MineLink
 All Data Structures Functions Variables Pages
delphos::BlockModel Class Reference

Abstracts a container of blocks as a table with arbitrary number of attributes that can be accessed by index \((0, 1,\ldots, N-1)\) (where \(N\) is total number of blocks) or coordinates \((x,y,z)\). More...

#include <blockmodel.h>

Collaboration diagram for delphos::BlockModel:
Collaboration graph

Public Member Functions

 BlockModel (const delphos::BlockIndexType &num_blocks)
 Creates a new block model with given number of blocks. More...
 
 BlockModel (const char *file_name, const vector< string > &columns=delphos::BlockModel::EMPTY_STRING_VECT)
 Creates a new block model from a text file reading optionally only selected columns. A block model file is formatted text file (table representation) with the three first columns reserved for the block spatial coordinates values \(x, y\) and \(z\), respectively, and the rest of the columns represent the "attributes" (or columns) of the blocks in the model. The first row is reserved as a header row, and all other rows represent the blocks on the model. Each row, except for the first one, must be comprised with numeric values only, if a non parseable value is found, an exception is thrown. The text file can be a tab or space separated file. More...
 
 BlockModel (const char *file_name, const double &ang)
 Creates a new block model from a text file and keep only blocks that are inside a feasible cone defined by a given angle (the angle is measured from the vertical axis). A block model file is formatted text file (table representation) with the three first columns reserved for the block spatial coordinates values \(x, y\) and \(z\), respectively, and the rest of the columns represent the "attributes" (or columns) of the blocks in the model. The first row is reserved as a header row, and all other rows represent the blocks on the model. Each row must except for the first one, must be comprised with numeric values only, if a non parseable value is found, an exception is thrown. The text file can be a tab or space separated file. More...
 
virtual ~BlockModel ()
 Destroys a block model.
 
double GetValue (const delphos::BlockIndexType &index, const string &column) const
 Retrieves the value of an attribute for a given block index and attribute name. More...
 
double GetValue (const delphos::BlockIndexType &index, const unsigned int &columnpos) const
 Retrieves the value of an attribute for a given block index and attribute name. More...
 
void SetValue (const delphos::BlockIndexType &index, const string &column, const double &value)
 Sets the value of an attribute for a given block index and attribute name. More...
 
void SetValue (const delphos::BlockIndexType &index, const unsigned int &columnpos, const double &value)
 Sets the value of an attribute for a given block index and attribute name. More...
 
void AddColumn (const string &column, const double &default_value)
 Adds a new column (of block attributes) to the model with a given default value. More...
 
void AddColumn (const string &column, const string &formula)
 Adds a new column (of blocks attributes) to the model with a given string that represent a formula. This formula references the BlockModel instance columns by their names between brackets. More...
 
bool RemoveColumn (const string &column)
 Removes a given column (of block attributes) from the model. More...
 
virtual const
delphos::BlockIndexType 
Size () const
 Returns the number of blocks in the BlockModel instance. More...
 
virtual const
delphos::BlockIndexType 
GetSize () const
 Returns the number of blocks in the BlockModel. More...
 
const unsigned int NumColumns () const
 Returns the number of columns (block attributes) in the model. More...
 
const unsigned int GetNumColumns () const
 Returns the number of columns (block attributes) in the model. More...
 
string ColumnName (const unsigned int &column_index) const
 Returns the name of the column with the given index. More...
 
string GetColumnName (const unsigned int &column_index) const
 Returns the name of the column with the given index. More...
 
vector< string > GetColumnNames () const
 Returns a vector comprised by all the column names in the model. More...
 
const delphos::BlockIndexType ColumnPos (const string &column) const
 Returns the index (position) of a column with given name. More...
 
const delphos::BlockIndexType GetColumnPos (const string &column) const
 Returns the index (position) of a column with given name. More...
 
virtual void SetCoordinates (const delphos::BlockIndexType &index, const delphos::Coordinates &c)
 Sets the coordinates of a block referenced by an index. More...
 
void SetCoordinates (const long &index, const double &x, const double &y, const double &z)
 Sets the coordinates of a block referenced by an index. More...
 
virtual delphos::Coordinates GetCoordinates (const delphos::BlockIndexType &index) const
 Returns the coordinates of the block with given index. More...
 
virtual delphos::BlockIndexType BlockIndex (const delphos::Coordinates &c) const
 Retrieves the index of the block with given coordinates. More...
 
virtual delphos::BlockIndexType GetBlockIndex (const delphos::Coordinates &c) const
 Retrieves the index of the block with given coordinates. More...
 
virtual delphos::BlockIndexType BlockIndex (const double &x, const double &y, const double &z) const
 Retrieves the index of the block with given coordinates. More...
 
virtual delphos::BlockIndexType GetBlockIndex (const double &x, const double &y, const double &z) const
 Retrieves the index of the block with given coordinates. More...
 
virtual delphos::BlockIndexType BlockIndex (const delphos::BlockIndexType &idx, const delphos::BlockIndexType &idy, const delphos::BlockIndexType &idz) const
 Retrieves the index of the block with given coordinate indexes. More...
 
virtual delphos::BlockIndexType GetBlockIndex (const delphos::BlockIndexType &idx, const delphos::BlockIndexType &idy, const delphos::BlockIndexType &idz) const
 Retrieves the index of the block with given coordinate indexes. More...
 
double X (const delphos::BlockIndexType index) const
 Retrieves the \(x\) coordinate of the block corresponding to the given index. More...
 
double Y (const delphos::BlockIndexType index) const
 Retrieves the \(y\) coordinate of the block corresponding to the given index. More...
 
