20 #include "headcpp.hpp"
21 #include "utilities.hpp"
24 #include "array_math.hpp"
25 #include "val_domain.hpp"
45 fread_be (&
xlim,
sizeof(
double), 1, fd) ;
49 Domain_critic_inner::~Domain_critic_inner() {
54 for (
int l=0 ; l<
ndim ; l++) safe_delete(
coloc[l]);
62 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
63 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
64 fwrite_be (&
xlim,
sizeof(
double), 1, fd) ;
68 o <<
"Inner critic domain (cylindric)" << endl ;
70 o <<
"X max = " <<
xlim << endl ;
75 double coloc_leg_parity (
int,
int) ;
83 for (
int i=0 ; i<
ndim ; i++)
94 for (
int i=0 ; i<
ndim ; i++)
102 cerr <<
"Unknown type of basis in Domain_critic_inner::do_coloc" << endl ;
108 for (
int i=0 ; i<2 ; i++)
109 assert (
coloc[i] !=
nullptr) ;
110 assert (
p_X==
nullptr) ;
116 while (index.
inc()) ;
120 for (
int i=0 ; i<2 ; i++)
121 assert (
coloc[i] !=
nullptr) ;
122 assert (
p_T==
nullptr) ;
128 while (index.
inc()) ;
147 for (
int i=0 ; i<2 ; i++)
148 assert (
coloc[i] !=
nullptr) ;
149 for (
int i=0 ; i<2 ; i++)
150 assert (
absol[i] ==
nullptr) ;
151 for (
int i=0 ; i<2 ; i++) {
153 absol[i]->allocate_conf() ;
158 absol[0]->set(index) = (*
coloc[0])(index(0)) ;
159 absol[1]->set(index) = (*
coloc[1])(index(1)) ;
161 while (index.
inc()) ;
168 if ((xx(1)<-prec) || (xx(1)>
xlim+prec))
170 if ((xx(2)<-prec) || (xx(2)>M_PI+prec))
190 base.
bases_1d[1]->set(0) = COSSIN_EVEN ;
192 base.
bases_1d[0]->set(k) = CHEB_EVEN ;
201 base.
bases_1d[1]->set(0) = COSSIN_EVEN ;
203 base.
bases_1d[0]->set(k) = LEG_EVEN ;
214 base.
bases_1d[1]->set(0) = COSSIN_EVEN ;
216 base.
bases_1d[0]->set(k) = CHEB_ODD ;
225 base.
bases_1d[1]->set(0) = COSSIN_EVEN ;
227 base.
bases_1d[0]->set(k) = LEG_ODD ;
237 base.
bases_1d[1]->set(0) = COSSIN_ODD ;
239 base.
bases_1d[0]->set(k) = CHEB_EVEN ;
248 base.
bases_1d[1]->set(0) = COSSIN_ODD ;
250 base.
bases_1d[0]->set(k) = LEG_EVEN ;
259 base.
bases_1d[1]->set(0) = COSSIN_ODD ;
261 base.
bases_1d[0]->set(k) = CHEB_ODD ;
270 base.
bases_1d[1]->set(0) = COSSIN_ODD ;
272 base.
bases_1d[0]->set(k) = LEG_ODD ;
282 bool res_def = true ;
297 res.
bases_1d[1]->set(0) = COSSIN_EVEN ;
300 res.
bases_1d[1]->set(0) = COSSIN_ODD ;
310 res.
bases_1d[1]->set(0) = COSSIN_ODD ;
313 res.
bases_1d[1]->set(0) = COSSIN_EVEN ;
331 res.
bases_1d[0]->set(k) = CHEB_EVEN ;
334 res.
bases_1d[0]->set(k) = CHEB_ODD ;
344 res.
bases_1d[0]->set(k) = LEG_EVEN ;
357 res.
bases_1d[0]->set(k) = CHEB_ODD ;
360 res.
bases_1d[0]->set(k) = CHEB_EVEN ;
373 res.
bases_1d[0]->set(k) = LEG_EVEN ;
389 for (
int dim=0 ; dim<a.
ndim ; dim++)
400 if (strcmp(p,
"X ")==0)
402 if (strcmp(p,
"T ")==0)
Class for storing the basis of decompositions of a field.
Bases_container bases_1d
Arrays containing the various basis of decomposition.
void allocate(const Dim_array &nbr_coefs)
Allocates the various arrays, for a given number of coefficients.
bool def
true if the Base_spectral is defined and false otherwise.
int ndim
Number of dimensions.
Class for storing the dimensions of an array.
int & set(int i)
Read/write of the size of a given dimension.
void save(FILE *) const
Save function.
Class for a 2-dimensional cylindrical type domain.
virtual const Val_domain & get_T() const
Returns the variable .
virtual void set_legendre_todd_base(Base_spectral &) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
double xlim
Relates the numerical to the variable.
void del_deriv() override
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
void do_T() const
Computes .
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.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
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 void save(FILE *) const
Saving function.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
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.
void do_X() const
Computes .
Val_domain * p_X
Pointer on the variable.
Val_domain * p_T
Pointer on the variable.
Abstract class that implements the fonctionnalities common to all the type of domains.
Memory_mapped_array< Val_domain * > absol
Asbolute coordinates (if defined ; usually Cartesian-like)
int ndim
Number of dimensions.
Dim_array nbr_coefs
Number of coefficients.
Dim_array nbr_points
Number of colocation points.
int type_base
Type of colocation point :
Memory_mapped_array< Array< double > * > coloc
Colocation points in each dimension (stored in ndim 1d- arrays)
Class that gives the position inside a multi-dimensional Array.
bool inc(int increm, int var=0)
Increments the position of the Index.
The class Point is used to store the coordinates of a point.
const int & get_ndim() const
Returns the number of dimensions.
double & set(int i)
Read/write of a coordinate.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.