LORENE
Lorene::Tensor_sym Class Reference

Symmetric tensors (with respect to two of their arguments). More...

#include <tensor.h>

Inheritance diagram for Lorene::Tensor_sym:
Lorene::Tensor Lorene::Sym_tensor Lorene::Sym_tensor_trans Lorene::Sym_tensor_tt

Public Member Functions

 Tensor_sym (const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, int index_sym1, int index_sym2)
 Standard constructor. More...
 
 Tensor_sym (const Map &map, int val, int tipe, const Base_vect &triad_i, int index_sym1, int index_sym2)
 Standard constructor when all the indices are of the same type. More...
 
 Tensor_sym (const Map &map, int tipe0, int tipe1, int tipe2, const Base_vect &triad_i, int index_sym1, int index_sym2)
 Constructor for a valence 3 symmetric tensor. More...
 
 Tensor_sym (const Tensor_sym &a)
 Copy constructor. More...
 
 Tensor_sym (const Map &map, const Base_vect &triad_i, FILE *fich)
 Constructor from a file (see sauve(FILE*) ). More...
 
virtual ~Tensor_sym ()
 Destructor. More...
 
virtual void operator= (const Tensor_sym &a)
 Assignment to another Tensor_sym. More...
 
virtual void operator= (const Tensor &a)
 Assignment to a Tensor NB: the symmetry about the indices id_sym1 and id_sym2 of the input tensor is assumed but is not checked. More...
 
int sym_index1 () const
 Number of the first symmetric index (0<= id_sym1 < valence ) More...
 
int sym_index2 () const
 Number of the second symmetric index (id_sym1 < id_sym2 < valence ) More...
 
virtual int position (const Itbl &ind) const
 Returns the position in the array cmp of a component given by its indices. More...
 
virtual Itbl indices (int pos) const
 Returns the indices of a component given by its position in the array cmp . More...
 
virtual void sauve (FILE *) const
 Save in a binary file. More...
 
const Tensor_symderive_cov (const Metric &gam) const
 Returns the covariant derivative of this with respect to some metric $\gamma$. More...
 
const Tensor_symderive_con (const Metric &gam) const
 Returns the "contravariant" derivative of this with respect to some metric $\gamma$, by raising the last index of the covariant derivative (cf. More...
 
Tensor_sym derive_lie (const Vector &v) const
 Computes the Lie derivative of this with respect to some vector field v. More...
 
virtual void set_etat_nondef ()
 Sets the logical state of all components to ETATNONDEF
(undefined state). More...
 
virtual void set_etat_zero ()
 Sets the logical state of all components to ETATZERO
(zero state). More...
 
virtual void set_etat_qcq ()
 Sets the logical state of all components to ETATQCQ
(ordinary state). More...
 
virtual void allocate_all ()
 Performs the memory allocation of all the elements, down to the double arrays of the Tbl s. More...
 
virtual void change_triad (const Base_vect &new_triad)
 Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly. More...
 
void set_triad (const Base_vect &new_triad)
 Assigns a new vectorial basis (triad) of decomposition. More...
 
Scalarset (const Itbl &ind)
 Returns the value of a component (read/write version). More...
 
Scalarset (int i1, int i2)
 Returns the value of a component for a tensor of valence 2 (read/write version). More...
 
Scalarset (int i1, int i2, int i3)
 Returns the value of a component for a tensor of valence 3 (read/write version). More...
 
Scalarset (int i1, int i2, int i3, int i4)
 Returns the value of a component for a tensor of valence 4 (read/write version). More...
 
void annule_domain (int l)
 Sets the Tensor to zero in a given domain. More...
 
virtual void annule (int l_min, int l_max)
 Sets the Tensor to zero in several domains. More...
 
void annule_extern_cn (int l_0, int deg)
 Performs a smooth (C^n) transition in a given domain to zero. More...
 
virtual void std_spectral_base ()
 Sets the standard spectal bases of decomposition for each component. More...
 
virtual void std_spectral_base_odd ()
 Sets the standard odd spectal bases of decomposition for each component. More...
 
virtual void dec_dzpuis (int dec=1)
 Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified external domain (CED). More...
 
virtual void inc_dzpuis (int inc=1)
 Increases by inc units the value of dzpuis and changes accordingly the values in the compactified external domain (CED). More...
 
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 ). More...
 
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 ). More...
 
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 ). More...
 
const Tensordivergence (const Metric &gam) const
 Computes the divergence of this with respect to some metric $\gamma$. More...
 
Tensor up (int ind, const Metric &gam) const
 Computes a new tensor by raising an index of *this. More...
 
Tensor down (int ind, const Metric &gam) const
 Computes a new tensor by lowering an index of *this. More...
 
Tensor up_down (const Metric &gam) const
 Computes a new tensor by raising or lowering all the indices of *this . More...
 
Tensor trace (int ind1, int ind2) const
 Trace on two different type indices. More...
 
Tensor trace (int ind1, int ind2, const Metric &gam) const
 Trace with respect to a given metric. More...
 
Scalar trace () const
 Trace on two different type indices for a valence 2 tensor. More...
 
Scalar trace (const Metric &gam) const
 Trace with respect to a given metric for a valence 2 tensor. More...
 