double Z (const delphos::BlockIndexType index) const
 Retrieves the \(z\) coordinate of the block corresponding to the given index. More...
 
double GetX (const delphos::BlockIndexType index) const
 Retrieves the \(x\) coordinate of the block corresponding to the given index. More...
 
double GetY (const delphos::BlockIndexType index) const
 Retrieves the \(y\) coordinate of the block corresponding to the given index. More...
 
double GetZ (const delphos::BlockIndexType index) const
 Retrieves the \(z\) coordinate of the block corresponding to the given index. More...
 
bool SaveToTextFile (const char *bm_file_name, const unsigned int &precision=4)
 Saves the current BlockModel instance as a formatted text file using a fixed precision for numbers. The file's fist row is reserved for columns names. The three first columns correspond to the spatial block coordinates \(x\), \(y\) and \(z\), respectively, and the rest correspond to the model's attributes. More...
 
bool SaveToTextFile (const char *bm_file_name, const vector< string > &columns, const unsigned int &precision=4, const string &delim="")
 Saves the given columns of the BlockModel instance to given text file, using given precision and text file delimiter. More...
 
bool SaveToVtkFile (const char *vtk_file_name, const vector< string > &columns, const unsigned int &precision=4)
 Saves the given columns of the BlockModel instance to the given text file in the VTK format. More...
 
bool SaveToVtkFile (const char *vtk_file_name, const string &filtercolumn, const float &li, const float &ls, const string &column, const unsigned int &precision=4)
 Saves a selected column of the BlockModel instance, filtered by another column in the model using a numeric range criteria, to the given text file in VTK format. More...
 
vector< double > * SaveToVtkScalarsArray (const string &filtercolumn, const float &li, const float &ls, const string &column, int &DIMX, int &DIMY, int &DIMZ, int &THRESOLD, int &BMXINF, int &BMYINF, int &BMZINF, int &BMXSUP, int &BMYSUP, int &BMZSUP, const unsigned int &precision=4)
 Retrieves a column from the model filtered by range criteria over another column on the model. More...
 
virtual bool SaveToVtkFileUGridView (const char *vtk_file_name, const string &filtercolumn, const float &li, const float &ls, const vector< string > &columns, const unsigned int &precision=4)
 Saves the given columns of the BlockModel instance to the given text file in the Unregular Grid View of the VTK format. More...
 
bool SaveToModFile (const char *mod_file_name, const string tonCol, const unsigned int &precision=4)
 Saves the BlockModel instance to Whittle's text file format (.mod extension). More...
 
bool SaveToModFile (const char *mod_file_name, const string tonCol, const string mcafCol, const string pcafCol, const unsigned int &precision=4)
 Saves the BlockModel instance to Whittle's text file format (.mod extension). More...
 
virtual delphos::Block GetBlock (const delphos::BlockIndexType &index)
 Returns the Block instance correponding to the given index. More...
 
virtual delphos::Block GetBlock (const delphos::Coordinates &c)
 Returns the block corresponding to the given Coordinates instance. More...
 
virtual delphos::Block GetBlock (const double &x, const double &y, const double &z)
 Returns the block with given coordinates. More...
 
virtual delphos::Block GetBlock (const delphos::BlockIndexType &index_x, const delphos::BlockIndexType &index_y, const delphos::BlockIndexType &index_z)
 Returns the block with given indexes. More...
 
delphos::BlockModelSubBlockModel (delphos::BlockSelection *bs)
 Generates a new BlockModel instance from a BlockSelection instance. More...
 
delphos::BlockModelSubBlockModel (const delphos::BlockFilter &bf)
 Generates a new BlockModel instance filtering the current one using the BlockFilter::eval function. More...
 
bool IsRegular () const
 Checks if the current BlockModel instance is regular or not. More...
 
bool Contains (const delphos::BlockIndexType &idx, const delphos::BlockIndexType &idy, const delphos::BlockIndexType &idz) const
 Checks if there exists a block with given indexes in the BlockModel. More...
 
bool Contains (const delphos::Coordinates &c) const
 Checks if there exists a block with given coordinates in the block model. More...
 
bool ContainsXYZ (const double &x, const double &y, const double &z) const
 Checks if there exists a block with given coordinates in the BlockModel. More...
 
bool Contains (const delphos::Block &b) const
 Checks if there is a block in the model that matches the coordinates of the submitted Block instance. More...
 
const CoordinatesGetReferenceBlockCoordinates () const
 Returns the coordinates of the reference block. More...
 
const double & GetDZ () const
 Returns the \(Z\) direction size of blocks. More...
 
const double & GetDY () const
 Returns the \(Y\) direction size of blocks. More...
 
const double & GetDX () const
 Returns the \(X\) direction size of blocks. More...
 
const BlockIndexType & GetZCount () const
 Returns the number of blocks in the \(Z\) axis. More...
 
const BlockIndexType & GetYCount () const
 Returns the number of blocks in the \(Y\) axis . More...
 
const BlockIndexType & GetXCount () const
 Returns the number of blocks in the \(X\) axis . More...
 
const BlockIndexType & GetXMinIndex (const unsigned int &level) const
 For a given level returns the minimum \(x\) index value. More...
 
const BlockIndexType & GetXMaxIndex (const unsigned int &level) const
 For a given level returns the maximum \(x\) index value. More...
 
const BlockIndexType & GetYMinIndex (const unsigned int &level) const
 For a given level returns the minimum \(y\) index value. More...
 
const BlockIndexType & GetYMaxIndex (const unsigned int &level) const
 For a given level returns the maximum \(y\) index value. More...
 
bool Regularize ()
 Regularize a non regular block model. More...
 
bool UnRegularize ()
 Unregularize a regular block model. More...
 
