20 #include "headcpp.hpp"
21 #include "utilities.hpp"
24 #include "array_math.hpp"
25 #include "val_domain.hpp"
29 alpha((rext-rint)/2.), beta((rext+rint)/2.), center(cr) {
40 beta(so.beta), center(so.center){}
45 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
46 fread_be (&
beta,
sizeof(
double), 1, fd) ;
51 Domain_polar_shell::~Domain_polar_shell() {}
56 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
57 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
59 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
60 fwrite_be (&
beta,
sizeof(
double), 1, fd) ;
64 o <<
"Polar shell" << endl ;
66 o <<
"Center = " <<
center << endl ;
86 cerr <<
"Unknown boundary case in Domain_polar_shell::der_normal" << endl ;
95 for (
int i=0 ; i<2 ; i++)
96 assert (
coloc[i] != 0x0) ;
97 for (
int i=0 ; i<2 ; i++)
98 assert (
absol[i] == 0x0) ;
99 for (
int i=0 ; i<2 ; i++) {
101 absol[i]->allocate_conf() ;
110 while (index.
inc()) ;
115 for (
int i=0 ; i<2 ; i++)
116 assert (
coloc[i] != 0x0) ;
123 while (index.
inc()) ;
128 for (
int i=0 ; i<2 ; i++)
129 assert (
coloc[i] != 0x0) ;
130 for (
int i=0 ; i<2 ; i++)
131 assert (
cart[i] == 0x0) ;
132 for (
int i=0 ; i<2 ; i++) {
134 cart[i]->allocate_conf() ;
143 while (index.
inc()) ;
148 for (
int i=0 ; i<2 ; i++)
149 assert (
coloc[i] != 0x0) ;
150 for (
int i=0 ; i<2 ; i++)
152 for (
int i=0 ; i<2 ; i++) {
162 while (index.
inc()) ;
170 double rho_loc = xx(1) -
center(1) ;
171 double z_loc = xx(2) -
center(2) ;
172 double air_loc = sqrt (rho_loc*rho_loc + z_loc*z_loc) ;
174 bool res = ((air_loc <=
alpha+
beta+prec) && (air_loc >=
beta-
alpha-prec)) ?
true :
false ;
181 assert (
is_in(abs)) ;
184 double rho_loc = fabs(abs(1) -
center(1)) ;
185 double z_loc = abs(2) -
center(2) ;
186 double air = sqrt(rho_loc*rho_loc+z_loc*z_loc) ;
191 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
194 num.
set(2) = atan(rho_loc/z_loc) ;
198 num.
set(2) = M_PI + num(2) ;
203 double coloc_leg (
int,
int) ;
210 for (
int i=0 ; i<
ndim ; i++)
220 for (
int i=0 ; i<
ndim ; i++)
228 cerr <<
"Unknown type of basis in Domain_polar_shell::do_coloc" << endl ;
262 base.
bases_1d[1]->set(0) = (m%2==0) ? COS_EVEN : SIN_ODD ;
276 base.
bases_1d[1]->set(0) = (m%2==0) ? COS_ODD : SIN_EVEN ;
290 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 ;
329 bool res_def = true ;
344 res.
bases_1d[1]->set(0) = COS_EVEN ;
350 res.
bases_1d[1]->set(0) = SIN_EVEN ;
366 res.
bases_1d[1]->set(0) = COS_EVEN ;
372 res.
bases_1d[1]->set(0) = SIN_EVEN ;
382 res.
bases_1d[1]->set(0) = SIN_EVEN ;
388 res.
bases_1d[1]->set(0) = COS_EVEN ;
404 res.
bases_1d[1]->set(0) = SIN_EVEN ;
410 res.
bases_1d[1]->set(0) = COS_EVEN ;
428 switch ((*a.
bases_1d[0])(index_0)) {
430 switch ((*b.
bases_1d[0])(index_0)) {
432 res.
bases_1d[0]->set(index_0) = CHEB ;
440 switch ((*b.
bases_1d[0])(index_0)) {
442 res.
bases_1d[0]->set(index_0) = LEG ;
454 while (index_0.
inc()) ;
458 for (
int dim=0 ; dim<a.
ndim ; dim++)
469 if (strcmp(p,
"R ")==0)
471 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 .
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 .
virtual void set_legendre_base_with_m(Base_spectral &, int m) const
Gives the stnadard base using Legendre polynomials.
virtual void do_cart_surr() const
Computes the Cartesian coordinates over the radius.
double beta
Relates the numerical to the physical radii.
virtual void set_anti_cheb_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
Domain_polar_shell(int num, int ttype, double r_int, double r_ext, const Point &cr, const Dim_array &nbr)
Standard constructor :
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
double alpha
Relates the numerical to the physical radii.
virtual void save(FILE *) const
Saving function.
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 const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
Point center
Absolute coordinates of the center.
virtual void do_radius() const
Computes the generalized radius.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
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(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual int give_place_var(char *) const
Translates a name of a coordinate into its corresponding numerical name.
virtual void set_cheb_base_with_m(Base_spectral &, int m) const
Gives the standard base using Chebyshev polynomials.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
virtual void do_cart() const
Computes the Cartesian coordinates.
virtual void do_coloc()
Computes the colocation points.
virtual void set_anti_legendre_base(Base_spectral &) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void do_absol() const
Computes the absolute coordinates.
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.
Memory_mapped_array< Val_domain * > cart_surr
Cartesian coordinates divided by the radius.
Dim_array nbr_coefs
Number of coefficients.
Val_domain const & get_radius() const
Returns the generalized radius.
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.
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...
Val_domain mult_sin_theta() const
Multiplication by .
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 der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
Base_spectral & set_base()
Sets the basis of decomposition.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.
const Base_spectral & get_base() const
Returns the basis of decomposition.