Visualizes a scalar PDE solution. More...
#include <scalar_view.h>
Inherits View.
Inherited by BaseView.
Classes | |
| struct | ElementInfo |
| < element info structure More... | |
| struct | GLVertex2 |
| < OpenGL vertex. Used to cache vertices prior rendering More... | |
| struct | SVGExportParams |
| struct | VertexNodeInfo |
| < Information about a vertex node. More... | |
Public Member Functions | |
| ScalarView (const char *title="ScalarView", DEFAULT_WINDOW_POS) | |
| virtual | ~ScalarView () |
| void | show (MeshFunction *sln, double eps=H2D_EPS_NORMAL, int item=H2D_FN_VAL_0, MeshFunction *xdisp=NULL, MeshFunction *ydisp=NULL, double dmult=1.0) |
| void | show_mesh (bool show=true) |
| void | show_contours (double step, double orig=0.0) |
| void | hide_contours () |
| void | set_3d_mode (bool enable=true) |
| void | load_data (const char *filename) |
| void | save_data (const char *filename) |
| void | save_numbered (const char *format, int number) |
| void | export_mesh_edges_svg (const char *filename, float width_mm=100.0f) |
| Exports mesh edges to SVG format. Height is calculated from input vertices. Function locks data. | |
Protected Types | |
| typedef void(* | DrawSingleEdgeCallback )(int inx_vert_a, int inx_vert_b, ScalarView *viewer, void *param) |
| A callback function that draws edge using specified vertex indices. Param is user supplied parameter. | |
Protected Member Functions | |
| H2D_API_USED_STL_VECTOR (VertexNodeInfo) | |
| void | init_vertex_nodes (Mesh *mesh) |
| Creates a copy of vertex nodes for purpose of displaying and selection. | |
| VertexNodeInfo * | find_nearest_node_in_range (float x, float y, float radius) |
| Finds nearest node in range. | |
| void | draw_vertex_nodes () |
| Draws vertex nodes. | |
| void | draw_single_vertex_node (const VertexNodeInfo &node) |
| Draws a single vertex node. | |
| void | create_nodes_widgets () |
| Creates vertex nodes widgets if not created already. | |
| H2D_API_USED_STL_VECTOR (ElementInfo) | |
| void | init_element_info (Mesh *mesh) |
| Creates element info from mesh. | |
| void | create_element_info_widgets () |
| Creates element ID widgets if not created already. | |
| void | draw_element_infos_2d () |
| Draws elements infos in 2D mode. | |
| virtual void | create_setup_bar () |
| create setup bar. Assumes that current window is set | |
| void | prepare_gl_geometry (const double value_min, const double value_irange) |
| prepares geometry in a form compatible with GL arrays; Data are updated if lin is updated. In a case of a failure (out of memory), gl_verts is NULL and an old OpenGL rendering method has to be used. | |
| void | draw_values_2d (const double value_min, const double value_irange) |
| draws values | |
| void | draw_edges_2d () |
| draws edges | |
| void | draw_normals_3d () |
| void | calculate_mesh_aabb (double *x_min, double *x_max, double *y_min, double *y_max) |
| Calculates AABB from edges. | |
| void | draw_edges (DrawSingleEdgeCallback draw_single_edge, void *param, bool boundary_only) |
| Draws edges of elements and boundary of mesh. Functions assumes that data are locked. | |
| virtual void | reset_view (bool force_reset) |
| Resets 2d and 3d view. | |
| virtual void | update_layout () |
| Updates layout, i.e., centers 2d and 3d mesh. | |
| void | draw_tri_contours (double3 *vert, int3 *tri) |
| void | calculate_normals (double3 *verts, int num_verts, int3 *tris, int num_tris) |
| Initializes normals. | |
| void | init_lighting () |
| void | update_mesh_info () |
| Updates mesh info. Assumes that data lock is locked. | |
| virtual void | on_display () |
| virtual void | on_key_down (unsigned char key, int x, int y) |
| virtual void | on_special_key (int key, int x, int y) |
| virtual void | on_mouse_move (int x, int y) |
| virtual void | on_right_mouse_down (int x, int y) |
| Handles selecting/deselecting of nodes. | |
| virtual void | on_middle_mouse_down (int x, int y) |
| virtual void | on_middle_mouse_up (int x, int y) |
| virtual const char * | get_help_text () const |
| virtual void | on_close () |
| virtual void | on_create (int output_id) |
| virtual void | on_left_mouse_down (int x, int y) |
| virtual void | on_left_mouse_up (int x, int y) |
| virtual void | on_right_mouse_up (int x, int y) |
| virtual void | on_reshape (int width, int height) |
Static Protected Member Functions | |
| static bool | compare_vertex_nodes_x (const VertexNodeInfo &a, const VertexNodeInfo &b) |
| Returns true, if a's X-axis coordinate is lower than b's one. Used to sort mesh nodes for searching purposes. | |
| static void | draw_svg_edge (int inx_vert_a, int inx_vert_b, ScalarView *viewer, void *param) |
| Draws edge specified by edge into SVG file given as parameter (type: SVGExportParams*). Functions assumes that data are locked. | |
| static void | draw_gl_edge (int inx_vert_a, int inx_vert_b, ScalarView *viewer, void *param) |
| Draws edge specified by edge indices using GL. Functions assumes that data are locked. | |
Protected Attributes | |
| std::vector< VertexNodeInfo > | vertex_nodes |
| Vertex nodes. Sorted accordin to the X-axis. | |
| VertexNodeInfo * | pointed_vertex_node |
| A vertex node that is under the mouse cursor. NULL if none. | |
| bool | allow_node_selection |
| unsigned int | pointed_node_widget |
| > True if node selection is allowed | |
| unsigned int | selected_node_widget |
| > A GL display-list denoting a pointed vertex node. The geometry assumes the size of a pixel is 1x1. | |
| const int | node_pixel_radius |
| > A GL display-list denoting a selected mesh node. The geometry assumes the size of a pixel is 1x1. | |
| const int | node_widget_vert_cnt |
| A number of vertices for a mesh node widget. | |
| std::vector< ElementInfo > | element_infos |
| Element info. | |
| unsigned int | element_id_widget |
| bool | show_element_info |
| > A GL display-list denoting a element ID widget. The geometry assumes the size of a pixel is 1x1. | |
| int | tw_wnd_id |
| tw window ID | |
| TwBar * | tw_setup_bar |
| setup bar | |
| Linearizer | lin |
| bool | lin_updated |
| true, if lin now contains new values | |
| unsigned int | gl_coord_buffer |
| Vertex coordinate buffer. (x,y,t). | |
| unsigned int | gl_index_buffer |
| Index data buffer. | |
| unsigned int | gl_edge_inx_buffer |
| A buffer for edge indices. The side of the buffer is H2DV_GL_MAX_EDGE_BUFFER pairs of indids. | |
| int | max_gl_verts |
| A maximum allocated number of vertices. | |
| int | max_gl_tris |
| A maximum allocated number of triangles. | |
| int | gl_tri_cnt |
| A number of OpenGL triangles. | |
| bool | show_values |
| true to show values | |
| bool | show_edges |
| true to show edges of mesh | |
| float | edges_color [3] |
| color of edges | |
| bool | contours |
| true to enable drawing of contours | |
| double | cont_orig |
| double | cont_step |
| contour settings. | |
| float | cont_color [3] |
| color of contours (RGB) | |
| bool | pmode |
| bool | mode3d |
| bool | panning |
| double | xrot |
| double | yrot |
| double | xtrans |
| double | ytrans |
| double | ztrans |
| double | xzscale |
| double | yscale |
| double | xctr |
| double | yctr |
| double | zctr |
| double | vertices_avg_value |
| Average value of a vertex. Used to center the mesh. | |
| double3 * | normals |
Visualizes a scalar PDE solution.
ScalarView is a visualization window for all scalar-valued PDE solutions.
typedef void(* ScalarView::DrawSingleEdgeCallback)(int inx_vert_a, int inx_vert_b, ScalarView *viewer, void *param) [protected] |
A callback function that draws edge using specified vertex indices. Param is user supplied parameter.
| ScalarView::ScalarView | ( | const char * | title = "ScalarView", |
|
| DEFAULT_WINDOW_POS | ||||
| ) |
| ScalarView::~ScalarView | ( | ) | [virtual] |
| void ScalarView::calculate_mesh_aabb | ( | double * | x_min, | |
| double * | x_max, | |||
| double * | y_min, | |||
| double * | y_max | |||
| ) | [protected] |
Calculates AABB from edges.
| void ScalarView::calculate_normals | ( | double3 * | verts, | |
| int | num_verts, | |||
| int3 * | tris, | |||
| int | num_tris | |||
| ) | [protected] |
Initializes normals.
| bool ScalarView::compare_vertex_nodes_x | ( | const VertexNodeInfo & | a, | |
| const VertexNodeInfo & | b | |||
| ) | [static, protected] |
Returns true, if a's X-axis coordinate is lower than b's one. Used to sort mesh nodes for searching purposes.
| void ScalarView::create_element_info_widgets | ( | ) | [protected] |
Creates element ID widgets if not created already.
| void ScalarView::create_nodes_widgets | ( | ) | [protected] |
Creates vertex nodes widgets if not created already.
| void ScalarView::create_setup_bar | ( | ) | [protected, virtual] |
create setup bar. Assumes that current window is set
| void ScalarView::draw_edges | ( | DrawSingleEdgeCallback | draw_single_edge, | |
| void * | param, | |||
| bool | boundary_only | |||
| ) | [protected] |
Draws edges of elements and boundary of mesh. Functions assumes that data are locked.
| void ScalarView::draw_edges_2d | ( | ) | [protected] |
draws edges
| void ScalarView::draw_element_infos_2d | ( | ) | [protected] |
Draws elements infos in 2D mode.
| void ScalarView::draw_gl_edge | ( | int | inx_vert_a, | |
| int | inx_vert_b, | |||
| ScalarView * | viewer, | |||
| void * | param | |||
| ) | [static, protected] |
Draws edge specified by edge indices using GL. Functions assumes that data are locked.
| void ScalarView::draw_normals_3d | ( | ) | [protected] |
| void ScalarView::draw_single_vertex_node | ( | const VertexNodeInfo & | node | ) | [protected] |
Draws a single vertex node.
| void ScalarView::draw_svg_edge | ( | int | inx_vert_a, | |
| int | inx_vert_b, | |||
| ScalarView * | viewer, | |||
| void * | param | |||
| ) | [static, protected] |
Draws edge specified by edge into SVG file given as parameter (type: SVGExportParams*). Functions assumes that data are locked.
| void ScalarView::draw_values_2d | ( | const double | value_min, | |
| const double | value_irange | |||
| ) | [protected] |
draws values
| void ScalarView::draw_vertex_nodes | ( | ) | [protected] |
Draws vertex nodes.
| void ScalarView::export_mesh_edges_svg | ( | const char * | filename, | |
| float | width_mm = 100.0f | |||
| ) |
Exports mesh edges to SVG format. Height is calculated from input vertices. Function locks data.
| ScalarView::VertexNodeInfo * ScalarView::find_nearest_node_in_range | ( | float | x, | |
| float | y, | |||
| float | radius | |||
| ) | [protected] |
Finds nearest node in range.
| const char * ScalarView::get_help_text | ( | ) | const [protected, virtual] |
| ScalarView::H2D_API_USED_STL_VECTOR | ( | ElementInfo | ) | [protected] |
| ScalarView::H2D_API_USED_STL_VECTOR | ( | VertexNodeInfo | ) | [protected] |
| void ScalarView::hide_contours | ( | ) | [inline] |
| void ScalarView::init_element_info | ( | Mesh * | mesh | ) | [protected] |
Creates element info from mesh.
| void ScalarView::init_lighting | ( | ) | [protected] |
| void ScalarView::init_vertex_nodes | ( | Mesh * | mesh | ) | [protected] |
Creates a copy of vertex nodes for purpose of displaying and selection.
| void ScalarView::load_data | ( | const char * | filename | ) |
| void ScalarView::on_close | ( | ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_create | ( | int | output_id | ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_display | ( | ) | [protected, virtual] |
Implements View.
| void ScalarView::on_key_down | ( | unsigned char | key, | |
| int | x, | |||
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_left_mouse_down | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_left_mouse_up | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_middle_mouse_down | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_middle_mouse_up | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_mouse_move | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_reshape | ( | int | width, | |
| int | height | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_right_mouse_down | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Handles selecting/deselecting of nodes.
Reimplemented from View.
| void ScalarView::on_right_mouse_up | ( | int | x, | |
| int | y | |||
| ) | [protected, virtual] |
Reimplemented from View.
| void ScalarView::on_special_key | ( | int | key, | |
| int | x, | |||
| int | y | |||
| ) | [protected, virtual] |
| void ScalarView::prepare_gl_geometry | ( | const double | value_min, | |
| const double | value_irange | |||
| ) | [protected] |
prepares geometry in a form compatible with GL arrays; Data are updated if lin is updated. In a case of a failure (out of memory), gl_verts is NULL and an old OpenGL rendering method has to be used.
| void ScalarView::reset_view | ( | bool | force_reset | ) | [protected, virtual] |
Resets 2d and 3d view.
Reimplemented from View.
| void ScalarView::save_data | ( | const char * | filename | ) |
| void ScalarView::save_numbered | ( | const char * | format, | |
| int | number | |||
| ) |
| void ScalarView::set_3d_mode | ( | bool | enable = true |
) | [inline] |
| void ScalarView::show | ( | MeshFunction * | sln, | |
| double | eps = H2D_EPS_NORMAL, |
|||
| int | item = H2D_FN_VAL_0, |
|||
| MeshFunction * | xdisp = NULL, |
|||
| MeshFunction * | ydisp = NULL, |
|||
| double | dmult = 1.0 | |||
| ) |
| void ScalarView::show_contours | ( | double | step, | |
| double | orig = 0.0 | |||
| ) |
| void ScalarView::show_mesh | ( | bool | show = true |
) | [inline] |
| void ScalarView::update_layout | ( | ) | [protected, virtual] |
Updates layout, i.e., centers 2d and 3d mesh.
Reimplemented from View.
| void ScalarView::update_mesh_info | ( | ) | [protected] |
Updates mesh info. Assumes that data lock is locked.
bool ScalarView::allow_node_selection [protected] |
float ScalarView::cont_color[3] [protected] |
color of contours (RGB)
double ScalarView::cont_orig [protected] |
double ScalarView::cont_step [protected] |
contour settings.
bool ScalarView::contours [protected] |
true to enable drawing of contours
float ScalarView::edges_color[3] [protected] |
color of edges
unsigned int ScalarView::element_id_widget [protected] |
std::vector<ElementInfo> ScalarView::element_infos [protected] |
Element info.
unsigned int ScalarView::gl_coord_buffer [protected] |
Vertex coordinate buffer. (x,y,t).
unsigned int ScalarView::gl_edge_inx_buffer [protected] |
A buffer for edge indices. The side of the buffer is H2DV_GL_MAX_EDGE_BUFFER pairs of indids.
unsigned int ScalarView::gl_index_buffer [protected] |
Index data buffer.
int ScalarView::gl_tri_cnt [protected] |
A number of OpenGL triangles.
Linearizer ScalarView::lin [protected] |
bool ScalarView::lin_updated [protected] |
true, if lin now contains new values
int ScalarView::max_gl_tris [protected] |
A maximum allocated number of triangles.
int ScalarView::max_gl_verts [protected] |
A maximum allocated number of vertices.
bool ScalarView::mode3d [protected] |
const int ScalarView::node_pixel_radius [protected] |
> A GL display-list denoting a selected mesh node. The geometry assumes the size of a pixel is 1x1.
A radius of node selection, in pixels.
const int ScalarView::node_widget_vert_cnt [protected] |
A number of vertices for a mesh node widget.
double3* ScalarView::normals [protected] |
bool ScalarView::panning [protected] |
bool ScalarView::pmode [protected] |
unsigned int ScalarView::pointed_node_widget [protected] |
> True if node selection is allowed
VertexNodeInfo* ScalarView::pointed_vertex_node [protected] |
A vertex node that is under the mouse cursor. NULL if none.
unsigned int ScalarView::selected_node_widget [protected] |
> A GL display-list denoting a pointed vertex node. The geometry assumes the size of a pixel is 1x1.
bool ScalarView::show_edges [protected] |
true to show edges of mesh
bool ScalarView::show_element_info [protected] |
> A GL display-list denoting a element ID widget. The geometry assumes the size of a pixel is 1x1.
true, to draw element info (currently ID) in 2D mode
bool ScalarView::show_values [protected] |
true to show values
TwBar* ScalarView::tw_setup_bar [protected] |
setup bar
int ScalarView::tw_wnd_id [protected] |
tw window ID
std::vector<VertexNodeInfo> ScalarView::vertex_nodes [protected] |
Vertex nodes. Sorted accordin to the X-axis.
double ScalarView::vertices_avg_value [protected] |
Average value of a vertex. Used to center the mesh.
double ScalarView::xctr [protected] |
double ScalarView::xrot [protected] |
double ScalarView::xtrans [protected] |
double ScalarView::xzscale [protected] |
double ScalarView::yctr [protected] |
double ScalarView::yrot [protected] |
double ScalarView::yscale [protected] |
double ScalarView::ytrans [protected] |
double ScalarView::zctr [protected] |
double ScalarView::ztrans [protected] |
1.6.3