Hermes2D  3.0
orderizer.cpp
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #include "orderizer.h"
17 #include "space.h"
18 #include "refmap.h"
19 #include "orderizer_quad.cpp"
20 
21 namespace Hermes
22 {
23  namespace Hermes2D
24  {
25  namespace Views
26  {
27  // vertices
28  static unsigned char* ord_np[2] = { num_vert_tri, num_vert_quad };
29  static double3* ord_tables_tri[2] = { vert_tri0, vert_tri1 };
30  static double3* ord_tables_quad[2] = { vert_quad0, vert_quad1 };
31  static double3** ord_tables[2] = { ord_tables_tri, ord_tables_quad };
32 
33  // triangles
34  static unsigned short* num_elem[2] = { num_elem_tri, num_elem_quad };
35  static int3* ord_elem_tri[2] = { elem_tri0, elem_tri1 };
36  static int3* ord_elem_quad[2] = { elem_quad0, elem_quad1 };
37  static int3** ord_elem[2] = { ord_elem_tri, ord_elem_quad };
38 
39  // edges
40  static unsigned short* num_edge[2] = { num_edge_tri, num_edge_quad };
41  static int3* ord_edge_tri[2] = { edge_tri0, edge_tri1 };
42  static int3* ord_edge_quad[2] = { edge_quad0, edge_quad1 };
43  static int3** ord_edge[2] = { ord_edge_tri, ord_edge_quad };
44 
45  // vertices_simple
46  static unsigned char* ord_np_simple[2] = { num_vert_tri_simple, num_vert_quad_simple };
47  static double3* ord_tables_tri_simple[2] = { vert_tri_simple, vert_tri_simple };
48  static double3* ord_tables_quad_simple[2] = { vert_quad_simple, vert_quad_simple };
49  static double3** ord_tables_simple[2] = { ord_tables_tri_simple, ord_tables_quad_simple };
50 
51  // triangles
52  static unsigned short* num_elem_simple[2] = { num_elem_tri_simple, num_elem_quad_simple };
53  static int3* ord_elem_tri_simple[2] = { elem_tri_simple, elem_tri_simple };
54  static int3* ord_elem_quad_simple[2] = { elem_quad_simple, elem_quad_simple };
55  static int3** ord_elem_simple[2] = { ord_elem_tri_simple, ord_elem_quad_simple };
56 
57  // edges
58  static unsigned short* num_edge_simple[2] = { num_edge_tri_simple, num_edge_quad_simple };
59  static int3* ord_edge_tri_simple[2] = { edge_tri_simple, edge_tri_simple };
60  static int3* ord_edge_quad_simple[2] = { edge_quad_simple, edge_quad_simple };
61  static int3** ord_edge_simple[2] = { ord_edge_tri_simple, ord_edge_quad_simple };
62 
63  static class Quad2DOrd : public Quad2D
64  {
65  public:
66 
67  Quad2DOrd()
68  {
69  max_order[0] = max_order[1] = 1;
70  num_tables[0] = num_tables[1] = 2;
71  tables = ord_tables;
72  np = ord_np;
73  };
74 
75  virtual unsigned char get_id()
76  {
77  return 5;
78  };
79  } quad_ord;
80 
81  static class Quad2DOrdSimple : public Quad2D
82  {
83  public:
84 
85  Quad2DOrdSimple()
86  {
87  max_order[0] = max_order[1] = 1;
88  num_tables[0] = num_tables[1] = 2;
89  tables = ord_tables_simple;
90  np = ord_np_simple;
91  };
92 
93  virtual unsigned char get_id()
94  {
95  return 6;
96  };
97  } quad_ord_simple;
98 
99  Orderizer::Orderizer()
100  {
101  verts = nullptr;
102  edges = nullptr;
103  this->label_size = 0;
104  ltext = nullptr;
105  lvert = nullptr;
106  lbox = nullptr;
107 
108  tris = nullptr;
109  tri_markers = nullptr;
110  edges = nullptr;
111  edge_markers = nullptr;
112 
113  vertex_count = triangle_count = edges_count = this->vertex_size = this->triangle_size = this->edges_size = 0;
114 
115  label_count = 0;
116 
117  for (int i = 0, p = 0; i <= 10; i++)
118  {
119  for (int j = 0; j <= 10; j++)
120  {
121  assert((unsigned)p < sizeof(buffer) - 5);
122  if (i == j)
123  sprintf(buffer + p, "%d", i);
124  else
125  sprintf(buffer + p, "%d|%d", i, j);
126  labels[i][j] = buffer + p;
127  p += strlen(buffer + p) + 1;
128  }
129  }
130 #ifndef NOGLUT
131  pthread_mutexattr_t attr;
132  pthread_mutexattr_init(&attr);
133  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
134  pthread_mutex_init(&data_mutex, &attr);
135  pthread_mutexattr_destroy(&attr);
136 #endif
137  }
138 
139  int Orderizer::add_vertex()
140  {
141  if (this->vertex_count >= this->vertex_size)
142  {
143  this->vertex_size *= 2;
144  this->verts = (double3*)realloc(verts, sizeof(double3)* vertex_size);
145  if ((!this->verts))
146  {
147  free();
148  throw Exceptions::Exception("Orderizer out of memory!");
149  }
150  }
151  return this->vertex_count++;
152  }
153 
154  void Orderizer::make_vert(int & index, double x, double y, double val)
155  {
156  index = add_vertex();
157  verts[index][0] = x;
158  verts[index][1] = y;
159  verts[index][2] = val;
160  }
161 
162  static const int default_allocation_multiplier_vertices = 10;
163  static const int default_allocation_multiplier_triangles = 15;
164  static const int default_allocation_multiplier_edges = 10;
165 
166  static const int default_allocation_minsize_vertices = 10000;
167  static const int default_allocation_minsize_triangles = 15000;
168  static const int default_allocation_minsize_edges = 10000;
169 
170  void Orderizer::reallocate(MeshSharedPtr mesh)
171  {
172  int number_of_elements = mesh->get_num_elements();
173 
174  this->vertex_size = std::max(default_allocation_multiplier_vertices * number_of_elements, std::max(this->vertex_size, default_allocation_minsize_vertices));
175  this->triangle_size = std::max(default_allocation_multiplier_triangles * number_of_elements, std::max(this->triangle_size, default_allocation_minsize_triangles));
176  this->edges_size = std::max(default_allocation_multiplier_edges * number_of_elements, std::max(this->edges_size, default_allocation_minsize_edges));
177 
178  // Set count.
179  this->vertex_count = 0;
180  this->triangle_count = 0;
181  this->edges_count = 0;
182 
183  this->tris = (int3*)realloc(this->tris, sizeof(int3)* this->triangle_size);
184  this->tri_markers = (int*)realloc(this->tri_markers, sizeof(int)* this->triangle_size);
185  this->edges = (int2*)realloc(this->edges, sizeof(int2)* this->edges_size);
186  this->edge_markers = (int*)realloc(this->edge_markers, sizeof(int)* this->edges_size);
187 
188  if (!this->tris || !this->tri_markers || !this->edges || !this->edge_markers)
189  throw Exceptions::Exception("Orderizer out of memory!");
190 
191  this->label_size = std::max(this->label_size, number_of_elements + 10);
192  this->label_count = 0;
193 
194  this->verts = realloc_with_check<Orderizer, double3>(this->verts, this->vertex_size, this);
195 
196  this->lvert = realloc_with_check<Orderizer, int>(this->lvert, label_size, this);
197 
198  ltext = realloc_with_check<Orderizer, char *>(this->ltext, label_size, this);
199 
200  lbox = realloc_with_check<Orderizer, double2>(this->lbox, label_size, this);
201  }
202 
203  Orderizer::~Orderizer()
204  {
205  free();
206 #ifndef NOGLUT
207  pthread_mutex_destroy(&data_mutex);
208 #endif
209  }
210 
211  void Orderizer::lock_data() const
212  {
213 #ifndef NOGLUT
214  pthread_mutex_lock(&data_mutex);
215 #endif
216  }
217 
218  void Orderizer::unlock_data() const
219  {
220 #ifndef NOGLUT
221  pthread_mutex_unlock(&data_mutex);
222 #endif
223  }
224  template<typename Scalar>
225  void Orderizer::process_space(SpaceSharedPtr<Scalar> space, bool show_edge_orders)
226  {
227  // sanity check
228  if (space == nullptr)
229  throw Hermes::Exceptions::Exception("Space is nullptr in Orderizer:process_space().");
230 
231  if (!space->is_up_to_date())
232  throw Hermes::Exceptions::Exception("The space is not up to date.");
233 
234  MeshSharedPtr mesh = space->get_mesh();
235 
236  // Reallocate.
237  this->reallocate(mesh);
238 
239  RefMap refmap;
240 
241  int oo, o[6];
242 
243  // make a mesh illustrating the distribution of polynomial orders over the space
244  Element* e;
245  for_all_active_elements(e, mesh)
246  {
247  oo = o[4] = o[5] = space->get_element_order(e->id);
248  if (show_edge_orders)
249  for (unsigned int k = 0; k < e->get_nvert(); k++)
250  o[k] = space->get_edge_order(e, k);
251  else if (e->is_curved())
252  {
253  if (e->is_triangle())
254  for (unsigned int k = 0; k < e->get_nvert(); k++)
255  o[k] = oo;
256  else
257  for (unsigned int k = 0; k < e->get_nvert(); k++)
258  o[k] = H2D_GET_H_ORDER(oo);
259  }
260 
261  double3* pt;
262  int np;
263  double* x;
264  double* y;
265  if (show_edge_orders || e->is_curved())
266  {
267  refmap.set_quad_2d(&quad_ord);
268  refmap.set_active_element(e);
269  x = refmap.get_phys_x(1);
270  y = refmap.get_phys_y(1);
271 
272  pt = quad_ord.get_points(1, e->get_mode());
273  np = quad_ord.get_num_points(1, e->get_mode());
274  }
275  else
276  {
277  refmap.set_quad_2d(&quad_ord_simple);
278  refmap.set_active_element(e);
279  x = refmap.get_phys_x(1);
280  y = refmap.get_phys_y(1);
281 
282  pt = quad_ord_simple.get_points(1, e->get_mode());
283  np = quad_ord_simple.get_num_points(1, e->get_mode());
284  }
285 
286  int id[80];
287  assert(np <= 80);
288 
289  int mode = e->get_mode();
290  if (e->is_quad())
291  {
292  o[4] = H2D_GET_H_ORDER(oo);
293  o[5] = H2D_GET_V_ORDER(oo);
294  }
295  if (show_edge_orders || e->is_curved())
296  {
297  make_vert(lvert[label_count], x[0], y[0], o[4]);
298 
299  for (int i = 1; i < np; i++)
300  make_vert(id[i - 1], x[i], y[i], o[(int)pt[i][2]]);
301 
302  for (int i = 0; i < num_elem[mode][1]; i++)
303  this->add_triangle(id[ord_elem[mode][1][i][0]], id[ord_elem[mode][1][i][1]], id[ord_elem[mode][1][i][2]], e->marker);
304 
305  for (int i = 0; i < num_edge[mode][1]; i++)
306  {
307  if (e->en[ord_edge[mode][1][i][2]]->bnd || (y[ord_edge[mode][1][i][0] + 1] < y[ord_edge[mode][1][i][1] + 1]) ||
308  ((y[ord_edge[mode][1][i][0] + 1] == y[ord_edge[mode][1][i][1] + 1]) &&
309  (x[ord_edge[mode][1][i][0] + 1] < x[ord_edge[mode][1][i][1] + 1])))
310  {
311  add_edge(id[ord_edge[mode][1][i][0]], id[ord_edge[mode][1][i][1]], e->en[ord_edge[mode][1][i][2]]->marker);
312  }
313  }
314  }
315  else
316  {
317  make_vert(lvert[label_count], x[0], y[0], o[4]);
318 
319  for (int i = 1; i < np; i++)
320  make_vert(id[i - 1], x[i], y[i], o[(int)pt[i][2]]);
321 
322  for (int i = 0; i < num_elem_simple[mode][1]; i++)
323  this->add_triangle(id[ord_elem_simple[mode][1][i][0]], id[ord_elem_simple[mode][1][i][1]], id[ord_elem_simple[mode][1][i][2]], e->marker);
324 
325  for (int i = 0; i < num_edge_simple[mode][1]; i++)
326  add_edge(id[ord_edge_simple[mode][1][i][0]], id[ord_edge_simple[mode][1][i][1]], e->en[ord_edge_simple[mode][1][i][2]]->marker);
327  }
328 
329  double xmin = 1e100, ymin = 1e100, xmax = -1e100, ymax = -1e100;
330  for (unsigned int k = 0; k < e->get_nvert(); k++)
331  {
332  if (e->vn[k]->x < xmin) xmin = e->vn[k]->x;
333  if (e->vn[k]->x > xmax) xmax = e->vn[k]->x;
334  if (e->vn[k]->y < ymin) ymin = e->vn[k]->y;
335  if (e->vn[k]->y > ymax) ymax = e->vn[k]->y;
336  }
337  lbox[label_count][0] = xmax - xmin;
338  lbox[label_count][1] = ymax - ymin;
339  ltext[label_count++] = labels[o[4]][o[5]];
340  }
341 
342  refmap.set_quad_2d(&g_quad_2d_std);
343  }
344 
345  void Orderizer::add_edge(int iv1, int iv2, int marker)
346  {
347 #pragma omp critical(realloc_edges)
348  {
349  if (edges_count >= edges_size)
350  {
351  edges = (int2*)realloc(edges, sizeof(int2)* (edges_size * 1.5));
352  edge_markers = (int*)realloc(edge_markers, sizeof(int)* (edges_size = edges_size * 1.5));
353  }
354  edges[edges_count][0] = iv1;
355  edges[edges_count][1] = iv2;
356  edge_markers[edges_count++] = marker;
357  }
358  }
359 
360  void Orderizer::add_triangle(int iv0, int iv1, int iv2, int marker)
361  {
362  int index;
363 #pragma omp critical(realloc_triangles)
364  {
365  if (triangle_count >= triangle_size)
366  {
367  this->triangle_size *= 2;
368  tri_markers = (int*)realloc(tri_markers, sizeof(int)* triangle_size);
369  tris = (int3*)realloc(tris, sizeof(int3)* triangle_size);
370  if ((!tri_markers) || (!this->tris))
371  {
372  free();
373  throw Exceptions::Exception("Orderizer out of memory!");
374  }
375  }
376  index = triangle_count++;
377  }
378  tris[index][0] = iv0;
379  tris[index][1] = iv1;
380  tris[index][2] = iv2;
381  tri_markers[index] = marker;
382  }
383 
384  void Orderizer::free()
385  {
386  free_with_check(verts, true);
387  free_with_check(lvert, true);
388  free_with_check(ltext, true);
389  free_with_check(lbox, true);
390  free_with_check(tris, true);
391  free_with_check(tri_markers, true);
392  free_with_check(edges, true);
393  free_with_check(edge_markers, true);
394  }
395 
396  template<typename Scalar>
397  void Orderizer::save_orders_vtk(SpaceSharedPtr<Scalar> space, const char* file_name)
398  {
399  process_space(space);
400 
401  FILE* f = fopen(file_name, "wb");
402  if (f == nullptr) throw Hermes::Exceptions::Exception("Could not open %s for writing.", file_name);
403 
404  // Output header for vertices.
405  fprintf(f, "# vtk DataFile Version 2.0\n");
406  fprintf(f, "\n");
407  fprintf(f, "ASCII\n\n");
408  fprintf(f, "DATASET UNSTRUCTURED_GRID\n");
409 
410  // Output vertices.
411  fprintf(f, "POINTS %d %s\n", this->vertex_count, "float");
412  for (int i = 0; i < this->vertex_count; i++)
413  {
414  fprintf(f, "%g %g %g\n", this->verts[i][0], this->verts[i][1], 0.);
415  }
416 
417  // Output elements.
418  fprintf(f, "\n");
419  fprintf(f, "CELLS %d %d\n", this->triangle_count, 4 * this->triangle_count);
420  for (int i = 0; i < this->triangle_count; i++)
421  {
422  fprintf(f, "3 %d %d %d\n", this->tris[i][0], this->tris[i][1], this->tris[i][2]);
423  }
424 
425  // Output cell types.
426  fprintf(f, "\n");
427  fprintf(f, "CELL_TYPES %d\n", this->triangle_count);
428 
429  for (int i = 0; i < this->triangle_count; i++)
430  // The "5" means triangle in VTK.
431  fprintf(f, "5\n");
432 
433  // This outputs double solution values. Look into Hermes2D/src/output/vtk.cpp
434  // for how it is done for vectors.
435  fprintf(f, "\n");
436  fprintf(f, "POINT_DATA %d\n", this->vertex_count);
437  fprintf(f, "SCALARS %s %s %d\n", "Mesh", "float", 1);
438  fprintf(f, "LOOKUP_TABLE %s\n", "default");
439  for (int i = 0; i < this->vertex_count; i++)
440  fprintf(f, "%g \n", this->verts[i][2]);
441  fclose(f);
442  }
443 
444  template<typename Scalar>
445  void Orderizer::save_markers_vtk(SpaceSharedPtr<Scalar> space, const char* file_name)
446  {
447  process_space(space);
448 
449  FILE* f = fopen(file_name, "wb");
450  if (f == nullptr) throw Hermes::Exceptions::Exception("Could not open %s for writing.", file_name);
451 
452  // Output header for vertices.
453  fprintf(f, "# vtk DataFile Version 2.0\n");
454  fprintf(f, "\n");
455  fprintf(f, "ASCII\n\n");
456  fprintf(f, "DATASET UNSTRUCTURED_GRID\n");
457 
458  // Output vertices.
459  fprintf(f, "POINTS %d %s\n", this->vertex_count, "float");
460  for (int i = 0; i < this->vertex_count; i++)
461  {
462  fprintf(f, "%g %g %g\n", this->verts[i][0], this->verts[i][1], 0.);
463  }
464 
465  // Output elements.
466  fprintf(f, "\n");
467  fprintf(f, "CELLS %d %d\n", this->triangle_count, 4 * this->triangle_count);
468  for (int i = 0; i < this->triangle_count; i++)
469  {
470  fprintf(f, "3 %d %d %d\n", this->tris[i][0], this->tris[i][1], this->tris[i][2]);
471  }
472 
473  // Output cell types.
474  fprintf(f, "\n");
475  fprintf(f, "CELL_TYPES %d\n", this->triangle_count);
476 
477  for (int i = 0; i < this->triangle_count; i++)
478  // The "5" means triangle in VTK.
479  fprintf(f, "5\n");
480 
481  // This outputs double solution values. Look into Hermes2D/src/output/vtk.cpp
482  // for how it is done for vectors.
483  fprintf(f, "\n");
484  fprintf(f, "CELL_DATA %d\n", this->triangle_count);
485  fprintf(f, "SCALARS %s %s %d\n", "Mesh", "float", 1);
486  fprintf(f, "LOOKUP_TABLE %s\n", "default");
487  for (int i = 0; i < this->triangle_count; i++)
488  fprintf(f, "%d \n", this->tri_markers[i]);
489  fclose(f);
490  }
491 
492  template<typename Scalar>
493  void Orderizer::save_mesh_vtk(SpaceSharedPtr<Scalar> space, const char* file_name)
494  {
495  process_space(space);
496 
497  FILE* f = fopen(file_name, "wb");
498  if (f == nullptr) throw Hermes::Exceptions::Exception("Could not open %s for writing.", file_name);
499 
500  // Output header for vertices.
501  fprintf(f, "# vtk DataFile Version 2.0\n");
502  fprintf(f, "\n");
503  fprintf(f, "ASCII\n\n");
504  fprintf(f, "DATASET UNSTRUCTURED_GRID\n");
505 
506  // Output vertices.
507  fprintf(f, "POINTS %d %s\n", this->vertex_count, "float");
508  for (int i = 0; i < this->vertex_count; i++)
509  fprintf(f, "%g %g %g\n", this->verts[i][0], this->verts[i][1], 0.0);
510 
511  // Output elements.
512  fprintf(f, "\n");
513  fprintf(f, "CELLS %d %d\n", this->edges_count, +3 * this->edges_count);
514  for (int i = 0; i < this->edges_count; i++)
515  fprintf(f, "2 %d %d\n", this->edges[i][0], this->edges[i][1]);
516 
517  // Output cell types.
518  fprintf(f, "\n");
519  fprintf(f, "CELL_TYPES %d\n", this->edges_count);
520 
521  for (int i = 0; i < this->edges_count; i++)
522  // The "3" means line in VTK.
523  fprintf(f, "3\n");
524 
525  // This outputs double solution values. Look into Hermes2D/src/output/vtk.cpp
526  // for how it is done for vectors.
527  fprintf(f, "\n");
528  fprintf(f, "CELL_DATA %d\n", this->edges_count);
529  fprintf(f, "SCALARS %s %s %d\n", "Mesh", "float", 1);
530  fprintf(f, "LOOKUP_TABLE %s\n", "default");
531  for (int i = 0; i < this->edges_count; i++)
532  fprintf(f, "0 \n");
533  fclose(f);
534  }
535 
536  int Orderizer::get_labels(int*& lvert, char**& ltext, double2*& lbox) const
537  {
538  lvert = this->lvert;
539  ltext = this->ltext;
540  lbox = this->lbox;
541  return label_count;
542  }
543 
544  void Orderizer::calc_vertices_aabb(double* min_x, double* max_x, double* min_y, double* max_y) const
545  {
546  if (verts == nullptr)
547  throw Exceptions::Exception("Cannot calculate AABB from nullptr vertices");
548  calc_aabb(&verts[0][0], &verts[0][1], sizeof(double3), vertex_count, min_x, max_x, min_y, max_y);
549  }
550 
551  void Orderizer::calc_aabb(double* x, double* y, int stride, int num, double* min_x, double* max_x, double* min_y, double* max_y)
552  {
553  *min_x = *max_x = *x;
554  *min_y = *max_y = *y;
555 
556  uint8_t* ptr_x = (uint8_t*)x;
557  uint8_t* ptr_y = (uint8_t*)y;
558  for (int i = 0; i < num; i++, ptr_x += stride, ptr_y += stride)
559  {
560  *min_x = std::min(*min_x, *((double*)ptr_x));
561  *min_y = std::min(*min_y, *((double*)ptr_y));
562  *max_x = std::max(*max_x, *((double*)ptr_x));
563  *max_y = std::max(*max_y, *((double*)ptr_y));
564  }
565  }
566 
567  double3* Orderizer::get_vertices()
568  {
569  return this->verts;
570  }
571 
572  int Orderizer::get_num_vertices()
573  {
574  return this->vertex_count;
575  }
576 
577  int3* Orderizer::get_triangles()
578  {
579  return this->tris;
580  }
581 
582  int* Orderizer::get_triangle_markers()
583  {
584  return this->tri_markers;
585  }
586 
587  int Orderizer::get_num_triangles()
588  {
589  return this->triangle_count;
590  }
591 
592  int2* Orderizer::get_edges()
593  {
594  return this->edges;
595  }
596 
597  int* Orderizer::get_edge_markers()
598  {
599  return this->edge_markers;
600  }
601 
602  int Orderizer::get_num_edges()
603  {
604  return this->edges_count;
605  }
606 
607  template HERMES_API void Orderizer::save_orders_vtk<double>(const SpaceSharedPtr<double> space, const char* file_name);
608  template HERMES_API void Orderizer::save_orders_vtk<std::complex<double> >(const SpaceSharedPtr<std::complex<double> > space, const char* file_name);
609  template HERMES_API void Orderizer::save_markers_vtk<double>(const SpaceSharedPtr<double> space, const char* file_name);
610  template HERMES_API void Orderizer::save_markers_vtk<std::complex<double> >(const SpaceSharedPtr<std::complex<double> > space, const char* file_name);
611  template HERMES_API void Orderizer::save_mesh_vtk<double>(const SpaceSharedPtr<double> space, const char* file_name);
612  template HERMES_API void Orderizer::save_mesh_vtk<std::complex<double> >(const SpaceSharedPtr<std::complex<double> > space, const char* file_name);
613  template HERMES_API void Orderizer::process_space<double>(const SpaceSharedPtr<double> space, bool);
614  template HERMES_API void Orderizer::process_space<std::complex<double> >(const SpaceSharedPtr<std::complex<double> > space, bool);
615  }
616  }
617 }
double x
vertex node coordinates
Definition: element.h:63
Definition: adapt.h:24
int marker
element marker
Definition: element.h:144
double * get_phys_y(int order)
Definition: refmap.cpp:45
void calc_vertices_aabb(double *min_x, double *max_x, double *min_y, double *max_y) const
Returns axis aligned bounding box (AABB) of vertices. Assumes lock.
Definition: orderizer.cpp:544
int id
element id number
Definition: element.h:112
Stores one element of a mesh.
Definition: element.h:107
Used to pass the instances of Space around.
Definition: space.h:34
int3 * tris
triangles: vertex index triplets
Definition: orderizer.h:105
double * get_phys_x(int order)
Definition: refmap.cpp:38
int * tri_markers
triangle_markers: triangle markers, ordering equal to tris
Definition: orderizer.h:107
Node * en[H2D_MAX_NUMBER_EDGES]
edge node pointers
Definition: element.h:138
#define H2D_GET_H_ORDER(encoded_order)
Macros for combining quad horizontal and vertical encoded_orders.
Definition: global.h:98
void process_space(SpaceSharedPtr< Scalar > space, bool show_edge_orders=false)
Internal.
Definition: orderizer.cpp:225
unsigned bnd
1 = boundary node; 0 = inner node
Definition: element.h:54
void set_quad_2d(Quad2D *quad_2d)
Definition: refmap.cpp:63
void save_mesh_vtk(SpaceSharedPtr< Scalar > space, const char *file_name)
Saves the mesh - edges.
Definition: orderizer.cpp:493
void save_orders_vtk(SpaceSharedPtr< Scalar > space, const char *file_name)
Saves the polynomial orders.
Definition: orderizer.cpp:397
Represents the reference mapping.
Definition: refmap.h:40
void reallocate(MeshSharedPtr mesh)
Definition: orderizer.cpp:170
int marker
edge marker
Definition: element.h:68
int vertex_count
Real numbers of vertices, triangles and edges.
Definition: orderizer.h:110
int * edge_markers
edge_markers: edge markers, ordering equal to edges
Definition: orderizer.h:87
int2 * edges
edges: pairs of vertex indices
Definition: orderizer.h:85
void save_markers_vtk(SpaceSharedPtr< Scalar > space, const char *file_name)
Saves the mesh with markers.
Definition: orderizer.cpp:445
int vertex_size
Size of arrays of vertices, triangles and edges.
Definition: orderizer.h:112
virtual void set_active_element(Element *e)
Definition: refmap.cpp:70
Node * vn[H2D_MAX_NUMBER_VERTICES]
vertex node pointers
Definition: element.h:134
double3 * verts
vertices: (x, y, value) triplets
Definition: orderizer.h:98