KADATH
ope_conjug.cpp
1 /*
2  Copyright 2021 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_conjug::Ope_conjug (const System_of_eqs* zesys, Ope_eq* target) : Ope_eq(zesys, target->get_dom(), 1) {
25  parts[0] = target ;
26 
27 }
28 
30 }
31 
33 
34  Term_eq target (parts[0]->action()) ;
35 
36  // Check it is a tensor
37  if (target.type_data != TERM_T) {
38  cerr << "Ope_conjug only defined with respect for a tensor" << endl ;
39  abort() ;
40  }
41 
42  if (target.val_t->get_n_comp() != 1) {
43  cerr << "Ope_conjug only defined with respect to a scalar" << endl ;
44  abort() ;
45  }
46 
47  int m_res = inv_m_quant (target.val_t->get_parameters()) ;
48  if (m_res!=0) {
49  target.val_t->set_parameters().set_m_quant() = m_res ;
50  if (target.der_t!=0x0)
51  target.der_t->set_parameters().set_m_quant() = m_res ;
52  }
53 
54  return target ;
55 }}
Ope_conjug(const System_of_eqs *syst, Ope_eq *so)
Constructor.
Definition: ope_conjug.cpp:24
~Ope_conjug() override
Destructor.
Definition: ope_conjug.cpp:29
Term_eq action() const override
Computes the action of the current Ope_eq using its various parts.
Definition: ope_conjug.cpp:32
Abstract class that describes the various operators that can appear in the equations.
Definition: ope_eq.hpp:32
MMPtr_array< Ope_eq > parts
Pointers of the various parts of the current operator.
Definition: ope_eq.hpp:38
int & set_m_quant()
Sets .
Definition: tensor.hpp:757
Class used to describe and solve a system of equations.
Param_tensor & set_parameters()
Read/write of the parameters.
Definition: tensor.hpp:314
const Param_tensor & get_parameters() const
Returns a pointer on the possible additional parameter.
Definition: tensor.hpp:311
int get_n_comp() const
Returns the number of stored components.
Definition: tensor.hpp:514
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
Definition: term_eq.hpp:69
const int type_data
Flag describing the type of data :
Definition: term_eq.hpp:75
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Definition: term_eq.hpp:68