20 #include "headcpp.hpp"
22 #include "utilities.hpp"
23 #include "spheric.hpp"
24 #include "term_eq.hpp"
27 #include "tensor_impl.hpp"
31 assert ((type_der==COV) || (type_der==CON)) ;
34 bool donames = (ind_der==
' ') ?
false :
true ;
35 bool need_sum = false ;
38 type_ind.
set(0) = COV ;
39 for (
int i=1 ; i<val_res ; i++)
46 for (
int i=1 ; i<val_res ; i++)
59 for (
int i=1 ; i<val_res ; i++)
65 Index pos_auxi_bis(auxi_val) ;
68 for (
int i=0 ; i<val_res-1 ; i++)
69 pos_so_bis.
set(i) = pos_auxi_bis(i+1) ;
70 switch (pos_auxi_bis(0)) {
84 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
88 while (pos_auxi_bis.
inc()) ;
91 for (
int ind_sum=0 ; ind_sum<val_res-1 ; ind_sum++) {
94 Index pos_auxi(auxi_val) ;
98 for (
int i=0 ; i<val_res-1 ; i++)
99 pos_so.
set(i) = pos_auxi(i+1) ;
101 switch (pos_auxi(0)) {
108 switch (pos_auxi(ind_sum+1)) {
111 pos_so.
set(ind_sum) = 1 ;
116 pos_so.
set(ind_sum) = 0 ;
123 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
130 switch (pos_auxi(ind_sum+1)) {
133 pos_so.
set(ind_sum) = 2 ;
138 pos_so.
set(ind_sum) = 2 ;
143 pos_so.
set(ind_sum) = 0 ;
145 pos_so.
set(ind_sum) = 1 ;
149 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
154 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
158 while (pos_auxi.
inc()) ;
182 for (
int i=1 ; i<val_res ; i++)
188 Index pos_auxi_der_bis(auxi_der) ;
190 for (
int i=0 ; i<val_res-1 ; i++)
191 pos_so_bis.
set(i) = pos_auxi_der_bis(i+1) ;
192 switch (pos_auxi_der_bis(0)) {
206 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
210 while (pos_auxi_der_bis.
inc()) ;
213 for (
int ind_sum=0 ; ind_sum<val_res-1 ; ind_sum++) {
216 Index pos_auxi_der(auxi_val) ;
220 for (
int i=0 ; i<val_res-1 ; i++)
221 pos_so.
set(i) = pos_auxi_der(i+1) ;
223 switch (pos_auxi_der(0)) {
230 switch (pos_auxi_der(ind_sum+1)) {
233 pos_so.
set(ind_sum) = 1 ;
238 pos_so.
set(ind_sum) = 0 ;
245 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
252 switch (pos_auxi_der(ind_sum+1)) {
255 pos_so.
set(ind_sum) = 2 ;
260 pos_so.
set(ind_sum) = 2 ;
265 pos_so.
set(ind_sum) = 0 ;
267 pos_so.
set(ind_sum) = 1 ;
271 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
276 cerr <<
"Bad indice in Domain_compact::derive_flat_spher" << endl ;
280 while (pos_auxi_der.
inc()) ;
299 bool doder = (so.
der_t==0x0) ?
false :
true ;
303 assert ((type_der==COV) || (type_der==CON)) ;
312 type_ind.
set(0) = COV ;
313 for (
int i=1 ; i<val_res ; i++)
317 bool need_sum = false ;
319 for (
int i=1 ; i<val_res ; i++)
332 for (
int i=1 ; i<val_res ; i++)
337 Index pos_auxi(auxi_val) ;
340 for (
int i=0 ; i<val_res-1 ; i++)
341 pos_so.
set(i) = pos_auxi(i+1) ;
344 while (pos_auxi.
inc()) ;
365 for (
int i=1 ; i<val_res ; i++)
369 Index pos_auxi_der(auxi_der) ;
371 for (
int i=0 ; i<val_res-1 ; i++)
372 pos_so.
set(i) = pos_auxi_der(i+1) ;
375 while (pos_auxi_der.
inc()) ;
reference set(const Index &pos)
Read/write of an element.
Describes the tensorial basis used by the various tensors.
virtual Term_eq derive_flat_cart(int, char, const Term_eq &, const Metric *) const
Computes the flat derivative of a Term_eq, in Cartesian coordinates.
virtual Term_eq derive_flat_spher(int, char, const Term_eq &, const Metric *) const
Computes the flat derivative of a Term_eq, in spherical orthonormal coordinates.
virtual Val_domain div_r(const Val_domain &) const
Division by .
virtual Val_domain der_r(const Val_domain &) const
Compute the radial derivative of a scalar field.
int num_dom
Number of the current domain (used by the Space)
Class that gives the position inside a multi-dimensional Array.
int & set(int i)
Read/write of the position in a given dimension.
bool inc(int increm, int var=0)
Increments the position of the Index.
Purely abstract class for metric handling.
MMPtr_array< Term_eq > p_met_con
Array of pointers on various Term_eq.
virtual void manipulate_ind(Term_eq &so, int ind) const
Uses the Metric to manipulate one of the index of a Term_eq (i.e.
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_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
int get_valence() const
Returns the valence.
bool is_name_affected() const
Check whether the names of the indices have been affected.
Tensor do_summation_one_dom(int dd) const
Does the inner contraction of the Tensor in a given domain.
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.
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Val_domain div_r() const
Division by the radius.
Val_domain div_sin_theta() const
Division by .
Val_domain mult_cos_theta() const
Multiplication by .