KADATH
ope_int_volume.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 "system_of_eqs.hpp"
24 namespace Kadath {
25 Ope_int_volume::Ope_int_volume (const System_of_eqs* zesys, Ope_eq* target) : Ope_eq(zesys, target->get_dom(), 1) {
26  parts[0] = target ;
27 }
28 
30 }
31 
33 
34  Term_eq target (parts[0]->action()) ;
35  if (target.get_type_data()==TERM_T)
36  return target.val_t->get_space().get_domain(dom)->integ_volume_term_eq(target) ;
37  else {
38  assert (target.get_type_data()==TERM_D) ;
39  Scalar auxival (syst->get_space()) ;
40  auxival.set_domain(dom) = target.get_val_d() ;
41  auxival.set_domain(dom).std_base() ;
42  if (target.der_d==0x0) {
43  Term_eq auxi (dom, auxival) ;
44  return auxi.val_t->get_space().get_domain(dom)->integ_volume_term_eq(auxi) ;
45  }
46  else {
47  Scalar auxider (syst->get_space()) ;
48  auxider.set_domain(dom) = target.get_der_d() ;
49  auxider.set_domain(dom).std_base() ;
50  Term_eq auxi (dom, auxival, auxider) ;
51  return auxi.val_t->get_space().get_domain(dom)->integ_volume_term_eq(auxi) ;
52  }
53  }
54 }
55 }
virtual Term_eq integ_volume_term_eq(const Term_eq &so) const
Volume integral of a Term_eq.
Definition: domain.cpp:901
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
int dom
Index of the Domain where the operator is defined.
Definition: ope_eq.hpp:36
Term_eq action() const override
Computes the action of the current Ope_eq using its various parts.
~Ope_int_volume() override
Destructor.
Ope_int_volume(const System_of_eqs *syst, Ope_eq *so)
Constructor.
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Definition: scalar.hpp:67
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
Definition: scalar.hpp:555
const Domain * get_domain(int i) const
returns a pointer on the domain.
Definition: space.hpp:1385
Class used to describe and solve a system of equations.
const Space & get_space() const
Returns the space.
const Space & get_space() const
Returns the Space.
Definition: tensor.hpp:499
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62
double get_der_d() const
Definition: term_eq.hpp:341
double get_val_d() const
Definition: term_eq.hpp:327
int get_type_data() const
Definition: term_eq.hpp:131
double * der_d
Pointer on the variation if the Term_eq is a double.
Definition: term_eq.hpp:67
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Definition: term_eq.hpp:68
void std_base()
Sets the standard basis of decomposition.
Definition: val_domain.cpp:246