![]() |
MineLink
|
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>
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::BlockModel * | SubBlockModel (delphos::BlockSelection *bs) |
Generates a new BlockModel instance from a BlockSelection instance. More... | |
delphos::BlockModel * | SubBlockModel (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 Coordinates & | GetReferenceBlockCoordinates () 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. | |
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.
delphos::BlockModel::BlockModel | ( | const delphos::BlockIndexType & | num_blocks | ) |
Creates a new block model with given number of blocks.
num_blocks | The 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.
file_name | Full path of the text file that contains the block model. |
columns | A 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.
file_name | Full path of the text file that contains the block model. |
ang | Angle 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.
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.
column | The name of the column to be created. |
default_value | The 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.
column | The name of the column to be created (or replaced). |
formula | The 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.
|
virtual |
Retrieves the index of the block with given coordinates.
c | The Coordinates of the block from which retrieve the index. |
If there is no block matching the given index, an exception is thrown.
|
virtual |
Retrieves the index of the block with given coordinates.
x | The \(x\) coordinate value of the block. |
y | The \(y\) coordinate value of the block. |
z | The \(z\) coordinate value of the block. |
|
virtual |
Retrieves the index of the block with given coordinate indexes.
idx | The \(x\) index of the block. |
idy | The \(y\) index of the block. |
idz | The \(z\) index of the block. |
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.
column_index | The position (index) of the column (from 0 to NumColumns()-1). |
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.
column | The name of the column to be queried. |
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.
idx | The \(x\) index of the block. |
idy | The \(y\) index of the block. |
idz | The \(z\) index of the block. |
bool delphos::BlockModel::Contains | ( | const delphos::Coordinates & | c | ) | const |
Checks if there exists a block with given coordinates in the block model.
c | A Coordinates instance containing the spatial coordinates values to be matched. |
bool delphos::BlockModel::Contains | ( | const delphos::Block & | b | ) | const |
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.
x | The \(x\) coordinate of a block. |
y | The \(y\) coordinate of a block. |
z | The \(z\) coordinate of a block. |
double delphos::BlockModel::GetAvgX | ( | ) |
Returns the \(x\) coordinate average value.
double delphos::BlockModel::GetAvgY | ( | ) |
Returns the \(y\) coordinate average value.
|
virtual |
|
virtual |
Returns the block corresponding to the given Coordinates instance.
c | The Coordinates instance with the numeric coordinates of the block. |
If no block on the model matches the submitted coordinates, an exception is thrown.
|
virtual |
Returns the block with given coordinates.
x | The coordinate of the block in the axis X. |
y | The coordinate of the block in the axis Y. |
z | The coordinate of the block in the axis Z. |
If no block on the model matches the submitted coordinates, an exception is thrown.
|
virtual |
Returns the block with given indexes.
index_x | The \(x\) index of the block. |
index_y | The \(y\) index of the block. |
index_z | The \(z\) index of the 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.
|
virtual |
Retrieves the index of the block with given coordinates.
c | The Coordinates of the block from which retrieve the index. |
|
virtual |
Retrieves the index of the block with given coordinates.
x | The \(x\) coordinate of the block. |
y | The \(y\) coordinate of the block. |
z | The \(z\) coordinate of the block. |
|
virtual |
Retrieves the index of the block with given coordinate indexes.
idx | The \(x\) index of the block. |
idy | The \(y\) index of the block. |
idz | The \(z\) index of the block. |
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.
column_index | The position (index) of the column (from 0 to NumColumns()-1). |
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.
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.
column | The name of the column to be queried. |
If there is no column matching the given column name, then BlockModel::NO_INDEX is returned.
|
virtual |
Returns the coordinates of the block with given index.
index | The index (position) of the block which its Coordinates will be retrieved (from 0 to Size()-1) |
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.
If the block model is not regular, an exception is thrown.
const double & delphos::BlockModel::GetDY | ( | ) | const |
Returns the \(Y\) direction size of blocks.
If the block model is not regular, an exception is thrown.
const double & delphos::BlockModel::GetDZ | ( | ) | const |
Returns the \(Z\) direction size of blocks.
If the block model is not regular, an exception is thrown.
double delphos::BlockModel::GetMaxX | ( | ) |
Returns the maximum value of the \(x\) coordinates.
double delphos::BlockModel::GetMaxY | ( | ) |
Returns the maximum value of the \(y\) coordinates.
double delphos::BlockModel::GetMaxZ | ( | ) |
Returns the maximum value of the \(z\) coordinates.
double delphos::BlockModel::GetMinX | ( | ) |
Returns the minimum value of the \(x\) coordinates.
double delphos::BlockModel::GetMinY | ( | ) |
Returns the minimum value of the \(y\) coordinates.
double delphos::BlockModel::GetMinZ | ( | ) |
Returns the minimum value of the \(z\) coordinates.
const unsigned int delphos::BlockModel::GetNumColumns | ( | ) | const |
Returns the number of columns (block attributes) in the model.
const Coordinates & delphos::BlockModel::GetReferenceBlockCoordinates | ( | ) | const |
Returns the coordinates of 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.
|
virtual |
Returns the number of blocks in the BlockModel.
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.
index | The index (position) of the block. From 0 to Size()-1. |
column | The 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.
index | The index (position) of the block. From 0 to Size()-1. |
columnpos | The 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.
index | The index (position) of the block (from 0 to Size()-1). |
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 .
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.
level | Level of the model to search. The level goes from 0 to GetZCount()-1. |
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.
level | Level of the model to search. The level goes from 0 to GetZCount()-1. |
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.
index | The index (position) of the block (from 0 to GetSize()-1). |
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 .
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.
level | Level of the model to search. The level goes from 0 to GetZCount()-1. |
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.
level | Level of the model to search. The level goes from 0 to GetZCount()-1. |
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.
index | The index (position) of the block (from 0 to GetSize()-1). |
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.
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.
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.
bool delphos::BlockModel::Regularize | ( | ) |
Regularize a non regular block model.
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.
column | The name of the column to be removed. |
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).
mod_file_name | The name (path) of the file in which will be saved the Block Model. |
tonCol | The name of the column that corresponds to the tonnage attribute. |
precision | The number of digits after the decimal point to be used for writing. |
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).
mod_file_name | The name (path) of the file in which will be saved the Block Model. |
tonCol | The name of the column that corresponds to the tonnage attribute. |
mcafCol | The name of the column that corresponds to the positional adjustment factor on the block mining cost attribute. |
pcafCol | The name of the column that corresponds to the positional adjustment factor on the block process cost attribute. |
precision | The number of digits after the decimal point to be used for writing. |
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.
bm_file_name | The name of the file in which will be saved the Block Model. |
precision | The number of digit after the decimal point. |
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.
bm_file_name | The name (path) of the output file. |
columns | The names of the columns attributes that will be written. |
precision | The number of digits after the decimal point. |
delim | The delimiter used to separate columns in the file. |
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.
vtk_file_name | The name of the file in which the BlockModel instance will be written. |
columns | The columns name of the columns attributes that will be saved. |
precision | The number of digits after the decimal point. |
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.
vtk_file_name | The name (path) of the file in which the BlockModel will be written. |
filtercolumn | The 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. |
li | The lowest value to filter. |
ls | The highest value to filter. |
column | The column to save. |
precision | The number of digits after the decimal point to be used for writing. |
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.
|
virtual |
Saves the given columns of the BlockModel instance to the given text file in the Unregular Grid View of the VTK format.
vtk_file_name | The name (path) of the file in which will be saved the Block Model in the vtk format. |
filtercolumn | The 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. |
li | The lowest value to filter. |
ls | The highest value to filter. |
columns | The columns name of the columns attributes that will be saved. |
precision | The number of digits after the decimal point to be used for writing. |
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.
[in] | filtercolumn | The 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] | li | The lowest value to filter. |
[in] | ls | The highest value to filter. |
[in] | column | The column to save. |
[out] | DIMX | Number of block of the block model in X |
[out] | DIMY | Number of block of the block model in Y |
[out] | DIMZ | Number of block of the block model in Z |
[out] | THRESOLD | Variable where SaveToVtkScalarsArray will return a check value |
[out] | BMXINF | Lowest X coordinate in the model |
[out] | BMYINF | Lowest Y coordinate in the model |
[out] | BMZINF | Lowest Z coordinate in the model |
[out] | BMXSUP | Largest X coordinate in the model |
[out] | BMYSUP | Largest Y coordinate in the model |
[out] | BMZSUP | Largest Z coordinate in the model |
[in] | precision | The number of digits after the decimal point to be used for writing. |
The precision default value is set to 4 to fit Vulcan data.
If the model is not regular an exception is thrown.
|
virtual |
Sets the coordinates of a block referenced by an index.
index | The position of the block (from 0 to Size()-1) in the BlockModel instance. |
c | The 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.
index | Position of the block (from 0 to Size()-1) |
x | The new \(x\) coordinate value for the block |
y | The new \(y\) coordinate value for the block |
z | The 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.
index | The index (position) of the block. From 0 to Size()-1. |
column | The name of the attribute to be set. |
value | The 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.
index | The index (position) of the block. From 0 to Size()-1. |
columnpos | The column position of the attribute to be set. |
value | The value to which the attribute will be set. |
|
virtual |
Returns the number of blocks in the BlockModel instance.
delphos::BlockModel * delphos::BlockModel::SubBlockModel | ( | delphos::BlockSelection * | bs | ) |
Generates a new BlockModel instance from a BlockSelection instance.
bs | A BlockSelection instance from which the new BlockModel instance will be created. |
BlockModel * delphos::BlockModel::SubBlockModel | ( | const delphos::BlockFilter & | bf | ) |
Generates a new BlockModel instance filtering the current one using the BlockFilter::eval function.
bf | The BlockFilter instance. |
bool delphos::BlockModel::UnRegularize | ( | ) |
Unregularize a regular block model.
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.
index | The index (position) of the block (from 0 to Size()-1). |
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.
index | The index (position) of the block (from 0 to Size()-1). |
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.
index | The index (position) of the block (from 0 to Size()-1). |
If there is no block that matching the given index, an exception is thrown.