Go to the documentation of this file.
52 const int Foam::faMesh::quadricsFit_ = 0;
57 void Foam::faMesh::setPrimitiveMeshData()
68 label nIntEdges = bp.nInternalEdges();
70 for (label curEdge = 0; curEdge < nIntEdges; ++curEdge)
72 edges_[++edgeI] = bp.edges()[curEdge];
81 edges_[++edgeI] = bp.edges()[curP[eI]];
85 nEdges_ = edges_.size();
86 nInternalEdges_ = nIntEdges;
97 for (label curEdge = 0; curEdge < nIntEdges; ++curEdge)
99 edgeOwner_[++edgeI] = bpef[curEdge][0];
101 edgeNeighbour_[edgeI] = bpef[curEdge][1];
110 edgeOwner_[++edgeI] = bpef[curP[eI]][0];
118 nPoints_ = bp.nPoints();
122 void Foam::faMesh::clearGeomNotAreas()
const
141 void Foam::faMesh::clearGeom()
const
152 void Foam::faMesh::clearAddressing()
const
160 void Foam::faMesh::clearOut()
const
183 time().findInstance(meshDir(),
"faceLabels"),
195 time().findInstance(meshDir(),
"faBoundary"),
210 patchStartsPtr_(nullptr),
213 centresPtr_(nullptr),
214 edgeCentresPtr_(nullptr),
215 faceAreaNormalsPtr_(nullptr),
216 edgeAreaNormalsPtr_(nullptr),
217 pointAreaNormalsPtr_(nullptr),
218 faceCurvaturesPtr_(nullptr),
219 edgeTransformTensorsPtr_(nullptr),
220 correctPatchPointNormalsPtr_(nullptr),
221 globalMeshDataPtr_(nullptr)
225 setPrimitiveMeshData();
275 mesh().facesInstance(),
288 mesh().facesInstance(),
304 patchStartsPtr_(
nullptr),
307 centresPtr_(
nullptr),
308 edgeCentresPtr_(
nullptr),
309 faceAreaNormalsPtr_(
nullptr),
310 edgeAreaNormalsPtr_(
nullptr),
311 pointAreaNormalsPtr_(
nullptr),
312 faceCurvaturesPtr_(
nullptr),
313 edgeTransformTensorsPtr_(
nullptr),
314 correctPatchPointNormalsPtr_(
nullptr),
315 globalMeshDataPtr_(
nullptr)
338 mesh().facesInstance(),
351 mesh().facesInstance(),
367 patchStartsPtr_(
nullptr),
370 centresPtr_(
nullptr),
371 edgeCentresPtr_(
nullptr),
372 faceAreaNormalsPtr_(
nullptr),
373 edgeAreaNormalsPtr_(
nullptr),
374 pointAreaNormalsPtr_(
nullptr),
375 faceCurvaturesPtr_(
nullptr),
376 edgeTransformTensorsPtr_(
nullptr),
377 correctPatchPointNormalsPtr_(
nullptr),
378 globalMeshDataPtr_(
nullptr)
409 forAll(faPatchNames, patchI)
413 faPatches[patchI].name_ = faPatchNames[patchI];
415 faPatches[patchI].type_ = curPatchDict.
get<
word>(
"type");
417 faPatches[patchI].ownPolyPatchID_ =
418 pbm.findPatchID(curPatchDict.
get<
word>(
"ownerPolyPatch"));
420 faPatches[patchI].ngbPolyPatchID_ =
421 pbm.findPatchID(curPatchDict.
get<
word>(
"neighbourPolyPatch"));
428 labelList patchIDs(polyMeshPatches.size(), -1);
430 forAll(polyMeshPatches, patchI)
432 patchIDs[patchI] = pbm.findPatchID(polyMeshPatches[patchI]);
434 size += pbm[patchIDs[patchI]].size();
445 forAll(polyMeshPatches, patchI)
447 label start = pbm[patchIDs[patchI]].start();
448 label size = pbm[patchIDs[patchI]].size();
450 for (label i = 0; i < size; ++i)
452 faceLabels_[++faceI] = start + i;
463 label faceID = faceLabels_[faceI];
478 const label nTotalEdges =
patch().nEdges();
479 const label nInternalEdges =
patch().nInternalEdges();
481 labelList bndEdgeFaPatchIDs(nTotalEdges - nInternalEdges, -1);
483 for (label edgeI = nInternalEdges; edgeI < nTotalEdges; ++edgeI)
485 label curMeshEdge = meshEdges[edgeI];
491 forAll(edgeFaces[curMeshEdge], faceI)
493 label curFace = edgeFaces[curMeshEdge][faceI];
495 label curPatchID = pbm.whichPatch(curFace);
497 if (curPatchID != -1)
499 curEdgePatchIDs[++patchI] = curPatchID;
503 for (label pI = 0; pI < faPatches.size() - 1; ++pI)
508 curEdgePatchIDs[0] == faPatches[pI].ownPolyPatchID_
509 && curEdgePatchIDs[1] == faPatches[pI].ngbPolyPatchID_
513 curEdgePatchIDs[1] == faPatches[pI].ownPolyPatchID_
514 && curEdgePatchIDs[0] == faPatches[pI].ngbPolyPatchID_
518 bndEdgeFaPatchIDs[edgeI - nInternalEdges] = pI;
526 for (label pI = 0; pI < (faPatches.size() - 1); ++pI)
530 forAll(bndEdgeFaPatchIDs, eI)
532 if (bndEdgeFaPatchIDs[eI] == pI)
534 tmpList.
append(nInternalEdges + eI);
538 faPatches[pI].edgeLabels_ = tmpList;
544 forAll(bndEdgeFaPatchIDs, eI)
546 if (bndEdgeFaPatchIDs[eI] == -1)
548 tmpList.
append(nInternalEdges + eI);
552 if (tmpList.size() > 0)
556 labelList ngbPolyPatch(allUndefEdges.size(), -1);
557 forAll(ngbPolyPatch, edgeI)
559 label curEdge = allUndefEdges[edgeI];
561 label curPMeshEdge = meshEdges[curEdge];
563 forAll(edgeFaces[curPMeshEdge], faceI)
565 label curFace = edgeFaces[curPMeshEdge][faceI];
567 if (faceLabels_.found(curFace))
581 forAll(ngbPolyPatch, edgeI)
583 if (ngbPolyPatch[edgeI] != -1)
585 if (isA<processorPolyPatch>(pbm[ngbPolyPatch[edgeI]]))
587 processorPatchSet.
insert(ngbPolyPatch[edgeI]);
592 faPatches.
setSize(faPatches.size() + processorPatches.size());
594 for (label i = 0; i < processorPatches.size(); ++i)
600 if (ngbPolyPatch[eI] == processorPatches[i])
602 tmpLst.
append(allUndefEdges[eI]);
606 faPatches[faPatchNames.size() + i].edgeLabels_ = tmpLst;
608 faPatches[faPatchNames.size() + i].name_ =
609 pbm[processorPatches[i]].name();
611 faPatches[faPatchNames.size() + i].type_ =
612 processorFaPatch::typeName;
614 faPatches[faPatchNames.size() + i].ngbPolyPatchID_ =
622 if (ngbPolyPatch[eI] == -1)
624 undefEdges.
append(allUndefEdges[eI]);
626 else if (!isA<processorPolyPatch>(pbm[ngbPolyPatch[eI]]))
628 undefEdges.
append(allUndefEdges[eI]);
632 if (undefEdges.size() > 0)
634 label pI = faPatches.size()-1;
636 faPatches[pI].name_ =
"undefined";
637 faPatches[pI].type_ =
"patch";
638 faPatches[pI].edgeLabels_ = undefEdges;
642 faPatches.setSize(faPatches.size() - 1);
647 faPatches.setSize(faPatches.size() - 1);
655 if (faPatches[patchI].type_ == processorFaPatch::typeName)
657 labelList ngbFaces(faPatches[patchI].edgeLabels_.size(), -1);
661 label curEdge = faPatches[patchI].edgeLabels_[edgeI];
663 label curPMeshEdge = meshEdges[curEdge];
665 forAll(edgeFaces[curPMeshEdge], faceI)
667 label curFace = edgeFaces[curPMeshEdge][faceI];
669 label curPatchID = pbm.whichPatch(curFace);
671 if (curPatchID == faPatches[patchI].ngbPolyPatchID_)
673 ngbFaces[edgeI] = curFace;
679 labelList reorderedEdgeLabels(ngbFaces.size(), -1);
680 for (label i = 0; i < reorderedEdgeLabels.size(); ++i)
682 reorderedEdgeLabels[i] =
683 faPatches[patchI].edgeLabels_
689 faPatches[patchI].edgeLabels_ = reorderedEdgeLabels;
697 for (label pI = 0; pI < faPatches.size(); ++pI)
699 faPatches[pI].dict_.add(
"type", faPatches[pI].type_);
700 faPatches[pI].dict_.add(
"edgeLabels", faPatches[pI].edgeLabels_);
701 faPatches[pI].dict_.add
704 faPatches[pI].ngbPolyPatchID_
707 if (faPatches[pI].type_ == processorFaPatch::typeName)
709 if (faPatches[pI].ngbPolyPatchID_ == -1)
712 <<
"ngbPolyPatch is not defined for processorFaPatch: "
713 << faPatches[pI].name_
718 refCast<const processorPolyPatch>
720 pbm[faPatches[pI].ngbPolyPatchID_]
723 faPatches[pI].dict_.add(
"myProcNo", procPolyPatch.
myProcNo());
724 faPatches[pI].dict_.add
752 boundary_.updateMesh();
755 boundary_.calcGeometry();
793 mesh().facesInstance(),
806 mesh().facesInstance(),
822 patchStartsPtr_(
nullptr),
825 centresPtr_(
nullptr),
826 edgeCentresPtr_(
nullptr),
827 faceAreaNormalsPtr_(
nullptr),
828 edgeAreaNormalsPtr_(
nullptr),
829 pointAreaNormalsPtr_(
nullptr),
830 faceCurvaturesPtr_(
nullptr),
831 edgeTransformTensorsPtr_(
nullptr),
832 correctPatchPointNormalsPtr_(
nullptr),
833 globalMeshDataPtr_(
nullptr)
840 forAll(faceLabels_, faceI)
848 const label nTotalEdges = bp.
nEdges();
852 labelList edgeLabels(nTotalEdges - nInternalEdges, -1);
856 edgeLabels[edgeI] = nInternalEdges + edgeI;
861 patchDict.
add(
"type",
"patch");
862 patchDict.
add(
"edgeLabels", edgeLabels);
863 patchDict.
add(
"ngbPolyPatchIndex", -1);
869 addFaPatches(faPatchLst);
871 setPrimitiveMeshData();
874 boundary_.updateMesh();
877 boundary_.calcGeometry();
955 return patch().localPoints();
967 return patch().localFaces();
978 <<
"boundary already exists"
982 boundary_.setSize(
p.size());
986 boundary_.set(patchI,
p[patchI]);
989 setPrimitiveMeshData();
991 boundary_.checkDefinition();
1027 if (!patchStartsPtr_)
1032 return *patchStartsPtr_;
1065 return *centresPtr_;
1071 if (!edgeCentresPtr_)
1076 return *edgeCentresPtr_;
1098 <<
"S0 is not available"
1133 if (!faceAreaNormalsPtr_)
1135 calcFaceAreaNormals();
1138 return *faceAreaNormalsPtr_;
1144 if (!edgeAreaNormalsPtr_)
1146 calcEdgeAreaNormals();
1149 return *edgeAreaNormalsPtr_;
1155 if (!pointAreaNormalsPtr_)
1157 calcPointAreaNormals();
1159 if (quadricsFit_ > 0)
1161 calcPointAreaNormalsByQuadricsFit();
1165 return *pointAreaNormalsPtr_;
1171 if (!faceCurvaturesPtr_)
1173 calcFaceCurvatures();
1176 return *faceCurvaturesPtr_;
1183 if (!edgeTransformTensorsPtr_)
1185 calcEdgeTransformTensors();
1188 return *edgeTransformTensorsPtr_;
1194 if (!globalMeshDataPtr_)
1199 return *globalMeshDataPtr_;
1207 calcLduAddressing();
1222 if (S00Ptr_ && S0Ptr_)
1252 curTimeIndex_ = time().timeIndex();
1255 clearGeomNotAreas();
1260 patchPtr_->movePoints(newPoints);
1281 <<
"patchID is not in the valid range"
1285 if (correctPatchPointNormalsPtr_)
1287 return (*correctPatchPointNormalsPtr_)[
patchID];
1296 if (!correctPatchPointNormalsPtr_)
1301 return *correctPatchPointNormalsPtr_;
1307 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()
Test if this a parallel run, or allow modify access.
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)
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.
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.
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< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
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)
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.
wordList toc() const
Return the table of contents.
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.