41 Foam::hexRef8Data::hexRef8Data(
const IOobject&
io)
51 cellLevelPtr_.reset(
new Type(rio));
62 pointLevelPtr_.reset(
new Type(rio));
73 level0EdgePtr_.reset(
new Type(rio));
84 refHistoryPtr_.reset(
new Type(rio));
90 Foam::hexRef8Data::hexRef8Data
93 const hexRef8Data& data,
98 if (data.cellLevelPtr_)
100 IOobject rio(
io, data.cellLevelPtr_().
name());
111 if (data.pointLevelPtr_)
113 IOobject rio(
io, data.pointLevelPtr_().
name());
124 if (data.level0EdgePtr_)
126 IOobject rio(
io, data.level0EdgePtr_().
name());
133 if (data.refHistoryPtr_)
135 IOobject rio(
io, data.refHistoryPtr_().
name());
137 refHistoryPtr_ =
data.refHistoryPtr_().
clone(rio, cellMap);
142 Foam::hexRef8Data::hexRef8Data
145 const UPtrList<const labelList>& cellMaps,
146 const UPtrList<const labelList>& pointMaps,
147 const UPtrList<const hexRef8Data>& procDatas
150 const polyMesh&
mesh =
dynamic_cast<const polyMesh&
>(
io.
db());
154 if (procDatas[0].cellLevelPtr_)
156 IOobject rio(
io, procDatas[0].cellLevelPtr_().
name());
159 auto& cellLevel = *cellLevelPtr_;
163 const labelList& procCellLevel = procDatas[procI].cellLevelPtr_();
171 if (procDatas[0].pointLevelPtr_)
173 IOobject rio(
io, procDatas[0].pointLevelPtr_().
name());
176 auto& pointLevel = *pointLevelPtr_;
180 const labelList& procPointLevel = procDatas[procI].pointLevelPtr_();
181 labelUIndList(pointLevel, pointMaps[procI]) = procPointLevel;
188 if (procDatas[0].level0EdgePtr_)
190 IOobject rio(
io, procDatas[0].level0EdgePtr_().
name());
197 procDatas[0].level0EdgePtr_()
205 if (procDatas[0].refHistoryPtr_)
207 IOobject rio(
io, procDatas[0].refHistoryPtr_().
name());
209 UPtrList<const refinementHistory> procRefs(procDatas.size());
212 procRefs.set(i, &procDatas[i].refHistoryPtr_());
217 new refinementHistory
241 if (hasCellLevel && !cellLevelPtr_)
252 if (hasPointLevel && !pointLevelPtr_)
254 IOobject rio(
io,
"pointLevel");
270 IOobject rio(
io,
"level0Edge");
284 if (hasHistory && !refHistoryPtr_)
298 (cellLevelPtr_ && cellLevelPtr_().size() != map.nOldCells())
299 || (pointLevelPtr_ && pointLevelPtr_().size() != map.nOldPoints())
302 cellLevelPtr_.clear();
303 pointLevelPtr_.clear();
304 level0EdgePtr_.clear();
305 refHistoryPtr_.clear();
312 const labelList& cellMap = map.cellMap();
318 label oldCelli = cellMap[newCelli];
322 newCellLevel[newCelli] = 0;
326 newCellLevel[newCelli] = cellLevel[oldCelli];
329 cellLevel.transfer(newCellLevel);
330 cellLevelPtr_().instance() = map.mesh().facesInstance();
334 const labelList& pointMap = map.pointMap();
335 labelList& pointLevel = pointLevelPtr_();
337 labelList newPointLevel(pointMap.size());
348 newPointLevel[
newPointi] = pointLevel[oldPointi];
351 pointLevel.transfer(newPointLevel);
352 pointLevelPtr_().instance() = map.mesh().facesInstance();
356 if (refHistoryPtr_ && refHistoryPtr_().active())
358 refHistoryPtr_().updateMesh(map);
359 refHistoryPtr_().instance() = map.mesh().facesInstance();
368 map.cellMap().distribute(*cellLevelPtr_);
372 map.pointMap().distribute(*pointLevelPtr_);
377 if (refHistoryPtr_ && refHistoryPtr_().active())
379 refHistoryPtr_().distribute(map);
389 ok = ok && cellLevelPtr_().write();
393 ok = ok && pointLevelPtr_().write();
397 ok = ok && level0EdgePtr_().write();
401 ok = ok && refHistoryPtr_().write();
readOption readOpt() const noexcept
Get the read option.
label nPoints() const noexcept
Number of mesh points.
void sync(const IOobject &io)
Parallel synchronise. This enforces valid objects on all processors.
const word & name() const noexcept
Return the object name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
UniformDimensionedField< scalar > uniformDimensionedScalarField
autoPtr< dictionary > clone() const
Construct and return clone.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
#define forAll(list, i)
Loop across all elements in list.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
void updateMesh(const mapPolyMesh &)
Update local numbering for changed mesh.
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.
Database for solution data, solver performance and other reduced data.
UIndirectList< label > labelUIndList
UIndirectList of labels.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
static bool master(const label communicator=worldComm)
Am I the master rank.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void distribute(const mapDistributePolyMesh &)
In-place distribute.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
All refinement history. Used in unrefinement.
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...
~hexRef8Data()
Destructor.
IOList< label > labelIOList
Label container classes.
static constexpr const zero Zero
Global zero (0)