22 #include "metric_nophi.hpp"
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(met.get_space()), p_met(&met), basis(met.get_basis()), fmet(met.get_space(), basis), conformal(ome), grad_conf (espace, COV, basis) {
38 for (
int i=1 ; i<=3 ; i++)
45 Metric (so), p_met(so.p_met), basis(so.basis), fmet(so.fmet), conformal(so.conformal), grad_conf(so.grad_conf), place_syst(so.place_syst) {
48 Metric_conf_factor::~Metric_conf_factor() {
70 bool doder = (
syst->
term[place]->der_t==0x0) ?
false :
true ;
78 detval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
86 detder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
109 cmpval = (*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
110 -(*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
113 cmpder = (*
syst->
term[place]->der_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
116 - (*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
117 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
118 res[0] =
new Term_eq (dd, val, der) ;
121 res[0] =
new Term_eq (dd, val) ;
125 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
126 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd) ;
129 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
132 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(3,3)(dd) ;
133 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
134 res[1] =
new Term_eq (dd, val, der) ;
137 res[1] =
new Term_eq (dd, val) ;
141 cmpval = (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
142 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd) ;
145 cmpder = (*
syst->
term[place]->der_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
148 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(2,2)(dd) ;
149 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
150 res[2] =
new Term_eq (dd, val, der) ;
153 res[2] =
new Term_eq (dd, val) ;
157 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
158 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,3)(dd) ;
161 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
164 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(1,3)(dd) ;
165 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
166 res[3] =
new Term_eq (dd, val, der) ;
169 res[3] =
new Term_eq (dd, val) ;
173 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
174 -(*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
177 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
180 - (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
181 der.
set_domain(dd) = cmpder/ detval - cmpval * detder / detval/detval ;
182 res[4] =
new Term_eq (dd, val, der) ;
185 res[4] =
new Term_eq (dd, val) ;
189 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
190 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd) ;
193 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
196 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(1,2)(dd) ;
197 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
198 res[5] =
new Term_eq (dd, val, der) ;
201 res[5] =
new Term_eq (dd, val) ;
254 bool doder = (
syst->
term[place]->der_t==0x0) ?
false :
true ;
264 detval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
272 detder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
293 cmpval = (*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
294 -(*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
297 cmpder = (*
syst->
term[place]->der_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
300 - (*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
301 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
302 res[0] =
new Term_eq (dd, val, der) ;
305 res[0] =
new Term_eq (dd, val) ;
309 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
310 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd) ;
313 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
316 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(3,3)(dd) ;
317 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
318 res[1] =
new Term_eq (dd, val, der) ;
321 res[1] =
new Term_eq (dd, val) ;
325 cmpval = (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
326 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd) ;
329 cmpder = (*
syst->
term[place]->der_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
332 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(2,2)(dd) ;
333 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
334 res[2] =
new Term_eq (dd, val, der) ;
337 res[2] =
new Term_eq (dd, val) ;
341 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
342 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,3)(dd) ;
345 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
348 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(1,3)(dd) ;
349 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
350 res[3] =
new Term_eq (dd, val, der) ;
353 res[3] =
new Term_eq (dd, val) ;
357 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
358 -(*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
361 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
364 - (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
365 der.
set_domain(dd) = cmpder/ detval - cmpval * detder / detval/detval ;
366 res[4] =
new Term_eq (dd, val, der) ;
369 res[4] =
new Term_eq (dd, val) ;
373 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
374 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd) ;
377 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
380 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(1,2)(dd) ;
381 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
382 res[5] =
new Term_eq (dd, val, der) ;
385 res[5] =
new Term_eq (dd, val) ;
441 type_ind.
set(0) = COV ; type_ind.
set(1) = COV ; type_ind.
set(2) = CON ;
446 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
448 Index pos (res_val) ;
454 cmpval +=
conformal(dd) * (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) +
455 (*flat_der.
val_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
val_t)(l, pos(0)+1, pos(1)+1)(dd))) ;
471 cmpder +=
conformal(dd) * (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) +
472 (*flat_der.
val_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
val_t)(l, pos(0)+1, pos(1)+1)(dd))
473 + 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) +
474 (*flat_der.
der_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
der_t)(l, pos(0)+1, pos(1)+1)(dd))) ;
478 cmpder += ((*
p_met_con[dd]->der_t)(pos(2)+1,l)(dd)*(*
p_met_cov[dd]->val_t)(pos(0)+1,pos(1)+1)(dd)
511 indices.
set(0) = CON ; indices.
set(1) = COV ; indices.
set(2) = COV ; indices.
set(3) = COV ;
516 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
518 Index pos (res_val) ;
522 - (*flat_der.
val_t)(pos(3)+1, pos(1)+1, pos(2)+1, pos(0)+1)(dd))) ;
525 cmpval -= (*
p_christo[dd]->val_t)(pos(1)+1, pos(3)+1, pos(0)+1)(dd)*
grad_conf(pos(2)+1)(dd) ;
526 cmpval += (*
p_christo[dd]->val_t)(pos(1)+1, pos(2)+1, pos(0)+1)(dd)*
grad_conf(pos(3)+1)(dd) ;
529 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)
530 - (*
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) ;
538 - (*flat_der.
der_t)(pos(3)+1, pos(1)+1, pos(2)+1, pos(0)+1)(dd))) ;
540 cmpder -= (*
p_christo[dd]->der_t)(pos(1)+1, pos(3)+1, pos(0)+1)(dd)*
grad_conf(pos(2)+1)(dd) ;
541 cmpder += (*
p_christo[dd]->der_t)(pos(1)+1, pos(2)+1, pos(0)+1)(dd)*
grad_conf(pos(3)+1)(dd) ;
545 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)
546 + (*
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)
547 - (*
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)
548 - (*
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);
577 indices.
set(0) = COV ; indices.
set(1) = COV ;
582 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
584 Index pos (res_val) ;
591 cmpval +=
conformal(dd)*((*flat_der.
val_t)(l, pos(1)+1,pos(0)+1,l)(dd)
592 - (*flat_der.
val_t)(pos(1)+1, pos(0)+1,l ,l)(dd)) ;
598 cmpval += (*
p_christo[dd]->val_t)(l,m, l)(dd)*(*
p_christo[dd]->val_t)(pos(0)+1,pos(1)+1,m)(dd)
599 - (*
p_christo[dd]->val_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,m,l)(dd) ;
609 cmpder +=
conformal(dd)*((*flat_der.
der_t)(l, pos(1)+1,pos(0)+1,l)(dd)
610 - (*flat_der.
der_t)(pos(1)+1, pos(0)+1,l ,l)(dd)) ;
617 cmpder += (*
p_christo[dd]->der_t)(l,m, l)(dd)*(*
p_christo[dd]->val_t)(pos(0)+1,pos(1)+1,m)(dd)
618 + (*
p_christo[dd]->val_t)(l,m, l)(dd)*(*
p_christo[dd]->der_t)(pos(0)+1,pos(1)+1,m)(dd)
619 - (*
p_christo[dd]->der_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,m,l)(dd)
620 - (*
p_christo[dd]->val_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,m,l)(dd);
644 for (
int i=1 ; i<=3 ; i++)
645 for (
int j=i ; j<=3 ; j++) {
647 if (ricci_flat.
der_t !=0x0)
684 if (ind_der==
char(start))
694 while ((!found) && (start<123)) ;
696 cerr <<
"Trouble with indices in derive (you are not using tensors of order > 24, are you ?)" << endl ;
699 char name_sum = char(start) ;
701 bool doder = ((so.
der_t==0x0) || (
p_christo[dd]->der_t==0x0)) ?
false :
true ;
709 p_christo[dd]->val_t->set_name_affected() ;
710 p_christo[dd]->val_t->set_name_ind(0, ind_der) ;
711 if (genre_indice==COV) {
713 p_christo[dd]->val_t->set_name_ind(2, name_sum) ;
717 p_christo[dd]->val_t->set_name_ind(1, name_sum) ;
721 p_christo[dd]->der_t->set_name_affected() ;
722 p_christo[dd]->der_t->set_name_ind(0, ind_der) ;
723 if (genre_indice==COV) {
725 p_christo[dd]->der_t->set_name_ind(2, name_sum) ;
729 p_christo[dd]->der_t->set_name_ind(1, name_sum) ;
739 bool need_sum = false ;
740 char const * ind =
p_christo[dd]->val_t->get_name_ind() ;
741 if ((ind[0]==ind[2]) || (ind[1]==ind[2]) || (ind[0]==ind[1]))
752 christ =
new Term_eq (auxi_christ) ;
771 Term_eq part_christo ((*christ)*copie) ;
774 if (genre_indice==CON)
775 res = res + part_christo ;
777 res = res - part_christo ;
793 cerr <<
"Metric already set for the system" << endl ;
799 trim_spaces (ss.
name_met, name_met) ;
reference set(const Index &pos)
Read/write of an element.
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 conformal decomposition (mainly used for AADS spacetimes) The true...
virtual Term_eq derive(int, char, const Term_eq &) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
Metric_flat fmet
Associated flat metric.
virtual void compute_ricci_tensor(int) const
Computes the Ricci tensor, in a given Domain.
Vector grad_conf
flat gradient of the conformal factor
Metric_conf_factor(Metric_tensor &, const Scalar &conf)
Constructor from a Metric_tensor and a conformal factor.
Metric_tensor * p_met
Pointer on the Metric_tensor describing the coformal metric.
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.
int place_syst
Gives the location of the metric amongst the various unknowns of the associated System_of_eqs.
virtual void compute_cov(int) const
Computes the covariant representation, in a given Domain.
virtual void compute_riemann(int) const
Computes the Riemann tensor, in a given Domain.
virtual Term_eq derive_flat(int, char, const Term_eq &) const
Computes the covariant flat derivative of a Term_eq.
virtual void compute_con(int) const
Computes the contravariant representation, in a given Domain.
Scalar conformal
The conformal factor (must be a purely radial function)
virtual int give_type(int) const
Returns the type of tensorial basis of the covariant representation, in a given Domain.
const Base_tensor & basis
The tensorial basis used.
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 Term_eq * give_ricci_tensor(int dd) const
Gives the Ricci tensor, in a Domain.
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.
const Domain * get_domain(int i) const
returns a pointer on the domain.
int get_ndim() const
Returns the number of dimensions.
int get_nbr_domains() const
Returns the number of Domains.
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_n_comp() const
Returns the number of stored components.
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.
void set_der_t(Tensor)
Sets the tensorial variation (only the values in the pertinent Domain are copied).
Tensor const & get_val_t() const
Tensor const & get_der_t() const
void set_val_t(Tensor)
Sets the tensorial value (only the values in the pertinent Domain are copied).
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...
Scalar & set(int)
Read/write access to a component.