40 ptrs_(s, reinterpret_cast<
T*>(0))
56 label oldSize = size();
62 else if (newSize < oldSize)
64 ptrs_.setSize(newSize);
66 else if (newSize > oldSize)
68 ptrs_.setSize(newSize);
71 for (
label i=oldSize; i<newSize; i++)
89 ptrs_.transfer(a.ptrs_);
96 if (oldToNew.
size() != size())
99 <<
"Size of map (" << oldToNew.
size()
100 <<
") not equal to list size (" << size()
104 List<T*> newPtrs_(ptrs_.size(),
reinterpret_cast<T*
>(0));
108 label newI = oldToNew[i];
110 if (newI < 0 || newI >= size())
113 <<
"Illegal index " << newI <<
nl 114 <<
"Valid indices are 0.." << size()-1
121 <<
"reorder map is not unique; element " << newI
124 newPtrs_[newI] = ptrs_[i];
132 <<
"Element " << i <<
" not set after reordering." <<
nl 137 ptrs_.transfer(newPtrs_);
148 label oldI = newToOld[newI];
150 if (oldI >= 0 && oldI < this->size())
152 newPtrs_[newI] = this->ptrs_[oldI];
#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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
UPtrList()
Null Constructor.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void setSize(const label)
Reset size of UPtrList. This can only be used to set the size.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
errorManip< error > abort(error &err)
void shuffle(const labelUList &newToOld)
Reorders elements. Ordering does not have to be done in.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void transfer(UPtrList< T > &)
Transfer the contents of the argument UPtrList into this.
void clear()
Clear the UPtrList, i.e. set size to zero.
label size() const
Return the number of elements in the UList.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void reorder(const labelUList &oldToNew)
Reorders elements. Ordering does not have to be done in.