CEPS  24.01
Cardiac ElectroPhysiology Simulator
ceps Namespace Reference

A namespace for all utility methods. More...

Namespaces

 hash
 namespace for hash generation tools
 
 math
 math typedef for matrix coefficients of a single element
 

Data Structures

struct  Function
 function caller : abstract base, only contains an variadic operator() More...
 
struct  ResultOfImpl
 Simply to indicate that ResultOfImpl will be a template to be specialized. More...
 
struct  ResultOfImpl< Function< _Res(_Args...)> >
 Used to get the return type of a Function struct. More...
 
struct  ResultOfImpl< _DerivedFn< _Signature > >
 Used to get the return type of a function. More...
 
struct  Function< _Res(_Args...)>
 base Function type for ceps. It's an abstract class which contains only a variadic operator parenthesis. Specialized to signature _Res(_Args...) More...
 
struct  MemberFunction
 Just to say that MemberFunction will be templated. More...
 
struct  MemberFunction< _Class, _Res(_Class::*)(_Args...)>
 A struct that can be used to convert member functions into ceps::Function. More...
 
struct  MemberFunction< _Class *, _Res(_Class::*)(_Args...)>
 A struct that can be used to convert member functions into ceps::Function pointer specialization. More...
 
struct  ConstantFunction
 Specialization of ceps::Function that returns constant values. More...
 
struct  ConstantFunction< _Res(_Args...)>
 Specialization of ceps::Function that returns constant values. More...
 
struct  PiecewiseFunction
 Specialization of ceps::Function with several constant values. More...
 
struct  PiecewiseFunction< _N, _Object, _Res(_Args...)>
 Specialization of ceps::Function with several constant values. More...
 
struct  ResultOfOperationStruct
 
struct  ResultOfOperationStruct<'+', _T1, _T2 >
 Gives the type of result of addition. More...
 
struct  ResultOfOperationStruct<'-', _T1, _T2 >
 Gives the type of result of substraction. More...
 
struct  ResultOfOperationStruct<' *', _T1, _T2 >
 Gives the type of result of multiplication. More...
 
struct  ResultOfOperationStruct<'/', _T1, _T2 >
 Gives the type of result of division. More...
 
struct  FunctionOperation
 The product of two functions, a function mult(_Res1,_Res2) must be implemented to be able to deduce the type of the product. More...
 
class  HoldsAttributes
 An abstract class from which all objects that contain region attributes should derive. More...
 
class  HoldsBoundary
 Abstract class to describe if an entity is on a boundary or not Objects that can be located in a mesh should inherit from this class. More...
 
class  HoldsCells
 An abstract class for objects that regroup pointers to cells (eg a mesh, a finite elements discretization, a finite volume discretization) More...
 
class  HoldsDimension
 Abstract class for objects that have a dimensionality (0D to 3D) More...
 
class  HoldsGeomObject
 For objects that have pointers to either a node or a cell. More...
 
class  HoldsGlobalIndex
 Abstract class for objects that have a global index. More...
 
class  HoldsNodes
 
class  HoldsProcIds
 Abstract class for objects that contain a CPU Id. More...
 

Typedefs

template<class _Fn >
using ResultOf = typename ResultOfImpl< _Fn >::type
 Used to get the return type of a function. More...
 
template<char _Op, typename _T1 , typename _T2 >
using ResultOfOperation = typename ResultOfOperationStruct< _Op, _T1, _T2 >::type
 Shortcut for type of result of operation. More...
 

Functions

template<class _Class , class _Res , class... _Args>
auto asFunction (_Class obj, _Res(_Class::*fn)(_Args...)) noexcept
 Transforms a member function of class into a MemberFunction struct. More...
 
template<class _Class , class _Res , class... _Args>
auto asFunction (_Class *obj, _Res(_Class::*fn)(_Args...)) noexcept
 Transforms a member function of class into a MemberFunction struct, version with a pointer to th class. More...
 
template<class _Class , class _Res , class... _Args>
auto newFunction (_Class obj, _Res(_Class::*fn)(_Args...)) noexcept
 Transforms a member function of class into a MemberFunction struct. More...
 
template<class _Class , class _Res , class... _Args>
auto newFunction (_Class *obj, _Res(_Class::*fn)(_Args...)) noexcept
 Transforms a member function of class into a MemberFunction struct, version with a pointer to th class. More...
 
template<class _Res , class... _Args>
ConstantFunction< _Res(_Args...)> asFunction (const _Res &arg) noexcept
 Convert a constant into a ceps function that returns it. More...
 
template<typename T >
int allGatherv (const CepsVector< T > &localTab, int localSize, CepsVector< T > &globalTab, CepsBool masterOnly=false)
 Gather all the local orig vector in the global dest vector. More...
 
int allGatherv (const std::unordered_map< CepsUInt, CepsUInt > &orig, std::unordered_map< CepsUInt, CepsUInt > &dest)
 gather all the local orig hashtable in the global dest hastable More...
 
template<typename _Key , typename _Val , template< typename, typename > typename _Container>
int broadcastMap (const CepsUInt &sender, _Container< _Key, _Val > &table)
 broadcast map or multimap More...
 
template<typename _Key , typename _Val , template< typename, typename > typename _Container>
int sendMap (const CepsUInt &sender, const CepsUInt &receiver, _Container< _Key, _Val > &table, const CepsUInt &nComms=1, const CepsUInt &commId=1)
 send a map or mutlimap from a cpu to another More...
 
template<typename T >
void sendRecvWithMatrix (const Eigen::Matrix< CepsUInt, Eigen::Dynamic, Eigen::Dynamic > &commMat, CepsVector< CepsVector< T >> &sendBuffers, CepsVector< CepsVector< T >> &recvBuffers)
 Pair to pair communication (using matrix) More...
 
template<typename _Key , typename _Tp , typename _Comp , typename _Alloc >
CepsVector< _Key > keysOf (const CepsMap< _Key, _Tp, _Comp, _Alloc > &m)
 Get the keys of a map as a vector. More...
 
template<typename _Key , typename _Tp , typename _Comp , typename _Alloc >
CepsVector< _Tp > valuesOf (const CepsMap< _Key, _Tp, _Comp, _Alloc > &m)
 Get the values of a map as a vector. More...
 
template<typename _Key , typename _Tp , typename _Hash , typename _Eq , typename _Alloc >
CepsVector< _Key > keysOf (const CepsMultiMap< _Key, _Tp, _Hash, _Eq, _Alloc > &m)
 Get the keys of a map as a vector. More...
 
template<typename _Key , typename _Tp , typename _Hash , typename _Eq , typename _Alloc >
CepsVector< _Tp > valuesOf (const CepsMultiMap< _Key, _Tp, _Hash, _Eq, _Alloc > &m)
 Get the values of a map as a vector. More...
 
template<typename _Key , typename _Tp , typename _Compare , typename _Alloc >
void destroy (CepsMap< _Key, _Tp, _Compare, _Alloc > &map, CepsBool deleteAll=true)
 Deletes all elements of the map properly, even if created with new. More...
 
template<typename _Key , typename _Tp , typename _Key2 >
CepsVector< _Tp > getValues (const CepsMultiMap< _Key, _Tp > &m, const _Key2 &key)
 extract values from multimap More...
 
template<class _Type , class _Alloc >
void destroy (CepsVector< _Type, _Alloc > &vec, CepsBool deleteAll=true)
 Clears the vector with delete if objects were created with new. More...
 
template<class _Type , class _Alloc >
CepsBool contains (const CepsVector< _Type, _Alloc > &vec, const _Type &item)
 Tells if vectors contains a given item. More...
 
template<class _Type , class _Alloc >
CepsBool contains (const CepsVector< _Type, _Alloc > &vec, _Type &&item)
 Tells if vectors contains a given item. More...
 
template<class _Type , class _Alloc , class InputIt >
void pushBack (CepsVector< _Type, _Alloc > &vec, InputIt first, InputIt last)
 Classic push back for several elements. More...
 
template<class _Type , class _Alloc , class InputIt >
void insertIf (CepsVector< _Type, _Alloc > &vec, InputIt first, InputIt last, std::function< CepsBool(const _Type &)> func)
 Conditional insertion of several elements. More...
 
