ScalarView Class Reference

Visualizes a scalar PDE solution. More...

#include <scalar_view.h>

Inherits View.

Inherited by BaseView.

List of all members.

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.
VertexNodeInfofind_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< VertexNodeInfovertex_nodes
 Vertex nodes. Sorted accordin to the X-axis.
VertexNodeInfopointed_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< ElementInfoelement_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.
double3normals

Detailed Description

Visualizes a scalar PDE solution.

ScalarView is a visualization window for all scalar-valued PDE solutions.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

ScalarView::ScalarView ( const char *  title = "ScalarView",
DEFAULT_WINDOW_POS   
)
ScalarView::~ScalarView (  )  [virtual]

Member Function Documentation

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_tri_contours ( double3 vert,
int3 tri 
) [protected]
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]

Reimplemented from View.

Reimplemented in BaseView.

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]

Reimplemented from View.

Reimplemented in BaseView.

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.


Member Data Documentation

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.

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.

bool ScalarView::panning [protected]
bool ScalarView::pmode [protected]
unsigned int ScalarView::pointed_node_widget [protected]

> True if node selection is allowed

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

> 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]

The documentation for this class was generated from the following files:
Generated on Sat Jun 5 15:17:43 2010 for Hermes2D Library: Real Version by  doxygen 1.6.3