33 #ifndef __H__UG_raster
34 #define __H__UG_raster
72 template <
class T,
int TDIM>
87 for(
size_t d = 0; d < TDIM; ++d){
117 for(
size_t d = 0; d < TDIM; ++d){
231 template <
class TKernel>
232 typename TKernel::result_t
248 template <
class TKernel>
262 template <
class TKernel>
263 typename TKernel::result_t
279 template <
class TKernel>
307 template <
class TKernel>
310 template <
class TKernel>
315 int curDim = TDIM - 1,
316 size_t curVal = 0)
const;
325 int curDim = TDIM)
const;
a mathematical Vector with N entries.
Definition: math_vector.h:97
Coordinate & operator-=(const Coordinate &c)
Definition: raster_impl.hpp:155
Coordinate()
Definition: raster_impl.hpp:97
Coordinate & operator*=(number s)
Definition: raster_impl.hpp:163
number & operator[](int d)
Definition: raster_impl.hpp:133
number m_coord[TDIM]
Definition: raster.h:127
Coordinate & operator+=(const Coordinate &c)
Definition: raster_impl.hpp:147
friend std::ostream & operator<<(std::ostream &o, const Coordinate &coord)
Definition: raster.h:114
int dim() const
Definition: raster_impl.hpp:117
void set(number c)
Definition: raster_impl.hpp:124
size_t m_ind[TDIM]
Definition: raster.h:97
friend std::ostream & operator<<(std::ostream &o, const MultiIndex &mi)
Definition: raster.h:84
int dim() const
Definition: raster_impl.hpp:64
void set(size_t i)
Definition: raster_impl.hpp:71
MultiIndex()
Definition: raster_impl.hpp:52
size_t & operator[](int d)
Definition: raster_impl.hpp:79
Generic raster for arbitrary dimensions.
Definition: raster.h:73
void set_cursor(int dim, number coord)
Set the coordinate of the cursor. The cursor can be used to interpolate values.
Definition: raster_impl.hpp:613
T & node_value(const MultiIndex &mi)
returns the value at the given multi-index (read/write)
Definition: raster_impl.hpp:353
Raster()
Creates an empty raster that has to be initialized before use.
Definition: raster_impl.hpp:176
size_t num_nodes_total() const
returns the total number of nodes in the raster
Definition: raster_impl.hpp:313
void select_node(int dim, size_t index)
Select a node. 'selected_node_value' provides read/write access to the selected node.
Definition: raster_impl.hpp:583
const Coordinate & min_corner() const
returns the min-corner of the raster
Definition: raster_impl.hpp:382
void set_num_nodes(int dim, size_t num)
sets the number of nodes that shall be used by the raster.
Definition: raster_impl.hpp:295
MultiIndex m_selNode
Definition: raster.h:329
void blur(T alpha, size_t iterations)
blurs (smoothens) the values by repeatedly averaging between direct neighbors
Definition: raster_impl.hpp:490
Coordinate m_extension
Definition: raster.h:331
T interpolate_linear(const MultiIndex &minNodeInd, Coordinate &localCoord, int curDim=TDIM) const
Definition: raster_impl.hpp:908
void update_num_nodes_total()
Definition: raster_impl.hpp:880
Coordinate m_cursor
Definition: raster.h:333
T * m_data
Definition: raster.h:327
TKernel::result_t run_on_all()
Creates and runs the specified kernel on all nodes and returns its result.
Definition: raster_impl.hpp:503
TKernel::result_t run_on_nbrs(const MultiIndex ¢er)
Creates and runs the specified kernel on all direct neighbors of a node and returns its result.
Definition: raster_impl.hpp:542
void load_from_asc(const char *filename)
Definition: raster_impl.hpp:636
T no_data_value() const
returns the value that shall be considered 'no-data-value'
Definition: raster_impl.hpp:482
void set_min_corner(int dim, number coord)
sets the min corner of the raster. Used for interpolation at cursor.
Definition: raster_impl.hpp:368
T interpolate_at_cursor(int order) const
interpolates the value with the given order at the cursor position
Definition: raster_impl.hpp:628
MultiIndex m_numNodes
Definition: raster.h:328
void set_extension(int dim, number ext)
sets the extension of the raster. Used for interpolation at cursor.
Definition: raster_impl.hpp:396
Coordinate m_cellExtension
Definition: raster.h:332
void set_no_data_value(T val)
sets the value that shall be considered as 'no-data-value'
Definition: raster_impl.hpp:475
T m_noDataValue
Definition: raster.h:335
~Raster()
Definition: raster_impl.hpp:259
void create()
creates the raster. Call this method after 'set_num_nodes' has been called for each dimension.
Definition: raster_impl.hpp:335
size_t m_numNodesTotal
Definition: raster.h:334
void set_num_nodes(const MultiIndex &mi)
size_t data_index(const MultiIndex &mi, int curDim=TDIM - 1, size_t curVal=0) const
Definition: raster_impl.hpp:869
T selected_node_value() const
returns the value of the selected node
Definition: raster_impl.hpp:605
Coordinate m_minCorner
Definition: raster.h:330
T interpolate(const Coordinate &coord, int order) const
interpolates the value with the given order at the given coordinate
Definition: raster_impl.hpp:427
Raster & operator=(const Raster &raster)
Definition: raster_impl.hpp:267
void update_cell_extension()
Definition: raster_impl.hpp:889
const Coordinate & extension() const
returns the extension of the raster
Definition: raster_impl.hpp:412
const MultiIndex & num_nodes() const
returns the number of nodes for each dimension in a multi-index.
Definition: raster_impl.hpp:327
void set_selected_node_value(T val)
sets the value of the selected node
Definition: raster_impl.hpp:598
void save_to_asc(const char *filename) const
Definition: raster_impl.hpp:799
int dim() const
Definition: raster_impl.hpp:288
double number
Definition: types.h:124