Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
3aba0e28
Commit
3aba0e28
authored
Feb 05, 2009
by
Mark Olesen
Browse files
surfMesh, surfaceRegistry re-working
parent
a4d0094e
Changes
16
Hide whitespace changes
Inline
Side-by-side
applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
View file @
3aba0e28
...
...
@@ -83,10 +83,24 @@ int main(int argc, char *argv[])
argList
::
validOptions
.
insert
(
"from"
,
"sourceCoordinateSystem"
);
argList
::
validOptions
.
insert
(
"to"
,
"targetCoordinateSystem"
);
argList
args
(
argc
,
argv
);
Time
runTime
(
args
.
rootPath
(),
args
.
caseName
());
# include "setRootCase.H"
# include "createTime.H"
const
stringList
&
params
=
args
.
additionalArgs
();
// try for the latestTime, but create "constant" as needed
instantList
Times
=
runTime
.
times
();
if
(
Times
.
size
())
{
label
startTime
=
Times
.
size
()
-
1
;
runTime
.
setTime
(
Times
[
startTime
],
startTime
);
}
else
{
runTime
.
setTime
(
instant
(
0
,
runTime
.
constant
()),
0
);
}
fileName
importName
(
params
[
0
]);
word
exportName
(
"default"
);
...
...
@@ -201,7 +215,6 @@ int main(int argc, char *argv[])
MeshedSurface
<
face
>
surf
(
importName
);
if
(
args
.
options
().
found
(
"clean"
))
...
...
src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C
View file @
3aba0e28
...
...
@@ -49,8 +49,8 @@ Foam::BasicMeshedSurface<Face>::BasicMeshedSurface()
template
<
class
Face
>
Foam
::
BasicMeshedSurface
<
Face
>::
BasicMeshedSurface
(
const
Xfer
<
pointField
>&
pointLst
,
const
Xfer
<
List
<
Face
>
>&
faceLst
const
Xfer
<
pointField
>&
pointLst
,
const
Xfer
<
List
<
Face
>
>&
faceLst
)
:
ParentType
(
List
<
Face
>
(),
pointField
())
...
...
@@ -112,8 +112,8 @@ void Foam::BasicMeshedSurface<Face>::scalePoints(const scalar& scaleFactor)
template
<
class
Face
>
void
Foam
::
BasicMeshedSurface
<
Face
>::
reset
(
const
Xfer
<
pointField
>&
pointLst
,
const
Xfer
<
List
<
Face
>
>&
faceLst
const
Xfer
<
pointField
>&
pointLst
,
const
Xfer
<
List
<
Face
>
>&
faceLst
)
{
ParentType
::
clearOut
();
...
...
@@ -135,8 +135,8 @@ void Foam::BasicMeshedSurface<Face>::reset
template
<
class
Face
>
void
Foam
::
BasicMeshedSurface
<
Face
>::
reset
(
const
Xfer
<
List
<
point
>
>&
pointLst
,
const
Xfer
<
List
<
Face
>
>&
faceLst
const
Xfer
<
List
<
point
>
>&
pointLst
,
const
Xfer
<
List
<
Face
>
>&
faceLst
)
{
ParentType
::
clearOut
();
...
...
@@ -556,7 +556,7 @@ void Foam::BasicMeshedSurface<Face>::writeStats(Ostream& os) const
}
os
<<
"faces : "
<<
this
->
size
()
<<
" (tri:"
<<
nTri
<<
" quad:"
<<
nQuad
<<
" (tri:"
<<
nTri
<<
" quad:"
<<
nQuad
<<
" poly:"
<<
(
this
->
size
()
-
nTri
-
nQuad
)
<<
")"
<<
nl
;
}
...
...
src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.H
View file @
3aba0e28
...
...
@@ -59,7 +59,8 @@ class BasicMeshedSurface
public
PrimitivePatch
<
Face
,
::
Foam
::
List
,
pointField
,
point
>
{
//- Typedefs for convenience
// Private typedefs
typedef
PrimitivePatch
<
Face
,
...
...
@@ -70,6 +71,7 @@ class BasicMeshedSurface
ParentType
;
protected:
// Protected Member Functions
//- Non-const access to global points
...
...
@@ -103,8 +105,8 @@ public:
//- Construct by transferring components (points, faces).
BasicMeshedSurface
(
const
Xfer
<
pointField
>&
,
const
Xfer
<
List
<
Face
>
>&
const
Xfer
<
pointField
>&
,
const
Xfer
<
List
<
Face
>
>&
);
// Destructor
...
...
@@ -135,15 +137,15 @@ public:
//- Transfer components (points, faces).
virtual
void
reset
(
const
Xfer
<
pointField
>&
,
const
Xfer
<
List
<
Face
>
>&
const
Xfer
<
pointField
>&
,
const
Xfer
<
List
<
Face
>
>&
);
//- Transfer components (points, faces).
virtual
void
reset
(
const
Xfer
<
List
<
point
>
>&
,
const
Xfer
<
List
<
Face
>
>&
const
Xfer
<
List
<
point
>
>&
,
const
Xfer
<
List
<
Face
>
>&
);
//- Remove invalid faces
...
...
@@ -160,14 +162,12 @@ public:
const
bool
verbose
=
false
);
//- Triangulate in-place
// Returning the number of triangles added
// Optionally returning a map of original face Ids (zero-sized when
// no triangulation was done)
//- Triangulate in-place, returning the number of triangles added
virtual
label
triangulate
();
//- Triangulate in-place, setting a map of original face Ids
// faceMap is zero-sized when no triangulation was done
//- Triangulate in-place, returning the number of triangles added
// and setting a map of original face Ids.
// The faceMap is zero-sized when no triangulation was done.
virtual
label
triangulate
(
List
<
label
>&
faceMap
);
...
...
src/surfMesh/Make/options
View file @
3aba0e28
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude
LIB_LIBS = \
-ltriSurface
src/surfMesh/MeshedSurface/MeshedSurface.C
View file @
3aba0e28
...
...
@@ -340,9 +340,9 @@ Foam::MeshedSurface<Face>::MeshedSurface(Istream& is)
template
<
class
Face
>
Foam
::
MeshedSurface
<
Face
>::
MeshedSurface
(
const
Time
&
d
)
Foam
::
MeshedSurface
<
Face
>::
MeshedSurface
(
const
Time
&
d
,
const
word
&
surfName
)
{
read
(
IFstream
(
findMeshName
(
d
))());
read
(
IFstream
(
findMesh
File
(
d
,
surf
Name
))());
}
...
...
@@ -822,9 +822,9 @@ bool Foam::MeshedSurface<Face>::read
template
<
class
Face
>
void
Foam
::
MeshedSurface
<
Face
>::
write
(
const
Time
&
d
)
const
void
Foam
::
MeshedSurface
<
Face
>::
write
(
const
Time
&
d
,
const
word
&
surfName
)
const
{
write
(
OFstream
(
findMeshName
(
d
))());
write
(
OFstream
(
findMesh
File
(
d
,
surf
Name
))());
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
...
...
src/surfMesh/MeshedSurface/MeshedSurface.H
View file @
3aba0e28
...
...
@@ -204,7 +204,7 @@ public:
MeshedSurface
(
Istream
&
);
//- Construct from objectRegistry
MeshedSurface
(
const
Time
&
);
MeshedSurface
(
const
Time
&
,
const
word
&
surfName
=
""
);
//- Construct as copy
MeshedSurface
(
const
MeshedSurface
&
);
...
...
@@ -348,7 +348,7 @@ public:
}
//- Write to database
void
write
(
const
Time
&
)
const
;
void
write
(
const
Time
&
,
const
word
&
surfName
=
""
)
const
;
// Member operators
...
...
src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
View file @
3aba0e28
...
...
@@ -25,17 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include
"MeshedSurface.H"
#include
"UnsortedMeshedSurface.H"
#include
"IFstream.H"
#include
"OFstream.H"
#include
"Time.H"
#include
"ListOps.H"
#include
"polyBoundaryMesh.H"
#include
"polyMesh.H"
#include
"surfMesh.H"
#include
"primitivePatch.H"
#include
"addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
...
...
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
View file @
3aba0e28
...
...
@@ -253,9 +253,13 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(Istream& is)
template
<
class
Face
>
Foam
::
UnsortedMeshedSurface
<
Face
>::
UnsortedMeshedSurface
(
const
Time
&
d
)
Foam
::
UnsortedMeshedSurface
<
Face
>::
UnsortedMeshedSurface
(
const
Time
&
d
,
const
word
&
surfName
)
{
read
(
IFstream
(
findMeshName
(
d
))());
read
(
IFstream
(
findMesh
File
(
d
,
surf
Name
))());
}
...
...
@@ -631,9 +635,13 @@ bool Foam::UnsortedMeshedSurface<Face>::read
template
<
class
Face
>
void
Foam
::
UnsortedMeshedSurface
<
Face
>::
write
(
const
Time
&
d
)
const
void
Foam
::
UnsortedMeshedSurface
<
Face
>::
write
(
const
Time
&
d
,
const
word
&
surfName
)
const
{
write
(
OFstream
(
findMeshName
(
d
))());
write
(
OFstream
(
findMesh
File
(
d
,
surf
Name
))());
}
...
...
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
View file @
3aba0e28
...
...
@@ -208,7 +208,7 @@ public:
UnsortedMeshedSurface
(
Istream
&
);
//- Construct from objectRegistry
UnsortedMeshedSurface
(
const
Time
&
);
UnsortedMeshedSurface
(
const
Time
&
,
const
word
&
surfName
=
""
);
//- Construct as copy
UnsortedMeshedSurface
(
const
UnsortedMeshedSurface
<
Face
>&
);
...
...
@@ -364,7 +364,7 @@ public:
}
//- Write to database
void
write
(
const
Time
&
)
const
;
void
write
(
const
Time
&
,
const
word
&
surfName
=
""
)
const
;
// Member operators
...
...
src/surfMesh/surfMesh/surfMesh.C
View file @
3aba0e28
...
...
@@ -36,10 +36,8 @@ License
defineTypeNameAndDebug
(
Foam
::
surfMesh
,
0
);
Foam
::
word
Foam
::
surfMesh
::
defaultName
=
"default"
;
Foam
::
word
Foam
::
surfMesh
::
meshSubDir
=
"surfMesh"
;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void
Foam
::
surfMesh
::
oneZone
()
...
...
@@ -69,9 +67,10 @@ void Foam::surfMesh::oneZone()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
surfMesh
::
surfMesh
(
const
IOobject
&
io
)
Foam
::
surfMesh
::
surfMesh
(
const
IOobject
&
io
,
const
word
&
surfName
)
:
surfaceRegistry
(
io
.
db
(),
io
.
name
()),
surfaceRegistry
(
io
.
db
(),
(
surfName
.
size
()
?
surfName
:
io
.
name
())
)
,
surfMeshAllocator
(
IOobject
...
...
@@ -93,7 +92,7 @@ Foam::surfMesh::surfMesh(const IOobject& io)
IOobject
::
NO_WRITE
)
),
MeshReference
(
io
Faces_
,
io
Points_
),
MeshReference
(
stored
Faces_
,
stored
Points_
),
surfZones_
(
IOobject
...
...
@@ -114,10 +113,10 @@ Foam::surfMesh::surfMesh
const
IOobject
&
io
,
const
Xfer
<
pointField
>&
pointLst
,
const
Xfer
<
faceList
>&
faceLst
,
const
bool
syncPar
const
word
&
surfName
)
:
surfaceRegistry
(
io
,
io
.
name
()),
surfaceRegistry
(
io
.
db
(),
(
surfName
.
size
()
?
surfName
:
io
.
name
())
)
,
surfMeshAllocator
(
IOobject
...
...
@@ -141,7 +140,7 @@ Foam::surfMesh::surfMesh
),
faceLst
),
MeshReference
(
io
Faces_
,
io
Points_
),
MeshReference
(
stored
Faces_
,
stored
Points_
),
surfZones_
(
IOobject
...
...
@@ -157,62 +156,14 @@ Foam::surfMesh::surfMesh
{}
Foam
::
surfMesh
::
surfMesh
(
const
IOobject
&
io
,
const
MeshedSurface
<
face
>&
surf
,
const
bool
syncPar
)
:
surfaceRegistry
(
io
,
io
.
name
()),
surfMeshAllocator
(
IOobject
(
"points"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
surf
.
points
(),
IOobject
(
"faces"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
surf
.
faces
()
),
MeshReference
(
ioFaces_
,
ioPoints_
),
surfZones_
(
IOobject
(
"surfZones"
,
instance
(),
meshSubDir
,
*
this
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
surf
.
zones
()
)
{}
Foam
::
surfMesh
::
surfMesh
(
const
IOobject
&
io
,
const
Xfer
<
MeshedSurface
<
face
>
>&
surf
,
const
bool
syncPar
const
word
&
surfName
)
:
surfaceRegistry
(
io
,
io
.
name
()),
surfaceRegistry
(
io
.
db
(),
(
surfName
.
size
()
?
surfName
:
io
.
name
())
)
,
surfMeshAllocator
(
IOobject
...
...
@@ -236,7 +187,7 @@ Foam::surfMesh::surfMesh
),
faceList
()
),
MeshReference
(
io
Faces_
,
io
Points_
),
MeshReference
(
stored
Faces_
,
stored
Points_
),
surfZones_
(
IOobject
...
...
@@ -251,7 +202,11 @@ Foam::surfMesh::surfMesh
surfZoneList
()
)
{
transfer
(
surf
());
// We can also send Xfer<..>::null just to force initialization
if
(
&
surf
)
{
transfer
(
surf
());
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
...
...
@@ -280,12 +235,12 @@ void Foam::surfMesh::resetPrimitives
// Optimized to avoid overwriting data at all
if
(
&
points
)
{
io
Points_
.
transfer
(
points
());
stored
Points_
.
transfer
(
points
());
}
if
(
&
faces
)
{
io
Faces_
.
transfer
(
faces
());
stored
Faces_
.
transfer
(
faces
());
}
if
(
&
zones
)
...
...
@@ -308,21 +263,19 @@ void Foam::surfMesh::transfer
// Clear addressing.
MeshReference
::
clearGeom
();
io
Points_
.
transfer
(
surf
.
storedPoints
());
io
Faces_
.
transfer
(
surf
.
storedFaces
());
stored
Points_
.
transfer
(
surf
.
storedPoints
());
stored
Faces_
.
transfer
(
surf
.
storedFaces
());
surfZones_
.
transfer
(
surf
.
storedZones
());
}
void
Foam
::
surfMesh
::
rename
(
const
word
&
newName
)
{
surfaceRegistry
::
rename
(
newName
);
FatalErrorIn
(
"surfMesh::rename(const word&)
\n
"
)
<<
"rename does not work correctly
\n
"
<<
exit
(
FatalError
);
<<
"rename does not work correctly
\n
"
;
}
...
...
@@ -335,34 +288,34 @@ Foam::fileName Foam::surfMesh::meshDir() const
const
Foam
::
fileName
&
Foam
::
surfMesh
::
pointsInstance
()
const
{
return
io
Points_
.
instance
();
return
stored
Points_
.
instance
();
}
const
Foam
::
fileName
&
Foam
::
surfMesh
::
facesInstance
()
const
{
return
io
Faces_
.
instance
();
return
stored
Faces_
.
instance
();
}
Foam
::
label
Foam
::
surfMesh
::
nPoints
()
const
{
return
io
Points_
.
size
();
return
stored
Points_
.
size
();
}
Foam
::
label
Foam
::
surfMesh
::
nFaces
()
const
{
return
io
Faces_
.
size
();
return
stored
Faces_
.
size
();
}
const
Foam
::
pointField
&
Foam
::
surfMesh
::
points
()
const
{
return
io
Points_
;
return
stored
Points_
;
}
const
Foam
::
faceList
&
Foam
::
surfMesh
::
faces
()
const
{
return
io
Faces_
;
return
stored
Faces_
;
}
void
Foam
::
surfMesh
::
checkZones
()
...
...
src/surfMesh/surfMesh/surfMesh.H
View file @
3aba0e28
...
...
@@ -63,13 +63,13 @@ class MeshedSurface;
class
surfMeshAllocator
{
protected:
pointIOField
io
Points_
;
faceIOList
io
Faces_
;
pointIOField
stored
Points_
;
faceIOList
stored
Faces_
;
surfMeshAllocator
(
const
IOobject
&
ioPoints
,
const
IOobject
&
ioFaces
)
:
io
Points_
(
ioPoints
),
io
Faces_
(
ioFaces
)
stored
Points_
(
ioPoints
),
stored
Faces_
(
ioFaces
)
{}
surfMeshAllocator
...
...
@@ -80,8 +80,8 @@ protected:
const
faceList
&
faces
)
:
io
Points_
(
ioPoints
,
points
),
io
Faces_
(
ioFaces
,
faces
)
stored
Points_
(
ioPoints
,
points
),
stored
Faces_
(
ioFaces
,
faces
)
{}
surfMeshAllocator
...
...
@@ -92,8 +92,8 @@ protected:
const
Xfer
<
faceList
>&
faces
)
:
io
Points_
(
ioPoints
,
points
),
io
Faces_
(
ioFaces
,
faces
)
stored
Points_
(
ioPoints
,
points
),
stored
Faces_
(
ioFaces
,
faces
)
{}
};
...
...
@@ -160,6 +160,28 @@ private:
//- Disallow default bitwise assignment
void
operator
=
(
const
surfMesh
&
);
protected:
// Protected Member Functions
//- Non-const access to global points
pointIOField
&
storedPoints
()
{
return
surfMeshAllocator
::
storedPoints_
;
}
//- Non-const access to the faces
faceIOList
&
storedFaces
()
{
return
surfMeshAllocator
::
storedFaces_
;
}
//- Non-const access to the zones
surfZoneIOList
&
storedZones
()
{
return
surfZones_
;
}
public:
// Public typedefs
...
...
@@ -170,20 +192,13 @@ public:
//- Runtime type information
TypeName
(
"surfMesh"
);
//- Return the default surface name
static
word
defaultName
;
//- Return the mesh sub-directory name (usually "surfMesh")
//- Return the mesh sub-directory name (normally "surfMesh")
static
word
meshSubDir
;
//- Return the default zone name
static
word
defaultZoneName
;
// Constructors
//- Construct from IOobject
explicit
surfMesh
(
const
IOobject
&
io
);
//- Construct from IOobject
, with alternative surface name
explicit
surfMesh
(
const
IOobject
&
,
const
word
&
surfName
=
""
);
//- Construct by transferring components (points, faces) without zones.
// surfZones are added using addZones() member function
...
...
@@ -192,23 +207,15 @@ public:
const
IOobject
&
,
const
Xfer
<
pointField
>&
,
const
Xfer
<
faceList
>&
,
const
bool
syncPar
=
true
);
//- Construct copy from MeshedSurface
surfMesh
(
const
IOobject
&
,
const
MeshedSurface
<
face
>&
surf
,
const
bool
syncPar
=
true
const
word
&
surfName
=
""
);
//- Construct copy from MeshedSurface
//- Construct copy
/move
from MeshedSurface
surfMesh
(
const
IOobject
&
,
const
Xfer
<
MeshedSurface
<
face
>
>&
surf
,
const
bool
syncPar
=
true
const
word
&
surfName
=
""
);
// Destructor
...
...
@@ -224,7 +231,7 @@ public:
fileName
meshDir
()
const
;
//- Return the current instance directory for points
// Used in the consruction of ge
m
ometric mesh data dependent
// Used in the consruction of geometric mesh data dependent
// on points
const
fileName
&
pointsInstance
()
const
;
...
...
@@ -300,6 +307,7 @@ public:
);
//- Transfer the contents of the argument and annull the argument
void
transfer
(
MeshedSurface
<
face
>&
);
// Storage management
...
...
src/surfMesh/surfMesh/surfMeshIO.C
View file @
3aba0e28
...
...
@@ -37,11 +37,11 @@ void Foam::surfMesh::setInstance(const fileName& inst)
<<
"Resetting file instance to "
<<
inst
<<
endl
;
}
io
Points_
.
writeOpt
()
=
IOobject
::
AUTO_WRITE
;