9 #include "metric_tensor.hpp"
11 #ifndef __TENSOR_IMPL_HPP_
12 #define __TENSOR_IMPL_HPP_
24 for (
int i=0 ; i<
n_comp ; i++)
104 for (
int i=0 ; i<
valence ; i++)
105 ind.
set(i) = idx(i)+1 ;
123 idx.
set(0) = indice ;
133 idx.
set(0) = indice1 ;
134 idx.
set(1) = indice2 ;
144 idx.
set(0) = indice1 ;
145 idx.
set(1) = indice2 ;
146 idx.
set(2) = indice3 ;
157 idx.
set(0) = indice1 ;
158 idx.
set(1) = indice2 ;
159 idx.
set(2) = indice3 ;
160 idx.
set(3) = indice4 ;
179 for (
int i=0 ; i<
valence ; i++)
180 ind.
set(i) = idx(i)+1 ;
187 assert((pos>=0) && (pos<
valence)) ;
230 for (
int i=0 ; i<3 ; i++)
240 assert ( (index>=1) && (index<=3) ) ;
241 return *
cmp[index - 1] ;
245 assert ((index>=1) && (index<=3)) ;
246 return *
cmp[index - 1] ;
reference set(const Index &pos)
Read/write of an element.
int get_ndim() const
Returns the number of dimensions.
int get_size(int i) const
Returns the size of a given dimension.
virtual void filter(Tensor &tt, int dom, double treshold) const
Puts to zero all the coefficients below a given treshold.
Class that gives the position inside a multi-dimensional Array.
bool inc(int increm, int var=0)
Increments the position of the Index.
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
void filter_phi(int dom, int ncf)
Sets to zero all the coefficients above a given order, for the coefficients, in a gicen Domain.
const Domain * get_domain(int i) const
returns a pointer on the domain.
int get_nbr_domains() const
Returns the number of Domains.
const Scalar & operator()() const
Read only for a Scalar.
bool name_affected
Indicator that states if the indices have been given names.
Memory_mapped_array< char > name_indice
If the indices haves names they are stored here.
void set_name_ind(int dd, char name)
Sets the name of one index ; the names must have been affected first.
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
void coef() const
Computes the coefficients.
void filter_phi(int dom, int ncf)
Sets to zero all the coefficients above a given order, for the coefficients, in a gicen Domain.
void coef_i() const
Computes the values in the configuration space.
Memory_mapped_array< Scalar * > cmp
Array of size n_comp of pointers onto the components.
void filter(double tre)
Sets all the coefficients below a given treshold, to zero (maintaining regularity).
virtual void annule_hard()
Sets the Tensor to zero (hard version ; no logical state used).
Scalar & set()
Read/write for a Scalar.
int n_comp
Number of stored components, depending on the symmetry.
const Space & espace
The Space.
const Scalar & at(int i1, int i2) const
Sylvain' stuff.
virtual int position(const Array< int > &idx) const
Gives the location of a given component in the array used for storage (Array version).
const Scalar & at(int) const
Readonly access to a component.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
void annule_hard() override
Sets the Tensor to zero (hard version ; no logical state used).