SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Attributes
Grid Class Reference

Data structure for a grid of points and their mapping onto a scalar field. More...

#include <Grid.hh>

Public Member Functions

 Grid ()
 Default constructor, initilizes everything to 0. More...
 
 Grid (const std::vector< Vertex > &vertices)
 Vertex constructor, constructs the grid from a vertex vector. More...
 
 Grid (const Matrix< double > &mat, const std::vector< double > &vec)
 Matrix constructor, sets matrix of vertices and their mapping on a grid. More...
 
 Grid (double(*fcn)(const std::vector< double > &val), const std::vector< size_t > &number, const std::vector< double > &lower, const std::vector< double > &upper)
 Function constructor, constructs the grid from a function. More...
 
 Grid (const std::vector< size_t > &number, const std::vector< double > &lower, const std::vector< double > &upper, const std::string algo="flat")
 Random constructor, constructs an N_1*...*N_n random grid between lower and upper. More...
 
 Grid (const Grid &grid)
 Copy constructor. More...
 
Grid & operator= (const Grid &grid)
 Equality operator. More...
 
bool operator! () const
 Not operator. More...
 
Vertex & operator[] (const size_t id)
 Returns the vertex. More...
 
const Vertex & operator[] (const size_t id) const
 Returns the vertex. More...
 
Vertex & operator[] (const std::vector< size_t > indices)
 Subscript operator. More...
 
const Vertex & operator[] (const std::vector< size_t > indices) const
 Subscript operator. More...
 
 ~Grid ()
 Destructor. More...
 
const size_t size () const
 Returns the dimension of the vector field in which the vertex is defined. More...
 
void Initialize ()
 Initializes the grid. More...
 
void InitializeFromMatrix (const Matrix< double > &mat, const std::vector< double > &vec)
 Initializes the grid, provided a matrix of vertices and their mapping. More...
 
void InitializeFromFunction (double(*fcn)(const std::vector< double > &val))
 Initializes the grid, provided a scalar function defined within boundaries. More...
 
void InitializeRandom (const std::string &algo)
 Initializes the grid to random values of scalar field. More...
 
Grid GetBestCell (const std::vector< double > &v) const
 Find the closest cell of the grid to a given point of coordinates v. More...
 
std::vector< size_t > GetLowerIndices (const std::vector< double > &v) const
 Find the IDs of the points on the grid that directly preceed v. More...
 
Grid GetCell (const std::vector< size_t > &indices) const
 Returns a cell of the grid given the lower bound indicies. More...
 
std::vector< Grid > GetCellArray () const
 Returns all the cells of the grid in an array. More...
 
double GetCellVolume () const
 Returns the volume of one of the cell of the grid. More...
 
const size_t & GetDimension () const
 Returns the dimension of the space in which the grid is constructed. More...
 
const std::vector< size_t > & GetNpointsArray () const
 Returns the array of number of points in each dimension. More...
 
const size_t & GetNpoints (const size_t i) const
 Returns the number of points in dimension i. More...
 
const std::vector< size_t > & GetStepArray () const
 Returns the array of step sizes in each dimension. More...
 
const size_t & GetStep (const size_t i) const
 Returns the step size in dimension i. More...
 
const std::vector< double > & GetPeriodArray () const
 Returns the array of period size in each dimension. More...
 
const double & GetPeriod (const size_t i) const
 Returns the period size in dimension i. More...
 
const std::vector< double > & GetLowerBoundArray () const
 Returns the array of lower bounds in each dimension. More...
 
const double & GetLowerBound (const size_t i) const
 Returns the lower bound in dimension i. More...
 
const std::vector< double > & GetUpperBoundArray () const
 Returns the array of upper bounds in each dimension. More...
 
const double & GetUpperBound (const size_t i) const
 Returns the upper bound in dimension i. More...
 
void SetVertex (const std::vector< size_t > &indices, const Vertex &vertex)
 Sets the coordinates of the vertex. More...
 
const std::vector< Vertex > & GetVertexArray () const
 Returns the array of all the vertices. More...
 
std::vector< Vertex > & GetVertexArray ()
 Returns the array of all the vertices, allows modifications. More...
 
