Flumy [Free API]
Process based model for meandering chanelized systems
|
Base class for 2D grid containing real values. More...
Base class for 2D grid containing real values.
This class stores real values for each node of a grid.
Public Member Functions | |
GridReal () | |
Default constructor. More... | |
GridReal (const MP_real &dx, const MP_real &dy, const MP_int &nx, const MP_int &ny, const MP_real &ox=0., const MP_real &oy=0., const MP_real &val=MP_UNKNOWN_REAL_VALUE) | |
Constructor from 2D grid parameters which fills the grid with the given real value. More... | |
GridReal (const MP_real &dx, const MP_real &dy, const MP_real &dz, const MP_int &nx, const MP_int &ny, const MP_int &nz, const MP_real &ox=0., const MP_real &oy=0., const MP_real &oz=0., const MP_real &val=MP_UNKNOWN_REAL_VALUE) | |
Constructor from 3D grid parameters which fills the grid with the given real value. More... | |
GridReal (const std::vector< std::vector< MP_real > > &values) | |
Constructor from a 2D array of real values. More... | |
GridReal (const GridParams &grid) | |
Constructor build from another grid (use it to copy another grid parameters). This is not a copy constructor! More... | |
GridReal (const GridParams &grid, const MP_real &val) | |
Constructor build from another grid (use it to copy another grid parameters). This is not a copy constructor! More... | |
GridReal (const GridReal &grid) | |
Copy constructor. More... | |
virtual | ~GridReal () |
Destructor. More... | |
GridReal & | operator= (const GridReal &gridc) |
Assignment operator. More... | |
virtual void | reset (const GridParams &grid) override |
Reset 2D grid parameters to new values. More... | |
virtual void | reset (const MP_real &dx, const MP_real &dy, const MP_int &nx, const MP_int &ny, const MP_real &ox=0., const MP_real &oy=0., const MP_real &val=MP_UNKNOWN_REAL_VALUE) |
Reset 2D grid parameters to new values and fill the grid with a new real value. More... | |
virtual void | reset (const MP_real &dx, const MP_real &dy, const MP_real &dz, const MP_int &nx, const MP_int &ny, const MP_int &nz, const MP_real &ox=0., const MP_real &oy=0., const MP_real &oz=0., const MP_real &val=MP_UNKNOWN_REAL_VALUE) |
Reset 3D grid parameters to new values and fill the grid with a new real value. More... | |
virtual bool | check (MP_real &val, bool correct=true) const |
Check the input value (and correct it if needed) More... | |
virtual void | fill (const MP_real &val) |
Fill the grid with a new real value. More... | |
virtual void | fill_2D (const std::vector< std::vector< MP_real > > &values) |
Fill the grid with a 2D array of real values. More... | |
virtual void | fill_yxz (const MP_int size, const MP_real values[]) |
Fill the grid with an array of real values (sorted by z then x then y, e.g. iy increasing first) Size of the array must be equal to nx * ny * nz. More... | |
virtual void | fill_zyx (const MP_int size, const MP_real values[]) |
Fill the grid with an array of real values (sorted by y then x then z, e.g. iz increasing first) Size of the array must be equal to nx * ny * nz. More... | |
virtual bool | get_at (MP_int &size, MP_real values[]) const |
Retrieve the grid values in an array of real values (sorted by z then x then y) Size of the array must be equal to nx * ny * nz. More... | |
virtual bool | set_at (const MP_int &ix, const MP_int &iy, const MP_real &val) |
Set the node[ix,iy] value of the grid (if grid is 3D, fill all pillar nodes) More... | |
virtual bool | set_at (const MP_int &ix, const MP_int &iy, const MP_int &iz, const MP_real &val) |
Set the node[ix,iy,iz] value of the grid. More... | |
virtual bool | get_at (const MP_int &ix, const MP_int &iy, MP_real &val) const |
Retrieve the node[ix,iy] value of the grid (if grid is 3D, retrieve first pillar node) More... | |
virtual bool | get_at (const MP_int &ix, const MP_int &iy, RealList &val) const |
Retrieve the vertical values list at node [ix,iy]. More... | |
virtual bool | get_at (const MP_int &ix, const MP_int &iy, const MP_int &iz, MP_real &val) const |
Retrieve the node[ix,iy,iz] value of the grid. More... | |
virtual bool | write (const MP_string &filename, const iTracer *tracer, const GridFileFormat &format=GFF_F2G, const MP_string &order=MP_DEFAULT_CELLS_ORDER) const |
Write all grid node values into a file (see User Manual Appendices for the file format) More... | |
virtual bool | read (const MP_string &filename) |
Read all grid node values from a file (see User Manual Appendices for the file format) More... | |
const RealList & | get_values () const |
Retrieve all grid values in a vector (order is +X +Y +Z, e.g. ix increasing first) More... | |
RealList | get_values_zyx () const |
Retrieve all grid values in a vector (order is +Z +Y +X, e.g. iz increasing first) (same as getRegular) More... | |
MP_real | get_mean () const |
Retrieve the grid mean value. More... | |
MP_real | get_min () const |
Retrieve the grid min value (keep get_ prefix to avoid conflict under windows) More... | |
MP_real | get_max () const |
Retrieve the grid max value (keep get_ prefix to avoid conflict under windows) More... | |
MP_real | get_min (MP_int &ix, MP_int &iy) const |
Retrieve the grid min value and location (keep get_ prefix to avoid conflict under windows) More... | |
MP_real | get_max (MP_int &ix, MP_int &iy) const |
Retrieve the grid max value and location (keep get_ prefix to avoid conflict under windows) More... | |
MP_int | get_nb_positive () const |
Retrieve the number of positive cells. More... | |
MP_int | get_nb_negative () const |
Retrieve the number of negative cells. More... | |
bool | add_variable (GridReal *aux) |
Add an auxiliary variable to the current grid (grids must be compatible) More... | |
void | set_name (const MP_string &name) |
Set the variable name. More... | |
const MP_string & | get_name () const |
Return the name of the variable. More... | |
void | set_undef_string (const MP_string &undef) |
Set the undefined string. More... | |
const MP_string & | get_undef_string () const |
Return the undefined string of the variable. More... | |
void | set_undef_value (const MP_real undef) |
Set the undefined value. More... | |
const MP_real & | get_undef_value () const |
Return the undefined value of the variable. More... | |
const MP_string & | last_error () const |
Return last error message. More... | |
Public Member Functions inherited from GridParams | |
GridParams () | |
Default constructor. More... | |
GridParams (const MP_real &dx, const MP_real &dy, const MP_int &nx, const MP_int &ny, const MP_real &ox=0., const MP_real &oy=0.) | |
Constructor from 2D grid parameters. More... | |
GridParams (const MP_real &dx, const MP_real &dy, const MP_real &dz, const MP_int &nx, const MP_int &ny, const MP_int &nz, const MP_real &ox=0., const MP_real &oy=0., const MP_real &oz=0.) | |
Constructor from 3D grid parameters. More... | |
GridParams (const GridParams &grid) | |
Copy constructor. More... | |
virtual | ~GridParams () |
Destructor. More... | |
GridParams & | operator= (const GridParams &) |
Operator =. More... | |
void | reset (const MP_real &dx, const MP_real &dy, const MP_int &nx, const MP_int &ny, const MP_real &ox=0., const MP_real &oy=0.) |
Reset 2D grid parameters to new values. More... | |
void | reset (const MP_real &dx, const MP_real &dy, const MP_real &dz, const MP_int &nx, const MP_int &ny, const MP_int &nz, const MP_real &ox=0., const MP_real &oy=0., const MP_real &oz=0.) |
Reset 3D grid parameters to new values. More... | |
MP_real | getDx () const |
Assessor get to protected member variable _dx. More... | |
MP_real | getDy () const |
Assessor get to protected member variable _dy. More... | |
MP_real | getDz () const |
Assessor get to protected member variable _dz. More... | |
MP_int | getNx () const |
Assessor get to protected member variable _nx. More... | |
MP_int | getNy () const |
Assessor get to protected member variable _ny. More... | |
MP_int | getNz () const |
Assessor get to protected member variable _nz. More... | |
MP_real | getOx () const |
Assessor get to protected member variable _ox. More... | |
MP_real | getOy () const |
Assessor get to protected member variable _oy. More... | |
MP_real | getOz () const |
Assessor get to protected member variable _oz. More... | |
Point2D | getOrigin () const |
Assessor get to origin 2D point _ox,_oy. More... | |
MP_int | getNbNodes () const |
Return the number of grid nodes. More... | |
void | getApexRel (Point2D &p1, Point2D &p2, Point2D &p3, Point2D &p4) const |
Return the 4 apex relative points. More... | |
void | setLocation (const MP_real &x, const MP_real &y, const MP_real &z=0.) |
Localize the grid in the geographical system. More... | |
void | setLocation (const Point3D &location) |
Localize the grid in the geographical system. More... | |
void | setLocation (const Point2D &location) |
Localize the grid in the geographical system. More... | |
const Point3D & | getLocation () const |
Return the location of the grid. More... | |
MP_real | getZLoc () const |
Assessor get location elevation. More... | |
void | setRotation (const MP_real &rot) |
Rotate the grid around z-axis in the geographical system. More... | |
MP_real | getRotation () const |
MP_real | getLength () const |
Return total length of the grid (in meters). It corresponds to the grid size along abscissa axis Ox. More... | |
MP_real | getWidth () const |
Return total width of the grid (in meters). It corresponds to the grid size along ordinate axis Oy. More... | |
MP_real | getHeight () const |
Return total height of the grid (in meters). It corresponds to the grid size along elevation axis Oz. More... | |
bool | is3D () const |
Return true if the grid has 3 dimensions (nz > 1 and dz < MP_MAX_REAL_VALUE) More... | |
bool | isCompatibleWith (const GridParams &grid, bool check_geo=false) const |
Return true if the given grid has same parameters. More... | |
Point2D & | rel2Geo (Point2D &point) const |
Point2D & | rel2Grid (Point2D &point, bool round=true) const |
Point2D & | geo2Rel (Point2D &point) const |
Point2D & | geo2Grid (Point2D &point, bool round=true) const |
Point2D & | grid2Rel (Point2D &point) const |
Point2D | grid2Rel (const MP_int &ix, const MP_int &iy) const |
Point2D | grid2Geo (const MP_int &ix, const MP_int &iy) const |
Point3D & | rel2Geo (Point3D &point) const |
Point3D & | geo2Rel (Point3D &point) const |
ConvexPolyedra2D & | rel2Grid (ConvexPolyedra2D &polyedra) const |
ConvexPolyedra2D & | grid2Rel (ConvexPolyedra2D &polyedra) const |
bool | is_on_grid (const Point2D &point) const |
bool | is_on_grid_nearest (const Point2D &point) const |
Static Public Member Functions | |
static bool | is_order_valid (const MP_string &order) |
Test if an "order string" is valid. More... | |
static bool | is_order_valid (const MP_string &order, MP_string &order1, MP_string &order2, MP_string &order3) |
Test if an "order string" is valid. More... | |
static bool | is_order_valid (const MP_string &order1, const MP_string &order2, const MP_string &order3) |
Test if an "order string" is valid. More... | |
static GridFileFormat | get_format (const MP_string &filename) |
Return the Ascii format of the given grid file. More... | |
static MP_string | get_format_label (const GridFileFormat &format) |
Return the Ascii format label for the given format id. More... | |
Protected Member Functions | |
bool | write_gslib (const MP_string &filename, const iTracer *tracer) const |
Write all grid node values into an GSLIB formated file (see User Manual Appendices for the file format) More... | |
bool | write_ascii (const MP_string &filename, const iTracer *tracer) const |
Write all grid node values into an ASCII formated file (see User Manual Appendices for the file format) More... | |
bool | write_f2g (const MP_string &filename, const iTracer *tracer, const MP_string &order=MP_DEFAULT_CELLS_ORDER) const |
Write all grid node values into an F2F formated file (see User Manual Appendices for the file format) More... | |
bool | write_values (std::ofstream &os, const iTracer *tracer, const MP_string &order=MP_DEFAULT_CELLS_ORDER) const |
Write values in the given output stream and in the given order. More... | |
bool | read_cps3 (const MP_string &filename) |
Read all grid node values from a CPS-3 formated file (see User Manual Appendices for the file format) More... | |
bool | read_gslib (const MP_string &filename) |
Read all grid node values from a GSLIB formated file (see User Manual Appendices for the file format) More... | |
bool | read_ascii (const MP_string &filename) |
Read all grid node values from an ASCII formated file (see User Manual Appendices for the file format) More... | |
bool | read_f2g (const MP_string &filename) |
Read all grid node values from an F2G formatted file (see User Manual Appendices for the file format) More... | |
Protected Attributes | |
RealList | _values |
Grid values (at any time, vector size should be _nx*_ny*_nz) More... | |
MP_real | _min |
Minimum and maximum of values. More... | |
MP_real | _max |
MP_int | _ixmin |
Minimum and maximum location. More... | |
MP_int | _iymin |
MP_int | _ixmax |
MP_int | _iymax |
std::vector< GridReal * > | _aux |
Auxiliary grids (at any time, these grids must contain the same number of elements) More... | |
MP_string | _name |
Variable name. More... | |
MP_string | _undef_string |
Undefined string. More... | |
MP_real | _undef_value |
Undefined value. More... | |
MP_string | _last_error |
Last error message. More... | |
Protected Attributes inherited from GridParams | |
MP_real | _dx |
Mesh size (m) along abscissa axis Ox (must be greater than 0) More... | |
MP_real | _dy |
Mesh size (m) along ordinate axis Oy (must be greater than 0) More... | |
MP_real | _dz |
Mesh size (m) along elevation axis Oz (must be greater than 0) More... | |
MP_int | _nx |
Number of nodes along abscissa axis Ox (must be greater than 0) More... | |
MP_int | _ny |
Number of nodes along ordinate axis Oy (must be greater than 0) More... | |
MP_int | _nz |
Number of nodes along elevation axis Oz (must be greater than 0) More... | |
MP_real | _ox |
Origin offset along x-axis (m) More... | |
MP_real | _oy |
Origin offset along y-axis (m) More... | |
MP_real | _oz |
Origin offset along z-axis (m) More... | |
Point3D | _location |
Front bottom left corner (m) of the grid (Geographical Location) More... | |
MP_real | _rotation |
MP_real | _cosrot |
MP_real | _sinrot |
GridReal::GridReal | ( | ) |
Default constructor.
GridReal::GridReal | ( | const MP_real & | dx, |
const MP_real & | dy, | ||
const MP_int & | nx, | ||
const MP_int & | ny, | ||
const MP_real & | ox = 0. , |
||
const MP_real & | oy = 0. , |
||
const MP_real & | val = MP_UNKNOWN_REAL_VALUE |
||
) |
Constructor from 2D grid parameters which fills the grid with the given real value.
GridReal::GridReal | ( | const MP_real & | dx, |
const MP_real & | dy, | ||
const MP_real & | dz, | ||
const MP_int & | nx, | ||
const MP_int & | ny, | ||
const MP_int & | nz, | ||
const MP_real & | ox = 0. , |
||
const MP_real & | oy = 0. , |
||
const MP_real & | oz = 0. , |
||
const MP_real & | val = MP_UNKNOWN_REAL_VALUE |
||
) |
Constructor from 3D grid parameters which fills the grid with the given real value.
GridReal::GridReal | ( | const std::vector< std::vector< MP_real > > & | values | ) |
Constructor from a 2D array of real values.
GridReal::GridReal | ( | const GridParams & | grid | ) |
Constructor build from another grid (use it to copy another grid parameters).
This is not a copy constructor!
GridReal::GridReal | ( | const GridParams & | grid, |
const MP_real & | val | ||
) |
Constructor build from another grid (use it to copy another grid parameters).
This is not a copy constructor!
GridReal::GridReal | ( | const GridReal & | grid | ) |
Copy constructor.
|
inlinevirtual |
Destructor.
bool GridReal::add_variable | ( | GridReal * | aux | ) |
Add an auxiliary variable to the current grid (grids must be compatible)
|
virtual |
Check the input value (and correct it if needed)
|
virtual |
Fill the grid with a new real value.
|
virtual |
Fill the grid with a 2D array of real values.
|
virtual |
Fill the grid with an array of real values (sorted by z then x then y, e.g. iy increasing first) Size of the array must be equal to nx * ny * nz.
|
virtual |
Fill the grid with an array of real values (sorted by y then x then z, e.g. iz increasing first) Size of the array must be equal to nx * ny * nz.
|
virtual |
Retrieve the node[ix,iy,iz] value of the grid.
|
virtual |
Retrieve the node[ix,iy] value of the grid (if grid is 3D, retrieve first pillar node)
|
virtual |
Retrieve the vertical values list at node [ix,iy].
|
virtual |
Retrieve the grid values in an array of real values (sorted by z then x then y) Size of the array must be equal to nx * ny * nz.
|
static |
Return the Ascii format of the given grid file.
|
static |
Return the Ascii format label for the given format id.
|
inline |
Retrieve the grid max value (keep get_ prefix to avoid conflict under windows)
MP_real GridReal::get_max | ( | MP_int & | ix, |
MP_int & | iy | ||
) | const |
Retrieve the grid max value and location (keep get_ prefix to avoid conflict under windows)
MP_real GridReal::get_mean | ( | ) | const |
Retrieve the grid mean value.
|
inline |
Retrieve the grid min value (keep get_ prefix to avoid conflict under windows)
MP_real GridReal::get_min | ( | MP_int & | ix, |
MP_int & | iy | ||
) | const |
Retrieve the grid min value and location (keep get_ prefix to avoid conflict under windows)
|
inline |
Return the name of the variable.
MP_int GridReal::get_nb_negative | ( | ) | const |
Retrieve the number of negative cells.
MP_int GridReal::get_nb_positive | ( | ) | const |
Retrieve the number of positive cells.
|
inline |
Return the undefined string of the variable.
|
inline |
Return the undefined value of the variable.
|
inline |
Retrieve all grid values in a vector (order is +X +Y +Z, e.g. ix increasing first)
RealList GridReal::get_values_zyx | ( | ) | const |
Retrieve all grid values in a vector (order is +Z +Y +X, e.g. iz increasing first) (same as getRegular)
|
static |
Test if an "order string" is valid.
|
static |
Test if an "order string" is valid.
|
static |
Test if an "order string" is valid.
|
inline |
Return last error message.
|
virtual |
Read all grid node values from a file (see User Manual Appendices for the file format)
|
protected |
Read all grid node values from an ASCII formated file (see User Manual Appendices for the file format)
|
protected |
Read all grid node values from a CPS-3 formated file (see User Manual Appendices for the file format)
|
protected |
Read all grid node values from an F2G formatted file (see User Manual Appendices for the file format)
|
protected |
Read all grid node values from a GSLIB formated file (see User Manual Appendices for the file format)
|
overridevirtual |
Reset 2D grid parameters to new values.
Reimplemented from GridParams.
|
virtual |
Reset 2D grid parameters to new values and fill the grid with a new real value.
|
virtual |
Reset 3D grid parameters to new values and fill the grid with a new real value.
|
virtual |
Set the node[ix,iy,iz] value of the grid.
|
virtual |
Set the node[ix,iy] value of the grid (if grid is 3D, fill all pillar nodes)
|
inline |
Set the variable name.
|
inline |
Set the undefined string.
|
inline |
Set the undefined value.
|
virtual |
Write all grid node values into a file (see User Manual Appendices for the file format)
|
protected |
Write all grid node values into an ASCII formated file (see User Manual Appendices for the file format)
|
protected |
Write all grid node values into an F2F formated file (see User Manual Appendices for the file format)
|
protected |
Write all grid node values into an GSLIB formated file (see User Manual Appendices for the file format)
|
protected |
Write values in the given output stream and in the given order.
|
protected |
Auxiliary grids (at any time, these grids must contain the same number of elements)
|
protected |
|
protected |
Minimum and maximum location.
|
protected |
|
protected |
|
mutableprotected |
Last error message.
|
protected |
|
protected |
Minimum and maximum of values.
|
protected |
Variable name.
|
protected |
Undefined string.
|
protected |
Undefined value.
|
protected |
Grid values (at any time, vector size should be _nx*_ny*_nz)