20 #include "headcpp.hpp"
22 #include "utilities.hpp"
23 #include "spheric.hpp"
25 #include "val_domain.hpp"
28 Domain_shell_surr::Domain_shell_surr (
int num,
int ttype,
double rint,
double rext,
const Point& cr,
const Dim_array& nbr) :
Domain_shell(num, ttype, rint, rext, cr, nbr) {
29 alpha = (1./rext-1./rint)/2. ;
30 beta = (1./rext+1./rint)/2. ;
44 alpha = (1./rext-1./rint)/2. ;
45 beta = (1./rext+1./rint)/2. ;
48 Domain_shell_surr::Domain_shell_surr (
int num, FILE* fd) :
Domain_shell(num, fd) {
53 Domain_shell_surr::~Domain_shell_surr() {}
58 fwrite_be (&
ndim,
sizeof(
int), 1, fd) ;
59 fwrite_be (&
type_base,
sizeof(
int), 1, fd) ;
61 fwrite_be (&
alpha,
sizeof(
double), 1, fd) ;
62 fwrite_be (&
beta,
sizeof(
double), 1, fd) ;
66 o <<
"Shell surr" << endl ;
68 o <<
"Center = " <<
center << endl ;
78 if ((bound!=OUTER_BC) && (bound!=INNER_BC)) {
79 cerr <<
"Unknown boundary case in Domain_shell_surr::der_normal" << endl ;
87 for (
int i=0 ; i<3 ; i++)
88 assert (
coloc[i] != 0x0) ;
89 for (
int i=0 ; i<3 ; i++)
90 assert (
absol[i] == 0x0) ;
91 for (
int i=0 ; i<3 ; i++) {
93 absol[i]->allocate_conf() ;
104 while (index.
inc()) ;
109 for (
int i=0 ; i<3 ; i++)
110 assert (
coloc[i] != 0x0) ;
117 while (index.
inc()) ;
123 for (
int i=0 ; i<3 ; i++)
124 assert (
coloc[i] != 0x0) ;
125 for (
int i=0 ; i<3 ; i++)
126 assert (
cart[i] == 0x0) ;
127 for (
int i=0 ; i<3 ; i++) {
129 cart[i]->allocate_conf() ;
140 while (index.
inc()) ;
148 double x_loc = xx(1) -
center(1) ;
149 double y_loc = xx(2) -
center(2) ;
150 double z_loc = xx(3) -
center(3) ;
151 double air_loc = sqrt (x_loc*x_loc + y_loc*y_loc + z_loc*z_loc) ;
153 bool res = ((air_loc*(
alpha+
beta) -1 <= +prec) && (air_loc * (
beta-
alpha) -1 >= -prec)) ?
true :
false ;
160 assert (
is_in(abs)) ;
163 double x_loc = abs(1) -
center(1) ;
164 double y_loc = abs(2) -
center(2) ;
165 double z_loc = abs(3) -
center(3) ;
166 double air = sqrt(x_loc*x_loc+y_loc*y_loc+z_loc*z_loc) ;
168 double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
172 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
176 num.
set(2) = atan(rho/z_loc) ;
177 num.
set(3) = atan2 (y_loc, x_loc) ;
181 num.
set(2) = M_PI + num(2) ;
190 assert ((bound==OUTER_BC) || (bound==INNER_BC)) ;
191 assert (
is_in(abs, 1e-3)) ;
194 double x_loc = abs(1) -
center(1) ;
195 double y_loc = abs(2) -
center(2) ;
196 double z_loc = abs(3) -
center(3) ;
206 cerr <<
"unknown boundary in Domain_shell::absol_to_num" << endl ;
210 double rho = sqrt(x_loc*x_loc+y_loc*y_loc) ;
214 num.
set(2) = (z_loc>=0) ? 0 : M_PI ;
218 num.
set(2) = atan(rho/z_loc) ;
219 num.
set(3) = atan2 (y_loc, x_loc) ;
223 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 void do_cart() const
Computes the Cartesian coordinates.
virtual const Point absol_to_num(const Point &xxx) const
Computes the numerical coordinates from the physical ones.
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 Val_domain der_r(const Val_domain &) const
Compute the radial derivative of a scalar field.
virtual void do_absol() const
Computes the absolute coordinates.
virtual ostream & print(ostream &o) const
Delegate function to virtualize the << operator.
virtual void save(FILE *) const
Saving function.
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 bool is_in(const Point &xx, double prec=1e-13) const
Check whether a point lies inside Domain.
virtual void do_radius() const
Computes the generalized radius.
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.