KADATH
Kadath::Base_spectral Class Reference

Class for storing the basis of decompositions of a field. More...

#include <base_spectral.hpp>

Inheritance diagram for Kadath::Base_spectral:

Public Types

using Bases_container = Memory_mapped_array< Array< int > *, int >
 Sylvain'stuff. More...
 

Public Member Functions

 Base_spectral (int dimensions)
 Standard constructor, the Base_spectral is not defined. More...
 
 Base_spectral (const Base_spectral &so)
 Copy constructor. More...
 
 Base_spectral (FILE *)
 Constructor from a file. More...
 
 Base_spectral (Base_spectral &&so)
 Move constructor. More...
 
Base_spectraloperator= (Base_spectral &&so)
 Move assignment operator. More...
 
 ~Base_spectral ()
 Destructor. More...
 
void save (FILE *) const
 Saving function. More...
 
void swap (Base_spectral &so)
 Swaps data between the source and this. More...
 
bool is_def () const
 
void set_non_def ()
 Sets all the basis to the undefined state. More...
 
Base_spectraloperator= (const Base_spectral &)
 Assignement operator. More...
 
const Array< int > * get_base_1d (int i) const
 Returns one of the 1d base array. More...
 
void allocate (const Dim_array &nbr_coefs)
 Allocates the various arrays, for a given number of coefficients. More...
 
void set (Dim_array const &nbr_coefs, int basephi, int basetheta, int baser)
 Allocates the various arrays, for a given number of coefficients and sets basis to some values (same for all harmonics). More...
 
void coef_dim (int var, int nbr, Array< double > *&tab) const
 
Array< double > coef (const Dim_array &nbr_coefs, const Array< double > &so) const
 
void coef_i_dim (int var, int nbr, Array< double > *&tab) const
 Performs the inverse coefficient transformation for one particular variable. More...
 
Array< double > coef_i (const Dim_array &nbr_points, const Array< double > &so) const
 
double summation (const Point &num, const Array< double > &tab) const
 Computes the spectral summation. More...
 
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. More...
 

Protected Attributes

bool def
 true if the Base_spectral is defined and false otherwise. More...
 
int ndim
 Number of dimensions. More...
 
Bases_container bases_1d
 Arrays containing the various basis of decomposition. More...
 

Friends

class Space
 
class Space_spheric
 
class Scalar
 
class Domain_nucleus
 
class Domain_shell
 
class Domain_shell_log
 
class Domain_compact
 
class Domain_bispheric_rect
 
class Domain_bispheric_chi_first
 
class Domain_bispheric_eta_first
 
class Domain_critic_inner
 
class Domain_critic_outer
 
class Domain_polar_nucleus
 
class Domain_polar_shell
 
class Domain_polar_shell_inner_adapted
 
class Domain_polar_shell_outer_adapted
 
class Domain_polar_compact
 
class Domain_oned_ori
 
class Domain_oned_qcq
 
class Domain_oned_inf
 
class Domain_spheric_periodic_nucleus
 
class Domain_spheric_periodic_shell
 
class Domain_spheric_periodic_compact
 
class Domain_spheric_time_nucleus
 
class Domain_spheric_time_shell
 
class Domain_spheric_time_compact
 
class Domain_shell_inner_adapted
 
class Domain_shell_outer_adapted
 
class Domain_shell_inner_homothetic
 
class Domain_shell_outer_homothetic
 
class Domain_nucleus_symphi
 
class Domain_shell_symphi
 
class Domain_compact_symphi
 
class Domain_polar_periodic_nucleus
 
class Domain_polar_periodic_shell
 
class Domain_fourD_periodic_nucleus
 
class Domain_fourD_periodic_shell
 
bool operator== (const Base_spectral &, const Base_spectral &)
 Comparison operator. More...
 
ostream & operator<< (ostream &o, const Base_spectral &)
 Display. More...
 

Detailed Description

Class for storing the basis of decompositions of a field.

It mainly consists in a list of integers, encoding the various basis.

  • CHEB : Chebyshev polynomials.
  • CHEB_EVEN : even Chebyshev polynomials.
  • CHEB_ODD : odd Chebyshev polynomials.
  • COSSIN : series of sines and cosines.
  • COS : series of cosines.
  • COS_EVEN : series of even cosines.
  • COS_ODD : series of odd cosines.
  • SIN : series of sines.
  • SIN_EVEN : series of even sines.
  • SIN_ODD : series of odd sines.
  • LEG : Legendre polynomials.
  • LEG_EVEN : even Legendre polynomials.
  • LEG_ODD : odd Legendre polynomials.
  • COSSIN_EVEN : series of sines and cosines with even harmonics only.
  • COSSIN_ODD : series of sines and cosines with odd harmonics only.

