KADATH
ope_der_background.cpp
1 /*
2  Copyright 2017 Philippe Grandclement
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "ope_eq.hpp"
21 #include "scalar.hpp"
22 #include "tensor_impl.hpp"
23 #include "tensor.hpp"
24 #include "metric.hpp"
25 #include "system_of_eqs.hpp"
26 namespace Kadath {
27 Ope_der_background::Ope_der_background (const System_of_eqs* zesys, int tt, char ind, Ope_eq* target) : Ope_eq(zesys, target->get_dom(), 1),
28  type_der (tt), ind_der(ind) {
29 
30  assert ((tt==COV) || (tt==CON)) ;
31  parts[0] = target ;
32 }
33 
35 }
36 
38  Term_eq target (parts[0]->action()) ;
39  // Check it is a tensor
40  if (target.type_data != TERM_T) {
41  cerr << "Ope_der_background only defined with respect for a tensor" << endl ;
42  abort() ;
43  }
44 
45  return (syst->get_met()->get_background()->derive(type_der, ind_der, target)) ;
46 }
47 }
virtual Term_eq derive(int typeder, char nameder, const Term_eq &so) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
Definition: metric.cpp:290
virtual const Metric * get_background() const
Returns a pointer on the background metric, if it exists.
Definition: metric.cpp:167
Ope_der_background(const System_of_eqs *syst, int typeder, char indder, Ope_eq *so)
Constructor.
char ind_der
Name of the index of the derivative.
Definition: ope_eq.hpp:418
int type_der
Type of derivative (CON or COV)
Definition: ope_eq.hpp:417
Term_eq action() const override
Computes the action of the current Ope_eq using its various parts.
~Ope_der_background() override
Destructor.
Abstract class that describes the various operators that can appear in the equations.
Definition: ope_eq.hpp:32
const System_of_eqs * syst
The associated System_of_eqs.
Definition: ope_eq.hpp:35
MMPtr_array< Ope_eq > parts
Pointers of the various parts of the current operator.
Definition: ope_eq.hpp:38
Class used to describe and solve a system of equations.
const Metric * get_met() const
Returns a pointer on the Metric.
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62
const int type_data
Flag describing the type of data :
Definition: term_eq.hpp:75