33 void Foam::cellMapper::calcAddressing()
const 38 || interpolationAddrPtr_
40 || insertedCellLabelsPtr_
44 <<
"Addressing already calculated." 59 labelList& insertedCells = *insertedCellLabelsPtr_;
61 label nInsertedCells = 0;
65 if (directAddr[celli] < 0)
68 directAddr[celli] = 0;
69 insertedCells[nInsertedCells] = celli;
74 insertedCells.setSize(nInsertedCells);
91 const labelList& mo = cfp[cfpI].masterObjects();
93 label celli = cfp[cfpI].index();
95 if (addr[celli].size())
98 <<
"Master cell " << celli
99 <<
" mapped from point cells " << mo
105 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
113 const labelList& mo = cfe[cfeI].masterObjects();
115 label celli = cfe[cfeI].index();
117 if (addr[celli].size())
120 <<
"Master cell " << celli
121 <<
" mapped from edge cells " << mo
127 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
135 const labelList& mo = cff[cffI].masterObjects();
137 label celli = cff[cffI].index();
139 if (addr[celli].size())
142 <<
"Master cell " << celli
143 <<
" mapped from face cells " << mo
149 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
159 const labelList& mo = cfc[cfcI].masterObjects();
161 label celli = cfc[cfcI].index();
163 if (addr[celli].size())
166 <<
"Master cell " << celli
167 <<
" mapped from cell cells " << mo
168 <<
" already destination of mapping." 185 <<
"cellVolumes size " << V.size()
187 <<
". Are your cellVolumes already mapped?" 188 <<
" (new number of cells " << mpm_.
cellMap().
size() <<
")" 194 const labelList& mo = cfc[cfcI].masterObjects();
196 label celli = cfc[cfcI].index();
198 w[celli].setSize(mo.size());
205 w[celli][ci] = V[mo[ci]];
212 w[celli][ci] /= sumV;
218 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
229 const labelList& mo = cfc[cfcI].masterObjects();
231 label celli = cfc[cfcI].index();
233 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
245 if (cm[celli] > -1 && addr[celli].empty())
256 labelList& insertedCells = *insertedCellLabelsPtr_;
258 label nInsertedCells = 0;
262 if (addr[celli].empty())
268 insertedCells[nInsertedCells] = celli;
273 insertedCells.setSize(nInsertedCells);
278 void Foam::cellMapper::clearOut()
293 insertedCells_(true),
295 directAddrPtr_(nullptr),
296 interpolationAddrPtr_(nullptr),
297 weightsPtr_(nullptr),
298 insertedCellLabelsPtr_(nullptr)
319 insertedCells_ =
false;
334 cm[cfp[cfpI].index()] = 0;
341 cm[cfe[cfeI].index()] = 0;
348 cm[cff[cffI].index()] = 0;
355 cm[cfc[cfcI].index()] = 0;
360 insertedCells_ =
true;
387 <<
"Requested direct addressing for an interpolative mapper." 403 return *directAddrPtr_;
413 <<
"Requested interpolative addressing for a direct mapper." 417 if (!interpolationAddrPtr_)
422 return *interpolationAddrPtr_;
431 <<
"Requested interpolative weights for a direct mapper." 446 if (!insertedCellLabelsPtr_)
451 insertedCellLabelsPtr_ =
new labelList(0);
459 return *insertedCellLabelsPtr_;
const scalarField & oldCellVolumes() const
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual label sizeBeforeMapping() const
Return size before mapping.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const scalarListList & weights() const
Return interpolation weights.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< objectMap > & cellsFromPointsMap() const
Cells inflated from points.
const List< objectMap > & cellsFromFacesMap() const
Cells inflated from faces.
const List< objectMap > & cellsFromEdgesMap() const
Cells inflated from edges.
const labelList & cellMap() const
Old cell map.
const List< objectMap > & cellsFromCellsMap() const
Cells originating from cells.
List< scalarList > scalarListList
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const labelListList & addressing() const
Return interpolated addressing.
List< scalar > scalarList
A List of scalars.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
cellMapper(const polyTopoChangeMap &mpm)
Construct from polyTopoChangeMap.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
virtual const labelUList & directAddressing() const
Return direct addressing.
Template functions to aid in the implementation of demand driven data.
bool hasOldCellVolumes() const
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
void deleteDemandDrivenData(DataPtr &dataPtr)
virtual ~cellMapper()
Destructor.
label nOldCells() const
Number of old cells.
virtual bool insertedObjects() const
Are there any inserted cells.
virtual bool direct() const
Is the mapping direct.