C++ mpi module for stochmagnet_main Package
Public Member Functions | Static Public Member Functions | List of all members
OMP_PtrField< T, K, D > Class Template Reference

this class describes a standart arithmetic array type implemented with a std::valarray object More...

#include <OMP_PtrField.h>

Inheritance diagram for OMP_PtrField< T, K, D >:
Inheritance graph
[legend]
Collaboration diagram for OMP_PtrField< T, K, D >:
Collaboration graph
[legend]

Public Member Functions

 OMP_PtrField ()
 build an array of T*
 
virtual ~OMP_PtrField ()
 destroy an array of T*
 
virtual tMemSize getMemorySize () const override
 return the memory size of the class More...
 
Selfoperator= (const T &v)
 fill the values of the array with v More...
 
Selfoperator= (const std::initializer_list< T > &values)
 build an array by a copy of values More...
 
Selfoperator= (std::initializer_list< T > &&values)
 build an array by a copy of values More...
 
template<size_t N, typename Q >
Selfoperator= (const std::array< Q, N > &values)
 build an array by a copy of values More...
 
template<typename Q >
Selfoperator= (const std::valarray< Q > &values)
 build an array by a copy of values More...
 
template<typename Q >
Selfoperator= (const std::vector< Q > &values)
 build an array by a copy of values More...
 
Selfoperator= (const Self &values)
 build an array by a copy of values More...
 
Selfoperator= (Self &&values)
 build an array by a copy of values More...
 
template<typename Q , class S1 , class I1 >
Selfoperator= (const CORE_Field< Q, K, D, S1, I1 > &values)
 build an array by a copy of values More...
 
template<typename Q , class S1 , class I1 >
Selfoperator= (CORE_Field< Q, K, D, S1, I1 > &&values)
 build an array by a copy of c More...
 
void initialize (const T &a)
 copy at element elemnt the array of size D More...
 
template<typename Q >
void initialize (const std::initializer_list< Q > &&a)
 copy at element elemnt the array of size D More...
 
template<typename Q >
void initialize (const std::initializer_list< Q > &a)
 copy at element elemnt the array of size D More...
 
template<typename Q >
void initialize (const std::array< Q, D > &a)
 copy at element elemnt the array of size D More...
 
Selfoperator+= (const T &v)
 add operator More...
 
Selfoperator-= (const T &v)
 sub operator More...
 
Selfoperator*= (const T &v)
 multiplicator operator More...
 
Selfoperator/= (const T &v)
 divisor operator More...
 
Selfoperator%= (const T &v) requires functions_type
 modulo operator More...
 
template<class Q , class S , class I >
Selfoperator-= (const CORE_Field< Q, K, D, S, I > &X)
 array sub operator More...
 
template<class Q , class S , class I >
Selfoperator*= (const CORE_Field< Q, K, D, S, I > &X)
 array multiply operator More...
 
template<class Q , class S , class I >
Selfoperator/= (const CORE_Field< Q, K, D, S, I > &X)
 array divisor operator More...
 
template<typename LambdaFct >
void elementsTransform (LambdaFct &&F)
 apply the transform element with the lambda function Xid = F(Xid) More...
 
void normalize ()
 normalize all the elements of the field return false if the method is not compatible with the floating point type
 
template<class I >
void mod2 (CORE_Array< T, I > &X) const
 return the norm2 array per each element More...
 
