266 #include "base_vect.h" 411 Tensor(
const Map& map,
int val,
int tipe,
457 Tensor(
const Map& map,
int val,
const Itbl& tipe,
int n_comp_i,
474 Tensor(
const Map& map,
int val,
int tipe,
int n_comp_i,
589 Scalar&
set(
int i1,
int i2) ;
602 Scalar&
set(
int i1,
int i2,
int i3) ;
616 Scalar&
set(
int i1,
int i2,
int i3,
int i4) ;
636 virtual void annule(
int l_min,
int l_max) ;
680 double alpha= -16.) ;
687 double alpha= -16.) ;
694 double alpha= -16.) ;
992 virtual void sauve(FILE *)
const ;
1005 double threshold = 1.e-7,
int precision = 4,
1006 ostream& ostr = cout)
const ;
1008 friend ostream& operator<<(ostream& ,
const Tensor & ) ;
1090 const Base_vect& triad_i,
int index_sym1,
1107 int index_sym1,
int index_sym2) ;
1124 int index_sym1,
int index_sym2) ;
1208 virtual void sauve(FILE *)
const ;
1260 Tensor
operator*(
const Tensor& a,
const Tensor& b) ;
1264 Tensor_sym
operator*(
const Tensor& a,
const Tensor_sym& b) ;
1267 Tensor_sym
operator*(
const Tensor_sym& a,
const Tensor& b) ;
1277 Tensor_sym
operator*(
const Tensor_sym& a,
const Tensor_sym& b) ;
1299 Tensor
contract(
const Tensor& t1,
int ind1,
const Tensor& t2,
int ind2,
1300 bool desaliasing =
false) ;
1328 Tensor
contract(
const Tensor& t1,
int ind_i1,
int ind_j1,
1329 const Tensor& t2,
int ind_i2,
int ind_j2,
1330 bool desaliasing =
false) ;
1348 Tensor
contract(
const Tensor& t1,
int ind1,
int ind2) ;
1362 Tbl
max(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout) ;
1376 Tbl
min(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout) ;
1389 Tbl
maxabs(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout,
1407 Tbl
diffrel(
const Tensor& aa,
const Tensor& bb,
const char* comment = 0x0,
1408 ostream& ost = cout) ;
1424 Tbl
diffrelmax(
const Tensor& aa,
const Tensor& bb,
const char* comment = 0x0,
1425 ostream& ost = cout) ;
1437 Tbl
central_value(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout) ;
1451 Tbl
max_all_domains(
const Tensor& aa,
int l_excluded = -1,
const char* comment = 0x0,
1452 ostream& ost = cout) ;
1467 Tbl
min_all_domains(
const Tensor& aa,
int l_excluded = -1,
const char* comment = 0x0,
1468 ostream& ost = cout) ;
1482 Tbl
maxabs_all_domains(
const Tensor& aa,
int l_excluded = -1,
const char* comment = 0x0,
1483 ostream& ost = cout,
bool verb =
true) ;
1498 Tensor
operator+(
const Tensor& a,
const Tensor& b) ;
1501 Scalar
operator+(
const Tensor& a,
const Scalar& b) ;
1504 Scalar
operator+(
const Scalar& a,
const Tensor& b) ;
1506 Tensor
operator-(
const Tensor& a,
const Tensor& b) ;
1509 Scalar
operator-(
const Tensor& a,
const Scalar& b) ;
1512 Scalar
operator-(
const Scalar& a,
const Tensor& b) ;
1514 Tensor
operator*(
const Scalar& a ,
const Tensor& b) ;
1515 Tensor
operator*(
const Tensor& a,
const Scalar& b) ;
1516 Tensor
operator*(
double ,
const Tensor&) ;
1517 Tensor
operator* (
const Tensor&,
double) ;
1520 Tensor
operator/(
const Tensor&,
const Scalar&) ;
1521 Tensor
operator/(
const Tensor&,
double) ;
1533 Tensor_sym
operator+(
const Tensor_sym&) ;
1538 Tensor_sym
operator-(
const Tensor_sym&) ;
1544 Tensor_sym
operator+(
const Tensor_sym&,
const Tensor_sym&) ;
1550 Tensor_sym
operator-(
const Tensor_sym&,
const Tensor_sym&) ;
1555 Tensor_sym
operator*(
const Scalar& a,
const Tensor_sym& b) ;
1560 Tensor_sym
operator*(
const Tensor_sym& a,
const Scalar& b) ;
1565 Tensor_sym
operator*(
double,
const Tensor_sym&) ;
1570 Tensor_sym
operator*(
const Tensor_sym&,
double) ;
1575 Tensor_sym
operator*(
int,
const Tensor_sym&) ;
1580 Tensor_sym
operator*(
const Tensor_sym&,
int) ;
1585 Tensor_sym
operator/(
const Tensor_sym&,
const Scalar&) ;
1590 Tensor_sym
operator/(
const Tensor_sym&,
double) ;
1595 Tensor_sym
operator/(
const Tensor_sym&,
int) ;
1604 #include "sym_tensor.h" friend Tensor_sym operator*(const Tensor &, const Tensor_sym &)
Tensorial product with symmetries.
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Tbl maxabs(const Tensor &aa, const char *comment=0x0, ostream &ost=cout, bool verb=true)
Maxima in each domain of the absolute values of the tensor components.
Metric for tensor calculation.
virtual void set_etat_qcq()
Sets the logical state of all components to ETATQCQ (ordinary state).
virtual void sauve(FILE *) const
Save in a binary file.
Tbl min_all_domains(const Tensor &aa, int l_excluded=-1, const char *comment=0x0, ostream &ost=cout)
Minimum value of each component of a tensor over all the domains.
virtual void operator=(const Tensor &)
Assignment to a Tensor.
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 sym_index1() const
Number of the first symmetric index (0<= id_sym1 < valence )
Tbl central_value(const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
Central value of each component of a tensor.
virtual void del_derive_met(int) const
Logical destructor of the derivatives depending on the i-th element of met_depend ...
void set_dependance(const Metric &) const
To be used to describe the fact that the derivatives members have been calculated with met ...
Tensor up(int ind, const Metric &gam) const
Computes a new tensor by raising an index of *this.
Itbl & set_index_type()
Sets the types of all the indices.
Tensor derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
friend Tensor operator*(const Tensor &, const Tensor &)
Tensorial product.
Tensor field of valence 0 (or component of a tensorial field).
virtual void set_etat_nondef()
Sets the logical state of all components to ETATNONDEF (undefined state).
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
int id_sym2
Number of the second symmetric index (id_sym1 < id_sym2 < valence )
Base class for coordinate mappings.
int get_n_comp() const
Returns the number of stored components.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
Tensor up_down(const Metric &gam) const
Computes a new tensor by raising or lowering all the indices of *this .
const Tensor_sym & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
int sym_index2() const
Number of the second symmetric index (id_sym1 < id_sym2 < valence )
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.
virtual void std_spectral_base_odd()
Sets the standard odd spectal bases of decomposition for each component.
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Tensor_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, int index_sym1, int index_sym2)
Standard constructor.
int get_place_met(const Metric &) const
Returns the position of the pointer on metre in the array met_depend .
Tensor field of valence 1.
const Tensor_sym & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Vectorial bases (triads) with respect to which the tensorial components are defined.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
virtual void exponential_filter_ylm_phi(int lzmin, int lzmax, int p_r, int p_tet, int p_phi, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_ylm_phi )...
Tensor * p_derive_cov[N_MET_MAX]
Array of pointers on the covariant derivatives of this with respect to various metrics.
Scalar trace() const
Trace on two different type indices for a valence 2 tensor.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_r ).
void operator-=(const Tensor &)
-= Tensor
Itbl type_indice
1D array of integers (class Itbl ) of size valence containing the type of each index: COV for a cova...
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.
void compute_derive_lie(const Vector &v, Tensor &resu) const
Computes the Lie derivative of this with respect to some vector field v (protected method; the public...
Tbl maxabs_all_domains(const Tensor &aa, int l_excluded=-1, const char *comment=0x0, ostream &ost=cout, bool verb=true)
Maximum of the absolute value of each component of a tensor over all the domains. ...
Cmp operator+(const Cmp &)
Tbl max_all_domains(const Tensor &aa, int l_excluded=-1, const char *comment=0x0, ostream &ost=cout)
Maximum value of each component of a tensor over all the domains.
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
Itbl get_index_type() const
Returns the types of all the indices.
virtual void allocate_all()
Performs the memory allocation of all the elements, down to the double arrays of the Tbl s...
Scalar ** cmp
Array of size n_comp of pointers onto the components.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
virtual ~Tensor_sym()
Destructor.
Tensor * p_derive_con[N_MET_MAX]
Array of pointers on the contravariant derivatives of this with respect to various metrics...
int id_sym1
Number of the first symmetric index (0<= id_sym1 < valence )
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
int get_valence() const
Returns the valence.
int & set_index_type(int i)
Sets the type of the index number i .
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
virtual void del_deriv() const
Deletes the derived quantities.
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values in the compactified ext...
virtual void spectral_display(const char *comment=0x0, double threshold=1.e-7, int precision=4, ostream &ostr=cout) const
Displays the spectral coefficients and the associated basis functions of each component.
virtual ~Tensor()
Destructor.
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
Tensor * p_divergence[N_MET_MAX]
Array of pointers on the divergence of this with respect to various metrics.
void operator+=(const Tensor &)
+= Tensor
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_ylm )...
void set_der_met_0x0(int) const
Sets all the i-th components of met_depend , p_derive_cov , etc...
const Metric * met_depend[N_MET_MAX]
Array on the Metric 's which were used to compute derived quantities, like p_derive_cov ...
void annule_extern_cn(int l_0, int deg)
Performs a smooth (C^n) transition in a given domain to zero.
friend Scalar operator-(const Tensor &, const Scalar &)
Tensor - Scalar. The Tensor must be of valence 0.
friend Scalar operator+(const Tensor &, const Scalar &)
Tensor + Scalar. The Tensor must be of valence 0.
virtual int position(const Itbl &ind) const
Returns the position in the array cmp of a component given by its indices.
const Scalar & operator()(const Itbl &ind) const
Returns the value of a component (read-only version).
virtual void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
Cmp operator-(const Cmp &)
- Cmp
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
Symmetric tensors (with respect to two of their arguments).
void set_der_0x0() const
Sets the pointers on derived quantities to 0x0.
Tensor_sym derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
const Map & get_mp() const
Returns the mapping.
virtual void annule(int l_min, int l_max)
Sets the Tensor to zero in several domains.
virtual void std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
Class intended to describe valence-2 symmetric tensors.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
Tensor(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i)
Standard constructor.
Tensor down(int ind, const Metric &gam) const
Computes a new tensor by lowering an index of *this.