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

@ -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;

View File

@ -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)

View File

@ -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();
}

View File

@ -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);

View File

@ -84,14 +84,7 @@ Foam::scalar Foam::Distribution<Type>::totalWeight(direction cmpt) const
template<class Type>
Foam::List<Foam::label> Foam::Distribution<Type>::keys(direction cmpt) const
{
List<label> keys = identity((*this)[cmpt].size());
forAll(keys, k)
{
keys[k] += listStarts_[cmpt];
}
return keys;
return identity((*this)[cmpt].size(), listStarts_[cmpt]);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,22 +42,23 @@ Foam::labelList Foam::invert
forAll(map, i)
{
const label newPos = map[i];
const label newIdx = map[i];
if (newPos >= 0)
if (newIdx >= 0)
{
if (inverse[newPos] >= 0)
if (inverse[newIdx] >= 0)
{
FatalErrorInFunction
<< "Map is not one-to-one. At index " << i
<< " element " << newPos << " has already occurred before"
<< " element " << newIdx << " has already occurred before"
<< nl << "Please use invertOneToMany instead"
<< abort(FatalError);
}
inverse[newPos] = i;
inverse[newIdx] = i;
}
}
return inverse;
}
@ -68,31 +69,31 @@ Foam::labelListList Foam::invertOneToMany
const labelUList& map
)
{
labelList nElems(len, 0);
labelList sizes(len, 0);
forAll(map, i)
for (const label newIdx : map)
{
if (map[i] >= 0)
if (newIdx >= 0)
{
nElems[map[i]]++;
sizes[newIdx]++;
}
}
labelListList inverse(len);
forAll(nElems, i)
for (label i=0; i<len; ++i)
{
inverse[i].setSize(nElems[i]);
nElems[i] = 0;
inverse[i].setSize(sizes[i]);
sizes[i] = 0; // reset size counter
}
forAll(map, i)
{
const label newI = map[i];
const label newIdx = map[i];
if (newI >= 0)
if (newIdx >= 0)
{
inverse[newI][nElems[newI]++] = i;
inverse[newIdx][sizes[newIdx]++] = i;
}
}
@ -100,13 +101,13 @@ Foam::labelListList Foam::invertOneToMany
}
Foam::labelList Foam::identity(const label len)
Foam::labelList Foam::identity(const label len, const label start)
{
labelList map(len);
for (label i = 0; i < len; ++i)
{
map[i] = i;
map[i] = i + start;
}
return map;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,12 +59,12 @@ static const List<Type>& emptyList()
//- Renumber the values (not the indices) of a list.
// Negative ListType elements are left untouched.
template<class ListType>
ListType renumber(const labelUList& oldToNew, const ListType& lst);
ListType renumber(const labelUList& oldToNew, const ListType& input);
//- Inplace renumber the values (not the indices) of a list.
// Negative ListType elements are left untouched.
template<class ListType>
void inplaceRenumber(const labelUList& oldToNew, ListType& lst);
void inplaceRenumber(const labelUList& oldToNew, ListType& input);
//- Reorder the elements of a list.
@ -76,7 +76,7 @@ template<class ListType>
ListType reorder
(
const labelUList& oldToNew,
const ListType& lst,
const ListType& input,
const bool prune = false
);
@ -89,7 +89,7 @@ template<class ListType>
void inplaceReorder
(
const labelUList& oldToNew,
ListType& lst,
ListType& input,
const bool prune = false
);
@ -99,22 +99,22 @@ void inplaceReorder
//- Map values. Do not map negative values.
template<class Container>
void inplaceMapValue(const labelUList& oldToNew, Container& lst);
void inplaceMapValue(const labelUList& oldToNew, Container& input);
//- Recreate with mapped keys. Do not map elements with negative key.
template<class Container>
void inplaceMapKey(const labelUList& oldToNew, Container& lst);
void inplaceMapKey(const labelUList& oldToNew, Container& input);
//- Generate the (stable) sort order for the list
template<class T>
void sortedOrder(const UList<T>& lst, labelList& order);
void sortedOrder(const UList<T>& input, labelList& order);
//- Sort using specified list compare predicate
template<class T, class ListComparePredicate>
void sortedOrder
(
const UList<T>& lst,
const UList<T>& input,
labelList& order,
const ListComparePredicate& comp
);
@ -122,14 +122,14 @@ void sortedOrder
//- Generate (sorted) indices corresponding to duplicate list values
template<class T>
void duplicateOrder(const UList<T>& lst, labelList& order);
void duplicateOrder(const UList<T>& input, labelList& order);
//- Generate (sorted) indices corresponding to duplicate list values
// sort using specified list compare predicate
template<class T, class ListComparePredicate>
void duplicateOrder
(
const UList<T>& lst,
const UList<T>& input,
labelList& order,
const ListComparePredicate& comp
);
@ -137,14 +137,14 @@ void duplicateOrder
//- Generate (sorted) indices corresponding to unique list values
template<class T>
void uniqueOrder(const UList<T>& lst, labelList& order);
void uniqueOrder(const UList<T>& input, labelList& order);
//- Generate (sorted) indices corresponding to unique list values
// sort using specified list compare predicate
template<class T, class ListComparePredicate>
void uniqueOrder
(
const UList<T>& lst,
const UList<T>& input,
labelList& order,
const ListComparePredicate& comp
);
@ -153,14 +153,14 @@ void uniqueOrder
//- Inplace sorting and removal of duplicates.
// Do not use FixedList for the input list, since it doesn't resize.
template<class ListType>
void inplaceUniqueSort(ListType& lst);
void inplaceUniqueSort(ListType& input);
//- Inplace sorting and removal of duplicates.
// Do not use FixedList for the input list, since it doesn't resize.
template<class ListType, class ListComparePredicate>
void inplaceUniqueSort
(
ListType& lst,
ListType& input,
const ListComparePredicate& comp
);
@ -178,19 +178,19 @@ void inplaceSubset(const UList<T>& select, const T& value, ListType&);
//- Extract elements of List when select is true
// eg, to extract all selected elements:
// subset<boolList, labelList>(selectedElems, lst);
// subset<boolList, labelList>(selectedElems, list);
// Note a labelHashSet can also be used as the bool-list.
// Do not use FixedList for the input list, since it doesn't resize.
template<class BoolListType, class ListType>
ListType subset(const BoolListType& select, const ListType& lst);
ListType subset(const BoolListType& select, const ListType& input);
//- Inplace extract elements of List when select is true
// eg, to extract all selected elements:
// inplaceSubset<boolList, labelList>(selectedElems, lst);
// inplaceSubset<boolList, labelList>(selectedElems, list);
// Note a labelHashSet can also be used as the bool-list.
// Do not use FixedList for the input list, since it doesn't resize.
template<class BoolListType, class ListType>
void inplaceSubset(const BoolListType& select, ListType& lst);
void inplaceSubset(const BoolListType& select, ListType& input);
//- Copy a subset of the input list when predicate is true.
@ -199,7 +199,8 @@ template<class ListType, class UnaryPredicate>
ListType subsetList
(
const ListType& input,
const UnaryPredicate& pred
const UnaryPredicate& pred,
const bool invert=false
);
//- Inplace subset of the list when predicate is true.
@ -208,7 +209,8 @@ template<class ListType, class UnaryPredicate>
void inplaceSubsetList
(
ListType& input,
const UnaryPredicate& pred
const UnaryPredicate& pred,
const bool invert=false
);
@ -242,7 +244,8 @@ List<OutputIntListType> invertManyToMany
}
//- Create identity map of the given length with (map[i] == i)
labelList identity(const label len);
// Optionally with an alternative start index, so that (map[i] == i+start)
labelList identity(const label len, const label start=0);
//- Find first occurence of given element and return index,
// return -1 if not found. Linear search.
@ -265,23 +268,23 @@ labelList findIndices
(
const ListType& input,
typename ListType::const_reference val,
const label start=0
label start=0
);
//- Opposite of findIndices: set values at indices to given value
template<class ListType>
void setValues
(
ListType& l,
ListType& input,
const labelUList& indices,
typename ListType::const_reference t
typename ListType::const_reference val
);
//- Opposite of findIndices: set values at indices to given value
template<class ListType>
ListType createWithValues
(
const label sz,
const label len,
typename ListType::const_reference initValue,
const labelUList& indices,
typename ListType::const_reference setValue
@ -290,13 +293,13 @@ ListType createWithValues
//- Find index of max element (and larger than given element).
// return -1 if not found. Linear search.
template<class ListType>
label findMax(const ListType& l, const label start=0);
label findMax(const ListType& input, const label start=0);
//- Find index of min element (and less than given element).
// return -1 if not found. Linear search.
template<class ListType>
label findMin(const ListType& l, const label start=0);
label findMin(const ListType& input, const label start=0);
//- Find first occurrence of given element in sorted list and return index,
@ -304,21 +307,21 @@ label findMin(const ListType& l, const label start=0);
template<class ListType>
label findSortedIndex
(
const ListType& l,
typename ListType::const_reference t,
const ListType& input,
typename ListType::const_reference val,
const label start=0
);
//- Find last element < given value in sorted list and return index,
// return -1 if not found. Binary search.
template<class ListType, class BinaryOp>
template<class ListType, class BinaryPredicate>
label findLower
(
const ListType& l,
typename ListType::const_reference t,
const ListType& input,
typename ListType::const_reference val,
const label start,
const BinaryOp& bop
const BinaryPredicate& pred
);
@ -327,8 +330,8 @@ label findLower
template<class ListType>
label findLower
(
const ListType& l,
typename ListType::const_reference t,
const ListType& input,
typename ListType::const_reference val,
const label start=0
);
@ -369,12 +372,12 @@ public:
//- Reverse a list. First element becomes last element etc.
template<class ListType>
ListType reverseList(const ListType& list);
ListType reverseList(const ListType& input);
//- Inplace reversal of a list using Swap.
template<class ListType>
void inplaceReverseList(ListType& list);
void inplaceReverseList(ListType& input);
//- Rotate a list by n places. If n is positive rotate clockwise/right/down.

File diff suppressed because it is too large Load Diff

View File

@ -369,7 +369,7 @@ inline void Foam::UList<T>::swap(UList<T>& lst)
template<class T>
inline void Foam::reverse(UList<T>& lst, const label n)
{
for (int i=0; i<n/2; ++i)
for (label i=0; i<n/2; ++i)
{
Foam::Swap(lst[i], lst[n-1-i]);
}

View File

@ -54,7 +54,7 @@ namespace Foam
labelList findMatchingStrings
(
const UnaryMatchPredicate& matcher,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert=false
);
@ -65,11 +65,11 @@ namespace Foam
labelList findStrings
(
const regExp& matcher,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert=false
)
{
return findMatchingStrings(matcher, lst, invert);
return findMatchingStrings(matcher, input, invert);
}
@ -79,11 +79,11 @@ namespace Foam
labelList findStrings
(
const char* re,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert=false
)
{
return findMatchingStrings(regExp(re), lst, invert);
return findMatchingStrings(regExp(re), input, invert);
}
@ -93,11 +93,11 @@ namespace Foam
labelList findStrings
(
const std::string& re,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert=false
)
{
return findMatchingStrings(regExp(re), lst, invert);
return findMatchingStrings(regExp(re), input, invert);
}
@ -107,11 +107,11 @@ namespace Foam
labelList findStrings
(
const wordRe& matcher,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert=false
)
{
return findMatchingStrings(matcher, lst, invert);
return findMatchingStrings(matcher, input, invert);
}
@ -121,11 +121,11 @@ namespace Foam
labelList findStrings
(
const wordRes& matcher,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert=false
)
{
return findMatchingStrings(matcher, lst, invert);
return findMatchingStrings(matcher, input, invert);
}
//- Return list indices for strings matching one of the regular expression
@ -148,13 +148,13 @@ namespace Foam
// optionally invert the match
// eg, to extract all selected elements:
// \code
// subsetMatchingStrings<regExp, stringList>(myRegExp, lst);
// subsetMatchingStrings<regExp, stringList>(myRegExp, list);
// \endcode
template<class UnaryMatchPredicate, class StringListType>
StringListType subsetMatchingStrings
(
const UnaryMatchPredicate& matcher,
const StringListType& lst,
const StringListType& input,
const bool invert=false
);
@ -165,11 +165,11 @@ namespace Foam
StringListType subsetStrings
(
const regExp& matcher,
const StringListType& lst,
const StringListType& input,
const bool invert=false
)
{
return subsetMatchingStrings(matcher, lst, invert);
return subsetMatchingStrings(matcher, input, invert);
}
@ -179,11 +179,11 @@ namespace Foam
StringListType subsetStrings
(
const char* re,
const StringListType& lst,
const StringListType& input,
const bool invert=false
)
{
return subsetMatchingStrings(regExp(re), lst, invert);
return subsetMatchingStrings(regExp(re), input, invert);
}
//- Extract elements of StringList when regular expression matches
@ -192,11 +192,11 @@ namespace Foam
StringListType subsetStrings
(
const std::string& re,
const StringListType& lst,
const StringListType& input,
const bool invert=false
)
{
return subsetMatchingStrings(regExp(re), lst, invert);
return subsetMatchingStrings(regExp(re), input, invert);
}
//- Extract elements of StringList when regular expression matches
@ -205,11 +205,11 @@ namespace Foam
StringListType subsetStrings
(
const wordRe& matcher,
const StringListType& lst,
const StringListType& input,
const bool invert=false
)
{
return subsetMatchingStrings(matcher, lst, invert);
return subsetMatchingStrings(matcher, input, invert);
}
//- Extract elements of StringList when regular expression matches
@ -218,11 +218,11 @@ namespace Foam
StringListType subsetStrings
(
const wordRes& matcher,
const StringListType& lst,
const StringListType& input,
const bool invert=false
)
{
return subsetMatchingStrings(matcher, lst, invert);
return subsetMatchingStrings(matcher, input, invert);
}
@ -248,7 +248,7 @@ namespace Foam
void inplaceSubsetMatchingStrings
(
const UnaryMatchPredicate& matcher,
StringListType& lst,
StringListType& input,
const bool invert=false
);
@ -258,11 +258,11 @@ namespace Foam
void inplaceSubsetStrings
(
const regExp& matcher,
StringListType& lst,
StringListType& input,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(matcher, lst, invert);
inplaceSubsetMatchingStrings(matcher, input, invert);
}
//- Inplace extract elements of StringList when regular expression matches
@ -271,11 +271,11 @@ namespace Foam
void inplaceSubsetStrings
(
const char* re,
StringListType& lst,
StringListType& input,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(regExp(re), lst, invert);
inplaceSubsetMatchingStrings(regExp(re), input, invert);
}
//- Inplace extract elements of StringList when regular expression matches
@ -284,11 +284,11 @@ namespace Foam
void inplaceSubsetStrings
(
const std::string& re,
StringListType& lst,
StringListType& input,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(regExp(re), lst, invert);
inplaceSubsetMatchingStrings(regExp(re), input, invert);
}
//- Inplace extract elements of StringList when regular expression matches
@ -297,11 +297,11 @@ namespace Foam
void inplaceSubsetStrings
(
const wordRe& matcher,
StringListType& lst,
StringListType& input,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(matcher, lst, invert);
inplaceSubsetMatchingStrings(matcher, input, invert);
}
//- Inplace extract elements of StringList when regular expression matches
@ -310,11 +310,11 @@ namespace Foam
void inplaceSubsetStrings
(
const wordRes& matcher,
StringListType& lst,
StringListType& input,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(matcher, lst, invert);
inplaceSubsetMatchingStrings(matcher, input, invert);
}
//- Inplace extract elements of StringList when regular expression matches

View File

@ -29,21 +29,24 @@ template<class UnaryMatchPredicate, class StringType>
Foam::labelList Foam::findMatchingStrings
(
const UnaryMatchPredicate& matcher,
const UList<StringType>& lst,
const UList<StringType>& input,
const bool invert
)
{
labelList indices(lst.size());
const label len = input.size();
labelList indices(len);
label count = 0;
forAll(lst, elemi)
for (label i=0; i < len; ++i)
{
if (matcher(lst[elemi]) ? !invert : invert)
if (matcher(input[i]) ? !invert : invert)
{
indices[count++] = elemi;
indices[count] = i;
++count;
}
}
indices.setSize(count);
indices.resize(count);
return indices;
}
@ -53,24 +56,27 @@ template<class UnaryMatchPredicate, class StringListType>
StringListType Foam::subsetMatchingStrings
(
const UnaryMatchPredicate& matcher,
const StringListType& lst,
const StringListType& input,
const bool invert
)
{
StringListType newLst(lst.size());
newLst.setSize(lst.size()); // Consistent sizing (eg, DynamicList)
const label len = input.size();
StringListType output(len);
output.resize(len); // Consistent sizing (eg, DynamicList)
label count = 0;
forAll(lst, elemi)
for (label i=0; i < len; ++i)
{
if (matcher(lst[elemi]) ? !invert : invert)
if (matcher(input[i]) ? !invert : invert)
{
newLst[count++] = lst[elemi];
output[count] = input[i];
++count;
}
}
newLst.setSize(count);
output.resize(count);
return newLst;
return output;
}
@ -78,23 +84,25 @@ template<class UnaryMatchPredicate, class StringListType>
void Foam::inplaceSubsetMatchingStrings
(
const UnaryMatchPredicate& matcher,
StringListType& lst,
StringListType& input,
const bool invert
)
{
const label len = input.size();
label count = 0;
forAll(lst, elemi)
for (label i=0; i < len; ++i)
{
if (matcher(lst[elemi]) ? !invert : invert)
if (matcher(input[i]) ? !invert : invert)
{
if (count != elemi)
if (count != i)
{
lst[count] = lst[elemi];
input[count] = std::move(input[i]);
}
++count;
}
}
lst.setSize(count);
input.resize(count);
}

View File

@ -2120,7 +2120,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// Initialize all addressing into current mesh
constructCellMap[Pstream::myProcNo()] = identity(mesh_.nCells());
constructFaceMap[Pstream::myProcNo()] = identity(mesh_.nFaces()) + 1;
constructFaceMap[Pstream::myProcNo()] = identity(mesh_.nFaces(), 1);
constructPointMap[Pstream::myProcNo()] = identity(mesh_.nPoints());
constructPatchMap[Pstream::myProcNo()] = identity(patches.size());
@ -2407,7 +2407,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
constructCellMap[sendProc] = identity(domainMesh.nCells());
constructFaceMap[sendProc] = identity(domainMesh.nFaces()) + 1;
constructFaceMap[sendProc] = identity(domainMesh.nFaces(), 1);
constructPointMap[sendProc] = identity(domainMesh.nPoints());
constructPatchMap[sendProc] =
identity(domainMesh.boundaryMesh().size());

View File

@ -455,14 +455,14 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
const polyPatch& patch1 = patches[slavePatchID_.index()];
labelList pp0Labels(identity(patch0.size())+patch0.start());
labelList pp0Labels(identity(patch0.size(), patch0.start()));
indirectPrimitivePatch pp0
(
IndirectList<face>(mesh.faces(), pp0Labels),
mesh.points()
);
labelList pp1Labels(identity(patch1.size())+patch1.start());
labelList pp1Labels(identity(patch1.size(), patch1.start()));
indirectPrimitivePatch pp1
(
IndirectList<face>(mesh.faces(), pp1Labels),

View File

@ -324,7 +324,10 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
if (isA<wallPolyPatch>(patch))
{
localWallFaces.append(identity(patch.size()) + patch.start());
localWallFaces.append
(
identity(patch.size(), patch.start())
);
}
}

View File

@ -135,7 +135,7 @@ void Foam::ParticleCollector<CloudType>::initPolygons
forAll(faces_, facei)
{
const Field<point>& polyPoints = polygons[facei];
face f(identity(polyPoints.size()) + pointOffset);
face f(identity(polyPoints.size(), pointOffset));
UIndirectList<point>(points_, f) = polyPoints;
area_[facei] = f.mag(points_);

View File

@ -619,8 +619,11 @@ void Foam::meshRefinement::checkData()
localPointRegion::findDuplicateFaces
(
mesh_,
identity(mesh_.nFaces()-mesh_.nInternalFaces())
+ mesh_.nInternalFaces()
identity
(
mesh_.nFaces() - mesh_.nInternalFaces(),
mesh_.nInternalFaces()
)
)
);

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);