28char connection_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Connection/connection.C,v 1.19 2014/10/13 08:52:49 j_novak Exp $" ;
117#include "connection.h"
131 : mp(&(delta_i.get_mp())),
132 triad(delta_i.get_triad()),
135 flat_met(&flat_met_i) {
152 : mp(&(met.get_mp())),
153 triad(met.cov().get_triad()),
154 delta(*mp, CON, COV, COV, *triad, 1, 2),
156 flat_met(&flat_met_i) {
169 assoc_metric(conn_i.assoc_metric),
170 flat_met(conn_i.flat_met) {
181 delta(mpi, CON, COV, COV, bi, 1, 2),
284 for (
int k=1; k<=3; k++) {
285 for (
int i=1; i<=3; i++) {
286 for (
int j=1; j<=i; j++) {
289 for (
int l=1; l<=3; l++) {
290 cc += gam.
con()(k,l) * (
291 dgam(l,j,i) + dgam(i,l,j) - dgam(i,j,l) ) ;
313 int valence1 = valence0 + 1 ;
314 int valence1m1 = valence1 - 1 ;
335 Itbl tipe(valence1) ;
337 for (
int id = 0;
id<valence0;
id++) {
338 tipe.
set(
id) = tipeuu(
id) ;
340 tipe.
set(valence1m1) = COV ;
356 Itbl ind1(valence1) ;
357 Itbl ind0(valence0) ;
365 for (
int ic=0; ic<ncomp0; ic++) {
366 int dzp = uu(uu.
indices(ic)).get_dzpuis() ;
368 if (dzp > dz_in) dz_in = dzp ;
373 for (
int ic=0; ic<ncomp0; ic++) {
374 if ( !(uu(uu.
indices(ic)).check_dzpuis(dz_in)) ) {
375 cout <<
"######## WARNING #######\n" ;
376 cout <<
" Connection::p_derive_cov : the tensor components \n"
377 <<
" do not have all the same dzpuis ! : \n"
378 <<
" ic, dzpuis(ic), dz_in : " << ic <<
" "
379 << uu(uu.
indices(ic)).get_dzpuis() <<
" " << dz_in << endl ;
393 for (
int ic=0; ic<ncomp1; ic++) {
399 for (
int id = 0;
id < valence0;
id++) {
400 ind0.
set(
id) = ind1(
id) ;
404 int k = ind1(valence1m1) ;
409 for (
int id=0;
id<valence0;
id++) {
416 for (
int l=1; l<=3; l++) {
418 tmp +=
delta(ind0(
id), k, l) * uu(ind) ;
424 for (
int l=1; l<=3; l++) {
426 tmp -=
delta(l, k, ind0(
id)) * uu(ind) ;
433 "Connection::p_derive_cov : unexpected type of index !\n" ;
446 resu->
set(ind1) += tmp ;
470 int valence1 = valence0 - 1 ;
471 int valence0m1 = valence0 - 1 ;
477 assert (valence0 >= 1) ;
493 Itbl tipe(valence1) ;
495 for (
int id = 0;
id<valence1;
id++) {
496 tipe.
set(
id) = tipeuu(
id) ;
534 Itbl ind0(valence0) ;
535 Itbl ind1(valence1) ;
544 for (
int ic=0; ic<ncomp0; ic++) {
545 int dzp = uu(uu.
indices(ic)).get_dzpuis() ;
547 if (dzp > dz_in) dz_in = dzp ;
552 for (
int ic=0; ic<ncomp0; ic++) {
553 if ( !(uu(uu.
indices(ic)).check_dzpuis(dz_in)) ) {
554 cout <<
"######## WARNING #######\n" ;
555 cout <<
" Connection::p_divergence : the tensor components \n"
556 <<
" do not have all the same dzpuis ! : \n"
557 <<
" ic, dzpuis(ic), dz_in : " << ic <<
" "
558 << uu(uu.
indices(ic)).get_dzpuis() <<
" " << dz_in << endl ;
577 for (
int ic=0; ic<ncomp1; ic++) {
583 for (
int id = 0;
id < valence1;
id++) {
584 ind0.
set(
id) = ind1(
id) ;
590 for (
int l=1; l<=3; l++) {
591 ind0.
set(valence0m1) = l ;
592 tmp += delta_trace(l) * uu(ind0) ;
595 ind0.
set(valence0m1) = -1 ;
601 for (
int id=0;
id<valence1;
id++) {
609 for (
int l=1; l<=3; l++) {
611 for (
int k=1; k<=3; k++) {
612 ind.
set(valence0m1) = k ;
613 tmp +=
delta(ind0(
id), l, k) * uu(ind) ;
620 for (
int l=1; l<=3; l++) {
622 for (
int k=1; k<=3; k++) {
623 ind.
set(valence0m1) = k ;
624 tmp -=
delta(l, ind0(
id), k) * uu(ind) ;
632 "Connection::p_divergence : unexpected type of index !\n" ;
645 resu->
set(ind1) += tmp ;
676 for (
int i=1; i<=3; i++) {
680 for (
int j=1; j<=jmax; j++) {
684 for (
int k=1; k<=3; k++) {
685 tmp1 += d_delta(k,i,j,k) ;
690 for (
int k=1; k<=3; k++) {
691 tmp2 += d_delta(k,i,k,j) ;
696 for (
int k=1; k<=3; k++) {
697 for (
int m=1; m<=3; m++) {
705 for (
int k=1; k<=3; k++) {
706 for (
int m=1; m<=3; m++) {
712 p_ricci->
set(i,j) = tmp1 - tmp2 + tmp3 - tmp4 ;
Vectorial bases (triads) with respect to which the tensorial components are defined.
Tensor * p_ricci
Pointer of the Ricci tensor associated with the connection.
bool assoc_metric
Indicates whether the connection is associated with a metric (in which case the Ricci tensor is symme...
const Metric_flat * flat_met
Flat metric with respect to which (member delta ) is defined.
void operator=(const Connection &)
Assignment to another Connection.
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
virtual ~Connection()
Destructor.
Connection(const Tensor_sym &delta_i, const Metric_flat &flat_met_i)
Standard constructor ab initio.
void update(const Tensor_sym &delta_i)
Update the connection when it is defined ab initio.
const Base_vect *const triad
Triad with respect to which the connection coefficients are defined.
virtual Tensor * p_derive_cov(const Tensor &tens) const
Computes the covariant derivative of a tensor (with respect to the current connection).
const Map *const mp
Reference mapping.
Tensor_sym delta
Tensor which defines the connection with respect to the flat one: is the difference between the con...
virtual const Tensor & ricci() const
Computes (if not up to date) and returns the Ricci tensor associated with the current connection.
virtual Tensor * p_divergence(const Tensor &tens) const
Computes the divergence of a tensor (with respect to the current connection).
void fait_delta(const Metric &)
Computes the difference between the connection coefficients and that a the flat connection in the ca...
void del_deriv() const
Deletes all the derived quantities.
Basic integer array class.
int & set(int i)
Read/write of a particular element (index i ) (1D case)
Base class for coordinate mappings.
Flat metric for tensor calculation.
Metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Tensor field of valence 0 (or component of a tensorial field).
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
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...
Class intended to describe valence-2 symmetric tensors.
Symmetric tensors (with respect to two of their arguments).
Tensor field of valence 1.
int sym_index1() const
Number of the first symmetric index (0<= id_sym1 < valence )
const Tensor_sym & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
int sym_index2() const
Number of the second symmetric index (id_sym1 < id_sym2 < valence )
int get_valence() const
Returns the valence.
virtual Itbl indices(int pos) const
Returns the indices of a component given by its position in the array cmp .
int get_n_comp() const
Returns the number of stored components.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).