CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::data::ScalarField3D Class Reference

The class ScalarField3D. More...

#include "Headers/Field3D.h"

Inheritance diagram for cbl::data::ScalarField3D:
Collaboration diagram for cbl::data::ScalarField3D:

Public Member Functions

Constructors/destructors
 ScalarField3D ()=default
 default constructor
 
 ScalarField3D (const double deltaR, const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 constructor More...
 
 ScalarField3D (const int nx, const int ny, const int nz, const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 constructor More...
 
virtual ~ScalarField3D ()=default
 default destructor
 
Member functions to set the private/protected members
void set_ScalarField (const double value, const int i, const int j, const int k, const bool add=0)
 set the value of the scalar field More...
 
void set_ScalarField_FourierSpace_real (const double value, const int i, const int j, const int k, const bool add=0)
 set the value of the scalar field in Fourier space, real part More...
 
void set_ScalarField_FourierSpace_complex (const double value, const int i, const int j, const int k, const bool add=0)
 set the value of the scalar field in Fourier space, real part More...
 
Member functions to get the private/protected members
double ScalarField (const int i, const int j, const int k) const
 get the value of the scalar field More...
 
double ScalarField (const std::vector< double > pos) const
 get the value of the scalar field More...
 
std::vector< double > ScalarField () const
 get the values of the scalar field More...
 
double ScalarField_FourierSpace_real (const int i, const int j, const int k) const
 get the value of the scalar field, Fourier space, real part More...
 
double ScalarField_FourierSpace_complex (const int i, const int j, const int k) const
 get the value of the scalar field, Fourier space, complex part More...
 
Member functions to compute operations on the field
void FourierTransformField ()
 perform the Fourier transform on the field
 
void FourierAntiTransformField ()
 perform the anti-Fourier transform on the field
 
void GaussianConvolutionField (const double kernel_size)
 perform a smoothing of the field with a gaussian kernel More...
 
void reset ()
 set to 0 the fields
 
- Public Member Functions inherited from cbl::data::Field3D
 Field3D ()=default
 default constructor
 
 Field3D (const double deltaR, const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 constructor More...
 
 Field3D (const int nx, const int ny, const int nz, const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 constructor More...
 
virtual ~Field3D ()=default
 default destructor
 
void set_parameters (const double deltaR, const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 set the parameters More...
 
void set_parameters (const int nx, const int ny, const int nz, const double minX, const double maxX, const double minY, const double maxY, const double minZ, const double maxZ)
 set the parameters More...
 
int nx () const
 get the private member m_nX More...
 
int ny () const
 get the private member m_nY More...
 
int nz () const
 get the private member m_nZ More...
 
int nzFourier () const
 get the private member m_nZF More...
 
int nCells () const
 get the private member m_nCells More...
 
int nCellsFourier () const
 get the private member m_nCells_Fourier More...
 
double MinX () const
 get the private member m_MinX More...
 
double MinY () const
 get the private member m_MinY More...
 
double MinZ () const
 get the private member m_MinZ More...
 
double MaxX () const
 get the private member m_MaxX More...
 
double MaxY () const
 get the private member m_MaxY More...
 
double MaxZ () const
 get the private member m_MaxZ More...
 
double deltaX () const
 get the private member m_deltaX More...
 
double deltaY () const
 get the private member m_deltaY More...
 
double deltaZ () const
 get the private member m_deltaZ More...
 
double Volume () const
 get the private member m_Volume More...
 
double XX (const int i) const
 get the value of the X coordinates at the i-th cell More...
 
double YY (const int i) const
 get the value of the Y coordinates at the i-th cell More...
 
double ZZ (const int i) const
 get the value of the Z coordinates at the i-th cell More...
 
double kX (const int i) const
 get the value of the X coordinates at the i-th cell, Fourier space More...
 
double kY (const int i) const
 get the value of the Y coordinates at the i-th cell, Fourier space More...
 
double kZ (const int i) const
 get the value of the Z coordinates at the i-th cell, Fourier space More...
 
virtual std::vector< double > VectorField (const int i, const int j, const int k) const
 get the value of the vector field More...
 
virtual std::vector< double > VectorField (const std::vector< double > pos) const
 get the value of the vector field More...
 
virtual std::vector< double > ScalarField_FourierSpace_real () const
 get the value of the scalar field, Fourier space, real part More...
 
virtual std::vector< double > ScalarField_FourierSpace_complex () const
 get the value of the scalar field, Fourier space, complex part More...
 
virtual std::vector< double > VectorField_FourierSpace_real (const int i, const int j, const int k) const
 get the value of the vector field, Fourier space, real part More...
 
virtual std::vector< double > VectorField_FourierSpace_complex (const int i, const int j, const int k) const
 get the value of the vector field, Fourier space, complex part More...
 
virtual void set_VectorField (const std::vector< double > value, const int i, const int j, const int k, const bool add=0)
 set the value of the vectorr field More...
 
virtual void set_VectorField_FourierSpace_real (const std::vector< double > value, const int i, const int j, const int k, const bool add=0)
 set the value of the vector field, Fourier space, real part More...
 
virtual void set_VectorField_FourierSpace_complex (const std::vector< double > value, const int i, const int j, const int k, const bool add=0)
 set the value of the vector field, Fourier space, complex part More...
 

Protected Attributes

double * m_field
 scalar field
 
fftw_complex * m_field_FourierSpace
 fourier transform of the scalar field
 
- Protected Attributes inherited from cbl::data::Field3D
int m_nX
 number of cells along the x-axis
 
int m_nY
 number of cells along the y-axis
 
int m_nZ
 number of cells along the z-axis
 
int m_nZF
 number of cells along the z-axis, Fourier space
 
int m_nCells
 number of cells
 
int m_nCells_Fourier
 number of cells, Fourier space
 
double m_deltaX
 X cell size.
 
double m_deltaY
 Y cell size.
 
double m_deltaZ
 Z cell size.
 
double m_MinX
 lower x bound
 
double m_MinY
 lower y bound
 
double m_MinZ
 lower z bound
 
double m_MaxX
 upper x bound
 
double m_MaxY
 upper y bound
 
double m_MaxZ
 upper z bound
 
double m_Volume
 box volume
 
std::vector< double > m_X
 coordinates of the cells along the x-axis
 
std::vector< double > m_Y
 coordinates of the cells along the y-axis
 
std::vector< double > m_Z
 coordinates of the cells along the z-axis
 
std::vector< double > m_kX
 coordinates of the cells along the kx-axis
 
std::vector< double > m_kY
 coordinates of the cells along the ky-axis
 
std::vector< double > m_kZ
 coordinates of the cells along the kz-axis
 

Additional Inherited Members

- Protected Member Functions inherited from cbl::data::Field3D
long int inds_to_index (const int i, const int j, const int k) const
 contract 3 indeces into one More...
 
long int inds_to_index_Fourier (const int i, const int j, const int k) const
 contract 3 indeces into one, Fourier space More...
 

Detailed Description

The class ScalarField3D.

This class is used to handle objects of type ScalarField3D

Definition at line 648 of file Field3D.h.

Constructor & Destructor Documentation

◆ ScalarField3D() [1/2]

cbl::data::ScalarField3D::ScalarField3D ( const double  deltaR,
const double  minX,
const double  maxX,
const double  minY,
const double  maxY,
const double  minZ,
const double  maxZ 
)

constructor

Parameters
deltaRsize of the cubic cells
minXlower x bound
maxXupper x bound
minYlower y bound
maxYupper y bound
minZlower z bound
maxZupper z bound

Definition at line 180 of file Field3D.cpp.

◆ ScalarField3D() [2/2]

cbl::data::ScalarField3D::ScalarField3D ( const int  nx,
const int  ny,
const int  nz,
const double  minX,
const double  maxX,
const double  minY,
const double  maxY,
const double  minZ,
const double  maxZ 
)

constructor

Parameters
nxnumber of x-axis cells
nynumber of y-axis cells
nznumber of z-axis cells
minXlower x bound
maxXupper x bound
minYlower y bound
maxYupper y bound
minZlower z bound
maxZupper z bound

Definition at line 198 of file Field3D.cpp.

Member Function Documentation

◆ GaussianConvolutionField()

void cbl::data::ScalarField3D::GaussianConvolutionField ( const double  kernel_size)
virtual

perform a smoothing of the field with a gaussian kernel

Parameters
kernel_sizesize of the gaussian kernel

Reimplemented from cbl::data::Field3D.

Definition at line 257 of file Field3D.cpp.

◆ ScalarField() [1/3]

vector< double > cbl::data::ScalarField3D::ScalarField ( ) const
virtual

get the values of the scalar field

Returns
the values of the scalar field

Reimplemented from cbl::data::Field3D.

Definition at line 356 of file Field3D.cpp.

◆ ScalarField() [2/3]

double cbl::data::ScalarField3D::ScalarField ( const int  i,
const int  j,
const int  k 
) const
virtual

get the value of the scalar field

Parameters
ithe i-th cell along the x-axis
jthe j-th cell along the y-axis
kthe k-th cell along the z-axis
Returns
the value of the vector field

Reimplemented from cbl::data::Field3D.

Definition at line 316 of file Field3D.cpp.

◆ ScalarField() [3/3]

double cbl::data::ScalarField3D::ScalarField ( const std::vector< double >  pos) const
virtual

get the value of the scalar field

Parameters
posvector containing the point coordinates
Returns
the value of the vector field

Reimplemented from cbl::data::Field3D.

Definition at line 343 of file Field3D.cpp.

◆ ScalarField_FourierSpace_complex()

double cbl::data::ScalarField3D::ScalarField_FourierSpace_complex ( const int  i,
const int  j,
const int  k 
) const
virtual

get the value of the scalar field, Fourier space, complex part

Parameters
ithe i-th cell along the x-axis
jthe j-th cell along the y-axis
kthe k-th cell along the z-axis
Returns
the value of the vector field, Fourier space, complex part

Reimplemented from cbl::data::Field3D.

Definition at line 334 of file Field3D.cpp.

◆ ScalarField_FourierSpace_real()

double cbl::data::ScalarField3D::ScalarField_FourierSpace_real ( const int  i,
const int  j,
const int  k 
) const
virtual

get the value of the scalar field, Fourier space, real part

Parameters
ithe i-th cell along the x-axis
jthe j-th cell along the y-axis
kthe k-th cell along the z-axis
Returns
the value of the vector field, Fourier space, real part

Reimplemented from cbl::data::Field3D.

Definition at line 325 of file Field3D.cpp.

◆ set_ScalarField()

void cbl::data::ScalarField3D::set_ScalarField ( const double  value,
const int  i,
const int  j,
const int  k,
const bool  add = 0 
)
virtual

set the value of the scalar field

Parameters
valuevalue of the scalar field
ithe i-th cell along the x-axis
jthe j-th cell along the y-axis
kthe k-th cell along the z-axis
add1 → add to the current value; 0 → overwrite the value

Reimplemented from cbl::data::Field3D.

Definition at line 289 of file Field3D.cpp.

◆ set_ScalarField_FourierSpace_complex()

void cbl::data::ScalarField3D::set_ScalarField_FourierSpace_complex ( const double  value,
const int  i,
const int  j,
const int  k,
const bool  add = 0 
)
virtual

set the value of the scalar field in Fourier space, real part

Parameters
valuevalue of the scalar field in Fourier space, real part
ithe i-th cell along the x-axis
jthe j-th cell along the y-axis
kthe k-th cell along the z-axis
add1 → add to the current value; 0 → overwrite the value

Reimplemented from cbl::data::Field3D.

Definition at line 307 of file Field3D.cpp.

◆ set_ScalarField_FourierSpace_real()

void cbl::data::ScalarField3D::set_ScalarField_FourierSpace_real ( const double  value,
const int  i,
const int  j,
const int  k,
const bool  add = 0 
)
virtual

set the value of the scalar field in Fourier space, real part

Parameters
valuevalue of the scalar field in Fourier space, real part
ithe i-th cell along the x-axis
jthe j-th cell along the y-axis
kthe k-th cell along the z-axis
add1 → add to the current value; 0 → overwrite the value

Reimplemented from cbl::data::Field3D.

Definition at line 298 of file Field3D.cpp.


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