LifeV
|
#include <MeshEntityContainer.hpp>
Public Member Functions | |
template<typename Policy > | |
UInt | countElementsWithMarkerID (const markerID_Type &markerID, const Policy &policy=std::equal_to< markerID_Type >()) const |
It counts all elements with a markerID. More... | |
Public Types | |
typedef DataType | data_Type |
typedef std::vector< DataType, Allocator > | vector_Type |
typedef vector_Type::size_type | size_type |
typedef vector_Type::value_type | value_type |
typedef vector_Type::reference | reference |
typedef vector_Type::const_reference | const_reference |
typedef vector_Type::iterator | iterator |
typedef vector_Type::const_iterator | const_iterator |
typedef vector_Type::const_reverse_iterator | const_reverse_iterator |
typedef vector_Type::pointer | pointer |
typedef vector_Type::const_pointer | const_pointer |
typedef vector_Type::reverse_iterator | reverse_iterator |
typedef vector_Type::allocator_type | allocator_type |
Constructor & Destructor | |
MeshEntityContainer () | |
Empty Constructor. More... | |
MeshEntityContainer (size_type vectorSize) | |
Constructor. More... | |
MeshEntityContainer (const MeshEntityContainer< DataType, Allocator > &vector) | |
Copy constructor. More... | |
MeshEntityContainer (const vector_Type &vector) | |
Constructor. More... | |
~MeshEntityContainer () | |
Destructor. More... | |
Operators | |
MeshEntityContainer< DataType, Allocator > & | operator= (const MeshEntityContainer< DataType, Allocator > &vector) |
Assignment operator. More... | |
reference | operator() (size_type const i) |
Access operator. More... | |
const_reference | operator() (size_type const i) const |
Const access operator. More... | |
Methods | |
void | destroyData () |
Completely clear out the container, returning memory to the system. More... | |
void | trim () |
trims the container so that capacity almost equals size More... | |
bool | setMaxNumItems (UInt size) |
It sets the capacity of the container It returns a bool to allow to test whether the container data pool has changed since in this case pointers to the container elements are invalidated It does not change the value of the elements currently stored, nor the container size. More... | |
Extractors | |
Utilities to extract from the SimpleVector. They rely on std::algorithms | |
template<typename Predicate > | |
std::vector< DataType const * > | extractAccordingToPredicate (Predicate const &p) const |
General extractor. More... | |
template<typename Predicate > | |
std::vector< DataType * > | extractAccordingToPredicateNonConstElement (Predicate const &p, std::vector< UInt > &indexes) |
template<typename Predicate > | |
UInt | countAccordingToPredicate (Predicate const &p) const |
Entity Counter. More... | |
template<typename Policy > | |
std::vector< DataType const * > | extractElementsWithFlag (const flag_Type &refFlag, Policy const &policy=&Flag::testOneSet) const |
It extracts all elements that satisfy a condition on the flag. More... | |
template<typename Policy > | |
UInt | countElementsWithFlag (const flag_Type &refFlag, Policy const &policy=&Flag::testOneSet) const |
It counts all elements that satisfy a condition on the flag. More... | |
Changers | |
Utilities that change the elements according to policies | |
template<typename Policy > | |
std::pair< UInt, std::vector< ID > > | reorderAccordingToFlag (const flag_Type &refFlag, Policy const &policy=&Flag::testOneSet, UInt offset=0) |
Set element with certain flag set first. More... | |
template<typename Functor > | |
void | changeAccordingToFunctor (Functor const &fun) |
Changes content according to a given functor. More... | |
std::vector< UInt > | resetId () |
Resets the id of the mesh entities so that it matches the position in the container. More... | |
The class is a wrap up of Standard Library vector class. Its role is to held meshEntities. Its old name VectorSimple has been changed to MeshEntityContainer Any other use of class is deprecated and it should be replaced by std::vector<T>
Definition at line 228 of file MeshEntityContainer.hpp.
typedef DataType data_Type |
Definition at line 235 of file MeshEntityContainer.hpp.
typedef std::vector<DataType, Allocator> vector_Type |
Definition at line 236 of file MeshEntityContainer.hpp.
typedef vector_Type::size_type size_type |
Definition at line 237 of file MeshEntityContainer.hpp.
typedef vector_Type::value_type value_type |
Definition at line 238 of file MeshEntityContainer.hpp.
typedef vector_Type::reference reference |
Definition at line 239 of file MeshEntityContainer.hpp.
typedef vector_Type::const_reference const_reference |
Definition at line 240 of file MeshEntityContainer.hpp.
typedef vector_Type::iterator iterator |
Definition at line 241 of file MeshEntityContainer.hpp.
typedef vector_Type::const_iterator const_iterator |
Definition at line 242 of file MeshEntityContainer.hpp.
typedef vector_Type::const_reverse_iterator const_reverse_iterator |
Definition at line 243 of file MeshEntityContainer.hpp.
typedef vector_Type::pointer pointer |
Definition at line 244 of file MeshEntityContainer.hpp.
typedef vector_Type::const_pointer const_pointer |
Definition at line 245 of file MeshEntityContainer.hpp.
typedef vector_Type::reverse_iterator reverse_iterator |
Definition at line 246 of file MeshEntityContainer.hpp.
typedef vector_Type::allocator_type allocator_type |
Definition at line 247 of file MeshEntityContainer.hpp.
|
inline |
Empty Constructor.
Definition at line 254 of file MeshEntityContainer.hpp.
|
inlineexplicit |
Constructor.
vectorSize | size of the vector |
Definition at line 260 of file MeshEntityContainer.hpp.
MeshEntityContainer | ( | const MeshEntityContainer< DataType, Allocator > & | vector | ) |
Copy constructor.
vector | MeshEntityContainer vector to copy |
Definition at line 639 of file MeshEntityContainer.hpp.
|
explicit |
Constructor.
Construct by copying a Standard Library vector
vector | Standard Library vector |
|
inline |
Destructor.
Definition at line 276 of file MeshEntityContainer.hpp.
MeshEntityContainer< DataType, Allocator > & operator= | ( | const MeshEntityContainer< DataType, Allocator > & | vector | ) |
Assignment operator.
Copies source MeshEntityContainer vector into "this"
vector | MeshEntityContainer vector |
Definition at line 649 of file MeshEntityContainer.hpp.
Access operator.
Example: a(10)=90; // a[10] will contain 90.0
i | index of the element of the MeshEntityContainer vector |
Definition at line 301 of file MeshEntityContainer.hpp.
|
inline |
Const access operator.
Example: a(10)=90; // a[10] will contain 90.0
i | index of the element of the MeshEntityContainer vector |
Definition at line 314 of file MeshEntityContainer.hpp.
|
inline |
Completely clear out the container, returning memory to the system.
Definition at line 661 of file MeshEntityContainer.hpp.
|
inline |
trims the container so that capacity almost equals size
Definition at line 329 of file MeshEntityContainer.hpp.
bool setMaxNumItems | ( | UInt | size | ) |
It sets the capacity of the container It returns a bool to allow to test whether the container data pool has changed since in this case pointers to the container elements are invalidated It does not change the value of the elements currently stored, nor the container size.
size | the new capacity of the container |
Definition at line 668 of file MeshEntityContainer.hpp.
std::vector< DataType const * > extractAccordingToPredicate | ( | Predicate const & | p | ) | const |
General extractor.
It extracts the a vector of pointers to the stored entities for which a predicate: i.e. a pointer to function with signature
or functor object with
returns true
The template parameter is the Predicate type (automatically deduced)
p | The predicate |
Definition at line 678 of file MeshEntityContainer.hpp.
std::vector< DataType * > extractAccordingToPredicateNonConstElement | ( | Predicate const & | p, |
std::vector< UInt > & | indexes | ||
) |
Definition at line 695 of file MeshEntityContainer.hpp.
UInt countAccordingToPredicate | ( | Predicate const & | p | ) | const |
Entity Counter.
It returns the number of stored entities for which a predicate returns true The template parameter is the Predicate type (automatically deduced): a function object or a pointer to function taking a constant reference to a mesh entity and returning a bool
p | The predicate |
Definition at line 716 of file MeshEntityContainer.hpp.
std::vector< DataType const * > extractElementsWithFlag | ( | const flag_Type & | refFlag, |
Policy const & | policy = &Flag::testOneSet |
||
) | const |
It extracts all elements that satisfy a condition on the flag.
It operates only container elements where the method flag_Type flag() is defined. Examples:
will extracts all elements in the boundary
will extracts all elements on the boundary or on an internal interface
refFlag | the flag against which the test is made |
policy. | A functor/function pointer which implements bool policy(const flag_Type & inputFlag, const flag_Type & refFlag) Available policies are Flag::testOneSet and Flag::testAllSet (defined in Lifev.hpp) |
Definition at line 724 of file MeshEntityContainer.hpp.
UInt countElementsWithFlag | ( | const flag_Type & | refFlag, |
Policy const & | policy = &Flag::testOneSet |
||
) | const |
It counts all elements that satisfy a condition on the flag.
It only operates on container elements where the method flag_Type flag() is defined. Examples:
will count all elements on the boundary
refFlag | the flag against which the test is made |
policy. | A functor/function pointer which implements bool policy(const flag_Type & inputFlag, const flag_Type & refFlag) Available policies testOneSet and testAllSet (defined in Lifev.hpp) |
Definition at line 733 of file MeshEntityContainer.hpp.
UInt countElementsWithMarkerID | ( | const markerID_Type & | markerID, |
const Policy & | policy = std::equal_to<markerID_Type>() |
||
) | const |
It counts all elements with a markerID.
markerID | the markerID against which the test is made |
policy. | A functor/function pointer which implements bool policy(const markerID_Type & inputMarkerID, const markerID_Type & refMarkerID) By default it uses std::equal_to |
Definition at line 742 of file MeshEntityContainer.hpp.
std::pair< UInt, std::vector< ID > > reorderAccordingToFlag | ( | const flag_Type & | refFlag, |
Policy const & | policy = &Flag::testOneSet , |
||
UInt | offset = 0 |
||
) |
Set element with certain flag set first.
It reorders the container starting from the given offset up to the end of the container so that elements with the given flag set are first. A policy must be passed. Typically either testOneSet or testAllSet. A policy object must have a method
which compares the boolean flag i with the reference flag r. It fixes the id of the stored entities and it returns the newToOld array in case we need to fix some related id
refFlag | the reference flag against which comparison is made. |
offset | We reorder only elements from offset to the end of the container. |
policy | The policy we use for comparing the flag of the mesh entity with the reference flag. |
Definition at line 752 of file MeshEntityContainer.hpp.
|
inline |
Changes content according to a given functor.
This method is here for people which do not remember how std::for_each works. It takes as argument a functor that must have the method
and which changes d according to the user will.
fun | The functor which implements the change |
Definition at line 492 of file MeshEntityContainer.hpp.
|
inline |
Resets the id of the mesh entities so that it matches the position in the container.
After its call the id of each mesh entity matches its position in the container. The mesh entity must have the method ID & id()
Definition at line 504 of file MeshEntityContainer.hpp.