56int Foam::faMesh::geometryOrder_ = 1;
58const int Foam::faMesh::quadricsFit_ = 0;
86 <<
"No matching patches: " << polyPatchNames <<
nl
90 label nFaceLabels = 0;
91 for (
const label patchi : patchIDs)
93 nFaceLabels += pbm[patchi].
size();
99 for (
const label patchi : patchIDs)
101 for (
const label facei : pbm[patchi].
range())
103 faceLabels[nFaceLabels] = facei;
116void Foam::faMesh::checkBoundaryEdgeLabelRange
118 const labelUList& edgeLabels
123 for (
const label edgei : edgeLabels)
125 if (edgei < nInternalEdges_ || edgei >= nEdges_)
130 <<
"Boundary edge label out of range "
131 << nInternalEdges_ <<
".." << (nEdges_-1) <<
nl
146void Foam::faMesh::initPatch()
const
152 UIndirectList<face>(
mesh().faces(), faceLabels_),
156 bndConnectPtr_.reset(
nullptr);
157 haloMapPtr_.reset(
nullptr);
158 haloFaceCentresPtr_.reset(
nullptr);
159 haloFaceNormalsPtr_.reset(
nullptr);
163void Foam::faMesh::setPrimitiveMeshData()
172 nEdges_ = bp.nEdges();
173 nInternalEdges_ = bp.nInternalEdges();
175 nPoints_ = bp.nPoints();
177 edges_.resize(nEdges_);
178 edgeOwner_.resize(nEdges_);
179 edgeNeighbour_.resize(nInternalEdges_);
182 for (label edgei = 0; edgei < nInternalEdges_; ++edgei)
184 edges_[edgei] = bp.edges()[edgei];
186 edgeOwner_[edgei] = edgeFaces[edgei][0];
188 edgeNeighbour_[edgei] = edgeFaces[edgei][1];
192 label edgei = nInternalEdges_;
196 for (
const label patchEdgei :
p.edgeLabels())
198 edges_[edgei] = bp.edges()[patchEdgei];
200 edgeOwner_[edgei] = edgeFaces[patchEdgei][0];
208void Foam::faMesh::clearHalo()
const
212 haloMapPtr_.reset(
nullptr);
213 haloFaceCentresPtr_.reset(
nullptr);
214 haloFaceNormalsPtr_.reset(
nullptr);
218void Foam::faMesh::clearGeomNotAreas()
const
223 patchPtr_.reset(
nullptr);
224 bndConnectPtr_.reset(
nullptr);
233 pointAreaNormalsPtr_.reset(
nullptr);
239void Foam::faMesh::clearGeom()
const
250void Foam::faMesh::clearAddressing()
const
258void Foam::faMesh::clearOut()
const
262 globalMeshDataPtr_.reset(
nullptr);
272 setPrimitiveMeshData();
282 boundary_.updateMesh();
285 boundary_.calcGeometry();
332 time().findInstance(meshDir(),
"faceLabels"),
350 faceLabels_.instance()
363 bndConnectPtr_(nullptr),
369 patchStartsPtr_(nullptr),
372 centresPtr_(nullptr),
373 edgeCentresPtr_(nullptr),
374 faceAreaNormalsPtr_(nullptr),
375 edgeAreaNormalsPtr_(nullptr),
376 pointAreaNormalsPtr_(nullptr),
377 faceCurvaturesPtr_(nullptr),
378 edgeTransformTensorsPtr_(nullptr),
379 correctPatchPointNormalsPtr_(nullptr),
380 globalMeshDataPtr_(nullptr),
382 haloMapPtr_(nullptr),
383 haloFaceCentresPtr_(nullptr),
384 haloFaceNormalsPtr_(nullptr)
388 setPrimitiveMeshData();
420 faMesh(pMesh, std::move(faceLabels), static_cast<const
IOobject&>(pMesh))
441 mesh().facesInstance(),
447 std::move(faceLabels)
454 mesh().facesInstance(),
467 bndConnectPtr_(nullptr),
473 patchStartsPtr_(nullptr),
476 centresPtr_(nullptr),
477 edgeCentresPtr_(nullptr),
478 faceAreaNormalsPtr_(nullptr),
479 edgeAreaNormalsPtr_(nullptr),
480 pointAreaNormalsPtr_(nullptr),
481 faceCurvaturesPtr_(nullptr),
482 edgeTransformTensorsPtr_(nullptr),
483 correctPatchPointNormalsPtr_(nullptr),
484 globalMeshDataPtr_(nullptr),
486 haloMapPtr_(nullptr),
487 haloFaceCentresPtr_(nullptr),
488 haloFaceNormalsPtr_(nullptr)
513 static_cast<const
data&>(baseMesh)
520 mesh().facesInstance(),
526 std::move(faceLabels)
533 mesh().facesInstance(),
546 bndConnectPtr_(nullptr),
552 patchStartsPtr_(nullptr),
555 centresPtr_(nullptr),
556 edgeCentresPtr_(nullptr),
557 faceAreaNormalsPtr_(nullptr),
558 edgeAreaNormalsPtr_(nullptr),
559 pointAreaNormalsPtr_(nullptr),
560 faceCurvaturesPtr_(nullptr),
561 edgeTransformTensorsPtr_(nullptr),
562 correctPatchPointNormalsPtr_(nullptr),
563 globalMeshDataPtr_(nullptr),
565 haloMapPtr_(nullptr),
566 haloFaceCentresPtr_(nullptr),
567 haloFaceNormalsPtr_(nullptr)
584 createOnePatch(
"default")
589 setPrimitiveMeshData();
611 faMeshDefinition.get<
wordRes>(
"polyMeshPatches")
621 faMeshDefinition.
subDict(
"boundary"),
627 faMeshDefinition.
findDict(
"defaultPatch")
711 fileName meshFilesPath = thisDb().time().
path()/instanceDir/meshDir();
713 Foam::rm(meshFilesPath/
"faceLabels");
714 Foam::rm(meshFilesPath/
"faBoundary");
720 removeFiles(
mesh().instance());
726 if (!patchStartsPtr_)
731 return *patchStartsPtr_;
770 if (!edgeCentresPtr_)
775 return *edgeCentresPtr_;
797 <<
"S0 is not available"
832 if (!faceAreaNormalsPtr_)
834 calcFaceAreaNormals();
837 return *faceAreaNormalsPtr_;
843 if (!edgeAreaNormalsPtr_)
845 calcEdgeAreaNormals();
848 return *edgeAreaNormalsPtr_;
854 if (!pointAreaNormalsPtr_)
858 calcPointAreaNormals(*pointAreaNormalsPtr_);
860 if (quadricsFit_ > 0)
862 calcPointAreaNormalsByQuadricsFit(*pointAreaNormalsPtr_);
866 return *pointAreaNormalsPtr_;
872 if (!faceCurvaturesPtr_)
874 calcFaceCurvatures();
877 return *faceCurvaturesPtr_;
884 if (!edgeTransformTensorsPtr_)
886 calcEdgeTransformTensors();
889 return *edgeTransformTensorsPtr_;
895 if (!globalMeshDataPtr_)
900 return *globalMeshDataPtr_;
923 if (S00Ptr_ && S0Ptr_)
953 curTimeIndex_ = time().timeIndex();
961 patchPtr_->movePoints(newPoints);
965 boundary_.movePoints(newPoints);
981 <<
"patchID is not in the valid range"
985 if (correctPatchPointNormalsPtr_)
987 return (*correctPatchPointNormalsPtr_)[
patchID];
996 if (!correctPatchPointNormalsPtr_)
1001 return *correctPatchPointNormalsPtr_;
1007 faceLabels_.write();
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A field of fields is a PtrList of fields with reference counting.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Inter-processor communications stream.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName timePath() const
Return current time path.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
static bool & parRun() noexcept
Test if this a parallel run.
label size() const noexcept
The number of elements in the list.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Database for solution data, solver performance and other reduced data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Face to edge interpolation scheme. Included in faMesh.
bool movePoints() const
Do what is necessary if the mesh has moved.
Various mesh related information for a parallel run.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
virtual bool movePoints()
Update after mesh motion.
boolList & correctPatchPointNormals() const
Set whether point normals should be corrected for a patch.
const fileName & facesInstance() const
Return the current instance directory for faces.
const labelList & patchStarts() const
Return patch starts.
const Time & time() const
Return reference to time.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
static const word prefix
The prefix to local: finite-area.
const edgeVectorField & edgeCentres() const
Return edge centres as edgeVectorField.
const DimensionedField< scalar, areaMesh > & S00() const
Return old-old-time face areas.
const polyMesh & mesh() const
Return access to polyMesh.
const edgeScalarField & magLe() const
Return edge length magnitudes.
const DimensionedField< scalar, areaMesh > & S() const
Return face areas.
const edgeVectorField & Le() const
Return edge length vectors.
const FieldField< Field, tensor > & edgeTransformTensors() const
Return edge transformation tensors.
virtual bool hasDb() const
Return true if thisDb() is a valid DB.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual const objectRegistry & thisDb() const
Return reference to the mesh database.
const faGlobalMeshData & globalData() const
Return parallel info.
const DimensionedField< scalar, areaMesh > & S0() const
Return old-time face areas.
const areaScalarField & faceCurvatures() const
Return face curvatures.
const edgeVectorField & edgeAreaNormals() const
Return edge area normals.
void addFaPatches(faPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
void removeFiles() const
Remove all files from mesh instance()
const vectorField & pointAreaNormals() const
Return point area normals.
virtual ~faMesh()
Destructor.
static word meshSubDir
The mesh sub-directory name (usually "faMesh")
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
const areaVectorField & faceAreaNormals() const
Return face area normals.
const areaVectorField & areaCentres() const
Return face centres as areaVectorField.
Selector class for finite area differencing schemes. faMesh is derived from faSchemes so that all fie...
Selector class for finite area solution. faMesh is derived from faSolution so that all fields have ac...
A class for handling file names.
static std::string path(const std::string &str)
Return directory path name (part before last /)
virtual bool write()
Write the output fields.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
const Time & time() const
Return the top-level database.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool useGroups=true) const
Return the set of patch IDs corresponding to the given names.
Mesh consisting of general polyhedral cells.
const fileName & facesInstance() const
Return the current instance directory for faces.
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual const pointField & points() const
Return raw points.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
A patch is a list of labels that address the faces in the global face list.
friend bool operator!=(const refineCell &rc1, const refineCell &rc2)
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Template functions to aid in the implementation of demand driven data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define DebugInfo
Report an information message using Foam::Info.
#define DebugInFunction
Report an information message using Foam::Info.
const std::string patch
OpenFOAM patch number as a std::string.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
const fileOperation & fileHandler()
Get current file handler.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static labelList selectPatchFaces(const polyBoundaryMesh &pbm, const wordRes &polyPatchNames)
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
List< labelList > labelListList
A List of labelList.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void deleteDemandDrivenData(DataPtr &dataPtr)
constexpr char nl
The newline '\n' character (0x0a)