KADATH
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 "system_of_eqs.hpp"
21 #include "ope_eq.hpp"
22 #include "name_tools.hpp"
23 #include "list_comp.hpp"
24 
25 namespace Kadath {
26  void System_of_eqs::add_eq_inside (int dom, const char* nom, int n_cmp, Array<int>** p_cmp) {
27  // Is it written like =0 ?
28  char p1[LMAX] ;
29  char p2[LMAX] ;
30  bool indic = is_ope_bin(nom, p1, p2, '=') ;
31  if (!indic) {
32  cerr << "= needed for equations" << endl ;
33  abort() ;
34  }
35  else {
36  // Verif lhs = 0 ?
37  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
38  true : false ;
39 
40  // no lhs :
41  if (indic)
42  eq[neq] = new Eq_inside(espace.get_domain(dom), dom, give_ope(dom, p1), n_cmp, p_cmp) ;
43 
44  else
45  eq[neq] = new Eq_inside(espace.get_domain(dom), dom,
46  new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), n_cmp, p_cmp) ;
47  neq ++ ;
48  }
49  nbr_conditions = -1 ;
50 }
51 
52 void System_of_eqs::add_eq_inside (int dom, const char* nom, const List_comp& list) {
53  add_eq_inside (dom, nom, list.get_ncomp(), list.get_pcomp()) ;
54 }
55 
56 void System_of_eqs::add_eq_order (int dom, int order, const char* nom, int n_cmp, Array<int>** p_cmp) {
57  // Is it written like =0 ?
58  char p1[LMAX] ;
59  char p2[LMAX] ;
60  bool indic = is_ope_bin(nom, p1, p2, '=') ;
61  if (!indic) {
62  cerr << "= needed for equations" << endl ;
63  abort() ;
64  }
65  else {
66  // Verif lhs = 0 ?
67  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
68  true : false ;
69 
70  // no lhs :
71  if (indic)
72  eq[neq] = new Eq_order(espace.get_domain(dom), dom, order, give_ope(dom, p1), n_cmp, p_cmp) ;
73 
74  else
75  eq[neq] = new Eq_order(espace.get_domain(dom), dom, order,
76  new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), n_cmp, p_cmp) ;
77  neq ++ ;
78  }
79  nbr_conditions = -1 ;
80 }
81 
82 void System_of_eqs::add_eq_vel_pot (int dom, int order, const char* nom, const char* const_part) {
83  // Is it written like =0 ?
84  char p1[LMAX] ;
85  char p2[LMAX] ;
86  bool indic1 = is_ope_bin(nom, p1, p2, '=') ;
87 
88  char p3[LMAX] ;
89  char p4[LMAX] ;
90  bool indic2 = is_ope_bin(const_part, p3, p4, '=') ;
91 
92 
93  if ((!indic1) || (!indic2)) {
94  cerr << "= needed for equations" << endl ;
95  abort() ;
96  }
97  else {
98  // Verif lhs1 = 0 ?
99  indic1 = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
100  true : false ;
101 
102  indic2 = ((p4[0]=='0') && (p4[1]==' ') && (p4[2]=='\0')) ?
103  true : false ;
104 
105  // no lhs :
106  if ((indic1) && (indic2))
107  eq[neq] = new Eq_vel_pot(espace.get_domain(dom), dom, order, give_ope(dom, p1), give_ope(dom,p3)) ;
108  // lhs in 1
109  if ((!indic1) && (indic2))
110  eq[neq] = new Eq_vel_pot(espace.get_domain(dom), dom, order, new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), give_ope(dom,p3)) ;
111  // lhs in 2
112  if ((indic1) && (!indic2))
113  eq[neq] = new Eq_vel_pot(espace.get_domain(dom), dom, order, give_ope(dom,p1), new Ope_sub(this, give_ope(dom, p3), give_ope(dom, p4))) ;
114  // both lhs
115  if ((!indic1) && (!indic2))
116  eq[neq] = new Eq_vel_pot(espace.get_domain(dom), dom, order, new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), new Ope_sub(this, give_ope(dom, p3), give_ope(dom, p4))) ;
117 
118  neq ++ ;
119  }
120  nbr_conditions = -1 ;
121 }
122 
123 void System_of_eqs::add_eq_bc_exception (int dom, int bound, const char* nom, const char* const_part) {
124  // Is it written like =0 ?
125  char p1[LMAX] ;
126  char p2[LMAX] ;
127  bool indic1 = is_ope_bin(nom, p1, p2, '=') ;
128 
129  char p3[LMAX] ;
130  char p4[LMAX] ;
131  bool indic2 = is_ope_bin(const_part, p3, p4, '=') ;
132 
133 
134  if ((!indic1) || (!indic2)) {
135  cerr << "= needed for equations" << endl ;
136  abort() ;
137  }
138  else {
139  // Verif lhs1 = 0 ?
140  indic1 = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
141  true : false ;
142 
143  indic2 = ((p4[0]=='0') && (p4[1]==' ') && (p4[2]=='\0')) ?
144  true : false ;
145 
146  // no lhs :
147  if ((indic1) && (indic2))
148  eq[neq] = new Eq_bc_exception (espace.get_domain(dom), dom, bound, give_ope(dom, p1), give_ope(dom,p3)) ;
149  // lhs in 1
150  if ((!indic1) && (indic2))
151  eq[neq] = new Eq_bc_exception(espace.get_domain(dom), dom, bound, new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), give_ope(dom,p3)) ;
152  // lhs in 2
153  if ((indic1) && (!indic2))
154  eq[neq] = new Eq_bc_exception(espace.get_domain(dom), dom, bound, give_ope(dom,p1), new Ope_sub(this, give_ope(dom, p3), give_ope(dom, p4))) ;
155  // both lhs
156  if ((!indic1) && (!indic2))
157  eq[neq] = new Eq_bc_exception(espace.get_domain(dom), dom, bound, new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), new Ope_sub(this, give_ope(dom, p3), give_ope(dom, p4))) ;
158 
159  neq ++ ;
160  }
161  nbr_conditions = -1 ;
162 }
163 
164 void System_of_eqs::add_eq_order (int dom, int order, const char* nom, const List_comp& list) {
165  add_eq_order (dom, order, nom, list.get_ncomp(), list.get_pcomp()) ;
166 }
167 
168 void System_of_eqs::add_eq_bc (int dom, int bound, const char* nom, int n_cmp, Array<int>** p_cmp) {
169  // Is it written like =0 ?
170  char p1[LMAX] ;
171  char p2[LMAX] ;
172  bool indic = is_ope_bin(nom, p1, p2, '=') ;
173  if (!indic) {
174  cerr << "= needed for boundary conditions" << endl ;
175  abort() ;
176  }
177  else {
178  // Verif lhs = 0 ?
179  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
180  true : false ;
181 
182  // no lhs :
183  if (indic)
184  eq[neq] = new Eq_bc(espace.get_domain(dom), dom, bound, give_ope(dom, p1, bound), n_cmp, p_cmp) ;
185  else
186  eq[neq] = new Eq_bc(espace.get_domain(dom), dom,
187  bound, new Ope_sub(this, give_ope(dom, p1, bound), give_ope(dom, p2, bound)), n_cmp, p_cmp) ;
188 
189  neq ++ ;
190  }
191  nbr_conditions = -1 ;
192 }
193 
194 void System_of_eqs::add_eq_bc (int dom, int bound, const char* nom, const List_comp& list) {
195  add_eq_bc (dom, bound, nom, list.get_ncomp(), list.get_pcomp()) ;
196 }
197 
198 void System_of_eqs::add_eq_matching (int dom, int bound, const char* nom, int n_cmp, Array<int>** p_cmp) {
199  int other_dom ;
200  int other_bound ;
201  espace.get_domain(dom)->find_other_dom (dom, bound, other_dom, other_bound) ;
202  assert (other_dom>=dom_min) ;
203  assert (other_dom<=dom_max) ;
204 
205  // Is it written with = ?
206  char p1[LMAX] ;
207  char p2[LMAX] ;
208  bool indic = is_ope_bin(nom, p1, p2, '=') ;
209 
210  if (!indic) {
211  char auxi[LMAX] ;
212  trim_spaces(auxi, nom) ;
213  // Version without =
214  eq[neq] = new Eq_matching(espace.get_domain(dom), dom, bound, other_dom, other_bound,
215  give_ope(dom, auxi, bound), give_ope(other_dom, auxi, other_bound), n_cmp, p_cmp) ;
216  neq++ ;
217  }
218  else {
219  // Version with =
220  eq[neq] = new Eq_matching(espace.get_domain(dom), dom, bound, other_dom, other_bound,
221  give_ope(dom, p1, bound), give_ope(other_dom, p2, other_bound), n_cmp, p_cmp) ;
222  neq++ ;
223  }
224  nbr_conditions = -1 ;
225 }
226 
227 void System_of_eqs::add_eq_matching (int dom, int bound, const char* nom, const List_comp& list) {
228  add_eq_matching (dom, bound, nom, list.get_ncomp(), list.get_pcomp()) ;
229 }
230 
231 void System_of_eqs::add_eq_matching_exception (int dom, int bound, const char* nom, const Param& par, const char* nom_exception, int n_cmp, Array<int>** p_cmp) {
232  int other_dom ;
233  int other_bound ;
234  espace.get_domain(dom)->find_other_dom (dom, bound, other_dom, other_bound) ;
235  assert (other_dom>=dom_min) ;
236  assert (other_dom<=dom_max) ;
237 
238  // Is it written with = ?
239  char p1[LMAX] ;
240  char p2[LMAX] ;
241  bool indic = is_ope_bin(nom, p1, p2, '=') ;
242 
243  if (!indic) {
244  char auxi[LMAX] ;
245  trim_spaces(auxi, nom) ;
246 
247  char auxi_exception[LMAX] ;
248  trim_spaces(auxi_exception, nom_exception) ;
249  // Version without =
250  eq[neq] = new Eq_matching_exception(espace.get_domain(dom), dom, bound, other_dom, other_bound,
251  give_ope(dom, auxi, bound), give_ope(other_dom, auxi, other_bound), par, give_ope(dom, auxi_exception, bound), n_cmp, p_cmp) ;
252  neq++ ;
253  }
254  else {
255  char auxi_exception[LMAX] ;
256  trim_spaces(auxi_exception, nom_exception) ;
257 
258  // Version with =
259  eq[neq] = new Eq_matching_exception(espace.get_domain(dom), dom, bound, other_dom, other_bound,
260  give_ope(dom, p1, bound), give_ope(other_dom, p2, other_bound), par, give_ope(dom, auxi_exception, bound) , n_cmp, p_cmp) ;
261  neq++ ;
262  }
263  nbr_conditions = -1 ;
264 }
265 
266 void System_of_eqs::add_eq_matching_exception (int dom, int bound, const char* nom, const Param& par, const char* nom_exception, const List_comp& list) {
267  add_eq_matching_exception (dom, bound, nom, par, nom_exception, list.get_ncomp(), list.get_pcomp()) ;
268 }
269 
270 void System_of_eqs::add_eq_matching_one_side (int dom, int bound, const char* nom, int n_cmp, Array<int>** p_cmp) {
271  int other_dom ;
272  int other_bound ;
273  espace.get_domain(dom)->find_other_dom (dom, bound, other_dom, other_bound) ;
274  assert (other_dom>=dom_min) ;
275  assert (other_dom<=dom_max) ;
276 
277  // Is it written with = ?
278  char p1[LMAX] ;
279  char p2[LMAX] ;
280  bool indic = is_ope_bin(nom, p1, p2, '=') ;
281 
282  if (!indic) {
283  char auxi[LMAX] ;
284  trim_spaces(auxi, nom) ;
285  // Version without =
286  eq[neq] = new Eq_matching_one_side(espace.get_domain(dom), dom, bound, other_dom, other_bound,
287  give_ope(dom, auxi, bound), give_ope(other_dom, auxi, other_bound), n_cmp, p_cmp) ;
288  neq++ ;
289  }
290  else {
291  // Version with =
292  eq[neq] = new Eq_matching_one_side(espace.get_domain(dom), dom, bound, other_dom, other_bound,
293  give_ope(dom, p1, bound), give_ope(other_dom, p2, other_bound), n_cmp, p_cmp) ;
294  neq++ ;
295  }
296  nbr_conditions = -1 ;
297 }
298 
299 void System_of_eqs::add_eq_matching_one_side (int dom, int bound, const char* nom, const List_comp& list) {
300  add_eq_matching_one_side (dom, bound, nom, list.get_ncomp(), list.get_pcomp()) ;
301 }
302 
303 void System_of_eqs::add_eq_matching_non_std (int dom, int bound, const char* nom, int n_cmp, Array<int>** p_cmp) {
304 
305  // First get the number, the indices and associated boundaries of the other domains (member of espace) :
306  Array<int> other_props (espace.get_indices_matching_non_std (dom, bound)) ;
307 
308  // The equation
309  eq[neq] = new Eq_matching_non_std(espace.get_domain(dom), dom, bound, other_props, n_cmp, p_cmp) ;
310 
311  // Affectation of the operator in each concerned domain :
312  // Current one :bool indic = is_ope_bin(nom, p1, p2, '=') ;
313  // Is it written with = ?
314  char p1[LMAX] ;
315  char p2[LMAX] ;
316  bool indic = is_ope_bin(nom, p1, p2, '=') ;
317 
318  if (!indic) {
319  char auxi[LMAX] ;
320  trim_spaces(auxi, nom) ;
321  // Version without =
322  eq[neq]->parts[0] = give_ope (dom, auxi, bound) ;
323  // The associated ones :
324  for (int i=0 ; i<eq[neq]->n_ope-1 ; i++)
325  eq[neq]->parts[i+1] = give_ope (other_props(0,i), auxi, other_props(1,i)) ;
326  neq++ ;
327  }
328  else {
329  // Version without =
330  eq[neq]->parts[0] = give_ope (dom, p1, bound) ;
331  // The associated ones :
332  for (int i=0 ; i<eq[neq]->n_ope-1 ; i++)
333  eq[neq]->parts[i+1] = give_ope (other_props(0,i), p2, other_props(1,i)) ;
334  neq++ ;
335  }
336 
337  nbr_conditions = -1 ;
338 }
339 
340 void System_of_eqs::add_eq_matching_non_std (int dom, int bound, const char* nom, const List_comp& list) {
341  add_eq_matching_non_std (dom, bound, nom, list.get_ncomp(), list.get_pcomp()) ;
342 }
343 
344 void System_of_eqs::add_eq_matching_import (int dom, int bound, const char* nom, int n_cmp, Array<int>** p_cmp) {
345 
346  // First get the number, the indices and associated boundaries of the other domains (member of espace) :
347  Array<int> others (espace.get_indices_matching_non_std (dom, bound)) ;
348 
349  // Is it written with = ?
350  char p1[LMAX] ;
351  char p2[LMAX] ;
352  bool indic = is_ope_bin(nom, p1, p2, '=') ;
353 
354  if (!indic) {
355  char auxi[LMAX] ;
356  trim_spaces(auxi, nom) ;
357  //Version without = ; assumes p2 = import(p1)
358  eq[neq] = new Eq_matching_import (espace.get_domain(dom), dom, bound, new Ope_sub (this, give_ope(dom, auxi, bound),
359  new Ope_import(this, dom, bound, auxi)) , others, n_cmp, p_cmp) ;
360  neq ++ ;
361  }
362  else {
363  // Version with =
364  eq[neq] = new Eq_matching_import (espace.get_domain(dom), dom, bound, new Ope_sub (this, give_ope(dom, p1, bound), give_ope(dom, p2, bound)), others, n_cmp, p_cmp) ;
365  neq++ ;
366  }
367  nbr_conditions = -1 ;
368 }
369 
370 void System_of_eqs::add_eq_matching_import (int dom, int bound, const char* nom, const List_comp& list) {
371  add_eq_matching_import (dom, bound, nom, list.get_ncomp(), list.get_pcomp()) ;
372 }
373 
374 void System_of_eqs::add_eq_full (int dom, const char* nom, int n_cmp, Array<int>** p_cmp) {
375 
376  // Is it written like =0 ?
377  char p1[LMAX] ;
378  char p2[LMAX] ;
379  bool indic = is_ope_bin(nom, p1, p2, '=') ;
380  if (!indic) {
381  cerr << "= needed for equations" << endl ;
382  abort() ;
383  }
384  else {
385  // Verif lhs = 0 ?
386  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
387  true : false ;
388 
389  // no lhs :
390  if (indic)
391  eq[neq] = new Eq_full(espace.get_domain(dom), dom, give_ope(dom, p1), n_cmp, p_cmp) ;
392 
393  else
394  {
395  eq[neq] = new Eq_full(espace.get_domain(dom), dom,
396  new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), n_cmp, p_cmp) ;
397  }
398  neq ++ ;
399  }
400  nbr_conditions = -1 ;
401 }
402 
403 void System_of_eqs::add_eq_full (int dom, const char* nom, const List_comp& list) {
404  add_eq_full (dom, nom, list.get_ncomp(), list.get_pcomp()) ;
405 }
406 
407 void System_of_eqs::add_eq_one_side (int dom, const char* nom, int n_cmp, Array<int>** p_cmp) {
408 
409  // Is it written like =0 ?
410  char p1[LMAX] ;
411  char p2[LMAX] ;
412  bool indic = is_ope_bin(nom, p1, p2, '=') ;
413  if (!indic) {
414  cerr << "= needed for equations" << endl ;
415  abort() ;
416  }
417  else {
418  // Verif lhs = 0 ?
419  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
420  true : false ;
421 
422  // no lhs :
423  if (indic)
424  eq[neq] = new Eq_one_side(espace.get_domain(dom), dom, give_ope(dom, p1), n_cmp, p_cmp) ;
425 
426  else
427  eq[neq] = new Eq_one_side(espace.get_domain(dom), dom,
428  new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), n_cmp, p_cmp) ;
429  neq ++ ;
430  }
431  nbr_conditions = -1 ;
432 }
433 
434 void System_of_eqs::add_eq_one_side (int dom, const char* nom, const List_comp& list) {
435  add_eq_one_side (dom, nom, list.get_ncomp(), list.get_pcomp()) ;
436 }
437 
438  void System_of_eqs::add_eq_mode (int dom, int bound, const char* nom, const Index& pos_cf, double value) {
439 
440  char auxi[LMAX] ;
441  trim_spaces(auxi, nom) ;
442 
443  eq_int[neq_int] = new Eq_int (1) ;
444  eq_int[neq_int]->set_part(0, new Ope_mode(this, bound, pos_cf, value, give_ope(dom, auxi, bound))) ;
445 
446  neq_int ++ ;
447  nbr_conditions = -1 ;
448 }
449 
450  void System_of_eqs::add_eq_val_mode (int dom, const char* nom, const Index& pos_cf, double value) {
451 
452  char auxi[LMAX] ;
453  trim_spaces(auxi, nom) ;
454 
455  eq_int[neq_int] = new Eq_int (1) ;
456  eq_int[neq_int]->set_part(0, new Ope_val_mode(this, pos_cf, value, give_ope(dom, auxi))) ;
457 
458  neq_int ++ ;
459  nbr_conditions = -1 ;
460 }
461 
462  void System_of_eqs::add_eq_val (int dom, const char* nom, const Index& pos) {
463 
464  char auxi[LMAX] ;
465  trim_spaces(auxi, nom) ;
466 
467  eq_int[neq_int] = new Eq_int (1) ;
468  eq_int[neq_int]->set_part(0, new Ope_val(this, pos, give_ope(dom, auxi))) ;
469 
470  neq_int ++ ;
471  nbr_conditions = -1 ;
472 }
473 void System_of_eqs::add_eq_point (int dom, const char* nom, const Point& num) {
474 
475  char auxi[LMAX] ;
476  trim_spaces(auxi, nom) ;
477 
478  eq_int[neq_int] = new Eq_int (1) ;
479  eq_int[neq_int]->set_part(0, new Ope_point(this, num, give_ope(dom, auxi))) ;
480 
481  neq_int ++ ;
482  nbr_conditions = -1 ;
483 }
484 
485 void System_of_eqs::add_eq_order (int dom, const Array<int>& order, const char* nom, int n_cmp, Array<int>** p_cmp) {
486  // Is it written like =0 ?
487  char p1[LMAX] ;
488  char p2[LMAX] ;
489  bool indic = is_ope_bin(nom, p1, p2, '=') ;
490  if (!indic) {
491  cerr << "= needed for equations" << endl ;
492  abort() ;
493  }
494  else {
495  // Verif lhs = 0 ?
496  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
497  true : false ;
498 
499  // no lhs :
500  if (indic)
501  eq[neq] = new Eq_order_array(espace.get_domain(dom), dom, order, give_ope(dom, p1), n_cmp, p_cmp) ;
502 
503  else
504  eq[neq] = new Eq_order_array(espace.get_domain(dom), dom, order,
505  new Ope_sub(this, give_ope(dom, p1), give_ope(dom, p2)), n_cmp, p_cmp) ;
506  neq ++ ;
507  }
508  nbr_conditions = -1 ;
509 }
510 
511 void System_of_eqs::add_eq_order (int dom, const Array<int>& order, const char* nom, const List_comp& list) {
512  add_eq_order (dom, order, nom, list.get_ncomp(), list.get_pcomp()) ;
513 }
514 
515 void System_of_eqs::add_eq_bc (int dom, int bound, const Array<int>& order, const char* nom, int n_cmp, Array<int>** p_cmp) {
516  // Is it written like =0 ?
517  char p1[LMAX] ;
518  char p2[LMAX] ;
519  bool indic = is_ope_bin(nom, p1, p2, '=') ;
520  if (!indic) {
521  cerr << "= needed for boundary conditions" << endl ;
522  abort() ;
523  }
524  else {
525  // Verif lhs = 0 ?
526  indic = ((p2[0]=='0') && (p2[1]==' ') && (p2[2]=='\0')) ?
527  true : false ;
528 
529  // no lhs :
530  if (indic)
531  eq[neq] = new Eq_bc_order_array(espace.get_domain(dom), dom, bound, order, give_ope(dom, p1, bound), n_cmp, p_cmp) ;
532  else
533  eq[neq] = new Eq_bc_order_array(espace.get_domain(dom), dom,
534  bound, order, new Ope_sub(this, give_ope(dom, p1, bound), give_ope(dom, p2, bound)), n_cmp, p_cmp) ;
535 
536  neq ++ ;
537  }
538  nbr_conditions = -1 ;
539 }
540 
541 void System_of_eqs::add_eq_bc (int dom, int bound, const Array<int>& order, const char* nom, const List_comp& list) {
542  add_eq_bc (dom, bound, order, nom, list.get_ncomp(), list.get_pcomp()) ;
543 }
544 
545 void System_of_eqs::add_eq_matching (int dom, int bound, const Array<int>& order, const char* nom, int n_cmp, Array<int>** p_cmp) {
546  int other_dom ;
547  int other_bound ;
548  espace.get_domain(dom)->find_other_dom (dom, bound, other_dom, other_bound) ;
549  assert (other_dom>=dom_min) ;
550  assert (other_dom<=dom_max) ;
551 
552  // Is it written with = ?
553  char p1[LMAX] ;
554  char p2[LMAX] ;
555  bool indic = is_ope_bin(nom, p1, p2, '=') ;
556 
557  if (!indic) {
558  char auxi[LMAX] ;
559  trim_spaces(auxi, nom) ;
560  // Version without =
561  eq[neq] = new Eq_matching_order_array(espace.get_domain(dom), dom, bound, other_dom, other_bound, order,
562  give_ope(dom, auxi, bound), give_ope(other_dom, auxi, other_bound), n_cmp, p_cmp) ;
563  neq++ ;
564  }
565  else {
566  // Version with =
567  eq[neq] = new Eq_matching_order_array(espace.get_domain(dom), dom, bound, other_dom, other_bound, order,
568  give_ope(dom, p1, bound), give_ope(other_dom, p2, other_bound), n_cmp, p_cmp) ;
569  neq++ ;
570  }
571  nbr_conditions = -1 ;
572 }
573 
574 void System_of_eqs::add_eq_matching (int dom, int bound, const Array<int>& order, const char* nom, const List_comp& list) {
575  add_eq_matching (dom, bound, order, nom, list.get_ncomp(), list.get_pcomp()) ;
576 }
577 
578 void System_of_eqs::add_eq_first_integral (int dom_min, int dom_max, const char* integ_part, const char* cst_part) {
579 
580  eq[neq] = new Eq_first_integral(this, espace.get_domain(dom_min), dom_min, dom_max, integ_part, cst_part) ;
581  neq++ ;
582 
583  nbr_conditions = -1 ;
584 }
585 
586 }
virtual void find_other_dom(int dom, int bound, int &otherdom, int &otherbound) const
Gives the informations corresponding the a touching neighboring domain.
Definition: domain.cpp:1411
Class for enforcing boundary condition.
Class for a boundary condition.
Class for an equation representing a boundary condition on some surface.
Equation for describing a first integral equation (i.e.
Class for a zeroth order equation in a Domain.
Class for bulk equations that are solved stricly inside a given domain.
Class implementing an integral equation.
Equation for a matching condition, except for one coefficient where an alternative condition is enfor...
Class for an equation representing the matching of quantities accross a boundary using the "import" r...
Class for an equation representing the matching of quantities accross a boundary.
Class for an equation representing the matching of quantities accross a boundary.
Class for a matching condition.
Class for an equation representing the matching of quantities accross a boundary.
Class for a first order equation in a Domain.
Class for an equation in a Domain which order is passed, for each variable.
Class for bulk equation which order is passed as a parameter.
Class for the velocity potential in irrotational binray neutron stars.
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
Class for storing a list of tensorial components.
Definition: list_comp.hpp:33
int get_ncomp() const
Returns the number of components.
Definition: list_comp.hpp:64
Array< int > ** get_pcomp() const
Returns a pointer of the liste.
Definition: list_comp.hpp:69
Operator importing the values of a field from a neighborig Domain.
Definition: ope_eq.hpp:1288
This operator gives the value of one coefficient of a field, on a given boundary.
Definition: ope_eq.hpp:926
This operator gives the value of a field at a point (arbitrary not necesseraly a collocation one)
Definition: ope_eq.hpp:999
The operator substraction.
Definition: ope_eq.hpp:165
This operator gives the value of one coefficient of a field.
Definition: ope_eq.hpp:955
This operator gives the value of a field at a given collocation point.
Definition: ope_eq.hpp:978
Parameter storage.
Definition: param.hpp:30
The class Point is used to store the coordinates of a point.
Definition: point.hpp:30
virtual Array< int > get_indices_matching_non_std(int dom, int bound) const
Gives the number of the other domains, touching a given boundary.
Definition: space.cpp:66
const Domain * get_domain(int i) const
returns a pointer on the domain.
Definition: space.hpp:1385
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_full(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 zeroth order i....
Definition: add_eq.cpp:374
virtual void add_eq_order(int dom, int order, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation to be solved inside a domain (of arbitrary order).
Definition: add_eq.cpp:56
void add_eq_bc_exception(int dom, int bound, const char *eq, const char *const_part)
Addition of an boundary equation with an exception for .
Definition: add_eq.cpp:123
virtual void add_eq_matching_import(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 domains using the ("import" setting) ...
Definition: add_eq.cpp:344
virtual void add_eq_mode(int dom, int bb, const char *eq, const Index &pos_cf, double val)
Addition of an equation prescribing the value of one coefficient of a scalar field,...
Definition: add_eq.cpp:438
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)
virtual void add_eq_bc(int dom, int bb, const char *eq, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of an equation describing a boundary condition.
Definition: add_eq.cpp:168
MMPtr_array< Equation > eq
Pointers onto the field equations.
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
virtual void add_eq_point(int dom, const char *eq, const Point &MM)
Addition of an equation saying that the value of a field must be zero at one point (arbitrary).
Definition: add_eq.cpp:473
virtual void add_eq_matching_one_side(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 (specialized function for...
Definition: add_eq.cpp:270
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
virtual void add_eq_val(int dom, const char *eq, const Index &pos)
Addition of an equation saying that the value of a field must be zero at one collocation point.
Definition: add_eq.cpp:462
virtual void add_eq_vel_pot(int dom, int order, const char *eq, const char *const_part)
Addition of an equation for the velocity potential of irrotational binaries.
Definition: add_eq.cpp:82
virtual void add_eq_matching_exception(int dom, int bb, const char *eq, const Param &par, const char *eq_exception, int n_cmp=-1, Array< int > **p_cmp=nullptr)
Addition of a matching condition, except for one coefficient where an alternative condition is enforc...
Definition: add_eq.cpp:231
int nbr_conditions
Total number of conditions (the number of coefficients of all the equations, once regularities are ta...
int neq
Number of field equations.
int dom_max
Highest domain number.
const Space & espace
Associated Space.
virtual void add_eq_one_side(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 first order).
Definition: add_eq.cpp:407
MMPtr_array< Eq_int > eq_int
Pointers onto the integral equations.
int dom_min
Smallest domain number.
virtual void add_eq_val_mode(int dom, const char *eq, const Index &pos_cf, double val)
Addition of an equation prescribing the value of one coefficient of a scalar field.
Definition: add_eq.cpp:450
virtual void add_eq_matching_non_std(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 domains.
Definition: add_eq.cpp:303
virtual void add_eq_first_integral(int dom_min, int dom_max, const char *integ_part, const char *const_part)
Addition of an equation representing a first integral.
Definition: add_eq.cpp:578