62#include "utilitaires.h"
73 const Base_vect& triad_i,
int index_sym1,
int index_sym2)
74 :
Tensor(map, val, tipe, 6*int(
pow(3.,val-2)), triad_i),
101 const Base_vect& triad_i,
int index_sym1,
int index_sym2)
102 :
Tensor(map, val, tipe, 6*int(
pow(3.,val-2)), triad_i),
125 int index_sym1,
int index_sym2)
126 :
Tensor(map, 3, tipe0, 18, triad_i),
130 assert( (tipe0==COV) || (tipe0==CON) ) ;
131 assert( (tipe1==COV) || (tipe1==CON) ) ;
132 assert( (tipe2==COV) || (tipe2==CON) ) ;
161 for (
int i=0 ; i<
n_comp ; i++) {
167 *(
cmp[i]) = *(source.
cmp[posi]) ;
178 :
Tensor(map, triad_i, fd) {
209 for (
int id=0 ;
id<
valence ;
id++)
212 for (
int ic=0 ; ic<
n_comp ; ic++) {
214 *
cmp[ic] = *(tt.
cmp[posi]) ;
227 for (
int id=0 ;
id<
valence ;
id++)
234 for (
int ic=0 ; ic<
n_comp ; ic++) {
236 *
cmp[ic] = *(tt.
cmp[posi]) ;
253 for (
int i=0 ; i<
valence ; i++) {
254 assert( (idx(i)>=1) && (idx(i)<=3) ) ;
260 for (
int id=0 ;
id<
id_sym1;
id++) {
261 idx0.
set(
id) = idx(
id) ;
264 idx0.
set(
id) = idx(
id+1) ;
267 idx0.
set(
id) = idx(
id+2) ;
286 for (
int id=0 ;
id<
valence-2 ;
id++) {
287 pos = 3 * pos + idx0(
id) - 1 ;
315 assert( (place>=0) && (place<
n_comp) ) ;
321 int reste = div(place, 6).rem ;
322 place = int((place-reste)/6) ;
329 if ( (reste>2) && (reste<5) ) {
340 if (
valence == 2)
return idx0 ;
342 for (
int id=
valence-3 ;
id>=0 ;
id--) {
343 int ind = div(place, 3).rem ;
344 place = int((place-ind)/3) ;
345 idx0.
set(
id) = ind + 1 ;
353 for (
int id=0 ;
id<
id_sym1;
id++) {
354 idx.
set(
id) = idx0(
id) ;
359 idx.
set(
id) = idx0(
id-1) ;
364 idx.
set(
id) = idx0(
id-2) ;
Vectorial bases (triads) with respect to which the tensorial components are defined.
Basic integer array class.
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 ).
Cmp pow(const Cmp &, int)
Power .
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 fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
virtual void sauve(FILE *) const
Save in a binary file.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
virtual void operator=(const Tensor_sym &a)
Assignment to another Tensor_sym.
int get_valence() const
Returns the valence.
virtual void sauve(FILE *) const
Save in a binary file.
virtual int position(const Itbl &ind) const
Returns the position in the array cmp of a component given by its indices.
int id_sym1
Number of the first symmetric index (0<= id_sym1 < valence ).
Tensor(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i)
Standard constructor.
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...).
Tensor_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, int index_sym1, int index_sym2)
Standard constructor.
Scalar ** cmp
Array of size n_comp of pointers onto the components.
int id_sym2
Number of the second symmetric index (id_sym1 < id_sym2 < valence ).
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
int n_comp
Number of stored components, depending on the symmetry.
virtual void del_deriv() const
Deletes the derived quantities.
virtual int position(const Itbl &ind) const
Returns the position in the array cmp of a component given by its indices.
Itbl type_indice
1D array of integers (class Itbl ) of size valence containing the type of each index: COV for a cov...
virtual ~Tensor_sym()
Destructor.
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.