Definition at line 69 of file base_spectral.hpp.

Member Typedef Documentation

◆ Bases_container

using Kadath::Base_spectral::Bases_container = Memory_mapped_array<Array<int>*,int>

Sylvain'stuff.

Definition at line 72 of file base_spectral.hpp.

Constructor & Destructor Documentation

◆ Base_spectral() [1/4]

Kadath::Base_spectral::Base_spectral ( int  dimensions)
inlineexplicit

Standard constructor, the Base_spectral is not defined.

Parameters
dimensions[input] : number of dimensions.

Definition at line 89 of file base_spectral.hpp.

References bases_1d, and ndim.

◆ Base_spectral() [2/4]

Kadath::Base_spectral::Base_spectral ( const Base_spectral so)
inline

Copy constructor.

Definition at line 224 of file base_spectral.hpp.

References bases_1d, and ndim.

◆ Base_spectral() [3/4]

Kadath::Base_spectral::Base_spectral ( FILE *  fd)

Constructor from a file.

Definition at line 36 of file base_spectral.cpp.

References bases_1d, def, and ndim.

◆ Base_spectral() [4/4]

Kadath::Base_spectral::Base_spectral ( Base_spectral &&  so)
inline

Move constructor.

Definition at line 229 of file base_spectral.hpp.

References bases_1d, and ndim.

◆ ~Base_spectral()

Kadath::Base_spectral::~Base_spectral ( )
inline

Destructor.

Definition at line 99 of file base_spectral.hpp.

References bases_1d, and ndim.

Member Function Documentation

◆ allocate()

void Kadath::Base_spectral::allocate ( const Dim_array nbr_coefs)

Allocates the various arrays, for a given number of coefficients.

Parameters
nbr_coefs[input] : a Dim_array storing the number of coefficients in each dimenions.

Definition at line 82 of file base_spectral.cpp.

References bases_1d, and ndim.

◆ coef()

Array< double > Kadath::Base_spectral::coef ( const Dim_array nbr_coefs,
const Array< double > &  so 
) const
Computes the coefficients for all the variables.
Parameters
nbr_coefs[input] : number of coefficients.
so[input] : values of the field in the configuration space.
Returns
the coefficients of the field.

Definition at line 96 of file coef.cpp.

References coef_dim(), and ndim.

◆ coef_dim()

void Kadath::Base_spectral::coef_dim ( int  var,
int  nbr,
Array< double > *&  tab 
) const
performs the coefficient transformation for one particular variable.
Parameters
var[input] : the variable for which the coefficients are to be computed.
nbr[input] : number of coefficients for var.
tab[input/output] : values of the field, before and after the computation of the coefficients.

Definition at line 28 of file coef.cpp.

References bases_1d, Kadath::Array< T >::get_dimensions(), Kadath::Array< T >::get_size(), Kadath::Array_iterator::inc(), Kadath::Array_iterator::inc1(), ndim, Kadath::Array_iterator::set(), Kadath::Array< T >::set(), and Kadath::Dim_array::set().

◆ coef_i()

Array< double > Kadath::Base_spectral::coef_i ( const Dim_array nbr_points,
const Array< double > &  so 
) const
Computes the values in the configuration space.
Parameters
nbr_points[input] : number of points.
so[input] : values of the field in the coefficients space.
Returns
the coefficients of the field.

Definition at line 96 of file coef_i.cpp.

References coef_i_dim(), and ndim.

◆ coef_i_dim()

void Kadath::Base_spectral::coef_i_dim ( int  var,
int  nbr,
Array< double > *&  tab 
) const

Performs the inverse coefficient transformation for one particular variable.

Parameters
var[input] : the variable for which the coefficients are to be computed.
nbr[input] : number of points in the configuration space for var.
tab[input/output] : values of the field, before and after the computation of the coefficients.

Definition at line 28 of file coef_i.cpp.

References bases_1d, Kadath::Array< T >::get_dimensions(), Kadath::Array< T >::get_size(), Kadath::Array_iterator::inc(), Kadath::Array_iterator::inc1(), ndim, Kadath::Array_iterator::set(), Kadath::Array< T >::set(), and Kadath::Dim_array::set().

◆ get_base_1d()

const Array<int>* Kadath::Base_spectral::get_base_1d ( int  i) const
inline

