KADATH
ope_import.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 "system_of_eqs.hpp"
25 namespace Kadath {
26 Ope_import::Ope_import (const System_of_eqs* zesys, int dd, int bb, const char* target) : Ope_eq(zesys, dd), bound(bb),
27  others(syst->get_space().get_indices_matching_non_std(dd, bb)) {
28 
29  n_ope = others.get_size(1) ;
30  parts.resize(n_ope) ;
31  for (int i=0 ; i<n_ope ; i++)
32  parts[i] = syst->give_ope (others(0, i), target, others(1, i)) ;
33 }
34 
36 }
37 
39 
40  Term_eq** res = new Term_eq* [n_ope] ;
41  for (int i=0 ; i<n_ope ; i++)
42  res[i] = new Term_eq (parts[i]->action()) ;
43 
44  Term_eq result (syst->get_space().get_domain(dom)->import(dom, bound, n_ope, res)) ;
45  for (int i=0 ; i<n_ope ; i++)
46  delete res[i] ;
47  delete [] res ;
48 
49  // Call the member function from domain
50  return result ;
51 }
52 }
int get_size(int i) const
Returns the size of a given dimension.
Definition: array.hpp:331
Term_eq import(int numdom, int bound, int n_ope, Term_eq **parts) const
Gets the value of a Term_eq by importing data from neighboring domains, on a boundary.
Definition: domain.cpp:107
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 n_ope
Number of terms involved (2 for + for instance, only one for sqrt...)
Definition: ope_eq.hpp:37
int dom
Index of the Domain where the operator is defined.
Definition: ope_eq.hpp:36
Array< int > others
2d array containing.
Definition: ope_eq.hpp:1297
~Ope_import() override
Destructor.
Definition: ope_import.cpp:35
Term_eq action() const override
Computes the action of the current Ope_eq using its various parts.
Definition: ope_import.cpp:38
int bound
The boundary where the field is imported.
Definition: ope_eq.hpp:1291
Ope_import(const System_of_eqs *syst, int dd, int bb, const char *field)
Constructor.
Definition: ope_import.cpp:26
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.
Ope_eq * give_ope(int dom, const char *name, int bb=0) const
Function that reads a string and returns a pointer on the generated Ope_eq.
Definition: give_ope.cpp:559
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62