Plugins
Loading...
Searching...
No Matches
ug::d3f::SegmentNetwork Class Reference

Represents a network of segments, like, e.g. a low dimensional river network. More...

#include <segment_network.h>

Public Types

typedef Grid::VertexAttachmentAccessor< gauge_attachment_tgauge_accessor_t
 
typedef Attachment< gauge_tgauge_attachment_t
 
typedef number gauge_t
 
typedef Grid::VertexAttachmentAccessor< position_attachment_tposition_accessor_t
 
typedef Attachment< vector_tposition_attachment_t
 
typedef vector2 vector_t
 

Public Member Functions

size_t find_vertices (std::vector< Vertex * > &vrtsOut, const vector_t &center, number radius) const
 finds the vertices in the specified sphere to vrtsOut
 
gauge_accessor_t gauge_accessor ()
 
gauge_attachment_t gauge_attachment ()
 
Gridgrid ()
 
void load_from_file (const char *name, number maxEdgeLen)
 loads a segment network from a grid file
 
position_accessor_t position_accessor ()
 
position_attachment_t position_attachment ()
 
void save_to_file (const char *name)
 saves the segment network into a file (mainly for plotting)
 
void save_to_file_with_ (gauge_accessor_t &z_acc, const char *name)
 saves the segment network into a file (mainly for plotting) using the given gauge values
 
 SegmentNetwork ()
 Constructor:
 
void set_gauge_values (SmartPtr< UserData< number, dim > > h)
 sets the gauge values from a UserData object
 
GridSubsetHandlersubset_handler ()
 
 ~SegmentNetwork ()
 Destructor:
 

Static Public Attributes

static const int dim = 3
 

Private Attributes

gauge_accessor_t m_aaGauge
 
position_accessor_t m_aaPos
 
gauge_attachment_t m_aGauge
 
position_attachment_t m_aPos
 
Grid m_grid
 
GridSubsetHandler m_SH
 

Detailed Description

Represents a network of segments, like, e.g. a low dimensional river network.

The class gives access to the two-dimensional coordinate of each vertex of the river and to the gauge at that vertex.

Note that this implementation should be used with 3d objects only!

Member Typedef Documentation

◆ gauge_accessor_t

◆ gauge_attachment_t

◆ gauge_t

◆ position_accessor_t

◆ position_attachment_t

◆ vector_t

Constructor & Destructor Documentation

◆ SegmentNetwork()

◆ ~SegmentNetwork()

ug::d3f::SegmentNetwork::~SegmentNetwork ( )
inline

Destructor:

Member Function Documentation

◆ find_vertices()

size_t ug::d3f::SegmentNetwork::find_vertices ( std::vector< Vertex * > &  vrtsOut,
const vector_t center,
number  radius 
) const

finds the vertices in the specified sphere to vrtsOut

Returns
returns the number of vertices found.

Finds the vertices in the specified sphere to vrtsOut

Returns
returns the number of vertices found.

References lg_end_for, lg_for_each_const, m_aaPos, m_grid, ug::sq(), and ug::VecDistanceSq().

◆ gauge_accessor()

gauge_accessor_t ug::d3f::SegmentNetwork::gauge_accessor ( )
inline

References m_aaGauge.

◆ gauge_attachment()

gauge_attachment_t ug::d3f::SegmentNetwork::gauge_attachment ( )
inline

References m_aGauge.

◆ grid()

Grid & ug::d3f::SegmentNetwork::grid ( )
inline

References m_grid.

◆ load_from_file()

void ug::d3f::SegmentNetwork::load_from_file ( const char *  name,
number  maxEdgeLen 
)

loads a segment network from a grid file

The last vertex coordinate is interpreted as gauge at each vertex. Upon load, the network is refined until all edges are shorter than maxEdgeLen. Note that the grid 3d coordinates are converted to the 2d (x,y)-coordinates and the gauge.

Parameters
namefile name to read from
maxEdgeLenmax. length of the edges to refine to

References ug::aPosition, ug::Grid::attach_to_edges(), ug::Grid::attach_to_vertices(), ug::Selector::clear(), ug::Grid::detach_from_edges(), ug::Grid::detach_from_vertices(), ug::EdgeLengthSq(), ug::Selector::empty(), lg_end_for, lg_for_each, ug::LoadGridFromFile(), m_aaGauge, m_aaPos, m_grid, m_SH, ug::Refine(), ug::ISelector::select(), ug::sq(), and UG_THROW.

Referenced by ug::d3f::RiverFunctionality3d::Independent().

◆ position_accessor()

position_accessor_t ug::d3f::SegmentNetwork::position_accessor ( )
inline

References m_aaPos.

◆ position_attachment()

position_attachment_t ug::d3f::SegmentNetwork::position_attachment ( )
inline

References m_aPos.

◆ save_to_file()

void ug::d3f::SegmentNetwork::save_to_file ( const char *  name)
inline

saves the segment network into a file (mainly for plotting)

Parameters
namefile name to write to

References m_aaGauge, and save_to_file_with_().

Referenced by ug::d3f::RiverFunctionality3d::Independent().

◆ save_to_file_with_()

void ug::d3f::SegmentNetwork::save_to_file_with_ ( gauge_accessor_t z_acc,
const char *  name 
)

saves the segment network into a file (mainly for plotting) using the given gauge values

Saves the segment grid to a file. The coordinates of the vertices are converted to (x,y,gauge) 3d coordinates.

Parameters
z_accto save in the z-coordinate
namefile name to write to

References ug::aPosition, ug::Grid::attach_to_vertices(), ug::Grid::detach_from_vertices(), lg_end_for, lg_for_each, m_aaPos, m_grid, and ug::SaveGridToFile().

Referenced by save_to_file().

◆ set_gauge_values()

void ug::d3f::SegmentNetwork::set_gauge_values ( SmartPtr< UserData< number, dim > >  h)

sets the gauge values from a UserData object

Sets the gauge values from a UserData object to the vertices of the segment grid. Note that the userdata object gets the old gauge value as the z coordinate and the subset id of the vertex.

Parameters
hthe data to write to the gauge at the vertices

References ug::ISubsetHandler::get_subset_index(), lg_end_for, lg_for_each, m_aaGauge, m_aaPos, m_grid, and m_SH.

Referenced by ug::d3f::RiverFunctionality3d::Independent().

◆ subset_handler()

GridSubsetHandler & ug::d3f::SegmentNetwork::subset_handler ( )
inline

References m_SH.

Member Data Documentation

◆ dim

const int ug::d3f::SegmentNetwork::dim = 3
static

◆ m_aaGauge

gauge_accessor_t ug::d3f::SegmentNetwork::m_aaGauge
private

◆ m_aaPos

◆ m_aGauge

gauge_attachment_t ug::d3f::SegmentNetwork::m_aGauge
private

Referenced by gauge_attachment(), and SegmentNetwork().

◆ m_aPos

position_attachment_t ug::d3f::SegmentNetwork::m_aPos
private

◆ m_grid

Grid ug::d3f::SegmentNetwork::m_grid
private

◆ m_SH

GridSubsetHandler ug::d3f::SegmentNetwork::m_SH
private

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