const std::vector< double > & GetPositionArray (const size_t id) const
 Returns the position of a point of index id. More...
 
double GetPosition (const size_t i, const size_t id) const
 Returns the position in dimension i for a point index id in this dimension. More...
 
std::vector< double > GetPosition (const std::vector< size_t > &vi, const std::vector< size_t > &ids) const
 Returns the position in dimensions vi for a point index ids in these dimension. More...
 
double GetVolume () const
 Returns the volume occupied by the grid. More...
 
size_t ID (const std::vector< size_t > &indices) const
 Returns the id of the element within the vertex matrix. More...
 
std::vector< size_t > Indices (size_t id) const
 Returns the indices of the element within the vertex matrix. More...
 
bool IsInside (const std::vector< double > &v) const
 Returns the indices of the element within the vertex matrix. More...
 
std::vector< TPolyLine * > Polygons () const
 Returns an array of polygons to be drawn in ROOT (only 2D) More...
 

Private Attributes

size_t _dim
 Dimension of the space. More...
 
std::vector< Vertex > _vertices
 N_1*...*N_n-vector of vertices (Vertex object) More...
 
std::vector< size_t > _number
 n-vector, number of steps on each axis More...
 
std::vector< size_t > _step
 n-vector, stepping of each axis More...
 
std::vector< double > _period
 n-vector, length of a period of each axis More...
 
std::vector< double > _lower
 n-vector, lower bounds of the grid More...
 
std::vector< double > _upper
 n-vector, upper bounds of the grid More...
 

Detailed Description

Data structure for a grid of points and their mapping onto a scalar field.

Constructor & Destructor Documentation

Grid::Grid ( )

Default constructor, initilizes everything to 0.

Grid::Grid ( const std::vector< Vertex > &  vertices)

Vertex constructor, constructs the grid from a vertex vector.

Parameters
verticesArray of vertices and their mapping
Grid::Grid ( const Matrix< double > &  mat,
const std::vector< double > &  vec 
)

Matrix constructor, sets matrix of vertices and their mapping on a grid.

Parameters
matnxN-matrix of vertices, n = dimension, N = number of vertices
vecN-vector of the mapping, one per vertex, same ordering
Grid::Grid ( double(*)(const std::vector< double > &val)  fcn,
const std::vector< size_t > &  number,
const std::vector< double > &  lower,
const std::vector< double > &  upper 
)

Function constructor, constructs the grid from a function.

Parameters
fcnFunction of vector field that returns a scalar field
numberNumber of steps between min and max values
lowerLower bounds of the grid in each dimension
upperUpper bounds of the grid in each dimension
Grid::Grid ( const std::vector< size_t > &  number,
const std::vector< double > &  lower,
const std::vector< double > &  upper,
const std::string  algo = "flat" 
)

Random constructor, constructs an N_1*...*N_n random grid between lower and upper.

Parameters
numberNumber of steps between min and max values
lowerLower bounds of the grid in each dimension
upperUpper bounds of the grid in each dimension
algoAlogrithm for random number generation
Grid::Grid ( const Grid &  grid)

Copy constructor.

Grid::~Grid ( )

Destructor.

Member Function Documentation

Grid Grid::GetBestCell ( const std::vector< double > &  v) const

Find the closest cell of the grid to a given point of coordinates v.

Parameters
vVector of coordinates of the n-point
Returns
Cell of surrounding vertices
Grid Grid::GetCell ( const std::vector< size_t > &  indices) const

Returns a cell of the grid given the lower bound indicies.

std::vector< Grid > Grid::GetCellArray ( ) const

Returns all the cells of the grid in an array.

double Grid::GetCellVolume ( ) const

Returns the volume of one of the cell of the grid.

const size_t& Grid::GetDimension ( ) const
inline

Returns the dimension of the space in which the grid is constructed.

const double& Grid::GetLowerBound ( const size_t  i) const
inline

Returns the lower bound in dimension i.

const std::vector<double>& Grid::GetLowerBoundArray ( ) const
inline

Returns the array of lower bounds in each dimension.

std::vector< size_t > Grid::GetLowerIndices ( const std::vector< double > &  v) const

Find the IDs of the points on the grid that directly preceed v.

const size_t& Grid::GetNpoints ( const size_t  i) const
inline

