20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "spheric_time.hpp"
24 #include "array_math.hpp"
25 #include "val_domain.hpp"
28 void coef_1d (
int, Array<double>&) ;
29 void coef_i_1d (
int, Array<double>&) ;
30 int der_1d (
int, Array<double>&) ;
34 Domain(numdom, ttype, nbr), alpha(r), tmin(tmmin), tmax(tmmax) {
44 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
45 fread_be (&
tmin,
sizeof(
double), 1, fd) ;
46 fread_be (&
tmax,
sizeof(
double), 1, fd) ;
51 Domain_spheric_time_nucleus::~Domain_spheric_time_nucleus() {}
56 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
57 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
58 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
59 fwrite_be (&
tmin,
sizeof(
double), 1, fd) ;
60 fwrite_be (&
tmax,
sizeof(
double), 1, fd) ;
64 o <<
"Spheric-time nucleus" << endl ;
65 o <<
"time goes from " <<
tmin <<
" to " <<
tmax << endl ;
66 o <<
"Rmax = " <<
alpha << endl ;
85 cerr <<
"Unknown boundary case in Domain_spheric_time_nucleus::der_normal" << endl ;
92 for (
int i=0 ; i<2 ; i++)
93 assert (
coloc[i] != 0x0) ;
94 for (
int i=0 ; i<2 ; i++)
95 assert (
absol[i] == 0x0) ;
96 for (
int i=0 ; i<2 ; i++) {
98 absol[i]->allocate_conf() ;
105 while (index.
inc()) ;
112 for (
int i=0 ; i<2 ; i++)
113 assert (
coloc[i] != 0x0) ;
120 while (index.
inc()) ;
129 bool res = (xx(1) <=
alpha+prec) ?
true :
false ;
130 if ((xx(2)<
tmin-prec) || (xx(2)>
tmax + prec))
138 assert (
is_in(abs)) ;
147 double coloc_leg(
int,
int) ;
148 double coloc_leg_parity(
int,
int) ;
155 for (
int i=0 ; i<
ndim ; i++)
165 for (
int i=0 ; i<
ndim ; i++)
173 cerr <<
"Unknown type of basis in Domain_spheric_time_nucleus::do_coloc" << endl ;
189 base.
bases_1d[0]->set(j) = CHEB_EVEN ;
202 base.
bases_1d[0]->set(j) = LEG_EVEN ;
220 bool res_def = true ;
263 switch ((*a.
bases_1d[0])(index_0)) {
265 switch ((*b.
bases_1d[0])(index_0)) {
267 res.
bases_1d[0]->set(index_0) = CHEB_EVEN ;
270 res.
bases_1d[0]->set(index_0) = CHEB_ODD ;
278 switch ((*b.
bases_1d[0])(index_0)) {
280 res.
bases_1d[0]->set(index_0) = CHEB_ODD ;
283 res.
bases_1d[0]->set(index_0) = CHEB_EVEN ;
291 switch ((*b.
bases_1d[0])(index_0)) {
293 res.
bases_1d[0]->set(index_0) = LEG_EVEN ;
296 res.
bases_1d[0]->set(index_0) = LEG_ODD ;
304 switch ((*b.
bases_1d[0])(index_0)) {
306 res.
bases_1d[0]->set(index_0) = LEG_ODD ;
309 res.
bases_1d[0]->set(index_0) = LEG_EVEN ;
321 while (index_0.
inc()) ;
324 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 containing the origin and a symetry with respect to the pl...
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
Domain_spheric_time_nucleus(int num, int ttype, double tmmin, double tmmax, double radius, const Dim_array &nbr)
Standard constructor :
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
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 void set_cheb_base(Base_spectral &) const
Gives the standard base for Chebyshev polynomials.
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 do_coloc()
Computes the colocation points.
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 save(FILE *) const
Saving function.
double tmin
Initial time .
virtual Val_domain der_normal(const Val_domain &, int) const
Normal derivative with respect to a given surface.
virtual void do_radius() const
Computes the generalized radius.
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.