Go to the documentation of this file.
51 const int Foam::faMesh::quadricsFit_ = 0;
56 void Foam::faMesh::setPrimitiveMeshData()
67 label nIntEdges = bp.nInternalEdges();
69 for (
label curEdge = 0; curEdge < nIntEdges; ++curEdge)
71 edges_[++edgeI] = bp.edges()[curEdge];
80 edges_[++edgeI] = bp.edges()[curP[eI]];
84 nEdges_ = edges_.size();
85 nInternalEdges_ = nIntEdges;
96 for (
label curEdge = 0; curEdge < nIntEdges; ++curEdge)
98 edgeOwner_[++edgeI] = bpef[curEdge][0];
100 edgeNeighbour_[edgeI] = bpef[curEdge][1];
109 edgeOwner_[++edgeI] = bpef[curP[eI]][0];
117 nPoints_ = bp.nPoints();
121 void Foam::faMesh::clearGeomNotAreas()
const
140 void Foam::faMesh::clearGeom()
const
151 void Foam::faMesh::clearAddressing()
const
159 void Foam::faMesh::clearOut()
const
182 time().findInstance(meshDir(),
"faceLabels"),
194 time().findInstance(meshDir(),
"faBoundary"),
209 patchStartsPtr_(nullptr),
212 centresPtr_(nullptr),
213 edgeCentresPtr_(nullptr),
214 faceAreaNormalsPtr_(nullptr),
215 edgeAreaNormalsPtr_(nullptr),
216 pointAreaNormalsPtr_(nullptr),
217 faceCurvaturesPtr_(nullptr),
218 edgeTransformTensorsPtr_(nullptr),
219 correctPatchPointNormalsPtr_(nullptr),
220 globalMeshDataPtr_(nullptr)
224 setPrimitiveMeshData();
274 mesh().facesInstance(),
287 mesh().facesInstance(),
303 patchStartsPtr_(
nullptr),
306 centresPtr_(
nullptr),
307 edgeCentresPtr_(
nullptr),
308 faceAreaNormalsPtr_(
nullptr),
309 edgeAreaNormalsPtr_(
nullptr),
310 pointAreaNormalsPtr_(
nullptr),
311 faceCurvaturesPtr_(
nullptr),
312 edgeTransformTensorsPtr_(
nullptr),
313 correctPatchPointNormalsPtr_(
nullptr),
314 globalMeshDataPtr_(
nullptr)
337 mesh().facesInstance(),
350 mesh().facesInstance(),
366 patchStartsPtr_(
nullptr),
369 centresPtr_(
nullptr),
370 edgeCentresPtr_(
nullptr),
371 faceAreaNormalsPtr_(
nullptr),
372 edgeAreaNormalsPtr_(
nullptr),
373 pointAreaNormalsPtr_(
nullptr),
374 faceCurvaturesPtr_(
nullptr),
375 edgeTransformTensorsPtr_(
nullptr),
376 correctPatchPointNormalsPtr_(
nullptr),
377 globalMeshDataPtr_(
nullptr)
395 const wordList polyMeshPatches(faMeshDefinition.
lookup(
"polyMeshPatches"));
399 const wordList faPatchNames(bndDict.toc());
405 forAll(faPatchNames, patchI)
409 faPatches[patchI].name_ = faPatchNames[patchI];
411 faPatches[patchI].type_ = curPatchDict.
get<
word>(
"type");
413 faPatches[patchI].ownPolyPatchID_ =
414 pbm.findPatchID(curPatchDict.
get<
word>(
"ownerPolyPatch"));
416 faPatches[patchI].ngbPolyPatchID_ =
417 pbm.findPatchID(curPatchDict.
get<
word>(
"neighbourPolyPatch"));
424 labelList patchIDs(polyMeshPatches.size(), -1);
426 forAll(polyMeshPatches, patchI)
428 patchIDs[patchI] = pbm.findPatchID(polyMeshPatches[patchI]);
430 size += pbm[patchIDs[patchI]].size();
441 forAll(polyMeshPatches, patchI)
444 label size = pbm[patchIDs[patchI]].size();
446 for (
label i = 0; i < size; ++i)
448 faceLabels_[++faceI] =
start + i;
459 label faceID = faceLabels_[faceI];
475 const label nInternalEdges =
patch().nInternalEdges();
477 labelList bndEdgeFaPatchIDs(nTotalEdges - nInternalEdges, -1);
479 for (
label edgeI = nInternalEdges; edgeI < nTotalEdges; ++edgeI)
481 label curMeshEdge = meshEdges[edgeI];
487 forAll(edgeFaces[curMeshEdge], faceI)
489 label curFace = edgeFaces[curMeshEdge][faceI];
491 label curPatchID = pbm.whichPatch(curFace);
493 if (curPatchID != -1)
495 curEdgePatchIDs[++patchI] = curPatchID;
499 for (
label pI = 0; pI < faPatches.size() - 1; ++pI)
504 curEdgePatchIDs[0] == faPatches[pI].ownPolyPatchID_
505 && curEdgePatchIDs[1] == faPatches[pI].ngbPolyPatchID_
509 curEdgePatchIDs[1] == faPatches[pI].ownPolyPatchID_
510 && curEdgePatchIDs[0] == faPatches[pI].ngbPolyPatchID_
514 bndEdgeFaPatchIDs[edgeI - nInternalEdges] = pI;
522 for (
label pI = 0; pI < (faPatches.size() - 1); ++pI)
526 forAll(bndEdgeFaPatchIDs, eI)
528 if (bndEdgeFaPatchIDs[eI] == pI)
530 tmpList.
append(nInternalEdges + eI);
534 faPatches[pI].edgeLabels_ = tmpList;
540 forAll(bndEdgeFaPatchIDs, eI)
542 if (bndEdgeFaPatchIDs[eI] == -1)
544 tmpList.
append(nInternalEdges + eI);
548 if (tmpList.size() > 0)
552 labelList ngbPolyPatch(allUndefEdges.size(), -1);
553 forAll(ngbPolyPatch, edgeI)
555 label curEdge = allUndefEdges[edgeI];
557 label curPMeshEdge = meshEdges[curEdge];
559 forAll(edgeFaces[curPMeshEdge], faceI)
561 label curFace = edgeFaces[curPMeshEdge][faceI];
563 if (faceLabels_.found(curFace))
577 forAll(ngbPolyPatch, edgeI)
579 if (ngbPolyPatch[edgeI] != -1)
581 if (isA<processorPolyPatch>(pbm[ngbPolyPatch[edgeI]]))
583 processorPatchSet.
insert(ngbPolyPatch[edgeI]);
588 faPatches.
setSize(faPatches.size() + processorPatches.size());
590 for (
label i = 0; i < processorPatches.size(); ++i)
596 if (ngbPolyPatch[eI] == processorPatches[i])
598 tmpLst.
append(allUndefEdges[eI]);
602 faPatches[faPatchNames.size() + i].edgeLabels_ = tmpLst;
604 faPatches[faPatchNames.size() + i].name_ =
605 pbm[processorPatches[i]].name();
607 faPatches[faPatchNames.size() + i].type_ =
608 processorFaPatch::typeName;
610 faPatches[faPatchNames.size() + i].ngbPolyPatchID_ =
618 if (ngbPolyPatch[eI] == -1)
620 undefEdges.
append(allUndefEdges[eI]);
622 else if (!isA<processorPolyPatch>(pbm[ngbPolyPatch[eI]]))
624 undefEdges.
append(allUndefEdges[eI]);
628 if (undefEdges.size() > 0)
630 label pI = faPatches.size()-1;
632 faPatches[pI].name_ =
"undefined";
633 faPatches[pI].type_ =
"patch";
634 faPatches[pI].edgeLabels_ = undefEdges;
638 faPatches.setSize(faPatches.size() - 1);
643 faPatches.setSize(faPatches.size() - 1);
651 if (faPatches[patchI].type_ == processorFaPatch::typeName)
653 labelList ngbFaces(faPatches[patchI].edgeLabels_.size(), -1);
657 label curEdge = faPatches[patchI].edgeLabels_[edgeI];
659 label curPMeshEdge = meshEdges[curEdge];
661 forAll(edgeFaces[curPMeshEdge], faceI)
663 label curFace = edgeFaces[curPMeshEdge][faceI];
665 label curPatchID = pbm.whichPatch(curFace);
667 if (curPatchID == faPatches[patchI].ngbPolyPatchID_)
669 ngbFaces[edgeI] = curFace;
675 labelList reorderedEdgeLabels(ngbFaces.size(), -1);
676 for (
label i = 0; i < reorderedEdgeLabels.size(); ++i)
678 reorderedEdgeLabels[i] =
679 faPatches[patchI].edgeLabels_
685 faPatches[patchI].edgeLabels_ = reorderedEdgeLabels;
693 for (
label pI = 0; pI < faPatches.size(); ++pI)
695 faPatches[pI].dict_.add(
"type", faPatches[pI].type_);
696 faPatches[pI].dict_.add(
"edgeLabels", faPatches[pI].edgeLabels_);
697 faPatches[pI].dict_.add
700 faPatches[pI].ngbPolyPatchID_
703 if (faPatches[pI].type_ == processorFaPatch::typeName)
705 if (faPatches[pI].ngbPolyPatchID_ == -1)
708 <<
"ngbPolyPatch is not defined for processorFaPatch: "
709 << faPatches[pI].name_
714 refCast<const processorPolyPatch>
716 pbm[faPatches[pI].ngbPolyPatchID_]
719 faPatches[pI].dict_.add(
"myProcNo", procPolyPatch.
myProcNo());
720 faPatches[pI].dict_.add
748 boundary_.updateMesh();
751 boundary_.calcGeometry();
789 mesh().facesInstance(),
802 mesh().facesInstance(),
818 patchStartsPtr_(
nullptr),
821 centresPtr_(
nullptr),
822 edgeCentresPtr_(
nullptr),
823 faceAreaNormalsPtr_(
nullptr),
824 edgeAreaNormalsPtr_(
nullptr),
825 pointAreaNormalsPtr_(
nullptr),
826 faceCurvaturesPtr_(
nullptr),
827 edgeTransformTensorsPtr_(
nullptr),
828 correctPatchPointNormalsPtr_(
nullptr),
829 globalMeshDataPtr_(
nullptr)
836 forAll(faceLabels_, faceI)
848 labelList edgeLabels(nTotalEdges - nInternalEdges, -1);
852 edgeLabels[edgeI] = nInternalEdges + edgeI;
857 patchDict.
add(
"type",
"patch");
858 patchDict.
add(
"edgeLabels", edgeLabels);
859 patchDict.
add(
"ngbPolyPatchIndex", -1);
865 addFaPatches(faPatchLst);
867 setPrimitiveMeshData();
870 boundary_.updateMesh();
873 boundary_.calcGeometry();
951 return patch().localPoints();
963 return patch().localFaces();
974 <<
"boundary already exists"
978 boundary_.setSize(
p.size());
982 boundary_.set(patchI,
p[patchI]);
985 setPrimitiveMeshData();
987 boundary_.checkDefinition();
1023 if (!patchStartsPtr_)
1028 return *patchStartsPtr_;
1061 return *centresPtr_;
1067 if (!edgeCentresPtr_)
1072 return *edgeCentresPtr_;
1094 <<
"S0 is not available"
1129 if (!faceAreaNormalsPtr_)
1131 calcFaceAreaNormals();
1134 return *faceAreaNormalsPtr_;
1140 if (!edgeAreaNormalsPtr_)
1142 calcEdgeAreaNormals();
1145 return *edgeAreaNormalsPtr_;
1151 if (!pointAreaNormalsPtr_)
1153 calcPointAreaNormals();
1155 if (quadricsFit_ > 0)
1157 calcPointAreaNormalsByQuadricsFit();
1161 return *pointAreaNormalsPtr_;
1167 if (!faceCurvaturesPtr_)
1169 calcFaceCurvatures();
1172 return *faceCurvaturesPtr_;
1179 if (!edgeTransformTensorsPtr_)
1181 calcEdgeTransformTensors();
1184 return *edgeTransformTensorsPtr_;
1190 if (!globalMeshDataPtr_)
1195 return *globalMeshDataPtr_;
1203 calcLduAddressing();
1218 if (S00Ptr_ && S0Ptr_)
1248 curTimeIndex_ = time().timeIndex();
1251 clearGeomNotAreas();
1256 patchPtr_->movePoints(newPoints);
1277 <<
"patchID is not in the valid range"
1281 if (correctPatchPointNormalsPtr_)
1283 return (*correctPatchPointNormalsPtr_)[
patchID];
1292 if (!correctPatchPointNormalsPtr_)
1297 return *correctPatchPointNormalsPtr_;
1303 faceLabels_.write();
The class contains the addressing required by the lduMatrix: upper, lower and losort.
void append(const T &item)
Add copy at tail of list.
List< label > labelList
A List of labels.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Return raw points.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const edgeVectorField & Le() const
Return edge length vectors.
void updateMesh()
Correct faBoundaryMesh after topology update.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
const faceList & faces() const
Return faces.
A class for handling file names.
A field of fields is a PtrList of fields with reference counting.
virtual bool write(const bool valid=true) const
Write mesh.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
Selector class for finite area differencing schemes. faMesh is derived from faShemes so that all fiel...
const indirectPrimitivePatch & patch() const
Return constant reference to primitive patch.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Template functions to aid in the implementation of demand driven data.
const labelListList & edgeFaces() const
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
label nEdges() const
Return number of edges in patch.
const Time & time() const
Return time.
static bool & parRun()
Is this a parallel run?
void calcGeometry()
Calculate the geometry for the patches.
const fileName & facesInstance() const
Return the current instance directory for faces.
int neighbProcNo() const
Return neighbour processor number.
const edgeList & edges() const
Return edges.
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?
Various mesh related information for a parallel run.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static autoPtr< faPatch > New(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm)
Return a pointer to a new patch created.
const vectorField & pointAreaNormals() const
Return point area normals.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
virtual ~faMesh()
Destructor.
const DimensionedField< scalar, areaMesh > & S00() const
Return old-old-time face areas.
label start() const
The start label of the boundary faces in the polyMesh face list.
Mesh consisting of general polyhedral cells.
const labelList & patchStarts() const
Return patch starts.
#define forAll(list, i)
Loop across all elements in list.
const faGlobalMeshData & globalData() const
Return parallel info.
Registry of regIOobjects.
Template class for non-intrusive linked lists.
void deleteDemandDrivenData(DataPtr &dataPtr)
const fileName & pointsInstance() const
Return the current instance directory for points.
Finite area boundary mesh.
const FieldField< Field, tensor > & edgeTransformTensors() const
Return edge transformation tensors.
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 DimensionedField< scalar, areaMesh > & S0() const
Return old-time face areas.
const DimensionedField< scalar, areaMesh > & S() const
Return face areas.
bool operator==(const faMesh &m) const
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
#define DebugInFunction
Report an information message using Foam::Info.
void addFaPatches(const List< faPatch * > &)
Add boundary patches. Constructor helper.
fileName timePath() const
Return current time path.
const areaVectorField & faceAreaNormals() const
Return face area normals.
const Time & time() const
Return reference to time.
virtual const labelList & faceOwner() const
Return face owner.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
A List with indirect addressing.
Neighbour processor patch.
Selector class for finite area solution. faMesh is derived from faSolution so that all fields have ac...
const edgeScalarField & magLe() const
Return edge length magnitudes.
const fileName & facesInstance() const
Return the current instance directory for faces.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
bool operator!=(const faMesh &m) const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A list that is sorted upon construction or when explicitly requested with the sort() method.
const pointField & points() const
Return mesh points.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
errorManip< error > abort(error &err)
label nInternalEdges() const
bool movePoints() const
Do what is necessary if the mesh has moved.
const edgeVectorField & edgeAreaNormals() const
Return edge area normals.
const polyMesh & mesh() const
Return access to polyMesh.
boolList & correctPatchPointNormals() const
Set whether point normals should be corrected for a patch.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
A PrimitivePatch using an IndirectList for the faces.
label nInternalEdges() const
Number of internal edges.
virtual const objectRegistry & thisDb() const
Return reference to the mesh database.
List< labelList > labelListList
A List of labelList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool hasDb() const
Return true if thisDb() is a valid DB.
#define DebugInfo
Report an information message using Foam::Info.
const areaScalarField & faceCurvatures() const
Return face curvatures.
const std::string patch
OpenFOAM patch number as a std::string.
DynamicID< polyBoundaryMesh > polyPatchID
Foam::polyPatchID.
Inter-processor communications stream.
static label worldComm
Default communicator (all processors)
label ListType::const_reference const label start
static word meshSubDir
Return the mesh sub-directory name (usually "faMesh")
const faBoundaryMesh & boundary() const
Return constant reference to boundary mesh.
const edgeVectorField & edgeCentres() const
Return edge centres as edgeVectorField.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
Finite area mesh. Used for 2-D non-Euclidian finite area method.
const Time & time() const
Return the top-level database.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
int myProcNo() const
Return processor number.
const fileName & pointsInstance() const
Return the current instance directory for points.
void setSize(const label newSize)
Alias for resize(const label)
Generic GeometricField class.
constant condensation/saturation model.
defineTypeNameAndDebug(combustionModel, 0)
Smooth ATC in cells next to a set of patches supplied by type.
Face to edge interpolation scheme. Included in faMesh.
Database for solution data, solver performance and other reduced data.
virtual bool movePoints()
Update after mesh motion.
label comm() const
Return communicator used for parallel communication.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A list of faces which address into the list of points.
const areaVectorField & areaCentres() const
Return face centres as areaVectorField.