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 " <<
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_(NULL),
296 interpolationAddrPtr_(NULL),
298 insertedCellLabelsPtr_(NULL)
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;
393 <<
"Requested direct addressing for an interpolative mapper." 409 return *directAddrPtr_;
419 <<
"Requested interpolative addressing for a direct mapper." 423 if (!interpolationAddrPtr_)
428 return *interpolationAddrPtr_;
437 <<
"Requested interpolative weights for a direct mapper." 452 if (!insertedCellLabelsPtr_)
457 insertedCellLabelsPtr_ =
new labelList(0);
465 return *insertedCellLabelsPtr_;
virtual const scalarListList & weights() const
Return interpolaion weights.
List< labelList > labelListList
A List of labelList.
const List< objectMap > & cellsFromEdgesMap() const
Cells inflated from edges.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool insertedObjects() const
Are there any inserted cells.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
virtual label size() const
Return size.
virtual const labelList & insertedObjectLabels() const
Return list of inserted cells.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< objectMap > & cellsFromCellsMap() const
Cells originating from cells.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
List< scalarList > scalarListList
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual label sizeBeforeMapping() const
Return size before mapping.
virtual const labelListList & addressing() const
Return interpolated addressing.
List< scalar > scalarList
A List of scalars.
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...
const List< objectMap > & cellsFromFacesMap() const
Cells inflated from faces.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label nOldCells() const
Number of old cells.
bool hasOldCellVolumes() const
Template functions to aid in the implementation of demand driven data.
virtual bool direct() const
Is the mapping direct.
virtual const labelUList & directAddressing() const
Return direct addressing.
const labelList & cellMap() const
Old cell map.
const scalarField & oldCellVolumes() const
void deleteDemandDrivenData(DataPtr &dataPtr)
virtual ~cellMapper()
Destructor.
const List< objectMap > & cellsFromPointsMap() const
Cells inflated from points.