20 #include "headcpp.hpp"
22 #include "utilities.hpp"
23 #include "spheric.hpp"
24 #include "val_domain.hpp"
27 Domain_shell_log::Domain_shell_log (
int num,
int ttype,
double rint,
double rext,
const Point& cr,
const Dim_array& nbr) :
Domain_shell(num, ttype, rint, rext, cr, nbr) {
28 alpha = (log(rext)-log(rint))/2. ;
29 beta = (log(rext)+log(rint))/2. ;
43 alpha = (log(rext)-log(rint))/2. ;
44 beta = (log(rext)+log(rint))/2. ;
49 Domain_shell_log::Domain_shell_log (
int num, FILE* fd) :
Domain_shell(num, fd) {
54 Domain_shell_log::~Domain_shell_log() {}
59 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
60 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
62 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
63 fwrite_be (&
beta,
sizeof(
double), 1, fd) ;
67 o <<
"Shell log" << endl ;
69 o <<
"Center = " <<
center << endl ;
79 if ((bound!=OUTER_BC) && (bound!=INNER_BC)) {
80 cerr <<
"Unknown boundary case in Domain_shell_log::der_normal" << endl ;
88 for (
int i=0 ; i<3 ; i++)
89 assert (
coloc[i] != 0x0) ;
90 for (
int i=0 ; i<3 ; i++)
91 assert (
absol[i] == 0x0) ;
92 for (
int i=0 ; i<3 ; i++) {
94 absol[i]->allocate_conf() ;
105 while (index.
inc()) ;
110 for (
int i=0 ; i<3 ; i++)
111 assert (
coloc[i] != 0x0) ;
118 while (index.
inc()) ;
124 for (
int i=0 ; i<3 ; i++)
125 assert (
coloc[i] != 0x0) ;
126 for (
int i=0 ; i<3 ; i++)
127 assert (
cart[i] == 0x0) ;
128 for (
int i=0 ; i<3 ; i++) {
130 cart[i]->allocate_conf() ;
141 while (index.
inc()) ;
149 double x_loc = xx(1) -
center(1) ;
150 double y_loc = xx(2) -
center(2) ;
151 double z_loc = xx(3) -
center(3) ;
152 double air_loc = sqrt (x_loc*x_loc + y_loc*y_loc + z_loc*z_loc) ;
154 bool res = ((air_loc/exp(
alpha+
beta) -1 <= +prec) && (air_loc/exp(
beta-
alpha) -1 >= -prec)) ? true : false ;
161 assert (
is_in(abs)) ;
164 double x_loc = abs(1) -
center(1) ;
165 double y_loc = abs(2) -
center(2) ;
166 double z_loc = abs(3) -
center(3) ;
167 double air = sqrt(x_loc*x_loc+y_loc*y_loc+z_loc*z_loc) ;
169 double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
173 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
177 num.
set(2) = atan(rho/z_loc) ;
178 num.
set(3) = atan2 (y_loc, x_loc) ;
182 num.
set(2) = M_PI + num(2) ;
191 assert ((bound==OUTER_BC) || (bound==INNER_BC)) ;
192 assert (
is_in(abs, 1e-3)) ;
195 double x_loc = abs(1) -
center(1) ;
196 double y_loc = abs(2) -
center(2) ;
197 double z_loc = abs(3) -
center(3) ;
207 cerr <<
"unknown boundary in Domain_shell::absol_to_num" << endl ;
211 double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
215 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
219 num.
set(2) = atan(rho/z_loc) ;
220 num.
set(3) = atan2 (y_loc, x_loc) ;
224 num.
set(2) = M_PI + num(2) ;
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 shell and a symmetry with respect to the plane .
virtual const Point absol_to_num_bound(const Point &, int) const
Computes the numerical coordinates from the physical ones for a point lying on a boundary.
virtual void do_absol() const
Computes the absolute coordinates.
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 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.
virtual Val_domain der_r(const Val_domain &) const
Compute the radial derivative of a scalar field.
virtual const Point absol_to_num(const Point &xxx) const
Computes the numerical coordinates from the physical ones.
virtual bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual void save(FILE *) const
Saving function.
virtual void do_cart() const
Computes the Cartesian coordinates.
Class for a spherical shell and a symmetry with respect to the plane .
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
double beta
Relates the numerical to the physical radii.
double alpha
Relates the numerical to the physical radii.
virtual void do_coloc()
Computes the colocation points.
virtual Val_domain mult_cos_phi(const Val_domain &) const
Multiplication by .
virtual Val_domain mult_sin_phi(const Val_domain &) const
Multiplication by .
Point center
Absolute coordinates of the center.
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
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.
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_phi() const
Multiplication by .
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.
void std_base()
Sets the standard basis of decomposition.
Val_domain div_sin_theta() const
Division by .
Val_domain mult_cos_theta() const
Multiplication by .
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.