double GetMaxX ()
 Returns the maximum value of the \(x\) coordinates. More...
 
double GetMaxY ()
 Returns the maximum value of the \(y\) coordinates. More...
 
double GetMaxZ ()
 Returns the maximum value of the \(z\) coordinates. More...
 
double GetMinX ()
 Returns the minimum value of the \(x\) coordinates. More...
 
double GetMinY ()
 Returns the minimum value of the \(y\) coordinates. More...
 
double GetMinZ ()
 Returns the minimum value of the \(z\) coordinates. More...
 
double GetAvgX ()
 Returns the \(x\) coordinate average value. More...
 
double GetAvgY ()
 Returns the \(y\) coordinate average value. More...
 

Static Public Attributes

static const
delphos::BlockIndexType 
NO_INDEX = numeric_limits<BlockIndexType>::max()
 Index of nonexistent Block.
 
static const vector< string > EMPTY_STRING_VECT
 Empty string vector.
 

Detailed Description

Abstracts a container of blocks as a table with arbitrary number of attributes that can be accessed by index \((0, 1,\ldots, N-1)\) (where \(N\) is total number of blocks) or coordinates \((x,y,z)\).

BlockModel is a fundamental class that works as a container of a blocks. A BlockModel instance has a number of columns (attributes) stored, each Block of the model has a numeric value for each attribute. This attributes can be queried and modified by methods provided in the class. Also, new attibutes can be generated in different ways, for example, using default values or using formulas. New BlockModel instances can be generated as subset from one instance using some selection criteria for blocks.

BlockModel offers two types of container for the coordinates. One for an arbitrary block model and one for a regular block model. A regular block model is composed of blocks with the same dimensions \((\Delta x,\Delta y,\Delta z)\). The container for the regular block model store only one reference block coordinates and indexes that defines the position of the blocks from the reference block. The reference block Coordinates corresponds to \((0,0,0)\) index. An arbitrary BlockModel makes full use of the blocks spatial coordinates to identify them.

Constructor & Destructor Documentation

delphos::BlockModel::BlockModel ( const delphos::BlockIndexType &  num_blocks)

Creates a new block model with given number of blocks.

Parameters
num_blocksThe number of blocks that the model will have.

This creates an empty BlockModel instance, with a given number of blocks, in which all coordinates are set to \((0,0,0)\). The coordinates container of arbitrary block model is used.

delphos::BlockModel::BlockModel ( const char *  file_name,
const vector< string > &  columns = delphos::BlockModel::EMPTY_STRING_VECT 
)

Creates a new block model from a text file reading optionally only selected columns. A block model file is formatted text file (table representation) with the three first columns reserved for the block spatial coordinates values \(x, y\) and \(z\), respectively, and the rest of the columns represent the "attributes" (or columns) of the blocks in the model. The first row is reserved as a header row, and all other rows represent the blocks on the model. Each row, except for the first one, must be comprised with numeric values only, if a non parseable value is found, an exception is thrown. The text file can be a tab or space separated file.

Parameters
file_nameFull path of the text file that contains the block model.
columnsA vector containing the names of the columns of the file to be read. The columns parameter default value is interpreted as if all the columns were selected.

This creates a BlockModel instance from the given file. The regular BlockModel coordinates container is used. Coordinates are used as a spatial reference, no unit specification is needed.

delphos::BlockModel::BlockModel ( const char *  file_name,
const double &  ang 
)

Creates a new block model from a text file and keep only blocks that are inside a feasible cone defined by a given angle (the angle is measured from the vertical axis). A block model file is formatted text file (table representation) with the three first columns reserved for the block spatial coordinates values \(x, y\) and \(z\), respectively, and the rest of the columns represent the "attributes" (or columns) of the blocks in the model. The first row is reserved as a header row, and all other rows represent the blocks on the model. Each row must except for the first one, must be comprised with numeric values only, if a non parseable value is found, an exception is thrown. The text file can be a tab or space separated file.

Parameters
file_nameFull path of the text file that contains the block model.
angAngle that is used to compute the feasible cone.

This creates a new BlockModel instance from the given file comprised by blocks in the feasible cone only. It also reads all the columns (except the coordinates) as attributes. The regular BlockModel coordinates container is used.

Member Function Documentation

void delphos::BlockModel::AddColumn ( const string &  column,
const double &  default_value 
)

Adds a new column (of block attributes) to the model with a given default value.

Parameters
columnThe name of the column to be created.
default_valueThe default value to the attribute.

This method creates a new column of attributes in the BlockModel instance. For each block in the model the value of this new attribute is setted as default_value.

If the name of the column is already in use, the old column values will be overriten.

void delphos::BlockModel::AddColumn ( const string &  column,
const string &  formula 
)

Adds a new column (of blocks attributes) to the model with a given string that represent a formula. This formula references the BlockModel instance columns by their names between brackets.

Parameters
columnThe name of the column to be created (or replaced).
formulaThe string containing the formula to be evaluated for each block.

The formula is evaluated for each block, also it is saved so if any changes are made to the columns on which the formula depends on, the values are computed again.

If the name of the column is already in use, the old column values will be overriten.

BlockIndexType delphos::BlockModel::BlockIndex ( const delphos::Coordinates c) const
virtual

Retrieves the index of the block with given coordinates.

Deprecated:
See GetBlockIndex(const delphos::Coordinates & c) const .
Parameters
cThe Coordinates of the block from which retrieve the index.
Returns
If there exists a block with the given coordinates, the index of such block (that goes from 0 to Size()-1) is returned.

If there is no block matching the given index, an exception is thrown.

BlockIndexType delphos::BlockModel::BlockIndex ( const double &  x,
const double &  y,
const double &  z 
) const
virtual

