20 #include "term_eq.hpp"
22 #include "tensor_impl.hpp"
25 void affecte_one_dom (
int, Tensor*,
const Tensor*) ;
28 Term_eq::Term_eq (
int dd,
const Tensor& vx) : dom{dd}, val_d{nullptr}, der_d{nullptr}, der_t{nullptr}, type_data {TERM_T} {
42 dom{dd}, val_d{nullptr}, der_d{nullptr}, val_t{new
Tensor{vx, false}}, der_t{new
Tensor{dx, false}},
69 type_data{so.type_data} {
71 if (so.
val_d!=
nullptr)
73 if (so.
der_d!=
nullptr)
75 if (so.
val_t!=
nullptr) {
89 if (so.
der_t!=
nullptr) {
121 cerr <<
"Wrong type of data in Term_eq" << endl ;
126 if (so.
val_d!=
nullptr) {
131 if (so.
der_d!=
nullptr) {
140 if (so.
val_t!=
nullptr) {
146 if (so.
der_t!=
nullptr) {
156 #ifndef REMOVE_ALL_CHECKS
158 cerr <<
"Wrong type of data in Term_eq" << endl ;
172 #ifndef REMOVE_ALL_CHECKS
174 cerr <<
"Wrong type of data in Term_eq" << endl ;
193 der_d =
new double(0.) ;
196 assert (
val_t!=
nullptr) ;
203 cerr <<
"Wrong type of data in Term_eq" << endl ;
208 ostream& operator<< (ostream& flux,
const Term_eq& so) {
209 flux <<
"Data defined in domain = " << so.
dom << endl ;
212 flux <<
"double data" << endl ;
213 if (so.
val_d !=
nullptr)
214 flux <<
"val = " << *so.
val_d << endl ;
216 flux <<
"val undefined" << endl ;
217 if (so.
der_d !=
nullptr)
218 flux <<
"der = " << *so.
der_d << endl ;
220 flux <<
"der undefined" << endl ;
223 flux <<
"tensorial data" << endl ;
224 if (so.
val_t !=
nullptr)
225 flux <<
"val = " << *so.
val_t << endl ;
227 flux <<
"val undefined" << endl ;
228 if (so.
der_t !=
nullptr)
229 flux <<
"der = " << *so.
der_t << endl ;
231 flux <<
"der undefined" << endl ;
234 cerr <<
"Unknown data type in Term_eq" << endl ;
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
void set_name_ind(int dd, char name)
Sets the name of one index ; the names must have been affected first.
void set_name_affected()
Affects the name of the indices.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
char const * get_name_ind() const
int get_n_comp() const
Returns the number of stored components.
virtual Array< int > indices(int pos) const
Gives the values of the indices corresponding to a location in the array used for storage of the comp...
int get_valence() const
Returns the valence.
bool is_name_affected() const
Check whether the names of the indices have been affected.
This class is intended to describe the manage objects appearing in the equations.
Tensor * set_val_t()
Read/write accessor to the tensorial value.
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.
Term_eq & operator=(Term_eq &&) noexcept
Move assignment operator.
void set_der_zero()
Sets the variation of the approriate type to zero.
const int dom
Index of the Domain where the Term_eq is defined.
double * der_d
Pointer on the variation if the Term_eq is a double.
Term_eq(int dom, int val)
Constructor for a double type Term_eq.
Tensor * set_der_t()
Read/write accessor to the tensorial derivative.
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).