mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve consistency of ListOps and stringListOps
- subsetList, inplaceSubsetList with optional inverted logic. - use moveable elements where possible. - allow optional starting offset for the identity global function. Eg, 'identity(10, start)' vs 'identity(10) + start'
This commit is contained in:
@ -37,6 +37,12 @@ Description
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
void printCompare(const face& a, const face& b)
|
||||
{
|
||||
Info<< "Compare " << a << " and " << b
|
||||
<< " Match = " << face::compare(a, b) << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
@ -96,44 +102,35 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< nl << nl << "Compare two faces: " << endl;
|
||||
face a(identity(5));
|
||||
Info<< "Compare " << a << " and " << a << " Match = " << face::compare(a, a)
|
||||
<< endl;
|
||||
printCompare(a, a);
|
||||
|
||||
face b(reverseList(a));
|
||||
Info<< "Compare " << a << " and " << b << " Match = " << face::compare(a, b)
|
||||
<< endl;
|
||||
printCompare(a, b);
|
||||
|
||||
face c(a);
|
||||
c[4] = 3;
|
||||
Info<< "Compare " << a << " and " << c << " Match = " << face::compare(a, c)
|
||||
<< endl;
|
||||
printCompare(a, c);
|
||||
|
||||
face d(rotateList(a, 2));
|
||||
Info<< "Compare " << a << " and " << d << " Match = " << face::compare(a, d)
|
||||
<< endl;
|
||||
printCompare(a, d);
|
||||
|
||||
face g(labelList(5, 1));
|
||||
face h(g);
|
||||
Info<< "Compare " << g << " and " << h << " Match = " << face::compare(g, h)
|
||||
<< endl;
|
||||
printCompare(g, h);
|
||||
|
||||
g[0] = 2;
|
||||
h[3] = 2;
|
||||
Info<< "Compare " << g << " and " << h << " Match = " << face::compare(g, h)
|
||||
<< endl;
|
||||
printCompare(g, h);
|
||||
|
||||
g[4] = 3;
|
||||
h[4] = 3;
|
||||
Info<< "Compare " << g << " and " << h << " Match = " << face::compare(g, h)
|
||||
<< endl;
|
||||
printCompare(g, h);
|
||||
|
||||
face face1(identity(1));
|
||||
Info<< "Compare " << face1 << " and " << face1
|
||||
<< " Match = " << face::compare(face1, face1) << endl;
|
||||
printCompare(face1, face1);
|
||||
|
||||
face face2(identity(1)+1);
|
||||
Info<< "Compare " << face1 << " and " << face2
|
||||
<< " Match = " << face::compare(face1, face2) << endl;
|
||||
face face2(identity(1, 2));
|
||||
printCompare(face1, face2);
|
||||
|
||||
Info<< nl << nl << "Zero face" << nl << endl;
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ int main(int argc, char *argv[])
|
||||
// (
|
||||
// mesh,
|
||||
// pp,
|
||||
// identity(pp.size())+pp.start()
|
||||
// identity(pp.size(), pp.start())
|
||||
// )
|
||||
// );
|
||||
// forAll(pn, pointi)
|
||||
@ -278,7 +278,7 @@ int main(int argc, char *argv[])
|
||||
// (
|
||||
// mesh,
|
||||
// pp,
|
||||
// identity(pp.size())+pp.start()
|
||||
// identity(pp.size(), pp.start())
|
||||
// )
|
||||
// );
|
||||
// forAll(pn, pointi)
|
||||
|
||||
@ -247,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
<< " by this amount" << nl << endl;
|
||||
|
||||
patch1Map = identity(surface1.patches().size());
|
||||
patch2Map = identity(surface2.patches().size()) + patch1Map.size();
|
||||
patch2Map = identity(surface2.patches().size(), patch1Map.size());
|
||||
|
||||
nNewPatches = surface1.patches().size()+surface2.patches().size();
|
||||
}
|
||||
|
||||
@ -165,10 +165,10 @@ void createBoundaryEdgeTrees
|
||||
|
||||
// Boundary edges
|
||||
treeBoundaryEdges[surfI] =
|
||||
labelList
|
||||
identity
|
||||
(
|
||||
identity(surf.nEdges() - surf.nInternalEdges())
|
||||
+ surf.nInternalEdges()
|
||||
surf.nEdges() - surf.nInternalEdges(),
|
||||
surf.nInternalEdges()
|
||||
);
|
||||
|
||||
Random rndGen(17301893);
|
||||
|
||||
Reference in New Issue
Block a user