Loading...
Searching...
No Matches
vtk_cell_type.cc
Go to the documentation of this file.
//
// helper for vtk file io
//
// author: Pierre.Saramito@imag.fr
//
// 29 january 2020
//
#include "rheolef/reference_element.h"
#include "vtk_cell_type.h"
namespace rheolef {
size_t vtk_cell_type2variant (size_t vtk_cell_type)
{
switch (vtk_cell_type) {
case VTK_VERTEX:
return reference_element::p;
case VTK_LINE:
case VTK_QUADRATIC_EDGE:
case VTK_CUBIC_LINE:
case VTK_LAGRANGE_CURVE:
return reference_element::e;
case VTK_TRIANGLE:
case VTK_QUADRATIC_TRIANGLE:
case VTK_LAGRANGE_TRIANGLE:
return reference_element::t;
case VTK_QUAD:
case VTK_BIQUADRATIC_QUAD:
case VTK_LAGRANGE_QUADRILATERAL:
return reference_element::t;
case VTK_TETRA:
case VTK_QUADRATIC_TETRA:
case VTK_LAGRANGE_TETRAHEDRON:
return reference_element::T;
case VTK_WEDGE:
case VTK_BIQUADRATIC_QUADRATIC_WEDGE:
case VTK_LAGRANGE_WEDGE:
return reference_element::P;
case VTK_HEXAHEDRON:
case VTK_TRIQUADRATIC_HEXAHEDRON:
case VTK_LAGRANGE_HEXAHEDRON:
return reference_element::H;
case VTK_QUADRATIC_QUAD: // incomplete order 2 variants
case VTK_QUADRATIC_WEDGE:
case VTK_QUADRATIC_HEXAHEDRON:
default:
error_macro ("unsupported vtk cell type = "<<vtk_cell_type);
}
}
size_t nv2vtk_cell_type (size_t map_dim, size_t nv)
{
switch (map_dim) {
case 0: {
return VTK_VERTEX;
}
case 1: {
check_macro(nv == 2, "unexpected 1D vtk cell with "<<nv<<" vertices");
return VTK_LINE;
}
case 2: {
check_macro(nv == 3, "unexpected 2D vtk cell with "<<nv<<" vertices");
return VTK_TRIANGLE;
}
default: {
error_macro("unexpected "<<map_dim<<"D vtk cell");
return 0;
}
}
}
}// namespace rheolef
rheolef::reference_element::H
static const variant_type H
Definition reference_element.h:81
rheolef::reference_element::e
static const variant_type e
Definition reference_element.h:76
rheolef::reference_element::p
static const variant_type p
Definition reference_element.h:75
rheolef::reference_element::T
static const variant_type T
Definition reference_element.h:79
rheolef::reference_element::P
static const variant_type P
Definition reference_element.h:80
rheolef::reference_element::t
static const variant_type t
Definition reference_element.h:77
error_macro
#define error_macro(message)
Definition dis_macros.h:49
check_macro
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::vtk_cell_type2variant
size_t vtk_cell_type2variant(size_t vtk_cell_type)
Definition vtk_cell_type.cc:34
rheolef::nv2vtk_cell_type
size_t nv2vtk_cell_type(size_t map_dim, size_t nv)
Definition vtk_cell_type.cc:71
vtk_cell_type.h
VTK_BIQUADRATIC_QUADRATIC_WEDGE
#define VTK_BIQUADRATIC_QUADRATIC_WEDGE
Definition vtk_cell_type.h:63
VTK_HEXAHEDRON
#define VTK_HEXAHEDRON
Definition vtk_cell_type.h:46
VTK_CUBIC_LINE
#define VTK_CUBIC_LINE
Definition vtk_cell_type.h:68
VTK_LAGRANGE_QUADRILATERAL
#define VTK_LAGRANGE_QUADRILATERAL
Definition vtk_cell_type.h:77
VTK_LINE
#define VTK_LINE
Definition vtk_cell_type.h:37
VTK_QUADRATIC_EDGE
#define VTK_QUADRATIC_EDGE
Definition vtk_cell_type.h:51
VTK_LAGRANGE_TETRAHEDRON
#define VTK_LAGRANGE_TETRAHEDRON
Definition vtk_cell_type.h:78
VTK_QUADRATIC_QUAD
#define VTK_QUADRATIC_QUAD
Definition vtk_cell_type.h:53
VTK_QUADRATIC_HEXAHEDRON
#define VTK_QUADRATIC_HEXAHEDRON
Definition vtk_cell_type.h:56
VTK_QUADRATIC_TRIANGLE
#define VTK_QUADRATIC_TRIANGLE
Definition vtk_cell_type.h:52
VTK_LAGRANGE_WEDGE
#define VTK_LAGRANGE_WEDGE
Definition vtk_cell_type.h:80
VTK_QUAD
#define VTK_QUAD
Definition vtk_cell_type.h:43
VTK_QUADRATIC_WEDGE
#define VTK_QUADRATIC_WEDGE
Definition vtk_cell_type.h:57
VTK_VERTEX
#define VTK_VERTEX
Definition vtk_cell_type.h:35
VTK_TRIANGLE
#define VTK_TRIANGLE
Definition vtk_cell_type.h:39
VTK_LAGRANGE_CURVE
#define VTK_LAGRANGE_CURVE
Definition vtk_cell_type.h:75
VTK_QUADRATIC_TETRA
#define VTK_QUADRATIC_TETRA
Definition vtk_cell_type.h:55
VTK_WEDGE
#define VTK_WEDGE
Definition vtk_cell_type.h:47
VTK_LAGRANGE_TRIANGLE
#define VTK_LAGRANGE_TRIANGLE
Definition vtk_cell_type.h:76
VTK_LAGRANGE_HEXAHEDRON
#define VTK_LAGRANGE_HEXAHEDRON
Definition vtk_cell_type.h:79
VTK_TRIQUADRATIC_HEXAHEDRON
#define VTK_TRIQUADRATIC_HEXAHEDRON
Definition vtk_cell_type.h:60
VTK_TETRA
#define VTK_TETRA
Definition vtk_cell_type.h:44
VTK_BIQUADRATIC_QUAD
#define VTK_BIQUADRATIC_QUAD
Definition vtk_cell_type.h:59