68 const int Foam::faMesh::quadricsFit_ = 0;
111 for (
const label facei :
pbm[patchi].
range())
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_),
171 bndConnectPtr_.reset(
nullptr);
172 haloMapPtr_.reset(
nullptr);
173 haloFaceCentresPtr_.reset(
nullptr);
174 haloFaceNormalsPtr_.reset(
nullptr);
178 void Foam::faMesh::setPrimitiveMeshData()
187 nEdges_ = bp.nEdges();
188 nInternalEdges_ = bp.nInternalEdges();
190 nPoints_ = bp.nPoints();
192 edges_.resize(nEdges_);
193 edgeOwner_.resize(nEdges_);
194 edgeNeighbour_.resize(nInternalEdges_);
197 for (label edgei = 0; edgei < nInternalEdges_; ++edgei)
199 edges_[edgei] = bp.edges()[edgei];
201 edgeOwner_[edgei] = edgeFaces[edgei][0];
203 edgeNeighbour_[edgei] = edgeFaces[edgei][1];
207 label edgei = nInternalEdges_;
211 for (
const label patchEdgei :
p.edgeLabels())
213 edges_[edgei] = bp.edges()[patchEdgei];
215 edgeOwner_[edgei] = edgeFaces[patchEdgei][0];
223 void Foam::faMesh::clearHalo()
const 227 haloMapPtr_.reset(
nullptr);
228 haloFaceCentresPtr_.reset(
nullptr);
229 haloFaceNormalsPtr_.reset(
nullptr);
233 void Foam::faMesh::clearGeomNotAreas()
const 238 patchPtr_.reset(
nullptr);
239 polyPatchFacesPtr_.reset(
nullptr);
240 polyPatchIdsPtr_.reset(
nullptr);
241 bndConnectPtr_.reset(
nullptr);
250 pointAreaNormalsPtr_.reset(
nullptr);
256 void Foam::faMesh::clearGeom()
const 267 void Foam::faMesh::clearAddressing()
const 275 void Foam::faMesh::clearOut()
const 279 globalMeshDataPtr_.reset(
nullptr);
292 faceCentresPtr_->boundaryFieldRef()
297 if (faceAreaNormalsPtr_)
299 faceAreaNormalsPtr_->boundaryFieldRef()
310 setPrimitiveMeshData();
320 boundary_.updateMesh();
323 boundary_.calcGeometry();
359 time().findInstance(meshDir(),
"faceLabels"),
377 faceLabels_.instance()
390 polyPatchFacesPtr_(nullptr),
391 polyPatchIdsPtr_(nullptr),
392 bndConnectPtr_(nullptr),
398 patchStartsPtr_(nullptr),
401 faceCentresPtr_(nullptr),
402 edgeCentresPtr_(nullptr),
403 faceAreaNormalsPtr_(nullptr),
404 edgeAreaNormalsPtr_(nullptr),
405 pointAreaNormalsPtr_(nullptr),
406 faceCurvaturesPtr_(nullptr),
407 edgeTransformTensorsPtr_(nullptr),
408 correctPatchPointNormalsPtr_(nullptr),
409 globalMeshDataPtr_(nullptr),
411 haloMapPtr_(nullptr),
412 haloFaceCentresPtr_(nullptr),
413 haloFaceNormalsPtr_(nullptr)
417 setPrimitiveMeshData();
441 rio.resetHeader(
"S0");
444 S0Ptr_ =
new DimensionedField<scalar, areaMesh>
457 const polyMesh& pMesh,
482 mesh().facesInstance(),
495 mesh().facesInstance(),
508 polyPatchFacesPtr_(nullptr),
509 polyPatchIdsPtr_(nullptr),
510 bndConnectPtr_(nullptr),
516 patchStartsPtr_(nullptr),
519 faceCentresPtr_(nullptr),
520 edgeCentresPtr_(nullptr),
521 faceAreaNormalsPtr_(nullptr),
522 edgeAreaNormalsPtr_(nullptr),
523 pointAreaNormalsPtr_(nullptr),
524 faceCurvaturesPtr_(nullptr),
525 edgeTransformTensorsPtr_(nullptr),
526 correctPatchPointNormalsPtr_(nullptr),
527 globalMeshDataPtr_(nullptr),
529 haloMapPtr_(nullptr),
530 haloFaceCentresPtr_(nullptr),
531 haloFaceNormalsPtr_(nullptr)
537 nFaces_ = faceLabels_.
size();
562 static_cast<const
data&>(baseMesh)
569 mesh().facesInstance(),
582 mesh().facesInstance(),
595 polyPatchFacesPtr_(nullptr),
596 polyPatchIdsPtr_(nullptr),
597 bndConnectPtr_(nullptr),
603 patchStartsPtr_(nullptr),
606 faceCentresPtr_(nullptr),
607 edgeCentresPtr_(nullptr),
608 faceAreaNormalsPtr_(nullptr),
609 edgeAreaNormalsPtr_(nullptr),
610 pointAreaNormalsPtr_(nullptr),
611 faceCurvaturesPtr_(nullptr),
612 edgeTransformTensorsPtr_(nullptr),
613 correctPatchPointNormalsPtr_(nullptr),
614 globalMeshDataPtr_(nullptr),
616 haloMapPtr_(nullptr),
617 haloFaceCentresPtr_(nullptr),
618 haloFaceNormalsPtr_(nullptr)
624 nFaces_ = faceLabels_.
size();
628 Foam::faMesh::faMesh(
const polyPatch&
pp,
const bool doInit)
641 createOnePatch(
"default")
646 setPrimitiveMeshData();
657 const polyMesh& pMesh,
658 const dictionary& faMeshDefinition,
667 pMesh.boundaryMesh(),
668 faMeshDefinition.
get<wordRes>(
"polyMeshPatches")
678 faMeshDefinition.subDict(
"boundary"),
681 faMeshDefinition.getOrDefault<word>(
"emptyPatch",
word::null),
684 faMeshDefinition.findDict(
"defaultPatch")
712 rio.resetHeader(
"S0");
715 S0Ptr_ =
new DimensionedField<scalar, areaMesh>
784 for (label& val : list)
787 val = faceOwner[val];
798 Foam::rm(meshFilesPath/
"faceLabels");
799 Foam::rm(meshFilesPath/
"faBoundary");
805 removeFiles(
mesh().instance());
811 if (!patchStartsPtr_)
816 return *patchStartsPtr_;
844 if (!faceCentresPtr_)
849 return *faceCentresPtr_;
855 if (!edgeCentresPtr_)
860 return *edgeCentresPtr_;
882 <<
"S0 is not available" 895 S00Ptr_ =
new DimensionedField<scalar, areaMesh>
917 if (!faceAreaNormalsPtr_)
919 calcFaceAreaNormals();
922 return *faceAreaNormalsPtr_;
928 if (!edgeAreaNormalsPtr_)
930 calcEdgeAreaNormals();
933 return *edgeAreaNormalsPtr_;
939 if (!pointAreaNormalsPtr_)
943 calcPointAreaNormals(*pointAreaNormalsPtr_);
945 if (quadricsFit_ > 0)
947 calcPointAreaNormalsByQuadricsFit(*pointAreaNormalsPtr_);
951 return *pointAreaNormalsPtr_;
957 if (!faceCurvaturesPtr_)
959 calcFaceCurvatures();
962 return *faceCurvaturesPtr_;
969 if (!edgeTransformTensorsPtr_)
971 calcEdgeTransformTensors();
974 return *edgeTransformTensorsPtr_;
980 if (!globalMeshDataPtr_)
985 return *globalMeshDataPtr_;
1008 if (S00Ptr_ && S0Ptr_)
1023 S0Ptr_ =
new DimensionedField<scalar, areaMesh>
1038 curTimeIndex_ = time().timeIndex();
1041 clearGeomNotAreas();
1045 patchPtr_->movePoints(newPoints);
1049 boundary_.movePoints(newPoints);
1066 bool(correctPatchPointNormalsPtr_)
1079 if (!correctPatchPointNormalsPtr_)
1084 return *correctPatchPointNormalsPtr_;
1090 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 ...
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
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.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
const Time & time() const
Return reference to time.
void syncGeom()
Processor/processor synchronisation for geometry fields.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
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.
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.
labelList faceLabels(nFaceLabels)
List< labelList > labelListList
List of labelList.
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.
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.
#define DebugInFunction
Report an information message using Foam::Info.
const edgeVectorField & Le() const
Return edge length vectors.
label size() const noexcept
The number of entries 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)
virtual bool movePoints()
Update after mesh motion.
int optimisationSwitch(const char *name, const int deflt=0)
Lookup optimisation switch or add default value.
virtual bool write(const bool writeOnProc=true) const
Write mesh.
defineTypeNameAndDebug(combustionModel, 0)
Database for solution data, solver performance and other reduced data.
const areaScalarField & faceCurvatures() const
Return face curvatures.
boolList & correctPatchPointNormals() const
Set whether point normals should be corrected for a patch.
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.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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.
Reading is optional [identical to READ_IF_PRESENT].
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.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
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.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
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.
Inter-processor communications stream.
Do not request registration (bool: false)
const dimensionSet dimArea(sqr(dimLength))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
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.
static constexpr const zero Zero
Global zero (0)