Lorene::Tensor Class Reference
Tensorial fields

Tensor handling. More...

`#include <tensor.h>`

Inheritance diagram for Lorene::Tensor:

## Public Member Functions

| Tensor (const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i)
| Standard constructor.
| Tensor (const Map &map, int val, const Itbl &tipe, const Base_vect *triad_i)
| Standard constructor with the triad passed as a pointer.
| Tensor (const Map &map, int val, int tipe, const Base_vect &triad_i)
| Standard constructor when all the indices are of the same type.
| Tensor (const Tensor &)
| Copy constructor.
| Tensor (const Map &map, const Base_vect &triad_i, FILE *fich)
| Constructor from a file (see `sauve(FILE*)` ).
virtual | ~Tensor ()
| Destructor.
virtual void | set_etat_nondef ()
| Sets the logical state of all components to `ETATNONDEF` (undefined state).
virtual void | set_etat_zero ()
| Sets the logical state of all components to `ETATZERO` (zero state).
virtual void | set_etat_qcq ()
| Sets the logical state of all components to `ETATQCQ` (ordinary state).
virtual void | allocate_all ()
| Performs the memory allocation of all the elements, down to the `double` arrays of the `Tbl` s.
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.
virtual void | operator= (const Tensor &)
| Assignment to a `Tensor`.
Scalar & | set (const Itbl &ind)
| Returns the value of a component (read/write version).
Scalar & | set (int i1, int i2)
| Returns the value of a component for a tensor of valence 2 (read/write version).
Scalar & | set (int i1, int i2, int i3)
| Returns the value of a component for a tensor of valence 3 (read/write version).
Scalar & | set (int i1, int i2, int i3, int i4)
| Returns the value of a component for a tensor of valence 4 (read/write version).
void | annule_domain (int l)
| Sets the `Tensor` to zero in a given domain.
virtual void | annule (int l_min, int l_max)
| Sets the `Tensor` to zero in several domains.
void | annule_extern_cn (int l_0, int deg)
| Performs a smooth (C^n) transition in a given domain to zero.
virtual void | std_spectral_base ()
| Sets the standard spectal bases of decomposition for each component.
virtual void | std_spectral_base_odd ()
| Sets the standard odd spectal bases of decomposition for each component.
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).
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).
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` ).
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 Tensor & | derive_cov (const Metric &gam) const
| Returns the covariant derivative of `this` with respect to some metric .
const Tensor & | derive_con (const Metric &gam) const
| Returns the "contravariant" derivative of `this` with respect to some metric , by raising the last index of the covariant derivative (cf.
const Tensor & | divergence (const Metric &gam) const
| Computes the divergence of `this` with respect to some metric .
Tensor | derive_lie (const Vector &v) const
| Computes the Lie derivative of `this` with respect to some vector field `v`.
Tensor | up (int ind, const Metric &gam) const
| Computes a new tensor by raising an index of `*this`.
Tensor | down (int ind, const Metric &gam) const
| Computes a new tensor by lowering an index of `*this`.
Tensor | up_down (const Metric &gam) const
| Computes a new tensor by raising or lowering all the indices of `*this` .
Tensor | trace (int ind1, int ind2) const
| Trace on two different type indices.
Tensor | trace (int ind1, int ind2, const Metric &gam) const
| Trace with respect to a given metric.
Scalar | trace () const
| Trace on two different type indices for a valence 2 tensor.
Scalar | trace (const Metric &gam) const
| Trace with respect to a given metric for a valence 2 tensor.
virtual int | position (const Itbl &ind) const
| Returns the position in the array `cmp` of a component given by its indices.
virtual Itbl | indices (int pos) const
| Returns the indices of a component given by its position in the array `cmp` .
const Map & | get_mp () const
| Returns the mapping.
const Base_vect * | get_triad () const
| Returns the vectorial basis (triad) on which the components are defined.
int | get_valence () const
| Returns the valence.
int | get_n_comp () const
| Returns the number of stored components.
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.
int & | set_index_type (int i)
| Sets the type of the index number `i` .
Itbl & | set_index_type ()
| Sets the types of all the indices.
const Scalar & | operator() (const Itbl &ind) const
| Returns the value of a component (read-only version).
const Scalar & | operator() (int i1, int i2) const
| Returns the value of a component for a tensor of valence 2 (read-only version).
const Scalar & | operator() (int i1, int i2, int i3) const
| Returns the value of a component for a tensor of valence 3 (read-only version).
const Scalar & | operator() (int i1, int i2, int i3, int i4) const
| Returns the value of a component for a tensor of valence 4 (read-only version).
void | operator+= (const Tensor &)
| += Tensor
void | operator-= (const Tensor &)
| -= Tensor
virtual void | sauve (FILE *) const
| Save in a binary file.
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.

## Protected Member Functions

| Tensor (const Map &map)
| Constructor for a scalar field: to be used only by the derived class `Scalar` .
| Tensor (const Map &map, int val, const Itbl &tipe, int n_comp_i, const Base_vect &triad_i)
| Constructor to be used by derived classes, with symmetries among the components.
| Tensor (const Map &map, int val, int tipe, int n_comp_i, const Base_vect &triad_i)
| Constructor used by derived classes, with symmetries among the components, when all the indices are of the same type.
virtual void | del_deriv () const
| Deletes the derived quantities.
void | set_der_0x0 () const
| Sets the pointers on derived quantities to 0x0.
virtual void | del_derive_met (int) const
| Logical destructor of the derivatives depending on the i-th element of `met_depend` .
void | set_der_met_0x0 (int) const
| Sets all the i-th components of `met_depend` , `p_derive_cov` , etc... to 0x0.
void | set_dependance (const Metric &) const
| To be used to describe the fact that the derivatives members have been calculated with `met` .
int | get_place_met (const Metric &) const
| Returns the position of the pointer on `metre` in the array `met_depend` .
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` ).