const Mapget_mp () const
 Returns the mapping. More...
 
const Base_vectget_triad () const
 Returns the vectorial basis (triad) on which the components are defined. More...
 
int get_valence () const
 Returns the valence. More...
 
int get_n_comp () const
 Returns the number of stored components. More...
 
int get_index_type (int i) const
 Gives the type (covariant or contravariant) of the index number i . More...
 
Itbl get_index_type () const
 Returns the types of all the indices. More...
 
int & set_index_type (int i)
 Sets the type of the index number i . More...
 
Itblset_index_type ()
 Sets the types of all the indices. More...
 
const Scalaroperator() (const Itbl &ind) const
 Returns the value of a component (read-only version). More...
 
const Scalaroperator() (int i1, int i2) const
 Returns the value of a component for a tensor of valence 2 (read-only version). More...
 
const Scalaroperator() (int i1, int i2, int i3) const
 Returns the value of a component for a tensor of valence 3 (read-only version). More...
 
const Scalaroperator() (int i1, int i2, int i3, int i4) const
 Returns the value of a component for a tensor of valence 4 (read-only version). More...
 
void operator+= (const Tensor &)
 += Tensor More...
 
void operator-= (const Tensor &)
 -= Tensor More...
 
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. More...
 

Protected Member Functions

virtual void del_deriv () const
 Deletes the derived quantities. More...
 
void set_der_0x0 () const
 Sets the pointers on derived quantities to 0x0. More...
 
virtual void del_derive_met (int) const
 Logical destructor of the derivatives depending on the i-th element of met_depend . More...
 
void set_der_met_0x0 (int) const
 Sets all the i-th components of met_depend , p_derive_cov , etc... More...
 
void set_dependance (const Metric &) const
 To be used to describe the fact that the derivatives members have been calculated with met . More...
 
int get_place_met (const Metric &) const
 Returns the position of the pointer on metre in the array met_depend . More...
 
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 interface is method derive_lie ). More...
 

Protected Attributes

int id_sym1
 Number of the first symmetric index (0<= id_sym1 < valence ) More...
 
int id_sym2
 Number of the second symmetric index (id_sym1 < id_sym2 < valence ) More...
 
const Map *const mp
 Mapping on which the numerical values at the grid points are defined. More...
 
int valence
 Valence of the tensor (0 = scalar, 1 = vector, etc...) More...
 
const Base_vecttriad
 Vectorial basis (triad) with respect to which the tensor components are defined. More...
 
Itbl type_indice
 1D array of integers (class Itbl ) of size valence
containing the type of each index: COV for a covariant one and CON for a contravariant one. More...
 
int n_comp
 Number of stored components, depending on the symmetry. More...
 
Scalar ** cmp
 Array of size n_comp of pointers onto the components. More...
 
const Metricmet_depend [N_MET_MAX]
 Array on the Metric 's which were used to compute derived quantities, like p_derive_cov , etc... More...
 
Tensorp_derive_cov [N_MET_MAX]
 Array of pointers on the covariant derivatives of this with respect to various metrics. More...
 
Tensorp_derive_con [N_MET_MAX]
 Array of pointers on the contravariant derivatives of this with respect to various metrics. More...
 
Tensorp_divergence [N_MET_MAX]
 Array of pointers on the divergence of this with respect to various metrics. More...
 

Friends

Tensor_sym operator* (const Tensor &, const Tensor_sym &)
 Tensorial product with symmetries. More...
 
Tensor_sym operator* (const Tensor_sym &, const Tensor &)
 Tensorial product with symmetries. More...
 

Detailed Description

Symmetric tensors (with respect to two of their arguments).

This subclass of Tensor is intended to store the components of a tensorial field with respect to a specific basis (triad), in the case the tensor has a valence at least 2 and is symmetric with respect to two of its arguments (or in other words, the components are symmetric with respect to two of their indices).
()

Definition at line 1050 of file tensor.h.

Constructor & Destructor Documentation

◆ Tensor_sym() [1/5]

Lorene::Tensor_sym::Tensor_sym ( const Map map,
int  val,
const Itbl tipe,
const Base_vect triad_i,
int  index_sym1,
int  index_sym2 
)

Standard constructor.

Parameters
mapthe mapping
valvalence of the tensor (must be at least 2)
tipe1-D array of integers (class Itbl ) of size valence containing the type of each index, COV for a covariant one and CON for a contravariant one, with the following storage convention:
  • tipe(0) : type of the first index
  • tipe(1) : type of the second index
  • and so on...
triad_ivectorial basis (triad) with respect to which the tensor components are defined
index_sym1number of the first symmetric index (0<= index_sym1 < valence )
index_sym2number of the second symmetric index (index_sym1 < index_sym2 < valence )

Definition at line 72 of file tensor_sym.C.

References id_sym1, id_sym2, and Lorene::Tensor::valence.

◆ Tensor_sym() [2/5]

Lorene::Tensor_sym::Tensor_sym ( const Map map,
int  val,
int  tipe,
const Base_vect triad_i,
int  index_sym1,
int  index_sym2 
)

Standard constructor when all the indices are of the same type.

