KADATH
ope_dr.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
namespace
Kadath {
24
Ope_dr::Ope_dr
(
const
System_of_eqs
* zesys,
Ope_eq
* target) :
Ope_eq
(zesys, target->get_dom(), 1) {
25
parts
[0] = target ;
26
}
27
28
Ope_dr::~Ope_dr
() {
29
}
30
31
Term_eq
Ope_dr::action
()
const
{
32
Term_eq
target (
parts
[0]->
action
()) ;
33
return
target.
val_t
->
get_space
().
get_domain
(
dom
)->
dr_term_eq
(target) ;
34
35
/*Term_eq target (parts[0]->action()) ;
36
// Check it is a tensor
37
if (target.type_data != TERM_T) {
38
cerr << "Ope_dr only defined with respect for a tensor" << endl ;
39
abort() ;
40
}
41
42
// The value
43
Tensor resval (*target.val_t, false) ;
44
45
for (int i=0 ; i<target.val_t->get_n_comp() ; i++) {
46
Array<int> ind (target.val_t->indices(i)) ;
47
Val_domain value ((*target.val_t)(ind)(dom)) ;
48
if (value.check_if_zero())
49
resval.set(ind).set_domain(dom).set_zero() ;
50
else {
51
Val_domain auxi (value.get_domain()->der_r(value)) ;
52
resval.set(ind).set_domain(dom) = auxi ;
53
}
54
}
55
56
if (target.der_t!=0x0) {
57
Tensor resder (*target.der_t, false) ;
58
for (int i=0 ; i<target.der_t->get_n_comp() ; i++) {
59
Array<int> ind (target.der_t->indices(i)) ;
60
Val_domain value ((*target.der_t)(ind)(dom)) ;
61
if (value.check_if_zero())
62
resder.set(ind).set_domain(dom).set_zero() ;
63
else {
64
Val_domain auxi (value.get_domain()->der_r(value)) ;
65
resder.set(ind).set_domain(dom) = auxi ;
66
}
67
}
68
Term_eq res (dom, resval, resder) ;
69
return res ;
70
}
71
else {
72
Term_eq res (dom, resval) ;
73
return res ;
74
}*/
75
76
}}
Kadath::Domain::dr_term_eq
virtual Term_eq dr_term_eq(const Term_eq &so) const
Radial derivative of a Term_eq.
Definition:
domain.cpp:145
Kadath::Ope_dr::Ope_dr
Ope_dr(const System_of_eqs *syst, Ope_eq *so)
Constructor.
Definition:
ope_dr.cpp:24
Kadath::Ope_dr::action
Term_eq action() const override
Computes the action of the current Ope_eq using its various parts.
Definition:
ope_dr.cpp:31
Kadath::Ope_dr::~Ope_dr
~Ope_dr() override
Destructor.
Definition:
ope_dr.cpp:28
Kadath::Ope_eq
Abstract class that describes the various operators that can appear in the equations.
Definition:
ope_eq.hpp:32
Kadath::Ope_eq::parts
MMPtr_array< Ope_eq > parts
Pointers of the various parts of the current operator.
Definition:
ope_eq.hpp:38
Kadath::Ope_eq::dom
int dom
Index of the Domain where the operator is defined.
Definition:
ope_eq.hpp:36
Kadath::Space::get_domain
const Domain * get_domain(int i) const
returns a pointer on the domain.
Definition:
space.hpp:1385
Kadath::System_of_eqs
Class used to describe and solve a system of equations.
Definition:
system_of_eqs.hpp:60
Kadath::Tensor::get_space
const Space & get_space() const
Returns the Space.
Definition:
tensor.hpp:499
Kadath::Term_eq
This class is intended to describe the manage objects appearing in the equations.
Definition:
term_eq.hpp:62
Kadath::Term_eq::val_t
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Definition:
term_eq.hpp:68
src
Ope_eq
ope_dr.cpp
Generated by
1.9.1