FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

MeshedSurface< Face > Class Template Reference

A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMesh, which actually refers to the cell faces of a volume mesh. More...

#include <surfMesh/MeshedSurface.H>


Detailed Description

template<class Face>
class Foam::MeshedSurface< Face >

A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMesh, which actually refers to the cell faces of a volume mesh.

A MeshedSurface can have zero or more surface zones (roughly equivalent to faceZones for a polyMesh). If surface zones are defined, they must be contiguous and cover all of the faces.

The MeshedSurface is intended for surfaces from a variety of sources.

  • A set of points and faces without any surface zone information.
  • A set of points and faces with randomly ordered zone information. This could arise, for example, from reading external file formats such as STL, etc.
Source files

Definition at line 82 of file MeshedSurface.H.

Inheritance diagram for MeshedSurface< Face >:
Collaboration diagram for MeshedSurface< Face >:

List of all members.

Public Member Functions

 ClassName ("MeshedSurface")
 Runtime type information.
 MeshedSurface ()
 Construct null.
 MeshedSurface (const Xfer< pointField > &, const Xfer< List< Face > > &, const Xfer< surfZoneList > &)
 Construct by transferring components (points, faces, zones).
 MeshedSurface (const Xfer< pointField > &, const Xfer< List< Face > > &, const UList< label > &zoneSizes=UList< label >(), const UList< word > &zoneNames=UList< word >())
 Construct by transferring components (points, faces).
 MeshedSurface (const MeshedSurface &)
 Construct as copy.
 MeshedSurface (const UnsortedMeshedSurface< Face > &)
 Construct from a UnsortedMeshedSurface.
 MeshedSurface (const polyBoundaryMesh &, const bool globalPoints=false)
 Construct from a boundary mesh with local points/faces.
 MeshedSurface (const surfMesh &)
 Construct from a surfMesh.
 MeshedSurface (const Xfer< UnsortedMeshedSurface< Face > > &)
 Construct by transferring the contents from a UnsortedMeshedSurface.
 MeshedSurface (const Xfer< MeshedSurface< Face > > &)
 Construct by transferring the contents from a MeshedSurface.
 MeshedSurface (const fileName &)
 Construct from file name (uses extension to determine type)
 MeshedSurface (const fileName &, const word &ext)
 Construct from file name (uses extension to determine type)
 MeshedSurface (const Time &, const word &surfName="")
 Construct from database.
 declareRunTimeSelectionTable (autoPtr, MeshedSurface, fileExtension,(const fileName &name),(name))
virtual  ~MeshedSurface ()
 declareMemberFunctionSelectionTable (void, UnsortedMeshedSurface, write, fileExtension,(const fileName &name, const MeshedSurface< Face > &surf),(name, surf))
label  size () const
 The surface size is the number of faces.
const List< Face > &  faces () const
 Return const access to the faces.
const List< surfZone > &  surfZones () const
 Const access to the surface zones.
virtual void  addZones (const UList< surfZone > &, const bool cullEmpty=false)
 Add surface zones.
virtual void  addZones (const UList< label > &sizes, const UList< word > &names, const bool cullEmpty=false)
 Add surface zones.
virtual void  addZones (const UList< label > &sizes, const bool cullEmpty=false)
 Add surface zones.
virtual void  removeZones ()
 Remove surface zones.
virtual void  clear ()
 Clear all storage.
virtual void  movePoints (const pointField &)
 Move points.
virtual void  scalePoints (const scalar &)
 Scale points. A non-positive factor is ignored.
