32 char tensor_sym_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/tensor_sym.C,v 1.3 2014/10/13 08:53:44 j_novak Exp $" ;
59 #include "utilitaires.h" 70 const Base_vect& triad_i,
int index_sym1,
int index_sym2)
71 :
Tensor(map, val, tipe, 6*int(
pow(3.,val-2)), triad_i),
98 const Base_vect& triad_i,
int index_sym1,
int index_sym2)
99 :
Tensor(map, val, tipe, 6*int(
pow(3.,val-2)), triad_i),
122 int index_sym1,
int index_sym2)
123 :
Tensor(map, 3, tipe0, 18, triad_i),
127 assert( (tipe0==COV) || (tipe0==CON) ) ;
128 assert( (tipe1==COV) || (tipe1==CON) ) ;
129 assert( (tipe2==COV) || (tipe2==CON) ) ;
158 for (
int i=0 ; i<
n_comp ; i++) {
164 *(
cmp[i]) = *(source.
cmp[posi]) ;
175 :
Tensor(map, triad_i, fd) {
206 for (
int id=0 ;
id<
valence ;
id++)
209 for (
int ic=0 ; ic<
n_comp ; ic++) {
211 *
cmp[ic] = *(tt.
cmp[posi]) ;
224 for (
int id=0 ;
id<
valence ;
id++)
231 for (
int ic=0 ; ic<
n_comp ; ic++) {
233 *
cmp[ic] = *(tt.
cmp[posi]) ;
250 for (
int i=0 ; i<
valence ; i++) {
251 assert( (idx(i)>=1) && (idx(i)<=3) ) ;
257 for (
int id=0 ;
id<
id_sym1;
id++) {
258 idx0.
set(
id) = idx(
id) ;
260 for (
int id=id_sym1;
id<
id_sym2-1;
id++) {
261 idx0.
set(
id) = idx(
id+1) ;
263 for (
int id=id_sym2-1;
id<valence-2;
id++) {
264 idx0.
set(
id) = idx(
id+2) ;
266 idx0.
set(valence-2) = idx(id_sym1) ;
267 idx0.
set(valence-1) = idx(id_sym2) ;
283 for (
int id=0 ;
id<valence-2 ;
id++) {
284 pos = 3 * pos + idx0(
id) - 1 ;
312 assert( (place>=0) && (place<
n_comp) ) ;
318 int reste = div(place, 6).rem ;
319 place = int((place-reste)/6) ;
326 if ( (reste>2) && (reste<5) ) {
337 if (
valence == 2)
return idx0 ;
339 for (
int id=
valence-3 ;
id>=0 ;
id--) {
340 int ind = div(place, 3).rem ;
341 place = int((place-ind)/3) ;
342 idx0.
set(
id) = ind + 1 ;
350 for (
int id=0 ;
id<
id_sym1;
id++) {
351 idx.
set(
id) = idx0(
id) ;
355 for (
int id=id_sym1+1;
id<
id_sym2;
id++) {
356 idx.
set(
id) = idx0(
id-1) ;
360 for (
int id=id_sym2+1;
id<
valence;
id++) {
361 idx.
set(
id) = idx0(
id-2) ;
virtual void sauve(FILE *) const
Save in a binary file.
int & set(int i)
Read/write of a particular element (index i ) (1D case)
int n_comp
Number of stored components, depending on the symmetry.
virtual void operator=(const Tensor_sym &a)
Assignment to another Tensor_sym.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim )
int id_sym2
Number of the second symmetric index (id_sym1 < id_sym2 < valence )
Base class for coordinate mappings.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
Basic integer array class.
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
virtual void sauve(FILE *) const
Save in a binary file.
Tensor_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, int index_sym1, int index_sym2)
Standard constructor.
Vectorial bases (triads) with respect to which the tensorial components are defined.
Itbl type_indice
1D array of integers (class Itbl ) of size valence containing the type of each index: COV for a covar...
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
virtual int position(const Itbl &ind) const
Returns the position in the array cmp of a component given by its indices.
Scalar ** cmp
Array of size n_comp of pointers onto the components.
virtual ~Tensor_sym()
Destructor.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
int id_sym1
Number of the first symmetric index (0<= id_sym1 < valence )
Cmp pow(const Cmp &, int)
Power .
int get_valence() const
Returns the valence.
virtual void del_deriv() const
Deletes the derived quantities.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
virtual int position(const Itbl &ind) const
Returns the position in the array cmp of a component given by its indices.
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] )
Symmetric tensors (with respect to two of their arguments).
const Map *const mp
Mapping on which the numerical values at the grid points are defined.