Retrieves the index of the block with given coordinates.

Deprecated:
See GetBlockIndex(const double & x, const double & y, const double & z) const .
Parameters
xThe \(x\) coordinate value of the block.
yThe \(y\) coordinate value of the block.
zThe \(z\) coordinate value of the block.
Returns
If there exists a block with the given coordinates, the index of such block (that goes from 0 to Size()-1) is returned. If not, BlockModel::NO_INDEX is returned.
BlockIndexType delphos::BlockModel::BlockIndex ( const delphos::BlockIndexType &  idx,
const delphos::BlockIndexType &  idy,
const delphos::BlockIndexType &  idz 
) const
virtual

Retrieves the index of the block with given coordinate indexes.

Deprecated:
See GetBlockIndex(const delphos::BlockIndexType& idx, const delphos::BlockIndexType& idy, const delphos::BlockIndexType& idz) const .
Parameters
idxThe \(x\) index of the block.
idyThe \(y\) index of the block.
idzThe \(z\) index of the block.
Returns
If there exists a block with the given coordinates indexes, the index of such block (that goes from 0 to Size()-1) is returned. If not, BlockModel::NO_INDEX is returned.

If the model is not regular, an exception is thrown.

string delphos::BlockModel::ColumnName ( const unsigned int &  column_index) const

Returns the name of the column with the given index.

Parameters
column_indexThe position (index) of the column (from 0 to NumColumns()-1).
Deprecated:
See GetColumnName()
Returns
The name of the attribute column with index matching the given one.

If the given index exceeds the feasible range, an exception is thrown.

const BlockIndexType delphos::BlockModel::ColumnPos ( const string &  column) const

Returns the index (position) of a column with given name.

Deprecated:
See GetColumnPos()
Parameters
columnThe name of the column to be queried.
Returns
The index (position) of the attribute column with name matching the given one.

If there is no column matching the given column name, then BlockModel::NO_INDEX is returned.

bool delphos::BlockModel::Contains ( const delphos::BlockIndexType &  idx,
const delphos::BlockIndexType &  idy,
const delphos::BlockIndexType &  idz 
) const

Checks if there exists a block with given indexes in the BlockModel.

Parameters
idxThe \(x\) index of the block.
idyThe \(y\) index of the block.
idzThe \(z\) index of the block.
Returns
True if there exists a block with the given indexes in the model. False otherwise. If the model is not regular an exception is thrown.
bool delphos::BlockModel::Contains ( const delphos::Coordinates c) const

Checks if there exists a block with given coordinates in the block model.

Parameters
cA Coordinates instance containing the spatial coordinates values to be matched.
Returns
True if there is a block with coordinates matching the submitted values. False otherwise.
bool delphos::BlockModel::Contains ( const delphos::Block b) const

Checks if there is a block in the model that matches the coordinates of the submitted Block instance.

Parameters
bThe Block instance to be matched.
Returns
True if there is a block in the block model that matches the coordinates of the given Block instance. False otherwise.
bool delphos::BlockModel::ContainsXYZ ( const double &  x,
const double &  y,
const double &  z 
) const

Checks if there exists a block with given coordinates in the BlockModel.

Parameters
xThe \(x\) coordinate of a block.
yThe \(y\) coordinate of a block.
zThe \(z\) coordinate of a block.
Returns
True if there is a block with coordinates matching the submitted values. False otherwise.
double delphos::BlockModel::GetAvgX ( )

Returns the \(x\) coordinate average value.

Returns
The means \(x\) coordinate value for all the blocks in the model.
double delphos::BlockModel::GetAvgY ( )

Returns the \(y\) coordinate average value.

Returns
The mean \(y\) coordinate value for all the blocks in the model.
Block delphos::BlockModel::GetBlock ( const delphos::BlockIndexType &  index)
virtual

Returns the Block instance correponding to the given index.

Parameters
indexThe index (position) of the block (form 0 to Size()-1).
Returns
A Block instance of the requested block.

If no block matches the given index, an exception is thrown.

Block delphos::BlockModel::GetBlock ( const delphos::Coordinates c)
virtual

Returns the block corresponding to the given Coordinates instance.

Parameters
cThe Coordinates instance with the numeric coordinates of the block.
Returns
A Block instance of the requested block.

If no block on the model matches the submitted coordinates, an exception is thrown.

Block delphos::BlockModel::GetBlock ( const double &  x,
const double &  y,
const double &  z 
)
virtual

Returns the block with given coordinates.

Parameters
xThe coordinate of the block in the axis X.
yThe coordinate of the block in the axis Y.
zThe coordinate of the block in the axis Z.
Returns
A Block instance of the requested block.

If no block on the model matches the submitted coordinates, an exception is thrown.

Block delphos::BlockModel::GetBlock ( const delphos::BlockIndexType &  index_x,
const delphos::BlockIndexType &  index_y,
const delphos::BlockIndexType &  index_z 
)
virtual

Returns the block with given indexes.

Parameters
index_xThe \(x\) index of the block.
index_yThe \(y\) index of the block.
index_zThe \(z\) index of the block.
Returns
A Block instance of the requested block.

The indexes of a block goes from (0,0,0) to (GetXCount(),GetYCount(),GetZCount()).

If no block matches the submitted indexes an exception is thrown.

BlockIndexType delphos::BlockModel::GetBlockIndex ( const delphos::Coordinates c) const
virtual

Retrieves the index of the block with given coordinates.

Parameters
cThe Coordinates of the block from which retrieve the index.
Returns
If there exists a block with the given coordinates, the index of such block (that goes from 0 to Size()-1) is returned. If not, BlockModel::NO_INDEX is returned.
BlockIndexType delphos::BlockModel::GetBlockIndex ( const double &  x,
const double &  y,
const double &  z 
) const
virtual

