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()
294 insertedCells_(true),
296 directAddrPtr_(NULL),
297 interpolationAddrPtr_(NULL),
299 insertedCellLabelsPtr_(NULL)
320 insertedCells_ =
false;
335 cm[cfp[cfpI].index()] = 0;
342 cm[cfe[cfeI].index()] = 0;
349 cm[cff[cffI].index()] = 0;
356 cm[cfc[cfcI].index()] = 0;
361 insertedCells_ =
true;
395 "const labelUList& cellMapper::directAddressing() const" 396 ) <<
"Requested direct addressing for an interpolative mapper." 412 return *directAddrPtr_;
423 "const labelListList& cellMapper::addressing() const" 424 ) <<
"Requested interpolative addressing for a direct mapper." 428 if (!interpolationAddrPtr_)
433 return *interpolationAddrPtr_;
443 "const scalarListList& cellMapper::weights() const" 444 ) <<
"Requested interpolative weights for a direct mapper." 459 if (!insertedCellLabelsPtr_)
464 insertedCellLabelsPtr_ =
new labelList(0);
472 return *insertedCellLabelsPtr_;
List< scalarList > scalarListList
virtual const labelListList & addressing() const
Return interpolated addressing.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool empty() const
Return true if the UList is empty (ie, size() is zero).
void deleteDemandDrivenData(DataPtr &dataPtr)
const List< objectMap > & cellsFromPointsMap() const
Cells inflated from points.
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 const labelList & insertedObjectLabels() const
Return list of inserted cells.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual label size() const
Return size.
const scalarField & oldCellVolumes() const
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
bool hasOldCellVolumes() const
virtual label sizeBeforeMapping() const
Return size before mapping.
virtual const labelUList & directAddressing() const
Return direct addressing.
Template functions to aid in the implementation of demand driven data.
List< scalar > scalarList
A List of scalars.
errorManip< error > abort(error &err)
virtual const scalarListList & weights() const
Return interpolaion weights.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
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.
virtual bool direct() const
Is the mapping direct.
const List< objectMap > & cellsFromCellsMap() const
Cells originating from cells.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
List< labelList > labelListList
A List of labelList.
virtual ~cellMapper()
Destructor.
const List< objectMap > & cellsFromEdgesMap() const
Cells inflated from edges.
label nOldCells() const
Number of old cells.
virtual bool insertedObjects() const
Are there any inserted cells.
const labelList & cellMap() const
Old cell map.