20 #include "headcpp.hpp"
21 #include "utilities.hpp"
24 #include "array_math.hpp"
25 #include "val_domain.hpp"
42 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
47 Domain_polar_compact::~Domain_polar_compact() {}
50 o <<
"Compactified polar domain" << endl ;
51 o <<
"Rmin = " << -0.5/
alpha << endl ;
52 o <<
"Center = " <<
center << endl ;
61 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
62 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
64 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
83 cerr <<
"Unknown boundary case in Domain_polar_compact::der_normal" << endl ;
93 if (baset != COS_EVEN) {
99 if (bound!=OUTER_BC) {
100 cerr <<
"Domain_polar_compact::integ only defined for outer boundary" << endl ;
113 double fact_tet = 2./double(1-4*j*j) ;
117 res += fact_tet*(*auxi.
cf)(pos) ;
126 for (
int i=0 ; i<2 ; i++)
127 assert (
coloc[i] != 0x0) ;
128 for (
int i=0 ; i<2 ; i++)
129 assert (
absol[i] == 0x0) ;
130 for (
int i=0 ; i<2 ; i++) {
132 absol[i]->allocate_conf() ;
141 while (index.
inc()) ;
146 for (
int i=0 ; i<2 ; i++)
147 assert (
coloc[i] != 0x0) ;
154 while (index.
inc()) ;
159 for (
int i=0 ; i<2 ; i++)
160 assert (
coloc[i] != 0x0) ;
161 for (
int i=0 ; i<2 ; i++)
162 assert (
cart[i] == 0x0) ;
163 for (
int i=0 ; i<2 ; i++) {
165 cart[i]->allocate_conf() ;
174 while (index.
inc()) ;
179 for (
int i=0 ; i<2 ; i++)
180 assert (
coloc[i] != 0x0) ;
181 for (
int i=0 ; i<2 ; i++)
183 for (
int i=0 ; i<2 ; i++) {
192 while (index.
inc()) ;
200 double rho_loc = xx(1) -
center(1) ;
201 double z_loc = xx(2) -
center(2) ;
202 double air_loc = sqrt (rho_loc*rho_loc + z_loc*z_loc) ;
204 bool res = (air_loc >= -0.5/
alpha-prec) ?
true :
false ;
211 assert (
is_in(abs)) ;
214 double rho_loc = fabs(abs(1) -
center(1)) ;
215 double z_loc = abs(2) -
center(2) ;
216 double air = sqrt(rho_loc*rho_loc+z_loc*z_loc) ;
221 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
224 num.
set(2) = atan(rho_loc/z_loc) ;
228 num.
set(2) = M_PI + num(2) ;
234 double coloc_leg(
int,
int) ;
241 for (
int i=0 ; i<
ndim ; i++)
251 for (
int i=0 ; i<
ndim ; i++)
259 cerr <<
"Unknown type of basis in Domain_polar_compact::do_coloc" << endl ;
291 base.
bases_1d[1]->set(0) = (m%2==0) ? COS_EVEN : SIN_ODD ;
304 base.
bases_1d[1]->set(0) = (m%2==0) ? COS_ODD : SIN_EVEN ;
316 base.
bases_1d[1]->set(0) = (m%2==0) ? COS_EVEN : SIN_ODD ;
330 base.
bases_1d[1]->set(0) = (m%2==0) ? COS_ODD : SIN_EVEN ;
347 while (inf.
inc1(1)) ;
370 bool res_def = true ;
385 res.
bases_1d[1]->set(0) = COS_EVEN ;
391 res.
bases_1d[1]->set(0) = SIN_EVEN ;
407 res.
bases_1d[1]->set(0) = COS_EVEN ;
413 res.
bases_1d[1]->set(0) = SIN_EVEN ;
423 res.
bases_1d[1]->set(0) = SIN_EVEN ;
429 res.
bases_1d[1]->set(0) = COS_EVEN ;
445 res.
bases_1d[1]->set(0) = SIN_EVEN ;
451 res.
bases_1d[1]->set(0) = COS_EVEN ;
469 switch ((*a.
bases_1d[0])(index_0)) {
471 switch ((*b.
bases_1d[0])(index_0)) {
473 res.
bases_1d[0]->set(index_0) = CHEB ;
481 switch ((*b.
bases_1d[0])(index_0)) {
483 res.
bases_1d[0]->set(index_0) = LEG ;
495 while (index_0.
inc()) ;
499 for (
int dim=0 ; dim<a.
ndim ; dim++)
510 if (strcmp(p,
"R ")==0)
512 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 get_ndim() const
Returns the number of dimensions.
void save(FILE *) const
Save function.
Class for a 2-dimensional spherical shell and a symmetry with respect to the plane .
Point center
Absolute coordinates of the center.
virtual void save(FILE *) const
Saving function.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual void set_legendre_base_with_m(Base_spectral &, int m) const
Gives the stnadard base using Legendre polynomials.
virtual void set_val_inf(Val_domain &so, double xx) const
Sets the value at infinity of a Val_domain : not implemented for this type of Domain.
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
virtual void set_anti_cheb_base_with_m(Base_spectral &, int m) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
double alpha
Relates the numerical to the physical radii.
virtual void do_absol() const
Computes the absolute coordinates.
virtual void set_anti_legendre_base(Base_spectral &) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void do_cart() const
Computes the Cartesian coordinates.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual void do_coloc()
Computes the colocation points.
Domain_polar_compact(int num, int ttype, double r_int, const Point &cr, const Dim_array &nbr)
Standard constructor :
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
virtual void do_cart_surr() const
Computes the Cartesian coordinates over the radius.
virtual double integ(const Val_domain &, int) const
Surface integral on a given boundary.
virtual int give_place_var(char *) const
Translates a name of a coordinate into its corresponding numerical name.
virtual void do_der_abs_from_der_var(const Val_domain *const *const der_var, Val_domain **const der_abs) const
Computes the derivative with respect to the absolute Cartesian coordinates from the derivative with r...
virtual void set_anti_legendre_base_with_m(Base_spectral &, int m) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void set_cheb_base_with_m(Base_spectral &, int m) const
Gives the standard base using Chebyshev polynomials.
virtual void do_radius() const
Computes the generalized radius.
virtual Val_domain mult_xm1(const Val_domain &) const
Multiplication by .
virtual void set_cheb_base(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
virtual void set_anti_cheb_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
Abstract class that implements the fonctionnalities common to all the type of domains.
virtual void del_deriv()
Destroys the derivated members (like coloc, cart and radius), when changing the type of colocation po...
Val_domain * radius
The generalized radius.
Memory_mapped_array< Val_domain * > cart
Cartesian coordinates.
Memory_mapped_array< Val_domain * > absol
Asbolute coordinates (if defined ; usually Cartesian-like)
int ndim
Number of dimensions.
Dim_array const & get_nbr_coefs() const
Returns the number of coefficients.
Memory_mapped_array< Val_domain * > cart_surr
Cartesian coordinates divided by the radius.
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.
int & set(int i)
Read/write of the position in a given dimension.
bool inc(int increm, int var=0)
Increments the position of the Index.
bool inc1(int var)
Increment on one dimension.
The class Point is used to store the coordinates of a point.
void save(FILE *) const
Saving function.
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...
Base_spectral base
Spectral basis of the field.
void set_in_conf()
Destroys the values in the coefficient space.
Val_domain div_xm1() const
Division by .
Val_domain mult_sin_theta() const
Multiplication by .
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
void coef_i() const
Computes the values in the configuration space.
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Val_domain mult_cos_theta() const
Multiplication by .
Val_domain mult_xm1() const
Multiplication by .
void coef() const
Computes the coefficients.
Val_domain der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.
const Domain * get_domain() const