20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "polar_periodic.hpp"
24 #include "array_math.hpp"
25 #include "val_domain.hpp"
26 #include "term_eq.hpp"
28 #include "tensor_impl.hpp"
31 void coef_1d (
int, Array<double>&) ;
32 void coef_i_1d (
int, Array<double>&) ;
33 int der_1d (
int, Array<double>&) ;
37 Domain(num, ttype, nbr), alpha(r), ome(oome), type_time(TO_PI) {
44 cerr <<
"Unknown case for type_time" << endl ;
57 type_time(so.type_time), maxt(so.maxt) {
66 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
67 fread_be (&
ome,
sizeof(
double), 1, fd) ;
68 fread_be (&
type_time,
sizeof(
int), 1, fd) ;
74 cerr <<
"Unknown case for type_time" << endl ;
84 Domain_polar_periodic_nucleus::~Domain_polar_periodic_nucleus() {
92 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
93 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
94 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
95 fwrite_be (&
ome,
sizeof(
double), 1, fd) ;
96 fwrite_be (&
type_time,
sizeof(
int), 1, fd) ;
100 o <<
"Polar_periodic nucleus" << endl ;
101 o <<
"time goes to " <<
maxt << endl ;
102 o <<
"Rmax = " <<
alpha << endl ;
103 o <<
"Omega = " <<
ome << endl ;
234 cerr <<
"Unknown boundary case in Domain_polar_periodic_nucleus::der_normal" << endl ;
242 for (
int i=0 ; i<3 ; i++)
243 assert (
coloc[i] != 0x0) ;
244 for (
int i=0 ; i<3 ; i++)
245 assert (
absol[i] == 0x0) ;
246 for (
int i=0 ; i<3 ; i++) {
248 absol[i]->allocate_conf() ;
256 while (index.
inc()) ;
263 for (
int i=0 ; i<2 ; i++)
264 assert (
coloc[i] != 0x0) ;
271 while (index.
inc()) ;
280 double rho_loc = xx(1) ;
281 double z_loc = xx(2) ;
282 double air_loc = sqrt (rho_loc*rho_loc + z_loc*z_loc) ;
284 bool res = (air_loc <=
alpha+prec) ?
true :
false ;
286 if ((xx(3)<0-prec) || (xx(3)>
maxt/
ome + prec))
295 assert (
is_in(abs)) ;
297 double rho_loc = fabs(abs(1)) ;
298 double z_loc = abs(2) ;
299 double air = sqrt(rho_loc*rho_loc+z_loc*z_loc) ;
304 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
307 num.
set(2) = atan(rho_loc/z_loc) ;
311 num.
set(2) = M_PI + num(2) ;
318 double coloc_leg_parity(
int,
int) ;
325 for (
int i=0 ; i<
ndim ; i++)
337 for (
int i=0 ; i<
ndim ; i++)
347 cerr <<
"Unknown type of basis in Domain_polar_periodic_nucleus::do_coloc" << endl ;
383 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
385 l = (m%2==0) ? 2*j : 2*j+1 ;
386 index.
set(0) = j ; index.
set(1) = k ;
387 base.
bases_1d[0]->set(index) = (l%2==0) ? CHEB_EVEN : CHEB_ODD ;
407 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_ODD : SIN_EVEN ;
409 l = (m%2==0) ? 2*j+1 : 2*j ;
410 index.
set(0) = j ; index.
set(1) = k ;
411 base.
bases_1d[0]->set(index) = (l%2==1) ? CHEB_ODD : CHEB_EVEN ;
428 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_EVEN : SIN_ODD ;
430 l = (m%2==0) ? 2*j : 2*j+1 ;
431 index.
set(0) = j ; index.
set(1) = k ;
432 base.
bases_1d[0]->set(index) = (l%2==0) ? LEG_EVEN : LEG_ODD ;
452 base.
bases_1d[1]->set(k) = (m%2==0) ? COS_ODD : SIN_EVEN ;
454 l = (m%2==0) ? 2*j+1 : 2*j ;
455 index.
set(0) = j ; index.
set(1) = k ;
456 base.
bases_1d[0]->set(index) = (l%2==1) ? LEG_ODD : LEG_EVEN ;
471 base.
bases_1d[1]->set(k) = COS_EVEN ;
473 index.
set(0) = j ; index.
set(1) = k ;
474 base.
bases_1d[0]->set(index) = CHEB_ODD ;
489 base.
bases_1d[1]->set(k) = SIN_EVEN ;
491 index.
set(0) = j ; index.
set(1) = k ;
492 base.
bases_1d[0]->set(index) = CHEB_ODD ;
507 base.
bases_1d[1]->set(k) = SIN_ODD ;
509 index.
set(0) = j ; index.
set(1) = k ;
510 base.
bases_1d[0]->set(index) = CHEB_ODD ;
525 base.
bases_1d[1]->set(k) = COS_EVEN ;
527 index.
set(0) = j ; index.
set(1) = k ;
528 base.
bases_1d[0]->set(index) = LEG_ODD ;
543 base.
bases_1d[1]->set(k) = SIN_EVEN ;
545 index.
set(0) = j ; index.
set(1) = k ;
546 base.
bases_1d[0]->set(index) = LEG_ODD ;
561 base.
bases_1d[1]->set(k) = SIN_ODD ;
563 index.
set(0) = j ; index.
set(1) = k ;
564 base.
bases_1d[0]->set(index) = LEG_ODD ;
589 bool res_def = true ;
634 switch ((*a.
bases_1d[1])(index_1)) {
636 switch ((*b.
bases_1d[1])(index_1)) {
638 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
641 res.
bases_1d[1]->set(index_1) = COS_ODD ;
644 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
647 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
655 switch ((*b.
bases_1d[1])(index_1)) {
657 res.
bases_1d[1]->set(index_1) = COS_ODD ;
660 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
663 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
666 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
674 switch ((*b.
bases_1d[1])(index_1)) {
676 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
679 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
682 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
685 res.
bases_1d[1]->set(index_1) = COS_ODD ;
693 switch ((*b.
bases_1d[1])(index_1)) {
695 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
698 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
701 res.
bases_1d[1]->set(index_1) = COS_ODD ;
704 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
716 while (index_1.
inc()) ;
723 switch ((*a.
bases_1d[0])(index_0)) {
725 switch ((*b.
bases_1d[0])(index_0)) {
727 res.
bases_1d[0]->set(index_0) = CHEB_EVEN ;
730 res.
bases_1d[0]->set(index_0) = CHEB_ODD ;
738 switch ((*b.
bases_1d[0])(index_0)) {
740 res.
bases_1d[0]->set(index_0) = CHEB_ODD ;
743 res.
bases_1d[0]->set(index_0) = CHEB_EVEN ;
751 switch ((*b.
bases_1d[0])(index_0)) {
753 res.
bases_1d[0]->set(index_0) = LEG_EVEN ;
756 res.
bases_1d[0]->set(index_0) = LEG_ODD ;
764 switch ((*b.
bases_1d[0])(index_0)) {
766 res.
bases_1d[0]->set(index_0) = LEG_ODD ;
769 res.
bases_1d[0]->set(index_0) = LEG_EVEN ;
781 while (index_0.
inc()) ;
785 for (
int dim=0 ; dim<a.
ndim ; dim++)
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 spherical nucleus with a symmetry in .
virtual void do_radius() const
Computes the generalized radius.
virtual void set_cheb_base_with_m(Base_spectral &, int m) const
Gives the standard base using Chebyshev polynomials.
virtual void set_legendre_base_t_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the component of a vector.
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 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...
Domain_polar_periodic_nucleus(int num, int ttype, double radius, double ome, const Dim_array &nbr)
Standard constructor :
virtual void set_legendre_base_with_m(Base_spectral &, int m) const
Gives the stnadard base using Legendre polynomials.
virtual Val_domain div_x(const Val_domain &) const
Division by .
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
int type_time
Gives the type of time periodicity.
virtual void set_cheb_base_p_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual void set_cheb_base(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
virtual void set_legendre_base_r_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the radial component of a vector.
Term_eq * ome_term_eq
Pointer on the Term_eq version of the pulsation.
virtual void do_coloc()
Computes the colocation points.
virtual void do_absol() const
Computes the absolute coordinates.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
virtual void save(FILE *) const
Saving function.
virtual void set_legendre_base_p_spher(Base_spectral &) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual void set_cheb_base_r_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the radial component of a vector.
virtual void set_anti_legendre_base(Base_spectral &) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void set_cheb_base_t_spher(Base_spectral &) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_anti_cheb_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
double maxt
Upper bound of which is or .
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 .
double alpha
Relates the numerical radius to the physical one.
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 * > absol
Asbolute coordinates (if defined ; usually Cartesian-like)
int ndim
Number of dimensions.
int num_dom
Number of the current domain (used by the Space)
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.
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.
This class is intended to describe the manage objects appearing in the equations.
void set_der_d(double)
Sets the double variation.
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.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.