44 for (
const label newIdx : map)
52 <<
"Inverse location " << newIdx
53 <<
" is out of range. List has size " << len
58 if (inverse[newIdx] >= 0)
61 <<
"Map is not one-to-one. At index " << i
62 <<
" element " << newIdx <<
" has already occurred\n"
63 <<
"Please use invertOneToMany instead"
86 for (
const label newIdx : map)
92 <<
"Inverse location " << newIdx
93 <<
" is out of range. List has size " << len
121 for (
const label newIdx : map)
131 for (label i=0; i < len; ++i)
133 inverse[i].
resize(sizes[i]);
138 for (
const label newIdx : map)
142 inverse[newIdx][sizes[newIdx]++] = i;
159 const label len = input.
size();
171 const label newIdx = oldToNew[
pos];
199 input =
reorder(oldToNew, input, prune);
205 std::iota(map.
begin(), map.
end(), start);
Various functions to operate on Lists.
void resize(const label len)
Adjust allocated size of list.
label size() const noexcept
Number of entries.
bool trim(label minpos=-1)
void reserve(const label numElem)
iterator begin() noexcept
Return an iterator to begin traversing the UList.
iterator end() noexcept
Return an iterator to end traversing the UList.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
label find_next(label pos) const
Locate the next bit set, starting one beyond the specified position.
label find_first() const
Locate the first bit that is set.
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void identity(labelUList &map, label start=0)
Set identity map with (map[i] == i)
dimensionedScalar pos(const dimensionedScalar &ds)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
errorManip< error > abort(error &err)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.