18 #ifndef __H2D_SCALAR_VIEW_H
19 #define __H2D_SCALAR_VIEW_H
56 throw Exceptions::Exception(
"Visualization of complex 2D solution is not possible, please use a filter that converts the solution into a real function, then display that one.");
59 void show_linearizer_data(
double eps,
int item = H2D_FN_VAL_0);
61 inline void show_mesh(
bool show =
true) { show_edges = show; refresh(); }
62 inline void show_bounding_box(
bool show =
true) { show_aabb = show; refresh(); }
63 void show_contours(
double step,
double orig = 0.0);
64 inline void hide_contours() { contours =
false; refresh(); }
65 void set_3d_mode(
bool enable =
true);
67 void set_vertical_scaling(
double sc);
69 void set_min_max_range(
double min,
double max);
72 virtual void reset_view(
bool force_reset);
95 ElementInfo() : x(0), y(0), width(0), height(0), id(-1) {};
96 ElementInfo(
int id,
float x,
float y,
float width,
float height) : x(x), y(y), width(width), height(height), id(id) {};
108 void init_element_info(MeshSharedPtr mesh);
110 void create_element_info_widgets();
112 void draw_element_infos_2d();
115 #define H2DV_GL_MAX_EDGE_BUFFER 128
123 GLVertex2(
float x,
float y,
float coord) : x(x), y(y), coord(coord) {};
125 static const size_t H2D_OFFSETOF_COORD = 2 *
sizeof(float);
143 void prepare_gl_geometry();
145 void draw_values_2d();
147 void draw_edges_2d();
155 float edges_color[3];
158 typedef void(*DrawSingleEdgeCallback)(
int inx_vert_a,
int inx_vert_b,
ScalarView* viewer,
void* param);
161 void calculate_mesh_aabb(
double* x_min,
double* x_max,
double* y_min,
double* y_max);
186 bool pmode, mode3d, panning;
187 double xrot, yrot, xtrans, ytrans, ztrans;
188 double xzscale, yscale, xctr, yctr,
zctr;
191 double value_irange, value_range_avg;
206 double calculate_ztrans_to_fit_view();
208 virtual void update_layout();
211 void init_lighting();
213 void update_mesh_info();
215 virtual void on_display();
216 void on_display_2d();
217 void on_display_3d();
219 virtual void on_key_down(
unsigned char key,
int x,
int y);
220 virtual void on_mouse_move(
int x,
int y);
222 virtual void on_right_mouse_down(
int x,
int y);
223 virtual void on_middle_mouse_down(
int x,
int y);
224 virtual void on_middle_mouse_up(
int x,
int y);
225 virtual const char* get_help_text()
const;
226 virtual void on_close();
232 void init() {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
233 ScalarView(
const char* title =
"ScalarView", WinGeom* wg =
nullptr) {}
234 ScalarView(
char* title, WinGeom* wg =
nullptr) {}
236 void show(MeshFunctionSharedPtr<double> sln,
int item = H2D_FN_VAL_0,
237 MeshFunctionSharedPtr<double> xdisp =
nullptr, MeshFunctionSharedPtr<double> ydisp =
nullptr,
double dmult = 1.0) {
238 throw Hermes::Exceptions::Exception(
"GLUT disabled.");
241 void show(MeshFunctionSharedPtr<std::complex<double> > sln,
int item = H2D_FN_VAL_0,
242 MeshFunctionSharedPtr<double> xdisp =
nullptr, MeshFunctionSharedPtr<double> ydisp =
nullptr,
double dmult = 1.0)
244 throw Exceptions::Exception(
"Visualization of complex 2D solution is not possible, please use a filter that converts the solution into a real function, then display that one.");
247 void show_linearizer_data(
double eps,
int item = H2D_FN_VAL_0) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
249 inline void show_mesh(
bool show =
true) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
250 inline void show_bounding_box(
bool show =
true) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
251 void show_contours(
double step,
double orig = 0.0) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
252 inline void hide_contours() {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
253 inline void set_3d_mode(
bool enable =
true) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
254 void set_vertical_scaling(
double sc) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
255 void set_min_max_range(
double min,
double max) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
256 Linearizer* get_linearizer() {
throw Hermes::Exceptions::Exception(
"GLUT disabled.");
return nullptr; }
257 void set_linearizer_criterion(LinearizerCriterion criterion) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
static const int fovy
Field of view in the vertical direction (in degrees).
bool show_edges
true to show edges of mesh
bool is_constant
true if the function to be displayed is constant
Represents a simple visualization window.
< OpenGL vertex. Used to cache vertices prior rendering
File containing LinearizerMultidimensional class.
double zctr
Information about the range of vertex values.
int max_gl_tris
A maximum allocated number of triangles.
File containing View abstract class.
bool show_values
true to show values
bool do_zoom_to_fit
true to automatically translate the view so that the whole model si displayed
int gl_tri_cnt
A number of OpenGL triangles.
static const double znear
Distance of the near clipping plane of the viewing frustum from the camera.
bool show_element_info
true, to draw element info (currently ID) in 2D mode
float x
location of center[in physical coordinates]
Linearizer * lin
LinearizerMultidimensional class responsible for obtaining linearized data.
Visualizes a Scalar PDE solution.
bool lin_updated
true, if lin now contains new_ values
std::vector< ElementInfo > element_infos
Element info.
LinearizerMultidimensional< ScalarLinearizerDataDimensions< LINEARIZER_DATA_TYPE > > Linearizer
Linearizer for scalar cases - historically called Linearizer.
int max_gl_verts
A maximum allocated number of vertices.
bool contours
true to enable drawing of contours
static const double zfar
Distance of the Far clipping plane of the viewing frustum from the camera.
bool show_aabb
true to show the bounding box
Typedefs used throughout the Linearizer functionality.
float width
width, height of AABB[in physical coordinates]
unsigned int element_id_widget
A GL display-list denoting a element ID widget. The geometry assumes the size of a pixel is 1x1...
double cont_orig
contour settings.
Abstract class for criterion according to which the linearizer stops dividing elements at some point ...