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:
Mark Olesen
2018-02-21 12:58:00 +01:00
parent 3ee2f3293e
commit f959927910
22 changed files with 472 additions and 425 deletions

View File

@ -372,8 +372,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
// Local constructMap is just identity
{
tgtConstructMap[Pstream::myProcNo()] =
identity(targetCoarseSize);
tgtConstructMap[Pstream::myProcNo()] = identity(targetCoarseSize);
}
labelList tgtCompactMap(map.constructSize());
@ -1134,13 +1133,19 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::append
{
mapMap.append
(
identity(srcConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
identity
(
srcConstructMap[proci].size(),
(mapMap.size() + newMapMap.size())
)
);
newMapMap.append
(
identity(newSrcConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
identity
(
newSrcConstructMap[proci].size(),
(mapMap.size() + newMapMap.size())
)
);
}
@ -1188,13 +1193,19 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::append
{
mapMap.append
(
identity(tgtConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
identity
(
tgtConstructMap[proci].size(),
(mapMap.size() + newMapMap.size())
)
);
newMapMap.append
(
identity(newTgtConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
identity
(
newTgtConstructMap[proci].size(),
(mapMap.size() + newMapMap.size())
)
);
}

View File

@ -1034,20 +1034,20 @@ Foam::extendedEdgeMesh::edgeTreesByType() const
// External edges
sliceEdges[0] =
identity(internalStart_ - externalStart_) + externalStart_;
identity((internalStart_ - externalStart_), externalStart_);
// Internal edges
sliceEdges[1] = identity(flatStart_ - internalStart_) + internalStart_;
sliceEdges[1] = identity((flatStart_ - internalStart_), internalStart_);
// Flat edges
sliceEdges[2] = identity(openStart_ - flatStart_) + flatStart_;
sliceEdges[2] = identity((openStart_ - flatStart_), flatStart_);
// Open edges
sliceEdges[3] = identity(multipleStart_ - openStart_) + openStart_;
sliceEdges[3] = identity((multipleStart_ - openStart_), openStart_);
// Multiple edges
sliceEdges[4] =
identity(edges().size() - multipleStart_) + multipleStart_;
identity((edges().size() - multipleStart_), multipleStart_);
forAll(edgeTreesByType_, i)
{

View File

@ -122,8 +122,7 @@ Foam::treeDataFace::treeDataFace
mesh_(patch.boundaryMesh().mesh()),
faceLabels_
(
identity(patch.size())
+ patch.start()
identity(patch.size(), patch.start())
),
isTreeFace_(mesh_.nFaces(), 0),
cacheBb_(cacheBb)

View File

@ -281,7 +281,7 @@ void Foam::mappedPatchBase::findSamples
else
{
// patch faces
const labelList patchFaces(identity(pp.size()) + pp.start());
const labelList patchFaces(identity(pp.size(), pp.start()));
treeBoundBox patchBb
(

View File

@ -626,8 +626,7 @@ Foam::List<Foam::labelPair> Foam::localPointRegion::findDuplicateFacePairs
// Faces to test: all boundary faces
labelList testFaces
(
identity(mesh.nFaces()-mesh.nInternalFaces())
+ mesh.nInternalFaces()
identity(mesh.nFaces()-mesh.nInternalFaces(), mesh.nInternalFaces())
);
// Find correspondencing baffle face (or -1)

View File

@ -564,12 +564,7 @@ Foam::triSurfaceMesh::edgeTree() const
// Boundary edges
labelList bEdges
(
identity
(
nEdges()
-nInternalEdges()
)
+ nInternalEdges()
identity(nEdges() - nInternalEdges(), nInternalEdges())
);
treeBoundBox bb(Zero, Zero);