20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "fourD_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 ;
53 type_time(so.type_time), maxt(so.maxt) {
57 fread_be (&
alpha,
sizeof(
double), 1, fd) ;
58 fread_be (&
ome,
sizeof(
double), 1, fd) ;
59 fread_be (&
type_time,
sizeof(
int), 1, fd) ;
65 cerr <<
"Unknown case for type_time" << endl ;
72 Domain_fourD_periodic_nucleus::~Domain_fourD_periodic_nucleus() {
78 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
79 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
80 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
81 fwrite_be (&
ome,
sizeof(
double), 1, fd) ;
82 fwrite_be (&
type_time,
sizeof(
int), 1, fd) ;
86 o <<
"fourD_periodic nucleus" << endl ;
87 o <<
"time goes to " <<
maxt << endl ;
88 o <<
"Rmax = " <<
alpha << endl ;
89 o <<
"Omega = " <<
ome << endl ;
97 for (
int i=0 ; i<4 ; i++)
98 assert (
coloc[i] != 0x0) ;
99 for (
int i=0 ; i<4 ; i++)
100 assert (
absol[i] == 0x0) ;
101 for (
int i=0 ; i<4 ; i++) {
103 absol[i]->allocate_conf() ;
108 sin((*
coloc[1])(index(1)))*cos((*
coloc[2])(index(2))) ;
110 sin((*
coloc[1])(index(1)))*sin((*
coloc[2])(index(2))) ;
114 while (index.
inc()) ;
121 for (
int i=0 ; i<4 ; i++)
122 assert (
coloc[i] != 0x0) ;
129 while (index.
inc()) ;
138 double x_loc = xx(1) ;
139 double y_loc = xx(2) ;
140 double z_loc = xx(3) ;
141 double air_loc = sqrt (x_loc*x_loc + y_loc*y_loc + z_loc*z_loc) ;
143 bool res = (air_loc <=
alpha+prec) ?
true :
false ;
145 if ((xx(4)<0-prec) || (xx(4)>
maxt/
ome + prec))
156 double x_loc = abs(1) ;
157 double y_loc = abs(2) ;
158 double z_loc = abs(3) ;
159 double air = sqrt(x_loc*x_loc+y_loc*y_loc+z_loc*z_loc) ;
161 double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
165 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
169 num.
set(2) = atan(rho/z_loc) ;
170 num.
set(3) = atan2 (y_loc, x_loc) ;
174 num.
set(2) = M_PI + num(2) ;
181 double coloc_leg_parity(
int,
int) ;
189 for (
int i=0 ; i<
ndim ; i++)
204 for (
int i=0 ; i<
ndim ; i++)
216 cerr <<
"Unknown type of basis in Domain_fourD_periodic_nucleus::do_coloc" << endl ;
249 bool res_def = true ;
295 switch ((*a.
bases_1d[2])(index_2)) {
297 switch ((*b.
bases_1d[2])(index_2)) {
299 res.
bases_1d[2]->set(index_2) = COSSIN ;
310 }
while (index_2.
inc()) ;
316 switch ((*a.
bases_1d[1])(index_1)) {
318 switch ((*b.
bases_1d[1])(index_1)) {
320 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
323 res.
bases_1d[1]->set(index_1) = COS_ODD ;
326 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
329 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
337 switch ((*b.
bases_1d[1])(index_1)) {
339 res.
bases_1d[1]->set(index_1) = COS_ODD ;
342 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
345 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
348 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
356 switch ((*b.
bases_1d[1])(index_1)) {
358 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
361 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
364 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
367 res.
bases_1d[1]->set(index_1) = COS_ODD ;
375 switch ((*b.
bases_1d[1])(index_1)) {
377 res.
bases_1d[1]->set(index_1) = SIN_ODD ;
380 res.
bases_1d[1]->set(index_1) = SIN_EVEN ;
383 res.
bases_1d[1]->set(index_1) = COS_ODD ;
386 res.
bases_1d[1]->set(index_1) = COS_EVEN ;
398 while (index_1.
inc()) ;
405 switch ((*a.
bases_1d[0])(index_0)) {
407 switch ((*b.
bases_1d[0])(index_0)) {
409 res.
bases_1d[0]->set(index_0) = CHEB_EVEN ;
412 res.
bases_1d[0]->set(index_0) = CHEB_ODD ;
420 switch ((*b.
bases_1d[0])(index_0)) {
422 res.
bases_1d[0]->set(index_0) = CHEB_ODD ;
425 res.
bases_1d[0]->set(index_0) = CHEB_EVEN ;
433 switch ((*b.
bases_1d[0])(index_0)) {
435 res.
bases_1d[0]->set(index_0) = LEG_EVEN ;
438 res.
bases_1d[0]->set(index_0) = LEG_ODD ;
446 switch ((*b.
bases_1d[0])(index_0)) {
448 res.
bases_1d[0]->set(index_0) = LEG_ODD ;
451 res.
bases_1d[0]->set(index_0) = LEG_EVEN ;
463 while (index_0.
inc()) ;
468 for (
int dim=0 ; dim<a.
ndim ; dim++)
519 pcf.
set(3) = pso(2) ;
521 pcf.
set(1) = pso(1) ;
522 pcf.
set(0) = pso(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.
int & set(int i)
Read/write of the size of a given dimension.
void save(FILE *) const
Save function.
Class for a spherical nucleus.
virtual void save(FILE *) const
Saving function.
double maxt
Upper bound of which is or .
virtual Val_domain mult_cos_phi(const Val_domain &) const
Multiplication by .
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
Val_domain translate(const Val_domain &so) const
Generates a Val_domain, from another one assumed to be on a Polar_periodic_nucleus.
virtual Val_domain mult_sin_phi(const Val_domain &) const
Multiplication by .
virtual void do_absol() const
Computes the absolute coordinates.
Domain_fourD_periodic_nucleus(int num, int ttype, double radius, double ome, const Dim_array &nbr)
Standard constructor :
virtual void do_radius() const
Computes the generalized radius.
double alpha
Relates the numerical radius to the physical one.
virtual Val_domain div_x(const Val_domain &) const
Division by .
virtual const Point absol_to_num(const Point &) const
Computes the numerical coordinates from the physical ones.
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 do_coloc()
Computes the colocation points.
int type_time
Gives the type of time periodicity.
virtual Base_spectral mult(const Base_spectral &, const Base_spectral &) const
Method for the multiplication of two Base_spectral.
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
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 const & get_nbr_coefs() const
Returns the number of coefficients.
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.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Val_domain mult_sin_phi() const
Multiplication by .
double & set_coef(const Index &pos)
Read/write the value of the field in the coefficient space.
Val_domain mult_sin_theta() const
Multiplication by .
Val_domain mult_cos_phi() const
Multiplication by .
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
Val_domain div_sin_theta() const
Division by .
Val_domain mult_cos_theta() const
Multiplication by .
void coef() const
Computes the coefficients.
Base_spectral & set_base()
Sets the basis of decomposition.
Array< double > get_coef() const
void annule_hard()
Sets all the arrays to zero (the logical state is NOT set to zero).
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.
const Domain * get_domain() const
const Base_spectral & get_base() const
Returns the basis of decomposition.