template<class Q , class S1 , class I1 >
T & scalarProduct (const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
 return the weight scalar product More...
 
template<class Q , class S1 , class I1 >
T & scalarProduct (const std::valarray< Q > &weights, const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
 return the weight scalar product More...
 
- Public Member Functions inherited from CORE_Field< T, K, D, OMP_PtrArray< T >, OMP_PtrField< T, K, D > >
virtual tMemSize getContentsMemorySize () const override
 return the memory size of the included associations More...
 
void setElementsNumber (const tInteger &n)
 set the number of element of the container More...
 
void fitToElementsNumber (const tInteger &n)
 set the number of element of the container without erasing values More...
 
tIndex getElementsNumber () const
 return the number values of the container More...
 
void setSize (const tIndex &n)
 set the number of values of the container More...
 
void resize (const tIndex &n)
 set the number of values of the container More...
 
tIndex getSize () const
 return the number values of the container More...
 
getDimension () const
 get the dimension of the field More...
 
const T & operator[] (const tIndex &i) const
 get the i-th value for reading. More...
 
T & operator[] (const tIndex &i)
 get the i-th value for writting. More...
 
const T & operator() (const tInteger &i, const K &d) const
 get the i-th element for reading. Do not verify the bounds More...
 
T & operator() (const tInteger &i, const K d)
 get the i-th element for writting. Do not verify the bounds More...
 
const T * operator() (const tInteger &i) const
 get the i-th element for reading. Do not verify the bounds More...
 
T * operator() (const tInteger &i)
 get the i-th element for writting. Do not verify the bounds More...
 
constexpr auto cbegin () const
 return begin iterator for reading More...
 
constexpr auto cend () const
 return end iterator for reading More...
 
auto begin ()
 return begin iterator for writing More...
 
auto end ()
 return end iterator for writing More...
 
auto rbegin ()
 return reverse begin iterator for writing More...
 
auto rend ()
 return reverse end iterator for writing More...
 
constexpr auto crbegin () const
 return reverse begin iterator for reading More...
 
constexpr auto crend () const
 return reverse end iterator for reading More...
 
auto sbegin ()
 return begin stride iterator for writing More...
 
auto send ()
 return end N-stride iterator for writing More...
 
constexpr auto csbegin () const
 return begin N-stride const iterator for writing More...
 
constexpr auto csend () const
 return end N-stride const iterator for writing More...
 
const T & get (const tIndex &i, const K &d) const
 get the d-th coordinate of the i-th element for reading More...
 
T & get (const tIndex &i, const K &d)
 get the d-th coordinate of the i-th element for writting More...
 
const T * getValues () const
 get the values of the array for reading More...
 
T * getValues ()
 get the values of the array More...
 
const OMP_PtrArray< T > & getStorage () const
 get the storage More...
 
OMP_PtrArray< T > & getStorage ()
 get the storage More...
 
Selfoperator= (const T &v)
 fill the values of the field with v More...
 
Selfoperator= (const std::initializer_list< T > &values)
 build an field by a copy of c More...
 
Selfoperator= (std::initializer_list< T > &&values)
 build an field by a copy of c More...
 
Selfoperator= (const std::array< Q, N > &values)
 build an field by a copy of c More...
 
Selfoperator= (const std::array< Q, D > &values)
 build an field by a copy of c More...
 
Selfoperator= (const std::valarray< Q > &values)
 build an field by a copy of c More...
 
Selfoperator= (const std::vector< Q > &values)
 build an field by a copy of c More...
 
Selfoperator= (const Self &cpy)
 build a field by a copy of cpy More...
 
Selfoperator= (Self &&cpy)
 build an field by a copy of cpy More...
 
Selfoperator= (const CORE_Field< Q, K, D, S1, I1 > &cpy)
 build a field by a copy of cpy More...
 
Selfoperator= (CORE_Field< Q, K, D, S1, I1 > &&cpy)
 build an field by a copy of cpy More...
 
void copy (const tIndex &n, const Q *vs)
 initialize the field to the values of pointer of size n More...
 
void copy (const std::array< Q, N > &vs)
 initialize the field at eche element with Vs More...
 
void copy (const std::array< Q, D > &vs)
 initialize the field to the values of array of size D More...
 
void copy (const std::valarray< Q > &vs)
 initialize the field to the values of val array More...
 
void copy (std::valarray< Q > &&vs)
 initialize the field to the values of val array More...
 
void copy (const std::vector< Q > &vs)
 initialize the field to the values of vector More...
 
void copy (const std::initializer_list< T > &vs)
 initialize the field to the values of list More...
 
void copy (std::initializer_list< T > &&vs)
 initialize the field to the values of list More...
 
void copy (const CORE_Field< Q, K, D, S1, I1 > &cpy)
 copy the the field More...
 
void copy (CORE_Field< Q, K, D, S1, I1 > &&cpy)
 copy the field : mv is destroyed after this More...
 
void initialize (const T &v)
 initialize the field to v More...
 
void initialize (const std::array< Q, D > &vs)
 initialize the field to the values of array of size D More...
 
void setUniformRandomizeSeed (const tULLInt &seed)
 set the uniform randomize seed More...
 
void setUniformRandomizeSeed ()
 set the uniform randomize seed
 
void uniformRandomize (const T &min, const T &max)
 randomize the field More...
 
Selfoperator+= (const T &v)
 add operator More...
 
Selfoperator-= (const T &v)
 sub operator More...
 
Selfoperator-= (const CORE_Field< T1, K, D, S1, I1 > &v)
 array sub operator More...
 
Selfoperator*= (const T &v)
 multiplicator operator More...
 
Selfoperator*= (const CORE_Field< T1, K, D, S1, I1 > &v)
 array multiply operator More...
 
Selfoperator/= (const T &v)
 divisor operator More...
 
Selfoperator/= (const CORE_Field< T1, K, D, S1, I1 > &v)
 array divisor operator More...
 
Selfoperator%= (const T &v) requires functions_type
 modulo operator More...
 
void transform (LambdaFct &&F)
 transform the transform element with the lambda function Ti = F(Ti) More...
 
void transform (LambdaFct &&F, const Self &X)
 transform the transform element with the lambda function Ti = F(Xi) More...
 
void transform (LambdaFct &&F, const Self &X, const Self &Y)
 transform the transform element with the lambda function Ti = F(Xi,Yi) More...
 
void elementsTransform (LambdaFct &&F)
 apply the transform element with the lambda function Xid = F(Xid) More...
 
void swap (CORE_Array< T, OMP_PtrField< T, K, D > > &a)
 swap the contents of the array More...
 
void swap (CORE_Field< T, K, D, OMP_PtrArray< T >, OMP_PtrField< T, K, D > > &a)
 swap the contents of the array More...
 
void normalize ()
 normalize all the elements of the field return false if the method is not compatible with the floating point type
 
void axpy (const Q &alpha, const CORE_Field< Q, K, D, S1, I1 > &X, const T &beta)
 compute This=beta.This+ alpha .X More...
 
tBoolean isNANContained () const
 return true if one value is Not A Number More...
 
void mod2 (CORE_Array< T, I1 > &X) const
 return the norm2 array per each element More...
 
tReal linfNorm (tIndex &i) const
 compute the L infinity norm More...
 
tReal linfDistance (const CORE_Field< Q, K, D, OMP_PtrArray< T >, I1 > &X, tIndex &i) const
 compute the Linfinitty norm More...
 
void sum (T &s) const
 return the sum of all the elements More...
 
void prod (T &p) const
 return the produc of all the elements More...
 
T & scalarProduct (const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
 return the scalar product More...
 
T & scalarProduct (const std::valarray< Q > &weights, const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
 return the scalar product More...
 
void min (T &m) const requires functions_type
 return the min value of all the elements More...
 
tBoolean loadFromFile (const tString &filename, tString &comment, tInt &retCode)
 load the field from a txt file with the format : More...
 
virtual tString toString () const override
 return the string representation of the object node More...
 
- Public Member Functions inherited from CORE_Collection< T, I >
void setSize (const tIndex &n)
 set the size of the container More...
 
tIndex getSize () const
 return the size of the container More...
 
void resize (const tIndex &n)
 modify the size of the array and keep its old values
 
const T & operator[] (const tIndex &i) const
 get the i-th element for reading. Do not verify the bounds More...
 
T & operator[] (const tIndex &i)
 get the i-th element for writting. Do not verify the bounds More...
 
constexpr auto cbegin () const
 return begin iterator for reading More...
 
constexpr auto cend () const
 return end iterator for reading More...
 
auto begin ()
 return begin iterator for writing More...
 
auto end ()
 return end iterator for writing More...
 
auto rbegin ()
 return reverse begin iterator for writing More...
 
auto rend ()
 return reverse end iterator for writing More...
 
constexpr auto crbegin () const
 return reverse begin iterator for reading More...
 
constexpr auto crend () const
 return reverse end iterator for reading More...
 
template<typename LambdaFct >
void transform (LambdaFct &&F)
 transform the transform element with the lambda function Ti = F(Ti) More...
 
tString getDataTypeName () const
 get the type of data More...
 
- Public Member Functions inherited from CORE_Object
template<class T >
std::shared_ptr< T > getSharedPointer ()
 return the shared pointer for this More...
 
template<class T >
std::shared_ptr< const T > getConstSharedPointer () const
 return a const shared pointer for this More...
 
template<class T >
tBoolean isInstanceOf () const
 test if the clas T is an instance of this class More...
 
tString getClassName () const
 return the name of the class More...
 
tString getPointerString () const
 retrun the pointer of the class as a string More...
 
tString getIdentityString () const
 retrun the string identification of the class More...
 

Static Public Member Functions

static CORE_UniquePointer< SelfNew ()
 return a new unique pointer of this More...
 
template<typename LambdaFct >
static void ElementsTransform (LambdaFct &&F, Self &X)
 apply the transform element with the lambda function Ri = F(Xi) More...
 
- Static Public Member Functions inherited from CORE_Object
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack
 
static void DisableMemoryStack ()
 disable the memory stack
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Additional Inherited Members

- Protected Member Functions inherited from CORE_Field< T, K, D, OMP_PtrArray< T >, OMP_PtrField< T, K, D > >
 CORE_Field ()
 instanciation method of a class
 
virtual ~CORE_Field ()
 destroy an instance of class
 
- Protected Member Functions inherited from CORE_Collection< T, I >
 CORE_Collection ()
 build an array of T*
 
virtual ~CORE_Collection ()
 destroy an array of T*
 
- Protected Member Functions inherited from CORE_Object
 CORE_Object ()
 build an instance of the object
 
virtual ~CORE_Object ()
 destroy the instance of object std

 

Detailed Description

template<typename T, typename K, K D>
class OMP_PtrField< T, K, D >

this class describes a standart arithmetic array type implemented with a std::valarray object

Template Parameters
T: type of elements
K: type of dimension
D: dimension value

Member Function Documentation

◆ elementsTransform()

template<typename T , typename K , K D>
template<typename LambdaFct >
void OMP_PtrField< T, K, D >::elementsTransform ( LambdaFct &&  F)
inline

apply the transform element with the lambda function Xid = F(Xid)

Template Parameters
LambdaFct: lambda function definition
Parameters
[in]F: lambda function with one variable

◆ ElementsTransform()

template<typename T , typename K , K D>
template<typename LambdaFct >
static void OMP_PtrField< T, K, D >::ElementsTransform ( LambdaFct &&  F,
Self X 
)
inlinestatic

apply the transform element with the lambda function Ri = F(Xi)

Template Parameters
LambdaFct: lambda function definition
Parameters
[in]F: lambda function with one variable
[in,out]X: argument of F

◆ getMemorySize()

template<typename T , typename K , K D>
virtual tMemSize OMP_PtrField< T, K, D >::getMemorySize ( ) const
inlineoverridevirtual

return the memory size of the class

Returns
the memory size of the class in bytes 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from CORE_Field< T, K, D, OMP_PtrArray< T >, OMP_PtrField< T, K, D > >.

◆ initialize() [1/4]

template<typename T , typename K , K D>
template<typename Q >
void OMP_PtrField< T, K, D >::initialize ( const std::array< Q, D > &  a)
inline

copy at element elemnt the array of size D

Template Parameters
Qtype of values
Parameters
[in]a: values of the element

◆ initialize() [2/4]

template<typename T , typename K , K D>
template<typename Q >
void OMP_PtrField< T, K, D >::initialize ( const std::initializer_list< Q > &&  a)
inline

copy at element elemnt the array of size D

Template Parameters
Qtype of values
Parameters
[in]a: values of the element

◆ initialize() [3/4]

template<typename T , typename K , K D>
template<typename Q >
void OMP_PtrField< T, K, D >::initialize ( const std::initializer_list< Q > &  a)
inline

copy at element elemnt the array of size D

Template Parameters
Qtype of values
Parameters
[in]a: values of the element

◆ initialize() [4/4]

template<typename T , typename K , K D>
void OMP_PtrField< T, K, D >::initialize ( const T &  a)
inline

copy at element elemnt the array of size D

Parameters
[in]a: values of the element

◆ mod2()

template<typename T , typename K , K D>
template<class I >
void OMP_PtrField< T, K, D >::mod2 ( CORE_Array< T, I > &  X) const
inline

return the norm2 array per each element

Template Parameters
I: implemented class of X
Parameters
[out]X: the vector to make the product X[i]=|Ti|^2

◆ New()

template<typename T , typename K , K D>
static CORE_UniquePointer<Self> OMP_PtrField< T, K, D >::New ( )
inlinestatic

return a new unique pointer of this

Returns
an unqie pointer of this class

◆ operator%=()

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator%= ( const T &  v)
inline

modulo operator

Parameters
[in]vmodulo value

and operator

Parameters
[in]vand value

or operator

Parameters
[in]vand value

complementary operator

Parameters
[in]vcomplementary value

left shift operator

Parameters
[in]vleft shift value

right shift operator

Parameters
[in]vleft shift value

array add operator

Template Parameters
Qtype of X
Sstorage type of X
Iimplemented class of X
Parameters
[in]Xfield to multiply

◆ operator*=() [1/2]

template<typename T , typename K , K D>
template<class Q , class S , class I >
Self& OMP_PtrField< T, K, D >::operator*= ( const CORE_Field< Q, K, D, S, I > &  X)
inline

array multiply operator

Template Parameters
Qtype of X
Sstorage type of X
Iimplemented class of X
Parameters
[in]Xfield to multiply

◆ operator*=() [2/2]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator*= ( const T &  v)
inline

multiplicator operator

Parameters
[in]vmultiplicator value

◆ operator+=()

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator+= ( const T &  v)
inline

add operator

Parameters
[in]vadd value

◆ operator-=() [1/2]

template<typename T , typename K , K D>
template<class Q , class S , class I >
Self& OMP_PtrField< T, K, D >::operator-= ( const CORE_Field< Q, K, D, S, I > &  X)
inline

array sub operator

Template Parameters
Qtype of X
Sstorage type of X
Iimplemented class of X
Parameters
[in]Xfield to multiply

◆ operator-=() [2/2]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator-= ( const T &  v)
inline

sub operator

Parameters
[in]vsub value

◆ operator/=() [1/2]

template<typename T , typename K , K D>
template<class Q , class S , class I >
Self& OMP_PtrField< T, K, D >::operator/= ( const CORE_Field< Q, K, D, S, I > &  X)
inline

array divisor operator

Template Parameters
Qtype of X
Sstorage type of X
Iimplemented class of X
Parameters
[in]Xfield to divide

◆ operator/=() [2/2]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator/= ( const T &  v)
inline

divisor operator

Parameters
[in]vdivisor value

◆ operator=() [1/10]

template<typename T , typename K , K D>
template<typename Q , class S1 , class I1 >
Self& OMP_PtrField< T, K, D >::operator= ( const CORE_Field< Q, K, D, S1, I1 > &  values)
inline

build an array by a copy of values

Template Parameters
Qtype of values
S1storage type of values
I1implemented class of values
Parameters
[in]valuesvalues to copy

◆ operator=() [2/10]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator= ( const Self values)
inline

build an array by a copy of values

Parameters
[in]valuesvalues to copy

◆ operator=() [3/10]

template<typename T , typename K , K D>
template<size_t N, typename Q >
Self& OMP_PtrField< T, K, D >::operator= ( const std::array< Q, N > &  values)
inline

build an array by a copy of values

Template Parameters
Nnumber of elements of values
Q: type of values
Parameters
[in]valuesvalues to copy

◆ operator=() [4/10]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator= ( const std::initializer_list< T > &  values)
inline

build an array by a copy of values

Parameters
[in]valuesvalues to copy

◆ operator=() [5/10]

template<typename T , typename K , K D>
template<typename Q >
Self& OMP_PtrField< T, K, D >::operator= ( const std::valarray< Q > &  values)
inline

build an array by a copy of values

Template Parameters
Q: type of values
Parameters
[in]valuesvalues to copy

◆ operator=() [6/10]

template<typename T , typename K , K D>
template<typename Q >
Self& OMP_PtrField< T, K, D >::operator= ( const std::vector< Q > &  values)
inline

build an array by a copy of values

Template Parameters
Q: type of values
Parameters
[in]valuesvalues to copy

◆ operator=() [7/10]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator= ( const T &  v)
inline

fill the values of the array with v

Parameters
[in]v: value to fill

◆ operator=() [8/10]

template<typename T , typename K , K D>
template<typename Q , class S1 , class I1 >
Self& OMP_PtrField< T, K, D >::operator= ( CORE_Field< Q, K, D, S1, I1 > &&  values)
inline

build an array by a copy of c

Template Parameters
Qtype of values
S1storage type of values
I1implemented class of values
Parameters
[in]valuesvalues to copy

◆ operator=() [9/10]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator= ( Self &&  values)
inline

build an array by a copy of values

Parameters
[in]valuesvalues to copy

◆ operator=() [10/10]

template<typename T , typename K , K D>
Self& OMP_PtrField< T, K, D >::operator= ( std::initializer_list< T > &&  values)
inline

build an array by a copy of values

Parameters
[in]valuesvalues to copy

◆ scalarProduct() [1/2]

template<typename T , typename K , K D>
template<class Q , class S1 , class I1 >
T& OMP_PtrField< T, K, D >::scalarProduct ( const CORE_Field< Q, K, D, S1, I1 > &  X,
T &  s 
) const
inline

return the weight scalar product

Template Parameters
Qtype of X
S1storage type of X
I1implemented class of X
Parameters
[in]X: argument field
[out]s: the scalar product as return
Returns
the value of \( <s=T,X>=\sum_{i=0}^{N-1} w_i \sum_{d=0}^{d=D-1} T^i_d.A^i_d \)

◆ scalarProduct() [2/2]

template<typename T , typename K , K D>
template<class Q , class S1 , class I1 >
T& OMP_PtrField< T, K, D >::scalarProduct ( const std::valarray< Q > &  weights,
const CORE_Field< Q, K, D, S1, I1 > &  X,
T &  s 
) const
inline

return the weight scalar product

Template Parameters
Qtype of X
S1storage type of X
I1implemented class of X
Parameters
[in]weights: weight of each element
[in]X: argument field
[out]s: the scalar product
Returns
the value of \( <s=T,X>=\sum_{i=0}^{N-1} w_i \sum_{d=0}^{d=D-1} T^i_d.A^i_d \)

The documentation for this class was generated from the following file: