20 #include "val_domain.hpp"
21 #include "utilities.hpp"
24 zone{dom}, base{zone->get_ndim()}, is_zero{false}, c{nullptr}, cf{nullptr}, in_conf{false},
25 in_coef{false}, p_der_var{zone->get_ndim()}, p_der_abs{zone->get_ndim()}
34 zone{so.zone}, base{so.base}, is_zero{so.is_zero}, in_conf{copie && so.in_conf}, in_coef{copie && so.in_coef},
35 c{nullptr}, cf{nullptr}, p_der_var{zone->get_ndim()}, p_der_abs{zone->get_ndim()}
48 assert(zone == so.zone);
50 std::swap(is_zero,so.is_zero);
53 std::swap(in_conf,so.in_conf);
54 std::swap(in_coef,so.in_coef);
55 p_der_var.swap(so.p_der_var);
56 p_der_abs.swap(so.p_der_abs);
60 zone{so.zone}, base{std::move(so.base)}, is_zero{so.is_zero}, c{so.c}, cf{so.cf}, in_conf{so.in_conf},
61 in_coef{so.in_coef}, p_der_var{std::move(so.p_der_var)}, p_der_abs{std::move(so.p_der_abs)}
69 assert(zone = so.zone);
70 base = std::move(so.base);
71 is_zero = so.is_zero ;
72 in_conf = so.in_conf ;
73 in_coef = so.in_coef ;
76 p_der_var = std::move(so.p_der_var);
77 p_der_abs = std::move(so.p_der_abs);
82 zone (so), base(fd), is_zero{}, c{}, cf{}, in_conf{}, in_coef{}, p_der_var{}, p_der_abs{}
85 fread_be (&indic,
sizeof(
int), 1, fd) ;
86 is_zero = (indic==0) ?
false :
true ;
87 fread_be (&indic,
sizeof(
int), 1, fd) ;
88 in_conf = (indic==0) ?
true :
false ;
90 fread_be (&indic,
sizeof(
int), 1, fd) ;
91 in_coef = (indic==0) ?
true :
false ;
112 int indic = (
is_zero) ? 1 : 0 ;
113 fwrite_be (&indic,
sizeof(
int), 1, fd) ;
115 fwrite_be (&indic,
sizeof(
int), 1, fd) ;
119 fwrite_be (&indic,
sizeof(
int), 1, fd) ;
126 p_der_var.apply(Safe_deleter<Val_domain>{});
127 p_der_abs.apply(Safe_deleter<Val_domain>{});
174 return c->
set(index) ;
180 return cf->
set(index) ;
188 return cf->
set(index) ;
257 cerr <<
"Unknown type of base in Val_domain::std_base" ;
273 cerr <<
"Unknown type of base in Val_domain::std_base" ;
290 cerr <<
"Unknown type of base in Val_domain::std_anti_base" ;
306 cerr <<
"Unknown type of base in Val_domain::std_base" ;
323 cerr <<
"Unknown type of base in Val_domain::std_anti_base" ;
337 cerr <<
"Unknown type of base in Val_domain::std_base_rt_spher";
351 cerr <<
"Unknown type of base in Val_domain::std_base_rp_spher";
365 cerr <<
"Unknown type of base in Val_domain::std_base_tp_spher";
379 cerr <<
"Unknown type of base in Val_domain::std_base_xy_cart";
393 cerr <<
"Unknown type of base in Val_domain::std_base_xz_cart";
407 cerr <<
"Unknown type of base in Val_domain::std_base_yz_cart";
423 cerr <<
"Unknown type of base in Val_domain::std_base_r_spher" ;
439 cerr <<
"Unknown type of base in Val_domain::std_base_t_spher" ;
455 cerr <<
"Unknown type of base in Val_domain::std_base_p_spher" ;
471 cerr <<
"Unknown type of base in Val_domain::std_base_x_cart" ;
487 cerr <<
"Unknown type of base in Val_domain::std_base_y_cart" ;
503 cerr <<
"Unknown type of base in Val_domain::std_base_z_cart" ;
519 cerr <<
"Unknown type of base in Val_domain::std_base_r_mtz" ;
535 cerr <<
"Unknown type of base in Val_domain::std_base_t_mtz" ;
551 cerr <<
"Unknown type of base in Val_domain::std_base_p_mtz" ;
568 cerr <<
"Unknown type of base in Val_domain::std_xodd_base" ;
584 cerr <<
"Unknown type of base in Val_domain::std_todd_base" ;
600 cerr <<
"Unknown type of base in Val_domain::std_xodd_todd_base" ;
616 cerr <<
"Unknown type of base in Val_domain::std_base_odd" ;
624 #ifndef REMOVE_ALL_CHECKS
626 cout <<
"Base not defined in Val_domain::coef" << endl ;
631 if (
cf !=
nullptr)
delete cf ;
639 #ifndef REMOVE_ALL_CHECKS
641 cout <<
"Base not defined in Val_domain::coef" << endl ;
656 o <<
"Null Val_domain" << endl ;
659 o <<
"Configuration space : " << endl ;
664 o <<
"Coefficient space : " << endl ;
665 o << *so.
cf << endl ;
671 assert ((var>0) && (var<=zone->get_ndim())) ;
683 assert ((var>=0) && (var<=zone->get_ndim())) ;
701 assert ( (var > 0 ) and ( var <= zone->get_ndim() ) );
711 return this->
der_r();
713 return this->
der_t();
715 return this->
der_p();
716 #ifndef REMOVE_ALL_CHECKS
719 cerr <<
"bad index in der_spher" << endl;
reference set(const Index &pos)
Read/write of an element.
void save(FILE *fd, Array_ordering order=last_index) const
Save in a file.
void save(FILE *) const
Saving function.
Array< double > coef(const Dim_array &nbr_coefs, const Array< double > &so) const
Array< double > coef_i(const Dim_array &nbr_points, const Array< double > &so) const
void set_non_def()
Sets all the basis to the undefined state.
Array< double > ope_1d(int(*function)(int, Array< double > &), int var, const Array< double > &so, Base_spectral &base) const
One-dimensional operator acting in the coefficient space.
Abstract class that implements the fonctionnalities common to all the type of domains.
virtual void set_legendre_base_odd(Base_spectral &so) const
Gives the base using odd Legendre polynomials$.
virtual void set_cheb_base_yz_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_cheb_base_r_mtz(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the radial component of a vector in the MTZ setting.
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_p(const Val_domain &so) const
Compute the derivative with respect to of a scalar field.
virtual void set_anti_legendre_base(Base_spectral &so) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
int get_ndim() const
Returns the number of dimensions.
Dim_array const & get_nbr_coefs() const
Returns the number of coefficients.
virtual Val_domain der_r(const Val_domain &so) const
Compute the radial derivative of a scalar field.
virtual void set_cheb_base_rt_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a 2-tensor.
virtual void set_legendre_base_t_mtz(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector in the MTZ context.
virtual void set_cheb_base_xz_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_cheb_xodd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
virtual Val_domain div_r(const Val_domain &so) const
Division by .
virtual void set_cheb_base_p_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual Val_domain der_r_rtwo(const Val_domain &so) const
Compute the radial derivative multiplied by of a scalar field.
virtual void set_cheb_base_t_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_legendre_base_r_spher(Base_spectral &so) const
Gives the base using Legendre polynomials, for the radial component of a vector.
virtual void set_cheb_r_base(Base_spectral &so) const
Gives the base using odd Chebyshev polynomials$ for the radius.
virtual void set_cheb_base(Base_spectral &so) const
Gives the standard base for Chebyshev polynomials.
virtual void set_cheb_base_z_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_cheb_base_rp_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a 2-tensor.
Dim_array const & get_nbr_points() const
Returns the number of points.
virtual void set_legendre_base_y_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual void set_cheb_base_tp_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a 2-tensor.
virtual void set_legendre_xodd_base(Base_spectral &so) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
virtual void set_legendre_base_with_m(Base_spectral &so, int m) const
Gives the stnadard base using Legendre polynomials.
virtual void set_cheb_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in (critic space case)
virtual Val_domain der_t(const Val_domain &so) const
Compute the derivative with respect to of a scalar field.
virtual Val_domain mult_r(const Val_domain &so) const
Multiplication by .
virtual void set_cheb_base_y_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_anti_legendre_base_with_m(Base_spectral &so, int m) const
Gives the base using Legendre polynomials, for functions antisymetric with respect to .
virtual void set_cheb_base_t_mtz(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector in the MTZ setting.
virtual void set_legendre_todd_base(Base_spectral &so) const
Gives the base using Legendre polynomials, for odd functions in (critic space case)
virtual void set_legendre_base_r_mtz(Base_spectral &so) const
Gives the base using Legendre polynomials, for the radial component of a vector in the MTZ context.
virtual void set_legendre_base_z_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual void set_cheb_base_r_spher(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the radial component of a vector.
int get_type_base() const
Returns the type of the basis.
virtual void set_cheb_base_odd(Base_spectral &so) const
Gives the base using odd Chebyshev polynomials$.
virtual void set_cheb_xodd_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in and in (critic space case)
virtual void set_legendre_base_p_spher(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual void set_legendre_base_t_spher(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual void set_legendre_base_x_cart(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector.
virtual double integ_volume(const Val_domain &so) const
Volume integral.
virtual void set_cheb_base_x_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_legendre_base_p_mtz(Base_spectral &so) const
Gives the base using Legendre polynomials, for the component of a vector in the MTZ context.
virtual void set_legendre_base(Base_spectral &so) const
Gives the standard base for Legendre polynomials.
virtual void set_cheb_base_xy_cart(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector.
virtual void set_anti_cheb_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
virtual void set_legendre_xodd_todd_base(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for odd functions in and in (critic space case)
virtual void set_cheb_base_p_mtz(Base_spectral &so) const
Gives the base using Chebyshev polynomials, for the component of a vector in the MTZ setting.
virtual void set_legendre_r_base(Base_spectral &so) const
Gives the base using odd Legendre polynomials$ for the radius.
virtual void set_cheb_base_with_m(Base_spectral &so, int m) const
Gives the standard base using Chebyshev polynomials.
virtual void set_anti_cheb_base_with_m(Base_spectral &so, int m) const
Gives the base using Chebyshev polynomials, for functions antisymetric with respect to .
virtual double integrale(const Val_domain &so) const
Volume integral.
Class that gives the position inside a multi-dimensional Array.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
double operator()(const Index &pos) const
Read only value of the field in the configuration space.
void std_base_r_spher()
Sets the basis for the radial component of a vector in orthonormal spherical coordinates.
void std_base_p_mtz()
Sets the basis for the component of a vector in orthonormal coordinates in the MTZ context.
Base_spectral base
Spectral basis of the field.
void set_in_conf()
Destroys the values in the coefficient space.
void std_todd_base()
Sets the basis for an odd function in (Critic case).
void std_base_t_mtz()
Sets the basis for the component of a vector in orthonormal coordinates in the MTZ context.
void operator=(const Val_domain &)
Assignement to another Val_domain.
void save(FILE *) const
Saving on a file.
void set_in_coef()
Destroys the values in the configuration space.
double & set_coef(const Index &pos)
Read/write the value of the field in the coefficient space.
void swap(Val_domain &so) noexcept
Swaps the content with the source.
void set_zero()
Sets the Val_domain to zero (logical state to zero and arrays destroyed).
void std_base_y_cart()
Sets the basis for the Y-component of a vector in Cartesian coordinates.
Val_domain div_r() const
Division by the radius.
void allocate_coef()
Allocates the values in the coefficient space and destroys the values in the configuration space.
void std_base_tp_spher()
Sets the basis for the component of a 2-tensor in orthonormal spherical coordinates.
bool in_conf
Is the field known in the configuration space ?
void compute_der_abs() const
Computes the derivatives with respect to the absolute Cartesian coordinates.
void std_base_xy_cart()
Sets the basis for the XY component of a 2-tensor in Cartesian coordinates.
Array< double > * cf
Pointer on the Array of the values in the coefficients space.
void del_deriv() const
Delete the derived quantities.
void std_r_base()
Sets the basis for the radius.
void coef_i() const
Computes the values in the configuration space.
void std_base_x_cart()
Sets the basis for the X-component of a vector in Cartesian coordinates.
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
void std_base_xz_cart()
Sets the basis for the XZ component of a 2-tensor in Cartesian coordinates.
void std_xodd_base()
Sets the basis for an odd function in (Critic case).
bool is_zero
Indicator used for null fields (for speed issues).
void std_base()
Sets the standard basis of decomposition.
void std_base_yz_cart()
Sets the basis for the YZ component of a 2-tensor in Cartesian coordinates.
Val_domain der_r_rtwo() const
bool in_coef
Is the field known in the coefficient space ?
void coef() const
Computes the coefficients.
Val_domain der_var(int i) const
Computes the derivative with respect to a numerical coordinate.
Memory_mapped_array< Val_domain * > p_der_var
Pointers on the derivatives of the field with respect to the numerical coordinates.
double integ_volume() const
void std_base_z_cart()
Sets the basis for the Z-component of a vector in Cartesian coordinates.
void annule_hard_coef()
Sets all the arrays to zero in the coefficient space (the logical state is NOT set to zero).
Val_domain mult_r() const
Multiplication by the radius.
void std_base_t_spher()
Sets the basis for the component of a vector in orthonormal spherical coordinates.
void std_anti_base()
Sets the standard, anti-symetric, basis of decomposition.
Array< double > get_coef() const
void std_base_r_mtz()
Sets the basis for the radial component of a vector in orthonormal coordinates in the MTZ context.
void std_base_p_spher()
Sets the basis for the component of a vector in orthonormal spherical coordinates.
void std_xodd_todd_base()
Sets the basis for an odd function in and (Critic case).
Array< double > * c
Pointer on the Array of the values in the configuration space.
Val_domain der_spher(int i) const
Computes the derivative with respect to the spherical coordinates (if defined).
Memory_mapped_array< Val_domain * > p_der_abs
Pointers on the derivatives of the field with respect to the absolute Cartesian coordinates.
void std_base_odd()
Sets the basis in odd polynomials.
void std_base_rp_spher()
Sets the basis for the component of a 2-tensor in orthonormal spherical coordinates.
Val_domain(const Domain *so)
Constructor from a Domain.
Val_domain der_abs(int i) const
Computes the derivative with respect to an absolute coordinate (typically Cartesian).
void annule_hard()
Sets all the arrays to zero (the logical state is NOT set to zero).
void compute_der_var() const
Computes the derivatives with respect to the numerical coordinates.
void allocate_conf()
Allocates the values in the configuration space and destroys the values in the coefficients space.
const Domain * get_domain() const
void std_base_rt_spher()
Sets the basis for the component of a 2-tensor in orthonormal spherical coordinates.
const Domain * zone
Pointer to the associated Domain.