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())
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);
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)
476 ParentType::clearOut();
478 storedPoints().clear();
479 storedFaces().clear();
480 storedZones().clear();
488 ParentType::movePoints(newPoints);
491 storedPoints() = newPoints;
499 if (scaleFactor > 0 && scaleFactor != 1.0)
504 ParentType::movePoints(newPoints);
506 storedPoints() = newPoints;
519 ParentType::clearOut();
525 storedPoints().transfer(pointLst());
530 storedFaces().transfer(faceLst());
535 storedZones().transfer(zoneLst());
548 ParentType::clearOut();
554 storedPoints().transfer(pointLst());
559 storedFaces().transfer(faceLst());
564 storedZones().transfer(zoneLst());
574 stitchFaces(small, verbose);
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);
657 ParentType::clearOut();
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;
811 ParentType::clearOut();
839 const label n = faceLst[facei].nTriangles();
848 if (nTri <= faceLst.
size())
868 nTri -= faceLst.
size();
870 if (this->
points().empty())
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;
925 ParentType::clearOut();
940 const pointField& locPoints = this->localPoints();
941 const List<Face>& locFaces = this->localFaces();
945 PatchTools::subsetMap(*
this, include, pointMap, faceMap);
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>
1124 transfer(
New(name, ext)());
1129 template<
class Face>
1133 const word& surfName
1142 template<
class Face>
1147 this->storedPoints() = surf.
points();
1148 this->storedFaces() = surf.
faces();
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.
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.
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.
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.
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 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.
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.
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< point > & 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.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
word name(const complex &)
Return a string representation of a complex.
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.
Xfer< MeshedSurface< Face > > xfer()
Transfer contents to the Xfer container.
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< face, List, 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.