C++ main module for stochmagnet Package
1.0
|
This class describes a field with a floating point type. More...
#include <SM_Field.h>
Public Member Functions | |
SM_Field () | |
create a field of dim 3 and size 1 More... | |
SM_Field (std::initializer_list< T > &&values) | |
create a field of dim 3 and size values.size()/3 initialized with values list values More... | |
virtual | ~SM_Field (void) |
destroy the interface More... | |
virtual tMemSize | getMemorySize () const |
return the memory size of the class and the memory size of all its attributes/associations More... | |
Self & | operator= (const T &v) |
copy operator More... | |
Self & | operator= (const std::initializer_list< T > &cpy) |
copy operator More... | |
Self & | operator= (std::initializer_list< T > &&cpy) |
copy operator More... | |
Self & | operator= (const std::valarray< T > &cpy) |
copy operator More... | |
Self & | operator= (const Self &cpy) |
copy operator More... | |
Self & | operator= (Self &&cpy) |
copy operator More... | |
template<class R > | |
requires core_functions::isRealType< R > void | addStochasticNoise (const R &epsilon, SM_StochasticFunction &f) |
add a stochastic noise the the field More... | |
template<class R , class I > | |
void | addTemplatedStochasticNoise (const R &epsilon, SM_TemplatedStochasticFunction< I > &f) |
add a stochastic noise the the field More... | |
void | initialize (const Q &v) |
initailize all the values with v More... | |
void | initialize (const std::array< Q, D > &a) |
copy at element element the array of size D More... | |
void | initialize (const T &v) |
initialize the field to v More... | |
tBoolean | setSharedValues (const tIndex &capacity, const tIndex &size, Q *values) |
set shared values with the capacity and size More... | |
tBoolean | setSharedValues (const tIndex &capacity, Q *values) |
set shared values with the capacity and size More... | |
tBoolean | setSharedValues (CORE_PtrArray< Q, I1 > &array) |
set shared values with the capacity and size More... | |
Self & | operator+= (const T &v) |
add operator More... | |
Self & | operator-= (const T &v) |
sub operator More... | |
Self & | operator-= (const CORE_Field< Q, K, D, S, I > &X) |
array sub operator More... | |
Self & | operator-= (const CORE_Field< T1, K, D, S1, I1 > &v) |
array sub operator More... | |
Self & | operator*= (const T &v) |
multiplicator operator More... | |
Self & | operator*= (const CORE_Field< Q, K, D, S, I > &X) |
array multiply operator More... | |
Self & | operator*= (const CORE_Field< T1, K, D, S1, I1 > &v) |
array multiply operator More... | |
Self & | operator/= (const T &v) |
divisor operator More... | |
Self & | operator/= (const CORE_Field< Q, K, D, S, I > &X) |
array divisor operator More... | |
Self & | operator/= (const CORE_Field< T1, K, D, S1, I1 > &v) |
array divisor operator More... | |
Self & | operator%= (const T &v) requires core_functions |
modulo operator More... | |
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 More... | |
void | mod2 (CORE_Array< T, I > &X) const |
return the norm2 array per each element More... | |
void | mod2 (CORE_Array< T, I1 > &X) const |
return the norm2 array per exch element 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... | |
T & | scalarProduct (const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const |
return the scalar product More... | |
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... | |
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... | |
tIndex | getSize () const |
return the number values of the container More... | |
K | 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 CORE_StdPtrArray< T > & | getStorage () const |
get the storage More... | |
CORE_StdPtrArray< T > & | getStorage () |
get the storage 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 | uniformRandomize (const T &min, const T &max) |
randomize the field 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 | swap (CORE_Array< T, CORE_StdPtrField< T, K, D > > &a) |
swap the contents of the array More... | |
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... | |
tReal | linfNorm (tIndex &i) const |
compute the L infinity norm More... | |
tReal | linfDistance (const CORE_Field< Q, K, D, CORE_StdPtrArray< 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... | |
void | min (T &m) const requires core_functions |
return the min value of all the elements More... | |
virtual tString | toString () const override |
return the string representation of the object node More... | |
void | resize (const tIndex &n) |
modify the size of the array and keep its old values More... | |
tString | getDataTypeName () const |
get the type of data 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... | |
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< Self > | New () |
build a new instance of a SM_Field More... | |
static void | ElementsTransform (LambdaFct &&F, Self &X) |
apply the transform element with the lambda function Ri = F(Xi) More... | |
static void | Normalize (const tIndex &n, T *values) |
normalize all the elements of the field More... | |
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... | |
Private Types | |
typedef SM_Field< T, K > | 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 | |
CORE_StdPtrArray< T > | mStorage |
std::weak_ptr< CORE_Object > | mThis |
This class describes a field with a floating point type.
A real field as a size of N (SM_Field::setSize()) and a dimension dim (SM_Field::setDimension()). So the size of the allocated array is N x dim.
create a field of dim 3 and size 1
|
inline |
create a field of dim 3 and size values.size()/3 initialized with values list values
[in] | values | :values of the field |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::copy().
destroy the interface
|
inline |
add a stochastic noise the the field
[in] | epsilon | : the amplitude of the noise |
[in] | f | the stochastic noise simulator This+=epsilon * f.random() |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::getSize(), CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::getValues(), and SM_StochasticFunction::random().
|
inline |
add a stochastic noise the the field
[in] | epsilon | : the amplitude of the noise |
[in] | f | the stochastic noise simulator This+=epsilon * f.random() |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::getSize(), CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::getValues(), and SM_TemplatedStochasticFunction< I >::templatedRandom().
|
inlineinherited |
compute This=beta.This+ alpha .X
[in] | alpha | alpha parameter |
[in] | X | X array |
(in] | beta : beta parameter |
|
inlineinherited |
return begin iterator for writing
|
inlineconstexprinherited |
return begin iterator for reading
|
inlineconstexprinherited |
return end iterator for reading
|
inlineinherited |
copy the the field
[in] | cpy | : field to copy |
|
inlineinherited |
initialize the field to the values of array of size D
[in] | vs | : values to copy |
|
inlineinherited |
initialize the field at eche element with Vs
[in] | vs | : values to copy |
|
inlineinherited |
initialize the field to the values of list
[in] | vs | : values of the field |
|
inlineinherited |
initialize the field to the values of val array
[in] | vs | : values of the field |
|
inlineinherited |
initialize the field to the values of vector
[in] | vs | : values of the field |
|
inlineinherited |
initialize the field to the values of pointer of size n
[in] | n | : size of vs |
[in] | vs | : values of the field |
|
inlineinherited |
copy the field : mv is destroyed after this
[in] | cpy | :field to move |
|
inlineinherited |
initialize the field to the values of list
[in] | vs | : values of the field |
|
inlineinherited |
initialize the field to the values of val array
[in] | vs | : values of the field |
|
inlineconstexprinherited |
return reverse begin iterator for reading
|
inlineconstexprinherited |
return reverse end iterator for reading
|
inlineconstexprinherited |
return begin N-stride const iterator for writing
|
inlineconstexprinherited |
return end N-stride const iterator for writing
|
inlinestaticinherited |
disable the memory stack
Referenced by CORE_Object::EnableMemoryStack().
|
inlineinherited |
apply the transform element with the lambda function Xid = F(Xid)
[in] | F | : lambda function with one variable |
[in,out] | X | : argument of F |
|
inlinestaticinherited |
apply the transform element with the lambda function Ri = F(Xi)
[in] | F | : lambda function with one variable |
[in] | X | : argument of F |
[out] | R | : result value |
|
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
|
inlineinherited |
get the d-th coordinate of the i-th element for writting
[in] | i | index of the element |
[in] | d | d-coordinate of the element |
|
inlineinherited |
get the d-th coordinate of the i-th element for reading
[in] | i | index of the element |
[in] | d | d-coordinate of the element |
|
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.
|
inlineoverridevirtualinherited |
return the memory size of the included associations
Reimplemented from CORE_Object.
|
inlineinherited |
get the type of data
Referenced by SM_XDMF::writeVertices().
|
inlineinherited |
get the dimension of the field
|
inlineinherited |
return the number values of the container
|
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().
|
inlinevirtual |
return the memory size of the class and the memory size of all its attributes/associations
Reimplemented from CORE_StdPtrField< T, K, 3 >.
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::getContentsMemorySize().
|
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 number values of the container
|
inlineinherited |
get the storage
|
inlineinherited |
get the storage
|
inlineinherited |
get the values of the array
|
inlineinherited |
get the values of the array for reading
|
inlineinherited |
initailize all the values with v
[in] | v | : initialize value |
|
inlineinherited |
copy at element element the array of size D
[in] | a | : values of the element |
|
inlineinherited |
initialize the field to v
[in] | vs | : constant value of the field |
|
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().
|
inlineinherited |
return true if one value is Not A Number
|
inlineinherited |
compute the Linfinitty norm
|
inlineinherited |
compute the L infinity norm
|
inlinestaticinherited |
get the memory stack in string
Referenced by main().
|
inlineinherited |
return the min value of all the elements
return the max value of all the elements
sort the element
[in] | order | 'i' or 'd' |
sort the element
[in] | order | 'i' or 'd' |
[in] | k | the coordinates to sort |
save the field into a txt file with the format : #coments N dim v[0] v[1] ..V[dim-1] v[dim].... ....V[dim*N-1]
[in] | comments | : without # |
[in] | filename | the file name to save the data |
[in] | nDigits | : precision for writing the data |
load the field from a txt file with the format :
N dim v[0] v[1].... V[dim*N-1]
[in] | filename | : the file name to load the data |
[out] | comment | : return the comment |
[out] | retCode | : return code : 1 : the loading has succeeded 0 : the file is not big enough -1 : no size given -2 : bad size or dimension -3 : file does not exist |
|
inlineinherited |
return the norm2 array per each element
[out] | X | : X[i]=|Ti|^2 |
|
inlineinherited |
return the norm2 array per exch element
[out] | X | : the vector to make the product X[i]=|Ti|^2 |
|
inlinestatic |
|
inlineinherited |
normalize all the elements of the field return false if the method is not compatible with the floating point type
|
inlinestaticinherited |
normalize all the elements of the field
[in] | n | : n is the size of values |
[in,out] | values | : the values array to normalize return false if the method is not compatible with the floating point type |
|
inlineinherited |
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 | field to multiply |
|
inlineinherited |
get the i-th element for writting. Do not verify the bounds
[in] | i | index of the element |
[in] | d | : index of the coordinate of the element |
|
inlineinherited |
get the i-th element for reading. Do not verify the bounds
[in] | i | index of the element |
[in] | d | : index of the coordinate of the element |
|
inlineinherited |
get the i-th element for reading. Do not verify the bounds
[in] | i | index of the element |
[in] | d | : index of the coordinate of the element |
|
inlineinherited |
get the i-th element for writting. Do not verify the bounds
[in] | i | index of the element |
[in] | d | : index of the coordinate of the element |
|
inlineinherited |
array multiply operator
[in] | X | field to multiply |
|
inlineinherited |
array multiply operator
[in] | v | array to multiply |
|
inlineinherited |
multiplicator operator
[in] | v | multiplicator value |
|
inlineinherited |
add operator
[in] | v:add | value |
|
inlineinherited |
array sub operator
[in] | X | field to multiply |
|
inlineinherited |
array sub operator
[in] | v | array to multiply |
|
inlineinherited |
sub operator
[in] | v:sub | value |
|
inlineinherited |
array divisor operator
[in] | X | field to multiply |
|
inlineinherited |
array divisor operator
[in] | v | array to multiply |
|
inlineinherited |
divisor operator
[in] | v | divisor value |
copy operator
[in] | cpy | : field to copy @retrn this |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::copy().
|
inline |
copy operator
[in] | cpy | : initializer list @retrn this |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::copy().
|
inline |
copy operator
[in] | cpy | : initializer list |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::copy().
copy operator
[in] | v | : initialize value @retrn this |
References CORE_StdPtrField< T, K, 3 >::initialize().
copy operator
[in] | cpy | : field to copy @retrn this |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::copy().
|
inline |
copy operator
[in] | cpy | : initializer list @retrn this |
References CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >::copy().
|
inlineinherited |
get the i-th value for writting.
[in] | i | index of the value |
|
inlineinherited |
get the i-th value for reading.
[in] | i | index of the value |
|
inlineinherited |
return the produc of all the elements
|
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
|
inlineinherited |
return begin stride iterator for writing
|
inlineinherited |
return the scalar product
[in] | X | : argument vector |
[out] | s | : the scalar product |
|
inlineinherited |
return the scalar product
[in] | weights | : weight of each element |
[in] | X | : argument field |
[out] | s | : the scalar product |
|
inlineinherited |
return end N-stride iterator for writing
|
inlineinherited |
set the number of element of the container
[in] | n | : number of elements of the container |
|
inlineinherited |
set shared values with the capacity and size
[in] | capacity | : memory size of the values |
[in] | size | suzefull size of the values |
[in,out] | values | the sahred values |
|
inlineinherited |
set shared values with the capacity and size
[in] | capacity | : memory size of the values |
[in,out] | values | the sahred values |
size is set to min(0,mCapacity-2)
|
inlineinherited |
set shared values with the capacity and size
[in] | capacity | : memory size of the values |
[in,out] | values | the sahred values |
size is set to min(0,mCapacity-2)
|
inlineinherited |
set the number of values of the container
[in] | n | : number of values of the container |
|
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.
|
inlineinherited |
return the sum of all the elements
|
inlineinherited |
swap the contents of the array
[in] | a | the array with witch the contents is swap |
|
inlineoverridevirtualinherited |
return the string representation of the object node
Reimplemented from CORE_Collection< T, I >.
|
inlineinherited |
transform the transform element with the lambda function Ti = F(Ti)
[in] | F | : lambda function with one variable |
|
inlineinherited |
transform the transform element with the lambda function Ti = F(Xi)
[in] | F | : lambda function with one variable |
[in] | X | : argument of F |
|
inlineinherited |
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 |
|
inlineinherited |
randomize the field
|
privateinherited |
|
privateinherited |
Referenced by CORE_Object::getConstSharedPointer(), CORE_Object::getSharedPointer(), and CORE_Object::setThis().