Returns one of the 1d base array.

Definition at line 119 of file base_spectral.hpp.

References bases_1d.

◆ is_def()

bool Kadath::Base_spectral::is_def ( ) const
inline
Returns
: true if the basis is defined, false otherwise.

Definition at line 109 of file base_spectral.hpp.

References def.

◆ ope_1d()

Array< double > Kadath::Base_spectral::ope_1d ( int(*)(int, Array< double > &)  function,
int  var,
const Array< double > &  so,
Base_spectral base 
) const

One-dimensional operator acting in the coefficient space.

Parameters
function[input] : function pointing to the particular operation to be performed (i.e. like mult_sin_x_1d )
var[input] : variable on which the operatio is to be performed.
so[input] : coefficients of the field before the operation.
base[input/output] : basis of the field. After the operation, the basis associated with var may is changed but not the others basis which should be changed by hand, if needed.
Returns
the coefficients of the result.

Definition at line 26 of file ope_1d.cpp.

References bases_1d, Kadath::Array< T >::get_dimensions(), Kadath::Array< T >::get_size(), Kadath::Array_iterator::inc(), Kadath::Array_iterator::inc1(), ndim, Kadath::Array_iterator::set(), and Kadath::Array< T >::set().

◆ operator=() [1/2]

Base_spectral & Kadath::Base_spectral::operator= ( Base_spectral &&  so)
inline

Move assignment operator.

Definition at line 235 of file base_spectral.hpp.

References bases_1d, def, and ndim.

◆ operator=() [2/2]

Base_spectral & Kadath::Base_spectral::operator= ( const Base_spectral so)
inline

Assignement operator.

Definition at line 251 of file base_spectral.hpp.

References bases_1d, def, and ndim.

◆ save()

void Kadath::Base_spectral::save ( FILE *  fd) const

Saving function.

Definition at line 71 of file base_spectral.cpp.

References bases_1d, def, and ndim.

◆ set()

void Kadath::Base_spectral::set ( Dim_array const &  nbr_coefs,
int  basephi,
int  basetheta,
int  baser 
)

Allocates the various arrays, for a given number of coefficients and sets basis to some values (same for all harmonics).

It assumes one is working in 3D.

Parameters
nbr_coefs[input] : a Dim_array storing the number of coefficients in each dimenions.
basephi: basis for $\varphi$
basetheta: basis for $\varphi$
baser: basis for $\varphi$

Definition at line 109 of file base_spectral.cpp.

References allocate(), bases_1d, def, Kadath::Dim_array::get_ndim(), and Kadath::Index::set().

◆ set_non_def()

void Kadath::Base_spectral::set_non_def ( )
inline

Sets all the basis to the undefined state.

Definition at line 242 of file base_spectral.hpp.

References bases_1d, def, and ndim.

◆ summation()

double Kadath::Base_spectral::summation ( const Point num,
const Array< double > &  tab 
) const

Computes the spectral summation.

Parameters
num[input] : numerical coordinates used in the summation.
tab[input] : spectral coefficients of the field.
Returns
the summation.

Definition at line 272 of file summation_1d.cpp.

References bases_1d, Kadath::Array< T >::get_dimensions(), Kadath::Array< T >::get_ndim(), Kadath::Array< T >::get_size(), Kadath::Index::inc(), ndim, Kadath::Array< T >::set(), Kadath::Dim_array::set(), and Kadath::Index::set().

◆ swap()

void Kadath::Base_spectral::swap ( Base_spectral so)
inline

Swaps data between the source and this.

Definition at line 264 of file base_spectral.hpp.

References bases_1d, def, and ndim.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  o,
const Base_spectral so 
)
friend

Display.

Definition at line 96 of file base_spectral.cpp.

◆ operator==

bool operator== ( const Base_spectral a,
const Base_spectral b 
)
friend

Comparison operator.

Definition at line 270 of file base_spectral.hpp.

Member Data Documentation

◆ bases_1d

Bases_container Kadath::Base_spectral::bases_1d
protected

Arrays containing the various basis of decomposition.

The size of each array depends on the order of the various numerical coordinates.

Definition at line 82 of file base_spectral.hpp.

◆ def

bool Kadath::Base_spectral::def
protected

true if the Base_spectral is defined and false otherwise.

Definition at line 75 of file base_spectral.hpp.

◆ ndim

int Kadath::Base_spectral::ndim
protected

Number of dimensions.

Definition at line 76 of file base_spectral.hpp.


The documentation for this class was generated from the following files: