Flumy [Free API]
Process based model for meandering chanelized systems
Public Member Functions | List of all members
Topo Class Reference

Storage class used to alterate or get domain topography. More...

Inheritance diagram for Topo:
GridReal GridParams

Detailed Description

Storage class used to alterate or get domain topography.

This class store a grid of real positive or negative elevation values.
All values (in meters) are geographical referenced (including Domain grid elevation offset)

Three file formats can be read:

Look at the User Manual for further details about importing topography.

Public Member Functions

 Topo ()
 Default constructor. More...
 
 Topo (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=0.)
 Constructor using 2D grid parameters. More...
 
 Topo (const GridParams &grid)
 Constructor build from another grid (use it to make Topography and Domain compatible).
This is not a copy constructor! More...
 
 Topo (const GridParams &grid, const MP_real &val)
 Constructor build from another grid (use it to make Topography and Domain compatible).
This is not a copy constructor! More...
 
virtual ~Topo ()
 Destructor. More...
 
- Public Member Functions inherited from GridReal
 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...
 
GridRealoperator= (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...
 
GridParamsoperator= (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...
 
Point2Drel2Geo (Point2D &point) const
 
Point2Drel2Grid (Point2D &point, bool round=true) const
 
Point2Dgeo2Rel (Point2D &point) const
 
Point2Dgeo2Grid (Point2D &point, bool round=true) const
 
Point2Dgrid2Rel (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
 

Additional Inherited Members

- Static Public Member Functions inherited from GridReal
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 inherited from GridReal
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 inherited from GridReal
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
 

Constructor & Destructor Documentation

◆ Topo() [1/4]

Topo::Topo ( )

Default constructor.

◆ Topo() [2/4]

Topo::Topo ( 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 = 0. 
)

Constructor using 2D grid parameters.

◆ Topo() [3/4]

Topo::Topo ( const GridParams grid)

Constructor build from another grid (use it to make Topography and Domain compatible).
This is not a copy constructor!

◆ Topo() [4/4]

Topo::Topo ( const GridParams grid,
const MP_real &  val 
)

Constructor build from another grid (use it to make Topography and Domain compatible).
This is not a copy constructor!

◆ ~Topo()

virtual Topo::~Topo ( )
inlinevirtual

Destructor.