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
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;
183 this->ptrs_[j] = this->ptrs_[i];
190 if (j != this->size())
192 this->ptrs_.setSize(j);
204 delete this->ptrs_[i];
216 this->ptrs_.transfer(a.ptrs_);
223 if (oldToNew.
size() != this->size())
226 <<
"Size of map (" << oldToNew.
size()
227 <<
") not equal to list size (" << this->size()
228 <<
") for type " <<
typeid(
T).
name()
232 List<T*> newPtrs_(this->ptrs_.size(),
reinterpret_cast<T*
>(0));
236 label newI = oldToNew[i];
238 if (newI < 0 || newI >= this->size())
241 <<
"Illegal index " << newI <<
nl
242 <<
"Valid indices are 0.." << this->size()-1
243 <<
" for type " <<
typeid(
T).
name()
250 <<
"reorder map is not unique; element " << newI
251 <<
" already set for type " <<
typeid(
T).
name()
254 newPtrs_[newI] = this->ptrs_[i];
262 <<
"Element " << i <<
" not set after reordering with type "
267 this->ptrs_.transfer(newPtrs_);
278 label oldI = newToOld[newI];
280 if (oldI >= 0 && oldI < this->size())
282 newPtrs_[newI] = this->ptrs_[oldI];
283 this->ptrs_[oldI] =
nullptr;
291 this->ptrs_.transfer(newPtrs_);
303 <<
"attempted assignment to self for type " <<
typeid(
T).
name()
307 if (this->size() == 0)
313 this->ptrs_[i] = (a[i]).
clone().ptr();
316 else if (a.
size() == this->size())
326 <<
"bad size: " << a.
size()
327 <<
" for type " <<
typeid(
T).
name()
339 <<
"attempted assignment to self for type " <<
typeid(
T).
name()
Non-intrusive singly-linked pointer list.
#define forAll(list, i)
Loop across all elements in list.
Template class for non-intrusive linked PtrLists.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void shrink()
Shrink the allocated space to the number of elements used.
PtrList()
Null Constructor.
void reorder(const labelUList &oldToNew)
Reorders elements. Ordering does not have to be done in.
void shuffle(const labelUList &newToOld)
Reorders elements. Ordering does not have to be done in.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
void operator=(const PtrList< T > &)
Assignment operator.
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
An STL-conforming const_iterator.
label size() const
Return the number of elements in the UList.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
label size() const
Return the number of elements in the UPtrList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word name(const bool)
Return a word representation of a bool.
errorManip< error > abort(error &err)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
points setSize(newPointi)