31 char tenseur_sym_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_sym.C,v 1.8 2014/10/13 08:53:42 j_novak Exp $" ;
96 Tenseur_sym::Tenseur_sym(
const Map& map,
int val,
const Itbl& tipe,
97 const Base_vect& triad_i,
const Metrique* met,
99 :
Tenseur(map, val, tipe, int(
pow(3., val-2)) * 6, triad_i,
107 Tenseur_sym::Tenseur_sym(
const Map& map,
int val,
int tipe,
108 const Base_vect& triad_i,
const Metrique* met,
110 :
Tenseur(map, val, tipe, int(
pow(3., val-2)) * 6, triad_i,
119 Tenseur (*source.mp, source.valence, source.type_indice,
120 int(
pow(3., source.valence-2)*6), *(source.triad), source.metric,
124 for (
int i=0 ; i<
n_comp ; i++) {
126 if (source.
c[place_source] == 0x0)
129 c[i] =
new Cmp (*source.
c[place_source]) ;
140 for (
int i=0; i<N_MET_MAX; i++) {
159 Tenseur_sym::Tenseur_sym (
const Tenseur& source) :
160 Tenseur (*source.mp, source.valence, source.type_indice,
161 int(
pow(3., source.valence-2)*6), *(source.triad), source.metric,
166 for (
int i=0 ; i<
n_comp ; i++) {
168 if (source.
c[place_source] == 0x0)
171 c[i] =
new Cmp (*source.
c[place_source]) ;
189 Tenseur_sym::Tenseur_sym(
const Map& map,
const Base_vect& triad_i, FILE* fd,
191 :
Tenseur(map, triad_i, fd, met) {
211 for (
int i=0 ; i<
valence ; i++)
212 assert ((idx(i) >= 0) && (idx(i) < 3)) ;
244 for (
int i=0 ; i<
valence-2 ; i++)
247 res = 6*res + place_fin ;
255 assert ((place>=0) && (place<
n_comp)) ;
257 int reste = div(place, 6).rem ;
258 place = int((place-reste)/6) ;
260 for (
int i=
valence-3 ; i>=0 ; i--) {
261 res.
set(i) = div(place, 3).rem ;
262 place = int((place-res(i))/3) ;
270 if ((reste>2) && (reste<5)) {
291 for (
int i=0 ; i<
valence ; i++)
307 for (
int i=0 ; i<
n_comp ; i++) {
309 if (t.
c[place_t] == 0x0)
312 *
c[i] = *t.
c[place_t] ;
318 cout <<
"Unknown state in Tenseur_sym::operator= " << endl ;
327 assert (
etat != ETATNONDEF) ;
337 for (
int i=0 ; i<
valence ; i++)
348 if (
etat == ETATZERO)
361 for (
int m=0 ; m<
valence ; m++)
362 indices_source.
set(m) = indices_res(m+1) ;
365 (*this)(indices_source).deriv(indices_res(0)) ;
374 assert (
etat != ETATNONDEF) ;
384 assert( *(metre.gamma().get_triad()) == *
triad ) ;
387 for (
int i=0 ; i<
valence ; i++) {
398 indices_gamma.
set(0) = indices(0) ;
399 indices_gamma.
set(1) = indices(i+1) ;
402 indices_gamma.
set(idx) = indices(idx-1) ;
404 indices_gamma.
set(idx) = indices(idx) ;
419 indices_gamma.
set(0) = indices(i+1) ;
420 indices_gamma.
set(1) = indices(0) ;
423 indices_gamma.
set(idx) = indices(idx-1) ;
425 indices_gamma.
set(idx) = indices(idx) ;
Vectorial bases (triads) with respect to which the tensorial components are defined.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Basic integer array class.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int & set(int i)
Read/write of a particular element (index i ) (1D case)
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] )
int get_ndim() const
Gives the number of dimensions (ie dim.ndim )
Base class for coordinate mappings.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping,...
Class intended to describe tensors with a symmetry on the two last indices *** DEPRECATED : use class...
virtual void fait_gradient() const
Calculates, if needed, the gradient of *this .
virtual void fait_derive_cov(const Metrique &met, int i) const
Calculates, if needed, the covariant derivative of *this , with respect to met .
virtual void operator=(const Tenseur &)
Assignment from a Tenseur .
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.
virtual void fait_derive_con(const Metrique &, int i) const
Calculates, if needed, the contravariant derivative of *this , with respect to met .
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 .
Tensor handling *** DEPRECATED : use class Tensor instead ***.
virtual Itbl donne_indices(int place) const
Returns the indices of a component given by its position in the Cmp 1-D array c .
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Tenseur ** p_derive_con
Array of pointers on the contravariant derivatives of *this with respect to the corresponding metri...
const Metrique * metric
For tensor densities: the metric defining the conformal factor.
const Map *const mp
Reference mapping.
const Metrique ** met_depend
Array of pointers on the Metrique 's used to calculate derivatives members.
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.
const Tenseur & derive_cov(const Metrique &met) const
Returns the covariant derivative of *this , with respect to met .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Tenseur(const Map &map, const Metrique *met=0x0, double weight=0)
Constructor for a scalar field.
Tenseur ** p_carre_scal
Array of pointers on the scalar squares of *this with respect to the corresponding metric in *met_d...
friend Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)
int n_comp
Number of components, depending on the symmetry.
void set_etat_zero()
Sets the logical state to ETATZERO (zero state).
Itbl type_indice
Array of size valence contening the type of each index, COV for a covariant one and CON for a contrav...
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
double poids
For tensor densities: the weight.
Tenseur ** p_derive_cov
Array of pointers on the covariant derivatives of *this with respect to the corresponding metric in...
int get_valence() const
Returns the valence.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
Tenseur * p_gradient
Pointer on the gradient of *this .
void set_dependance(const Metrique &met) const
To be used to describe the fact that the derivatives members have been calculated with met .
int get_etat() const
Returns the logical state.
Cmp pow(const Cmp &, int)
Power .