260#include "base_vect.h"
405 Tensor(
const Map& map,
int val,
int tipe,
451 Tensor(
const Map& map,
int val,
const Itbl& tipe,
int n_comp_i,
468 Tensor(
const Map& map,
int val,
int tipe,
int n_comp_i,
610 Scalar&
set(
int i1,
int i2,
int i3,
int i4) ;
630 virtual void annule(
int l_min,
int l_max) ;
674 double alpha= -16.) ;
681 double alpha= -16.) ;
979 virtual void sauve(FILE *)
const ;
992 double threshold = 1.e-7,
int precision = 4,
993 ostream& ostr = cout)
const ;
995 friend ostream& operator<<(ostream& ,
const Tensor & ) ;
1077 const Base_vect& triad_i,
int index_sym1,
1094 int index_sym1,
int index_sym2) ;
1111 int index_sym1,
int index_sym2) ;
1195 virtual void sauve(FILE *)
const ;
1248Tensor
operator*(
const Tensor& a,
const Tensor& b) ;
1251Tensor_sym
operator*(
const Tensor& a,
const Tensor_sym& b) ;
1254Tensor_sym
operator*(
const Tensor_sym& a,
const Tensor& b) ;
1264Tensor_sym
operator*(
const Tensor_sym& a,
const Tensor_sym& b) ;
1286Tensor
contract(
const Tensor& t1,
int ind1,
const Tensor& t2,
int ind2,
1287 bool desaliasing =
false) ;
1315Tensor
contract(
const Tensor& t1,
int ind_i1,
int ind_j1,
1316 const Tensor& t2,
int ind_i2,
int ind_j2,
1317 bool desaliasing =
false) ;
1335Tensor
contract(
const Tensor& t1,
int ind1,
int ind2) ;
1349Tbl
max(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout) ;
1363Tbl
min(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout) ;
1376Tbl
maxabs(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout,
1394Tbl
diffrel(
const Tensor& aa,
const Tensor& bb,
const char* comment = 0x0,
1395 ostream& ost = cout) ;
1411Tbl
diffrelmax(
const Tensor& aa,
const Tensor& bb,
const char* comment = 0x0,
1412 ostream& ost = cout) ;
1424Tbl
central_value(
const Tensor& aa,
const char* comment = 0x0, ostream& ost = cout) ;
1438Tbl
max_all_domains(
const Tensor& aa,
int l_excluded = -1,
const char* comment = 0x0,
1439 ostream& ost = cout) ;
1454Tbl
min_all_domains(
const Tensor& aa,
int l_excluded = -1,
const char* comment = 0x0,
1455 ostream& ost = cout) ;
1469Tbl
maxabs_all_domains(
const Tensor& aa,
int l_excluded = -1,
const char* comment = 0x0,
1470 ostream& ost = cout,
bool verb =
true) ;
1485Tensor
operator+(
const Tensor& a,
const Tensor& b) ;
1488Scalar
operator+(
const Tensor& a,
const Scalar& b) ;
1491Scalar
operator+(
const Scalar& a,
const Tensor& b) ;
1493Tensor
operator-(
const Tensor& a,
const Tensor& b) ;
1496Scalar
operator-(
const Tensor& a,
const Scalar& b) ;
1499Scalar
operator-(
const Scalar& a,
const Tensor& b) ;
1501Tensor
operator*(
const Scalar& a ,
const Tensor& b) ;
1502Tensor
operator*(
const Tensor& a,
const Scalar& b) ;
1503Tensor
operator*(
double ,
const Tensor&) ;
1504Tensor
operator* (
const Tensor&,
double) ;
1507Tensor
operator/(
const Tensor&,
const Scalar&) ;
1508Tensor
operator/(
const Tensor&,
double) ;
1520Tensor_sym
operator+(
const Tensor_sym&) ;
1525Tensor_sym
operator-(
const Tensor_sym&) ;
1531Tensor_sym
operator+(
const Tensor_sym&,
const Tensor_sym&) ;
1537Tensor_sym
operator-(
const Tensor_sym&,
const Tensor_sym&) ;
1542Tensor_sym
operator*(
const Scalar& a,
const Tensor_sym& b) ;
1547Tensor_sym
operator*(
const Tensor_sym& a,
const Scalar& b) ;
1552Tensor_sym
operator*(
double,
const Tensor_sym&) ;
1557Tensor_sym
operator*(
const Tensor_sym&,
double) ;
1562Tensor_sym
operator*(
int,
const Tensor_sym&) ;
1567Tensor_sym
operator*(
const Tensor_sym&,
int) ;
1572Tensor_sym
operator/(
const Tensor_sym&,
const Scalar&) ;
1577Tensor_sym
operator/(
const Tensor_sym&,
double) ;
1582Tensor_sym
operator/(
const Tensor_sym&,
int) ;
1591#include "sym_tensor.h"
Vectorial bases (triads) with respect to which the tensorial components are defined.
Basic integer array class.
int & set(int i)
Read/write of a particular element (index i ) (1D case)
Base class for coordinate mappings.
Metric for tensor calculation.
Tensor field of valence 0 (or component of a tensorial field).
Class intended to describe valence-2 symmetric tensors.
Symmetric tensors (with respect to two of their arguments).
Tensor field of valence 1.
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Cmp operator-(const Cmp &)
- Cmp
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Cmp operator+(const Cmp &)
Itbl & set_index_type()
Sets the types of all the indices.
Tensor_sym derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
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 ).
const Map & get_mp() const
Returns the mapping.
virtual void operator=(const Tensor &)
Assignment to a Tensor.
int sym_index1() const
Number of the first symmetric index (0<= id_sym1 < valence )
virtual void sauve(FILE *) const
Save in a binary file.
const Tensor_sym & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
virtual void del_derive_met(int) const
Logical destructor of the derivatives depending on the i-th element of met_depend .
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
friend Tensor operator*(const Tensor &, const Tensor &)
Tensorial product.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
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 .
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
virtual void allocate_all()
Performs the memory allocation of all the elements, down to the double arrays of the Tbl s.
virtual void std_spectral_base_odd()
Sets the standard odd spectal bases of decomposition for each component.
virtual void operator=(const Tensor_sym &a)
Assignment to another Tensor_sym.
Tensor * p_divergence[N_MET_MAX]
Array of pointers on the divergence of this with respect to various metrics.
Tensor up_down(const Metric &gam) const
Computes a new tensor by raising or lowering all the indices of *this .
void annule_extern_cn(int l_0, int deg)
Performs a smooth (C^n) transition in a given domain to zero.
int get_place_met(const Metric &) const
Returns the position of the pointer on metre in the array met_depend .
void set_der_0x0() const
Sets the pointers on derived quantities to 0x0.
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.
int sym_index2() const
Number of the second symmetric index (id_sym1 < id_sym2 < valence )
int get_valence() const
Returns the valence.
Scalar trace() const
Trace on two different type indices for a valence 2 tensor.
virtual void sauve(FILE *) const
Save in a binary file.
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
Tensor * p_derive_cov[N_MET_MAX]
Array of pointers on the covariant derivatives of this with respect to various metrics.
const Metric * met_depend[N_MET_MAX]
Array on the Metric 's which were used to compute derived quantities, like p_derive_cov ,...
friend Scalar operator-(const Tensor &, const Scalar &)
Tensor - Scalar. The Tensor must be of valence 0.
virtual void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
int & set_index_type(int i)
Sets the type of the index number i .
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 )
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
virtual void set_etat_nondef()
Sets the logical state of all components to ETATNONDEF (undefined state).
virtual void annule(int l_min, int l_max)
Sets the Tensor to zero in several domains.
virtual ~Tensor()
Destructor.
int get_n_comp() const
Returns the number of stored components.
Tensor down(int ind, const Metric &gam) const
Computes a new tensor by lowering an index of *this.
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values in the compactified ext...
const Scalar & operator()(const Itbl &ind) const
Returns the value of a component (read-only version).
void set_dependance(const Metric &) const
To be used to describe the fact that the derivatives members have been calculated with met .
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 )
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...
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.
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...
void operator-=(const Tensor &)
-= Tensor
Tensor derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
void set_der_met_0x0(int) const
Sets all the i-th components of met_depend , p_derive_cov , etc... to 0x0.
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
virtual void del_deriv() const
Deletes the derived quantities.
void operator+=(const Tensor &)
+= Tensor
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
virtual void set_etat_qcq()
Sets the logical state of all components to ETATQCQ (ordinary state).
virtual int position(const Itbl &ind) const
Returns the position in the array cmp of a component given by its indices.
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Tensor up(int ind, const Metric &gam) const
Computes a new tensor by raising an index of *this.
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.
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 ).
Tensor * p_derive_con[N_MET_MAX]
Array of pointers on the contravariant derivatives of this with respect to various metrics.
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Itbl get_index_type() const
Returns the types of all the indices.
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
virtual void std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
friend Scalar operator+(const Tensor &, const Scalar &)
Tensor + Scalar. The Tensor must be of valence 0.
friend Tensor_sym operator*(const Tensor &, const Tensor_sym &)
Tensorial product with symmetries.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
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.
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.
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.
Tbl central_value(const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
Central value of each component of a tensor.
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.