22 #include "tensor_impl.hpp"
37 cerr <<
"Ope_inverse only defined with respect for a tensor" << endl ;
41 cerr <<
"Ope_inverse only defined with respect to a second order tensor" << endl ;
45 cerr <<
"Ope_inverse only defined with respect to a tensor which indices are of the same type" << endl ;
51 bool m_doder = (target.
der_t==0x0) ?
false :
true ;
63 gsl_permutation* p(gsl_permutation_calloc(dim-1));
64 for (
int i(1) ; i <= dim ; ++i)
66 for (
int j(i) ; j <= dim ; ++j)
73 int p1(
static_cast<int>(gsl_permutation_get(p, 0)) + 1);
74 int p2(
static_cast<int>(gsl_permutation_get(p, 1)) + 1);
75 vector<int> index1, index2;
76 index1 = ind_com(i, j, p1, 1);
77 index2 = ind_com(i, j, p2, 2);
78 cmpval += pow(-1.0, i + j)*signature*(*target.
val_t)(index1[0], index1[1])(
dom)*(*target.
val_t)(index2[0],index2[1])(
dom);
80 cmpder += pow(-1.0, i + j)*signature*(*target.
der_t)(index1[0], index1[1])(
dom)*(*target.
val_t)(index2[0], index2[1])(
dom)
81 + pow(-1.0, i + j)*signature*(*target.
val_t)(index1[0], index1[1])(
dom)*(*target.
der_t)(index2[0], index2[1])(
dom);
82 }
while(gsl_permutation_next(p) == GSL_SUCCESS);
83 gsl_permutation_free(p) ;
84 p = gsl_permutation_calloc(dim - 1);
89 res[j - 1 + dim*(i - 1) - i*(i - 1)/2] =
new Term_eq (
dom, val, der);
92 res[j - 1 + dim*(i - 1) - i*(i - 1)/2] =
new Term_eq (
dom, val);
95 gsl_permutation_free(p);
100 for (
int i(1) ; i <= dim ; ++i)
101 for (
int j(i) ; j <= dim ; ++j)
102 resval.
set(i, j) = res[j - 1 + dim*(i - 1) - i*(i - 1)/2]->
get_val_t();
106 for (
int i(1) ; i <= dim ; ++i)
107 for (
int j(i) ; j <= dim ; ++j)
108 resder.
set(i, j) = res[j - 1 + dim*(i - 1) - i*(i - 1)/2]->
get_der_t();
111 for (
int i(0) ; i < dim*(dim + 1)/2 ; ++i)
Particular type of Tensor, dedicated to the desription of metrics.
Abstract class that describes the various operators that can appear in the equations.
MMPtr_array< Ope_eq > parts
Pointers of the various parts of the current operator.
int dom
Index of the Domain where the operator is defined.
Term_eq action() const override
Computes the action of the current Ope_eq using its various parts.
Ope_inverse_nodet(const System_of_eqs *syst, Ope_eq *so)
Constructor.
~Ope_inverse_nodet() override
Destructor.
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
const Domain * get_domain(int i) const
returns a pointer on the domain.
int get_ndim() const
Returns the number of dimensions.
Class used to describe and solve a system of equations.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
const Base_tensor & get_basis() const
Returns the vectorial basis (triad) on which the components are defined.
int get_valence() const
Returns the valence.
const Space & get_space() const
Returns the Space.
This class is intended to describe the manage objects appearing in the equations.
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
const int type_data
Flag describing the type of data :
Tensor const & get_val_t() const
Tensor const & get_der_t() const
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Class for storing the basis of decompositions of a field and its values on both the configuration and...