23 #include "term_eq.hpp"
25 #include "tensor_impl.hpp"
26 #include "system_of_eqs.hpp"
27 #include "metric_tensor.hpp"
28 #include "name_tools.hpp"
32 Metric(conf.get_space()), p_conf(&conf), basis(bb), fmet(conf.get_space(), basis) {
37 Metric (so), p_conf(so.p_conf), basis(so.basis), fmet(so.fmet), place_syst(so.place_syst) {
40 Metric_cfc::~Metric_cfc() {
53 cerr <<
"Function only implemented for dimension 3" << endl ;
59 bool doder = (
syst->
term[place]->der_t==0x0) ?
false :
true ;
75 resval.
set(1,1) = val ;
78 resval.
set(2,2) = val ;
80 resval.
set(3,3) = val ;
91 resder.
set(1,1) = der ;
94 resder.
set(2,2) = der ;
96 resder.
set(3,3) = der ;
109 cerr <<
"Function only implemented for dimension 3" << endl ;
115 bool doder = (
syst->
term[place]->der_t==0x0) ?
false :
true ;
131 resval.
set(1,1) = val ;
132 resval.
set(1,2) = 0 ;
133 resval.
set(1,3) = 0 ;
134 resval.
set(2,2) = val ;
135 resval.
set(2,3) = 0 ;
136 resval.
set(3,3) = val ;
147 resder.
set(1,1) = der ;
148 resder.
set(1,2) = 0 ;
149 resder.
set(1,3) = 0 ;
150 resder.
set(2,2) = der ;
151 resder.
set(2,3) = 0 ;
152 resder.
set(3,3) = der ;
179 type_ind.
set(0) = COV ; type_ind.
set(1) = COV ; type_ind.
set(2) = CON ;
184 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
186 Index pos (res_val) ;
192 cmpval += 0.5*(*
p_met_con[dd]->val_t)(pos(2)+1,l)(dd)*((*flat_der.
val_t)(pos(0)+1, pos(1)+1, l)(dd) +
193 (*flat_der.
val_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
val_t)(l, pos(0)+1, pos(1)+1)(dd)) ;
201 cmpder += 0.5*(*
p_met_con[dd]->der_t)(pos(2)+1,l)(dd)*((*flat_der.
val_t)(pos(0)+1, pos(1)+1, l)(dd) +
202 (*flat_der.
val_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
val_t)(l, pos(0)+1, pos(1)+1)(dd))
203 + 0.5*(*
p_met_con[dd]->val_t)(pos(2)+1,l)(dd)*((*flat_der.
der_t)(pos(0)+1, pos(1)+1, l)(dd) +
204 (*flat_der.
der_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
der_t)(l, pos(0)+1, pos(1)+1)(dd)) ;
236 indices.
set(0) = CON ; indices.
set(1) = COV ; indices.
set(2) = COV ; indices.
set(3) = COV ;
241 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
243 Index pos (res_val) ;
246 Val_domain cmpval ((*flat_der.
val_t)(pos(2)+1, pos(1)+1,pos(3)+1,pos(0)+1)(dd)
247 - (*flat_der.
val_t)(pos(3)+1, pos(1)+1, pos(2)+1, pos(0)+1)(dd)) ;
249 cmpval += (*
p_christo[dd]->val_t)(pos(2)+1,m, pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(3)+1,m)(dd)
250 - (*
p_christo[dd]->val_t)(pos(3)+1,m,pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(2)+1,m)(dd) ;
254 Val_domain cmpder ((*flat_der.
der_t)(pos(2)+1, pos(1)+1,pos(3)+1,pos(0)+1)(dd)
255 - (*flat_der.
der_t)(pos(3)+1, pos(1)+1, pos(2)+1, pos(0)+1)(dd)) ;
257 cmpder += (*
p_christo[dd]->der_t)(pos(2)+1,m, pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(3)+1,m)(dd)
258 + (*
p_christo[dd]->val_t)(pos(2)+1,m, pos(0)+1)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,pos(3)+1,m)(dd)
259 - (*
p_christo[dd]->der_t)(pos(3)+1,m,pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(2)+1,m)(dd)
260 - (*
p_christo[dd]->val_t)(pos(3)+1,m,pos(0)+1)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,pos(2)+1,m)(dd);
291 indices.
set(0) = COV ; indices.
set(1) = COV ;
296 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
298 Index pos (res_val) ;
305 cmpval += (*flat_der.
val_t)(l, pos(1)+1,pos(0)+1,l)(dd)
306 - (*flat_der.
val_t)(pos(1)+1, pos(0)+1,l ,l)(dd) ;
308 cmpval += (*
p_christo[dd]->val_t)(l,m, l)(dd)*(*
p_christo[dd]->val_t)(pos(0)+1,pos(1)+1,m)(dd)
309 - (*
p_christo[dd]->val_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,m,l)(dd) ;
319 cmpder += (*flat_der.
der_t)(l, pos(1)+1,pos(0)+1,l)(dd)
320 - (*flat_der.
der_t)(pos(1)+1, pos(0)+1,l ,l)(dd) ;
322 cmpder += (*
p_christo[dd]->der_t)(l,m, l)(dd)*(*
p_christo[dd]->val_t)(pos(0)+1,pos(1)+1,m)(dd)
323 + (*
p_christo[dd]->val_t)(l,m, l)(dd)*(*
p_christo[dd]->der_t)(pos(0)+1,pos(1)+1,m)(dd)
324 - (*
p_christo[dd]->der_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,m,l)(dd)
325 - (*
p_christo[dd]->val_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,m,l)(dd);
382 if (ind_der==
char(start))
392 while ((!found) && (start<123)) ;
394 cerr <<
"Trouble with indices in derive (you are not using tensors of order > 24, are you ?)" << endl ;
397 char name_sum = char(start) ;
399 bool doder = ((so.
der_t==0x0) || (
p_christo[dd]->der_t==0x0)) ?
false :
true ;
407 p_christo[dd]->val_t->set_name_affected() ;
408 p_christo[dd]->val_t->set_name_ind(0, ind_der) ;
409 if (genre_indice==COV) {
411 p_christo[dd]->val_t->set_name_ind(2, name_sum) ;
415 p_christo[dd]->val_t->set_name_ind(1, name_sum) ;
419 p_christo[dd]->der_t->set_name_affected() ;
420 p_christo[dd]->der_t->set_name_ind(0, ind_der) ;
421 if (genre_indice==COV) {
423 p_christo[dd]->der_t->set_name_ind(2, name_sum) ;
427 p_christo[dd]->der_t->set_name_ind(1, name_sum) ;
437 bool need_sum = false ;
438 char const * ind =
p_christo[dd]->val_t->get_name_ind() ;
439 if ((ind[0]==ind[2]) || (ind[1]==ind[2]) || (ind[0]==ind[1]))
450 christ =
new Term_eq (auxi_christ) ;
469 Term_eq part_christo ((*christ)*copie) ;
472 if (genre_indice==CON)
473 res = res + part_christo ;
475 res = res - part_christo ;
493 cerr <<
"Metric already set for the system" << endl ;
499 trim_spaces (ss.
name_met, name_met) ;
reference set(const Index &pos)
Read/write of an element.
Describes the tensorial basis used by the various tensors.
int get_basis(int nd) const
Read only the basis in a given domain.
Class that gives the position inside a multi-dimensional Array.
bool inc(int increm, int var=0)
Increments the position of the Index.
Class to deal with a metric with a conformaly flat metric.
int place_syst
Gives the location of the metric amongst the various unknowns of the associated System_of_eqs.
virtual void compute_christo(int) const
Computes the Christoffel symbols, in a given Domain.
virtual void set_system(System_of_eqs &syst, const char *name)
Associate the metric to a given system of equations.
const Base_tensor & basis
The tensorial basis used.
virtual void compute_ricci_tensor(int) const
Computes the Ricci tensor, in a given Domain.
Scalar * p_conf
Pointer on the Scalar being the conformal factor.
Metric_flat fmet
Associated flat metric.
virtual void compute_riemann(int) const
Computes the Riemann tensor, in a given Domain.
virtual void compute_cov(int) const
Computes the covariant representation, in a given Domain.
virtual int give_type(int) const
Returns the type of tensorial basis of the covariant representation, in a given Domain.
virtual void compute_con(int) const
Computes the contravariant representation, in a given Domain.
Metric_cfc(Scalar &, const Base_tensor &)
Constructor from a Metric_tensor.
virtual Term_eq derive(int, char, const Term_eq &) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
virtual Term_eq derive_flat(int, char, const Term_eq &) const
Computes the covariant flat derivative of a Term_eq.
Term_eq derive_with_other(int tder, char indder, const Term_eq &so, const Metric *othermet) const
Computes the flat covariant derivative.
virtual Term_eq derive(int, char, const Term_eq &) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
Particular type of Tensor, dedicated to the desription of metrics.
Purely abstract class for metric handling.
int type_tensor
States if one works in the CON or COV representation.
MMPtr_array< Term_eq > p_ricci_tensor
Array of pointers on various Term_eq.
const Space & espace
The associated Space.
MMPtr_array< Term_eq > p_met_cov
Array of pointers on various Term_eq.
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.
MMPtr_array< Term_eq > p_riemann
Array of pointers on various Term_eq.
MMPtr_array< Term_eq > p_christo
Array of pointers on various Term_eq.
const System_of_eqs * syst
Pointer of the system of equations where the metric is used (only one for now).
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.
void std_base()
Sets the standard basis of decomposition.
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.
virtual void add_var(const char *name, double &var)
Addition of a variable (number case)
int ndom
Number of domains used.
char * name_met
Name by which the metric is recognized.
MMPtr_array< Term_eq > term
Pointers on the Term_eq corresponding to the unknown fields.
int dom_min
Smallest domain number.
Metric * met
Pointer on the associated Metric, if defined.
int nvar
Number of unknown fields.
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.
Tensor do_summation_one_dom(int dd) const
Does the inner contraction of the Tensor in a given domain.
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.
Class for storing the basis of decompositions of a field and its values on both the configuration and...