32 void Foam::cellMapper::calcAddressing()
const
37 || interpolationAddrPtr_
39 || insertedCellLabelsPtr_
43 <<
"Addressing already calculated."
58 labelList& insertedCells = *insertedCellLabelsPtr_;
60 label nInsertedCells = 0;
64 if (directAddr[celli] < 0)
67 directAddr[celli] = 0;
68 insertedCells[nInsertedCells] = celli;
73 insertedCells.setSize(nInsertedCells);
92 const labelList& mo = cfc[cfcI].masterObjects();
94 label celli = cfc[cfcI].index();
96 if (addr[celli].size())
99 <<
"Master cell " << celli
100 <<
" mapped from cell cells " << mo
101 <<
" already destination of mapping."
118 <<
"cellVolumes size " << V.size()
120 <<
". Are your cellVolumes already mapped?"
121 <<
" (new number of cells " << mpm_.
cellMap().
size() <<
")"
127 const labelList& mo = cfc[cfcI].masterObjects();
129 label celli = cfc[cfcI].index();
131 w[celli].setSize(mo.size());
138 w[celli][ci] = V[mo[ci]];
145 w[celli][ci] /= sumV;
151 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
162 const labelList& mo = cfc[cfcI].masterObjects();
164 label celli = cfc[cfcI].index();
166 w[celli] =
scalarList(mo.size(), 1.0/mo.size());
178 if (cm[celli] > -1 && addr[celli].empty())
189 labelList& insertedCells = *insertedCellLabelsPtr_;
191 label nInsertedCells = 0;
195 if (addr[celli].empty())
198 <<
"No interpolative addressing provided for cell " << celli
203 insertedCells.setSize(nInsertedCells);
208 void Foam::cellMapper::clearOut()
223 insertedCells_(true),
225 directAddrPtr_(nullptr),
226 interpolationAddrPtr_(nullptr),
227 weightsPtr_(nullptr),
228 insertedCellLabelsPtr_(nullptr)
243 insertedCells_ =
false;
258 cm[cfc[cfcI].index()] = 0;
263 insertedCells_ =
true;
284 <<
"Requested direct addressing for an interpolative mapper."
288 if (!insertedObjects())
291 return mpm_.cellMap();
300 return *directAddrPtr_;
310 <<
"Requested interpolative addressing for a direct mapper."
314 if (!interpolationAddrPtr_)
319 return *interpolationAddrPtr_;
328 <<
"Requested interpolative weights for a direct mapper."
343 return mpm_.nOldCells();
349 if (!insertedCellLabelsPtr_)
351 if (!insertedObjects())
354 insertedCellLabelsPtr_ =
new labelList(0);
362 return *insertedCellLabelsPtr_;
#define forAll(list, i)
Loop across all elements in list.
void size(const label)
Override size to be inconsistent with allocated storage.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
cellMapper(const polyTopoChangeMap &mpm)
Construct from polyTopoChangeMap.
virtual ~cellMapper()
Destructor.
virtual const labelListList & addressing() const
Return interpolated addressing.
virtual const scalarListList & weights() const
Return interpolation weights.
virtual const labelUList & directAddressing() const
Return direct addressing.
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
virtual label sizeBeforeMapping() const
Return size before mapping.
virtual bool direct() const
Is the mapping direct.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & cellMap() const
Old cell map.
const scalarField & oldCellVolumes() const
const List< objectMap > & cellsFromCellsMap() const
Cells originating from cells.
bool hasOldCellVolumes() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< scalarList > scalarListList
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
List< scalar > scalarList
A List of scalars.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< labelList > labelListList
A List of labelList.