Retrieves the index of the block with given coordinates.

Parameters
xThe \(x\) coordinate of the block.
yThe \(y\) coordinate of the block.
zThe \(z\) coordinate of the block.
Returns
If there exists a block with the given coordinates, the index of such block (that goes from 0 to Size()-1) is returned. If not, BlockModel::NO_INDEX is returned.
BlockIndexType delphos::BlockModel::GetBlockIndex ( const delphos::BlockIndexType &  idx,
const delphos::BlockIndexType &  idy,
const delphos::BlockIndexType &  idz 
) const
virtual

Retrieves the index of the block with given coordinate indexes.

Parameters
idxThe \(x\) index of the block.
idyThe \(y\) index of the block.
idzThe \(z\) index of the block.
Returns
If there exists a block with the given coordinates indexes, the index of such block (that goes from 0 to Size()-1) is returned. If not, BlockModel::NO_INDEX is returned.

If the model is not regular, an exception is thrown.

string delphos::BlockModel::GetColumnName ( const unsigned int &  column_index) const

Returns the name of the column with the given index.

Parameters
column_indexThe position (index) of the column (from 0 to NumColumns()-1).
Returns
The name of the attribute column with index matching the given one.

If the given index exceeds the feasible range, an exception is thrown.

vector< string > delphos::BlockModel::GetColumnNames ( ) const

Returns a vector comprised by all the column names in the model.

Returns
A std::vector<string> whose elements are the names of the columns present in the BlockModel instance.

The column name position on the vector are the same as the positions in the model, This is, the output preserves the order present in the BlockModel instance.

const BlockIndexType delphos::BlockModel::GetColumnPos ( const string &  column) const

Returns the index (position) of a column with given name.

Parameters
columnThe name of the column to be queried.
Returns
The index (position) of the attribute column with name matching the given one.

If there is no column matching the given column name, then BlockModel::NO_INDEX is returned.

Coordinates delphos::BlockModel::GetCoordinates ( const delphos::BlockIndexType &  index) const
virtual

Returns the coordinates of the block with given index.

Parameters
indexThe index (position) of the block which its Coordinates will be retrieved (from 0 to Size()-1)
Returns
A Coordinates instance containing the spatial coordinates of the referenced block.

If there is no block matching the given index, an exception is thrown.

const double & delphos::BlockModel::GetDX ( ) const

Returns the \(X\) direction size of blocks.

Returns
The size of the blocks of the model on the \(X\) direction.

If the block model is not regular, an exception is thrown.

const double & delphos::BlockModel::GetDY ( ) const

Returns the \(Y\) direction size of blocks.

Returns
The size of the blocks of the model on the \(Y\) direction.

If the block model is not regular, an exception is thrown.

const double & delphos::BlockModel::GetDZ ( ) const

Returns the \(Z\) direction size of blocks.

Returns
The size of the blocks of the model on the \(Z\) direction.

If the block model is not regular, an exception is thrown.

double delphos::BlockModel::GetMaxX ( )

Returns the maximum value of the \(x\) coordinates.

Returns
The maximum value of the \(x\) coordinate of all blocks in the model.
double delphos::BlockModel::GetMaxY ( )

Returns the maximum value of the \(y\) coordinates.

Returns
The maximum value of the \(y\) coordinate of all blocks in the model.
double delphos::BlockModel::GetMaxZ ( )

Returns the maximum value of the \(z\) coordinates.

Returns
The maximum value of the \(z\) coordinate of all blocks in the model.
double delphos::BlockModel::GetMinX ( )

Returns the minimum value of the \(x\) coordinates.

Returns
The minimum value of the \(x\) coordinate of all blocks in the model.
double delphos::BlockModel::GetMinY ( )

Returns the minimum value of the \(y\) coordinates.

Returns
The minimum value of the \(y\) coordinate of all blocks in the model.
double delphos::BlockModel::GetMinZ ( )

Returns the minimum value of the \(z\) coordinates.

Returns
The minimum value of the \(z\) coordinate of all blocks in the model.
const unsigned int delphos::BlockModel::GetNumColumns ( ) const

Returns the number of columns (block attributes) in the model.

Returns
The amount of attribute columns present in the BlockModel instance.
const Coordinates & delphos::BlockModel::GetReferenceBlockCoordinates ( ) const

Returns the coordinates of the reference block.

Returns
A Coordinates instance containing the spatial coordinates values for the reference block.

The reference Block corresponds to the block with indexes \((0,0,0)\). If the model is not regular an exception is thrown.

const BlockIndexType delphos::BlockModel::GetSize ( ) const
virtual

Returns the number of blocks in the BlockModel.

Returns
The amount of blocks that are in the BlockModel instance.
double delphos::BlockModel::GetValue ( const delphos::BlockIndexType &  index,
const string &  column 
) const

Retrieves the value of an attribute for a given block index and attribute name.

Parameters
indexThe index (position) of the block. From 0 to Size()-1.
columnThe name of the attribute to be retrieved.

The column must exist or an exception is thrown. The index the index is out of range an exception is thrown.

double delphos::BlockModel::GetValue ( const delphos::BlockIndexType &  index,
const unsigned int &  columnpos 
) const

Retrieves the value of an attribute for a given block index and attribute name.

Parameters
indexThe index (position) of the block. From 0 to Size()-1.
columnposThe column position of the attribute to be retrieved. From 0 to GetNumColumns()-1.

If the column index or the block index are out of range an exception is thrown.

double delphos::BlockModel::GetX ( const delphos::BlockIndexType  index) const

