mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: relocate sortedOrder from ListOps.H to List.H
- commonly used, only depends on routines defined in UList (don't need the rest of ListOps for it). ENH: implement boolList::operator() const - allows use as a predicate functor, as per bitSet and labelHashSet GIT: combine SubList, UList into List directory (intertwined concepts) STYLE: default initialize DynamicList instead of with size 0
This commit is contained in:
@ -157,18 +157,34 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
boolList list2(5, true);
|
||||
list2.unset(2);
|
||||
list2.unset(3);
|
||||
|
||||
Info<< "Test wrapper idea" << nl;
|
||||
|
||||
bitSetOrBoolList wrapper(list2);
|
||||
|
||||
if (wrapper.test(1))
|
||||
// Use predicate, or test() method
|
||||
|
||||
if (list2(1))
|
||||
{
|
||||
Info<< "1 is on" << nl;
|
||||
Info<< "1 is on (original)" << nl;
|
||||
}
|
||||
if (!wrapper.test(2))
|
||||
if (!list2(2))
|
||||
{
|
||||
Info<< "2 is off" << nl;
|
||||
Info<< "2 is off (original)" << nl;
|
||||
}
|
||||
if (!list2(100))
|
||||
{
|
||||
Info<< "100 is off (original)" << nl;
|
||||
}
|
||||
|
||||
if (wrapper(1))
|
||||
{
|
||||
Info<< "1 is on (wrapped)" << nl;
|
||||
}
|
||||
if (!wrapper(2))
|
||||
{
|
||||
Info<< "2 is off (wrapped)" << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef bitSetOrBoolList_H
|
||||
#define bitSetOrBoolList_H
|
||||
#ifndef Foam_bitSetOrBoolList_H
|
||||
#define Foam_bitSetOrBoolList_H
|
||||
|
||||
#include "bitSet.H"
|
||||
#include "boolList.H"
|
||||
@ -88,6 +88,13 @@ public:
|
||||
{
|
||||
return bits_.test(i) || bools_.test(i);
|
||||
}
|
||||
|
||||
//- Test predicate
|
||||
bool operator()(const label i) const
|
||||
{
|
||||
// Can also use test(i) etc...
|
||||
return bits_(i) || bools_(i);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -41,8 +41,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef disabledBoolList_H
|
||||
#define disabledBoolList_H
|
||||
#ifndef Foam_disabledBoolList_H
|
||||
#define Foam_disabledBoolList_H
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class disabledBoolList Declaration
|
||||
@ -60,6 +60,9 @@ struct disabledBoolList
|
||||
bool test(int) const { return true; }
|
||||
|
||||
void set(bool) {}
|
||||
|
||||
// Perhaps not?
|
||||
/// bool operator()(const label i) const { return true; }
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
#include "string.H"
|
||||
#include "macros.H"
|
||||
#include "IOstreams.H"
|
||||
#include "UList.H"
|
||||
#include "List.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
@ -163,9 +163,8 @@ void Foam::conformalVoronoiMesh::calcTetMesh
|
||||
|
||||
label nPatches = patchNames.size();
|
||||
|
||||
List<DynamicList<face>> patchFaces(nPatches, DynamicList<face>(0));
|
||||
|
||||
List<DynamicList<label>> patchOwners(nPatches, DynamicList<label>(0));
|
||||
List<DynamicList<face>> patchFaces(nPatches);
|
||||
List<DynamicList<label>> patchOwners(nPatches);
|
||||
|
||||
faces.setSize(number_of_finite_facets());
|
||||
|
||||
@ -1711,12 +1710,11 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
patchDicts[patchi].getOrDefault<label>("neighbProcNo", -1);
|
||||
}
|
||||
|
||||
List<DynamicList<face>> patchFaces(nPatches, DynamicList<face>(0));
|
||||
List<DynamicList<label>> patchOwners(nPatches, DynamicList<label>(0));
|
||||
List<DynamicList<face>> patchFaces(nPatches);
|
||||
List<DynamicList<label>> patchOwners(nPatches);
|
||||
// Per patch face the index of the slave node of the point pair
|
||||
List<DynamicList<label>> patchPPSlaves(nPatches, DynamicList<label>(0));
|
||||
|
||||
List<DynamicList<bool>> indirectPatchFace(nPatches, DynamicList<bool>(0));
|
||||
List<DynamicList<label>> patchPPSlaves(nPatches);
|
||||
List<DynamicList<bool>> indirectPatchFace(nPatches);
|
||||
|
||||
|
||||
faces.setSize(number_of_finite_edges());
|
||||
|
||||
Reference in New Issue
Block a user