## Protected Attributes

const Map *const | mp
| Mapping on which the numerical values at the grid points are defined.
int | valence
| Valence of the tensor (0 = scalar, 1 = vector, etc...).
const Base_vect * | triad
| Vectorial basis (triad) with respect to which the tensor components are defined.
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.
int | n_comp
| Number of stored components, depending on the symmetry.
Scalar ** | cmp
| Array of size `n_comp` of pointers onto the components.
const Metric * | met_depend [N_MET_MAX]
| 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.
Tensor * | p_derive_cov [N_MET_MAX]
| Array of pointers on the covariant derivatives of `this` with respect to various metrics.
Tensor * | p_derive_con [N_MET_MAX]
| Array of pointers on the contravariant derivatives of `this` with respect to various metrics.
Tensor * | p_divergence [N_MET_MAX]
| Array of pointers on the divergence of `this` with respect to various metrics.

## Friends

class | Scalar
class | Vector
class | Sym_tensor
class | Tensor_sym
class | Metric
ostream & | operator<< (ostream &flux, const Tensor &source)
Scalar | operator+ (const Tensor &a, const Scalar &b)
| Tensor + Scalar. The `Tensor` must be of valence 0.
Scalar | operator+ (const Scalar &a, const Tensor &b)
| Scalar + Tensor. The `Tensor` must be of valence 0.
Scalar | operator- (const Tensor &a, const Scalar &b)
| Tensor - Scalar. The `Tensor` must be of valence 0.
Scalar | operator- (const Scalar &a, const Tensor &b)
| Scalar - Tensor. The `Tensor` must be of valence 0.
Tensor | operator* (const Tensor &a, const Tensor &b)
| Tensorial product.
Tensor_sym | operator* (const Tensor &a, const Tensor_sym &b)
| Tensorial product with symmetries.
Tensor_sym | operator* (const Tensor_sym &a, const Tensor &b)
| Tensorial product with symmetries.
Tensor_sym | operator* (const Tensor_sym &a, const Tensor_sym &b)
| Tensorial product of two symmetric tensors.

## Detailed Description

Tensor handling.

()

This class has been devised to replace `Tenseur` and `Cmp` (the latter via the derived class `Scalar` ).

The `Tensor` class is intended to store the components of a tensorial field with respect to a specific basis (triad).

All this is 3D meaning that the indices go from 1 to 3.

Definition at line 288 of file tensor.h.

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

- tensor.h
- tensor.C
- tensor_calculus.C
- tensor_change_triad.C