50 return wordHashSet(*fileExtensionConstructorTablePtr_);
57 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
70 return fileFormats::surfaceFormatsCore::checkSupport
72 readTypes() | FriendType::readTypes(),
87 return fileFormats::surfaceFormatsCore::checkSupport
89 writeTypes() | ProxyType::writeTypes(),
109 return canReadType(ext, verbose);
122 Info<<
"MeshedSurface::write" 123 "(const fileName&, const MeshedSurface&) : " 124 "writing to " << name
130 typename writefileExtensionMemberFunctionTable::iterator mfIter =
131 writefileExtensionMemberFunctionTablePtr_->find(ext);
133 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
138 if (supported.
found(ext))
146 "MeshedSurface::write" 147 "(const fileName&, const MeshedSurface&)" 148 ) <<
"Unknown file extension " << ext <<
nl <<
nl 149 <<
"Valid types are :" <<
endl 150 << (supported | writeTypes())
156 mfIter()(
name, surf);
181 reset(pointLst, faceLst, zoneLst);
198 if (zoneSizes.
size())
200 if (zoneNames.
size())
239 newFaces[faceMap[faceI]] = origFaces[faceI];
267 const bool useGlobalPoints
290 useGlobalPoints ? mesh.
points() : allBoundary.localPoints()
296 useGlobalPoints ? allBoundary : allBoundary.localFaces()
303 label startFaceI = 0;
320 startFaceI += p.size();
324 newZones.setSize(nZone);
440 if (zones.
size() == 1)
445 else if (zones.
size())
454 zone.
start() = newFaceI;
455 origEndI += zone.
size();
457 for (
label faceI = newFaceI; faceI < faceMap.
size(); ++faceI)
459 if (faceMap[faceI] < origEndI)
505 if (scaleFactor > 0 && scaleFactor != 1.0)
600 bool hasMerged =
mergePoints(pointLst, tol, verbose, pointMap, newPoints);
609 Info<<
"MeshedSurface::stitchFaces : Renumbering all faces" 624 Face&
f = faceLst[faceI];
627 f[fp] = pointMap[f[fp]];
631 if (f.collapse() >= 3)
633 if (newFaceI != faceI)
635 faceLst[newFaceI] =
f;
637 faceMap[newFaceI] = faceI;
642 Pout<<
"MeshedSurface::stitchFaces : " 643 <<
"Removing collapsed face " << faceI <<
endl 644 <<
" vertices :" << f <<
endl;
649 if (newFaceI != faceLst.
size())
653 Pout<<
"MeshedSurface::stitchFaces : " 654 <<
"Removed " << faceLst.
size() - newFaceI
658 faceMap.setSize(newFaceI);
676 bool changed =
false;
686 Face&
f = faceLst[faceI];
689 if (f.collapse() >= 3)
693 if (f[fp] < 0 || f[fp] > maxPointI)
697 <<
" uses point indices outside point range 0.." 703 faceMap[faceI] = faceI;
716 "MeshedSurface::checkFaces(bool verbose)" 717 ) <<
"face[" << faceI <<
"] = " << f
718 <<
" does not have three unique vertices" <<
endl;
730 if (faceMap[faceI] < 0)
735 const Face&
f = faceLst[faceI];
739 const labelList& neighbours = fFaces[faceI];
743 forAll(neighbours, neighI)
745 const label neiFaceI = neighbours[neighI];
747 if (neiFaceI <= faceI || faceMap[neiFaceI] < 0)
754 const Face& nei = faceLst[neiFaceI];
764 "MeshedSurface::checkFaces(bool verbose)" 765 ) <<
"faces share the same vertices:" <<
nl 766 <<
" face[" << faceI <<
"] : " << f <<
nl 767 <<
" face[" << neiFaceI <<
"] : " << nei <<
endl;
778 faceMap[faceI] = faceI;
790 if (changed || newFaceI < faceLst.
size())
798 "MeshedSurface::checkFaces(bool verbose)" 799 ) <<
"Removed " << faceLst.
size() - newFaceI
800 <<
" illegal faces." <<
endl;
807 if (faceMap[faceI] >= 0)
809 if (newFaceI != faceI)
811 faceLst[newFaceI] = faceLst[faceI];
813 faceMap[newFaceI] = faceI;
852 const label n = faceLst[faceI].nTriangles();
861 if (nTri <= faceLst.
size())
881 nTri -= faceLst.
size();
890 const Face&
f = faceLst[faceI];
892 for (
label fp = 1; fp < f.size() - 1; ++fp)
896 newFaces[newFaceI] =
triFace(f[0], f[fp], f[fp1]);
897 faceMap[newFaceI] = faceI;
911 const face&
f = faceLst[faceI];
915 for (
label triI = 0; triI < nTmp; triI++)
917 newFaces[newFaceI] = Face
919 static_cast<labelUList&>(tmpTri[triI])
921 faceMap[newFaceI] = faceI;
965 newPoints[pointI] = locPoints[pointMap[pointI]];
966 oldToNew[pointMap[pointI]] = pointI;
973 newZones[zoneI].
size() = 0;
980 const label origFaceI = faceMap[faceI];
981 newFaces[faceI] = Face(locFaces[origFaceI]);
984 Face&
f = newFaces[faceI];
987 f[fp] = oldToNew[f[fp]];
1002 zone.
start() = newFaceI;
1003 origEndI += zone.
size();
1005 for (
label faceI = newFaceI; faceI < faceMap.
size(); ++faceI)
1007 if (faceMap[faceI] < origEndI)
1032 template<
class Face>
1039 return subsetMesh(include, pointMap, faceMap);
1044 template<
class Face>
1059 template<
class Face>
1070 if (zoneLst.
size() <= 1)
1086 newFaces[faceMap[faceI]].transfer(oldFaces[faceI]);
1102 template<
class Face>
1110 template<
class Face>
1117 return read(unzipName, unzipName.
ext());
1121 return read(name, ext);
1127 template<
class Face>
1142 template<
class Face>
1146 const word& surfName
1155 template<
class Face>
1166 template<
class Face>
void transcribe(MeshedSurface< face > &)
Transfer points/zones and transcribe face -> triFace.
A surface mesh consisting of general polygon faces.
label start() const
Return start label of this zone in the face list.
word ext() const
Return file name extension (part after last .)
HashSet wordHashSet
A HashSet with word keys.
virtual void cleanup(const bool verbose)
Remove invalid faces.
const labelListList & faceFaces() const
Return face-face addressing.
pointField & storedPoints()
Non-const access to global points.
label size() const
Return the number of elements in the PtrList.
label size() const
Return size of this zone in the face list.
const List< surfZone > & surfZones() const
Const access to the surface zones.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Xfer< T > xferCopy(const T &)
const word & name() const
Return name.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
word name(const complex &)
Return a string representation of a complex.
virtual void remapFaces(const labelUList &faceMap)
Set new zones from faceMap.
Xfer< MeshedSurface< Face > > xfer()
Transfer contents to the Xfer container.
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
bool empty() const
Return true if the UList is empty (ie, size() is zero).
static wordHashSet readTypes()
static void write(const fileName &, const MeshedSurfaceProxy< Face > &)
Write to file.
surfZoneList & storedZones()
Non-const access to the zones.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
A simple container for copying or transferring objects of type <T>.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Various functions to operate on Lists.
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
MeshedSurface()
Construct null.
bool checkTopology(const bool report=false, labelHashSet *setPtr=NULL) const
Check surface formed by patch for manifoldness (see above).
vectorField pointField
pointField is a vectorField.
static wordHashSet writeTypes()
pointField & storedPoints()
Non-const access to global points.
static void write(const fileName &, const MeshedSurface< Face > &)
Write to file.
A patch is a list of labels that address the faces in the global face list.
virtual void clear()
Clear all storage.
virtual void clear()
Clear all storage.
static autoPtr< MeshedSurface > New(const fileName &, const word &ext)
Select constructed from filename (explicit extension)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A face is a list of labels corresponding to mesh vertices.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const Field< point > & localPoints() const
Return pointField of points in patch.
void clear()
Clear the list, i.e. set size to zero.
virtual const surfZoneList & surfZones() const
Return surface zones.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const List< Face > & faces() const
Return const access to the faces.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
virtual const pointField & points() const
Return raw points.
PrimitivePatch< face, List, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points) ...
virtual void reset(const Xfer< pointField > &points, const Xfer< List< Face > > &faces, const Xfer< surfZoneList > &zones)
Reset primitive data (points, faces and zones)
surfZoneList & storedZones()
Non-const access to the zones.
virtual ~MeshedSurface()
Destructor.
label size() const
Return the number of elements in the UList.
Macros for easy insertion into run-time selection tables.
A surface zone on a MeshedSurface.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
label nInternalFaces() const
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
virtual void addZones(const UList< surfZone > &, const bool cullEmpty=false)
Add surface zones.
void operator=(const MeshedSurface< Face > &)
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return points.
static bool isTri()
Face storage only handles triangulated faces.
const polyMesh & mesh() const
Return the mesh reference.
A class for handling file names.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A HashTable with keys but without contents.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
fileName lessExt() const
Return file name without extension (part before last .)
static void subsetMap(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &includeFaces, labelList &pointMap, labelList &faceMap)
Determine the mapping for a sub-patch.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
virtual void movePoints(const pointField &)
Move points.
A List obtained as a section of another List.
List< Face > & storedFaces()
Non-const access to the faces.
void transfer(MeshedSurface< Face > &)
Transfer the contents of the argument and annul the argument.
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format?
virtual const faceList & faces() const
Return raw faces.
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
MeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
virtual void movePoints(const Field< point > &)
Correct patch after moving points.
virtual const faceList & faces() const
Return faces.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
bool found(const Key &) const
Return true if hashedEntry is found in table.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
const Field< point > & points() const
Return reference to global points.
virtual bool checkFaces(const bool verbose=false)
virtual bool stitchFaces(const scalar tol=SMALL, const bool verbose=false)
prefixOSstream Pout(cout,"Pout")
bool read(const fileName &, const word &ext)
Read from file. Chooses reader based on explicit extension.
static bool canRead(const fileName &, const bool verbose=false)
Can we read this file format?
faceList & storedFaces()
Non-const access to the faces.