47 const word& defaultPatchFieldType,
48 const bool validBoundary
62 label insertPatchi = polyPatches.size();
63 label startFacei =
mesh.nFaces();
65 if (!isA<processorPolyPatch>(
patch))
67 forAll(polyPatches, patchi)
69 const polyPatch& pp = polyPatches[patchi];
71 if (isA<processorPolyPatch>(pp))
73 insertPatchi = patchi;
74 startFacei = pp.
start();
87 label sz = polyPatches.size();
104 fvPatches.resize(sz+1);
119 #define doLocalCode(FieldType) \ 121 addPatchFields<FieldType> \ 123 mesh, patchFieldDict, defaultPatchFieldType, Zero \ 152 for (label i = insertPatchi; i < sz; ++i)
156 oldToNew[sz] = insertPatchi;
160 polyPatches.reorder(oldToNew, validBoundary);
161 fvPatches.reorder(oldToNew);
166 #define doLocalCode(FieldType) \ 168 reorderPatchFields<FieldType>(mesh, oldToNew); \ 193 void Foam::fvMeshTools::setPatchFields
203 #define doLocalCode(FieldType) \ 205 setPatchFields<FieldType>(mesh, patchi, patchFieldDict); \ 233 #define doLocalCode(FieldType) \ 235 setPatchFields<FieldType>(mesh, patchi, Zero); \ 259 void Foam::fvMeshTools::trimPatches(fvMesh&
mesh,
const label
nPatches)
265 auto& fvPatches =
const_cast<fvBoundaryMesh&
>(
mesh.
boundary());
267 if (polyPatches.empty())
270 <<
"No patches in mesh" 275 for (label patchi =
nPatches; patchi < polyPatches.size(); patchi++)
277 nFaces += polyPatches[patchi].size();
279 reduce(nFaces, sumOp<label>());
284 <<
"There are still " << nFaces
285 <<
" faces in " << polyPatches.size()-
nPatches 296 #define doLocalCode(FieldType) \ 298 trimPatchFields<FieldType>(mesh, nPatches); \ 325 const label nNewPatches,
326 const bool validBoundary
330 auto& fvPatches =
const_cast<fvBoundaryMesh&
>(
mesh.
boundary());
333 polyPatches.reorder(oldToNew, validBoundary);
334 fvPatches.reorder(oldToNew);
339 #define doLocalCode(FieldType) \ 341 reorderPatchFields<FieldType>(mesh, oldToNew); \ 363 trimPatches(
mesh, nNewPatches);
370 const bool validBoundary
385 if (!isA<processorPolyPatch>(pp))
387 label nFaces = pp.size();
395 newToOld[newI] = patchI;
396 oldToNew[patchI] = newI++;
404 const polyPatch& pp = pbm[patchI];
406 if (isA<processorPolyPatch>(pp) && pp.size())
408 newToOld[newI] = patchI;
409 oldToNew[patchI] = newI++;
418 if (oldToNew[patchI] == -1)
420 oldToNew[patchI] = newI++;
424 reorderPatches(
mesh, oldToNew, newToOld.
size(), validBoundary);
453 const bool masterOnlyReading,
525 meshIO.instance() = facesInstance;
529 IOobject cmptIO(meshIO,
"points", meshSubDir);
532 cmptIO.registerObject(
false);
536 const fileName meshDir =
io.
time().
path()/facesInstance/meshSubDir;
537 bool haveMesh =
isDir(meshDir);
565 cmptIO.instance() = pointsInstance;
566 cmptIO.rename(
"points");
570 cmptIO.instance() = facesInstance;
573 cmptIO.rename(
"faces");
577 cmptIO.rename(
"owner");
581 cmptIO.rename(
"neighbour");
602 DynamicList<polyPatch*> newPatches(patchEntries.
size());
625 forAll(patchEntries, patchi)
627 const entry&
e = patchEntries[patchi];
628 const word
type(
e.dict().get<word>(
"type"));
629 const word&
name =
e.keyword();
633 type == processorPolyPatch::typeName
634 ||
type == processorCyclicPolyPatch::typeName
642 dictionary patchDict(
e.dict());
646 patchDict.set(
"nFaces", 0);
647 patchDict.set(
"startFace", 0);
691 List<pointZone*> pz(pointZoneNames.size());
694 pz[i] =
new pointZone
701 List<faceZone*> fz(faceZoneNames.size());
711 List<cellZone*> cz(cellZoneNames.size());
722 if (pz.size() || fz.size() || cz.size())
736 const bool decompose,
795 io.time().
path()/
io.instance()/meshSubDir/
"faces" 817 forAll(patchEntries, patchi)
819 const entry&
e = patchEntries[patchi];
820 const word
type(
e.dict().get<word>(
"type"));
821 const word&
name =
e.keyword();
825 type == processorPolyPatch::typeName
826 ||
type == processorCyclicPolyPatch::typeName
835 dictionary patchDict(
e.dict());
836 patchDict.set(
"nFaces", 0);
837 patchDict.set(
"startFace", 0);
847 dummyMesh.boundaryMesh()
853 dummyMesh.addFvPatches(
patches,
false);
863 new pointZone(
"dummyPointZone", 0, dummyMesh.pointZones())
868 new faceZone(
"dummyFaceZone", 0, dummyMesh.faceZones())
873 new cellZone(
"dummyCellZone", 0, dummyMesh.cellZones())
875 dummyMesh.addZones(pz, fz, cz);
876 dummyMesh.pointZones().clear();
877 dummyMesh.faceZones().clear();
878 dummyMesh.cellZones().clear();
909 forAll(patchEntries, patchi)
911 const entry&
e = patchEntries[patchi];
912 const word
type(
e.dict().get<word>(
"type"));
913 const word&
name =
e.keyword();
917 type == processorPolyPatch::typeName
918 ||
type == processorCyclicPolyPatch::typeName
927 <<
"Non-processor patches not synchronised." 931 <<
" patches, master has " 943 <<
"Non-processor patches not synchronised." 945 <<
"Master patch " << patchi
949 <<
" patch " << patchi
951 <<
" type:" <<
patches[patchi].type()
979 List<pointZone*> pz(pointZoneNames.size());
984 List<faceZone*> fz(faceZoneNames.size());
989 List<cellZone*> cz(cellZoneNames.size());
1011 pointSetNames = objects.sortedNames<pointSet>();
1012 faceSetNames = objects.sortedNames<faceSet>();
1013 cellSetNames = objects.sortedNames<cellSet>();
1025 for (
const word& setName : pointSetNames)
1027 pointSet(
mesh, setName, 0).write();
1029 for (
const word& setName : faceSetNames)
1031 faceSet(
mesh, setName, 0).write();
1033 for (
const word& setName : cellSetNames)
1035 cellSet(
mesh, setName, 0).write();
1116 IOdictionary(
io,
dict).regIOobject::write();
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order.
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
void clearOut()
Clear all geometry and addressing.
fileName path() const
Return path.
void removeFvBoundary()
Remove boundary patches. Warning: fvPatchFields hold ref to these fvPatches.
A class for handling file names.
void clear()
Clear the zones.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
const word & name() const noexcept
Return the object name.
vectorIOField pointIOField
pointIOField is a vectorIOField.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
PtrList< T > clone(Args &&... args) const
Make a copy by cloning each of the list elements.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
GeometricField< sphericalTensor, fvsPatchField, surfaceMesh > surfaceSphericalTensorField
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
autoPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler.
label size() const noexcept
The number of elements in table.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Ignore writing from objectRegistry::writeObject()
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
const Time & time() const
Return the top-level database.
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
GeometricField< vector, fvPatchField, volMesh > volVectorField
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
Default geometry calculation scheme. Slight stabilisation for bad meshes.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Foam::word regionName(Foam::polyMesh::defaultRegion)
CompactIOList< face, label > faceCompactIOList
const dimensionedScalar e
Elementary charge.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
GeometricField< symmTensor, fvsPatchField, surfaceMesh > surfaceSymmTensorField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
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.
bool checkDefinition(const bool report=false) const
Check boundary definition.
label size() const noexcept
The number of elements in the list.
const word & system() const noexcept
Return system name.
void addZones(PtrList< pointZone > &&pz, PtrList< faceZone > &&fz, PtrList< cellZone > &&cz)
Add mesh zones.
GeometricField< tensor, fvsPatchField, surfaceMesh > surfaceTensorField
const objectRegistry & db() const noexcept
Return the local objectRegistry.
const globalMeshData & globalData() const
Return parallel info.
label nInternalFaces() const noexcept
Number of internal faces.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
static fileCheckTypes fileModificationChecking
Type of file modification checking.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
void resize(const label newLen)
Adjust size of PtrList.
const fileName & instance() const noexcept
Read access to instance path component.
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
bool empty() const noexcept
True if the list is empty (ie, size() is zero)
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
List< word > wordList
A List of words.
const Time & time() const
Return Time associated with the objectRegistry.
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
Am I the master rank.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & patches
Automatically write from objectRegistry::writeObject()
const std::string patch
OpenFOAM patch number as a std::string.
virtual const fvGeometryScheme & geometry() const
Return reference to geometry calculation scheme.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
wordList names() const
A list of the zone names.
messageStream Info
Information stream (stdout output on master, null elsewhere)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
List< label > labelList
A List of labels.
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
Read and store dictionary entries for boundary patches.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Defines the attributes of an object for which implicit objectRegistry management is supported...
IOList< label > labelIOList
Label container classes.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.