Parameters
mapthe mapping
valvalence of the tensor (must be at least 2)
tipethe type (COV or CON ) of the indices.
triad_ivectorial basis (triad) with respect to which the tensor components are defined.
index_sym1number of the first symmetric index (0<= index_sym1 < valence )
index_sym2number of the second symmetric index (index_sym1 < index_sym2 < valence )

Definition at line 100 of file tensor_sym.C.

References id_sym1, id_sym2, and Lorene::Tensor::valence.

◆ Tensor_sym() [3/5]

Lorene::Tensor_sym::Tensor_sym ( const Map map,
int  tipe0,
int  tipe1,
int  tipe2,
const Base_vect triad_i,
int  index_sym1,
int  index_sym2 
)

Constructor for a valence 3 symmetric tensor.

Parameters
mapthe mapping
tipe0type (COV or CON ) of the first index.
tipe1type (COV or CON ) of the second index.
tipe2type (COV or CON ) of the third index.
triad_ivectorial basis (triad) with respect to which the tensor components are defined.
index_sym1number of the first symmetric index (0<= index_sym1 <=2 )
index_sym2number of the second symmetric index (index_sym1 < index_sym2 <=2 )

Definition at line 123 of file tensor_sym.C.

References id_sym1, id_sym2, Lorene::Itbl::set(), and Lorene::Tensor::type_indice.

◆ Tensor_sym() [4/5]

Lorene::Tensor_sym::Tensor_sym ( const Tensor_sym a)

Copy constructor.

Definition at line 155 of file tensor_sym.C.

References Lorene::Tensor::cmp, indices(), Lorene::Tensor::n_comp, and position().

◆ Tensor_sym() [5/5]

Lorene::Tensor_sym::Tensor_sym ( const Map map,
const Base_vect triad_i,
FILE *  fich 
)

Constructor from a file (see sauve(FILE*) ).

Parameters
mapthe mapping
triad_ivectorial basis (triad) with respect to which the tensor components are defined. It will be checked that it coincides with the basis saved in the file.
fichfile which has been created by the function sauve(FILE*).

Definition at line 177 of file tensor_sym.C.

References Lorene::fread_be(), id_sym1, id_sym2, and Lorene::Tensor::type_indice.

◆ ~Tensor_sym()

Lorene::Tensor_sym::~Tensor_sym ( )
virtual

Destructor.

Definition at line 192 of file tensor_sym.C.

Member Function Documentation

◆ allocate_all()

void Lorene::Tensor::allocate_all ( )
virtualinherited

Performs the memory allocation of all the elements, down to the double arrays of the Tbl s.

This function performs in fact recursive calls to set_etat_qcq() on each element of the chain Scalar -> Valeur -> Mtbl -> Tbl .

Reimplemented in Lorene::Scalar.

Definition at line 517 of file tensor.C.

References Lorene::Scalar::allocate_all(), Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), and Lorene::Tensor::n_comp.

◆ annule()

void Lorene::Tensor::annule ( int  l_min,
int  l_max 
)
virtualinherited

Sets the Tensor to zero in several domains.

Parameters
l_min[input] The Tensor will be set (logically) to zero in the domains whose indices are in the range [l_min,l_max] .
l_max[input] see the comments for l_min .

Note that annule(0,nz-1) , where nz is the total number of domains, is equivalent to set_etat_zero() .

Reimplemented in Lorene::Scalar.

Definition at line 680 of file tensor.C.

References Lorene::Scalar::annule(), Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Map::get_mg(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::mp, Lorene::Tensor::n_comp, and Lorene::Tensor::set_etat_zero().

◆ annule_domain()

void Lorene::Tensor::annule_domain ( int  l)
inherited

Sets the Tensor to zero in a given domain.

Parameters
l[input] Index of the domain in which the Tensor will be set (logically) to zero.

Definition at line 675 of file tensor.C.

References Lorene::Tensor::annule().

◆ annule_extern_cn()

void Lorene::Tensor::annule_extern_cn ( int  l_0,
int  deg 
)
inherited

Performs a smooth (C^n) transition in a given domain to zero.

Parameters
l_0[input] in the domain of index l0 the tensor is multiplied by the right polynomial (of degree 2n+1), to ensure continuty of the function and its n first derivative at both ends of this domain. The tensor is unchanged in the domains l < l_0 and set to zero in domains l > l_0.
deg[input] the degree n of smoothness of the transition.

Definition at line 699 of file tensor.C.

References Lorene::Map::get_mg(), Lorene::Mg3d::get_type_r(), and Lorene::Tensor::mp.

◆ change_triad()

◆ compute_derive_lie()

void Lorene::Tensor::compute_derive_lie ( const Vector v,
Tensor resu 
) const
protectedinherited

◆ dec_dzpuis()

void Lorene::Tensor::dec_dzpuis ( int  dec = 1)
virtualinherited

Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified external domain (CED).

Reimplemented in Lorene::Scalar.

Definition at line 817 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), and Lorene::Tensor::n_comp.

◆ del_deriv()

void Lorene::Tensor::del_deriv ( ) const
protectedvirtualinherited

◆ del_derive_met()

void Lorene::Tensor::del_derive_met ( int  j) const
protectedvirtualinherited

