Go to the documentation of this file.
47 return wordHashSet(*fileExtensionConstructorTablePtr_);
53 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
66 return fileFormats::surfaceFormatsCore::checkSupport
68 readTypes() | FriendType::readTypes(),
83 return fileFormats::surfaceFormatsCore::checkSupport
85 writeTypes() | ProxyType::writeTypes(),
105 return canReadType(ext, verbose);
135 auto mfIter = writefileExtensionMemberFunctionTablePtr_->cfind(ext);
140 const wordHashSet& delegate = ProxyType::writeTypes();
142 if (delegate.
found(ext))
149 <<
"Unknown file extension " << ext <<
nl <<
nl
150 <<
"Valid types:" <<
nl
151 <<
flatOutput((delegate | writeTypes()).sortedToc()) <<
nl
157 mfIter()(
name, surf, options);
199 newFaces[
faceMap[facei]] = origFaces[facei];
202 this->storedFaces().
transfer(newFaces);
268 if (zoneSizes.
size())
270 if (zoneNames.
size())
272 addZones(zoneSizes, zoneNames);
294 if (zoneSizes.
size())
296 if (zoneNames.
size())
298 addZones(zoneSizes, zoneNames);
321 this->transcribe(surf);
329 const bool useGlobalPoints
343 mesh.nBoundaryFaces(),
344 mesh.nInternalFaces()
352 useGlobalPoints ?
mesh.points() : allBoundary.localPoints()
358 useGlobalPoints ? allBoundary : allBoundary.localFaces()
365 label startFacei = 0;
380 startFacei +=
p.size();
384 newZones.setSize(nZone);
389 this->transcribe(surf);
436 IOobject::MUST_READ_IF_MODIFIED,
446 std::move(*(
mesh.releaseGeom()))
449 this->transcribe(surf);
477 if (zones.size() == 1)
479 zones[0].size() =
faceMap.size();
490 zone.start() = newFacei;
491 origEndI +=
zone.size();
493 for (
label facei = newFacei; facei <
faceMap.size(); ++facei)
506 zone.size() = newFacei -
zone.start();
516 ParentType::clearOut();
518 storedPoints().clear();
519 storedFaces().clear();
520 storedZones().clear();
527 ParentType::clearGeom();
530 ParentType::movePoints(newPoints);
533 storedPoints() = newPoints;
541 if (scaleFactor > 0 && scaleFactor != 1.0)
543 ParentType::clearGeom();
548 ParentType::movePoints(newPoints);
550 storedPoints() = newPoints;
560 stitchFaces(SMALL, verbose);
580 bool hasMerged =
mergePoints(pointLst, tol, verbose, pointMap, newPoints);
593 pointLst.transfer(newPoints);
603 Face&
f = faceLst[facei];
606 f[fp] = pointMap[
f[fp]];
610 if (
f.collapse() >= 3)
612 if (newFacei != facei)
614 faceLst[newFacei] =
f;
621 Pout<<
"MeshedSurface::stitchFaces : "
622 <<
"Removing collapsed face " << facei <<
endl
623 <<
" vertices :" <<
f <<
endl;
628 if (newFacei != faceLst.size())
632 Pout<<
"MeshedSurface::stitchFaces : "
633 <<
"Removed " << faceLst.size() - newFacei
643 ParentType::clearOut();
656 bool changed =
false;
666 Face&
f = faceLst[facei];
669 if (
f.collapse() >= 3)
673 if (
f[fp] < 0 ||
f[fp] > maxPointi)
677 <<
" uses point indices outside point range 0.."
695 <<
"face[" << facei <<
"] = " <<
f
696 <<
" does not have three unique vertices" <<
endl;
713 const Face&
f = faceLst[facei];
717 const labelList& neighbours = fFaces[facei];
721 forAll(neighbours, neighI)
723 const label neiFacei = neighbours[neighI];
725 if (neiFacei <= facei ||
faceMap[neiFacei] < 0)
732 const Face& nei = faceLst[neiFacei];
741 <<
"faces share the same vertices:" <<
nl
742 <<
" face[" << facei <<
"] : " <<
f <<
nl
743 <<
" face[" << neiFacei <<
"] : " << nei <<
endl;
766 if (changed || newFacei < faceLst.size())
773 <<
"Removed " << faceLst.size() - newFacei
774 <<
" illegal faces." <<
endl;
783 if (newFacei != facei)
785 faceLst[newFacei] = faceLst[facei];
798 ParentType::clearOut();
808 return ParentType::size();
830 nTri += faceLst[facei].nTriangles();
834 if (nTri <= faceLst.size())
849 label n = faceLst[facei].nTriangles();
905 const label n = faceLst[facei].nTriangles();
914 if (nTri <= faceLst.size())
933 if (this->
points().empty())
940 const Face&
f = faceLst[facei];
942 for (
label fp = 1; fp <
f.size() - 1; ++fp)
944 const label fp1 =
f.fcIndex(fp);
946 newFaces[nTri] = Face{
f[0],
f[fp],
f[fp1]};
961 const face&
f = faceLst[facei];
964 f.triangles(this->
points(), nTmp, tmpTri);
965 for (
label triI = 0; triI < nTmp; triI++)
967 newFaces[nTri] = Face
978 nTri -= faceLst.size();
991 ParentType::clearOut();
998 template<
class BoolListType>
1001 const BoolListType& include,
1006 const pointField& locPoints = this->localPoints();
1007 const List<Face>& locFaces = this->localFaces();
1011 PatchTools::subsetMap(*
this, include, pointMap,
faceMap);
1018 newPoints[pointi] = locPoints[pointMap[pointi]];
1019 oldToNew[pointMap[pointi]] = pointi;
1026 newZones[zoneI].size() = 0;
1034 newFaces[facei] = Face(locFaces[origFacei]);
1037 Face&
f = newFaces[facei];
1040 f[fp] = oldToNew[
f[fp]];
1055 zone.start() = newFacei;
1056 origEndI +=
zone.size();
1058 for (
label facei = newFacei; facei <
faceMap.size(); ++facei)
1060 if (
faceMap[facei] < origEndI)
1071 zone.size() = newFacei -
zone.start();
1077 std::move(newPoints),
1078 std::move(newFaces),
1084 template<
class Face>
1091 return subsetMesh(include, pointMap,
faceMap);
1095 template<
class Face>
1102 return subsetMesh(include, pointMap,
faceMap);
1106 template<
class Face>
1117 ParentType::clearOut();
1126 template<
class Face>
1133 ParentType::clearOut();
1135 this->storedPoints().transfer(pointLst);
1136 this->storedFaces().transfer(faceLst);
1137 this->storedZones().clear();
1141 template<
class Face>
1152 ParentType::clearOut();
1162 template<
class Face>
1175 if (zoneLst.size() > 1)
1182 sortedFaces[
faceMap[facei]].transfer(faceLst[facei]);
1185 faceLst.swap(sortedFaces);
1190 std::move(surf.storedPoints()),
1197 this->swap(newSurf);
1201 template<
class Face>
1209 template<
class Face>
1212 ParentType::clearOut();
1214 this->storedFaces().swap(faces);
1218 template<
class Face>
1221 ParentType::clearOut();
1223 this->storedPoints().swap(
points);
1227 template<
class Face>
1230 this->storedZones().swap(zones);
1234 template<
class Face>
1241 return read(unzipName, unzipName.
ext());
1249 template<
class Face>
1264 template<
class Face>
1268 const word& surfName
1277 template<
class Face>
1282 this->storedPoints() = surf.points();
1288 template<
class Face>
1295 template<
class Face>
int debug
Static debugging option.
word lessExt() const
Return word without extension (part before last .)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
#define InfoInFunction
Report an information message using Foam::Info.
const surfZoneList & surfZones() const
Const access to the surface zones.
virtual ~MeshedSurface()
Destructor.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from Foam::string.
void swapZones(surfZoneList &zones)
Swap the stored zones.
List< Face > & storedFaces()
Non-const access to the faces.
A class for handling file names.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
void swap(MeshedSurface< Face > &surf)
Swap contents.
pointField & storedPoints()
Non-const access to global points.
virtual bool stitchFaces(const scalar tol=SMALL, const bool verbose=false)
A List obtained as a section of another List.
MeshedSurface subsetMesh(const BoolListType &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
void operator=(const MeshedSurface< Face > &surf)
Copy assignment.
Base class for mesh zones.
const List< Face > & surfFaces() const
Return const access to the faces.
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
A surface mesh consisting of general polygon faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word ext() const
Return file name extension (part after last .)
virtual void clear()
Clear all storage.
label checkTopology(const polyMesh &mesh, const bool allTopology, const bool allGeometry, autoPtr< surfaceWriter > &surfWriter, const autoPtr< writer< scalar >> &setWriter)
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
Mesh consisting of general polyhedral cells.
virtual bool checkFaces(const bool verbose=false)
static bool canWriteType(const word &ext, bool verbose=false)
Can we write this file format?
#define forAll(list, i)
Loop across all elements in list.
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
virtual void remapFaces(const labelUList &faceMap)
Set new zones from faceMap.
surfZoneList & storedZones()
Non-const access to the zones.
static void write(const fileName &name, const MeshedSurfaceProxy &surf, const dictionary &options)
Write to file, select based on its extension.
void transfer(pointField &pointLst, List< Face > &faceLst)
Transfer the components.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
PrimitivePatch< face, List, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points)
void transfer(List< T > &list)
virtual label nTriangles() const
Count number of triangles.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void swapPoints(pointField &points)
Swap the stored points.
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
word ext() const
Return file name extension (part after last .)
static wordHashSet readTypes()
Known readable file-types.
static bool canReadType(const word &ext, bool verbose=false)
Can we read this file format?
label mergePoints(const PointList &points, const scalar mergeTol, const bool verbose, labelList &pointMap, typename PointList::const_reference origin=PointList::value_type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual void movePoints(const pointField &newPoints)
Move points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
FlatOutput< Container > flatOutput(const Container &obj, label len=0)
Global flatOutput function.
virtual void clear()
Clear all storage.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A surface zone on a MeshedSurface.
void clear()
Clear the list, i.e. set size to zero.
MeshedSurface()
Construct null, an empty surface.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
HashSet< word > wordHashSet
A HashSet with word keys.
static wordHashSet writeTypes()
Known writable file-types.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
A face is a list of labels corresponding to mesh vertices.
Various functions to operate on Lists.
bool found(const Key &key) const
Return true if hashed entry is found in table.
void swapFaces(List< Face > &faces)
Swap the stored faces.
void setSize(const label newSize)
Alias for resize(const label)
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
#define WarningInFunction
Report a warning using Foam::Warning.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
autoPtr< MeshedSurface< Face > > releaseGeom()
Release (clear) geometry and return for reuse.
virtual void cleanup(const bool verbose)
Remove invalid faces.
A list of faces which address into the list of points.