1 #ifndef CORE_StdPtrField_H
2 #define CORE_StdPtrField_H
5 #include "CORE_Field.h"
8 #include "CORE_StdPtrArray.h"
16 template <
typename T,
typename K,K D>
68 static inline CORE_UniquePointer<Self>
New() {
116 template<
size_t N,
typename Q>
164 template<
typename Q,
class S1,
class I1>
175 template<
typename Q,
class S1,
class I1>
202 const Q* iA=a.data();
210 const T* eV=iV+this->
getSize();
230 inline tBoolean
setSharedValues(
const tIndex& capacity,
const tIndex& size,Q* values) {
231 return this->
getStorage().setSharedValues(capacity,size,values);
253 template<
typename Q,
class I1>
310 inline Self& operator&=(
const T& v) requires functions_type::isIntegerType<T>{
318 inline Self& operator|=(
const T& v) requires functions_type::isIntegerType<T>{
326 inline Self& operator^=(
const T& v) requires functions_type::isIntegerType<T> {
333 inline Self& operator<<=(
const T& v) requires functions_type::isIntegerType<T> {
341 inline Self& operator>>=(
const T& v) requires functions_type::isIntegerType<T> {
355 template<
class Q,
class S,
class I>
366 template<
class Q,
class S,
class I>
377 template<
class Q,
class S,
class I>
389 template<
class Q,
class S,
class I>
406 template<
typename LambdaFct>
418 template<
typename LambdaFct>
439 inline static void Normalize(
const tIndex& n,T* values) {
456 T eps=std::numeric_limits<T>::epsilon();
467 invNi+=(*iVd)*(*iVd);
472 invNi=1./sqrt(invNi);
545 template<
class Q,
class S1,
class I1>
559 template<
class Q,
class S1,
class I1>
567 if (weights.size()==0) {
572 tBoolean incW=(weights.size()>1);
574 const tReal *iWs=&weights[0];
578 const T* iYe=iYs+n*D;
592 s+=(*iWs)*(*iXd)*(*iYs);
608 #ifndef DIMENSION_TYPE
609 #define DIMENSION_TYPE
610 typedef tUCInt tDimension;
618 #ifndef DEFAULT_FIELD
619 #define DEFAULT_FIELD
this class describes an array of values T of dynamical size with algebrical operators and I is an imp...
Definition: CORE_Array.h:91
void setSize(const tIndex &n)
set the size of the container
Definition: CORE_Collection.h:104
this class describes an field. A field is composed by
Definition: CORE_Field.h:49
virtual tMemSize getContentsMemorySize() const override
return the memory size of the included associations
Definition: CORE_Field.h:102
void copy(const tIndex &n, const Q *vs)
initialize the field to the values of pointer of size n
Definition: CORE_Field.h:447
const T * getValues() const
get the values of the array for reading
Definition: CORE_Field.h:323
auto sbegin()
return begin stride iterator for writing
Definition: CORE_Field.h:276
auto send()
return end N-stride iterator for writing
Definition: CORE_Field.h:282
tIndex getElementsNumber() const
return the number values of the container
Definition: CORE_Field.h:135
tIndex getSize() const
return the number values of the container
Definition: CORE_Field.h:161
const CORE_StdPtrArray< T > & getStorage() const
get the storage
Definition: CORE_Field.h:336
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
this class describes an arithmetic array type implemented with as a pointer allocation object with im...
Definition: CORE_PtrArray.h:69
const T * getValues() const
get the values of the array for reading
Definition: CORE_PtrArray.h:357
tIndex getSize() const
return the size of the array for writing
Definition: CORE_PtrArray.h:155
this class describes a standart arithmetic array type implemented with a memory allocation with type ...
Definition: CORE_StdPtrArray.h:13
this class describes a standart arithmetic array type implemented with a CORE_StdPtrArray object
Definition: CORE_StdPtrField.h:17
static CORE_UniquePointer< Self > New()
return a new unique pointer of this
Definition: CORE_StdPtrField.h:68
void normalize()
normalize all the elements of the field return false if the method is not compatible with the floatin...
Definition: CORE_StdPtrField.h:429
Self & operator+=(const T &v)
add operator
Definition: CORE_StdPtrField.h:268
Self & operator=(const std::valarray< Q > &values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:128
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: CORE_StdPtrField.h:57
T & scalarProduct(const std::valarray< Q > &weights, const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
return the scalar product
Definition: CORE_StdPtrField.h:560
virtual ~CORE_StdPtrField()
destroy an array of T*
Definition: CORE_StdPtrField.h:38
Self & operator-=(const T &v)
sub operator
Definition: CORE_StdPtrField.h:275
CORE_StdPtrField()
build an array of T*
Definition: CORE_StdPtrField.h:30
T & scalarProduct(const CORE_Field< Q, K, D, S1, I1 > &X, T &s) const
return the weight scalar product
Definition: CORE_StdPtrField.h:546
void elementsTransform(LambdaFct &&F)
apply the transform element with the lambda function Xid = F(Xid)
Definition: CORE_StdPtrField.h:419
Self & operator*=(const T &v)
multiplicator operator
Definition: CORE_StdPtrField.h:284
Self & operator=(Self &&values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:153
static void ElementsTransform(LambdaFct &&F, Self &X)
apply the transform element with the lambda function Ri = F(Xi)
Definition: CORE_StdPtrField.h:407
Self & operator=(CORE_Field< Q, K, D, S1, I1 > &&values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:176
Self & operator=(const Self &values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:146
void initialize(const Q &v)
initailize all the values with v
Definition: CORE_StdPtrField.h:192
Self & operator/=(const T &v)
divisor operator
Definition: CORE_StdPtrField.h:292
tBoolean setSharedValues(const tIndex &capacity, const tIndex &size, Q *values)
set shared values with the capacity and size
Definition: CORE_StdPtrField.h:230
void initialize(const std::array< Q, D > &a)
copy at element element the array of size D
Definition: CORE_StdPtrField.h:200
Self & operator=(const std::array< Q, N > &values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:117
Self & operator/=(const CORE_Field< Q, K, D, S, I > &X)
array divisor operator
Definition: CORE_StdPtrField.h:390
tBoolean setSharedValues(const tIndex &capacity, Q *values)
set shared values with the capacity and size
Definition: CORE_StdPtrField.h:243
Self & operator*=(const CORE_Field< Q, K, D, S, I > &X)
array multiply operator
Definition: CORE_StdPtrField.h:378
Self & operator=(const T &v)
fill the values of the array with v
Definition: CORE_StdPtrField.h:92
Self & operator=(std::initializer_list< T > &&values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:99
Self & operator%=(const T &v) requires functions_type
modulo operator
Definition: CORE_StdPtrField.h:302
Self & operator=(const std::vector< Q > &values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:138
static void Normalize(const tIndex &n, T *values)
normalize all the elements of the field
Definition: CORE_StdPtrField.h:439
Self & operator=(const CORE_Field< Q, K, D, S1, I1 > &values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:165
Self & operator=(const std::initializer_list< T > &values)
build an array by a copy of c
Definition: CORE_StdPtrField.h:106
Self & operator-=(const CORE_Field< Q, K, D, S, I > &X)
array sub operator
Definition: CORE_StdPtrField.h:367
tBoolean setSharedValues(CORE_PtrArray< Q, I1 > &array)
share the values of array
Definition: CORE_StdPtrField.h:254
void mod2(CORE_Array< T, I > &X) const
return the norm2 array per each element
Definition: CORE_StdPtrField.h:502