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"
70 bool doder = (so.
der_t==0x0) ?
false :
true ;
96 type_ind.
set(0) = COV ;
97 for (
int i=0 ; i<valso ; i++)
102 Tensor res (
sp, valso+1 , type_ind, basis) ;
108 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
112 for (
int i=0 ; i<valso ; i++)
113 indtarget.
set(i+1) = ind(i) ;
116 indtarget.
set(0) = 1 ;
119 indtarget.
set(0) = 2 ;
129 Tensor resder (
sp, valso+1 , type_ind, basis) ;
131 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
135 for (
int i=0 ; i<valso ; i++)
136 indtarget.
set(i+1) = ind(i) ;
139 indtarget.
set(0) = 1 ;
142 indtarget.
set(0) = 2 ;
224 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
228 for (
int i=0 ; i<valso ; i++)
229 indgrad.
set(i+1) = ind(i) ;
243 for (
int nc=0 ; nc<so.
get_val_t().get_n_comp() ; nc++) {
247 for (
int i=0 ; i<valso ; i++)
248 indgrad.
set(i+1) = ind(i) ;
267 cerr <<
"Unknown boundary in Domain_polar_shell_inner_adapted::der_normal" << endl ;
276 cerr <<
"Domain_polar_shell_inner_adapted::lap_term_eq only defined for scalars" << endl ;
296 cerr <<
"Domain_polar_shell_inner_adapted::lap2_term_eq not defined for m != 0 (for now)" << endl ;
301 cerr <<
"Domain_polar_shell_inner_adapted::lap2_term_eq only defined for scalars" << endl ;
320 return so * (*rad_term_eq) ;
326 return so / (*rad_term_eq) ;
350 der.
cmp[cmp]->set_domain(
num_dom).set_zero() ;
363 type_ind.
set(0) = COV ;
364 for (
int i=1 ; i<valence+1 ; i++)
376 Index pos_res (val_res) ;
378 for (
int i=1 ; i<valence+1 ; i++)
379 pos_res.
set(i) = pos_so(i-1) ;
387 while (pos_so.
inc()) ;
394 Index pos_res (val_res) ;
396 for (
int i=1 ; i<valence+1 ; i++)
397 pos_res.
set(i) = pos_so(i-1) ;
405 while (pos_so.
inc()) ;
421 type_ind.
set(0) = COV ;
422 for (
int i=1 ; i<valence+1 ; i++)
434 Index pos_res (val_res) ;
436 for (
int i=1 ; i<valence+1 ; i++)
437 pos_res.
set(i) = pos_so(i-1) ;
447 while (pos_so.
inc()) ;
454 Index pos_res (val_res) ;
456 for (
int i=1 ; i<valence+1 ; i++)
457 pos_res.
set(i) = pos_so(i-1) ;
468 while (pos_so.
inc()) ;
481 assert (bound==INNER_BC) ;
483 case CARTESIAN_BASIS :
488 case SPHERICAL_BASIS :
494 cerr <<
"Unknown type of tensorial basis in Domain_polar_shell_inner_adapted::give_normal" << endl ;
502 cerr <<
"Domain_polar_shell_inner_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 lap2_term_eq(const Term_eq &, int) const
Returns the flat 2d-Laplacian of Term_eq, for a given harmonic.
virtual Term_eq der_normal_term_eq(const Term_eq &, int) const
Returns the normal derivative of a Term_eq.
Term_eq * der_rad_term_eq
Pointer on the Term_eq containing the .
void do_normal_cart() const
Computes the normal wrt the inner boundary, in Cartesian coordinates.
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.
Term_eq * dt_rad_term_eq
Pointer on the Term_eq containing the .
Term_eq * rad_term_eq
Pointer on the Term_eq containing the radius.
Term_eq * inner_radius_term_eq
Pointer on the inner boundary , as a Term_eq.
Term_eq derive_t(const Term_eq &so) const
Computes .
const Space & sp
The corresponding Space ; required for updating fields whene the mapping changes.
virtual const Term_eq * give_normal(int, int) const
Returns the vector normal to a surface.
Term_eq * normal_cart
Pointer on the Term_eq containing the normal vector to the inner boundary, in Cartesian coordinates.
virtual Val_domain mult_sin_theta(const Val_domain &) const
Multiplication by .
virtual Term_eq dr_term_eq(const Term_eq &) const
Radial derivative of a Term_eq.
Term_eq derive_r(const Term_eq &so) const
Computes .
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 div_r_term_eq(const Term_eq &) const
Division by of a Term_eq.
Term_eq flat_grad_spher(const Term_eq &so) const
Computes the flat gradient of a field, in orthonormal spherical coordinates.
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...
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...
virtual Term_eq mult_r_term_eq(const Term_eq &) const
Multiplication by of a Term_eq.
Term_eq * normal_spher
Pointer on the Term_eq containing the normal vector to the inner boundary, in orthonormal spherical c...
virtual Term_eq integ_term_eq(const Term_eq &, int) const
Surface integral of a Term_eq.
virtual Term_eq grad_term_eq(const Term_eq &) const
Gradient of Term_eq.
virtual Val_domain mult_cos_theta(const Val_domain &) const
Multiplication by .
void do_normal_spher() const
Computes the normal wrt the inner boundary, in orthonormal spherical coordinates.
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.