C++ main module for stochmagnet Package
1.0
|
this class describes an array of values T of dynamical size with algebrical operators and I is an implemented class which implements the following polymorphic methods: More...
#include <CORE_Array.h>
Public Member Functions | |
virtual tMemSize | getMemorySize () const override |
return the memory size of the class and the memory size of all its attributes/associations More... | |
template<int N> | |
auto | sbegin () |
return begin stride iterator for writing More... | |
template<int N> | |
auto | send () |
return end N-stride iterator for writing More... | |
template<int N> | |
constexpr auto | csbegin () const |
return begin N-stride const iterator for writing More... | |
template<int N> | |
constexpr auto | csend () const |
return end N-stride const iterator for writing More... | |
const T & | get (const tIndex &i) const |
get the i-th element for reading More... | |
T & | get (const tIndex &i) |
get 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... | |
Self & | operator= (const T &v) |
fill the values of the array with v More... | |
Self & | operator= (std::initializer_list< T > values) |
build an array by a copy of c More... | |
template<size_t N, typename Q > | |
Self & | operator= (const std::array< Q, N > &values) |
build an array by a copy of c More... | |
template<typename Q > | |
Self & | operator= (const std::valarray< Q > &values) |
build an array by a copy of c More... | |
template<typename Q > | |
Self & | operator= (const std::vector< Q > &values) |
build an array by a copy of c More... | |
template<typename Q , class I1 > | |
Self & | operator= (const CORE_Array< Q, I1 > &cpy) |
build an array by a copy of cpy More... | |
Self & | operator= (const Self &cpy) |
build an array by a copy of cpy More... | |
template<typename Q , class I1 > | |
Self & | operator= (CORE_Array< Q, I1 > &&cpy) |
build an array by a copy of cpy More... | |
Self & | operator= (Self &&cpy) |
build an array by a copy of cpy More... | |
template<typename Q > | |
void | copy (const tIndex &n, const Q *vs) |
initialize the array to the values of pointer of size n More... | |
template<typename Q , size_t N> | |
void | copy (const tIndex &n, const std::array< Q, N > &vs) |
initialize the array to the values of array of size N More... | |
template<typename Q > | |
void | copy (const tIndex &n, const std::valarray< Q > &vs) |
initialize the array to the values of val array More... | |
template<typename Q > | |
void | copy (const tIndex &n, const std::vector< Q > &vs) |
initialize the array to the values of vector More... | |
void | copy (const tIndex &n, const std::initializer_list< T > &vs) |
initialize the array to the values of list More... | |
void | copy (const tIndex &n, std::initializer_list< T > &&vs) |
initialize the array to the values of list More... | |
template<typename Q , class I1 > | |
void | copy (const CORE_Array< Q, I1 > &cpy) |
copy the container More... | |
template<typename Q , class I1 > | |
void | copy (CORE_Array< Q, I1 > &&cpy) |
copy the conatiner : mv is destroyed after this More... | |
void | initialize (const T &v) |
randomize the field More... | |
void | uniformRandomize () |
randomize the field More... | |
void | uniformRandomize (const T &min, const T &max) |
randomize the field More... | |
I & | operator+= (const T &v) |
add operator More... | |
I & | operator-= (const T &v) |
sub operator More... | |
I & | operator*= (const T &v) |
multiplicator operator More... | |
I & | operator/= (const T &v) |
divisor operator More... | |
I & | operator%= (const T &v) requires core_functions |
modulo operator More... | |
template<typename Q , class I1 > | |
I & | operator-= (const CORE_Array< Q, I1 > &v) |
array sub operator More... | |
template<typename Q , class I1 > | |
I & | operator*= (const CORE_Array< Q, I1 > &v) |
array multiply operator More... | |
template<typename Q , class I1 > | |
I & | operator/= (const CORE_Array< Q, I1 > &v) |
array divisor operator More... | |
template<typename LambdaFct > | |
void | transform (LambdaFct &&F) |
transform the transform element with the lambda function Ti = F(Ti) More... | |
template<typename LambdaFct > | |
void | transform (LambdaFct &&F, const Self &X) |
transform the transform element with the lambda function Ti = F(Xi) More... | |
template<typename LambdaFct > | |
void | transform (LambdaFct &&F, const Self &X, const Self &Y) |
transform the transform element with the lambda function Ti = F(Xi,Yi) More... | |
void | swap (Self &a) |
swap the contents of the array More... | |
void | swap (const tIndex &i, const tIndex &j) |
swap the two elements of the array More... | |
void | normalize () |
normalize the array More... | |
template<typename Q , class I1 > | |
void | axpy (const Q &alpha, const CORE_Array< Q, 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 | sum (T &s) const |
Computes the sum of all the elements. More... | |
void | prod (T &p) const |
return the produc of all the elements More... | |
template<typename Q , class I1 > | |
T & | scalarProduct (const CORE_Array< Q, I1 > &X, T &s) const |
return the scalar product More... | |
tReal | l2Norm2 () const |
compute the L2 norm squared More... | |
tReal | l2Norm () const |
compute the L2 norm More... | |
template<typename Q , class I1 > | |
tReal | l2Distance2 (const CORE_Array< Q, I1 > &X) const |
compute the L2 distance squared More... | |
template<typename Q , class I1 > | |
tReal | l2Distance (const CORE_Array< Q, I1 > &X) const |
compute the L2 distance More... | |
tReal | linfNorm (tIndex &i) const |
compute the L infinity norm More... | |
template<typename Q , class I1 > | |
tReal | linfDistance (const CORE_Array< Q, I1 > &X, tIndex &i) const |
compute the Linfinitty norm More... | |
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 More... | |
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... | |
tString | getDataTypeName () const |
get the type of data More... | |
virtual tString | toString () const override |
return the string representation of the object node More... | |
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... | |
virtual tMemSize | getContentsMemorySize () const |
return nthe memory size of the included associations 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 tBoolean | EnableMemoryStack (const tBoolean &isMemoryChecked) |
enable the memory stack More... | |
static void | EnableMemoryStack () |
enable the memory stack More... | |
static void | DisableMemoryStack () |
disable the memory stack More... | |
static tBoolean | IsMemoryStackEnabled () |
return trur if the memory stack is enabled More... | |
static tString | MemoryStackToString () |
get the memory stack in string More... | |
static tIndex | GetRegisteredClassesNumber () |
get the memory stack in string More... | |
Protected Member Functions | |
CORE_Array () | |
instanciation method of a class More... | |
virtual | ~CORE_Array () |
destroy an instance of class More... | |
Private Types | |
typedef CORE_Array< T, I > | Self |
Private Member Functions | |
template<class T > | |
std::shared_ptr< T > | setThis (std::unique_ptr< T, CORE_Object::Delete > &up) |
set the shared pointer from an unique pointer More... | |
Private Attributes | |
std::weak_ptr< CORE_Object > | mThis |
this class describes an array of values T of dynamical size with algebrical operators and I is an implemented class which implements the following polymorphic methods:
|
private |
|
inlineprotected |
instanciation method of a class
|
inlineprotectedvirtual |
destroy an instance of class
|
inline |
compute This=beta.This+ alpha .X
[in] | alpha | alpha parameter |
[in] | X | X array |
(in] | beta : beta parameter |
Referenced by CORE_Test::testArray().
|
inlineinherited |
return begin iterator for writing
Referenced by CORE_StdValArray< T >::AXPY(), CORE_StdValArray< T >::Sum(), CORE_StdPtrArray< T >::Transform(), and CORE_StdValArray< T >::Transform().
|
inlineconstexprinherited |
return begin iterator for reading
Referenced by CORE_StdValArray< T >::AXPY(), CORE_StdValArray< T >::Copy(), CORE_StdValArray< T >::scalarProduct(), CORE_StdValArray< T >::Sum(), CORE_Test::testArray(), CORE_Collection< T, I >::toString(), CORE_StdPtrArray< T >::Transform(), and CORE_StdValArray< T >::Transform().
|
inlineconstexprinherited |
return end iterator for reading
Referenced by CORE_StdValArray< T >::AXPY(), CORE_Test::testArray(), CORE_Collection< T, I >::toString(), CORE_StdPtrArray< T >::Transform(), and CORE_StdValArray< T >::Transform().
|
inline |
copy the container
[in] | cpy | : container to copy |
References CORE_Array< T, I >::copy().
|
inline |
initialize the array to the values of pointer of size n
[in] | n | : size of vs |
[in] | vs | : values of the array |
Referenced by CORE_Array< T, I >::copy(), CORE_Array< T, I >::operator=(), and CORE_Test::testArray().
|
inline |
initialize the array to the values of array of size N
[in] | vs | : values of the array |
References CORE_Array< T, I >::copy().
|
inline |
initialize the array to the values of list
[in] | vs | : values of the array |
References CORE_Array< T, I >::copy().
|
inline |
initialize the array to the values of val array
[in] | vs | : values of the array |
References CORE_Array< T, I >::copy().
|
inline |
initialize the array to the values of vector
[in] | vs | : values of the array |
References CORE_Array< T, I >::copy().
|
inline |
initialize the array to the values of list
[in] | vs | : values of the array |
References CORE_Array< T, I >::copy().
|
inline |
copy the conatiner : mv is destroyed after this
[in] | cpy | :container to move |
|
inlineconstexprinherited |
return reverse begin iterator for reading
|
inlineconstexprinherited |
return reverse end iterator for reading
|
inlineconstexpr |
return begin N-stride const iterator for writing
|
inlineconstexpr |
return end N-stride const iterator for writing
References CORE_Collection< T, I >::getSize().
|
inlinestaticinherited |
disable the memory stack
Referenced by CORE_Object::EnableMemoryStack().
|
inlinestaticinherited |
enable the memory stack
Referenced by CORE_Object::EnableMemoryStack(), and CORE_Run::SetDebugOptions().
|
inlinestaticinherited |
enable the memory stack
[in] | isMemoryChecked | : true to verify memory allocation of CORE_Object classes |
References CORE_Object::DisableMemoryStack(), CORE_Object::EnableMemoryStack(), and CORE_Object::IsMemoryStackEnabled().
|
inlineinherited |
return end iterator for writing
Referenced by CORE_StdValArray< T >::Sum().
|
inline |
get the i-th element for writting
[in] | i | index of the element |
|
inline |
get the i-th element for reading
[in] | i | index of the element |
Referenced by CORE_Test::testArray().
|
inlineinherited |
return the name of the class
Referenced by CORE_Object::getIdentityString(), and CORE_Test::testTypes().
|
inlineinherited |
return a const shared pointer for this
References CORE_Object::mThis.
|
inlinevirtualinherited |
return nthe memory size of the included associations
Reimplemented in CORE_VectorList< T, I >, CORE_VectorList< tString, CORE_StringsList >, CORE_ValArray< T, I >, CORE_ValArray< T, CORE_StdValArray< T > >, CORE_Run, CORE_PtrArray< T, I >, CORE_PtrArray< T, CORE_StdPtrArray< T > >, CORE_Field< T, K, D, S, I >, CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >, CORE_Field< T, K, D, CORE_StdValArray< T >, CORE_StdValField< T, K, D > >, CORE_ClassFactory, SMS_STDUniformFunction, SMS_STDNormalFunction, SMS_BoostUniformFunction, SMS_BoostNormalFunction, SM_ZeemanOperator, SM_XDMF, SM_VTK, SM_System, SM_Output, SM_Operator, SM_Network, SM_DemagnetizedOperator, SM_Beam, CORE_StringsList, and CORE_Out.
Referenced by CORE_Out::getContentsMemorySize(), SM_Beam::getContentsMemorySize(), SM_Network::getContentsMemorySize(), SM_Operator::getContentsMemorySize(), SM_Output::getContentsMemorySize(), SM_System::getContentsMemorySize(), SM_VTK::getContentsMemorySize(), SMS_BoostNormalFunction::getContentsMemorySize(), SMS_BoostUniformFunction::getContentsMemorySize(), SMS_STDNormalFunction::getContentsMemorySize(), SMS_STDUniformFunction::getContentsMemorySize(), CORE_ClassFactory::getContentsMemorySize(), CORE_PtrArray< T, I >::getContentsMemorySize(), CORE_ValArray< T, I >::getContentsMemorySize(), CORE_VectorList< T, I >::getContentsMemorySize(), CORE_Object::getMemorySize(), SM_ConstantNoiseRateFunction::getMemorySize(), SM_InverseNoiseRateFunction::getMemorySize(), SM_LandauLifschitzFunction::getMemorySize(), SM_NoiseRateFunction::getMemorySize(), SM_Object::getMemorySize(), SM_StochasticFunction::getMemorySize(), SM_TemplatedNoiseRateFunction< DerivedClass >::getMemorySize(), SM_TimeStepper::getMemorySize(), SMS_BoostRandomFunction::getMemorySize(), CORE_Array< T, I >::getMemorySize(), CORE_Chrono::getMemorySize(), CORE_Collection< T, I >::getMemorySize(), CORE_IO::getMemorySize(), CORE_List< T, K, I >::getMemorySize(), CORE_OptionsReader::getMemorySize(), CORE_OutputFile::getMemorySize(), and CORE_Test::getMemorySize().
|
inlineinherited |
get the type of data
Referenced by SM_XDMF::writeVertices().
|
inlineinherited |
retrun the string identification of the class
References CORE_Object::getClassName(), and core_functions::pointerToString().
Referenced by CORE_Test::testArray(), CORE_Test::testField(), CORE_Test::testTypes(), CORE_Object::toString(), CORE_ClassFactory::toString(), and CORE_Field< T, K, D, S, I >::toString().
|
inlineoverridevirtual |
return the memory size of the class and the memory size of all its attributes/associations
Reimplemented from CORE_Collection< T, I >.
Reimplemented in CORE_ValArray< T, I >, CORE_ValArray< T, CORE_StdValArray< T > >, CORE_StdValArray< T >, CORE_StdPtrArray< T >, CORE_PtrArray< T, I >, and CORE_PtrArray< T, CORE_StdPtrArray< T > >.
References CORE_Object::getContentsMemorySize().
Referenced by CORE_Test::testArray().
|
inlineinherited |
retrun the pointer of the class as a string
References core_functions::pointerToString().
|
inlinestaticinherited |
get the memory stack in string
|
inlineinherited |
return the shared pointer for this
References CORE_Object::mThis.
|
inlineinherited |
return the size of the container
Referenced by CORE_StdPtrArray< T >::axpy(), CORE_StdPtrArray< T >::copy(), CORE_StdValArray< T >::Copy(), CORE_Array< T, I >::csend(), CORE_StdPtrArray< T >::l2Distance2(), CORE_StdValArray< T >::l2Distance2(), CORE_StdPtrArray< T >::linfDistance(), CORE_StdValArray< T >::linfDistance(), CORE_StdPtrArray< T >::operator*=(), CORE_StdPtrArray< T >::operator-=(), CORE_StdPtrArray< T >::operator/=(), CORE_StdPtrArray< T >::scalarProduct(), CORE_StdValArray< T >::scalarProduct(), CORE_Array< T, I >::send(), CORE_StdValArray< T >::Sum(), CORE_Test::testArray(), CORE_StdPtrArray< T >::Transform(), and CORE_StdValArray< T >::Transform().
|
inline |
get the values of the array
References CORE_Array< T, I >::getValues().
|
inline |
get the values of the array for reading
Referenced by CORE_StdPtrArray< T >::axpy(), CORE_StdPtrArray< T >::copy(), CORE_Array< T, I >::getValues(), CORE_StdPtrArray< T >::l2Distance2(), CORE_StdValArray< T >::l2Distance2(), CORE_StdPtrArray< T >::linfDistance(), CORE_StdValArray< T >::linfDistance(), CORE_StdPtrArray< T >::operator*=(), CORE_StdPtrArray< T >::operator-=(), CORE_StdPtrArray< T >::operator/=(), and CORE_StdPtrArray< T >::scalarProduct().
|
inline |
randomize the field
Referenced by CORE_Array< T, I >::operator=().
|
inlineinherited |
test if the clas T is an instance of this class
Referenced by SM_Beam::templatedSimulate().
|
inlinestaticinherited |
return trur if the memory stack is enabled
Referenced by CORE_Object::EnableMemoryStack(), and main().
|
inline |
return true if one value is Not A Number
|
inline |
compute the L2 distance
References CORE_Array< T, I >::l2Distance2().
Referenced by CORE_Test::testArray().
|
inline |
compute the L2 distance squared
[in] | X | X array |
Referenced by CORE_Array< T, I >::l2Distance().
|
inline |
compute the L2 norm
References CORE_Array< T, I >::l2Norm2().
|
inline |
compute the L2 norm squared
Referenced by CORE_Array< T, I >::l2Norm().
|
inline |
compute the Linfinitty norm
Referenced by CORE_Test::testArray().
|
inline |
compute the L infinity norm
|
inlinestaticinherited |
get the memory stack in string
Referenced by main().
|
inline |
normalize the array
|
inline |
modulo operator
[in] | v | modulo value |
and operator
[in] | v | and value |
or operator
[in] | v | and value |
complementary operator
[in] | v | complementary value |
left shift operator
[in] | v | left shift value |
right shift operator
[in] | v | left shift value |
array add operator
[in] | v | array to multiply |
|
inline |
array multiply operator
[in] | v | array to multiply |
|
inline |
multiplicator operator
[in] | v | multiplicator value |
|
inline |
add operator
[in] | v:add | value |
|
inline |
array sub operator
[in] | v | array to multiply |
|
inline |
sub operator
[in] | v:sub | value |
|
inline |
array divisor operator
[in] | v | array to multiply |
|
inline |
divisor operator
[in] | v | divisor value |
|
inline |
build an array by a copy of cpy
[in] | cpy | : array to copy |
References CORE_Array< T, I >::copy().
|
inline |
build an array by a copy of cpy
[in] | cpy | : array to copy |
References CORE_Array< T, I >::copy().
|
inline |
build an array by a copy of c
[in] | values | values to copy |
References CORE_Array< T, I >::copy().
|
inline |
build an array by a copy of c
[in] | values | values to copy |
References CORE_Array< T, I >::copy().
|
inline |
build an array by a copy of c
[in] | values | values to copy |
References CORE_Array< T, I >::copy().
|
inline |
fill the values of the array with v
[in] | v | : value to fill |
References CORE_Array< T, I >::initialize().
|
inline |
build an array by a copy of cpy
[in] | cpy | : array to copy ( in mirror with th ecopy operator) |
References CORE_Array< T, I >::copy().
|
inline |
build an array by a copy of cpy
[in] | cpy | : array to copy ( in mirror with th ecopy operator) |
References CORE_Array< T, I >::copy().
|
inline |
build an array by a copy of c
[in] | values | values to copy |
References CORE_Array< T, I >::copy().
|
inlineinherited |
get the i-th element for writting. Do not verify the bounds
[in] | i | index of the element |
|
inlineinherited |
get the i-th element for reading. Do not verify the bounds
[in] | i | index of the element |
|
inline |
return the produc of all the elements
[out] | p | : the product of all the elements |
Referenced by CORE_Test::testArray().
|
inlineinherited |
return reverse begin iterator for writing
|
inlineinherited |
return reverse end iterator for writing
|
inlineinherited |
modify the size of the array and keep its old values
return begin stride iterator for writing
|
inline |
return the scalar product
|in] | X : argument vector | |
[out] |
return end N-stride iterator for writing
References CORE_Collection< T, I >::getSize().
|
inlineinherited |
set the size of the container
[in] | n | :size of the container |
Referenced by CORE_StdPtrField< T, K, D >::mod2(), CORE_StdValField< T, K, D >::mod2(), CORE_Test::testArray(), CORE_StdPtrArray< T >::Transform(), CORE_StdValArray< T >::Transform(), and CORE_Test::uniformRandomTest().
|
inlineprivateinherited |
set the shared pointer from an unique pointer
[in,out] | up | unique pointer of the class at input, points to null pointer at output |
Method only calledby the friend class CORE_ClassFactory::NewSharedInstance()
References CORE_Object::mThis.
|
inline |
Computes the sum of all the elements.
[out] | s | : the sum of all the elements |
Referenced by CORE_Test::testArray(), and CORE_Test::uniformRandomTest().
|
inline |
swap the two elements of the array
[in] | i | : index to swap |
[in] | j | : index to swap |
References CORE_Array< T, I >::swap().
|
inline |
swap the contents of the array
[in] | a | the array with witch the contents is swap |
Referenced by CORE_Array< T, I >::swap(), and CORE_Test::testArray().
|
inlineoverridevirtualinherited |
return the string representation of the object node
Reimplemented from CORE_Object.
Reimplemented in CORE_Field< T, K, D, S, I >, CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >, and CORE_Field< T, K, D, CORE_StdValArray< T >, CORE_StdValField< T, K, D > >.
References CORE_Collection< T, I >::cbegin(), CORE_Collection< T, I >::cend(), and CORE_Object::toString().
|
inline |
transform the transform element with the lambda function Ti = F(Ti)
[in] | F | : lambda function with one variable |
Referenced by CORE_Array< T, I >::transform(), and CORE_Test::uniformRandomTest().
|
inline |
transform the transform element with the lambda function Ti = F(Xi)
[in] | F | : lambda function with one variable |
[in] | X | : argument of F |
References CORE_Array< T, I >::transform().
|
inline |
transform the transform element with the lambda function Ti = F(Xi,Yi)
[in] | F | : lambda function with one variable |
[in] | X | : first argument of F |
[in] | Y | : second argument of F |
References CORE_Array< T, I >::transform().
|
inline |
randomize the field
Referenced by CORE_Test::testArray(), CORE_Array< T, I >::uniformRandomize(), and CORE_Test::uniformRandomTest().
|
inline |
randomize the field
References core_functions::max(), core_functions::min(), and CORE_Array< T, I >::uniformRandomize().
|
privateinherited |
Referenced by CORE_Object::getConstSharedPointer(), CORE_Object::getSharedPointer(), and CORE_Object::setThis().