virtual void  reset (const Xfer< pointField > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
 Reset primitive data (points, faces and zones)
virtual void  reset (const Xfer< List< point > > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
 Reset primitive data (points, faces and zones)
virtual void  cleanup (const bool verbose)
 Remove invalid faces.
virtual bool  stitchFaces (const scalar tol=SMALL, const bool verbose=false)
virtual bool  checkFaces (const bool verbose=false)
virtual label  triangulate ()
 Triangulate in-place, returning the number of triangles added.
virtual label  triangulate (List< label > &faceMap)
 Triangulate in-place, returning the number of triangles added.
MeshedSurface  subsetMesh (const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
 Return new surface.
MeshedSurface  subsetMesh (const labelHashSet &include) const
 Return new surface.
void  transfer (MeshedSurface< Face > &)
 Transfer the contents of the argument and annull the argument.
void  transfer (UnsortedMeshedSurface< Face > &)
 Transfer the contents of the argument and annull the argument.
Xfer< MeshedSurface< Face > >  xfer ()
 Transfer contents to the Xfer container.
bool  read (const fileName &, const word &ext)
 Read from file. Chooses reader based on explicit extension.
virtual bool  read (const fileName &)
 Read from file. Chooses reader based on detected extension.
void  writeStats (Ostream &os) const
virtual void  write (const fileName &name) const
 Generic write routine. Chooses writer based on extension.
void  write (const Time &, const word &surfName="") const
 Write to database.
void  operator= (const MeshedSurface< Face > &)
 operator MeshedSurfaceProxy< Face > () const
 Conversion operator to MeshedSurfaceProxy.
template<>
bool  isTri ()
template<>
label  triangulate ()
template<>
label  triangulate (List< label > &faceMap)

Static Public Member Functions

static bool  isTri ()
 Face storage only handles triangulated faces.
static bool  canRead (const fileName &, const bool verbose=false)
 Can we read this file format?
static bool  canReadType (const word &ext, const bool verbose=false)
 Can we read this file format?
static bool  canWriteType (const word &ext, const bool verbose=false)
 Can we write this file format?
static wordHashSet  readTypes ()
static wordHashSet  writeTypes ()
static autoPtr< MeshedSurface >  New (const fileName &, const word &ext)
 Select constructed from filename (explicit extension)
static autoPtr< MeshedSurface >  New (const fileName &)
 Select constructed from filename (implicit extension)
static void  write (const fileName &, const MeshedSurface< Face > &)
 Write to file.

Protected Member Functions

void  transcribe (MeshedSurface< face > &)
 Transfer points/zones and transcribe face -> triFace.
void  checkZones ()
 basic sanity check on zones
pointField &  storedPoints ()
 Non-const access to global points.
List< Face > &  storedFaces ()
 Non-const access to the faces.
surfZoneList &  storedZones ()
 Non-const access to the zones.
void  sortFacesAndStore (const Xfer< List< Face > > &unsortedFaces, const Xfer< List< label > > &zoneIds, const bool sorted)
 sort faces by zones and store sorted faces
virtual void  remapFaces (const UList< label > &faceMap)
 Set new zones from faceMap.
template<>
void  transcribe (MeshedSurface< face > &surf)
template<>
void  transcribe (MeshedSurface< face > &surf)

Friends

class  MeshedSurface
class  UnsortedMeshedSurface
class  surfMesh

Constructor & Destructor Documentation

Construct null.

MeshedSurface ( const Xfer< pointField > &   pointLst,
const Xfer< List< Face > > &   faceLst,
const Xfer< surfZoneList > &   zoneLst  
)

Construct by transferring components (points, faces, zones).

Definition at line 172 of file MeshedSurface.C.

MeshedSurface ( const Xfer< pointField > &   pointLst,
const Xfer< List< Face > > &   faceLst,
const UList< label > &   zoneSizes = UList<label>(),
const UList< word > &   zoneNames = UList<word>()  
)

Construct by transferring components (points, faces).

Use zone information if available

Definition at line 187 of file MeshedSurface.C.

References UList< T >::size().

MeshedSurface ( const MeshedSurface< Face > &    )

Construct as copy.

MeshedSurface ( const polyBoundaryMesh &   bMesh,
const bool   globalPoints = false  
)
MeshedSurface ( const Xfer< UnsortedMeshedSurface< Face > > &   surf  )

Construct by transferring the contents from a UnsortedMeshedSurface.

Definition at line 398 of file MeshedSurface.C.

MeshedSurface ( const Xfer< MeshedSurface< Face > > &   surf  )

Construct by transferring the contents from a MeshedSurface.

Definition at line 410 of file MeshedSurface.C.

MeshedSurface ( const fileName &   name  )

Construct from file name (uses extension to determine type)

Definition at line 353 of file MeshedSurface.C.

References MeshedSurface< Face >::read().

MeshedSurface ( const fileName &   name,
const word &   ext  
)

Construct from file name (uses extension to determine type)

Definition at line 341 of file MeshedSurface.C.

MeshedSurface ( const Time &   t,
const word &   surfName = ""  
)
~MeshedSurface (  ) [virtual]

Definition at line 424 of file MeshedSurface.C.


Member Function Documentation

void transcribe ( MeshedSurface< face > &    ) [protected]

Transfer points/zones and transcribe face -> triFace.

Referenced by MeshedSurface< Face >::MeshedSurface(), and OFSsurfaceFormat< Face >::read().

void checkZones (  ) [protected]

basic sanity check on zones

Definition at line 31 of file MeshedSurfaceZones.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, forAll, List< T >::size(), and WarningIn.

pointField& storedPoints (  ) [inline, protected]
List<Face>& storedFaces (  ) [inline, protected]
surfZoneList& storedZones (  ) [inline, protected]

Non-const access to the zones.

Definition at line 140 of file MeshedSurface.H.

Referenced by MeshedSurface< Face >::transcribe(), surfMesh::transfer(), and MeshedSurface< Face >::transfer().

void sortFacesAndStore ( const Xfer< List< Face > > &   unsortedFaces,
const Xfer< List< label > > &   zoneIds,
const bool   sorted  
) [protected]

sort faces by zones and store sorted faces

Definition at line 72 of file MeshedSurfaceZones.C.

References List< T >::clear(), forAll, List< T >::size(), and Foam::sortedOrder().

void remapFaces ( const UList< label > &   faceMap  ) [protected, virtual]

Set new zones from faceMap.

Reimplemented in cuttingPlane, and UnsortedMeshedSurface< Face >.

Definition at line 435 of file MeshedSurface.C.

References forAll, surfZone::size(), List< T >::size(), UList< T >::size(), and surfZone::start().

ClassName ( "MeshedSurface< Face >"    )

Runtime type information.

bool isTri (  ) [inline, static]

Face storage only handles triangulated faces.

Definition at line 41 of file MeshedSurface.C.

bool canRead ( const fileName &   name,
const bool   verbose = false  
) [static]

Can we read this file format?

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 99 of file MeshedSurface.C.

References fileName::ext(), and fileName::lessExt().

bool canReadType ( const word &   ext,
const bool   verbose = false  
) [static]

Can we read this file format?

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 65 of file MeshedSurface.C.

bool canWriteType ( const word &   ext,
const bool   verbose = false  
) [static]

Can we write this file format?

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 82 of file MeshedSurface.C.

Foam::wordHashSet readTypes (  ) [static]

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 48 of file MeshedSurface.C.

Foam::wordHashSet writeTypes (  ) [static]

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 55 of file MeshedSurface.C.

declareRunTimeSelectionTable ( autoPtr   ,
MeshedSurface< Face >   ,
fileExtension   ,
(const fileName &name)   ,
(name)    
)
Foam::autoPtr< Foam::MeshedSurface< Face > > New ( const fileName &   name,
const word &   ext  
) [static]

Select constructed from filename (explicit extension)

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 34 of file MeshedSurfaceNew.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, HashTable< T, Key, Hash >::found(), Foam::Info, name(), and Foam::nl.

declareMemberFunctionSelectionTable ( void   ,
UnsortedMeshedSurface< Face >   ,
write   ,
fileExtension   ,
(const fileName &name, const MeshedSurface< Face > &surf)   ,
(name, surf)    
)
void write ( const fileName &   name,
const MeshedSurface< Face > &   surf  
) [static]
label size (  ) const [inline]

The surface size is the number of faces.

Reimplemented from List< Face >.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 286 of file MeshedSurface.H.

Referenced by UnsortedMeshedSurface< Face >::size(), and GTSsurfaceFormat< Face >::write().

const List<surfZone>& surfZones (  ) const [inline]

Const access to the surface zones.

If zones are defined, they must be contiguous and cover the entire surface.

Definition at line 300 of file MeshedSurface.H.

Referenced by UnsortedMeshedSurface< Face >::transfer(), UnsortedMeshedSurface< Face >::UnsortedMeshedSurface(), and GTSsurfaceFormat< Face >::write().

void addZones ( const UList< surfZone > &   srfZones,
const bool   cullEmpty = false  
) [virtual]

Add surface zones.

Definition at line 111 of file MeshedSurfaceZones.C.

References forAll, List< T >::setSize(), and List< T >::size().

void addZones ( const UList< label > &   sizes,
const UList< word > &   names,
const bool   cullEmpty = false  
) [virtual]

Add surface zones.

Definition at line 134 of file MeshedSurfaceZones.C.

References forAll, List< T >::setSize(), and UList< T >::size().

void addZones ( const UList< label > &   sizes,
const bool   cullEmpty = false  
) [virtual]

Add surface zones.

Definition at line 166 of file MeshedSurfaceZones.C.

References forAll, Foam::name(), List< T >::setSize(), and UList< T >::size().

void removeZones (  ) [virtual]

Remove surface zones.

Definition at line 196 of file MeshedSurfaceZones.C.

void clear (  ) [virtual]

Clear all storage.

Reimplemented from List< Face >.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 484 of file MeshedSurface.C.

Referenced by OFSsurfaceFormat< Face >::read(), MeshedSurface< Face >::transcribe(), and UnsortedMeshedSurface< Face >::transfer().

void movePoints ( const pointField &   newPoints  ) [virtual]

Move points.

Definition at line 495 of file MeshedSurface.C.

void scalePoints ( const scalar &   scaleFactor  ) [virtual]

Scale points. A non-positive factor is ignored.

Definition at line 509 of file MeshedSurface.C.

void reset ( const Xfer< pointField > &   points,
const Xfer< List< Face > > &   faces,
const Xfer< surfZoneList > &   zones  
) [virtual]

Reset primitive data (points, faces and zones)

Note, optimized to avoid overwriting data (with Xfer::null)

Definition at line 527 of file MeshedSurface.C.

Referenced by OFSsurfaceFormat< Face >::read().

void reset ( const Xfer< List< point > > &   points,
const Xfer< List< Face > > &   faces,
const Xfer< surfZoneList > &   zones  
) [virtual]

Reset primitive data (points, faces and zones)

Note, optimized to avoid overwriting data (with Xfer::null)

Definition at line 556 of file MeshedSurface.C.

void cleanup ( const bool   verbose  ) [virtual]

Remove invalid faces.

Definition at line 585 of file MeshedSurface.C.

References Foam::checkTopology().

bool stitchFaces ( const scalar   tol = SMALL,
const bool   verbose = false  
) [virtual]
bool checkFaces ( const bool   verbose = false  ) [virtual]
Foam::label triangulate (  ) [virtual]

Triangulate in-place, returning the number of triangles added.

Definition at line 837 of file MeshedSurface.C.

Referenced by MeshedSurface< Face >::transcribe().

Foam::label triangulate ( List< label > &   faceMap  ) [virtual]

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.

Definition at line 848 of file MeshedSurface.C.

References List< T >::clear(), f(), UList< T >::fcIndex(), forAll, points, List< T >::setSize(), List< T >::size(), List< T >::transfer(), face::triangles(), and triFace().

Foam::MeshedSurface< Face > subsetMesh ( const labelHashSet &   include,
labelList &   pointMap,
labelList &   faceMap  
) const

Return new surface.

Returns return pointMap, faceMap from subsetMeshMap

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 954 of file MeshedSurface.C.

References f(), forAll, surfZone::size(), List< T >::size(), surfZone::start(), PatchTools::subsetMap(), and Foam::xferMove().

Foam::MeshedSurface< Face > subsetMesh ( const labelHashSet &   include  ) const

Return new surface.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 1042 of file MeshedSurface.C.

void transfer ( MeshedSurface< Face > &   surf  )

Transfer the contents of the argument and annull the argument.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 1054 of file MeshedSurface.C.

References MeshedSurface< Face >::storedFaces(), MeshedSurface< Face >::storedPoints(), MeshedSurface< Face >::storedZones(), and Foam::xferMove().

Foam::Xfer< Foam::MeshedSurface< Face > > xfer (  )

Transfer contents to the Xfer container.

Reimplemented from List< Face >.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 1112 of file MeshedSurface.C.

References Foam::xferMove().

bool read ( const fileName &   name,
const word &   ext  
)

Read from file. Chooses reader based on explicit extension.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 1138 of file MeshedSurface.C.

References clear().

Referenced by MeshedSurface< Face >::MeshedSurface().

void writeStats ( Ostream &   os  ) const

Definition at line 33 of file MeshedSurfaceIO.C.

References Foam::endl(), forAll, Foam::nl, points, and List< T >::size().

void write ( const Time &   t,
const word &   surfName = ""  
) const

Write to database.

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 1153 of file MeshedSurface.C.

References MeshedSurfaceProxy< Face >::write().

void operator= ( const MeshedSurface< Face > &    )
operator MeshedSurfaceProxy< Face > (  ) const

Conversion operator to MeshedSurfaceProxy.

Reimplemented in UnsortedMeshedSurface< Face >.

bool isTri (  ) [inline]

Definition at line 444 of file MeshedSurface.H.

label triangulate (  ) [inline]

Definition at line 451 of file MeshedSurface.H.

label triangulate ( List< label > &   faceMap  ) [inline]

Definition at line 458 of file MeshedSurface.H.

References List< T >::clear().

void transcribe ( MeshedSurface< face > &   surf  ) [protected]

Definition at line 60 of file MeshedSurfaceCore.C.


Friends And Related Function Documentation

MeshedSurface [friend]

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 88 of file MeshedSurface.H.

friend class UnsortedMeshedSurface [friend]

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 89 of file MeshedSurface.H.

friend class surfMesh [friend]

Reimplemented in UnsortedMeshedSurface< Face >.

Definition at line 90 of file MeshedSurface.H.


The documentation for this class was generated from the following files: