31char tenseur_sym_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_sym.C,v 1.8 2014/10/13 08:53:42 j_novak Exp $" ;
97 const Base_vect& triad_i,
const Metrique* met,
99 :
Tenseur(map, val, tipe, int(
pow(3., val-2)) * 6, triad_i,
108 const Base_vect& triad_i,
const Metrique* met,
110 :
Tenseur(map, val, tipe, int(
pow(3., val-2)) * 6, triad_i,
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++) {
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]) ;
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++)
342 assert(*
triad ==
mp->get_bvect_cart()) ;
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) ;
400 for (
int idx=2 ; idx<
p_derive_cov[ind]->valence ; idx++)
402 indices_gamma.
set(idx) = indices(idx-1) ;
404 indices_gamma.
set(idx) = indices(idx) ;
406 p_derive_cov[ind]->set(indices) -= (*auxi)(indices_gamma) ;
419 indices_gamma.
set(0) = indices(i+1) ;
420 indices_gamma.
set(1) = indices(0) ;
421 for (
int idx=2 ; idx<
p_derive_cov[ind]->valence ; idx++)
423 indices_gamma.
set(idx) = indices(idx-1) ;
425 indices_gamma.
set(idx) = indices(idx) ;
426 p_derive_cov[ind]->set(indices) += (*auxi)(indices_gamma) ;
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 get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] ).
int & set(int i)
Read/write of a particular element (index i ) (1D case).
int get_ndim() const
Gives the number of dimensions (ie dim.ndim ).
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 .
Tenseur_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, const Metrique *met=0x0, double weight=0)
Standard constructor.
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 .
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...
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).
friend Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
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 .
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.