LORENE
Tensor calculus

() More...

Functions

Tensor Lorene::operator* (const Tensor &a, const Tensor &b)
 Tensorial product. More...
 
Tensor_sym Lorene::operator* (const Tensor &a, const Tensor_sym &b)
 Tensorial product with symmetries. More...
 
Tensor_sym Lorene::operator* (const Tensor_sym &a, const Tensor &b)
 Tensorial product with symmetries. More...
 
Tensor_sym Lorene::operator* (const Tensor_sym &a, const Tensor_sym &b)
 Tensorial product of two symmetric tensors. More...
 
Tensor Lorene::contract (const Tensor &t1, int ind1, const Tensor &t2, int ind2, bool desaliasing=false)
 Contraction of two tensors. More...
 
Tensor Lorene::contract (const Tensor &t1, int ind_i1, int ind_j1, const Tensor &t2, int ind_i2, int ind_j2, bool desaliasing=false)
 Double contraction of two tensors. More...
 
Tensor Lorene::contract (const Tensor &t1, int ind1, int ind2)
 Contraction on two indices of a single tensor (trace). More...
 
Tbl Lorene::max (const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
 Maxima in each domain of the values of the tensor components. More...
 
Tbl Lorene::min (const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
 Minima in each domain of the values of the tensor components. More...
 
Tbl Lorene::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. More...
 
Tbl Lorene::diffrel (const Tensor &aa, const Tensor &bb, const char *comment=0x0, ostream &ost=cout)
 Relative difference between two Tensor ( $L^1$ version). More...
 
Tbl Lorene::diffrelmax (const Tensor &aa, const Tensor &bb, const char *comment=0x0, ostream &ost=cout)
 Relative difference between two Tensor (max version). More...
 
Tbl Lorene::central_value (const Tensor &aa, const char *comment=0x0, ostream &ost=cout)
 Central value of each component of a tensor. More...
 
Tbl Lorene::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. More...
 
Tbl Lorene::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. More...
 
Tbl Lorene::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. More...
 

Detailed Description

()

Function Documentation

◆ central_value()

Tbl Lorene::central_value ( const Tensor aa,
const char *  comment = 0x0,
ostream &  ost = cout 
)

Central value of each component of a tensor.

Parameters
aatensor
commentcomment to be printed on ost (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result; used only if comment != 0x0.
Returns
1-D Tbl of size the number of independent components (aa.get_ncomp()), the elements of which are the central values of the various components.

Definition at line 655 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_n_comp(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ contract() [1/3]

Tensor Lorene::contract ( const Tensor t1,
int  ind1,
const Tensor t2,
int  ind2,
bool  desaliasing = false 
)

Contraction of two tensors.

Parameters
t1[input] first tensor
ind1[input] index of the first tensor for the contraction, obeying to the following convention :
  • ind1 = 0 : first index of the tensor
  • ind1 = 1 : second index of the tensor
  • and so on... (ind1 must thus be in the range 0...t1.valence-1)
t2[input] second tensor
ind2[input] index of the second tensor for the contraction, with the same convention as ind1
desaliasing[input] determines whether the products are performed with desaliasing or not
Returns
tensor resulting of the contraction of the index ind1 of t1 with the index ind2 of t2 . NB: the types (COV or CON ) of the indices ind1 and ind2 must be different.

Definition at line 166 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_index_type(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), Lorene::Itbl::set(), Lorene::Tensor::set(), and Lorene::Scalar::set_etat_zero().

◆ contract() [2/3]

Tensor Lorene::contract ( const Tensor t1,
int  ind_i1,
int  ind_j1,
const Tensor t2,
int  ind_i2,
int  ind_j2,
bool  desaliasing = false 
)

Double contraction of two tensors.

Parameters
t1[input] first tensor
ind_i1[input] position of the first index i1 in the first tensor for the contraction, obeying to the following convention :
  • ind_i1 = 0 : first index of the tensor
  • ind_i1 = 1 : second index of the tensor
  • and so on... (ind_i1 must thus be in the range 0...t1.valence-1)
ind_j1[input] position of the second index j1 in the first tensor for the contraction; one must have ind_i1 < ind_ j1
t2[input] second tensor
ind_i2[input] position of the first index i2 in the second tensor for the contraction
ind_j2[input] position of the second index j2 in the second tensor for the contraction; one must have ind_i2 < ind_ j2
desaliasing[input] determines whether the products are performed with desaliasing or not
Returns
tensor resulting of the contraction of the index ind_i1
of t1 with the index ind_i2 of t2 and of the contraction of the index ind_j1
of t1 with the index ind_j2 of t2 NB: the types (COV or CON ) of the indices ind_i1 and ind_i2 (resp. ind_j1 and ind_j2 ) must be different.

Definition at line 244 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_index_type(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), Lorene::Itbl::set(), Lorene::Tensor::set(), and Lorene::Scalar::set_etat_zero().

◆ contract() [3/3]

Tensor Lorene::contract ( const Tensor t1,
int  ind1,
int  ind2 
)

Contraction on two indices of a single tensor (trace).

Parameters
t1[input] tensor
ind1[input] first index of the tensor for the contraction, obeying to the following convention :
  • ind1 = 0 : first index of the tensor
  • ind1 = 1 : second index of the tensor
  • and so on... (ind1 must thus be in the range 0...t1.valence-1)
ind2[input] second index of the tensor for the contraction, with the same convention as ind1
Returns
tensor resulting of the contraction NB: the types (COV or CON ) of the indices ind1 and ind2 must be different.

Definition at line 346 of file tensor_calculus_ext.C.

References Lorene::Tensor::get_index_type(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_triad(), Lorene::Tensor::get_valence(), Lorene::Itbl::set(), Lorene::Tensor::set(), and Lorene::Scalar::set_etat_zero().

◆ diffrel()

Tbl Lorene::diffrel ( const Tensor aa,
const Tensor bb,
const char *  comment = 0x0,
ostream &  ost = cout 
)

Relative difference between two Tensor ( $L^1$ version).

Parameters
aafirst tensor
bbsecond tensor
commentcomment to be printed on ost before the result (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result
Returns
2-D Tbl of size the number of independent components times the number of domains, the elements (i,l) of which are norme[a(l)-b(l)]/norme[b(l)] if b(l)!=0 and norme[a(l)-b(l)] if b(l)=0 , where a(l) and b(l) denote symbolically the values of aa and bb
in domain no. l and for component no.i .

Definition at line 414 of file tensor_calculus_ext.C.

References Lorene::diffrel(), Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ diffrelmax()

Tbl Lorene::diffrelmax ( const Tensor aa,
const Tensor bb,
const char *  comment = 0x0,
ostream &  ost = cout 
)

Relative difference between two Tensor (max version).

Parameters
aafirst tensor
bbsecond tensor
commentcomment to be printed on ost before the result (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result
Returns
2-D Tbl of size the number of independent components times the number of domains, the elements (i,l) of which are max[abs(a(l)-b(l))]/max[abs(b(l))] if b(l)!=0 and max[abs(a(l)-b(l))] if b(l)=0 , where a(l) and b(l) denote symbolically the values of aa and bb
in domain no. l and for component no.i .

Definition at line 470 of file tensor_calculus_ext.C.

References Lorene::diffrelmax(), Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ max()

Tbl Lorene::max ( const Tensor aa,
const char *  comment = 0x0,
ostream &  ost = cout 
)

Maxima in each domain of the values of the tensor components.

Parameters
aatensor
commentcomment to be printed on ost before the result (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result
Returns
2-D Tbl of size the number of independent components times the number of domains, the elements (i,l) of which are max(a(l)) , where a(l)
denotes symbolically the values of aa
in domain no. l and for component no.i .

Definition at line 527 of file tensor_calculus_ext.C.

References Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::max(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ max_all_domains()

Tbl Lorene::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.

Parameters
aatensor
l_excludedindex of domain to be excluded from the computation: the default = -1 corresponds to no excluded domain
commentcomment to be printed on ost (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result; used only if comment != 0x0.
Returns
1-D Tbl of size the number of independent components (aa.get_ncomp()), the elements of which are the maximum values of the various components.

Definition at line 693 of file tensor_calculus_ext.C.

References Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::max(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ maxabs()

Tbl Lorene::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.

Parameters
aatensor
commentcomment to be printed on ost before the result (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result
Returns
2-D Tbl of size the number of independent components times the number of domains, the elements (i,l) of which are max[abs(a(l))] , where a(l)
denotes symbolically the values of aa
in domain no. l and for component no.i .

Definition at line 612 of file tensor_calculus_ext.C.

References Lorene::abs(), Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::max(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ maxabs_all_domains()

Tbl Lorene::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.

Parameters
aatensor
l_excludedindex of domain to be excluded from the computation: the default = -1 corresponds to no excluded domain
commentcomment to be printed on ost (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result; used only if comment != 0x0.
Returns
1-D Tbl of size the number of independent components (aa.get_ncomp()), the elements of which are the maximum of of the absolute value of the various components.

Definition at line 794 of file tensor_calculus_ext.C.

References Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::maxabs(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ min()

Tbl Lorene::min ( const Tensor aa,
const char *  comment = 0x0,
ostream &  ost = cout 
)

Minima in each domain of the values of the tensor components.

Parameters
aatensor
commentcomment to be printed on ost before the result (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result
Returns
2-D Tbl of size the number of independent components times the number of domains, the elements (i,l) of which are min(a(l)), where a(l)
denotes symbolically the values of aa
in domain no. l and for component no.i .

Definition at line 570 of file tensor_calculus_ext.C.

References Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::min(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ min_all_domains()

Tbl Lorene::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.

Parameters
aatensor
l_excludedindex of domain to be excluded from the computation: the default = -1 corresponds to no excluded domain
commentcomment to be printed on ost (default: 0x0 = nothing printed)
ostoutput stream for a formatted output of the result; used only if comment != 0x0.
Returns
1-D Tbl of size the number of independent components (aa.get_ncomp()), the elements of which are the minimum values of the various components.

Definition at line 743 of file tensor_calculus_ext.C.

References Lorene::Map::get_mg(), Lorene::Tensor::get_mp(), Lorene::Tensor::get_n_comp(), Lorene::Mg3d::get_nzone(), Lorene::Tensor::get_valence(), Lorene::Tensor::indices(), Lorene::min(), Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().

◆ operator*() [1/4]

◆ operator*() [2/4]

◆ operator*() [3/4]

◆ operator*() [4/4]

Tensor_sym Lorene::operator* ( const Tensor_sym a,
const Tensor_sym b 
)

Tensorial product of two symmetric tensors.

NB: the output is an object of class Tensor_sym , with the two symmetric indices corresponding to the symmetric indices of tensor a . This means that the symmetries of tensor b indices are not used in the storage, since there is currently no class in Lorene to manage tensors with more than two symmetric indices.

Definition at line 154 of file tensor_sym_calculus.C.

References Lorene::Tensor::get_triad(), Lorene::Tensor::mp, Lorene::Itbl::set(), Lorene::Tensor_sym::sym_index1(), Lorene::Tensor_sym::sym_index2(), Lorene::Tensor::type_indice, and Lorene::Tensor::valence.