Retrieves the \(x\) coordinate of the block corresponding to the given index.

Parameters
indexThe index (position) of the block (from 0 to Size()-1).
Returns
The value of the \(x\) spatial coordinate for the referenced block.

If there is no block that matching the given index, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetXCount ( ) const

Returns the number of blocks in the \(X\) axis .

Returns
The number of blocks in \(X\) axis.

If the block model is not regular, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetXMaxIndex ( const unsigned int &  level) const

For a given level returns the maximum \(x\) index value.

Parameters
levelLevel of the model to search. The level goes from 0 to GetZCount()-1.
Returns
The maximum \(x\) index value of the for all blocks in the given level.

In a regular model, a level is the set of all blocks that have the same value of their \(z\) coordinate. Also, the level index is ordered, this is, the level 0 corresponds to the blocks in the "bottom" of the model, the the level 1 corresponds to the set of blocks inmediatly on top of those on the bottom, and so on. Clearly the level indexes go from 0 to GetZCount()-1.

If the model is not regular, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetXMinIndex ( const unsigned int &  level) const

For a given level returns the minimum \(x\) index value.

Parameters
levelLevel of the model to search. The level goes from 0 to GetZCount()-1.
Returns
The minimum \(x\) index value of the for all blocks in the given level.

In a regular model, a level is the set of all blocks that have the same value of their \(z\) coordinate. Also, the level index is ordered, this is, the level 0 corresponds to the blocks in the "bottom" of the model, the the level 1 corresponds to the set of blocks inmediatly on top of those on the bottom, and so on. Clearly the level indexes go from 0 to GetZCount()-1.

If the model is not regular, an exception is thrown.

double delphos::BlockModel::GetY ( const delphos::BlockIndexType  index) const

Retrieves the \(y\) coordinate of the block corresponding to the given index.

Parameters
indexThe index (position) of the block (from 0 to GetSize()-1).
Returns
The value of the \(y\) spatial coordinate for the referenced block.

If there is no block that matching the given index, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetYCount ( ) const

Returns the number of blocks in the \(Y\) axis .

Returns
The number of blocks in \(Y\) axis.

If the block model is not regular, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetYMaxIndex ( const unsigned int &  level) const

For a given level returns the maximum \(y\) index value.

Parameters
levelLevel of the model to search. The level goes from 0 to GetZCount()-1.
Returns
The maximum \(y\) index value of the for all blocks in the given level.

In a regular model, a level is the set of all blocks that have the same value of their \(z\) coordinate. Also, the level index is ordered, this is, the level 0 corresponds to the blocks in the "bottom" of the model, the the level 1 corresponds to the set of blocks inmediatly on top of those on the bottom, and so on. Clearly the level indexes go from 0 to GetZCount()-1.

If the model is not regular, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetYMinIndex ( const unsigned int &  level) const

For a given level returns the minimum \(y\) index value.

Parameters
levelLevel of the model to search. The level goes from 0 to GetZCount()-1.
Returns
The minimum \(y\) index value of the for all blocks in the given level.

In a regular model, a level is the set of all blocks that have the same value of their \(z\) coordinate. Also, the level index is ordered, this is, the level 0 corresponds to the blocks in the "bottom" of the model, the the level 1 corresponds to the set of blocks inmediatly on top of those on the bottom, and so on. Clearly the level indexes go from 0 to GetZCount()-1.

If the model is not regular, an exception is thrown.

double delphos::BlockModel::GetZ ( const delphos::BlockIndexType  index) const

Retrieves the \(z\) coordinate of the block corresponding to the given index.

Parameters
indexThe index (position) of the block (from 0 to GetSize()-1).
Returns
The value of the \(z\) spatial coordinate for the referenced block.

If there is no block that matching the given index, an exception is thrown.

const BlockIndexType & delphos::BlockModel::GetZCount ( ) const

Returns the number of blocks in the \(Z\) axis.

Returns
The number of blocks in \(Z\) axis.

If the block model is not regular, an exception is thrown.

bool delphos::BlockModel::IsRegular ( ) const

Checks if the current BlockModel instance is regular or not.

Returns
True only if the regular coordinates container is used, False otherwise.

A regular block model is a block model that is composed of blocks of the same dimensions \((\Delta x,\Delta y,\Delta z)\).

const unsigned int delphos::BlockModel::NumColumns ( ) const

Returns the number of columns (block attributes) in the model.

Deprecated:
See GetNumColumns()
Returns
The amount of attribute columns present in the BlockModel instance.
bool delphos::BlockModel::Regularize ( )

Regularize a non regular block model.

Returns
True only if the BlockModel has been successfully regularized. False if any problems were found during the conversion process.

A regular BlockModel is a block model that is comprised of blocks of the same dimensions \((\Delta x,\Delta y,\Delta z)\).

This method deletes the general coordinates container and creates and fill the regular one. The container for the regular block model store only one reference block coordinates and indexes that defines the position of the blocks from the reference block.

If the block the BlockModel is already regular or its size is 1 it throws an exception.

bool delphos::BlockModel::RemoveColumn ( const string &  column)

Removes a given column (of block attributes) from the model.

Parameters
columnThe name of the column to be removed.
Returns
True is the column is found and removed. False otherwise.
bool delphos::BlockModel::SaveToModFile ( const char *  mod_file_name,
const string  tonCol,
const unsigned int &  precision = 4 
)

Saves the BlockModel instance to Whittle's text file format (.mod extension).

Parameters
mod_file_nameThe name (path) of the file in which will be saved the Block Model.
tonColThe name of the column that corresponds to the tonnage attribute.
precisionThe number of digits after the decimal point to be used for writing.
Returns
True on success. False if problems were found during the writing process.

