52 this->ptrs_[i] = (a[i]).
clone().ptr();
58 template<
class CloneArg>
65 this->ptrs_[i] = (a[i]).
clone(cloneArg).ptr();
86 this->ptrs_[i] = (a[i]).
clone().ptr();
107 this->ptrs_[i++] = (iter()).
clone().ptr();
122 delete this->ptrs_[i];
136 <<
"bad set size " << newSize
137 <<
" for type " <<
typeid(
T).
name()
141 label oldSize = this->size();
147 else if (newSize < oldSize)
150 for (i=newSize; i<oldSize; i++)
154 delete this->ptrs_[i];
158 this->ptrs_.setSize(newSize);
162 this->ptrs_.setSize(newSize);
165 for (i=oldSize; i<newSize; i++)
167 this->ptrs_[i] =
nullptr;
180 delete this->ptrs_[i];
192 this->ptrs_.transfer(a.ptrs_);
199 if (oldToNew.
size() != this->size())
202 <<
"Size of map (" << oldToNew.
size()
203 <<
") not equal to list size (" << this->size()
204 <<
") for type " <<
typeid(
T).
name()
208 List<T*> newPtrs_(this->ptrs_.size(),
reinterpret_cast<T*
>(0));
212 label newI = oldToNew[i];
214 if (newI < 0 || newI >= this->size())
217 <<
"Illegal index " << newI <<
nl 218 <<
"Valid indices are 0.." << this->size()-1
219 <<
" for type " <<
typeid(
T).
name()
226 <<
"reorder map is not unique; element " << newI
227 <<
" already set for type " <<
typeid(
T).
name()
230 newPtrs_[newI] = this->ptrs_[i];
238 <<
"Element " << i <<
" not set after reordering with type " 243 this->ptrs_.transfer(newPtrs_);
254 label oldI = newToOld[newI];
256 if (oldI >= 0 && oldI < this->size())
258 newPtrs_[newI] = this->ptrs_[oldI];
259 this->ptrs_[oldI] =
nullptr;
267 this->ptrs_.transfer(newPtrs_);
279 <<
"attempted assignment to self for type " <<
typeid(
T).
name()
283 if (this->size() == 0)
289 this->ptrs_[i] = (a[i]).
clone().ptr();
292 else if (a.
size() == this->size())
302 <<
"bad size: " << a.
size()
303 <<
" for type " <<
typeid(
T).
name()
315 <<
"attempted assignment to self for type " <<
typeid(
T).
name()
void reorder(const labelUList &oldToNew)
Reorders elements. Ordering does not have to be done in.
#define forAll(list, i)
Loop across all elements in list.
#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...
An STL-conforming const_iterator.
points setSize(newPointi)
Template class for non-intrusive linked PtrLists.
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 operator=(const PtrList< T > &)
Assignment operator.
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)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Non-intrusive singly-linked pointer list.
word name(const complex &)
Return a string representation of a complex.
label size() const
Return the number of elements in the UPtrList.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
void shuffle(const labelUList &newToOld)
Reorders elements. Ordering does not have to be done in.
label size() const
Return the number of elements in the UList.
PtrList()
Null Constructor.