KADATH
spheric_adapted_add_eq.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 "headcpp.hpp"
21 #include "adapted.hpp"
22 #include "utilities.hpp"
23 #include "point.hpp"
24 #include "scalar.hpp"
25 #include "tensor_impl.hpp"
26 #include "system_of_eqs.hpp"
27 #include "name_tools.hpp"
28 namespace Kadath {
30 
31  // Check the last domain is of the right type :
32  const Domain_compact* pcomp = dynamic_cast <const Domain_compact*> (domains[nbr_domains-1]) ;
33  if (pcomp==0x0) {
34  cerr << "add_eq_int_inf requires a compactified domain" << endl ;
35  abort() ;
36  }
37  int dom = nbr_domains-1 ;
38 
39  // Get the lhs and rhs
40  char p1[LMAX] ;
41  char p2[LMAX] ;
42  bool indic = sys.is_ope_bin(nom, p1, p2, '=') ;
43  if (!indic) {
44  cerr << "= needed for equations" << endl ;
45  abort() ;
46  }
47  else {
48  // Construction of the equation
49  sys.eq_int[sys.neq_int] = new Eq_int(1) ;
50 
51  // Affectation :
52  sys.eq_int[sys.neq_int]->set_part(0, new Ope_sub(&sys, sys.give_ope(dom, p1, OUTER_BC), sys.give_ope(dom, p2, OUTER_BC))) ;
53  sys.neq_int ++ ;
54  }
55  sys.nbr_conditions = -1 ;
56 }
57 
58 void Space_spheric_adapted::add_eq_int_volume (System_of_eqs& sys, int nz, const char* nom) {
59 
60  // Get the lhs and rhs
61  char p1[LMAX] ;
62  char p2[LMAX] ;
63  bool indic = sys.is_ope_bin(nom, p1, p2, '=') ;
64  if (!indic) {
65  cerr << "= needed for equations" << endl ;
66  abort() ;
67  }
68  else {
69  // Construction of the equation
70  sys.eq_int[sys.neq_int] = new Eq_int(nz+1) ;
71 
72  // Affectation of the intregrale parts
73  for (int d=0 ; d<nz ; d++)
74  sys.eq_int[sys.neq_int]->set_part(d, sys.give_ope(d, p1)) ;
75  // Affectation of the second member (constant value)
76  sys.eq_int[sys.neq_int]->set_part(nz, new Ope_minus(&sys, sys.give_ope(0, p2))) ;
77  sys.neq_int ++ ;
78  }
79  sys.nbr_conditions = -1 ;
80 }
81 
82 void Space_spheric_adapted::add_eq (System_of_eqs& sys, const char* eq, const char* rac, const char* rac_der, int nused, Array<int>** pused) {
83  for (int dd=sys.get_dom_min() ; dd<sys.get_dom_max(); dd++) {
84  sys.add_eq_inside (dd, eq, nused, pused) ;
85  sys.add_eq_matching (dd, OUTER_BC, rac, nused, pused) ;
86  sys.add_eq_matching (dd, OUTER_BC, rac_der, nused, pused) ;
87  }
88  sys.add_eq_inside (sys.get_dom_max(), eq, nused, pused) ;
89 }}
Class for a spherical compactified domain and a symmetry with respect to the plane .
Definition: spheric.hpp:1007
Class implementing an integral equation.
The operator minus.
Definition: ope_eq.hpp:128
The operator substraction.
Definition: ope_eq.hpp:165
void add_eq(System_of_eqs &syst, const char *eq, const char *rac, const char *rac_der, int nused=-1, Array< int > **pused=0x0)
Adds a bulk equation and two matching conditions.
void add_eq_int_inf(System_of_eqs &syst, const char *eq)
Adds an equation being a surface integral at infinity.
void add_eq_int_volume(System_of_eqs &syst, int nz, const char *eq)
Adds an equation being a volume integral in the domains below a given number.
Domain ** domains
Pointers on the various Domains.
Definition: space.hpp:1368
int nbr_domains
Number od Domains.
Definition: space.hpp:1365
Class used to describe and solve a system of equations.
virtual void add_eq_inside(int dom, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation to be solved inside a domain (assumed to be second order).
Definition: add_eq.cpp:26
virtual void add_eq_matching(int dom, int bb, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation describing a matching condition between two domains (standard setting)
Definition: add_eq.cpp:198
int neq_int
Number of integral equations (i.e. which are doubles)
bool is_ope_bin(const char *input, char *p1, char *p2, char symb) const
Checks if a string represents an operator of the type "a + b".
Definition: give_ope.cpp:276
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
int get_dom_max() const
Returns the highest index of the domains.
int nbr_conditions
Total number of conditions (the number of coefficients of all the equations, once regularities are ta...
int get_dom_min() const
Returns the smallest index of the domains.
MMPtr_array< Eq_int > eq_int
Pointers onto the integral equations.