Returns the number of points in dimension i.

const std::vector<size_t>& Grid::GetNpointsArray ( ) const
inline

Returns the array of number of points in each dimension.

const double& Grid::GetPeriod ( const size_t  i) const
inline

Returns the period size in dimension i.

const std::vector<double>& Grid::GetPeriodArray ( ) const
inline

Returns the array of period size in each dimension.

double Grid::GetPosition ( const size_t  i,
const size_t  id 
) const

Returns the position in dimension i for a point index id in this dimension.

std::vector< double > Grid::GetPosition ( const std::vector< size_t > &  vi,
const std::vector< size_t > &  ids 
) const

Returns the position in dimensions vi for a point index ids in these dimension.

const std::vector<double>& Grid::GetPositionArray ( const size_t  id) const
inline

Returns the position of a point of index id.

const size_t& Grid::GetStep ( const size_t  i) const
inline

Returns the step size in dimension i.

const std::vector<size_t>& Grid::GetStepArray ( ) const
inline

Returns the array of step sizes in each dimension.

const double& Grid::GetUpperBound ( const size_t  i) const
inline

Returns the upper bound in dimension i.

const std::vector<double>& Grid::GetUpperBoundArray ( ) const
inline

Returns the array of upper bounds in each dimension.

const std::vector<Vertex>& Grid::GetVertexArray ( ) const
inline

Returns the array of all the vertices.

std::vector<Vertex>& Grid::GetVertexArray ( )
inline

Returns the array of all the vertices, allows modifications.

double Grid::GetVolume ( ) const

Returns the volume occupied by the grid.

size_t Grid::ID ( const std::vector< size_t > &  indices) const

Returns the id of the element within the vertex matrix.

std::vector< size_t > Grid::Indices ( size_t  id) const

Returns the indices of the element within the vertex matrix.

void Grid::Initialize ( )

Initializes the grid.

void Grid::InitializeFromFunction ( double(*)(const std::vector< double > &val)  fcn)

Initializes the grid, provided a scalar function defined within boundaries.

Parameters
fcnFunction of vector field that returns a scalar field
void Grid::InitializeFromMatrix ( const Matrix< double > &  mat,
const std::vector< double > &  vec 
)

Initializes the grid, provided a matrix of vertices and their mapping.

Parameters
matnxN-matrix of vertices, n = dimension, N = number of vertices
vecN-vector of the mapping, one per vertex, same ordering
void Grid::InitializeRandom ( const std::string &  algo)

Initializes the grid to random values of scalar field.

Parameters
algoAlogrithm for random number generation
bool Grid::IsInside ( const std::vector< double > &  v) const

Returns the indices of the element within the vertex matrix.

bool Grid::operator! ( ) const
inline

Not operator.

Grid & Grid::operator= ( const Grid &  grid)

Equality operator.

Vertex& Grid::operator[] ( const size_t  id)
inline

Returns the vertex.

const Vertex& Grid::operator[] ( const size_t  id) const
inline

Returns the vertex.

Vertex& Grid::operator[] ( const std::vector< size_t >  indices)
inline

Subscript operator.

const Vertex& Grid::operator[] ( const std::vector< size_t >  indices) const
inline

Subscript operator.

std::vector< TPolyLine * > Grid::Polygons ( ) const

Returns an array of polygons to be drawn in ROOT (only 2D)

void Grid::SetVertex ( const std::vector< size_t > &  indices,
const Vertex &  vertex 
)
inline

Sets the coordinates of the vertex.

const size_t Grid::size ( ) const
inline

Returns the dimension of the vector field in which the vertex is defined.

Field Documentation

size_t Grid::_dim
private

Dimension of the space.

std::vector<double> Grid::_lower
private

n-vector, lower bounds of the grid

std::vector<size_t> Grid::_number
private

n-vector, number of steps on each axis

std::vector<double> Grid::_period
private

n-vector, length of a period of each axis

std::vector<size_t> Grid::_step
private

n-vector, stepping of each axis

std::vector<double> Grid::_upper
private

n-vector, upper bounds of the grid

std::vector<Vertex> Grid::_vertices
private

N_1*...*N_n-vector of vertices (Vertex object)


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