Logical destructor of the derivatives depending on the i-th element of met_depend .

Reimplemented in Lorene::Sym_tensor, and Lorene::Vector.

Definition at line 423 of file tensor.C.

References Lorene::Tensor::met_depend, Lorene::Tensor::p_derive_con, Lorene::Tensor::p_derive_cov, Lorene::Tensor::p_divergence, Lorene::Tensor::set_der_met_0x0(), and Lorene::Metric::tensor_depend.

◆ derive_con()

const Tensor_sym & Lorene::Tensor_sym::derive_con ( const Metric gam) const

Returns the "contravariant" derivative of this with respect to some metric $\gamma$, by raising the last index of the covariant derivative (cf.

method derive_cov() ) with $\gamma$.

Definition at line 207 of file tensor_sym_calculus.C.

References Lorene::Tensor::derive_con().

◆ derive_cov()

const Tensor_sym & Lorene::Tensor_sym::derive_cov ( const Metric gam) const

Returns the covariant derivative of this with respect to some metric $\gamma$.

$T$ denoting the tensor represented by this and $\nabla T$ its covariant derivative with respect to the metric $\gamma$, the extra index (with respect to the indices of $T$) of $\nabla T$ is chosen to be the last one. This convention agrees with that of MTW (see Eq. (10.17) of MTW).

Parameters
gammetric $\gamma$
Returns
covariant derivative $\nabla T$ of this with respect to the connection $\nabla$ associated with the metric $\gamma$

Definition at line 195 of file tensor_sym_calculus.C.

References Lorene::Tensor::derive_cov().

◆ derive_lie()

Tensor_sym Lorene::Tensor_sym::derive_lie ( const Vector v) const

Computes the Lie derivative of this with respect to some vector field v.

Definition at line 222 of file tensor_sym_calculus.C.

References Lorene::Tensor::compute_derive_lie(), id_sym1, id_sym2, Lorene::Tensor::mp, Lorene::Tensor::triad, Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ divergence()

const Tensor & Lorene::Tensor::divergence ( const Metric gam) const
inherited

Computes the divergence of this with respect to some metric $\gamma$.

The divergence is taken with respect of the last index of this which thus must be contravariant. For instance if the tensor $T$ represented by this is a twice contravariant tensor, whose components w.r.t. the triad $e_i$ are $T^{ij}$: $T = T^{ij} \; e_i \otimes e_j$, the divergence of $T$ w.r.t. $\gamma$ is the vector

\[ {\rm div}\, T = \nabla_k T^{ik} \; e_i \]

where $\nabla$ denotes the connection associated with the metric $\gamma$.

Parameters
gammetric $\gamma$
Returns
divergence of this with respect to $\gamma$.

Definition at line 1064 of file tensor.C.

References Lorene::Metric::connect(), Lorene::Tensor::get_place_met(), Lorene::Connection::p_divergence(), Lorene::Tensor::p_divergence, and Lorene::Tensor::set_dependance().

◆ down()

Tensor Lorene::Tensor::down ( int  ind,
const Metric gam 
) const
inherited

Computes a new tensor by lowering an index of *this.

Parameters
indindex to be lowered, with the following convention :
  • ind1 = 0 : first index of the tensor
  • ind1 = 1 : second index of the tensor
  • and so on... (ind must be of covariant type (CON )).
gammetric used to lower the index (contraction with the twice covariant form of the metric on the index ind ).

Definition at line 268 of file tensor_calculus.C.

References Lorene::contract(), Lorene::Metric::cov(), Lorene::Tensor::indices(), Lorene::Tensor::mp, Lorene::Tensor::n_comp, Lorene::Itbl::set(), Lorene::Tensor::set(), Lorene::Tensor::triad, Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ exponential_filter_r()

void Lorene::Tensor::exponential_filter_r ( int  lzmin,
int  lzmax,
int  p,
double  alpha = -16. 
)
virtualinherited

Applies exponential filters to all components (see Scalar::exponential_filter_r ).

Works only for Cartesian components.

Reimplemented in Lorene::Scalar, Lorene::Sym_tensor, and Lorene::Vector.

Definition at line 1075 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Map::get_bvect_cart(), Lorene::Base_vect::identify(), Lorene::Tensor::mp, Lorene::Tensor::n_comp, and Lorene::Tensor::triad.

◆ exponential_filter_ylm()

void Lorene::Tensor::exponential_filter_ylm ( int  lzmin,
int  lzmax,
int  p,
double  alpha = -16. 
)
virtualinherited

Applies exponential filters to all components (see Scalar::exponential_filter_ylm ).

Works only for Cartesian components.

Reimplemented in Lorene::Scalar, Lorene::Sym_tensor, and Lorene::Vector.

Definition at line 1088 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Map::get_bvect_cart(), Lorene::Base_vect::identify(), Lorene::Tensor::mp, Lorene::Tensor::n_comp, and Lorene::Tensor::triad.

◆ exponential_filter_ylm_phi()

void Lorene::Tensor::exponential_filter_ylm_phi ( int  lzmin,
int  lzmax,
int  p_r,
int  p_tet,
int  p_phi,
double  alpha = -16. 
)
virtualinherited

Applies exponential filters to all components (see Scalar::exponential_filter_ylm_phi ).

