Go to the documentation of this file.
41 const word& defaultPatchFieldType,
42 const bool validBoundary
57 label insertPatchi = polyPatches.size();
58 label startFacei =
mesh.nFaces();
60 if (!isA<processorPolyPatch>(
patch))
62 forAll(polyPatches, patchi)
64 const polyPatch& pp = polyPatches[patchi];
66 if (isA<processorPolyPatch>(pp))
68 insertPatchi = patchi;
69 startFacei = pp.
start();
82 label sz = polyPatches.size();
110 addPatchFields<volScalarField>
114 defaultPatchFieldType,
117 addPatchFields<volVectorField>
121 defaultPatchFieldType,
124 addPatchFields<volSphericalTensorField>
128 defaultPatchFieldType,
131 addPatchFields<volSymmTensorField>
135 defaultPatchFieldType,
138 addPatchFields<volTensorField>
142 defaultPatchFieldType,
148 addPatchFields<surfaceScalarField>
152 defaultPatchFieldType,
155 addPatchFields<surfaceVectorField>
159 defaultPatchFieldType,
162 addPatchFields<surfaceSphericalTensorField>
166 defaultPatchFieldType,
169 addPatchFields<surfaceSymmTensorField>
173 defaultPatchFieldType,
176 addPatchFields<surfaceTensorField>
180 defaultPatchFieldType,
187 for (label i = 0; i < insertPatchi; i++)
192 for (label i = insertPatchi; i < sz; i++)
197 oldToNew[sz] = insertPatchi;
200 polyPatches.
reorder(oldToNew, validBoundary);
201 fvPatches.reorder(oldToNew);
203 reorderPatchFields<volScalarField>(
mesh, oldToNew);
204 reorderPatchFields<volVectorField>(
mesh, oldToNew);
205 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
206 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
207 reorderPatchFields<volTensorField>(
mesh, oldToNew);
208 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
209 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
210 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
211 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
212 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
218 void Foam::fvMeshTools::setPatchFields
225 setPatchFields<volScalarField>(
mesh, patchi, patchFieldDict);
226 setPatchFields<volVectorField>(
mesh, patchi, patchFieldDict);
227 setPatchFields<volSphericalTensorField>(
mesh, patchi, patchFieldDict);
228 setPatchFields<volSymmTensorField>(
mesh, patchi, patchFieldDict);
229 setPatchFields<volTensorField>(
mesh, patchi, patchFieldDict);
230 setPatchFields<surfaceScalarField>(
mesh, patchi, patchFieldDict);
231 setPatchFields<surfaceVectorField>(
mesh, patchi, patchFieldDict);
232 setPatchFields<surfaceSphericalTensorField>
238 setPatchFields<surfaceSymmTensorField>(
mesh, patchi, patchFieldDict);
239 setPatchFields<surfaceTensorField>(
mesh, patchi, patchFieldDict);
245 setPatchFields<volScalarField>(
mesh, patchi,
Zero);
246 setPatchFields<volVectorField>(
mesh, patchi,
Zero);
247 setPatchFields<volSphericalTensorField>
253 setPatchFields<volSymmTensorField>
259 setPatchFields<volTensorField>(
mesh, patchi,
Zero);
260 setPatchFields<surfaceScalarField>(
mesh, patchi,
Zero);
261 setPatchFields<surfaceVectorField>(
mesh, patchi,
Zero);
262 setPatchFields<surfaceSphericalTensorField>
268 setPatchFields<surfaceSymmTensorField>
274 setPatchFields<surfaceTensorField>(
mesh, patchi,
Zero);
288 if (polyPatches.empty())
291 <<
"No patches in mesh"
296 for (label patchi =
nPatches; patchi < polyPatches.size(); patchi++)
298 nFaces += polyPatches[patchi].size();
300 reduce(nFaces, sumOp<label>());
305 <<
"There are still " << nFaces
306 <<
" faces in " << polyPatches.size()-
nPatches
316 trimPatchFields<volSphericalTensorField>(
mesh,
nPatches);
322 trimPatchFields<surfaceSphericalTensorField>(
mesh,
nPatches);
323 trimPatchFields<surfaceSymmTensorField>(
mesh,
nPatches);
332 const label nNewPatches,
333 const bool validBoundary
341 polyPatches.
reorder(oldToNew, validBoundary);
342 fvPatches.reorder(oldToNew);
344 reorderPatchFields<volScalarField>(
mesh, oldToNew);
345 reorderPatchFields<volVectorField>(
mesh, oldToNew);
346 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
347 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
348 reorderPatchFields<volTensorField>(
mesh, oldToNew);
349 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
350 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
351 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
352 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
353 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
356 trimPatches(
mesh, nNewPatches);
363 const bool validBoundary
378 if (!isA<processorPolyPatch>(pp))
380 label nFaces = pp.size();
388 newToOld[newI] = patchI;
389 oldToNew[patchI] = newI++;
399 if (isA<processorPolyPatch>(pp) && pp.size())
401 newToOld[newI] = patchI;
402 oldToNew[patchI] = newI++;
411 if (oldToNew[patchI] == -1)
413 oldToNew[patchI] = newI++;
417 reorderPatches(
mesh, oldToNew, newToOld.size(), validBoundary);
426 const bool masterOnlyReading
486 toSlave << patchEntries;
497 fromMaster >> patchEntries;
509 bool haveMesh =
isDir(meshDir);
653 forAll(patchEntries, patchI)
655 const entry&
e = patchEntries[patchI];
660 type == processorPolyPatch::typeName
661 ||
type == processorCyclicPolyPatch::typeName
670 patchDict.
set(
"nFaces", 0);
671 patchDict.set(
"startFace", 0);
678 patchEntries[patchI].keyword(),
749 if (pz.size() || fz.size() || cz.size())
787 dummyDict.
add(
"divSchemes", divDict);
789 dummyDict.
add(
"gradSchemes", gradDict);
791 dummyDict.
add(
"laplacianSchemes", laplDict);
A keyword and a list of tokens is an 'entry'.
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
void clear()
Clear the zones.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Foam::autoPtr< Foam::fvMesh > meshPtr(nullptr)
fileCheckTypes
Enumeration defining the file checking options.
static constexpr int masterNo() noexcept
Process index of the master (always 0)
A class for handling words, derived from Foam::string.
A class for handling file names.
A primitive field of type <T> with automated input and output.
Read and store dictionary entries for boundary patches.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static word defaultRegion
Return the default region name.
const fileName & instance() const noexcept
static constexpr const zero Zero
Global zero (0)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Output inter-processor communications stream.
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.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
static bool master(const label communicator=worldComm)
Am I the master process.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
const Time & time() const
Return Time associated with the objectRegistry.
#define forAll(list, i)
Loop across all elements in list.
Registry of regIOobjects.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
A subset of mesh faces organised as a primitive patch.
messageStream Info
Information stream (stdout output on master, null elsewhere)
A patch is a list of labels that address the faces in the global face list.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void setSize(const label n)
Alias for resize()
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void setSize(const label newLen)
Same as resize()
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void addFvPatches(PtrList< polyPatch > &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
PtrList< T > clone(Args &&... args) const
Make a copy by cloning each of the list elements.
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.
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
label start() const
Return start label of this patch in the polyMesh face list.
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
wordList names() const
A list of the zone names.
readOption readOpt() const noexcept
The read option.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const word & name() const noexcept
Return name.
const word & system() const
Return system name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
fileName path() const
Return path.
const std::string patch
OpenFOAM patch number as a std::string.
label nInternalFaces() const noexcept
Number of internal faces.
static bool & parRun() noexcept
Test if this a parallel run.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionedScalar e
Elementary charge.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
const Time & time() const
Return the top-level database.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Input inter-processor communications stream.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
void clearOut()
Clear all geometry and addressing.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
const objectRegistry & db() const noexcept
Return the local objectRegistry.