template<class _Type , class _Alloc >
void insert (CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Conditional insertion of several elements. More...
 
template<class _Type , class _Alloc , class InputIt >
void insertUnique (CepsVector< _Type, _Alloc > &vec, InputIt first, InputIt last)
 Set behaviour: insert if elements does not exist in vector. More...
 
template<class _Type , class _Alloc >
CepsBool insertUnique (CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Set behaviour: insert if element does not exist in vector. More...
 
template<class _Type , class _Alloc >
CepsBool insertUnique (CepsVector< _Type, _Alloc > &vec, _Type &&value)
 Set behaviour: insert if element does not exist in vector. More...
 
template<class _Type , class _Alloc >
void eraseValue (CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Removes a value from a vector. More...
 
template<class _Type , class _Alloc , class InputIt >
void eraseValues (CepsVector< _Type, _Alloc > &vec, InputIt first, InputIt last)
 Removes several values from a vector. More...
 
template<class _Type , class _Alloc >
CepsVector< _Type, _Alloc >::iterator find (CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Returns the result of find in the whole vector. More...
 
template<class _Type , class _Alloc >
CepsVector< _Type, _Alloc >::const_iterator find (const CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Returns the result of find in the whole vector. More...
 
template<class _Type , class _Alloc >
std::pair< CepsBool, CepsUIntindexOf (const CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Returns T/F and an index of the position of element in the vector. More...
 
template<class _Type , class _Alloc >
CepsInt argVector (const CepsVector< _Type, _Alloc > &vec, const _Type &value)
 Get position of element in vector, -1 if not found. More...
 
template<class _Type , class _Alloc >
CepsUInt countWithPredicate (const CepsVector< _Type, _Alloc > &vec, std::function< CepsBool(const _Type &x)> predicate)
 Count the number of elements of a vector that satisfy a condition. More...
 
template<class _Type , class _Alloc >
CepsUInt countWithPredicate (const CepsVector< _Type *, _Alloc > &vec, std::function< CepsBool(_Type *x)> predicate)
 Count the number of elements of a vector that satisfy a condition Specialization for pointers. More...
 
template<class _Type , class _Alloc , typename _Compare >
void sort (CepsVector< _Type, _Alloc > &vec, _Compare compare)
 Sort whole vector with specified comparator. More...
 
template<class _Type , class _Alloc >
void sort (CepsVector< _Type, _Alloc > &vec)
 Basic sorting of whole vector, increasing values. More...
 
template<class _Type , class _Alloc , typename _Compare >
CepsVector< CepsUIntgetSortPermutation (const CepsVector< _Type, _Alloc > &vec, _Compare compare)
 Get the permutation that would be applied to sort the whole vector with specific comparator. More...
 
template<class _Type , class _Alloc >
CepsVector< CepsUIntgetSortPermutation (CepsVector< _Type, _Alloc > &vec)
 Get the permutation that would be applied to sort the whole vector. More...
 
template<class _Type , class _Alloc >
void applyPermutation (CepsVector< _Type, _Alloc > &vec, const CepsVector< CepsUInt > &p)
 Apply a permutation to a vector. More...
 
template<class _Type , class _Alloc >
CepsVector< CepsUIntgetIndicesInVector (const CepsVector< _Type, _Alloc > &origin, const CepsVector< _Type, _Alloc > &target)
 Compute indices of target elements into the origin vector. More...
 
template<class _Type , class _Alloc >
void rightRotate (CepsVector< _Type, _Alloc > &vec, CepsUInt n=1)
 Rotate n times the whole vector to the right. More...
 
template<class _Type , class _Alloc >
void leftRotate (CepsVector< _Type, _Alloc > &vec, CepsUInt n=1)
 Rotate n times the whole vector to the left. More...
 
template<class _Type , class _Alloc >
CepsUInt argmin (CepsVector< _Type, _Alloc > &vec)
 Returns the position of the minimum in a whole vector. More...
 
template<class _Type , class _Alloc , typename _Res >
CepsUInt argmin (CepsVector< _Type, _Alloc > &vec, std::function< _Res(const _Type &)> func)
 Returns the position of the minimum of func(item) in whole vector,. More...
 
template<class _Type , class _Alloc >
CepsUInt argmax (CepsVector< _Type, _Alloc > &vec)
 Returns the position of the maximum in a whole vector. More...
 
template<class _Type , class _Alloc , typename _Res >
CepsUInt argmax (CepsVector< _Type, _Alloc > &vec, std::function< _Res(const _Type &)> func)
 Returns the position of the maximum of func(item) in whole vector,. More...
 
template<class _Type , class _Alloc >
const _Type & min (const CepsVector< _Type, _Alloc > &vec)
 Returns the minimum of the vector, const version. More...
 
template<class _Type , class _Alloc >
_Type & min (CepsVector< _Type, _Alloc > &vec)
 Returns the minimum of the vector. More...
 
template<class _Type , class _Alloc >
const _Type & max (const CepsVector< _Type, _Alloc > &vec)
 Returns the maximum of the vector, const version. More...
 
template<class _Type , class _Alloc >
_Type & max (CepsVector< _Type, _Alloc > &vec)
 Returns the maximum of the vector. More...
 
template<class _Type , class _Alloc >
void cumSum (const CepsVector< _Type, _Alloc > &vec, CepsVector< _Type, _Alloc > &vecOut)
 Cumulated sum of values. More...
 
template<class _Type , class _Alloc >
CepsVector< _Type, _Alloc > cumSum (const CepsVector< _Type, _Alloc > &vec)
 Cumulated sum of values. More...
 
template<typename _Input1 , typename _Input2 >
void setIntersectionIndices (_Input1 first1, _Input1 last1, _Input2 first2, _Input2 last2, CepsVector< CepsUInt > &indices1, CepsVector< CepsUInt > &indices2)
 Returns the indices in two containers of the elements that are present in both containers. More...
 
template<class _Key , class _Value >
void extractValues (const CepsVector< _Key > &keys1, const CepsVector< _Value > &vals1, const CepsVector< _Key > &keys2, CepsVector< _Value > &vals2, _Value defaultValue=_Value())
 Get the values from vals1, indexed by keys1, following the keys given in keys2. Result put in vals2. If a key from keys2 is not found in keys1, replace with defaultValue. More...
 
template<typename _Type >
void popFront (CepsVector< _Type > &vec)
 Remove first element. More...
 
template<class _Type >
void distribute (const CepsVector< _Type > &vec, CepsVector< CepsVector< _Type >> &vecs, CepsUInt s, CepsBool eqDistrib=true)
 Divides the content of a vector into vectors of size s. Result is put in vecs. If eqDistrib is true, all the resulting subvectors have the same size. More...
 
template<class _Type , class _Res >
_Res applyAlong (const CepsVector< _Type > &vec, std::function< void(const _Type &, _Res &)> f, _Res init=_Res())
 Applies f(elem,init) to each element of a vector. More...
 
template<typename _Enum >
constexpr auto toIntegral (_Enum e) -> typename std::underlying_type< _Enum >::type
 Converts an enum type variable to an integer. More...
 
std::ofstream & debugLog ()
 Get the DebugLog used in Ceps. More...
 
std::ofstream & profilingLog ()
 Get the ProfilingLog used in Ceps. More...
 
CepsBool isProfiling ()
 Check if we are currently profiling on the master proc (always false on slave procs). More...
 
CepsBool isVerbose ()
 Check if the verbosity is enabled on the master proc (always false on slave procs). More...
 
CepsBool isWarnings ()
 Check if we enable the warnings on the master proc (always false on slave procs). More...
 
CepsBool isDebug ()
 Check if we enable the debug on the master proc (always false on slave procs). More...
 
void disableAbortOnError ()
 Set testing to true. Exceptions do not terminate program. More...
 
void enableAbortOnError ()
 Set testing to false. Exceptions terminate program. More...
 
template<typename _Type >
CepsBool isNullPtr (_Type *ptr)
 Tells if passed pointer is null. More...
 
template<typename _Type >
CepsBool isNullPtr (std::shared_ptr< _Type > ptr)
 Tells if passed pointer is null. More...
 
template<typename _Type >
CepsBool isValidPtr (_Type *ptr)
 Tells if pointer is not null. More...
 
template<typename _Type >
CepsBool isValidPtr (std::shared_ptr< _Type > ptr)
 Tells if pointer is not null. More...
 
template<typename _Type , typename U >
CepsBool isSamePtr (_Type *xptr, U *yptr)
 Tells if two pointers designate the same address. More...
 
template<typename _Type , typename U >
CepsBool isDifferentPtr (_Type *xptr, U *yptr)
 Tells if two pointers designate two different addresses. More...
 
template<typename _Derived , class _Base >
_Derived runtimeCast (_Base x)
 Perform a runtime cast between base type and derived type if we can. More...
 
template<typename _Type >
void destroyObject (_Type &)
 Destroy[delete] any type. More...
 
template<typename _Type >
void destroyObject (_Type *&obj)
 Specialization if is_pointer : Destroy[delete] any type. More...
 
template<typename _Type >
void destroyObject (const _Type *obj)
 Specialization if is_pointer : Destroy[delete] any type. More...
 
template<typename _Type >
void destroyTabular (_Type &)
 Destroy[delete] any type. More...
 
template<typename _Type >
void destroyTabular (_Type *&obj)
 Specialization if is_pointer : Destroy[delete] any type. More...
 
template<typename _Type , typename... _Args>
_Type * getNew (_Args... args)
 Allocates memory for one object. Be careful, the expansion of arguments may produce some weird results when pointers and const references are passed. More...
 
template<typename _Type >
_Type * newArray (long unsigned int n, _Type fill=_Type())
 Creates a C-array with optional init value. More...
 
template<typename _Type >
_Type * newCopyArray (_Type *src, long unsigned int n)
 Generates a C-style copy of a C-style array. More...
 
CepsUInt initialize (int argc, char *argv[])
 Initializes parallel environment. More...
 
void finalize ()
 Finalizes parallel environment. More...
 
void finalizeWithError ()
 Calls MPI_Abort, function used instead of std::terminate() More...
 
CepsUInt getRank ()
 Returns current processor rank. More...
 
CepsUInt getGridSize ()
 Returns the number of process on the computing grid. More...
 
CepsBool isMaster ()
 Is calling process the master ? More...
 
CepsBool isLast ()
 Is calling process last in computing grid ? More...
 
CepsBool isParallel ()
 Is there more than 1 process currently working ? More...
 
void barrier ()
 Explicit barrier: wait for all processors before continuing. More...
 
void beginSequential ()
 Begins a sequential block. More...
 
void endSequential ()
 End a sequential block. More...
 
MPI_Comm getCommunicator ()
 Get the communicator. More...
 
MPI_Comm * getPtrCommunicator ()
 Get pointer to the communicator. More...
 
CepsString execute (CepsString command, CepsBool withErr=false, CepsBool abortOnErr=false)
 Not really a parallel thing. Calls system() and deals with return code. More...
 
template<typename _Result >
_Result convertReal (CepsReal *data)
 A small utility to convert a vector of reals into the appropriate (scalar,vector,tensor) More...
 
void checkNanOrInf (CepsReal v, CepsString message="")
 Stops if value is NaN or infty. More...
 
CepsBool equals (CepsReal a, CepsReal b, CepsReal error=1.0)
 CepsReal equality up to machine precision. More...
 
CepsBool approxEquals (CepsReal a, CepsReal b, CepsReal epsilon)
 Approximate equality with epsilon tolerance. More...
 
CepsBool approxEquals (CepsReal *a, CepsReal *b, CepsUInt n, CepsReal epsilon)
 Approximate equality with epsilon tolerance for n floating point numbers. Inequality tested in the linfty norm. More...
 
CepsBool greaterThan (CepsReal a, CepsReal b, CepsReal epsilon=FLOATING_POINT_EPSILON)
 Greater than comparison with epsilon tolerance. More...
 
CepsBool lesserThan (CepsReal a, CepsReal b, CepsReal epsilon=FLOATING_POINT_EPSILON)
 Lesser than comparison with epsilon tolerance. More...
 
CepsVector< CepsStringsplit (const CepsString &s, const CepsString &delimiters=CepsString(" \t"))
 Splits a string using mulitple delimiters in a single string. More...
 
CepsMap< CepsString, CepsVector< CepsString > > split (const CepsMap< CepsString, CepsString > &map, const CepsString &delimiters=CepsString(" \t"))
 Apply split function on all string stored. More...
 
CepsVector< CepsVector< CepsString > > split (const CepsVector< CepsString > &vec, const CepsString &delimiters=CepsString(" \t"))
 Apply split function on all string stored. More...
 
CepsString join (const CepsVector< CepsString > &vec, const CepsChar &delimeter=' ')
 Join multiple strings into one. More...
 
CepsString trim (const CepsString &s)
 Removes trailing and preceeding spaces. More...
 
CepsString removeSpaces (const CepsString &s)
 Removes spaces and tabs. More...
 
CepsString substract (const CepsString &s, const CepsString &toErase)
 Substract all occurences of another CepsString. More...
 
CepsString substract (const CepsString &s, const CepsVector< CepsString > &toErase)
 Substract all occurences of different CepsString. More...
 
CepsString toUpper (const CepsString &s)
 Switches all characters to upper case. More...
 
CepsString toLower (const CepsString &s)
 Switches all characters to lower case. More...
 
CepsBool isPathInOneWord (const CepsString &s)
 Checks if given path is in one word (it may not exist yet) More...
 
CepsString toKey (const CepsString &s)
 Transform to key type a std::string, upper case and no spaces. More...
 
CepsVector< CepsStringtoKey (const CepsVector< CepsString > &vec)
 Transform to key type a vector of std::string, upper case and no spaces. More...
 
void toKeyInPlace (CepsVector< CepsString > &vec)
 Transform to key type a vector of std::string, upper case and no spaces. More...
 
CepsBool toBool (const CepsString &s)
 Cast CepsString to CepsBool. More...
 
CepsReal toReal (const CepsString &s)
 Cast CepsString to CepsReal. More...
 
CepsSet< CepsRealtoReals (const CepsString &s)
 Cast CepsString to a set of CepsReal. More...
 
CepsMathScalar toMathScalar (const CepsVector< CepsString > &vec)
 Cast a CepsVector of CepsString to CepsMathScalar same effect as ceps::toReal(vec[0]) More...
 
CepsMathVertex toMathVertex (const CepsVector< CepsString > &vec)
 Cast a CepsVector of CepsString to CepsMathVertex. More...
 
CepsMathTensor toMathTensor (const CepsVector< CepsString > &vec)
 Cast a CepsVector of CepsString to CepsMathTensor. More...
 
CepsInt toInt (const CepsString &s)
 Cast CepsString to CepsInt. More...
 
CepsSet< CepsInttoInts (const CepsString &s)
 Cast CepsString to a set of CepsInt. More...
 
CepsUInt toUInt (const CepsString &s)
 Cast CepsString to CepsUInt. More...
 
CepsSet< CepsUInttoUInts (const CepsString &s)
 Cast CepsString to a set of CepsUInt. More...
 
CepsBool isNumber (const CepsString &s)
 Check if the string contains only digit numbers. More...
 
CepsBool startsWith (const CepsString &s, const CepsString &comp)
 Check if the string 'str' starts with 'comp'. More...
 
CepsBool startsWithOneOf (const CepsString &s, const CepsVector< CepsString > &comps)
 Check if the string 'str' starts with one of 'comps'. More...
 
CepsBool endsWith (const CepsString &s, const CepsString &comp)
 Check if the string 'str' ends with 'comp'. More...
 
CepsBool endsWithOneOf (const CepsString &s, const CepsVector< CepsString > &comps)
 Check if the string 'str' ends with one of 'comps'. More...
 
CepsMap< CepsString, CepsVector< CepsString > > splitByKeyword (const CepsString &s, const CepsSet< CepsString > &tags)
 Extract parameters in the CepsString given by tags. Builds a map of keywords and parameter words according to tags. If splitted string s is "FOO 1 2 BAR toto" extractParam(vec,{"FOO","BAR"}) returns {"BAR":"toto","FOO":"1 2"}. More...
 
CepsVector< CepsStringsplitAtNthDelimiter (const CepsString &s, CepsUInt n, CepsString delimiters=CepsString(" \t"))
 Split a string a the n-th delimeter. This ignores the doubled delimiter (eg multiple spaces count as one) More...
 
CepsVector< CepsStringsplitUntilNthDelimiter (const CepsString &s, const CepsUInt &n, CepsString delimiters=CepsString(" \t"))
 Split a string for the first n delimeters. More...
 
CepsString readParams (const CepsVector< CepsString > &scope, const CepsString &tag, const CepsString &def="", const CepsUInt &pad=1)
 Read parameters into a map. More...
 
CepsString removeDoubleSlashes (const CepsString &path)
 Replaces double slashes in a string with a single slash. Used for clean paths. More...
 
CepsString getDir (const CepsString &str)
 Get a substring of s, from beginning of s to the last '/' character. Example: "/home/someone/file.txt" returns "/home/someone/". More...
 
CepsString getFilename (const CepsString &str)
 Returns a substring corresponding to the string after the last '/' character. Example: "/home/someone/file.txt" returns "file.txt". More...
 
CepsString getBaseName (const CepsString &str)
 Extracts the base of a file name, without path, nor extension. Ex: getBaseName("/path/to/myfile.dat") returns myfile Ex: getBaseName("./path.with.dots//farboo") returns farboo. More...
 
CepsString getExtension (const CepsString &str)
 Returns the extension of a file, if any. More...
 
CepsString changeExtension (const CepsString &str, const CepsString &ext)
 Change the extension of a file name (does not check if file exists). More...
 
template<typename _Tp >
CepsString toString (_Tp value)
 Convert a given value to a string (input has to be compatible with std::to_string) More...
 
CepsBool fileExists (const CepsString &fileName, const CepsString &directory)
 
CepsBool fileExists (const CepsString &fileName)
 
CepsBool isSameFile (const CepsString &f1, const CepsString &f2)
 Tells if given paths refer to the same file. More...
 
CepsVector< CepsStringcleanup (const CepsVector< CepsString > &vec)
 Clean a vector of string, remove empty and " " string. More...
 
CepsReal readReal (std::istream &file, const CepsString &errorMessage="")
 Reads a floating point number from an istream, aborts if conversion fails advances the stream by 1 word. More...
 
CepsInt readInt (std::istream &file, const CepsString &errorMessage="")
 Reads an integral number from an istream, aborts if conversion fails advances the stream by 1 word. More...
 
CepsReal3D readVertex (std::istream &file, const CepsString &errorMessage="")
 Reads an integral number from an istream, aborts if conversion fails advances the stream by 1 word. More...
 
CepsMathTensor readTensor (std::istream &file, const CepsString &errorMessage="")
 Reads 9 floating point numbers from an istream, aborts if conversion fails advances the stream by 9 words. More...
 
template<CepsUInt n>
CepsArray< CepsMathScalar, n > readReals (std::istream &file, const CepsString &errorMessage="")
 Reads n floating point numbers from an istream, aborts if conversion fails. More...
 
void linearRegression (std::vector< CepsReal > &xs, std::vector< CepsReal > &fs, CepsReal &a, CepsReal &b)
 Performs a linear regression with least squares, put results in a and b coefficients. More...
 
template<typename _Result >
CepsEnum getFlagsOf (ArraySAFunc< _Result > *f)
 get functor options More...
 
CepsEnum getFlagsOf (FileInterpolatorSAFunc *f)
 get functor options More...
 
template<typename _Result >
CepsEnum getFlagsOf (CoeffInterpolatorSAFunc< _Result > *f)
 get functor options More...
 
template<typename _Result >
CepsEnum getFlagsOf (CstPiecewiseSAFunc< _Result > *f)
 get functor options More...
 
template<typename _Result >
CepsEnum getFlagsOf (FctPiecewiseSAFunc< _Result > *f)
 get functor options More...
 
template<typename _Fn >
CepsEnum getFlagsOf (_Fn f)
 Tell that this function is template, nothing more. More...
 
template<typename _Result >
CepsEnum getFlagsOf (Function< _Result(CepsStandardArgs)> *f)
 Get flags of dereferenced object ptr. More...
 
CepsEnum getFlagsOf (SolVecSAFunc *f)
 get functor options More...
 

Detailed Description

A namespace for all utility methods.

Mathematical utilities and stimulation functions.

Typedef Documentation

◆ ResultOf

template<class _Fn >
using ceps::ResultOf = typedef typename ResultOfImpl<_Fn>::type

Used to get the return type of a function.

Definition at line 79 of file CepsFunction.hpp.

◆ ResultOfOperation

template<char _Op, typename _T1 , typename _T2 >
using ceps::ResultOfOperation = typedef typename ResultOfOperationStruct<_Op, _T1, _T2>::type

Shortcut for type of result of operation.

Definition at line 359 of file CepsFunction.hpp.

Function Documentation

◆ allGatherv() [1/2]

template<typename T >
int ceps::allGatherv ( const CepsVector< T > &  localTab,
int  localSize,
CepsVector< T > &  globalTab,
CepsBool  masterOnly = false 
)

Gather all the local orig vector in the global dest vector.

Parameters
[in]localTablocal vector to put in the global vector
[in]localSizenumber of local elements we want to put in the global Tab
[out]globalTabglobal output vector gather all the local vectors
[in]masterOnlyuse MPI_Gatherv to root, instead of AllgatherV
Returns
MPI_SUCCES if success

Definition at line 114 of file CepsContainerCommunication.hpp.

◆ allGatherv() [2/2]

int ceps::allGatherv ( const std::unordered_map< CepsUInt, CepsUInt > &  orig,
std::unordered_map< CepsUInt, CepsUInt > &  dest 
)

gather all the local orig hashtable in the global dest hastable

Parameters
[in]origlocal hashtable
[out]destglobal hastable
Returns
MPI_SUCCES if success

Definition at line 35 of file CepsContainerCommunication.cpp.

◆ applyAlong()

template<class _Type , class _Res >
_Res ceps::applyAlong ( const CepsVector< _Type > &  vec,
std::function< void(const _Type &, _Res &)>  f,
_Res  init = _Res () 
)

Applies f(elem,init) to each element of a vector.

Definition at line 638 of file CepsVector.hpp.

◆ applyPermutation()

template<class _Type , class _Alloc >
void ceps::applyPermutation ( CepsVector< _Type, _Alloc > &  vec,
const CepsVector< CepsUInt > &  p 
)

Apply a permutation to a vector.

See also
ceps::getSortPermutation

Definition at line 278 of file CepsVector.hpp.

◆ approxEquals() [1/2]

CepsBool ceps::approxEquals ( CepsReal a,
CepsReal b,
CepsUInt  n,
CepsReal  epsilon 
)
inline

Approximate equality with epsilon tolerance for n floating point numbers. Inequality tested in the linfty norm.

Parameters
aCepsReal to compare
bCepsReal to compare
nnumber of reals to compare
epsilonadditional error factor
Returns
true if both CepsReal have been found to be approximately equal

Definition at line 82 of file Precision.hpp.

◆ approxEquals() [2/2]

CepsBool ceps::approxEquals ( CepsReal  a,
CepsReal  b,
CepsReal  epsilon 
)
inline

Approximate equality with epsilon tolerance.

Parameters
aCepsReal to compare
bCepsReal to compare
epsilonadditional error factor
Returns
true if both CepsReal have been found to be approximately equal

Definition at line 67 of file Precision.hpp.

◆ argmax() [1/2]

template<class _Type , class _Alloc >
CepsUInt ceps::argmax ( CepsVector< _Type, _Alloc > &  vec)

Returns the position of the maximum in a whole vector.

Definition at line 402 of file CepsVector.hpp.

◆ argmax() [2/2]

template<class _Type , class _Alloc , typename _Res >
CepsUInt ceps::argmax ( CepsVector< _Type, _Alloc > &  vec,
std::function< _Res(const _Type &)>  func 
)

Returns the position of the maximum of func(item) in whole vector,.

Definition at line 422 of file CepsVector.hpp.

◆ argmin() [1/2]

template<class _Type , class _Alloc >
CepsUInt ceps::argmin ( CepsVector< _Type, _Alloc > &  vec)

Returns the position of the minimum in a whole vector.

Definition at line 356 of file CepsVector.hpp.

◆ argmin() [2/2]

template<class _Type , class _Alloc , typename _Res >
CepsUInt ceps::argmin ( CepsVector< _Type, _Alloc > &  vec,
std::function< _Res(const _Type &)>  func 
)

Returns the position of the minimum of func(item) in whole vector,.

Definition at line 376 of file CepsVector.hpp.

◆ argVector()

template<class _Type , class _Alloc >
CepsInt ceps::argVector ( const CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Get position of element in vector, -1 if not found.

Definition at line 200 of file CepsVector.hpp.

◆ asFunction() [1/3]

template<class _Class , class _Res , class... _Args>
auto ceps::asFunction ( _Class *  obj,
_Res(_Class::*)(_Args...)  fn 
)
inlinenoexcept

Transforms a member function of class into a MemberFunction struct, version with a pointer to th class.

Definition at line 219 of file CepsFunction.hpp.

◆ asFunction() [2/3]

template<class _Class , class _Res , class... _Args>
auto ceps::asFunction ( _Class  obj,
_Res(_Class::*)(_Args...)  fn 
)
inlinenoexcept

Transforms a member function of class into a MemberFunction struct.

Definition at line 210 of file CepsFunction.hpp.

◆ asFunction() [3/3]

template<class _Res , class... _Args>
ConstantFunction<_Res(_Args...)> ceps::asFunction ( const _Res &  arg)
inlinenoexcept

Convert a constant into a ceps function that returns it.

Definition at line 279 of file CepsFunction.hpp.

◆ barrier()

void ceps::barrier ( )

Explicit barrier: wait for all processors before continuing.

Definition at line 198 of file CepsParallelTools.cpp.

◆ beginSequential()

void ceps::beginSequential ( )

Begins a sequential block.

All the instructions between the beginning and the end of a sequential block will be run by each process one after the other. The hand is given to process 0, then process 1 etc. Users should be careful when using beginSequential and endSequential: every call to beginSequential must be coupled with a call to endSequential. Invalid use of these methods will create deadlocks.

Definition at line 208 of file CepsParallelTools.cpp.

◆ broadcastMap()

template<typename _Key , typename _Val , template< typename, typename > typename _Container>
int ceps::broadcastMap ( const CepsUInt sender,
_Container< _Key, _Val > &  table 
)

broadcast map or multimap

Parameters
[in]senderrank of sender cpu
[in]tablehashtable to share
Returns
MPI_SUCCES if success

Definition at line 154 of file CepsContainerCommunication.hpp.

◆ changeExtension()

CepsString ceps::changeExtension ( const CepsString str,
const CepsString ext 
)

Change the extension of a file name (does not check if file exists).

Parameters
strthe CepsString to consider
extextension to replace with

Definition at line 588 of file CepsString.cpp.

◆ checkNanOrInf()

void ceps::checkNanOrInf ( CepsReal  v,
CepsString  message = "" 
)

Stops if value is NaN or infty.

Definition at line 61 of file CepsTypeTools.cpp.

◆ cleanup()

CepsVector< CepsString > ceps::cleanup ( const CepsVector< CepsString > &  vec)

Clean a vector of string, remove empty and " " string.

Parameters
vecthe vector of string to clean
Returns
CepsVector<CepsString>

Definition at line 647 of file CepsString.cpp.

◆ contains() [1/2]

template<class _Type , class _Alloc >
CepsBool ceps::contains ( const CepsVector< _Type, _Alloc > &  vec,
_Type &&  item 
)

Tells if vectors contains a given item.

Definition at line 65 of file CepsVector.hpp.

◆ contains() [2/2]

template<class _Type , class _Alloc >
CepsBool ceps::contains ( const CepsVector< _Type, _Alloc > &  vec,
const _Type &  item 
)

Tells if vectors contains a given item.

Definition at line 56 of file CepsVector.hpp.

◆ convertReal()

template<typename _Result >
_Result ceps::convertReal ( CepsReal data)

A small utility to convert a vector of reals into the appropriate (scalar,vector,tensor)

◆ countWithPredicate() [1/2]

template<class _Type , class _Alloc >
CepsUInt ceps::countWithPredicate ( const CepsVector< _Type *, _Alloc > &  vec,
std::function< CepsBool(_Type *x)>  predicate 
)

Count the number of elements of a vector that satisfy a condition Specialization for pointers.

Definition at line 223 of file CepsVector.hpp.

◆ countWithPredicate() [2/2]

template<class _Type , class _Alloc >
CepsUInt ceps::countWithPredicate ( const CepsVector< _Type, _Alloc > &  vec,
std::function< CepsBool(const _Type &x)>  predicate 
)

Count the number of elements of a vector that satisfy a condition.

Definition at line 211 of file CepsVector.hpp.

◆ cumSum() [1/2]

template<class _Type , class _Alloc >
CepsVector<_Type,_Alloc> ceps::cumSum ( const CepsVector< _Type, _Alloc > &  vec)

Cumulated sum of values.

for a given vector $(x_i)_{i \in \llbracket 0,n\rrbracket}$ computes a vector $y$ of size $n+1$ such that

\[ y_0 = 0,\quad y_i = \sum{k=0}^i x_k \]

Definition at line 503 of file CepsVector.hpp.

◆ cumSum() [2/2]

template<class _Type , class _Alloc >
void ceps::cumSum ( const CepsVector< _Type, _Alloc > &  vec,
CepsVector< _Type, _Alloc > &  vecOut 
)

Cumulated sum of values.

for a given vector $(x_i)_{i \in \llbracket 0,n\rrbracket}$ computes a vector $y$ of size $n+1$ such that

\[ y_0 = 0,\quad y_i = \sum{k=0}^i x_k \]

Parameters
[out]vecto sum
[out]vecOutcumulated sums

Definition at line 487 of file CepsVector.hpp.

◆ debugLog()

std::ofstream & ceps::debugLog ( )

Get the DebugLog used in Ceps.

Returns
std::ofstream&

Definition at line 245 of file CepsFlags.cpp.

◆ destroy() [1/2]

template<typename _Key , typename _Tp , typename _Compare , typename _Alloc >
void ceps::destroy ( CepsMap< _Key, _Tp, _Compare, _Alloc > &  map,
CepsBool  deleteAll = true 
)

Deletes all elements of the map properly, even if created with new.

Definition at line 93 of file CepsMap.hpp.

◆ destroy() [2/2]

template<class _Type , class _Alloc >
void ceps::destroy ( CepsVector< _Type, _Alloc > &  vec,
CepsBool  deleteAll = true 
)

Clears the vector with delete if objects were created with new.

Definition at line 45 of file CepsVector.hpp.

◆ destroyObject() [1/3]

template<typename _Type >
void ceps::destroyObject ( _Type &  )

Destroy[delete] any type.

Definition at line 116 of file CepsMemory.hpp.

◆ destroyObject() [2/3]

template<typename _Type >
void ceps::destroyObject ( _Type *&  obj)

Specialization if is_pointer : Destroy[delete] any type.

Definition at line 124 of file CepsMemory.hpp.

◆ destroyObject() [3/3]

template<typename _Type >
void ceps::destroyObject ( const _Type *  obj)

Specialization if is_pointer : Destroy[delete] any type.

Definition at line 137 of file CepsMemory.hpp.

◆ destroyTabular() [1/2]

template<typename _Type >
void ceps::destroyTabular ( _Type &  )

Destroy[delete] any type.

Definition at line 149 of file CepsMemory.hpp.

◆ destroyTabular() [2/2]

template<typename _Type >
void ceps::destroyTabular ( _Type *&  obj)

Specialization if is_pointer : Destroy[delete] any type.

Definition at line 158 of file CepsMemory.hpp.

◆ disableAbortOnError()

void ceps::disableAbortOnError ( )

Set testing to true. Exceptions do not terminate program.

Definition at line 285 of file CepsFlags.cpp.

◆ distribute()

template<class _Type >
void ceps::distribute ( const CepsVector< _Type > &  vec,
CepsVector< CepsVector< _Type >> &  vecs,
CepsUInt  s,
CepsBool  eqDistrib = true 
)

Divides the content of a vector into vectors of size s. Result is put in vecs. If eqDistrib is true, all the resulting subvectors have the same size.

Definition at line 605 of file CepsVector.hpp.

◆ enableAbortOnError()

void ceps::enableAbortOnError ( )

Set testing to false. Exceptions terminate program.

Definition at line 291 of file CepsFlags.cpp.

◆ endSequential()

void ceps::endSequential ( )

End a sequential block.

All the instructions between the beginning and the end of a sequential block will be run by each process one after the other. The hand is given to process 0, then process 1 etc.

Definition at line 224 of file CepsParallelTools.cpp.

◆ endsWith()

CepsBool ceps::endsWith ( const CepsString s,
const CepsString comp 
)

Check if the string 'str' ends with 'comp'.

Definition at line 363 of file CepsString.cpp.

◆ endsWithOneOf()

CepsBool ceps::endsWithOneOf ( const CepsString s,
const CepsVector< CepsString > &  comps 
)

Check if the string 'str' ends with one of 'comps'.

Definition at line 374 of file CepsString.cpp.

◆ equals()

CepsBool ceps::equals ( CepsReal  a,
CepsReal  b,
CepsReal  error = 1.0 
)
inline

CepsReal equality up to machine precision.

Equality with tolerance based on numerical limit of CepsReal precision (single or double), and an error factor that can arise from iterative computation. Not really fast, but reliable for what we intend to compute.

Parameters
aCepsReal to compare
bCepsReal to compare
erroradditional error factor
Returns
true if both CepsReal have been found to be equal

Definition at line 54 of file Precision.hpp.

◆ eraseValue()

template<class _Type , class _Alloc >
void ceps::eraseValue ( CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Removes a value from a vector.

Definition at line 151 of file CepsVector.hpp.

◆ eraseValues()

template<class _Type , class _Alloc , class InputIt >
void ceps::eraseValues ( CepsVector< _Type, _Alloc > &  vec,
InputIt  first,
InputIt  last 
)

Removes several values from a vector.

Definition at line 160 of file CepsVector.hpp.

◆ execute()

CepsString ceps::execute ( CepsString  command,
CepsBool  withErr = false,
CepsBool  abortOnErr = false 
)

Not really a parallel thing. Calls system() and deals with return code.

Parameters
withErradds the stderr to the stdoutput. Command will be appended with 2&>1
abortOnErrstops CEPS if command fails
Returns
standard output in a string

Definition at line 256 of file CepsParallelTools.cpp.

◆ extractValues()

template<class _Key , class _Value >
void ceps::extractValues ( const CepsVector< _Key > &  keys1,
const CepsVector< _Value > &  vals1,
const CepsVector< _Key > &  keys2,
CepsVector< _Value > &  vals2,
_Value  defaultValue = _Value () 
)

Get the values from vals1, indexed by keys1, following the keys given in keys2. Result put in vals2. If a key from keys2 is not found in keys1, replace with defaultValue.

Definition at line 557 of file CepsVector.hpp.

◆ fileExists() [1/2]

CepsBool ceps::fileExists ( const CepsString fileName)

Returns true if the given file. File is searched in getDir(fileName)

Parameters
[in]fileNamethe file
Returns
true if file exists

Definition at line 631 of file CepsString.cpp.

◆ fileExists() [2/2]

CepsBool ceps::fileExists ( const CepsString fileName,
const CepsString directory 
)

Returns true if the given file is in the specified directory

Parameters
[in]fileNamethe file
[in]directoryabsolute path to the directory
Returns
true if file exists

Definition at line 595 of file CepsString.cpp.

◆ finalize()

void ceps::finalize ( )

Finalizes parallel environment.

As with ceps::initialize(), implementation differs whether PETSc is used or not.

Definition at line 106 of file CepsParallelTools.cpp.

◆ finalizeWithError()

void ceps::finalizeWithError ( )

Calls MPI_Abort, function used instead of std::terminate()

Definition at line 124 of file CepsParallelTools.cpp.

◆ find() [1/2]

template<class _Type , class _Alloc >
CepsVector<_Type,_Alloc>::iterator ceps::find ( CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Returns the result of find in the whole vector.

Definition at line 173 of file CepsVector.hpp.

◆ find() [2/2]

template<class _Type , class _Alloc >
CepsVector<_Type,_Alloc>::const_iterator ceps::find ( const CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Returns the result of find in the whole vector.

Definition at line 181 of file CepsVector.hpp.

◆ getBaseName()

CepsString ceps::getBaseName ( const CepsString str)

Extracts the base of a file name, without path, nor extension. Ex: getBaseName("/path/to/myfile.dat") returns myfile Ex: getBaseName("./path.with.dots//farboo") returns farboo.

Parameters
strthe CepsString to consider
Returns
CepsString

Definition at line 563 of file CepsString.cpp.

◆ getCommunicator()

MPI_Comm ceps::getCommunicator ( )

Get the communicator.

Definition at line 240 of file CepsParallelTools.cpp.

◆ getDir()

CepsString ceps::getDir ( const CepsString str)

Get a substring of s, from beginning of s to the last '/' character. Example: "/home/someone/file.txt" returns "/home/someone/".

Parameters
strthe CepsString to consider
Returns
CepsString

Definition at line 521 of file CepsString.cpp.

◆ getExtension()

CepsString ceps::getExtension ( const CepsString str)

Returns the extension of a file, if any.

Parameters
strthe CepsString to consider
Returns
CepsString

Definition at line 580 of file CepsString.cpp.

◆ getFilename()

CepsString ceps::getFilename ( const CepsString str)

Returns a substring corresponding to the string after the last '/' character. Example: "/home/someone/file.txt" returns "file.txt".

Parameters
strthe CepsString to consider
Returns
CepsString

Definition at line 556 of file CepsString.cpp.

◆ getFlagsOf() [1/8]

template<typename _Fn >
CepsEnum ceps::getFlagsOf ( _Fn  f)

Tell that this function is template, nothing more.

◆ getFlagsOf() [2/8]

template<typename _Result >
CepsEnum ceps::getFlagsOf ( ArraySAFunc< _Result > *  f)

get functor options

◆ getFlagsOf() [3/8]

template<typename _Result >
CepsEnum ceps::getFlagsOf ( CoeffInterpolatorSAFunc< _Result > *  f)

get functor options

◆ getFlagsOf() [4/8]

template<typename _Result >
CepsEnum ceps::getFlagsOf ( CstPiecewiseSAFunc< _Result > *  f)

get functor options

◆ getFlagsOf() [5/8]

template<typename _Result >
CepsEnum ceps::getFlagsOf ( FctPiecewiseSAFunc< _Result > *  f)

get functor options

◆ getFlagsOf() [6/8]

CepsEnum ceps::getFlagsOf ( FileInterpolatorSAFunc f)

get functor options

Definition at line 150 of file FileInterpolatorSAFunc.cpp.

◆ getFlagsOf() [7/8]

template<typename _Result >
CepsEnum ceps::getFlagsOf ( Function< _Result(CepsStandardArgs)> *  f)

Get flags of dereferenced object ptr.

◆ getFlagsOf() [8/8]

CepsEnum ceps::getFlagsOf ( SolVecSAFunc f)

get functor options

Definition at line 58 of file SolVecSAFunc.cpp.

◆ getGridSize()

CepsUInt ceps::getGridSize ( )

Returns the number of process on the computing grid.

Definition at line 167 of file CepsParallelTools.cpp.

◆ getIndicesInVector()

template<class _Type , class _Alloc >
CepsVector<CepsUInt> ceps::getIndicesInVector ( const CepsVector< _Type, _Alloc > &  origin,
const CepsVector< _Type, _Alloc > &  target 
)

Compute indices of target elements into the origin vector.

Definition at line 303 of file CepsVector.hpp.

◆ getNew()

template<typename _Type , typename... _Args>
_Type* ceps::getNew ( _Args...  args)

Allocates memory for one object. Be careful, the expansion of arguments may produce some weird results when pointers and const references are passed.

Definition at line 170 of file CepsMemory.hpp.

◆ getPtrCommunicator()

MPI_Comm * ceps::getPtrCommunicator ( )

Get pointer to the communicator.

Definition at line 246 of file CepsParallelTools.cpp.

◆ getRank()

CepsUInt ceps::getRank ( )

Returns current processor rank.

Definition at line 155 of file CepsParallelTools.cpp.

◆ getSortPermutation() [1/2]

template<class _Type , class _Alloc >
CepsVector<CepsUInt> ceps::getSortPermutation ( CepsVector< _Type, _Alloc > &  vec)

Get the permutation that would be applied to sort the whole vector.

See also
ceps::applyPermutation

Definition at line 270 of file CepsVector.hpp.

◆ getSortPermutation() [2/2]

template<class _Type , class _Alloc , typename _Compare >
CepsVector<CepsUInt> ceps::getSortPermutation ( const CepsVector< _Type, _Alloc > &  vec,
_Compare  compare 
)

Get the permutation that would be applied to sort the whole vector with specific comparator.

See also
ceps::applyPermutation

Definition at line 254 of file CepsVector.hpp.

◆ getValues()

template<typename _Key , typename _Tp , typename _Key2 >
CepsVector<_Tp> ceps::getValues ( const CepsMultiMap< _Key, _Tp > &  m,
const _Key2 &  key 
)

extract values from multimap

Definition at line 106 of file CepsMap.hpp.

◆ greaterThan()

CepsBool ceps::greaterThan ( CepsReal  a,
CepsReal  b,
CepsReal  epsilon = FLOATING_POINT_EPSILON 
)
inline

Greater than comparison with epsilon tolerance.

Parameters
aCepsReal to compare
bCepsReal to compare
epsilonmaximum tolerance admitted
Returns
true if a > b with epsilon tolerance

Definition at line 98 of file Precision.hpp.

◆ indexOf()

template<class _Type , class _Alloc >
std::pair<CepsBool, CepsUInt> ceps::indexOf ( const CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Returns T/F and an index of the position of element in the vector.

Definition at line 189 of file CepsVector.hpp.

◆ initialize()

CepsUInt ceps::initialize ( int  argc,
char *  argv[] 
)

Initializes parallel environment.

If PETSc is used then the PETSc method PetscTools::PetscInitialize(...) is used. Else, use default MPI initialization method. Also parses command line arguments.

Parameters
[in]argcnumber of arguments
[in]argvprogram arguments
Returns
non-zero value on failure.

Definition at line 44 of file CepsParallelTools.cpp.

◆ insert()

template<class _Type , class _Alloc >
void ceps::insert ( CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Conditional insertion of several elements.

Definition at line 105 of file CepsVector.hpp.

◆ insertIf()

template<class _Type , class _Alloc , class InputIt >
void ceps::insertIf ( CepsVector< _Type, _Alloc > &  vec,
InputIt  first,
InputIt  last,
std::function< CepsBool(const _Type &)>  func 
)

Conditional insertion of several elements.

Definition at line 85 of file CepsVector.hpp.

◆ insertUnique() [1/3]

template<class _Type , class _Alloc >
CepsBool ceps::insertUnique ( CepsVector< _Type, _Alloc > &  vec,
_Type &&  value 
)

Set behaviour: insert if element does not exist in vector.

Definition at line 140 of file CepsVector.hpp.

◆ insertUnique() [2/3]

template<class _Type , class _Alloc >
CepsBool ceps::insertUnique ( CepsVector< _Type, _Alloc > &  vec,
const _Type &  value 
)

Set behaviour: insert if element does not exist in vector.

Definition at line 129 of file CepsVector.hpp.

◆ insertUnique() [3/3]

template<class _Type , class _Alloc , class InputIt >
void ceps::insertUnique ( CepsVector< _Type, _Alloc > &  vec,
InputIt  first,
InputIt  last 
)

Set behaviour: insert if elements does not exist in vector.

Definition at line 114 of file CepsVector.hpp.

◆ isDebug()

CepsBool ceps::isDebug ( )

Check if we enable the debug on the master proc (always false on slave procs).

Returns
true
false

Definition at line 275 of file CepsFlags.cpp.

◆ isDifferentPtr()

template<typename _Type , typename U >
CepsBool ceps::isDifferentPtr ( _Type *  xptr,
U *  yptr 
)

Tells if two pointers designate two different addresses.

Definition at line 86 of file CepsMemory.hpp.

◆ isLast()

CepsBool ceps::isLast ( )

Is calling process last in computing grid ?

Definition at line 185 of file CepsParallelTools.cpp.

◆ isMaster()

CepsBool ceps::isMaster ( )

Is calling process the master ?

Definition at line 179 of file CepsParallelTools.cpp.

◆ isNullPtr() [1/2]

template<typename _Type >
CepsBool ceps::isNullPtr ( _Type *  ptr)

Tells if passed pointer is null.

Definition at line 45 of file CepsMemory.hpp.

◆ isNullPtr() [2/2]

template<typename _Type >
CepsBool ceps::isNullPtr ( std::shared_ptr< _Type >  ptr)

Tells if passed pointer is null.

Definition at line 53 of file CepsMemory.hpp.

◆ isNumber()

CepsBool ceps::isNumber ( const CepsString s)

Check if the string contains only digit numbers.

Parameters
s
Returns
CepsBool

Definition at line 322 of file CepsString.cpp.

◆ isParallel()

CepsBool ceps::isParallel ( )

Is there more than 1 process currently working ?

Definition at line 191 of file CepsParallelTools.cpp.

◆ isPathInOneWord()

CepsBool ceps::isPathInOneWord ( const CepsString s)

Checks if given path is in one word (it may not exist yet)

Returns
true
false

Definition at line 144 of file CepsString.cpp.

◆ isProfiling()

CepsBool ceps::isProfiling ( )

Check if we are currently profiling on the master proc (always false on slave procs).

Returns
true
false

Definition at line 257 of file CepsFlags.cpp.

◆ isSameFile()

CepsBool ceps::isSameFile ( const CepsString f1,
const CepsString f2 
)

Tells if given paths refer to the same file.

Parameters
f1
f2
Returns
CepsBool

Definition at line 637 of file CepsString.cpp.

◆ isSamePtr()

template<typename _Type , typename U >
CepsBool ceps::isSamePtr ( _Type *  xptr,
U *  yptr 
)

Tells if two pointers designate the same address.

Definition at line 78 of file CepsMemory.hpp.

◆ isValidPtr() [1/2]

template<typename _Type >
CepsBool ceps::isValidPtr ( _Type *  ptr)

Tells if pointer is not null.

Definition at line 61 of file CepsMemory.hpp.

◆ isValidPtr() [2/2]

template<typename _Type >
CepsBool ceps::isValidPtr ( std::shared_ptr< _Type >  ptr)

Tells if pointer is not null.

Definition at line 70 of file CepsMemory.hpp.

◆ isVerbose()

CepsBool ceps::isVerbose ( )

Check if the verbosity is enabled on the master proc (always false on slave procs).

Returns
true
false

Definition at line 263 of file CepsFlags.cpp.

◆ isWarnings()

CepsBool ceps::isWarnings ( )

Check if we enable the warnings on the master proc (always false on slave procs).

Returns
true
false

Definition at line 269 of file CepsFlags.cpp.

◆ join()

CepsString ceps::join ( const CepsVector< CepsString > &  vec,
const CepsChar delimeter = ' ' 
)

Join multiple strings into one.

Parameters
vecthe vector of strings
delimeterdelimiter to use
Returns
CepsString

Definition at line 63 of file CepsString.cpp.

◆ keysOf() [1/2]

template<typename _Key , typename _Tp , typename _Comp , typename _Alloc >
CepsVector<_Key> ceps::keysOf ( const CepsMap< _Key, _Tp, _Comp, _Alloc > &  m)

Get the keys of a map as a vector.

Definition at line 45 of file CepsMap.hpp.

◆ keysOf() [2/2]

template<typename _Key , typename _Tp , typename _Hash , typename _Eq , typename _Alloc >
CepsVector<_Key> ceps::keysOf ( const CepsMultiMap< _Key, _Tp, _Hash, _Eq, _Alloc > &  m)

Get the keys of a map as a vector.

Definition at line 69 of file CepsMap.hpp.

◆ leftRotate()

template<class _Type , class _Alloc >
void ceps::leftRotate ( CepsVector< _Type, _Alloc > &  vec,
CepsUInt  n = 1 
)

Rotate n times the whole vector to the left.

Definition at line 338 of file CepsVector.hpp.

◆ lesserThan()

CepsBool ceps::lesserThan ( CepsReal  a,
CepsReal  b,
CepsReal  epsilon = FLOATING_POINT_EPSILON 
)
inline

Lesser than comparison with epsilon tolerance.

Parameters
aCepsReal to compare
bCepsReal to compare
epsilonmaximum tolerance admitted
Returns
true if a < b with epsilon tolerance

Definition at line 111 of file Precision.hpp.

◆ linearRegression()

void ceps::linearRegression ( std::vector< CepsReal > &  xs,
std::vector< CepsReal > &  fs,
CepsReal a,
CepsReal b 
)

Performs a linear regression with least squares, put results in a and b coefficients.

Parameters
xssamples positions
fssamples values
aresult slope
bresult vertical shift

Definition at line 34 of file LeastSquares.cpp.

◆ max() [1/2]

template<class _Type , class _Alloc >
_Type& ceps::max ( CepsVector< _Type, _Alloc > &  vec)

Returns the maximum of the vector.

Definition at line 472 of file CepsVector.hpp.

◆ max() [2/2]

template<class _Type , class _Alloc >
const _Type& ceps::max ( const CepsVector< _Type, _Alloc > &  vec)

Returns the maximum of the vector, const version.

Definition at line 464 of file CepsVector.hpp.

◆ min() [1/2]

template<class _Type , class _Alloc >
_Type& ceps::min ( CepsVector< _Type, _Alloc > &  vec)

Returns the minimum of the vector.

Definition at line 456 of file CepsVector.hpp.

◆ min() [2/2]

template<class _Type , class _Alloc >
const _Type& ceps::min ( const CepsVector< _Type, _Alloc > &  vec)

Returns the minimum of the vector, const version.

Definition at line 448 of file CepsVector.hpp.

◆ newArray()

template<typename _Type >
_Type* ceps::newArray ( long unsigned int  n,
_Type  fill = _Type() 
)

Creates a C-array with optional init value.

Definition at line 183 of file CepsMemory.hpp.

◆ newCopyArray()

template<typename _Type >
_Type* ceps::newCopyArray ( _Type *  src,
long unsigned int  n 
)

Generates a C-style copy of a C-style array.

Definition at line 197 of file CepsMemory.hpp.

◆ newFunction() [1/2]

template<class _Class , class _Res , class... _Args>
auto ceps::newFunction ( _Class *  obj,
_Res(_Class::*)(_Args...)  fn 
)
inlinenoexcept

Transforms a member function of class into a MemberFunction struct, version with a pointer to th class.

Definition at line 236 of file CepsFunction.hpp.

◆ newFunction() [2/2]

template<class _Class , class _Res , class... _Args>
auto ceps::newFunction ( _Class  obj,
_Res(_Class::*)(_Args...)  fn 
)
inlinenoexcept

Transforms a member function of class into a MemberFunction struct.

Definition at line 227 of file CepsFunction.hpp.

◆ popFront()

template<typename _Type >
void ceps::popFront ( CepsVector< _Type > &  vec)

Remove first element.

Definition at line 592 of file CepsVector.hpp.

◆ profilingLog()

std::ofstream & ceps::profilingLog ( )

Get the ProfilingLog used in Ceps.

Returns
std::ofstream&

Definition at line 251 of file CepsFlags.cpp.

◆ pushBack()

template<class _Type , class _Alloc , class InputIt >
void ceps::pushBack ( CepsVector< _Type, _Alloc > &  vec,
InputIt  first,
InputIt  last 
)

Classic push back for several elements.

Definition at line 74 of file CepsVector.hpp.

◆ readInt()

CepsInt ceps::readInt ( std::istream &  file,
const CepsString errorMessage = "" 
)

Reads an integral number from an istream, aborts if conversion fails advances the stream by 1 word.

Definition at line 677 of file CepsString.cpp.

◆ readParams()

CepsString ceps::readParams ( const CepsVector< CepsString > &  scope,
const CepsString tag,
const CepsString def = "",
const CepsUInt pad = 1 
)

Read parameters into a map.

Parameters
scopescope key
tagtag key
defdefault value
padpad into argument
Returns
CepsString

Definition at line 496 of file CepsString.cpp.

◆ readReal()

CepsReal ceps::readReal ( std::istream &  file,
const CepsString errorMessage = "" 
)

Reads a floating point number from an istream, aborts if conversion fails advances the stream by 1 word.

Definition at line 661 of file CepsString.cpp.

◆ readReals()

template<CepsUInt n>
CepsArray< CepsMathScalar, n > ceps::readReals ( std::istream &  file,
const CepsString errorMessage = "" 
)

Reads n floating point numbers from an istream, aborts if conversion fails.

Definition at line 481 of file CepsString.hpp.

◆ readTensor()

CepsMathTensor ceps::readTensor ( std::istream &  file,
const CepsString errorMessage = "" 
)

Reads 9 floating point numbers from an istream, aborts if conversion fails advances the stream by 9 words.

Definition at line 704 of file CepsString.cpp.

◆ readVertex()

CepsReal3D ceps::readVertex ( std::istream &  file,
const CepsString errorMessage = "" 
)

Reads an integral number from an istream, aborts if conversion fails advances the stream by 1 word.

Definition at line 693 of file CepsString.cpp.

◆ removeDoubleSlashes()

CepsString ceps::removeDoubleSlashes ( const CepsString path)

Replaces double slashes in a string with a single slash. Used for clean paths.

Definition at line 510 of file CepsString.cpp.

◆ removeSpaces()

CepsString ceps::removeSpaces ( const CepsString s)

Removes spaces and tabs.

Returns
CepsString&

Definition at line 87 of file CepsString.cpp.

◆ rightRotate()

template<class _Type , class _Alloc >
void ceps::rightRotate ( CepsVector< _Type, _Alloc > &  vec,
CepsUInt  n = 1 
)

Rotate n times the whole vector to the right.

Definition at line 329 of file CepsVector.hpp.

◆ runtimeCast()

template<typename _Derived , class _Base >
_Derived ceps::runtimeCast ( _Base  x)

Perform a runtime cast between base type and derived type if we can.

Definition at line 94 of file CepsMemory.hpp.

◆ sendMap()

template<typename _Key , typename _Val , template< typename, typename > typename _Container>
int ceps::sendMap ( const CepsUInt sender,
const CepsUInt receiver,
_Container< _Key, _Val > &  table,
const CepsUInt nComms = 1,
const CepsUInt commId = 1 
)

send a map or mutlimap from a cpu to another

Parameters
[in]senderrank of sender cpu
[in]receiverrank of sender cpu
[in]tablehashtable to share
[in]nCommsexpected number of simultaneous calls to this function, used to define tag
[in]commIdId-th/nComms communication
Returns
MPI_SUCCES if success

Definition at line 185 of file CepsContainerCommunication.hpp.

◆ sendRecvWithMatrix()

template<typename T >
void ceps::sendRecvWithMatrix ( const Eigen::Matrix< CepsUInt, Eigen::Dynamic, Eigen::Dynamic > &  commMat,
CepsVector< CepsVector< T >> &  sendBuffers,
CepsVector< CepsVector< T >> &  recvBuffers 
)

Pair to pair communication (using matrix)

Parameters
[in]commMatcommMat(i,j) indicate the size of the vector to send from process i to process j
[in]sendBuffersvector of vector of buffers to send
[out]recvBuffersvector of vector FIXME find the size limit of communications. ~5M uint_ts on mac OS CI machine

Definition at line 243 of file CepsContainerCommunication.hpp.

◆ setIntersectionIndices()

template<typename _Input1 , typename _Input2 >
void ceps::setIntersectionIndices ( _Input1  first1,
_Input1  last1,
_Input2  first2,
_Input2  last2,
CepsVector< CepsUInt > &  indices1,
CepsVector< CepsUInt > &  indices2 
)

Returns the indices in two containers of the elements that are present in both containers.

Template Parameters
_Input1iterators of a vector, set, etc
_Input2iterators of a vector, set, etc
Parameters
first1where to begin in container 1
last1where to end in container 1
first2where to begin in container 2
last2where to end in container 2
indices1indices of common elements in container 1
indices2indices of common elements in container 2

Definition at line 522 of file CepsVector.hpp.

◆ sort() [1/2]

template<class _Type , class _Alloc >
void ceps::sort ( CepsVector< _Type, _Alloc > &  vec)

Basic sorting of whole vector, increasing values.

Definition at line 243 of file CepsVector.hpp.

◆ sort() [2/2]

template<class _Type , class _Alloc , typename _Compare >
void ceps::sort ( CepsVector< _Type, _Alloc > &  vec,
_Compare  compare 
)

Sort whole vector with specified comparator.

Definition at line 234 of file CepsVector.hpp.

◆ split() [1/3]

CepsMap< CepsString, CepsVector< CepsString > > ceps::split ( const CepsMap< CepsString, CepsString > &  map,
const CepsString delimiters = CepsString (" \t") 
)

Apply split function on all string stored.

Definition at line 44 of file CepsString.cpp.

◆ split() [2/3]

CepsVector< CepsString > ceps::split ( const CepsString s,
const CepsString delimiters = CepsString (" \t") 
)

Splits a string using mulitple delimiters in a single string.

Warning: this does not consider the whole argument as being a separator, but each of its character to act as one. Each created substring will be trimmed from white spaces. Beginning and trailing empty fields are still added to the result vector. Example: split(" ,: far ,,boo:,",",:") will return the vector with strings "","","far","","boo","",""

Parameters
sstring to parse
delimitersdelimiters to use
Returns
CepsVector<CepsString>

Definition at line 38 of file CepsString.cpp.

◆ split() [3/3]

CepsVector< CepsVector< CepsString > > ceps::split ( const CepsVector< CepsString > &  vec,
const CepsString delimiters = CepsString (" \t") 
)

Apply split function on all string stored.

Definition at line 53 of file CepsString.cpp.

◆ splitAtNthDelimiter()

CepsVector< CepsString > ceps::splitAtNthDelimiter ( const CepsString s,
CepsUInt  n,
CepsString  delimiters = CepsString (" \t") 
)

Split a string a the n-th delimeter. This ignores the doubled delimiter (eg multiple spaces count as one)

Parameters
sthe considered string
nwhere to split
delimitersall delimeters
Returns
CepsVector<CepsString> a vector of size 2

Definition at line 419 of file CepsString.cpp.

◆ splitByKeyword()

CepsMap< CepsString, CepsVector< CepsString > > ceps::splitByKeyword ( const CepsString s,
const CepsSet< CepsString > &  tags 
)

Extract parameters in the CepsString given by tags. Builds a map of keywords and parameter words according to tags. If splitted string s is "FOO 1 2 BAR toto" extractParam(vec,{"FOO","BAR"}) returns {"BAR":"toto","FOO":"1 2"}.

Parameters
sstring to parse
tagskeywords
Returns
CepsMap<CepsString, CepsVector<CepsString>>

Definition at line 384 of file CepsString.cpp.

◆ splitUntilNthDelimiter()

CepsVector< CepsString > ceps::splitUntilNthDelimiter ( const CepsString s,
const CepsUInt n,
CepsString  delimiters = CepsString (" \t") 
)

Split a string for the first n delimeters.

Parameters
sthe considered string
nsplit action count
delimitersall delimeters
Returns
CepsVector<CepsString>

Definition at line 441 of file CepsString.cpp.

◆ startsWith()

CepsBool ceps::startsWith ( const CepsString s,
const CepsString comp 
)

Check if the string 'str' starts with 'comp'.

Parameters
sstring to parse
compstart string
Returns
true
false

Definition at line 342 of file CepsString.cpp.

◆ startsWithOneOf()

CepsBool ceps::startsWithOneOf ( const CepsString s,
const CepsVector< CepsString > &  comps 
)

Check if the string 'str' starts with one of 'comps'.

Parameters
sstring to parse
compsstart strings
Returns
true
false

Definition at line 353 of file CepsString.cpp.

◆ substract() [1/2]

CepsString ceps::substract ( const CepsString s,
const CepsString toErase 
)

Substract all occurences of another CepsString.

Parameters
sbase string considered
toErasestring to erase
Returns
CepsString the string after erasure

Definition at line 95 of file CepsString.cpp.

◆ substract() [2/2]

CepsString ceps::substract ( const CepsString s,
const CepsVector< CepsString > &  toErase 
)

Substract all occurences of different CepsString.

Parameters
sbase string considered
toErasevector of strings to erase
Returns
CepsString the string after erasure

Definition at line 108 of file CepsString.cpp.

◆ toBool()

CepsBool ceps::toBool ( const CepsString s)

Cast CepsString to CepsBool.

Returns
true
false

Definition at line 186 of file CepsString.cpp.

◆ toInt()

CepsInt ceps::toInt ( const CepsString s)

Cast CepsString to CepsInt.

Returns
CepsInt

Definition at line 270 of file CepsString.cpp.

◆ toIntegral()

template<typename _Enum >
constexpr auto ceps::toIntegral ( _Enum  e) -> typename std::underlying_type<_Enum>::type
constexpr

Converts an enum type variable to an integer.

Template Parameters
_Enum
Parameters
e
Returns

Definition at line 42 of file CepsEnums.hpp.

◆ toInts()

CepsSet< CepsInt > ceps::toInts ( const CepsString s)

Cast CepsString to a set of CepsInt.

Returns
CepsInt

Definition at line 284 of file CepsString.cpp.

◆ toKey() [1/2]

CepsString ceps::toKey ( const CepsString s)

Transform to key type a std::string, upper case and no spaces.

Returns
CepsString&

Definition at line 157 of file CepsString.cpp.

◆ toKey() [2/2]

CepsVector< CepsString > ceps::toKey ( const CepsVector< CepsString > &  vec)

Transform to key type a vector of std::string, upper case and no spaces.

Returns
CepsString&

Definition at line 168 of file CepsString.cpp.

◆ toKeyInPlace()

void ceps::toKeyInPlace ( CepsVector< CepsString > &  vec)

Transform to key type a vector of std::string, upper case and no spaces.

Definition at line 178 of file CepsString.cpp.

◆ toLower()

CepsString ceps::toLower ( const CepsString s)

Switches all characters to lower case.

Returns
CepsString&

Definition at line 134 of file CepsString.cpp.

◆ toMathScalar()

CepsMathScalar ceps::toMathScalar ( const CepsVector< CepsString > &  vec)

Cast a CepsVector of CepsString to CepsMathScalar same effect as ceps::toReal(vec[0])

Returns
CepsMathScalar

Definition at line 219 of file CepsString.cpp.

◆ toMathTensor()

CepsMathTensor ceps::toMathTensor ( const CepsVector< CepsString > &  vec)

Cast a CepsVector of CepsString to CepsMathTensor.

If vector is of size 1 : returns Identity*scalar 3 : returns diag(vec) 6 : returns symmetric tensor v[0] v[1] v[2], v[1] v[3] v[4], v[2] v[4] v[5] 9 : returns tensor with 9 coeffs set line per line

Returns
CepsMathTensor

Definition at line 237 of file CepsString.cpp.

◆ toMathVertex()

CepsMathVertex ceps::toMathVertex ( const CepsVector< CepsString > &  vec)

Cast a CepsVector of CepsString to CepsMathVertex.

Returns
CepsMathVertex

Definition at line 227 of file CepsString.cpp.

◆ toReal()

CepsReal ceps::toReal ( const CepsString s)

Cast CepsString to CepsReal.

Returns
CepsReal

Definition at line 193 of file CepsString.cpp.

◆ toReals()

CepsSet< CepsReal > ceps::toReals ( const CepsString s)

Cast CepsString to a set of CepsReal.

Returns
CepsReal

Definition at line 207 of file CepsString.cpp.

◆ toString()

template<typename _Tp >
CepsString ceps::toString ( _Tp  value)

Convert a given value to a string (input has to be compatible with std::to_string)

Returns
CepsString

Definition at line 409 of file CepsString.hpp.

◆ toUInt()

CepsUInt ceps::toUInt ( const CepsString s)

Cast CepsString to CepsUInt.

Returns
CepsUInt

Definition at line 296 of file CepsString.cpp.

◆ toUInts()

CepsSet< CepsUInt > ceps::toUInts ( const CepsString s)

Cast CepsString to a set of CepsUInt.

Returns
CepsUInt

Definition at line 310 of file CepsString.cpp.

◆ toUpper()

CepsString ceps::toUpper ( const CepsString s)

Switches all characters to upper case.

Returns
CepsString&

Definition at line 124 of file CepsString.cpp.

◆ trim()

CepsString ceps::trim ( const CepsString s)

Removes trailing and preceeding spaces.

Returns
CepsString&

Definition at line 78 of file CepsString.cpp.

◆ valuesOf() [1/2]

template<typename _Key , typename _Tp , typename _Comp , typename _Alloc >
CepsVector<_Tp> ceps::valuesOf ( const CepsMap< _Key, _Tp, _Comp, _Alloc > &  m)

Get the values of a map as a vector.

Definition at line 57 of file CepsMap.hpp.

◆ valuesOf() [2/2]

template<typename _Key , typename _Tp , typename _Hash , typename _Eq , typename _Alloc >
CepsVector<_Tp> ceps::valuesOf ( const CepsMultiMap< _Key, _Tp, _Hash, _Eq, _Alloc > &  m)

Get the values of a map as a vector.

Definition at line 81 of file CepsMap.hpp.