Works only for Cartesian components.

Reimplemented in Lorene::Scalar.

Definition at line 1101 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Map::get_bvect_cart(), Lorene::Base_vect::identify(), Lorene::Tensor::mp, Lorene::Tensor::n_comp, and Lorene::Tensor::triad.

◆ get_index_type() [1/2]

int Lorene::Tensor::get_index_type ( int  i) const
inlineinherited

Gives the type (covariant or contravariant) of the index number i .

i must be strictly lower than valence and obey the following convention:

  • i = 0 : first index
  • i = 1 : second index
  • and so on...
Returns
COV for a covariant index, CON for a contravariant one.

Definition at line 899 of file tensor.h.

References Lorene::Tensor::type_indice.

◆ get_index_type() [2/2]

Itbl Lorene::Tensor::get_index_type ( ) const
inlineinherited

Returns the types of all the indices.

Returns
1-D array of integers (class Itbl ) of size valence
containing the type of each index, COV for a covariant one and CON
for a contravariant one.

Definition at line 909 of file tensor.h.

References Lorene::Tensor::type_indice.

◆ get_mp()

const Map& Lorene::Tensor::get_mp ( ) const
inlineinherited

Returns the mapping.

Definition at line 874 of file tensor.h.

References Lorene::Tensor::mp.

◆ get_n_comp()

int Lorene::Tensor::get_n_comp ( ) const
inlineinherited

Returns the number of stored components.

Definition at line 885 of file tensor.h.

References Lorene::Tensor::n_comp.

◆ get_place_met()

int Lorene::Tensor::get_place_met ( const Metric metre) const
protectedinherited

Returns the position of the pointer on metre in the array met_depend .

Definition at line 452 of file tensor.C.

References Lorene::Tensor::met_depend.

◆ get_triad()

const Base_vect* Lorene::Tensor::get_triad ( ) const
inlineinherited

Returns the vectorial basis (triad) on which the components are defined.

Definition at line 879 of file tensor.h.

References Lorene::Tensor::triad.

◆ get_valence()

int Lorene::Tensor::get_valence ( ) const
inlineinherited

Returns the valence.

Definition at line 882 of file tensor.h.

References Lorene::Tensor::valence.

◆ inc_dzpuis()

void Lorene::Tensor::inc_dzpuis ( int  inc = 1)
virtualinherited

Increases by inc units the value of dzpuis and changes accordingly the values in the compactified external domain (CED).

Reimplemented in Lorene::Scalar.

Definition at line 825 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), and Lorene::Tensor::n_comp.

◆ indices()

Itbl Lorene::Tensor_sym::indices ( int  pos) const
virtual

Returns the indices of a component given by its position in the array cmp .

Parameters
pos[input] position in the array cmp of the pointer to the Scalar representing a component
Returns
1-D array of integers (class Itbl ) of size valence giving the value of each index for the component located at the position pos in the array cmp, with the following storage convention:
  • Itbl(0) : value of the first index (1, 2 or 3)
  • Itbl(1) : value of the second index (1, 2 or 3)
  • and so on...

Reimplemented from Lorene::Tensor.

Definition at line 313 of file tensor_sym.C.

References id_sym1, id_sym2, Lorene::Tensor::n_comp, Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ operator()() [1/4]

const Scalar & Lorene::Tensor::operator() ( const Itbl ind) const
inherited

Returns the value of a component (read-only version).

Parameters
ind1-D Itbl of size valence containing the values of each index specifing the component, with the following storage convention:
  • ind(0) : value of the first index (1, 2 or 3)
  • ind(1) : value of the second index (1, 2 or 3)
  • and so on...
Returns
reference on the component specified by ind

Definition at line 807 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Itbl::get_dim(), Lorene::Itbl::get_ndim(), Lorene::Tensor::position(), and Lorene::Tensor::valence.

◆ operator()() [2/4]

const Scalar & Lorene::Tensor::operator() ( int  i1,
int  i2 
) const
inherited

Returns the value of a component for a tensor of valence 2 (read-only version).

Parameters
i1value of the first index (1, 2 or 3)
i2value of the second index (1, 2 or 3)
Returns
reference on the component specified by (i1,i2)

Definition at line 769 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::position(), Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ operator()() [3/4]

const Scalar & Lorene::Tensor::operator() ( int  i1,
int  i2,
int  i3 
) const
inherited

Returns the value of a component for a tensor of valence 3 (read-only version).

Parameters
i1value of the first index (1, 2 or 3)
i2value of the second index (1, 2 or 3)
i3value of the third index (1, 2 or 3)
Returns
reference on the component specified by (i1,i2,i3)

Definition at line 780 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::position(), Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ operator()() [4/4]

const Scalar & Lorene::Tensor::operator() ( int  i1,
int  i2,
int  i3,
int  i4 
) const
inherited

Returns the value of a component for a tensor of valence 4 (read-only version).

Parameters
i1value of the first index (1, 2 or 3)
i2value of the second index (1, 2 or 3)
i3value of the third index (1, 2 or 3)
i4value of the fourth index (1, 2 or 3)
Returns
reference on the component specified by (i1,i2,i3,i4)

Definition at line 792 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::position(), Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ operator+=()

