68 const int Foam::faMesh::quadricsFit_ = 0;
96 <<
"No matching patches: " << polyPatchNames <<
nl 100 label nFaceLabels = 0;
101 for (
const label patchi : patchIDs)
103 nFaceLabels += pbm[patchi].
size();
109 for (
const label patchi : patchIDs)
111 for (
const label facei : pbm[patchi].
range())
113 faceLabels[nFaceLabels] = facei;
126 void Foam::faMesh::checkBoundaryEdgeLabelRange
133 for (
const label edgei : edgeLabels)
135 if (edgei < nInternalEdges_ || edgei >= nEdges_)
140 <<
"Boundary edge label out of range " 141 << nInternalEdges_ <<
".." << (nEdges_-1) <<
nl 156 void Foam::faMesh::initPatch()
const 162 UIndirectList<face>(
mesh().faces(), faceLabels_),
166 bndConnectPtr_.reset(
nullptr);
167 haloMapPtr_.reset(
nullptr);
168 haloFaceCentresPtr_.reset(
nullptr);
169 haloFaceNormalsPtr_.reset(
nullptr);
173 void Foam::faMesh::setPrimitiveMeshData()
182 nEdges_ = bp.nEdges();
183 nInternalEdges_ = bp.nInternalEdges();
185 nPoints_ = bp.nPoints();
187 edges_.resize(nEdges_);
188 edgeOwner_.resize(nEdges_);
189 edgeNeighbour_.resize(nInternalEdges_);
192 for (label edgei = 0; edgei < nInternalEdges_; ++edgei)
194 edges_[edgei] = bp.edges()[edgei];
196 edgeOwner_[edgei] = edgeFaces[edgei][0];
198 edgeNeighbour_[edgei] = edgeFaces[edgei][1];
202 label edgei = nInternalEdges_;
206 for (
const label patchEdgei :
p.edgeLabels())
208 edges_[edgei] = bp.edges()[patchEdgei];
210 edgeOwner_[edgei] = edgeFaces[patchEdgei][0];
218 void Foam::faMesh::clearHalo()
const 222 haloMapPtr_.reset(
nullptr);
223 haloFaceCentresPtr_.reset(
nullptr);
224 haloFaceNormalsPtr_.reset(
nullptr);
228 void Foam::faMesh::clearGeomNotAreas()
const 233 patchPtr_.reset(
nullptr);
234 polyPatchFacesPtr_.reset(
nullptr);
235 polyPatchIdsPtr_.reset(
nullptr);
236 bndConnectPtr_.reset(
nullptr);
245 pointAreaNormalsPtr_.reset(
nullptr);
251 void Foam::faMesh::clearGeom()
const 262 void Foam::faMesh::clearAddressing()
const 270 void Foam::faMesh::clearOut()
const 274 globalMeshDataPtr_.reset(
nullptr);
284 setPrimitiveMeshData();
294 boundary_.updateMesh();
297 boundary_.calcGeometry();
303 .evaluateCoupled<processorFaPatch>();
344 time().findInstance(meshDir(),
"faceLabels"),
362 faceLabels_.instance()
375 polyPatchFacesPtr_(nullptr),
376 polyPatchIdsPtr_(nullptr),
377 bndConnectPtr_(nullptr),
383 patchStartsPtr_(nullptr),
386 faceCentresPtr_(nullptr),
387 edgeCentresPtr_(nullptr),
388 faceAreaNormalsPtr_(nullptr),
389 edgeAreaNormalsPtr_(nullptr),
390 pointAreaNormalsPtr_(nullptr),
391 faceCurvaturesPtr_(nullptr),
392 edgeTransformTensorsPtr_(nullptr),
393 correctPatchPointNormalsPtr_(nullptr),
394 globalMeshDataPtr_(nullptr),
396 haloMapPtr_(nullptr),
397 haloFaceCentresPtr_(nullptr),
398 haloFaceNormalsPtr_(nullptr)
402 setPrimitiveMeshData();
411 S0Ptr_ =
new DimensionedField<scalar, areaMesh>
430 const polyMesh& pMesh,
455 mesh().facesInstance(),
461 std::move(faceLabels)
468 mesh().facesInstance(),
481 polyPatchFacesPtr_(nullptr),
482 polyPatchIdsPtr_(nullptr),
483 bndConnectPtr_(nullptr),
489 patchStartsPtr_(nullptr),
492 faceCentresPtr_(nullptr),
493 edgeCentresPtr_(nullptr),
494 faceAreaNormalsPtr_(nullptr),
495 edgeAreaNormalsPtr_(nullptr),
496 pointAreaNormalsPtr_(nullptr),
497 faceCurvaturesPtr_(nullptr),
498 edgeTransformTensorsPtr_(nullptr),
499 correctPatchPointNormalsPtr_(nullptr),
500 globalMeshDataPtr_(nullptr),
502 haloMapPtr_(nullptr),
503 haloFaceCentresPtr_(nullptr),
504 haloFaceNormalsPtr_(nullptr)
529 static_cast<const
data&>(baseMesh)
536 mesh().facesInstance(),
542 std::move(faceLabels)
549 mesh().facesInstance(),
562 polyPatchFacesPtr_(nullptr),
563 polyPatchIdsPtr_(nullptr),
564 bndConnectPtr_(nullptr),
570 patchStartsPtr_(nullptr),
573 faceCentresPtr_(nullptr),
574 edgeCentresPtr_(nullptr),
575 faceAreaNormalsPtr_(nullptr),
576 edgeAreaNormalsPtr_(nullptr),
577 pointAreaNormalsPtr_(nullptr),
578 faceCurvaturesPtr_(nullptr),
579 edgeTransformTensorsPtr_(nullptr),
580 correctPatchPointNormalsPtr_(nullptr),
581 globalMeshDataPtr_(nullptr),
583 haloMapPtr_(nullptr),
584 haloFaceCentresPtr_(nullptr),
585 haloFaceNormalsPtr_(nullptr)
589 Foam::faMesh::faMesh(
const polyPatch& pp,
const bool doInit)
602 createOnePatch(
"default")
607 setPrimitiveMeshData();
618 const polyMesh& pMesh,
619 const dictionary& faMeshDefinition,
628 pMesh.boundaryMesh(),
629 faMeshDefinition.
get<wordRes>(
"polyMeshPatches")
639 faMeshDefinition.subDict(
"boundary"),
642 faMeshDefinition.getOrDefault<word>(
"emptyPatch",
word::null),
645 faMeshDefinition.findDict(
"defaultPatch")
658 S0Ptr_ =
new DimensionedField<scalar, areaMesh>
733 for (label& val : list)
736 val = faceOwner[val];
747 Foam::rm(meshFilesPath/
"faceLabels");
748 Foam::rm(meshFilesPath/
"faBoundary");
754 removeFiles(
mesh().instance());
760 if (!patchStartsPtr_)
765 return *patchStartsPtr_;
793 if (!faceCentresPtr_)
798 return *faceCentresPtr_;
804 if (!edgeCentresPtr_)
809 return *edgeCentresPtr_;
831 <<
"S0 is not available" 844 S00Ptr_ =
new DimensionedField<scalar, areaMesh>
866 if (!faceAreaNormalsPtr_)
868 calcFaceAreaNormals();
871 return *faceAreaNormalsPtr_;
877 if (!edgeAreaNormalsPtr_)
879 calcEdgeAreaNormals();
882 return *edgeAreaNormalsPtr_;
888 if (!pointAreaNormalsPtr_)
892 calcPointAreaNormals(*pointAreaNormalsPtr_);
894 if (quadricsFit_ > 0)
896 calcPointAreaNormalsByQuadricsFit(*pointAreaNormalsPtr_);
900 return *pointAreaNormalsPtr_;
906 if (!faceCurvaturesPtr_)
908 calcFaceCurvatures();
911 return *faceCurvaturesPtr_;
918 if (!edgeTransformTensorsPtr_)
920 calcEdgeTransformTensors();
923 return *edgeTransformTensorsPtr_;
929 if (!globalMeshDataPtr_)
934 return *globalMeshDataPtr_;
957 if (S00Ptr_ && S0Ptr_)
972 S0Ptr_ =
new DimensionedField<scalar, areaMesh>
987 curTimeIndex_ = time().timeIndex();
995 patchPtr_->movePoints(newPoints);
999 boundary_.movePoints(newPoints);
1014 bool(correctPatchPointNormalsPtr_)
1027 if (!correctPatchPointNormalsPtr_)
1032 return *correctPatchPointNormalsPtr_;
1038 faceLabels_.write();
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
PtrList< faPatch > faPatchList
Store lists of faPatch as a PtrList.
registerOptSwitch("fa:geometryOrder", int, faMesh::geometryOrder_)
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
List< labelList > labelListList
A List of labelList.
void size(const label n)
Older name for setAddressableSize.
void addFaPatches(faPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const DimensionedField< scalar, areaMesh > & S00() const
Return old-old-time face areas.
const fileName & facesInstance() const
Return the current instance directory for faces.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
fileName timePath() const
Return current time path.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
virtual bool write(const bool valid=true) const
Write mesh.
const Time & time() const
Return reference to time.
constexpr char nl
The newline '\n' character (0x0a)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const DimensionedField< scalar, areaMesh > & S() const
Return face areas.
Face to edge interpolation scheme. Included in faMesh.
bool operator!=(const faMesh &m) const
static bool & parRun() noexcept
Test if this a parallel run.
Various mesh related information for a parallel run.
autoPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler.
Generic GeometricField class.
const faGlobalMeshData & globalData() const
Return parallel info.
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
static std::string path(const std::string &str)
Return directory path name (part before last /)
const labelList & patchStarts() const
Return patch starts.
Ignore writing from objectRegistry::writeObject()
bool movePoints() const
Do what is necessary if the mesh has moved.
const Time & time() const
Return the top-level database.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
const areaVectorField & areaCentres() const
Return face centres as areaVectorField.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual const objectRegistry & thisDb() const
Return reference to the mesh database.
const edgeScalarField & magLe() const
Return edge length magnitudes.
UList< label > labelUList
A UList of labels.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
virtual const pointField & points() const
Return raw points.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
virtual bool hasDb() const
Return true if thisDb() is a valid DB.
const fileName & pointsInstance() const
Return the current instance directory for points.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual ~faMesh()
Destructor.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
A class for handling words, derived from Foam::string.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
bool operator==(const faMesh &m) const
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
const Time & time() const noexcept
Return time registry.
#define DebugInFunction
Report an information message using Foam::Info.
const edgeVectorField & Le() const
Return edge length vectors.
Inter-processor communications stream.
label size() const noexcept
The number of elements in the list.
static const word prefix
The prefix to local: finite-area.
virtual const labelList & faceOwner() const
Return face owner.
static const word null
An empty word.
A List of wordRe with additional matching capabilities.
errorManip< error > abort(error &err)
#define DebugInfo
Report an information message using Foam::Info.
const FieldField< Field, tensor > & edgeTransformTensors() const
Return edge transformation tensors.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
static labelList selectPatchFaces(const polyBoundaryMesh &pbm, const wordRes &polyPatchNames)
const word & name() const noexcept
The patch name.
virtual bool movePoints()
Update after mesh motion.
int optimisationSwitch(const char *name, const int deflt=0)
Lookup optimisation switch or add default value.
defineTypeNameAndDebug(combustionModel, 0)
Database for solution data, solver performance and other reduced data.
const polyMesh & mesh() const
Return access to polyMesh.
const areaScalarField & faceCurvatures() const
Return face curvatures.
boolList & correctPatchPointNormals() const
Set whether point normals should be corrected for a patch.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Template functions to aid in the implementation of demand driven data.
static word meshSubDir
The mesh sub-directory name (usually "faMesh")
const fileName & facesInstance() const
Return the current instance directory for faces.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
Selector class for finite area differencing schemes. faMesh is derived from faSchemes so that all fie...
const edgeVectorField & edgeCentres() const
Return edge centres as edgeVectorField.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
IOobject(const IOobject &)=default
Copy construct.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Automatically write from objectRegistry::writeObject()
const std::string patch
OpenFOAM patch number as a std::string.
const fileName & pointsInstance() const
Return the current instance directory for points.
Selector class for finite area solution. faMesh is derived from faSolution so that all fields have ac...
const edgeVectorField & edgeAreaNormals() const
Return edge area normals.
bool init(const bool doInit)
Initialise non-demand-driven data etc.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
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.
labelList faceCells() const
The volume (owner) cells associated with the area-mesh.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static int geometryOrder_
Geometry treatment.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
void removeFiles() const
Remove all files from mesh instance()
Registry of regIOobjects.
A patch is a list of labels that address the faces in the global face list.
void deleteDemandDrivenData(DataPtr &dataPtr)
const vectorField & pointAreaNormals() const
Return point area normals.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const areaVectorField & faceAreaNormals() const
Return face area normals.
List< bool > boolList
A List of bools.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
Do not request registration (bool: false)
const DimensionedField< scalar, areaMesh > & S0() const
Return old-time face areas.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.