Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
Mesh Class Reference

: creates a mesh of N*N*(N+2) cells More...

#include <class_mesh.hpp>

Inheritance diagram for Mesh:
Collaboration diagram for Mesh:

Public Member Functions

 Mesh (size_t n)
 
FFTW_COMPLEX_TYPEcomplex ()
 get fftw_complex pointer to data More...
 
const FFTW_COMPLEX_TYPEcomplex () const
 get const fftw_complex pointer to data More...
 
void reset_part (bool part)
 
void reset_re ()
 
void reset_im ()
 
template<typename U >
doubleoperator() (Vec_3D< U > pos)
 
template<typename U >
const doubleoperator() (Vec_3D< U > pos) const
 
- Public Member Functions inherited from Mesh_base< double >
 Mesh_base (size_t n1, size_t n2, size_t n3)
 
doublereal ()
 
const doublereal () const
 
void assign (doubleval)
 
doubleoperator[] (size_t i)
 
const doubleoperator[] (size_t i) const
 
doubleoperator() (size_t i, size_t j, size_t k)
 
const doubleoperator() (size_t i, size_t j, size_t k) const
 
doubleoperator() (size_t i, size_t j)
 
const doubleoperator() (size_t i, size_t j) const
 
doubleoperator() (Vec_3D< U > pos)
 
const doubleoperator() (Vec_3D< U > pos) const
 
Mesh_baseoperator+= (const double &rhs)
 
Mesh_baseoperator-= (const double &rhs)
 
Mesh_baseoperator*= (const double &rhs)
 
Mesh_baseoperator/= (const double &rhs)
 

Public Attributes

size_t N
 
- Public Attributes inherited from Mesh_base< double >
size_t N1
 
size_t N2
 
size_t N3
 
size_t length
 
std::vector< doubledata
 

Detailed Description

: creates a mesh of N*N*(N+2) cells

Definition at line 95 of file class_mesh.hpp.

Constructor & Destructor Documentation

Mesh::Mesh ( size_t  n)
inline

Definition at line 99 of file class_mesh.hpp.

99 : Mesh_base(n, n, n+2), N(n) {}
Mesh_base(size_t n1, size_t n2, size_t n3)
Definition: class_mesh.hpp:28
size_t N
Definition: class_mesh.hpp:102

Member Function Documentation

FFTW_COMPLEX_TYPE* Mesh::complex ( )
inline

get fftw_complex pointer to data

Returns
FFTW_COMPLEX_TYPE*

Definition at line 111 of file class_mesh.hpp.

References Mesh_base< T >::data, and FFTW_COMPLEX_TYPE.

Referenced by fftw_execute_dft_c2r(), fftw_execute_dft_r2c(), anonymous_namespace{chameleon.cpp}::ChiSolver< T >::set_linear_recursively(), and TEST_CASE().

111 { return reinterpret_cast<FFTW_COMPLEX_TYPE*>(data.data());}
std::vector< double > data
Definition: class_mesh.hpp:33
#define FFTW_COMPLEX_TYPE
Definition: precision.hpp:28
const FFTW_COMPLEX_TYPE* Mesh::complex ( ) const
inline

get const fftw_complex pointer to data

Returns
FFTW_COMPLEX_TYPE*

Definition at line 118 of file class_mesh.hpp.

References Mesh_base< T >::data, and FFTW_COMPLEX_TYPE.

118 { return reinterpret_cast<const FFTW_COMPLEX_TYPE*>(data.data());}
std::vector< double > data
Definition: class_mesh.hpp:33
#define FFTW_COMPLEX_TYPE
Definition: precision.hpp:28
template<typename U >
double& Mesh::operator() ( Vec_3D< U >  pos)
inline

Definition at line 134 of file class_mesh.hpp.

References Mesh_base< T >::data, get_per(), Mesh_base< T >::N2, and Mesh_base< T >::N3.

135  {
136  get_per(pos, N);
137  return data[size_t(pos[0])*N2*N3+size_t(pos[1])*N3+size_t(pos[2])];
138  }
std::vector< double > data
Definition: class_mesh.hpp:33
size_t N
Definition: class_mesh.hpp:102
void get_per(Vec_3D< T > &position, size_t per)
Definition: core_mesh.cpp:66
template<typename U >
const double& Mesh::operator() ( Vec_3D< U >  pos) const
inline

Definition at line 140 of file class_mesh.hpp.

References Mesh_base< T >::data, get_per(), Mesh_base< T >::N2, and Mesh_base< T >::N3.

141  {
142  get_per(pos, N);
143  return data[size_t(pos[0])*N2*N3+size_t(pos[1])*N3+size_t(pos[2])];
144  }
std::vector< double > data
Definition: class_mesh.hpp:33
size_t N
Definition: class_mesh.hpp:102
void get_per(Vec_3D< T > &position, size_t per)
Definition: core_mesh.cpp:66
void Mesh::reset_im ( )
inline

Definition at line 129 of file class_mesh.hpp.

129 { reset_part(1); }
void reset_part(bool part)
Definition: class_mesh.hpp:120
void Mesh::reset_part ( bool  part)
inline

Definition at line 120 of file class_mesh.hpp.

References Mesh_base< T >::data, and Mesh_base< T >::length.

121  {/* nullify real (part = 0) or complex (part = 1) part of a field */
122  #pragma omp parallel for
123  for (size_t i = part; i < this->length; i+=2){
124  data[i] = 0;
125  }
126  }
std::vector< double > data
Definition: class_mesh.hpp:33
void Mesh::reset_re ( )
inline

Definition at line 128 of file class_mesh.hpp.

128 { reset_part(0); }
void reset_part(bool part)
Definition: class_mesh.hpp:120

Member Data Documentation


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