◆ operator-=()

◆ operator=() [1/2]

◆ operator=() [2/2]

void Lorene::Tensor_sym::operator= ( const Tensor a)
virtual

Assignment to a Tensor NB: the symmetry about the indices id_sym1 and id_sym2 of the input tensor is assumed but is not checked.

Reimplemented from Lorene::Tensor.

Reimplemented in Lorene::Sym_tensor_tt, Lorene::Sym_tensor_trans, and Lorene::Sym_tensor.

Definition at line 221 of file tensor_sym.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), id_sym1, id_sym2, indices(), Lorene::Tensor::n_comp, Lorene::Tensor::position(), Lorene::Tensor::triad, Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ position()

int Lorene::Tensor_sym::position ( const Itbl ind) const
virtual

Returns the position in the array cmp of a component given by its indices.

Parameters
ind[input] 1-D array of integers (class Itbl ) of size valence giving the values of each index specifing the component, with the following storage convention:
  • ind(0) : value of the first index (1, 2 or 3)
  • ind(1) : value of the second index (1, 2 or 3)
  • and so on...
Returns
position in the array cmp of the pointer to the Scalar containing the component specified by ind

Reimplemented from Lorene::Tensor.

Definition at line 248 of file tensor_sym.C.

References Lorene::Itbl::get_dim(), Lorene::Itbl::get_ndim(), id_sym1, id_sym2, Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ sauve()

void Lorene::Tensor_sym::sauve ( FILE *  fd) const
virtual

Save in a binary file.

Reimplemented from Lorene::Tensor.

Definition at line 375 of file tensor_sym.C.

References Lorene::fwrite_be(), id_sym1, id_sym2, and Lorene::Tensor::sauve().

◆ set() [1/4]

Scalar & Lorene::Tensor::set ( const Itbl ind)
inherited

Returns the value of a component (read/write version).

Parameters
ind1-D Itbl of size valence containing the values of each index specifing the component, with the following storage convention:
  • ind(0) : value of the first index (1, 2 or 3)
  • ind(1) : value of the second index (1, 2 or 3)
  • and so on...
Returns
modifiable reference on the component specified by ind

Definition at line 663 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Itbl::get_dim(), Lorene::Itbl::get_ndim(), Lorene::Tensor::position(), and Lorene::Tensor::valence.

◆ set() [2/4]

Scalar & Lorene::Tensor::set ( int  i1,
int  i2 
)
inherited

Returns the value of a component for a tensor of valence 2 (read/write version).

Parameters
i1value of the first index (1, 2 or 3)
i2value of the second index (1, 2 or 3)
Returns
modifiable reference on the component specified by (i1,i2)

Definition at line 615 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::position(), Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ set() [3/4]

Scalar & Lorene::Tensor::set ( int  i1,
int  i2,
int  i3 
)
inherited

Returns the value of a component for a tensor of valence 3 (read/write version).

Parameters
i1value of the first index (1, 2 or 3)
i2value of the second index (1, 2 or 3)
i3value of the third index (1, 2 or 3)
Returns
modifiable reference on the component specified by (i1,i2,i3)

Definition at line 630 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::position(), Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ set() [4/4]

Scalar & Lorene::Tensor::set ( int  i1,
int  i2,
int  i3,
int  i4 
)
inherited

Returns the value of a component for a tensor of valence 4 (read/write version).

Parameters
i1value of the first index (1, 2 or 3)
i2value of the second index (1, 2 or 3)
i3value of the third index (1, 2 or 3)
i4value of the fourth index (1, 2 or 3)
Returns
modifiable reference on the component specified by (i1,i2,i3,i4)

Definition at line 646 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::position(), Lorene::Itbl::set(), and Lorene::Tensor::valence.

◆ set_dependance()

void Lorene::Tensor::set_dependance ( const Metric met) const
protectedinherited

To be used to describe the fact that the derivatives members have been calculated with met .

First it sets a null element of met_depend to &met and puts this in the list of the dependancies of met .

Definition at line 462 of file tensor.C.

References Lorene::Tensor::met_depend, and Lorene::Metric::tensor_depend.

◆ set_der_0x0()

void Lorene::Tensor::set_der_0x0 ( ) const
protectedinherited

Sets the pointers on derived quantities to 0x0.

Definition at line 416 of file tensor.C.

References Lorene::Tensor::set_der_met_0x0().

◆ set_der_met_0x0()

void Lorene::Tensor::set_der_met_0x0 ( int  i) const
protectedinherited

Sets all the i-th components of met_depend , p_derive_cov , etc...

to 0x0.

Definition at line 442 of file tensor.C.

References Lorene::Tensor::met_depend, Lorene::Tensor::p_derive_con, Lorene::Tensor::p_derive_cov, and Lorene::Tensor::p_divergence.

◆ set_etat_nondef()

void Lorene::Tensor::set_etat_nondef ( )
virtualinherited

Sets the logical state of all components to ETATNONDEF
(undefined state).

Reimplemented in Lorene::Scalar.

Definition at line 498 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::n_comp, and Lorene::Scalar::set_etat_nondef().

◆ set_etat_qcq()

void Lorene::Tensor::set_etat_qcq ( )
virtualinherited

Sets the logical state of all components to ETATQCQ
(ordinary state).

Reimplemented in Lorene::Scalar.

Definition at line 490 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::n_comp, and Lorene::Scalar::set_etat_qcq().

◆ set_etat_zero()

void Lorene::Tensor::set_etat_zero ( )
virtualinherited

Sets the logical state of all components to ETATZERO
(zero state).

Reimplemented in Lorene::Scalar.

Definition at line 506 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::del_deriv(), Lorene::Tensor::n_comp, and Lorene::Scalar::set_etat_zero().

◆ set_index_type() [1/2]

int& Lorene::Tensor::set_index_type ( int  i)
inlineinherited

Sets the type of the index number i .

i must be strictly lower than valence and obey the following convention:

  • i = 0 : first index
  • i = 1 : second index
  • and so on...
Returns
reference on the type that can be modified (COV for a covariant index, CON for a contravariant one)

Definition at line 922 of file tensor.h.

References Lorene::Itbl::set(), and Lorene::Tensor::type_indice.

◆ set_index_type() [2/2]

Itbl& Lorene::Tensor::set_index_type ( )
inlineinherited

Sets the types of all the indices.

Returns
a reference on the 1-D array of integers (class Itbl ) of size valence that can be modified (COV for a covariant one and CON for a contravariant one)

Definition at line 931 of file tensor.h.

References Lorene::Tensor::type_indice.

◆ set_triad()

void Lorene::Tensor::set_triad ( const Base_vect new_triad)
inherited

Assigns a new vectorial basis (triad) of decomposition.

NB: this function modifies only the member triad and leave unchanged the components (member cmp ). In order to change them coherently with the new basis, the function change_triad(const Base_vect& ) must be called instead.

Definition at line 528 of file tensor.C.

References Lorene::Tensor::triad.

◆ spectral_display()

void Lorene::Tensor::spectral_display ( const char *  comment = 0x0,
double  threshold = 1.e-7,
int  precision = 4,
ostream &  ostr = cout 
) const
virtualinherited

Displays the spectral coefficients and the associated basis functions of each component.

This function shows only the values greater than a given threshold.

Parameters
commentcomment to be printed at top of the display (default: 0x0 = nothing printed)
threshold[input] Value above which a coefficient is printed (default: 1.e-7)
precision[input] Number of printed digits (default: 4)
ostr[input] Output stream used for the printing (default: cout)

Reimplemented in Lorene::Scalar.

Definition at line 883 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Tensor::indices(), Lorene::Tensor::n_comp, Lorene::Scalar::spectral_display(), and Lorene::Tensor::valence.

◆ std_spectral_base()

void Lorene::Tensor::std_spectral_base ( )
virtualinherited

◆ std_spectral_base_odd()

void Lorene::Tensor::std_spectral_base_odd ( )
virtualinherited

Sets the standard odd spectal bases of decomposition for each component.

Currently only implemented for a scalar.

Reimplemented in Lorene::Scalar.

Definition at line 991 of file tensor.C.

References Lorene::Tensor::cmp, Lorene::Scalar::std_spectral_base_odd(), and Lorene::Tensor::valence.

◆ sym_index1()

int Lorene::Tensor_sym::sym_index1 ( ) const
inline

Number of the first symmetric index (0<= id_sym1 < valence )

Definition at line 1162 of file tensor.h.

References id_sym1.

◆ sym_index2()

int Lorene::Tensor_sym::sym_index2 ( ) const
inline

Number of the second symmetric index (id_sym1 < id_sym2 < valence )

Definition at line 1167 of file tensor.h.

References id_sym2.

◆ trace() [1/4]

Tensor Lorene::Tensor::trace ( int  ind1,
int  ind2 
) const
inherited

Trace on two different type indices.

Parameters
ind1first index for the contraction, with the following convention :
  • ind1 = 0 : first index of the tensor
  • ind1 = 1 : second index of the tensor
  • and so on...
ind2second index for the contraction

Definition at line 97 of file tensor_calculus.C.

References Lorene::Tensor::cmp, Lorene::Tensor::get_n_comp(), Lorene::Tensor::indices(), Lorene::Tensor::mp, Lorene::Tensor::position(), Lorene::Itbl::set(), Lorene::Tensor::set(), Lorene::Scalar::set_etat_zero(), Lorene::Tensor::triad, Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ trace() [2/4]

Tensor Lorene::Tensor::trace ( int  ind1,
int  ind2,
const Metric gam 
) const
inherited

Trace with respect to a given metric.

Parameters
ind1first index for the contraction, with the following convention :
  • ind1 = 0 : first index of the tensor
  • ind1 = 1 : second index of the tensor
  • and so on...
ind2second index for the contraction
gammetric used to raise or lower ind1 in order that it has a opposite type than ind2

Definition at line 156 of file tensor_calculus.C.

References Lorene::Metric::con(), Lorene::contract(), Lorene::Metric::cov(), Lorene::Tensor::trace(), Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ trace() [3/4]

Scalar Lorene::Tensor::trace ( ) const
inherited

Trace on two different type indices for a valence 2 tensor.

Definition at line 183 of file tensor_calculus.C.

References Lorene::Tensor::mp, Lorene::Tensor::operator()(), Lorene::Scalar::set_etat_zero(), Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ trace() [4/4]

Scalar Lorene::Tensor::trace ( const Metric gam) const
inherited

Trace with respect to a given metric for a valence 2 tensor.

Parameters
gammetric used to raise or lower one of the indices, in order to take the trace

Definition at line 200 of file tensor_calculus.C.

References Lorene::Metric::con(), Lorene::contract(), Lorene::Metric::cov(), Lorene::Tensor::trace(), Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ up()

Tensor Lorene::Tensor::up ( int  ind,
const Metric gam 
) const
inherited

Computes a new tensor by raising an index of *this.

Parameters
indindex to be raised, with the following convention :
  • ind1 = 0 : first index of the tensor
  • ind1 = 1 : second index of the tensor
  • and so on... (ind must be of covariant type (COV )).
gammetric used to raise the index (contraction with the twice contravariant form of the metric on the index ind ).

Definition at line 228 of file tensor_calculus.C.

References Lorene::Metric::con(), Lorene::contract(), Lorene::Tensor::indices(), Lorene::Tensor::mp, Lorene::Tensor::n_comp, Lorene::Itbl::set(), Lorene::Tensor::set(), Lorene::Tensor::triad, Lorene::Tensor::type_indice, and Lorene::Tensor::valence.

◆ up_down()

Tensor Lorene::Tensor::up_down ( const Metric gam) const
inherited

Computes a new tensor by raising or lowering all the indices of *this .

Parameters
gammetric used to lower the contravariant indices and raising the covariant ones.

Definition at line 308 of file tensor_calculus.C.

References Lorene::Tensor::down(), Lorene::Tensor::Tensor(), Lorene::Tensor::type_indice, Lorene::Tensor::up(), and Lorene::Tensor::valence.

Friends And Related Function Documentation

◆ operator* [1/2]

Tensor_sym operator* ( const Tensor a,
const Tensor_sym b 
)
friend

Tensorial product with symmetries.

Definition at line 111 of file tensor_sym_calculus.C.

◆ operator* [2/2]

Tensor_sym operator* ( const Tensor_sym a,
const Tensor b 
)
friend

Tensorial product with symmetries.

Definition at line 71 of file tensor_sym_calculus.C.

Member Data Documentation

◆ cmp

Scalar** Lorene::Tensor::cmp
protectedinherited

Array of size n_comp of pointers onto the components.

Definition at line 321 of file tensor.h.

◆ id_sym1

int Lorene::Tensor_sym::id_sym1
protected

Number of the first symmetric index (0<= id_sym1 < valence )

Definition at line 1057 of file tensor.h.

◆ id_sym2

int Lorene::Tensor_sym::id_sym2
protected

Number of the second symmetric index (id_sym1 < id_sym2 < valence )

Definition at line 1062 of file tensor.h.

◆ met_depend

const Metric* Lorene::Tensor::met_depend[N_MET_MAX]
mutableprotectedinherited

Array on the Metric 's which were used to compute derived quantities, like p_derive_cov , etc...

The i-th element of this array is the Metric used to compute the i-th element of p_derive_cov , etc..

Definition at line 333 of file tensor.h.

◆ mp

const Map* const Lorene::Tensor::mp
protectedinherited

Mapping on which the numerical values at the grid points are defined.

Definition at line 301 of file tensor.h.

◆ n_comp

int Lorene::Tensor::n_comp
protectedinherited

Number of stored components, depending on the symmetry.

Definition at line 318 of file tensor.h.

◆ p_derive_con

Tensor* Lorene::Tensor::p_derive_con[N_MET_MAX]
mutableprotectedinherited

Array of pointers on the contravariant derivatives of this with respect to various metrics.

See the comments of met_depend . See also the comments of method derive_con() for a precise definition of a "contravariant" derivative.

Definition at line 349 of file tensor.h.

◆ p_derive_cov

Tensor* Lorene::Tensor::p_derive_cov[N_MET_MAX]
mutableprotectedinherited

Array of pointers on the covariant derivatives of this with respect to various metrics.

See the comments of met_depend . See also the comments of method derive_cov() for the index convention of the covariant derivation.

Definition at line 341 of file tensor.h.

◆ p_divergence

Tensor* Lorene::Tensor::p_divergence[N_MET_MAX]
mutableprotectedinherited

Array of pointers on the divergence of this with respect to various metrics.

See the comments of met_depend . See also the comments of method divergence() for a precise definition of a the divergence with respect to a given metric.

Definition at line 357 of file tensor.h.

◆ triad

const Base_vect* Lorene::Tensor::triad
protectedinherited

Vectorial basis (triad) with respect to which the tensor components are defined.

Definition at line 309 of file tensor.h.

◆ type_indice

Itbl Lorene::Tensor::type_indice
protectedinherited

1D array of integers (class Itbl ) of size valence
containing the type of each index: COV for a covariant one and CON for a contravariant one.

Definition at line 316 of file tensor.h.

◆ valence

int Lorene::Tensor::valence
protectedinherited

Valence of the tensor (0 = scalar, 1 = vector, etc...)

Definition at line 304 of file tensor.h.


The documentation for this class was generated from the following files: