45 for (
const label newIdx : map)
53 <<
"Inverse location " << newIdx
54 <<
" is out of range. List has size " << len
59 if (inverse[newIdx] >= 0)
62 <<
"Map is not one-to-one. At index " << i
63 <<
" element " << newIdx <<
" has already occurred\n" 64 <<
"Please use invertOneToMany instead" 87 for (
const label newIdx : map)
93 <<
"Inverse location " << newIdx
94 <<
" is out of range. List has size " << len
116 const label len =
values.size();
118 Map<label> inverse(2*len);
120 for (label i = 0 ; i < len; ++i)
125 inverse.insert(
values[i], i);
140 for (
const label newIdx : map)
148 <<
"Inverse location " << newIdx
149 <<
" is out of range. List has size " << len
160 for (label i = 0; i < len; ++i)
162 inverse[i].resize(sizes[i]);
167 for (
const label newIdx : map)
171 inverse[newIdx][sizes[newIdx]++] = i;
190 for (
const label newIdx : map)
198 <<
"Inverse location " << newIdx
199 <<
" is out of range. List has size " << len
208 CompactListList<label> inverse(sizes);
211 sizes = labelList::subList(inverse.offsets(), inverse.size());
215 for (
const label newIdx : map)
219 values[sizes[newIdx]++] = i;
236 const label len =
input.size();
248 const label newIdx = oldToNew[
pos];
280 void Foam::ListOps::unionEqOp::operator()
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
List< labelList > labelListList
List of labelList.
UList< label > labelUList
A UList of labels.
Various functions to operate on Lists.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
dimensionedScalar pos(const dimensionedScalar &ds)
CompactListList< label > invertOneToManyCompact(const label len, const labelUList &map)
Invert one-to-many compact map. Unmapped elements will be size 0.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
static Istream & input(Istream &is, IntRange< T > &range)
errorManip< error > abort(error &err)
A packed storage of objects of type <T> using an offset table for access.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
static Ostream & output(Ostream &os, const IntRange< T > &range)
List< label > labelList
A List of labels.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
label size() const noexcept
Number of entries.
A HashTable to objects of type <T> with a label key.