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(move(pointLst), move(faceLst), move(zoneLst));
192 if (zoneSizes.
size())
194 if (zoneNames.
size())
196 addZones(zoneSizes, zoneNames);
233 newFaces[faceMap[facei]] = origFaces[facei];
236 this->storedFaces().
transfer(newFaces);
253 this->transcribe(surf);
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);
328 this->transcribe(surf);
370 IOobject::MUST_READ_IF_MODIFIED,
385 this->transcribe(surf);
409 if (zones.
size() == 1)
414 else if (zones.
size())
423 zone.
start() = newFacei;
424 origEndI += zone.
size();
426 for (
label facei = newFacei; facei < faceMap.
size(); ++facei)
428 if (faceMap[facei] < origEndI)
451 ParentType::clearOut();
453 storedPoints().clear();
454 storedFaces().clear();
455 storedZones().clear();
463 ParentType::movePoints(newPoints);
466 storedPoints() = newPoints;
474 if (scaleFactor > 0 && scaleFactor != 1.0)
479 ParentType::movePoints(newPoints);
481 storedPoints() = newPoints;
494 ParentType::clearOut();
500 storedPoints().transfer(pointLst);
505 storedFaces().transfer(faceLst);
510 storedZones().transfer(zoneLst);
523 ParentType::clearOut();
529 storedPoints().transfer(pointLst);
534 storedFaces().transfer(faceLst);
539 storedZones().transfer(zoneLst);
549 stitchFaces(small, verbose);
569 bool hasMerged =
mergePoints(pointLst, tol, verbose, pointMap, newPoints);
592 Face&
f = faceLst[facei];
595 f[fp] = pointMap[f[fp]];
599 if (f.collapse() >= 3)
601 if (newFacei != facei)
603 faceLst[newFacei] =
f;
605 faceMap[newFacei] = facei;
610 Pout<<
"MeshedSurface::stitchFaces : " 611 <<
"Removing collapsed face " << facei <<
endl 612 <<
" vertices :" << f <<
endl;
617 if (newFacei != faceLst.
size())
621 Pout<<
"MeshedSurface::stitchFaces : " 622 <<
"Removed " << faceLst.
size() - newFacei
626 faceMap.setSize(newFacei);
632 ParentType::clearOut();
644 bool changed =
false;
654 Face&
f = faceLst[facei];
657 if (f.collapse() >= 3)
661 if (f[fp] < 0 || f[fp] > maxPointi)
665 <<
" uses point indices outside point range 0.." 671 faceMap[facei] = facei;
683 <<
"face[" << facei <<
"] = " << f
684 <<
" does not have three unique vertices" <<
endl;
696 if (faceMap[facei] < 0)
701 const Face&
f = faceLst[facei];
705 const labelList& neighbours = fFaces[facei];
709 forAll(neighbours, neighI)
711 const label neiFacei = neighbours[neighI];
713 if (neiFacei <= facei || faceMap[neiFacei] < 0)
720 const Face& nei = faceLst[neiFacei];
729 <<
"faces share the same vertices:" <<
nl 730 <<
" face[" << facei <<
"] : " << f <<
nl 731 <<
" face[" << neiFacei <<
"] : " << nei <<
endl;
742 faceMap[facei] = facei;
754 if (changed || newFacei < faceLst.
size())
761 <<
"Removed " << faceLst.
size() - newFacei
762 <<
" illegal faces." <<
endl;
769 if (faceMap[facei] >= 0)
771 if (newFacei != facei)
773 faceLst[newFacei] = faceLst[facei];
775 faceMap[newFacei] = facei;
786 ParentType::clearOut();
814 const label n = faceLst[facei].nTriangles();
823 if (nTri <= faceLst.
size())
843 nTri -= faceLst.
size();
845 if (this->
points().empty())
852 const Face&
f = faceLst[facei];
854 for (
label fp = 1; fp < f.size() - 1; ++fp)
858 newFaces[newFacei] =
triFace(f[0], f[fp], f[fp1]);
859 faceMap[newFacei] = facei;
873 const face&
f = faceLst[facei];
877 for (
label triI = 0; triI < nTmp; triI++)
879 newFaces[newFacei] = Face
881 static_cast<labelUList&>(tmpTri[triI])
883 faceMap[newFacei] = facei;
900 ParentType::clearOut();
915 const pointField& locPoints = this->localPoints();
916 const List<Face>& locFaces = this->localFaces();
920 PatchTools::subsetMap(*
this, include, pointMap, faceMap);
927 newPoints[pointi] = locPoints[pointMap[pointi]];
928 oldToNew[pointMap[pointi]] = pointi;
935 newZones[zoneI].
size() = 0;
942 const label origFacei = faceMap[facei];
943 newFaces[facei] = Face(locFaces[origFacei]);
946 Face&
f = newFaces[facei];
949 f[fp] = oldToNew[f[fp]];
964 zone.
start() = newFacei;
965 origEndI += zone.
size();
967 for (
label facei = newFacei; facei < faceMap.
size(); ++facei)
969 if (faceMap[facei] < origEndI)
1001 return subsetMesh(include, pointMap, faceMap);
1006 template<
class Face>
1021 template<
class Face>
1032 if (zoneLst.
size() <= 1)
1048 newFaces[faceMap[facei]].transfer(oldFaces[facei]);
1065 template<
class Face>
1072 return read(unzipName, unzipName.
ext());
1076 return read(name, ext);
1082 template<
class Face>
1092 transfer(
New(name, ext)());
1097 template<
class Face>
1101 const word& surfName
1110 template<
class Face>
1115 this->storedPoints() = surf.
points();
1116 this->storedFaces() = surf.
faces();
1121 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 HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
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...
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
static wordHashSet writeTypes()
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
faceList & storedFaces()
Non-const access to the faces.
virtual void clear()
Clear all storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Return size of this zone in the face list.
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.
MeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
surfZoneList & storedZones()
Non-const access to the zones.
word ext() const
Return file name extension (part after last .)
Macros for easy insertion into run-time selection tables.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Various functions to operate on Lists.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual const pointField & points() const
Return raw points.
A list of faces which address into the list of points.
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.
bool found(const Key &) const
Return true if hashedEntry is found in table.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
virtual const faceList & faces() const
Return faces.
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.
label checkTopology(const polyMesh &, const bool, const bool, const autoPtr< surfaceWriter > &, const autoPtr< writer< scalar >> &)
const Field< PointType > & points() const
Return reference to global points.
const polyMesh & mesh() const
Return the mesh reference.
HashSet wordHashSet
A HashSet with word keys.
virtual const faceList & faces() const
Return raw faces.
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?
A surface mesh consisting of general polygon faces.
virtual void reset(pointField &&points, List< Face > &&faces, surfZoneList &&zones)
Reset primitive data (points, faces and zones)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
word name(const complex &)
Return a string representation of a complex.
List< surfZone > surfZoneList
const List< Face > & faces() const
Return const access to the faces.
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
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 UPtrList.
void setSize(const label)
Reset size of List.
static void write(const fileName &, const MeshedSurfaceProxy< Face > &)
Write to file.
label start() const
Return start label of this zone in the face list.
virtual void remapFaces(const labelUList &faceMap)
Set new zones from faceMap.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual const surfZoneList & surfZones() const
Return surface zones.
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...
prefixOSstream Pout(cout, "Pout")
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.
fileName lessExt() const
Return file name without extension (part before last .)
virtual bool stitchFaces(const scalar tol=small, const bool verbose=false)
pointField & storedPoints()
Non-const access to global points.
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return points.
A patch is a list of labels that address the faces in the global face list.
label size() const
Return the number of elements in the UList.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
PrimitivePatch< faceList, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points) ...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
virtual void movePoints(const pointField &)
Move points.
const List< surfZone > & surfZones() const
Const access to the surface zones.
MeshedSurface()
Construct null.
#define InfoInFunction
Report an information message using Foam::Info.