20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "spheric_periodic.hpp"
23 #include "array_math.hpp"
24 #include "val_domain.hpp"
27 void coef_1d (
int, Array<double>&) ;
28 void coef_i_1d (
int, Array<double>&) ;
29 int der_1d (
int, Array<double>&) ;
33 Domain(num, ttype, nbr), alpha((rext-rint)/2.), beta((rext+rint)/2.), ome(oome), type_time(typet) {
43 cerr <<
"Unknown case for type_time" << endl ;
51 type_time (so.type_time), maxt (so.maxt) {
55 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
56 fread_be (&
beta,
sizeof(
double), 1, fd) ;
57 fread_be (&
ome,
sizeof(
double), 1, fd) ;
58 fread_be (&
type_time,
sizeof(
int), 1, fd) ;
67 cerr <<
"Unknown case for type_time" << endl ;
74 Domain_spheric_periodic_shell::~Domain_spheric_periodic_shell() {}
79 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
80 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
81 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
82 fwrite_be (&
beta,
sizeof(
double), 1, fd) ;
83 fwrite_be (&
ome,
sizeof(
double), 1, fd) ;
84 fwrite_be (&
type_time,
sizeof(
int), 1, fd) ;
88 o <<
"Spheric-periodic shell" << endl ;
90 o <<
"time goes to " <<
maxt << endl ;
91 o <<
"Omega = " <<
ome << endl ;
109 cerr <<
"Unknown boundary case in Domain_spheric_periodic_shell::der_normal" << endl ;
117 for (
int i=0 ; i<2 ; i++)
118 assert (
coloc[i] != 0x0) ;
119 for (
int i=0 ; i<2 ; i++)
120 assert (
absol[i] == 0x0) ;
121 for (
int i=0 ; i<2 ; i++) {
123 absol[i]->allocate_conf() ;
130 while (index.
inc()) ;
136 for (
int i=0 ; i<2 ; i++)
137 assert (
coloc[i] != 0x0) ;
144 while (index.
inc()) ;
153 bool res = ((xx(1) <=
alpha+
beta+prec) && (xx(1) >=
beta-
alpha-prec)) ? true : false ;
154 if ((xx(2)<0-prec) || (xx(2)>
maxt/
ome + prec))
162 assert (
is_in(abs)) ;
171 double coloc_leg(
int,
int) ;
178 for (
int i=0 ; i<
ndim ; i++)
188 for (
int i=0 ; i<
ndim ; i++)
196 cerr <<
"Unknown type of basis in Domain_spheric_periodic_shell::do_coloc" << endl ;
215 base.
bases_1d[1]->set(0) = COS_EVEN ;
218 cerr <<
"Unknown case for type_time" << endl ;
238 base.
bases_1d[1]->set(0) = COS_EVEN ;
241 cerr <<
"Unknown case for type_time" << endl ;
261 base.
bases_1d[1]->set(0) = COS_EVEN ;
264 cerr <<
"Unknown case for type_time" << endl ;
283 base.
bases_1d[1]->set(0) = COS_EVEN ;
286 cerr <<
"Unknown case for type_time" << endl ;
303 base.
bases_1d[1]->set(0) = COS_ODD ;
306 cerr <<
"Unknown case for type_time" << endl ;
323 base.
bases_1d[1]->set(0) = COS_ODD ;
326 cerr <<
"Unknown case for type_time" << endl ;
347 bool res_def = true ;
389 res.
bases_1d[1]->set(0) = COS_EVEN ;
395 res.
bases_1d[1]->set(0) = SIN_EVEN ;
411 res.
bases_1d[1]->set(0) = COS_EVEN ;
417 res.
bases_1d[1]->set(0) = SIN_EVEN ;
427 res.
bases_1d[1]->set(0) = SIN_EVEN ;
433 res.
bases_1d[1]->set(0) = COS_EVEN ;
449 res.
bases_1d[1]->set(0) = SIN_EVEN ;
455 res.
bases_1d[1]->set(0) = COS_EVEN ;
471 switch ((*a.
bases_1d[0])(index_0)) {
473 switch ((*b.
bases_1d[0])(index_0)) {
475 res.
bases_1d[0]->set(index_0) = CHEB ;
483 switch ((*b.
bases_1d[0])(index_0)) {
485 res.
bases_1d[0]->set(index_0) = LEG ;
497 while (index_0.
inc()) ;
501 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 2-dimensional spherical domain bounded between two fixed radii and a symetry with respect...
double maxt
Upper bound of which is or .
virtual void set_anti_cheb_base(Base_spectral &) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
virtual void do_absol() const
Computes the absolute coordinates.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
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(Base_spectral &) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void save(FILE *) const
Saving function.
virtual void set_cheb_base(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
virtual void do_radius() const
Computes the generalized radius.
virtual void set_legendre_base_odd(Base_spectral &) const
Gives the base using odd Legendre polynomials$.
double alpha
Relates the numerical to the physical radii.
virtual void do_coloc()
Computes the colocation points.
double ome
Relates the numerical time to the physical one.
virtual void set_legendre_base(Base_spectral &) const
Gives the standard base for Legendre polynomials.
double beta
Relates the numerical to the physical radii.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
int type_time
Gives the type of time periodicity.
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
virtual void set_cheb_base_odd(Base_spectral &) const
Gives the base using odd Chebyshev polynomials$.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
Domain_spheric_periodic_shell(int num, int ttype, int typet, double r_int, double r_ext, double ome, const Dim_array &nbr)
Standard constructor :
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
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.
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.
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.