MoReFEM
|
Namespace that enclose most of the Utilities (some aren't for conveniency, such as NumericNS or FilesystemNS). More...
Namespaces | |
namespace | ExceptionNS |
Placeholder namespace description needed for it to appear in Doxygen namespace list. | |
namespace | PointerComparison |
Placeholder namespace description needed for it to appear in Doxygen namespace list. | |
namespace | PrintPolicyNS |
Placeholder namespace description needed for it to appear in Doxygen namespace list. | |
namespace | String |
Placeholder namespace description needed for it to appear in Doxygen namespace list. | |
namespace | Tuple |
Placeholder namespace description needed for it to appear in Doxygen namespace list. | |
Data Structures | |
struct | ArraySize |
Helper struct to return statically the size of an array. More... | |
class | AsciiOrBinary |
Provides a way to specify the output format of the solution vectors corresponding to each unknown. More... | |
class | BoolArray |
A class to handle a dynamic array of bool with some safety. More... | |
struct | ConstRefOrValue |
Yields most adapted return type: by value or by const reference. More... | |
struct | ContainerHash |
Struct used to generate a hash key for a container with a direct accessor. More... | |
class | CSRPattern |
Objects that store information about the CSR pattern of a sparse matrix. More... | |
class | Environment |
Provides access to shell environment variables and also some internal data that act likewise. More... | |
struct | IsSharedPtr |
Determines whether an object is a shared_ptr or not. More... | |
struct | IsSpecializationOf |
Yields true_type if T is a specialization of Template. More... | |
struct | IsSpecializationOf< Template, Template< Args... > > |
struct | IsSpecializationOfInt |
struct | IsSpecializationOfInt< Template, Template< N > > |
struct | IsUniquePtr |
Determines whether an object is a unique_ptr or not. More... | |
struct | PrintContainer |
Print the content of a container (that might be associative or not - see PrintPolicyT). More... | |
class | Singleton |
Provides part of the singleton interface to T through a CRTP. More... | |
struct | StaticCast |
A slightly extended static_cast. More... | |
struct | Type2Type |
Create an hollow object that might be useful to mimic template function overloading. More... | |
Enumerations | |
enum class | Access { read_only , read_and_write } |
Enum used to enforce constness in third party libraries that didn't do it natively. More... | |
Functions | |
template<class ItemPtrT , std::size_t N> | |
std::array< ItemPtrT, N > | NullptrArray () |
Function to set to nullptr all the content of a defined array. | |
template<class T , std::size_t N> | |
std::array< T, N > | FilledWithUninitializedIndex () |
Init an array with NumericNS::UninitializedIndex for all of its elements. | |
std::vector< bool > | VectorFromBoolArray (const BoolArray &array) |
Create a std::vector<bool> with the same content as array object. | |
template<::MoReFEM::Concept::Tuple TupleT, typename StreamT = std::ostream> | |
void | PrintTuple (const TupleT &tuple, StreamT &stream=std::cout, PrintNS::Delimiter::separator separator=PrintNS::Delimiter::separator(", "), PrintNS::Delimiter::opener opener=PrintNS::Delimiter::opener("["), PrintNS::Delimiter::closer closer=PrintNS::Delimiter::closer("]\n")) |
Print the content of a tuple or a pair. | |
template<class T , class FirstCriterionT , typename... OtherCriteriaT> | |
bool | Sort (const T &lhs, const T &rhs) |
Defines the ordering of two different objects. | |
constexpr float | DefaultMaxLoadFactor () noexcept |
Value of std::unordered_map::max_load_factor() that is recommended in "The C++ Standard Library" by N. Josuttis. | |
template<class T > | |
std::size_t | HashCombine (std::size_t &seed, const T &value) |
Function lifted from Boost (http://www.boost.org) to combine several hash keys together. | |
template<class T > | |
void | EliminateDuplicate (std::vector< T > &vector) |
Sort a std::vector and delete the possible duplicates. | |
template<class T , class ComparePredicateT , class EqualPredicateT > | |
void | EliminateDuplicate (std::vector< T > &vector, ComparePredicateT comp, EqualPredicateT equal) |
Sort a std::vector and delete the possible duplicates. | |
std::string | Now (const Wrappers::Mpi &mpi) |
Write the current date in format 'YYYY-MM-DD_HH:MM:SS'. | |
template<class PointerT > | |
IGNORE_BLOCK_IN_DOXYGEN bool | IsNullptr (const PointerT &pointer) |
A trivial function to check whether a pointer is nullptr or not. | |
const std::string & | EmptyString () |
Returns a reference to a static empty string. | |
Namespace that enclose most of the Utilities (some aren't for conveniency, such as NumericNS or FilesystemNS).
|
strong |
Enum used to enforce constness in third party libraries that didn't do it natively.
It is currently used in Petsc::AccessVectorContent for instance.
std::array< ItemPtrT, N > MoReFEM::Utilities::NullptrArray | ( | ) |
Function to set to nullptr all the content of a defined array.
e.g.
in a class declaration of data attribute will init it with 5 nullptr.
std::array< T, N > MoReFEM::Utilities::FilledWithUninitializedIndex | ( | ) |
Init an array with NumericNS::UninitializedIndex for all of its elements.
T | An integral type. |
N | Size of the array. |
std::vector< bool > MoReFEM::Utilities::VectorFromBoolArray | ( | const BoolArray & | array | ) |
Create a std::vector<bool> with the same content as array object.
[in] | array | The BoolArray object. |
void MoReFEM::Utilities::PrintTuple | ( | const TupleT & | tuple, |
StreamT & | stream = std::cout, | ||
PrintNS::Delimiter::separator | separator = PrintNS::Delimiter::separator(", "), | ||
PrintNS::Delimiter::opener | opener = PrintNS::Delimiter::opener("["), | ||
PrintNS::Delimiter::closer | closer = PrintNS::Delimiter::closer("]\n") ) |
Print the content of a tuple or a pair.
Inspired by Nicolai M. Josuttis "The C++ standard library" page 74.
StreamT | Type of output stream considered |
[in,out] | stream | Output stream in which tuple content will be displayed. All tuple elements must define operator<<. |
[in] | tuple | Tuple which content is displayed. |
[in] | separator | Separator between two entries of the tuple. |
[in] | opener | Prefix used while displaying the tuple. |
[in] | closer | Suffix used while displaying the tuple. |
bool MoReFEM::Utilities::Sort | ( | const T & | lhs, |
const T & | rhs ) |
Defines the ordering of two different objects.
T | Type of the objects. |
FirstCriterionT | First criterion to be considered to sort both objects. If the criterion is enough to make a difference between both objects, result is returned. A criterion object must provide:
|
OtherCriteriaT | If first criterion isn't enough, iterate through OtherCriteriaT until one criterion is able to separate both objects, or until all criteria have been tried. |
An example is probably the best way to explain the purpose of sort.
As variadic template is used, more than 2 criteria might be used (as many as you like in fact).
[in] | lhs | Left-hand side. |
[in] | rhs | Right-hand side. |
|
constexprnoexcept |
Value of std::unordered_map::max_load_factor() that is recommended in "The C++ Standard Library" by N. Josuttis.
std::size_t MoReFEM::Utilities::HashCombine | ( | std::size_t & | seed, |
const T & | value ) |
Function lifted from Boost (http://www.boost.org) to combine several hash keys together.
Apparently this formula stems from Knuth's work.
For instance to yield a hash key for a std::pair<std::size_t, std::size_t>:
T | Type for which a std::hash specialization already exists. |
[in,out] | seed | In input current value of the hash; in output modified value. |
[in] | value | New element which hash key is combined to the seed to provide a new has key. |
void MoReFEM::Utilities::EliminateDuplicate | ( | std::vector< T > & | vector | ) |
Sort a std::vector and delete the possible duplicates.
T | Type of the data stored within the std::vector. |
[in,out] | vector | Vector which should be sort and from which duplicates should be removed. |
This version uses default comparison (less) and equality (==) predicates.
void MoReFEM::Utilities::EliminateDuplicate | ( | std::vector< T > & | vector, |
ComparePredicateT | comp, | ||
EqualPredicateT | equal ) |
Sort a std::vector and delete the possible duplicates.
T | Type of the data stored within the std::vector. |
[in,out] | vector | Vector which should be sort and from which duplicates should be removed. |
ComparePredicateT | Functor used to compare two values of the vector. |
EqualPredicateT | Predicate used to determine two quantities are equal. |
[in] | comp | Binary functor used to sort two values. |
[in] | equal | Predicate to use to determine whether two values are equal. |
std::string MoReFEM::Utilities::Now | ( | const Wrappers::Mpi & | mpi | ) |
Write the current date in format 'YYYY-MM-DD_HH:MM:SS'.
[in] | mpi | The mpi facility. Current function is there to tag output directories, so we do not want a mismatcch among ranks due to slightly different time. So root processor transmits its time to all ranks. |
I could probably have used std::chrono library, but I'm not very familiar with it and lots of features (including some that I think would do in a breeze what this function does) are set to appear in C++20.
|
inline |
A trivial function to check whether a pointer is nullptr or not.
[internal]
The point is just to avoid a lambda in algorithms... [internal]
Argument is a const reference to make it work also for unique_ptr...
PointerT | Type of the variable being scrutinized; it must be a pointer or a pointer-like type (currently only pointer or shared/unique smart pointers may be used in this function). |
[in] | pointer | Pointer or pointer-like variable being under investigation. |
const std::string & MoReFEM::Utilities::EmptyString | ( | ) |
Returns a reference to a static empty string.