20 #include "term_eq.hpp"
22 #include "tensor_impl.hpp"
45 cerr <<
"derivative only defined with respect to tensors" << endl ;
59 cerr <<
"Unknown data storage in operator+" << endl ;
74 if (aa.
der_d==
nullptr)
79 if (bb.
der_d==
nullptr)
84 if (bb.
der_t==
nullptr)
88 cerr <<
"Unknown data storage in operator+" << endl ;
93 if (aa.
der_t==
nullptr)
97 if (bb.
der_d==
nullptr)
102 if (bb.
der_t==
nullptr)
107 cerr <<
"Unknown data storage in operator+" << endl ;
112 cerr <<
"Unknown data storage in operator+" << endl ;
126 res.
der_t = (do_der) ?
130 cerr <<
"Unknown data storage in operator+" << endl ;
138 res.
der_t = (do_der) ?
143 res.
der_t = (do_der) ?
147 cerr <<
"Unknown data storage in operator+" << endl ;
152 cerr <<
"Unknown data storage in operator+" << endl ;
165 if (aa.
der_d==
nullptr)
169 if (bb.
der_d==
nullptr)
174 if (bb.
der_t==
nullptr)
179 cerr <<
"Unknown data storage in operator-" << endl ;
184 if (aa.
der_t==
nullptr)
188 if (bb.
der_d==
nullptr)
193 if (bb.
der_t==
nullptr)
198 cerr <<
"Unknown data storage in operator-" << endl ;
203 cerr <<
"Unknown data storage in operator-" << endl ;
217 res.
der_t = (do_der) ?
221 cerr <<
"Unknown data storage in operator+" << endl ;
229 res.
der_t = (do_der) ?
234 res.
der_t = (do_der) ?
238 cerr <<
"Unknown data storage in operator+" << endl ;
243 cerr <<
"Unknown data storage in operator+" << endl ;
256 if (aa.
der_d==
nullptr)
260 if (bb.
der_d==
nullptr)
265 if (bb.
der_t==
nullptr)
270 cerr <<
"Unknown data storage in operator*" << endl ;
275 if (aa.
der_t==
nullptr)
279 if (bb.
der_d==
nullptr)
284 if (bb.
der_t==
nullptr)
289 cerr <<
"Unknown data storage in operator*" << endl ;
294 cerr <<
"Unknown data storage in operator*" << endl ;
304 res.
der_d = (do_der) ?
309 res.
der_t = (do_der) ?
314 cerr <<
"Unknown data storage in operator+" << endl ;
322 res.
der_t = (do_der) ?
327 res.
der_t = (do_der) ?
332 cerr <<
"Unknown data storage in operator*" << endl ;
337 cerr <<
"Unknown data storage in operator*" << endl ;
352 if (aa.
der_d==
nullptr)
356 if (bb.
der_d==
nullptr)
361 if (bb.
der_t==
nullptr)
366 cerr <<
"Unknown data storage in operator*" << endl ;
371 if (aa.
der_t==
nullptr)
375 if (bb.
der_d==
nullptr)
380 if (bb.
der_t==
nullptr)
385 cerr <<
"Unknown data storage in operator*" << endl ;
390 cerr <<
"Unknown data storage in operator*" << endl ;
400 res.
der_d = (do_der) ?
412 cerr <<
"Unknown data storage in operator+" << endl ;
432 cerr <<
"Unknown data storage in operator+" << endl ;
437 cerr <<
"Unknown data storage in operator+" << endl ;
450 cerr <<
"scalar_product only defined with tensors" << endl ;
454 if (aa.
der_t==
nullptr)
458 cerr <<
"scalar_product only defined with tensors" << endl ;
462 if (bb.
der_t==
nullptr)
466 cerr <<
"Unknown data storage in operator*" << endl ;
471 cerr <<
"Unknown data storage in operator*" << endl ;
477 bool param_val = false ;
480 bool param_der = false ;
512 cerr <<
"scalar_product only defined with tensors" << endl ;
518 cerr <<
"scalar_product only defined with tensors" << endl ;
535 cerr <<
"Unknown data storage in operator+" << endl ;
540 cerr <<
"Unknown data storage in operator+" << endl ;
550 for (
int i=1 ; i<nn ; i++)
555 Scalar one_scal (so.
get_val_t(),
false) ;
557 one_scal.std_base() ;
558 Scalar zero_scal (one_scal) ;
560 Term_eq one (so.
get_dom(), one_scal, zero_scal) ;
562 for (
int i=0 ; i<-nn ; i++)
574 res.
val_d =
new double(
double(nn)*(*so.
val_d)) ;
575 if (so.
der_d!=
nullptr)
576 res.
der_d =
new double(
double(nn)*(*so.
der_d)) ;
580 if (so.
der_t!=
nullptr)
584 cerr <<
"Unknown data storage in operator+" << endl ;
601 if (so.
der_d!=
nullptr)
606 if (so.
der_t!=
nullptr)
610 cerr <<
"Unknown data storage in operator+" << endl ;
622 cerr <<
"Multiplication of a Term_èeq by a Scalar onlyu defined for Tensorial type" << endl ;
627 if (so.
der_t!=
nullptr)
631 cerr <<
"Unknown data storage in operator+" << endl ;
648 if (so.
der_d!=
nullptr)
653 if (so.
der_t!=
nullptr)
657 cerr <<
"Unknown data storage in operator/" << endl ;
670 if (so.
der_d!=
nullptr)
675 if (so.
der_t!=
nullptr)
679 cerr <<
"Unknown data storage in operator/" << endl ;
689 cerr <<
"Partial only defined with respect to tensors" << endl ;
693 if (so.
der_t!=
nullptr)
697 cerr <<
"Unknown data storage in partial" << endl ;
virtual Term_eq div_1mx2_term_eq(const Term_eq &) const
Returns the division by of a Term_eq.
Class that gives the position inside a multi-dimensional Array.
bool inc(int increm, int var=0)
Increments the position of the Index.
int get_m_quant() const
Returns .
int & set_m_quant()
Sets .
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.
Param_tensor & set_parameters()
Read/write of the parameters.
const Param_tensor & get_parameters() const
Returns a pointer on the possible additional parameter.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
bool is_m_quant_affected() const
Checks whether the additional parameter is affected (used for boson stars for instance).
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 :
double * val_d
Pointer on the value, if the Term_eq is a double.
const int dom
Index of the Domain where the Term_eq is defined.
Term_eq der_abs(int i) const
Computes the derivative wrt to an absolute coordinate (i.e.
double * der_d
Pointer on the variation if the Term_eq is a double.
Tensor const & get_val_t() const
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Val_domain der_abs(int i) const
Computes the derivative with respect to an absolute coordinate (typically Cartesian).