55 const label nOldPoints =
mesh.nPoints();
56 const label nOldFaces =
mesh.nFaces();
57 const label nOldCells =
mesh.nCells();
65 oldPatchStarts[patchi] =
pbm[patchi].start();
66 oldPatchNumPoints[patchi] =
pbm[patchi].nPoints();
74 boundaryProcAddressing,
114 const fvMesh& baseMesh = *baseMeshPtr;
116 const label nNewPoints = baseMesh.
nPoints();
117 const label nNewFaces = baseMesh.
nFaces();
118 const label nNewCells = baseMesh.
nCells();
124 std::move(cellSubMap),
125 std::move(cellAddressing)
131 std::move(faceSubMap),
132 std::move(faceAddressing),
140 std::move(pointSubMap),
141 std::move(pointAddressing)
147 std::move(patchSubMap),
148 std::move(patchAddressing)
156 std::move(oldPatchStarts),
157 std::move(oldPatchNumPoints),
171 std::move(cellSubMap),
178 std::move(faceSubMap),
187 std::move(pointSubMap),
194 std::move(patchSubMap),
203 std::move(oldPatchStarts),
204 std::move(oldPatchNumPoints),
229 mesh.facesInstance(),
247 Info<<
"Reading (cell|face|point|boundary)ProcAddressing from "
248 <<
mesh.facesInstance().c_str() <<
'/'
251 ioAddr.
rename(
"cellProcAddressing");
254 ioAddr.
rename(
"faceProcAddressing");
257 ioAddr.
rename(
"pointProcAddressing");
260 ioAddr.
rename(
"boundaryProcAddressing");
265 mesh.nCells() != cellProcAddressing.
size()
266 ||
mesh.nPoints() != pointProcAddressing.
size()
267 ||
mesh.nFaces() != faceProcAddressing.
size()
268 ||
mesh.boundaryMesh().size() != boundaryProcAddressing.
size()
272 <<
"Read addressing inconsistent with mesh sizes" <<
nl
273 <<
"cells:" <<
mesh.nCells()
275 <<
" size:" << cellProcAddressing.
size() <<
nl
276 <<
"faces:" <<
mesh.nFaces()
278 <<
" size:" << faceProcAddressing.
size() <<
nl
279 <<
"points:" <<
mesh.nPoints()
281 <<
" size:" << pointProcAddressing.
size()
282 <<
"patches:" <<
mesh.boundaryMesh().size()
284 <<
" size:" << boundaryProcAddressing.
size()
295 boundaryProcAddressing
304 const mapDistributePolyMesh& map,
305 const bool decompose,
306 const fileName& writeInstance,
307 refPtr<fileOperation>& writeHandler
311 << (decompose ?
"decompose" :
"reconstruct")
312 <<
") procAddressing files to "
313 <<
mesh.facesInstance().c_str() <<
'/'
322 mesh.facesInstance(),
331 ioAddr.rename(
"cellProcAddressing");
335 ioAddr.rename(
"faceProcAddressing");
339 ioAddr.rename(
"pointProcAddressing");
343 ioAddr.rename(
"boundaryProcAddressing");
352 cellMap =
identity(map.nOldCells());
353 map.distributeCellData(cellMap);
357 const mapDistribute& faceDistMap = map.faceMap();
359 if (faceDistMap.subHasFlip() || faceDistMap.constructHasFlip())
365 faceDistMap.mapDistributeBase::distribute
373 pointMap =
identity(map.nOldPoints());
374 map.distributePointData(pointMap);
376 patchMap =
identity(map.oldPatchSizes().size());
377 map.patchMap().mapDistributeBase::distribute
391 map.cellMap().reverseDistribute(map.nOldCells(), cellMap);
397 if (faceDistMap.subHasFlip() || faceDistMap.constructHasFlip())
403 faceDistMap.mapDistributeBase::reverseDistribute
413 map.pointMap().reverseDistribute(map.nOldPoints(), pointMap);
416 map.patchMap().mapDistributeBase::reverseDistribute
419 map.oldPatchSizes().size(),
434 if (!writeInstance.empty())
436 cellMap.instance() = writeInstance;
437 faceMap.instance() = writeInstance;
438 pointMap.instance() = writeInstance;
439 patchMap.instance() = writeInstance;
442 const auto& tm = cellMap.time();
447 const bool cellOk =
fileHandler().writeObject(cellMap, opt,
true);
449 const bool pointOk =
fileHandler().writeObject(pointMap, opt,
true);
450 const bool patchOk =
fileHandler().writeObject(patchMap, opt,
true);
454 if (!cellOk || !faceOk || !pointOk || !patchOk)
457 <<
"Failed to write some of "
458 << cellMap.objectRelPath() <<
", "
459 <<
faceMap.objectRelPath() <<
", "
460 << pointMap.objectRelPath() <<
", "
461 << patchMap.objectRelPath() <<
endl;
472 const fvMesh& procMesh,
473 const autoPtr<fvMesh>& baseMeshPtr
476 return readProcAddressing(procMesh, baseMeshPtr.get());
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
const polyBoundaryMesh & pbm
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Time & time() const noexcept
Return Time associated with the objectRegistry.
fileName objectRelPath() const
The object path relative to the case.
const fileName & instance() const noexcept
Read access to instance path component.
virtual void rename(const word &newName)
Rename the object.
A simple container for options an IOstream can normally have.
static IndirectList< T > subset_if(const UList< T > &values, const UnaryPredicate &pred, const bool invert=false)
Return an IndirectList comprising entries with values that satisfy the predicate.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static constexpr int masterNo() noexcept
Relative rank for the master process - is always 0.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
@ gatherList
gatherList [manual algorithm]
label size() const noexcept
The number of entries in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
T * get() noexcept
Return pointer to managed object without nullptr checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A class for handling file names.
static const fileOperation & fileHandler()
Return the current file handler. Will create the default file handler if necessary.
Mesh data needed to do the Finite Volume discretisation.
bool constructHasFlip() const noexcept
Does constructMap include a sign.
bool subHasFlip() const noexcept
Does subMap include a sign.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const mapDistribute & patchMap() const noexcept
Patch distribute map.
void distributeCellData(List< T > &values) const
Distribute list of cell data.
label nOldCells() const noexcept
Number of cells in mesh before distribution.
label nOldFaces() const noexcept
Number of faces in mesh before distribution.
const labelList & oldPatchSizes() const noexcept
List of the old patch sizes.
void distributePointData(List< T > &values) const
Distribute list of point data.
const mapDistribute & cellMap() const noexcept
Cell distribute map.
const mapDistribute & pointMap() const noexcept
Point distribute map.
const mapDistribute & faceMap() const noexcept
Face distribute map.
label nOldPoints() const noexcept
Number of points in mesh before distribution.
Class containing processor-to-processor mapping information.
void reverseDistribute(const label constructSize, List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
A class for managing references or pointers (no reference counting).
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
static autoPtr< mapDistributePolyMesh > createReconstructMap(const fvMesh &mesh, const fvMesh *baseMeshPtr, const labelList &cellProcAddressing, const labelList &faceProcAddressing, const labelList &pointProcAddressing, const labelList &boundaryProcAddressing)
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
IOList< label > labelIOList
IO for a List of label.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
Functor to negate primitives. Dummy for most other types.