120 #include "connection.h" 134 : mp(&(delta_i.get_mp())),
135 triad(delta_i.get_triad()),
138 flat_met(&flat_met_i) {
155 : mp(&(met.get_mp())),
156 triad(met.cov().get_triad()),
157 delta(*mp, CON, COV, COV, *triad, 1, 2),
159 flat_met(&flat_met_i) {
172 assoc_metric(conn_i.assoc_metric),
173 flat_met(conn_i.flat_met) {
184 delta(mpi, CON, COV, COV, bi, 1, 2),
287 for (
int k=1; k<=3; k++) {
288 for (
int i=1; i<=3; i++) {
289 for (
int j=1; j<=i; j++) {
292 for (
int l=1; l<=3; l++) {
293 cc += gam.
con()(k,l) * (
294 dgam(l,j,i) + dgam(i,l,j) - dgam(i,j,l) ) ;
316 int valence1 = valence0 + 1 ;
317 int valence1m1 = valence1 - 1 ;
338 Itbl tipe(valence1) ;
340 for (
int id = 0;
id<valence0;
id++) {
341 tipe.
set(
id) = tipeuu(
id) ;
343 tipe.
set(valence1m1) = COV ;
359 Itbl ind1(valence1) ;
360 Itbl ind0(valence0) ;
368 for (
int ic=0; ic<ncomp0; ic++) {
369 int dzp = uu(uu.
indices(ic)).get_dzpuis() ;
371 if (dzp > dz_in) dz_in = dzp ;
376 for (
int ic=0; ic<ncomp0; ic++) {
377 if ( !(uu(uu.
indices(ic)).check_dzpuis(dz_in)) ) {
378 cout <<
"######## WARNING #######\n" ;
379 cout <<
" Connection::p_derive_cov : the tensor components \n" 380 <<
" do not have all the same dzpuis ! : \n" 381 <<
" ic, dzpuis(ic), dz_in : " << ic <<
" " 382 << uu(uu.
indices(ic)).get_dzpuis() <<
" " << dz_in << endl ;
396 for (
int ic=0; ic<ncomp1; ic++) {
402 for (
int id = 0;
id < valence0;
id++) {
403 ind0.
set(
id) = ind1(
id) ;
407 int k = ind1(valence1m1) ;
412 for (
int id=0;
id<valence0;
id++) {
419 for (
int l=1; l<=3; l++) {
421 tmp +=
delta(ind0(
id), k, l) * uu(ind) ;
427 for (
int l=1; l<=3; l++) {
429 tmp -=
delta(l, k, ind0(
id)) * uu(ind) ;
436 "Connection::p_derive_cov : unexpected type of index !\n" ;
449 resu->
set(ind1) += tmp ;
473 int valence1 = valence0 - 1 ;
474 int valence0m1 = valence0 - 1 ;
480 assert (valence0 >= 1) ;
496 Itbl tipe(valence1) ;
498 for (
int id = 0;
id<valence1;
id++) {
499 tipe.
set(
id) = tipeuu(
id) ;
535 int ncomp1 = resu->get_n_comp() ;
537 Itbl ind0(valence0) ;
538 Itbl ind1(valence1) ;
547 for (
int ic=0; ic<ncomp0; ic++) {
548 int dzp = uu(uu.
indices(ic)).get_dzpuis() ;
550 if (dzp > dz_in) dz_in = dzp ;
555 for (
int ic=0; ic<ncomp0; ic++) {
556 if ( !(uu(uu.
indices(ic)).check_dzpuis(dz_in)) ) {
557 cout <<
"######## WARNING #######\n" ;
558 cout <<
" Connection::p_divergence : the tensor components \n" 559 <<
" do not have all the same dzpuis ! : \n" 560 <<
" ic, dzpuis(ic), dz_in : " << ic <<
" " 561 << uu(uu.
indices(ic)).get_dzpuis() <<
" " << dz_in << endl ;
580 for (
int ic=0; ic<ncomp1; ic++) {
583 ind1 = resu->indices(ic) ;
586 for (
int id = 0;
id < valence1;
id++) {
587 ind0.
set(
id) = ind1(
id) ;
593 for (
int l=1; l<=3; l++) {
594 ind0.
set(valence0m1) = l ;
595 tmp += delta_trace(l) * uu(ind0) ;
598 ind0.
set(valence0m1) = -1 ;
604 for (
int id=0;
id<valence1;
id++) {
612 for (
int l=1; l<=3; l++) {
614 for (
int k=1; k<=3; k++) {
615 ind.
set(valence0m1) = k ;
616 tmp +=
delta(ind0(
id), l, k) * uu(ind) ;
623 for (
int l=1; l<=3; l++) {
625 for (
int k=1; k<=3; k++) {
626 ind.
set(valence0m1) = k ;
627 tmp -=
delta(l, ind0(
id), k) * uu(ind) ;
635 "Connection::p_divergence : unexpected type of index !\n" ;
648 resu->set(ind1) += tmp ;
679 for (
int i=1; i<=3; i++) {
683 for (
int j=1; j<=jmax; j++) {
687 for (
int k=1; k<=3; k++) {
688 tmp1 += d_delta(k,i,j,k) ;
693 for (
int k=1; k<=3; k++) {
694 tmp2 += d_delta(k,i,k,j) ;
699 for (
int k=1; k<=3; k++) {
700 for (
int m=1; m<=3; m++) {
708 for (
int k=1; k<=3; k++) {
709 for (
int m=1; m<=3; m++) {
715 p_ricci->
set(i,j) = tmp1 - tmp2 + tmp3 - tmp4 ;
Metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
int & set(int i)
Read/write of a particular element (index i ) (1D case)
virtual const Tensor & ricci() const
Computes (if not up to date) and returns the Ricci tensor associated with the current connection...
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
const Map *const mp
Reference mapping.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int sym_index1() const
Number of the first symmetric index (0<= id_sym1 < valence )
bool assoc_metric
Indicates whether the connection is associated with a metric (in which case the Ricci tensor is symme...
void operator=(const Connection &)
Assignment to another Connection.
Flat metric for tensor calculation.
Tensor field of valence 0 (or component of a tensorial field).
Base class for coordinate mappings.
virtual Tensor * p_derive_cov(const Tensor &tens) const
Computes the covariant derivative of a tensor (with respect to the current connection).
int get_n_comp() const
Returns the number of stored components.
int sym_index2() const
Number of the second symmetric index (id_sym1 < id_sym2 < valence )
Basic integer array class.
Tensor_sym delta
Tensor which defines the connection with respect to the flat one: is the difference between the con...
Tensor field of valence 1.
const Tensor_sym & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Vectorial bases (triads) with respect to which the tensorial components are defined.
const Metric_flat * flat_met
Flat metric with respect to which (member delta ) is defined.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
void del_deriv() const
Deletes all the derived quantities.
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
void update(const Tensor_sym &delta_i)
Update the connection when it is defined ab initio.
Connection(const Tensor_sym &delta_i, const Metric_flat &flat_met_i)
Standard constructor ab initio.
virtual ~Connection()
Destructor.
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
int get_valence() const
Returns the valence.
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
void fait_delta(const Metric &)
Computes the difference between the connection coefficients and that a the flat connection in the ca...
Symmetric tensors (with respect to two of their arguments).
Tensor * p_ricci
Pointer of the Ricci tensor associated with the connection.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values of the Scalar in the co...
const Base_vect *const triad
Triad with respect to which the connection coefficients are defined.
Class intended to describe valence-2 symmetric tensors.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
virtual Tensor * p_divergence(const Tensor &tens) const
Computes the divergence of a tensor (with respect to the current connection).