![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
#include "Headers/ChainMesh.h"
Public Member Functions | |
ChainMesh ()=default | |
default constructor | |
ChainMesh (const double cell_size, const long nDim) | |
constructor More... | |
~ChainMesh ()=default | |
default destructor | |
void | set_par (const double cell_size, const long nDim) |
function that set parameters for the chain-mesh More... | |
long | nCell () const |
get the private member ChainMesh::m_nCell_tot More... | |
long | nCell_NonEmpty () const |
get the private member ChainMesh::m_nCell_NonEmpty More... | |
std::vector< long > | NonEmpty_Cells () const |
get the private member ChainMesh::m_NonEmpty_Cells More... | |
long | pos_to_index (const std::vector< double > center) const |
get the index of the cell given the object coordinates More... | |
long | inds_to_index (const std::vector< long > indx) const |
get the unique index of the cell given the n indices More... | |
void | index_to_inds (const long index, const std::vector< long > nn, std::vector< long > &indx) const |
get the n indices given the unique index More... | |
void | create_chain_mesh (const std::vector< std::vector< double > > data, const double rMax, const double rMin=-1., const long nMAX=300, const long nMIN=10) |
create the chain mesh More... | |
void | create_chain_mesh_m2 (const std::vector< std::vector< double > > data) |
create the chain mesh More... | |
void | get_searching_region (const double r_max, const double r_min=-1.) |
set the internal variable m_search_region, the list of cell around a generic center More... | |
std::vector< long > | close_objects_cell (const int cell_index, long ii=-1) const |
get the indeces of the objects close to a cell More... | |
std::vector< long > | close_objects (std::vector< double > center, long ii=-1) const |
get the indeces of the objects close to an object More... | |
void | normalize (std::vector< std::vector< double >> points, std::vector< double > values, const double rMAX) |
function to set a normalized (square/cubic) grid from a sample of points, used for the N-dim interpolation More... | |
double | interpolate (std::vector< double > xi, const int distNum) |
N-dim interpolation of a set of N coordinates on a normalised grid (see normalize) More... | |
std::vector< double > | interpolate (std::vector< std::vector< double >> points, std::vector< double > values, std::vector< std::vector< double >> xi, const int distNum, const double rMAX) |
N-dim interpolation. More... | |
std::vector< long > | get_list (const long cell_index) const |
get the index of the object inside a cell More... | |
Protected Attributes | |
int | m_nDim |
the number of dimension | |
std::vector< long > | m_cell_to_index |
indexes in the i-th cell | |
double | m_cell_size |
the size of the cell in unit of the interested quantity | |
std::vector< long > | m_List |
list of internal use | |
std::vector< long > | m_Label |
array containing the last particle of the chain-mesh in each cell | |
std::vector< std::vector< long > > | m_List_index |
index list of internal use | |
std::vector< std::vector< double > > | m_Lim |
Min,Max limits of variable(s) used for the chain-mesh. | |
std::vector< double > | m_Delta |
Max-Min of variable(s) used for the chain-mesh. | |
std::vector< long > | m_nCell |
number of cell(s) for variable(s) | |
std::vector< long > | m_search_region |
the list of cell around a generic center | |
long | m_nCell_tot |
the total number of cells | |
long | m_nCell_NonEmpty |
the number of non-empty cells | |
std::vector< long > | m_NonEmpty_Cells |
the total number of non-empty cells | |
std::vector< long > | m_multCell |
multiplicative factor to compute the projected number of cells | |
std::vector< std::vector< double > > | m_points |
the vector containing the sample points for the n-dim interpolation | |
std::vector< double > | m_values |
the vector containing the values of the n-dim function on the sample points | |
std::vector< std::vector< double > > | m_extremals |
the vector containing the extremals of the sample points coordinates | |
std::vector< double > | m_delta |
vetors of differences between the extremals of the sample points coordinates | |
double | m_rMAX |
the maximum radius for the search of close points in the chain mesh | |
double | m_rMIN |
the minimum radius for the search of close points in the chain mesh | |
The class ChainMesh.
This class is used to handle objects of type ChainMesh
Definition at line 60 of file ChainMesh.h.
cbl::chainmesh::ChainMesh::ChainMesh | ( | const double | cell_size, |
const long | nDim | ||
) |
constructor
cell_size | double storing the cell size |
nDim | the number of dimensions |
Definition at line 64 of file ChainMesh.cpp.
vector< long > cbl::chainmesh::ChainMesh::close_objects | ( | std::vector< double > | center, |
long | ii = -1 |
||
) | const |
get the indeces of the objects close to an object
center | coordinates of an object |
ii | the minimum index given in output |
Definition at line 298 of file ChainMesh.cpp.
vector< long > cbl::chainmesh::ChainMesh::close_objects_cell | ( | const int | cell_index, |
long | ii = -1 |
||
) | const |
get the indeces of the objects close to a cell
cell_index | the cell index |
ii | the minimum index given in output |
Definition at line 271 of file ChainMesh.cpp.
void cbl::chainmesh::ChainMesh::create_chain_mesh | ( | const std::vector< std::vector< double > > | data, |
const double | rMax, | ||
const double | rMin = -1. , |
||
const long | nMAX = 300 , |
||
const long | nMIN = 10 |
||
) |
create the chain mesh
data | the vector containing the coordinate of the object |
rMax | the maximum radius, to set the interal variable m_search_region |
rMin | the minimum radius, to set the interal variable m_search_region |
nMAX | maximum number of cells |
nMIN | minimum number of cells |
Definition at line 133 of file ChainMesh.cpp.
void cbl::chainmesh::ChainMesh::create_chain_mesh_m2 | ( | const std::vector< std::vector< double > > | data | ) |
create the chain mesh
data | the vector containing the coordinate of the object |
Definition at line 196 of file ChainMesh.cpp.
vector< long > cbl::chainmesh::ChainMesh::get_list | ( | const long | cell_index | ) | const |
get the index of the object inside a cell
cell_index | the cell index |
Definition at line 526 of file ChainMesh.cpp.
void cbl::chainmesh::ChainMesh::get_searching_region | ( | const double | r_max, |
const double | r_min = -1. |
||
) |
set the internal variable m_search_region, the list of cell around a generic center
r_max | the maximum radius |
r_min | the minimum radius |
Definition at line 226 of file ChainMesh.cpp.
void cbl::chainmesh::ChainMesh::index_to_inds | ( | const long | index, |
const std::vector< long > | nn, | ||
std::vector< long > & | indx | ||
) | const |
get the n indices given the unique index
index | the unique index |
nn | the number of cells along the box axis |
indx | vector of the indices of the nD space cell |
Definition at line 112 of file ChainMesh.cpp.
long cbl::chainmesh::ChainMesh::inds_to_index | ( | const std::vector< long > | indx | ) | const |
get the unique index of the cell given the n indices
indx | vector of the indices of the nD space cell |
Definition at line 95 of file ChainMesh.cpp.
double cbl::chainmesh::ChainMesh::interpolate | ( | std::vector< double > | xi, |
const int | distNum | ||
) |
N-dim interpolation of a set of N coordinates on a normalised grid (see normalize)
xi | the input coordinates that has to be interpolated |
distNum | the number of closest points on which the average will be done |
Definition at line 387 of file ChainMesh.cpp.
vector< double > cbl::chainmesh::ChainMesh::interpolate | ( | std::vector< std::vector< double >> | points, |
std::vector< double > | values, | ||
std::vector< std::vector< double >> | xi, | ||
const int | distNum, | ||
const double | rMAX | ||
) |
N-dim interpolation.
points | sample points |
values | sample values |
xi | the coordinates to be interpolated |
distNum | the number of closest points on which the average will be done |
rMAX | the maximum radius, to set the interal variable m_search_region |
Definition at line 442 of file ChainMesh.cpp.
|
inline |
get the private member ChainMesh::m_nCell_tot
Definition at line 156 of file ChainMesh.h.
|
inline |
get the private member ChainMesh::m_nCell_NonEmpty
Definition at line 162 of file ChainMesh.h.
|
inline |
get the private member ChainMesh::m_NonEmpty_Cells
Definition at line 168 of file ChainMesh.h.
void cbl::chainmesh::ChainMesh::normalize | ( | std::vector< std::vector< double >> | points, |
std::vector< double > | values, | ||
const double | rMAX | ||
) |
function to set a normalized (square/cubic) grid from a sample of points, used for the N-dim interpolation
points | sample points |
values | the data on the sample points |
rMAX | the maximum radius, to set the internal variable m_search_region |
Definition at line 349 of file ChainMesh.cpp.
long cbl::chainmesh::ChainMesh::pos_to_index | ( | const std::vector< double > | center | ) | const |
get the index of the cell given the object coordinates
center | the object coordinates |
Definition at line 73 of file ChainMesh.cpp.
void cbl::chainmesh::ChainMesh::set_par | ( | const double | cell_size, |
const long | nDim | ||
) |
function that set parameters for the chain-mesh
cell_size | double storing the cell size |
nDim | the number of dimensions |
Definition at line 45 of file ChainMesh.cpp.