KADATH
critic.hpp
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 #ifndef __CRITIC_HPP_
21 #define __CRITIC_HPP_
22 
23 #include "space.hpp"
24 
25 namespace Kadath {
26 
45 class Domain_critic_inner : public Domain {
46 
47  protected:
48  mutable Val_domain* p_X ;
49  mutable Val_domain* p_T ;
50  double xlim ;
51 
52  public:
60  Domain_critic_inner (int num, int ttype, const Dim_array& nbr, double xl) ;
67  Domain_critic_inner (int num, FILE* ff) ;
68 
69  virtual ~Domain_critic_inner() ;
70  void del_deriv() override;
71  virtual void save (FILE*) const ;
72 
73  private :
74  virtual void set_cheb_base(Base_spectral& so) const ;
75  virtual void set_legendre_base(Base_spectral&) const ;
76 
77  virtual void set_cheb_xodd_base(Base_spectral& so) const ;
78  virtual void set_legendre_xodd_base(Base_spectral&) const ;
79  virtual void set_cheb_todd_base(Base_spectral& so) const ;
80  virtual void set_legendre_todd_base(Base_spectral&) const ;
81  virtual void set_cheb_xodd_todd_base(Base_spectral& so) const ;
82  virtual void set_legendre_xodd_todd_base(Base_spectral&) const ;
83 
84  virtual void do_coloc () ;
85  virtual int give_place_var (char*) const ;
86  void do_X() const ;
87  void do_T() const ;
88 
89  public:
90  virtual const Val_domain & get_X() const ;
91  virtual const Val_domain & get_T() const ;
92  virtual Val_domain div_x (const Val_domain&) const ;
93 
94  virtual bool is_in(const Point& xx, double prec=1e-13) const ;
95  virtual const Point absol_to_num(const Point& xxx) const ;
96  virtual void do_absol () const ;
97 
98  public:
99  virtual void find_other_dom (int, int, int&, int&) const ;
100  virtual Base_spectral mult (const Base_spectral&, const Base_spectral&) const ;
101  virtual double val_boundary (int, const Val_domain&, const Index&) const ;
102  virtual Val_domain der_partial_var (const Val_domain&, int) const ;
103 
104  virtual int nbr_unknowns (const Tensor&, int) const ;
111  int nbr_unknowns_val_domain (const Val_domain& so) const ;
112  virtual Array<int> nbr_conditions (const Tensor&, int, int, int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
120  int nbr_conditions_val_domain (const Val_domain& so, int order) const ;
121  virtual Array<int> nbr_conditions_boundary (const Tensor&, int, int, int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
129  int nbr_conditions_val_domain_boundary (const Val_domain& eq) const ;
130  virtual void export_tau (const Tensor&, int, int, Array<double>&, int&, const Array<int>&,int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
140  void export_tau_val_domain (const Val_domain& eq, int order, Array<double>& res, int& pos_res, int ncond) const ;
141  virtual void export_tau_boundary (const Tensor&, int, int, Array<double>&, int&, const Array<int>&, int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
151  void export_tau_val_domain_boundary (const Val_domain& eq, int bound, Array<double>& res, int& pos_res, int ncond) const ;
152  virtual void affecte_tau (Tensor&, int, const Array<double>&, int&) const ;
160  void affecte_tau_val_domain (Val_domain& so, const Array<double>& cf, int& pos_cf) const ;
161  virtual void affecte_tau_one_coef (Tensor&, int, int, int&) const ;
169  void affecte_tau_one_coef_val_domain (Val_domain& so, int cc, int& pos_cf) const ;
170 
171  virtual int nbr_points_boundary (int, const Base_spectral&) const ;
172  virtual void do_which_points_boundary (int, const Base_spectral&, Index**, int) const ;
173 
174 public:
175  virtual ostream& print (ostream& o) const ;
176 } ;
177 
178 
197 class Domain_critic_outer : public Domain {
198 
199  protected:
200  mutable Val_domain* p_X ;
201  mutable Val_domain* p_T ;
202  double xlim ;
203 
204  public:
212  Domain_critic_outer (int num, int ttype, const Dim_array& nbr, double xl) ;
219  Domain_critic_outer (int num, FILE* ff) ;
220 
221  virtual ~Domain_critic_outer() ;
222  void del_deriv() override;
223  virtual void save (FILE*) const ;
224 
225  private :
226  virtual void set_cheb_base(Base_spectral& so) const ;
227  virtual void set_legendre_base(Base_spectral&) const ;
228  virtual void set_cheb_todd_base(Base_spectral& so) const ;
229  virtual void set_legendre_todd_base(Base_spectral&) const ;
230 
231  virtual void do_coloc () ;
232  virtual int give_place_var (char*) const ;
233  void do_X() const ;
234  void do_T() const ;
235 
236  public:
237  virtual const Val_domain & get_X() const ;
238  virtual const Val_domain & get_T() const ;
239 
240  virtual bool is_in(const Point& xx, double prec=1e-13) const ;
241  virtual const Point absol_to_num(const Point& xxx) const ;
242  virtual void do_absol () const ;
243 
244  public:
245  virtual void find_other_dom (int, int, int&, int&) const ;
246  virtual Base_spectral mult (const Base_spectral&, const Base_spectral&) const ;
247  virtual double val_boundary (int, const Val_domain&, const Index&) const ;
248  virtual Val_domain der_partial_var (const Val_domain&, int) const ;
249 
250  virtual int nbr_unknowns (const Tensor&, int) const ;
257  int nbr_unknowns_val_domain (const Val_domain& so) const ;
258  virtual Array<int> nbr_conditions (const Tensor&, int, int, int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
266  int nbr_conditions_val_domain (const Val_domain& so, int order) const ;
267  virtual Array<int> nbr_conditions_boundary (const Tensor&, int, int, int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
275  int nbr_conditions_val_domain_boundary (const Val_domain& eq) const ;
276  virtual void export_tau (const Tensor&, int, int, Array<double>&, int&, const Array<int>&,int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
286  void export_tau_val_domain (const Val_domain& eq, int order, Array<double>& res, int& pos_res, int ncond) const ;
287  virtual void export_tau_boundary (const Tensor&, int, int, Array<double>&, int&, const Array<int>&, int n_cmp=-1, Array<int>** p_cmp=0x0) const ;
297  void export_tau_val_domain_boundary (const Val_domain& eq, int bound, Array<double>& res, int& pos_res, int ncond) const ;
298  virtual void affecte_tau (Tensor&, int, const Array<double>&, int&) const ;
306  void affecte_tau_val_domain (Val_domain& so, const Array<double>& cf, int& pos_cf) const ;
307  virtual void affecte_tau_one_coef (Tensor&, int, int, int&) const ;
315  void affecte_tau_one_coef_val_domain (Val_domain& so, int cc, int& pos_cf) const ;
316 
317  virtual int nbr_points_boundary (int, const Base_spectral&) const ;
318  virtual void do_which_points_boundary (int, const Base_spectral&, Index**, int) const ;
319 
320  //friend ostream& operator<< (ostream& o, const Domain_critic_outer& so) ; ///< Display
321 public:
322  virtual ostream& print (ostream& o) const ;
323 } ;
324 
329 class Space_critic : public Space {
330  public:
338  Space_critic (int ttype, double xl, const Dim_array& nbr_inner, const Dim_array& nbr_outer) ;
339  Space_critic (FILE*) ;
340  virtual ~Space_critic() ;
341  virtual void save(FILE*) const ;
342 
350  void add_bc_zero (System_of_eqs& syst, const char* eq, int nused=-1, Array<int>** pused=0x0) ;
358  void add_bc_one (System_of_eqs& syst, const char* eq, int nused=-1, Array<int>** pused=0x0) ;
365  void add_eq_zero_mode_center (System_of_eqs& syst, const char* f, int jtarget) ;
366 
367  virtual Array<int> get_indices_matching_non_std(int, int) const ;
368 } ;
369 }
370 #endif
Class for storing the basis of decompositions of a field.
Class for storing the dimensions of an array.
Definition: dim_array.hpp:34
Class for a 2-dimensional cylindrical type domain.
Definition: critic.hpp:45
virtual const Val_domain & get_T() const
Returns the variable .
int nbr_conditions_val_domain_boundary(const Val_domain &eq) const
Computes number of discretized equations associated with a given equation on a boundary.
void affecte_tau_val_domain(Val_domain &so, const Array< double > &cf, int &pos_cf) const
Affects some coefficients to a Val_domain.
virtual Val_domain div_x(const Val_domain &) const
Division by .
virtual void affecte_tau_one_coef(Tensor &, int, int, int &) const
Sets at most one coefficient of a Tensor to 1.
virtual void set_legendre_todd_base(Base_spectral &) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
void export_tau_val_domain_boundary(const Val_domain &eq, int bound, Array< double > &res, int &pos_res, int ncond) const
Exports all the residual equations corresponding to a tensorial one on a given boundary It makes use ...
double xlim
Relates the numerical to the variable.
Definition: critic.hpp:50
void del_deriv() override
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
virtual void do_which_points_boundary(int, const Base_spectral &, Index **, int) const
Lists all the indices corresponding to true collocation points on a boundary.
virtual void find_other_dom(int, int, int &, int &) const
Gives the informations corresponding the a touching neighboring domain.
void export_tau_val_domain(const Val_domain &eq, int order, Array< double > &res, int &pos_res, int ncond) const
Exports a residual equation in the bulk.
virtual int nbr_points_boundary(int, const Base_spectral &) const
Computes the number of relevant collocation points on a boundary.
virtual double val_boundary(int, const Val_domain &, const Index &) const
Computes the value of a field at a boundary.
virtual void set_cheb_xodd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
virtual void do_coloc()
Computes the colocation points.
int nbr_unknowns_val_domain(const Val_domain &so) const
Computes the number of true unknowns of a Val_domain.
void affecte_tau_one_coef_val_domain(Val_domain &so, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual void export_tau(const Tensor &, int, int, Array< double > &, int &, const Array< int > &, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one in the bulk.
virtual void affecte_tau(Tensor &, int, const Array< double > &, int &) const
Affects some coefficients to a Tensor.
virtual int nbr_unknowns(const Tensor &, int) const
Computes the number of true unknowns of a Tensor, in a given domain.
virtual Array< int > nbr_conditions(const Tensor &, int, int, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation in the bulk.
virtual void set_cheb_xodd_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in and in (critic space case)
virtual Array< int > nbr_conditions_boundary(const Tensor &, int, int, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation on a boundary.
virtual void save(FILE *) const
Saving function.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
int nbr_conditions_val_domain(const Val_domain &so, int order) const
Computes number of discretized equations associated with a given tensorial equation in the bulk.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual const Val_domain & get_X() const
Returns the variable .
virtual void set_legendre_xodd_base(Base_spectral &) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
virtual int give_place_var(char *) const
Translates a name of a coordinate into its corresponding numerical name.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual const Point absol_to_num(const Point &xxx) const
Computes the numerical coordinates from the physical ones.
Domain_critic_inner(int num, int ttype, const Dim_array &nbr, double xl)
Standard constructor :
virtual void set_cheb_base(Base_spectral &so) const
Gives the standard base for Chebyshev polynomials.
virtual void set_cheb_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
virtual void set_legendre_xodd_todd_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for odd functions in and in (critic space case)
virtual void do_absol() const
Computes the absolute coordinates.
virtual Val_domain der_partial_var(const Val_domain &, int) const
Partial derivative with respect to a coordinate.
Val_domain * p_X
Pointer on the variable.
Definition: critic.hpp:48
Val_domain * p_T
Pointer on the variable.
Definition: critic.hpp:49
virtual void export_tau_boundary(const Tensor &, int, int, Array< double > &, int &, const Array< int > &, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one on a given boundary It makes use ...
Class for a 2-dimensional cylindrical type domain.
Definition: critic.hpp:197
void affecte_tau_val_domain(Val_domain &so, const Array< double > &cf, int &pos_cf) const
Affects some coefficients to a Val_domain.
virtual void set_legendre_todd_base(Base_spectral &) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
virtual int nbr_unknowns(const Tensor &, int) const
Computes the number of true unknowns of a Tensor, in a given domain.
int nbr_conditions_val_domain(const Val_domain &so, int order) const
Computes number of discretized equations associated with a given tensorial equation in the bulk.
void export_tau_val_domain_boundary(const Val_domain &eq, int bound, Array< double > &res, int &pos_res, int ncond) const
Exports all the residual equations corresponding to a tensorial one on a given boundary It makes use ...
virtual const Point absol_to_num(const Point &xxx) const
Computes the numerical coordinates from the physical ones.
Domain_critic_outer(int num, int ttype, const Dim_array &nbr, double xl)
Standard constructor :
int nbr_conditions_val_domain_boundary(const Val_domain &eq) const
Computes number of discretized equations associated with a given equation on a boundary.
virtual Val_domain der_partial_var(const Val_domain &, int) const
Partial derivative with respect to a coordinate.
virtual void save(FILE *) const
Saving function.
virtual void set_cheb_base(Base_spectral &so) const
Gives the standard base for Chebyshev polynomials.
virtual const Val_domain & get_X() const
Returns the variable .
virtual void set_cheb_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
int nbr_unknowns_val_domain(const Val_domain &so) const
Computes the number of true unknowns of a Val_domain.
virtual void find_other_dom(int, int, int &, int &) const
Gives the informations corresponding the a touching neighboring domain.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual void export_tau(const Tensor &, int, int, Array< double > &, int &, const Array< int > &, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one in the bulk.
virtual int nbr_points_boundary(int, const Base_spectral &) const
Computes the number of relevant collocation points on a boundary.
virtual Array< int > nbr_conditions_boundary(const Tensor &, int, int, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation on a boundary.
void export_tau_val_domain(const Val_domain &eq, int order, Array< double > &res, int &pos_res, int ncond) const
Exports a residual equation in the bulk.
virtual void export_tau_boundary(const Tensor &, int, int, Array< double > &, int &, const Array< int > &, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Exports all the residual equations corresponding to a tensorial one on a given boundary It makes use ...
double xlim
Relates the numerical to the variable.
Definition: critic.hpp:202
virtual void affecte_tau(Tensor &, int, const Array< double > &, int &) const
Affects some coefficients to a Tensor.
virtual const Val_domain & get_T() const
Returns the variable .
virtual int give_place_var(char *) const
Translates a name of a coordinate into its corresponding numerical name.
virtual void do_absol() const
Computes the absolute coordinates.
virtual void do_which_points_boundary(int, const Base_spectral &, Index **, int) const
Lists all the indices corresponding to true collocation points on a boundary.
virtual Array< int > nbr_conditions(const Tensor &, int, int, int n_cmp=-1, Array< int > **p_cmp=0x0) const
Computes number of discretized equations associated with a given tensorial equation in the bulk.
virtual void affecte_tau_one_coef(Tensor &, int, int, int &) const
Sets at most one coefficient of a Tensor to 1.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual void do_coloc()
Computes the colocation points.
void affecte_tau_one_coef_val_domain(Val_domain &so, int cc, int &pos_cf) const
Sets at most one coefficient of a Val_domain to 1.
void del_deriv() override
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
Val_domain * p_T
Pointer on the variable.
Definition: critic.hpp:201
Val_domain * p_X
Pointer on the variable.
Definition: critic.hpp:200
virtual double val_boundary(int, const Val_domain &, const Index &) const
Computes the value of a field at a boundary.
Abstract class that implements the fonctionnalities common to all the type of domains.
Definition: space.hpp:60
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
The class Point is used to store the coordinates of a point.
Definition: point.hpp:30
The Space_critic ; set the space with two critic domains, separated at .
Definition: critic.hpp:329
void add_bc_one(System_of_eqs &syst, const char *eq, int nused=-1, Array< int > **pused=0x0)
Sets a boundary condition at .
void add_eq_zero_mode_center(System_of_eqs &syst, const char *f, int jtarget)
Adds an equation saying that one coefficient of a field is zero (at )
virtual Array< int > get_indices_matching_non_std(int, int) const
Gives the number of the other domains, touching a given boundary.
virtual void save(FILE *) const
Saving function.
void add_bc_zero(System_of_eqs &syst, const char *eq, int nused=-1, Array< int > **pused=0x0)
Sets a boundary condition at .
Space_critic(int ttype, double xl, const Dim_array &nbr_inner, const Dim_array &nbr_outer)
Standard constructor.
The Space class is an ensemble of domains describing the whole space of the computation.
Definition: space.hpp:1362
Class used to describe and solve a system of equations.
Tensor handling.
Definition: tensor.hpp:149
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69