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);
127 typename writefileExtensionMemberFunctionTable::iterator mfIter =
128 writefileExtensionMemberFunctionTablePtr_->find(ext);
130 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
135 if (supported.
found(ext))
142 <<
"Unknown file extension " << ext <<
nl <<
nl 143 <<
"Valid types are :" <<
endl 144 << (supported | writeTypes())
150 mfIter()(
name, surf);
175 reset(pointLst, faceLst, zoneLst);
192 if (zoneSizes.
size())
194 if (zoneNames.
size())
233 newFaces[faceMap[facei]] = origFaces[facei];
261 const bool useGlobalPoints
284 useGlobalPoints ? mesh.
points() : allBoundary.localPoints()
290 useGlobalPoints ? allBoundary : allBoundary.localFaces()
297 label startFacei = 0;
314 startFacei += p.size();
318 newZones.setSize(nZone);
434 if (zones.
size() == 1)
439 else if (zones.
size())
448 zone.
start() = newFacei;
449 origEndI += zone.
size();
451 for (
label facei = newFacei; facei < faceMap.
size(); ++facei)
453 if (faceMap[facei] < origEndI)
499 if (scaleFactor > 0 && scaleFactor != 1.0)
594 bool hasMerged =
mergePoints(pointLst, tol, verbose, pointMap, newPoints);
617 Face&
f = faceLst[facei];
620 f[fp] = pointMap[f[fp]];
624 if (f.collapse() >= 3)
626 if (newFacei != facei)
628 faceLst[newFacei] =
f;
630 faceMap[newFacei] = facei;
635 Pout<<
"MeshedSurface::stitchFaces : " 636 <<
"Removing collapsed face " << facei <<
endl 637 <<
" vertices :" << f <<
endl;
642 if (newFacei != faceLst.
size())
646 Pout<<
"MeshedSurface::stitchFaces : " 647 <<
"Removed " << faceLst.
size() - newFacei
651 faceMap.setSize(newFacei);
669 bool changed =
false;
679 Face&
f = faceLst[facei];
682 if (f.collapse() >= 3)
686 if (f[fp] < 0 || f[fp] > maxPointi)
690 <<
" uses point indices outside point range 0.." 696 faceMap[facei] = facei;
708 <<
"face[" << facei <<
"] = " << f
709 <<
" does not have three unique vertices" <<
endl;
721 if (faceMap[facei] < 0)
726 const Face&
f = faceLst[facei];
730 const labelList& neighbours = fFaces[facei];
734 forAll(neighbours, neighI)
736 const label neiFacei = neighbours[neighI];
738 if (neiFacei <= facei || faceMap[neiFacei] < 0)
745 const Face& nei = faceLst[neiFacei];
754 <<
"faces share the same vertices:" <<
nl 755 <<
" face[" << facei <<
"] : " << f <<
nl 756 <<
" face[" << neiFacei <<
"] : " << nei <<
endl;
767 faceMap[facei] = facei;
779 if (changed || newFacei < faceLst.
size())
786 <<
"Removed " << faceLst.
size() - newFacei
787 <<
" illegal faces." <<
endl;
794 if (faceMap[facei] >= 0)
796 if (newFacei != facei)
798 faceLst[newFacei] = faceLst[facei];
800 faceMap[newFacei] = facei;
839 const label n = faceLst[facei].nTriangles();
848 if (nTri <= faceLst.
size())
868 nTri -= faceLst.
size();
877 const Face&
f = faceLst[facei];
879 for (
label fp = 1; fp < f.size() - 1; ++fp)
883 newFaces[newFacei] =
triFace(f[0], f[fp], f[fp1]);
884 faceMap[newFacei] = facei;
898 const face&
f = faceLst[facei];
902 for (
label triI = 0; triI < nTmp; triI++)
904 newFaces[newFacei] = Face
906 static_cast<labelUList&>(tmpTri[triI])
908 faceMap[newFacei] = facei;
952 newPoints[pointi] = locPoints[pointMap[pointi]];
953 oldToNew[pointMap[pointi]] = pointi;
960 newZones[zoneI].
size() = 0;
967 const label origFacei = faceMap[facei];
968 newFaces[facei] = Face(locFaces[origFacei]);
971 Face&
f = newFaces[facei];
974 f[fp] = oldToNew[f[fp]];
989 zone.
start() = newFacei;
990 origEndI += zone.
size();
992 for (
label facei = newFacei; facei < faceMap.
size(); ++facei)
994 if (faceMap[facei] < origEndI)
1019 template<
class Face>
1026 return subsetMesh(include, pointMap, faceMap);
1031 template<
class Face>
1046 template<
class Face>
1057 if (zoneLst.
size() <= 1)
1073 newFaces[faceMap[facei]].transfer(oldFaces[facei]);
1089 template<
class Face>
1097 template<
class Face>
1104 return read(unzipName, unzipName.
ext());
1108 return read(name, ext);
1114 template<
class Face>
1129 template<
class Face>
1133 const word& surfName
1142 template<
class Face>
1153 template<
class Face>
bool read(const fileName &, const word &ext)
Read from file. Chooses reader based on explicit extension.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
virtual void clear()
Clear all storage.
A simple container for copying or transferring objects of type <T>.
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
virtual void movePoints(const Field< point > &)
Correct patch after moving points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual const surfZoneList & surfZones() const
Return surface zones.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
virtual ~MeshedSurface()
Destructor.
virtual const faceList & faces() const
Return faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
surfZoneList & storedZones()
Non-const access to the zones.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
bool checkTopology(const bool report=false, labelHashSet *setPtr=NULL) const
Check surface formed by patch for manifoldness (see above).
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
static wordHashSet writeTypes()
const List< Face > & faces() const
Return const access to the faces.
faceList & storedFaces()
Non-const access to the faces.
virtual void clear()
Clear all storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Field< point > & points() const
Return reference to global points.
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
void transfer(MeshedSurface< Face > &)
Transfer the contents of the argument and annul the argument.
virtual const pointField & points() const
Return points.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
surfZoneList & storedZones()
Non-const access to the zones.
static autoPtr< MeshedSurface > New(const fileName &, const word &ext)
Select constructed from filename (explicit extension)
Macros for easy insertion into run-time selection tables.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
virtual const pointField & points() const
Return raw points.
Various functions to operate on Lists.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
virtual void reset(const Xfer< pointField > &points, const Xfer< List< Face >> &faces, const Xfer< surfZoneList > &zones)
Reset primitive data (points, faces and zones)
A List obtained as a section of another List.
void operator=(const MeshedSurface< Face > &)
vectorField pointField
pointField is a vectorField.
static wordHashSet readTypes()
List< Face > & storedFaces()
Non-const access to the faces.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
pointField & storedPoints()
Non-const access to global points.
virtual void cleanup(const bool verbose)
Remove invalid faces.
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
HashSet wordHashSet
A HashSet with word keys.
const word & name() const
Return name.
const polyMesh & mesh() const
Return the mesh reference.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static bool isTri()
Face storage only handles triangulated faces.
static void write(const fileName &, const MeshedSurface< Face > &)
Write to file.
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format?
bool found(const Key &) const
Return true if hashedEntry is found in table.
A surface mesh consisting of general polygon faces.
prefixOSstream Pout(cout,"Pout")
const List< surfZone > & surfZones() const
Const access to the surface zones.
label start() const
Return start label of this zone in the face list.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
fileName lessExt() const
Return file name without extension (part before last .)
label size() const
Return size of this zone in the face list.
word name(const complex &)
Return a string representation of a complex.
const labelListList & faceFaces() const
Return face-face addressing.
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
label size() const
Return the number of elements in the UList.
void setSize(const label)
Reset size of List.
static void write(const fileName &, const MeshedSurfaceProxy< Face > &)
Write to file.
virtual void remapFaces(const labelUList &faceMap)
Set new zones from faceMap.
#define WarningInFunction
Report a warning using Foam::Warning.
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
virtual bool checkFaces(const bool verbose=false)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static bool canRead(const fileName &, const bool verbose=false)
Can we read this file format?
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.
word ext() const
Return file name extension (part after last .)
Xfer< MeshedSurface< Face > > xfer()
Transfer contents to the Xfer container.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
pointField & storedPoints()
Non-const access to global points.
virtual void addZones(const UList< surfZone > &, const bool cullEmpty=false)
Add surface zones.
Mesh consisting of general polyhedral cells.
void transcribe(MeshedSurface< face > &)
Transfer points/zones and transcribe face -> triFace.
A patch is a list of labels that address the faces in the global face list.
virtual const faceList & faces() const
Return raw faces.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
PrimitivePatch< face, List, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points) ...
label nInternalFaces() const
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
virtual void movePoints(const pointField &)
Move points.
const Field< point > & localPoints() const
Return pointField of points in patch.
label size() const
Return the number of elements in the UPtrList.
MeshedSurface()
Construct null.
virtual bool stitchFaces(const scalar tol=SMALL, const bool verbose=false)
MeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
#define InfoInFunction
Report an information message using Foam::Info.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.