The precision default value is set to 4 to fit Vulcan data. Given that on Whittle format files the blocks are numbered (1, ..., GetXCount(); 1, ..., GetYCount(); 1, ..., GetZCount()), blocks that do not belong to the original model are generated with tonnage 0 and without parcels.

If the model is not regular, an exception is thrown.

If output file cannot be created, an exception is thrown.

If the refereced tonnage column is not found on the model, an exception is thrown.

bool delphos::BlockModel::SaveToModFile ( const char *  mod_file_name,
const string  tonCol,
const string  mcafCol,
const string  pcafCol,
const unsigned int &  precision = 4 
)

Saves the BlockModel instance to Whittle's text file format (.mod extension).

Parameters
mod_file_nameThe name (path) of the file in which will be saved the Block Model.
tonColThe name of the column that corresponds to the tonnage attribute.
mcafColThe name of the column that corresponds to the positional adjustment factor on the block mining cost attribute.
pcafColThe name of the column that corresponds to the positional adjustment factor on the block process cost attribute.
precisionThe number of digits after the decimal point to be used for writing.
Returns
Throws an exception if BlockModel is not regular or the output file cannot be created. Returns false if at least one of the requested columns is not found on BlockModel or there are problems writing on file. Returns true if file is successfully created.

The precision default value is set to 4 to fit Vulcan data. Given that on Whittle format files the blocks are numbered (1, ..., GetXCount(); 1, ..., GetYCount(); 1, ..., GetZCount()), blocks that do not belong to the original model are generated with tonnage 0 and without parcels.

bool delphos::BlockModel::SaveToTextFile ( const char *  bm_file_name,
const unsigned int &  precision = 4 
)

Saves the current BlockModel instance as a formatted text file using a fixed precision for numbers. The file's fist row is reserved for columns names. The three first columns correspond to the spatial block coordinates \(x\), \(y\) and \(z\), respectively, and the rest correspond to the model's attributes.

Parameters
bm_file_nameThe name of the file in which will be saved the Block Model.
precisionThe number of digit after the decimal point.
Returns
Returns True on sucess. False if problems are found in the process of writing.

The precision default value is set to 4 to fit Vulcan data. As convention, the output is tab-separated text file.

If the path of the file is not accessible, an exception is thrown.

bool delphos::BlockModel::SaveToTextFile ( const char *  bm_file_name,
const vector< string > &  columns,
const unsigned int &  precision = 4,
const string &  delim = "" 
)

Saves the given columns of the BlockModel instance to given text file, using given precision and text file delimiter.

Parameters
bm_file_nameThe name (path) of the output file.
columnsThe names of the columns attributes that will be written.
precisionThe number of digits after the decimal point.
delimThe delimiter used to separate columns in the file.
Returns
True on success. False if problems are found during the writing process.

The precision default value is set to 4 to fit Vulcan data. Delimiters can be comma (","), space " " and tab ("\t").

If the path of the file is not accessible, an exception is thrown.

bool delphos::BlockModel::SaveToVtkFile ( const char *  vtk_file_name,
const vector< string > &  columns,
const unsigned int &  precision = 4 
)

Saves the given columns of the BlockModel instance to the given text file in the VTK format.

Parameters
vtk_file_nameThe name of the file in which the BlockModel instance will be written.
columnsThe columns name of the columns attributes that will be saved.
precisionThe number of digits after the decimal point.
Returns
True on sucess. False if problems are found during the writing process.

The precision default value is set to 4 to fit Vulcan data.

If the model is not regular an exception is thrown.

If a submitted column name is not found in the model, an exception is thrown.

If the path of the file is not accessible, an exception is thrown.

bool delphos::BlockModel::SaveToVtkFile ( const char *  vtk_file_name,
const string &  filtercolumn,
const float &  li,
const float &  ls,
const string &  column,
const unsigned int &  precision = 4 
)

Saves a selected column of the BlockModel instance, filtered by another column in the model using a numeric range criteria, to the given text file in VTK format.

Parameters
vtk_file_nameThe name (path) of the file in which the BlockModel will be written.
filtercolumnThe name of the column from which the blocks will be filtered. Only blocks with value in this column inside the given range will be selected for writing.
liThe lowest value to filter.
lsThe highest value to filter.
columnThe column to save.
precisionThe number of digits after the decimal point to be used for writing.
Returns
True on sucess. False if problems are found in the writing process.

The precision default value is set to 4 to fit Vulcan data.

If a given column name is not found on the model, an exception is thrown.

If the model is not regular, an exception is thrown.

If the given path is not accessible, an exception is thrown.

bool delphos::BlockModel::SaveToVtkFileUGridView ( const char *  vtk_file_name,
const string &  filtercolumn,
const float &  li,
const float &  ls,
const vector< string > &  columns,
const unsigned int &  precision = 4 
)
virtual

Saves the given columns of the BlockModel instance to the given text file in the Unregular Grid View of the VTK format.

Parameters
vtk_file_nameThe name (path) of the file in which will be saved the Block Model in the vtk format.
filtercolumnThe name of the column from which the blocks will be filtered. Only blocks with value in this column inside the given range will be selected for writing.
liThe lowest value to filter.
lsThe highest value to filter.
columnsThe columns name of the columns attributes that will be saved.
precisionThe number of digits after the decimal point to be used for writing.
Returns
True on success. False if problems are found during the writing process.

The precision default value is set to 4 to fit Vulcan data.

If the given attribute column name for filtering is not found in the model, an exception is thrown.

If the model is not regular an exception is thrown.

