ENH: promote ListOps::identity to Foam::identity

- becoming more frequently used and there is no ambiguity in calling
  parameters either - identity(label) vs identity(labelUList&).

  Provide both int32 and int64 versions.
This commit is contained in:
Mark Olesen
2023-10-26 10:42:23 +02:00
parent ef92d31493
commit d9f0587416
20 changed files with 86 additions and 86 deletions

View File

@ -133,7 +133,7 @@ int main(int argc, char *argv[])
DynamicList<label, 64> list1;
list1.resize(4);
ListOps::identity(list1);
Foam::identity(list1);
list1.resize(3);
printInfo("", list1);
@ -152,7 +152,7 @@ int main(int argc, char *argv[])
DynamicList<label, 64> list2;
list2.resize(5);
ListOps::identity(list2);
Foam::identity(list2);
Info<< "initial list" << nl;
printInfo("", list2);

View File

@ -147,7 +147,7 @@ int main(int argc, char *argv[])
{
List<label> ident(15);
std::iota(ident.begin(), ident.end(), 0);
Foam::identity(ident, 0);
Info<<"Ident:";
forAllConstIters(ident, iter)
@ -546,10 +546,10 @@ int main(int argc, char *argv[])
Info<< "scalars: " << flatOutput(scalars) << endl;
}
#if WM_LABEL_SIZE == 32
// #if WM_LABEL_SIZE == 32
{
List<int64_t> input(10);
std::iota(input.begin(), input.end(), 50);
Foam::identity(input, 50);
auto output = ListOps::create<label>
(
@ -558,10 +558,10 @@ int main(int argc, char *argv[])
);
Info<< "label (from int64): " << flatOutput(output) << endl;
}
#elif WM_LABEL_SIZE == 64
// #elif WM_LABEL_SIZE == 64
{
List<int32_t> input(10);
std::iota(input.begin(), input.end(), 50);
Foam::identity(input, 50);
auto output = ListOps::create<label>
(
@ -570,7 +570,7 @@ int main(int argc, char *argv[])
);
Info<< "label (from int32): " << flatOutput(output) << endl;
}
#endif
// #endif
labelHashSet locations{ -15, 5, 10, 15, 25, 35 };

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
{
List<label> ident(25);
std::iota(ident.begin(), ident.end(), 0);
Foam::identity(ident, 0);
print(ident);
@ -108,7 +108,7 @@ int main(int argc, char *argv[])
// This is also possible since we hold a concrete pointer/size
// and not an intermediate
ListOps::identity(sub.reset(ident, 8, 8));
Foam::identity(sub.reset(ident, 8, 8));
print(sub);
print(ident);
}