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
483 toSlave << patchEntries;
494 fromMaster >> patchEntries;
505 bool haveMesh =
isDir(meshDir);
571 forAll(patchEntries, patchI)
573 const entry&
e = patchEntries[patchI];
578 type == processorPolyPatch::typeName
579 ||
type == processorCyclicPolyPatch::typeName
585 patchDict.
set(
"nFaces", 0);
586 patchDict.set(
"startFace", 0);
592 patchEntries[patchI].keyword(),
663 if (pz.size() && fz.size() && cz.size())
701 dummyDict.
add(
"divSchemes", divDict);
703 dummyDict.
add(
"gradSchemes", gradDict);
705 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.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
A class for handling file names.
Foam::polyBoundaryMeshEntries.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static word defaultRegion
Return the default region name.
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.
const fileName & instance() const
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.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
void removeFvBoundary()
Remove boundary patches. Warning: fvPatchFields hold ref to.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
const Time & time() const
Return time.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
const objectRegistry & db() const
Return the local objectRegistry.
Registry of regIOobjects.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
A subset of mesh faces organised as a primitive patch.
static int lastSlave(const label communicator=0)
Process index of last slave.
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
const pointZoneMesh & pointZones() const
Return point zone mesh.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void setSize(const label newLen)
Same as resize()
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 a pointer to a new patch created on freestore from.
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (if set) or nullptr.
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.
static bool master(const label communicator=0)
Am I the master process.
static constexpr int firstSlave() noexcept
Process index of first slave.
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 & 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.
readOption readOpt() const
The read option.
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 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 setSize(const label newSize)
Alias for resize(const label)
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?