106 const Base_vect& triad_i,
const Metrique* met,
108 :
Tenseur(map, val, tipe, int(
pow(3., val-2)) * 6, triad_i,
117 const Base_vect& triad_i,
const Metrique* met,
119 :
Tenseur(map, val, tipe, int(
pow(3., val-2)) * 6, triad_i,
128 Tenseur (*source.mp, source.valence, source.type_indice,
129 int(
pow(3., source.valence-2)*6), *(source.triad), source.metric,
133 for (
int i=0 ; i<
n_comp ; i++) {
135 if (source.
c[place_source] == 0x0)
138 c[i] =
new Cmp (*source.
c[place_source]) ;
149 for (
int i=0; i<N_MET_MAX; i++) {
169 Tenseur (*source.mp, source.valence, source.type_indice,
170 int(
pow(3., source.valence-2)*6), *(source.triad), source.metric,
175 for (
int i=0 ; i<
n_comp ; i++) {
177 if (source.
c[place_source] == 0x0)
180 c[i] =
new Cmp (*source.
c[place_source]) ;
200 :
Tenseur(map, triad_i, fd, met) {
220 for (
int i=0 ; i<
valence ; i++)
221 assert ((idx(i) >= 0) && (idx(i) < 3)) ;
253 for (
int i=0 ; i<
valence-2 ; i++)
256 res = 6*res + place_fin ;
264 assert ((place>=0) && (place<
n_comp)) ;
266 int reste = div(place, 6).rem ;
267 place = int((place-reste)/6) ;
269 for (
int i=
valence-3 ; i>=0 ; i--) {
270 res.
set(i) = div(place, 3).rem ;
271 place = int((place-res(i))/3) ;
279 if ((reste>2) && (reste<5)) {
300 for (
int i=0 ; i<
valence ; i++)
316 for (
int i=0 ; i<
n_comp ; i++) {
318 if (t.
c[place_t] == 0x0)
321 *
c[i] = *t.
c[place_t] ;
327 cout <<
"Unknown state in Tenseur_sym::operator= " << endl ;
340 assert (
etat != ETATNONDEF) ;
350 for (
int i=0 ; i<
valence ; i++)
361 if (
etat == ETATZERO)
374 for (
int m=0 ; m<
valence ; m++)
375 indices_source.
set(m) = indices_res(m+1) ;
378 (*this)(indices_source).deriv(indices_res(0)) ;
387 assert (
etat != ETATNONDEF) ;
397 assert( *(metre.gamma().get_triad()) == *
triad ) ;
400 for (
int i=0 ; i<
valence ; i++) {
411 indices_gamma.
set(0) = indices(0) ;
412 indices_gamma.
set(1) = indices(i+1) ;
415 indices_gamma.
set(idx) = indices(idx-1) ;
417 indices_gamma.
set(idx) = indices(idx) ;
432 indices_gamma.
set(0) = indices(i+1) ;
433 indices_gamma.
set(1) = indices(0) ;
436 indices_gamma.
set(idx) = indices(idx-1) ;
438 indices_gamma.
set(idx) = indices(idx) ;
Itbl type_indice
Array of size valence contening the type of each index, COV for a covariant one and CON for a contrav...
const Map *const mp
Reference mapping.
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
int & set(int i)
Read/write of a particular element (index i ) (1D case)
int n_comp
Number of components, depending on the symmetry.
Class intended to describe tensors with a symmetry on the two last indices *** DEPRECATED : use class...
int get_ndim() const
Gives the number of dimensions (ie dim.ndim )
virtual int donne_place(const Itbl &idx) const
Returns the position in the Cmp 1-D array c of a component given by its indices.
Base class for coordinate mappings.
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
virtual Itbl donne_indices(int place) const
Returns the indices of a component given by its position in the Cmp 1-D array c . ...
Basic integer array class.
virtual ~Tenseur_sym()
Destructor.
virtual Itbl donne_indices(int place) const
Returns the indices of a component given by its position in the Cmp 1-D array c . ...
Vectorial bases (triads) with respect to which the tensorial components are defined.
virtual void fait_derive_cov(const Metrique &met, int i) const
Calculates, if needed, the covariant derivative of *this , with respect to met .
int get_valence() const
Returns the valence.
virtual void operator=(const Tenseur &tens)
Assignment to another Tenseur.
virtual void operator=(const Tenseur &)
Assignment from a Tenseur .
virtual void fait_gradient() const
Calculates, if needed, the gradient of *this .
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Tenseur * p_gradient
Pointer on the gradient of *this .
virtual int donne_place(const Itbl &idx) const
Returns the position in the Cmp 1-D array c of a component given by its indices.
double poids
For tensor densities: the weight.
Tenseur ** p_derive_con
Array of pointers on the contravariant derivatives of *this with respect to the corresponding metric...
int get_etat() const
Returns the logical state.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
friend Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Cmp pow(const Cmp &, int)
Power .
const Metrique ** met_depend
Array of pointers on the Metrique 's used to calculate derivatives members.
Tenseur(const Map &map, const Metrique *met=0x0, double weight=0)
Constructor for a scalar field.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
void set_dependance(const Metrique &met) const
To be used to describe the fact that the derivatives members have been calculated with met ...
Tenseur_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, const Metrique *met=0x0, double weight=0)
Standard constructor.
const Metrique * metric
For tensor densities: the metric defining the conformal factor.
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] )
Tenseur ** p_derive_cov
Array of pointers on the covariant derivatives of *this with respect to the corresponding metric in ...
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
const Tenseur & derive_cov(const Metrique &met) const
Returns the covariant derivative of *this , with respect to met .
void set_etat_zero()
Sets the logical state to ETATZERO (zero state).
virtual void fait_derive_con(const Metrique &, int i) const
Calculates, if needed, the contravariant derivative of *this , with respect to met ...
Tenseur ** p_carre_scal
Array of pointers on the scalar squares of *this with respect to the corresponding metric in *met_de...
Tensor handling *** DEPRECATED : use class Tensor instead ***.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)