20 #include "headcpp.hpp"
21 #include "utilities.hpp"
22 #include "adapted_polar.hpp"
24 #include "array_math.hpp"
25 #include "val_domain.hpp"
27 #include "tensor_impl.hpp"
71 bool doder = (so.
der_t==0x0) ?
false :
true ;
97 type_ind.
set(0) = COV ;
98 for (
int i=0 ; i<valso ; i++)
103 Tensor res (
sp, valso+1 , type_ind, basis) ;
109 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
113 for (
int i=0 ; i<valso ; i++)
114 indtarget.
set(i+1) = ind(i) ;
117 indtarget.
set(0) = 1 ;
120 indtarget.
set(0) = 2 ;
130 Tensor resder (
sp, valso+1 , type_ind, basis) ;
132 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
136 for (
int i=0 ; i<valso ; i++)
137 indtarget.
set(i+1) = ind(i) ;
140 indtarget.
set(0) = 1 ;
143 indtarget.
set(0) = 2 ;
225 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
229 for (
int i=0 ; i<valso ; i++)
230 indgrad.
set(i+1) = ind(i) ;
244 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
248 for (
int i=0 ; i<valso ; i++)
249 indgrad.
set(i+1) = ind(i) ;
268 cerr <<
"Unknown boundary in Domain_polar_shell_outer_adapted::der_normal" << endl ;
276 #ifndef REMOVE_ALL_CHECKS
278 cerr <<
"Domain_polar_shell_outer_adapted::lap_term_eq only defined for scalars" << endl ;
300 #ifndef REMOVE_ALL_CHECKS
302 cerr <<
"Domain_polar_shell_outer_adapted::lap2_term_eq not defined for m != 0 (for now)" << endl ;
307 cerr <<
"Domain_polar_shell_outer_adapted::lap2_term_eq only defined for scalars" << endl ;
327 return so * (*rad_term_eq) ;
333 return so / (*rad_term_eq) ;
357 der.
cmp[cmp]->set_domain(
num_dom).set_zero() ;
370 type_ind.
set(0) = COV ;
371 for (
int i=1 ; i<valence+1 ; i++)
383 Index pos_res (val_res) ;
385 for (
int i=1 ; i<valence+1 ; i++)
386 pos_res.
set(i) = pos_so(i-1) ;
394 while (pos_so.
inc()) ;
401 Index pos_res (val_res) ;
403 for (
int i=1 ; i<valence+1 ; i++)
404 pos_res.
set(i) = pos_so(i-1) ;
412 while (pos_so.
inc()) ;
428 type_ind.
set(0) = COV ;
429 for (
int i=1 ; i<valence+1 ; i++)
441 Index pos_res (val_res) ;
443 for (
int i=1 ; i<valence+1 ; i++)
444 pos_res.
set(i) = pos_so(i-1) ;
454 while (pos_so.
inc()) ;
461 Index pos_res (val_res) ;
463 for (
int i=1 ; i<valence+1 ; i++)
464 pos_res.
set(i) = pos_so(i-1) ;
475 while (pos_so.
inc()) ;
488 assert (bound==INNER_BC) ;
490 case CARTESIAN_BASIS :
495 case SPHERICAL_BASIS :
501 cerr <<
"Unknown type of tensorial basis in Domain_polar_shell_outer_adapted::give_normal" << endl ;
507 cerr <<
"Domain_polar_shell_outer_adapted::integ_term_eq not implemented yet" << endl ;
reference set(const Index &pos)
Read/write of an element.
Describes the tensorial basis used by the various tensors.
int & set_basis(int nd)
Read/write the basis in a given domain.
virtual Term_eq lap_term_eq(const Term_eq &, int) const
Returns the flat Laplacian of Term_eq, for a given harmonic.
virtual Term_eq dr_term_eq(const Term_eq &) const
Radial derivative of a Term_eq.
Term_eq * normal_cart
Pointer on the Term_eq containing the normal vector to the outer boundary, in Cartesian coordinates.
virtual Term_eq der_normal_term_eq(const Term_eq &, int) const
Returns the normal derivative of a Term_eq.
virtual Term_eq integ_term_eq(const Term_eq &, int) const
Surface integral of a Term_eq.
void do_normal_cart() const
Computes the normal wrt the inner boundary, in Cartesian coordinates.
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
const Space & sp
The corresponding Space ; required for updating fields whene the mapping changes.
virtual Term_eq lap2_term_eq(const Term_eq &, int) const
Returns the flat 2d-Laplacian of Term_eq, for a given harmonic.
virtual Term_eq partial_spher(const Term_eq &) const
Computes the part of the gradient containing the partial derivative of the field, in spherical orthon...
Term_eq derive_r(const Term_eq &so) const
Computes .
void do_normal_spher() const
Computes the normal wrt the inner boundary, in orthonormal spherical coordinates.
virtual Term_eq partial_cart(const Term_eq &) const
Computes the part of the gradient containing the partial derivative of the field, in Cartesian coordi...
Term_eq flat_grad_spher(const Term_eq &) const
Computes the flat gradient of a field, in orthonormal spherical coordinates.
virtual Term_eq mult_r_term_eq(const Term_eq &) const
Multiplication by of a Term_eq.
Term_eq * dt_rad_term_eq
Pointer on the Term_eq containing the .
Term_eq * normal_spher
Pointer on the Term_eq containing the normal vector to the outer boundary, in orthonormal spherical c...
virtual const Term_eq * give_normal(int, int) const
Returns the vector normal to a surface.
Term_eq derive_t(const Term_eq &so) const
Computes .
virtual void update_term_eq(Term_eq *) const
Update the value of a field, after the shape of the Domain has been changed by the system.
virtual Term_eq grad_term_eq(const Term_eq &) const
Gradient of Term_eq.
virtual Term_eq div_r_term_eq(const Term_eq &) const
Division by of a Term_eq.
Term_eq * rad_term_eq
Pointer on the Term_eq containing the radius.
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
Term_eq * der_rad_term_eq
Pointer on the Term_eq containing the .
Term_eq * outer_radius_term_eq
Pointer on the outer boundary , as a Term_eq.
Term_eq do_comp_by_comp(const Term_eq &so, Val_domain(Domain::*pfunc)(const Val_domain &) const) const
Function used to apply the same operation to all the components of a tensor, in the current domain.
int num_dom
Number of the current domain (used by the Space)
virtual Val_domain div_sin_theta(const Val_domain &) const
Division by .
Dim_array nbr_points
Number of colocation points.
Memory_mapped_array< Array< double > * > coloc
Colocation points in each dimension (stored in ndim 1d- arrays)
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
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 Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
Memory_mapped_array< Scalar * > cmp
Array of size n_comp of pointers onto the components.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
int get_n_comp() const
Returns the number of stored components.
virtual Array< int > indices(int pos) const
Gives the values of the indices corresponding to a location in the array used for storage of the comp...
int get_valence() const
Returns the valence.
const Space & get_space() const
Returns the Space.
This class is intended to describe the manage objects appearing in the equations.
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
void set_der_t(Tensor)
Sets the tensorial variation (only the values in the pertinent Domain are copied).
Tensor const & get_val_t() const
Tensor const & get_der_t() const
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
bool check_if_zero() const
Check whether the logical state is zero or not.
double & set(const Index &pos)
Read/write the value of the field in the configuration space.
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.
A class derived from Tensor to deal specificaly with objects of valence 1 (and so also 1-forms).
Scalar & set(int)
Read/write access to a component.