vector< double > * delphos::BlockModel::SaveToVtkScalarsArray ( const string &  filtercolumn,
const float &  li,
const float &  ls,
const string &  column,
int &  DIMX,
int &  DIMY,
int &  DIMZ,
int &  THRESOLD,
int &  BMXINF,
int &  BMYINF,
int &  BMZINF,
int &  BMXSUP,
int &  BMYSUP,
int &  BMZSUP,
const unsigned int &  precision = 4 
)

Retrieves a column from the model filtered by range criteria over another column on the model.

Parameters
[in]filtercolumnThe name of the column from which the blocks will be filtered. Only blocks with value in this column inside the given range will be selected for writing.
[in]liThe lowest value to filter.
[in]lsThe highest value to filter.
[in]columnThe column to save.
[out]DIMXNumber of block of the block model in X
[out]DIMYNumber of block of the block model in Y
[out]DIMZNumber of block of the block model in Z
[out]THRESOLDVariable where SaveToVtkScalarsArray will return a check value
[out]BMXINFLowest X coordinate in the model
[out]BMYINFLowest Y coordinate in the model
[out]BMZINFLowest Z coordinate in the model
[out]BMXSUPLargest X coordinate in the model
[out]BMYSUPLargest Y coordinate in the model
[out]BMZSUPLargest Z coordinate in the model
[in]precisionThe number of digits after the decimal point to be used for writing.
Returns
The values of the selected column for the all the blocks that fullfill the criteria. Index order is preserved. Also, complementary data is stored on some of the arguments.

The precision default value is set to 4 to fit Vulcan data.

If the model is not regular an exception is thrown.

void delphos::BlockModel::SetCoordinates ( const delphos::BlockIndexType &  index,
const delphos::Coordinates c 
)
virtual

Sets the coordinates of a block referenced by an index.

Parameters
indexThe position of the block (from 0 to Size()-1) in the BlockModel instance.
cThe new Coordinates of the block.

Only available for a non regular block model. If the block model is regular, an exception is thrown.

void delphos::BlockModel::SetCoordinates ( const long &  index,
const double &  x,
const double &  y,
const double &  z 
)

Sets the coordinates of a block referenced by an index.

Parameters
indexPosition of the block (from 0 to Size()-1)
xThe new \(x\) coordinate value for the block
yThe new \(y\) coordinate value for the block
zThe new \(z\) coordinate value for the block.

Only available for a non regular block model. If the block model is regular, an exception is thrown.

void delphos::BlockModel::SetValue ( const delphos::BlockIndexType &  index,
const string &  column,
const double &  value 
)

Sets the value of an attribute for a given block index and attribute name.

Parameters
indexThe index (position) of the block. From 0 to Size()-1.
columnThe name of the attribute to be set.
valueThe value to which the attribute will be set.
void delphos::BlockModel::SetValue ( const delphos::BlockIndexType &  index,
const unsigned int &  columnpos,
const double &  value 
)

Sets the value of an attribute for a given block index and attribute name.

Parameters
indexThe index (position) of the block. From 0 to Size()-1.
columnposThe column position of the attribute to be set.
valueThe value to which the attribute will be set.
const BlockIndexType delphos::BlockModel::Size ( ) const
virtual

Returns the number of blocks in the BlockModel instance.

Deprecated:
See GetSize().
Returns
The amount of blocks that are in the BlockModel instance.
delphos::BlockModel * delphos::BlockModel::SubBlockModel ( delphos::BlockSelection bs)

Generates a new BlockModel instance from a BlockSelection instance.

Parameters
bsA BlockSelection instance from which the new BlockModel instance will be created.
Returns
A pointer to a new BlockModel instance comprised by all the blocks in the submitted BlockSelection instance . The new BlockModel has all the attributes that the original BlockModel instance referenced by the BlockSelection instance.
BlockModel * delphos::BlockModel::SubBlockModel ( const delphos::BlockFilter bf)

Generates a new BlockModel instance filtering the current one using the BlockFilter::eval function.

Parameters
bfThe BlockFilter instance.
Returns
A pointer to a new BlockModel instance. This new instance contains all the attribute columns present in the original model.
bool delphos::BlockModel::UnRegularize ( )

Unregularize a regular block model.

Returns
True only if the BlockModel has been successfully unregularized. False if any problems are found during the conversion process.

This method deletes the regular coordinates container and creates and fill the general coordinates container. This is, the container of all spatial coordinates for the blocks in the model.

If the block the BlockModel is already unregular it throws an exception.

double delphos::BlockModel::X ( const delphos::BlockIndexType  index) const

Retrieves the \(x\) coordinate of the block corresponding to the given index.

Deprecated:
See GetX(const delphos::BlockIndexType index) const
Parameters
indexThe index (position) of the block (from 0 to Size()-1).
Returns
The value of the \(x\) spatial coordinate for the referenced block.

If there is no block that matching the given index, an exception is thrown.

double delphos::BlockModel::Y ( const delphos::BlockIndexType  index) const

Retrieves the \(y\) coordinate of the block corresponding to the given index.

Deprecated:
See GetY(const delphos::BlockIndexType index) const
Parameters
indexThe index (position) of the block (from 0 to Size()-1).
Returns
The value of the \(y\) spatial coordinate for the referenced block.

If there is no block that matching the given index, an exception is thrown.

double delphos::BlockModel::Z ( const delphos::BlockIndexType  index) const

Retrieves the \(z\) coordinate of the block corresponding to the given index.

Deprecated:
See GetZ(const delphos::BlockIndexType index) const
Parameters
indexThe index (position) of the block (from 0 to Size()-1).
Returns
The value of the \(x\) spatial coordinate for the referenced block.

If there is no block that matching the given index, an exception is thrown.


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