Commit b8fa05a2 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

pytnl: added bindings for VTKTraits

parent 51f77b2f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ set( sources
      Object.cpp
      SparseMatrix.cpp
      String.cpp
      VTKTraits.cpp
      tnl.cpp
)
pybind11_add_module( pytnl ${sources} )
+45 −0
Original line number Diff line number Diff line
#include <pybind11/pybind11.h>
namespace py = pybind11;

#include <TNL/Meshes/VTKTraits.h>

void export_VTKTraits( py::module & m )
{
    py::enum_< TNL::Meshes::VTK::FileFormat >( m, "VTKFileFormat")
       .value("ascii", TNL::Meshes::VTK::FileFormat::ascii)
       .value("binary", TNL::Meshes::VTK::FileFormat::binary)
       .value("zlib_compressed", TNL::Meshes::VTK::FileFormat::zlib_compressed)
    ;
    py::enum_< TNL::Meshes::VTK::DataType >( m, "VTKDataType")
       .value("CellData", TNL::Meshes::VTK::DataType::CellData)
       .value("PointData", TNL::Meshes::VTK::DataType::PointData)
    ;
    py::enum_< TNL::Meshes::VTK::EntityShape >( m, "VTKEntityShape")
       .value("Vertex", TNL::Meshes::VTK::EntityShape::Vertex)
       .value("PolyVertex", TNL::Meshes::VTK::EntityShape::PolyVertex)
       .value("Line", TNL::Meshes::VTK::EntityShape::Line)
       .value("PolyLine", TNL::Meshes::VTK::EntityShape::PolyLine)
       .value("Triangle", TNL::Meshes::VTK::EntityShape::Triangle)
       .value("TriangleStrip", TNL::Meshes::VTK::EntityShape::TriangleStrip)
       .value("Polygon", TNL::Meshes::VTK::EntityShape::Polygon)
       .value("Pixel", TNL::Meshes::VTK::EntityShape::Pixel)
       .value("Quad", TNL::Meshes::VTK::EntityShape::Quad)
       .value("Tetra", TNL::Meshes::VTK::EntityShape::Tetra)
       .value("Voxel", TNL::Meshes::VTK::EntityShape::Voxel)
       .value("Hexahedron", TNL::Meshes::VTK::EntityShape::Hexahedron)
       .value("Wedge", TNL::Meshes::VTK::EntityShape::Wedge)
       .value("Pyramid", TNL::Meshes::VTK::EntityShape::Pyramid)
    ;
    py::enum_< TNL::Meshes::VTK::CellGhostTypes >( m, "VTKCellGhostTypes")
       .value("DUPLICATECELL", TNL::Meshes::VTK::CellGhostTypes::DUPLICATECELL,               "the cell is present on multiple processors")
       .value("HIGHCONNECTIVITYCELL", TNL::Meshes::VTK::CellGhostTypes::HIGHCONNECTIVITYCELL, "the cell has more neighbors than in a regular mesh")
       .value("LOWCONNECTIVITYCELL", TNL::Meshes::VTK::CellGhostTypes::LOWCONNECTIVITYCELL,   "the cell has less neighbors than in a regular mesh")
       .value("REFINEDCELL", TNL::Meshes::VTK::CellGhostTypes::REFINEDCELL,                   "other cells are present that refines it")
       .value("EXTERIORCELL", TNL::Meshes::VTK::CellGhostTypes::EXTERIORCELL,                 "the cell is on the exterior of the data set")
       .value("HIDDENCELL", TNL::Meshes::VTK::CellGhostTypes::HIDDENCELL,                     "the cell is needed to maintain connectivity, but the data values should be ignored")
    ;
    py::enum_< TNL::Meshes::VTK::PointGhostTypes >( m, "VTKPointGhostTypes")
       .value("DUPLICATEPOINT", TNL::Meshes::VTK::PointGhostTypes::DUPLICATEPOINT, "the cell is present on multiple processors")
       .value("HIDDENPOINT", TNL::Meshes::VTK::PointGhostTypes::HIDDENPOINT,       "the point is needed to maintain connectivity, but the data values should be ignored")
    ;
}
+3 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ void export_String( py::module & m );
void export_Grid1D( py::module & m );
void export_Grid2D( py::module & m );
void export_Grid3D( py::module & m );
void export_VTKTraits( py::module & m );
void export_Meshes( py::module & m );
void export_MeshReaders( py::module & m );
void export_SparseMatrices( py::module & m );
@@ -42,6 +43,8 @@ PYBIND11_MODULE(PYTNL_MODULE_NAME(tnl), m)
    export_Grid2D(m);
    export_Grid3D(m);

    export_VTKTraits(m);

    export_Meshes(m);
    export_MeshReaders(m);

+3 −3
Original line number Diff line number Diff line
@@ -172,16 +172,16 @@ enum class CellGhostTypes
   DUPLICATECELL = 1,        // the cell is present on multiple processors
   HIGHCONNECTIVITYCELL = 2, // the cell has more neighbors than in a regular mesh
   LOWCONNECTIVITYCELL = 4,  // the cell has less neighbors than in a regular mesh
   REFINEDCELL = 8,          // other cells are present that refines it.
   REFINEDCELL = 8,          // other cells are present that refines it
   EXTERIORCELL = 16,        // the cell is on the exterior of the data set
   HIDDENCELL = 32           // the cell is needed to maintain connectivity, but the data values should be ignored.
   HIDDENCELL = 32           // the cell is needed to maintain connectivity, but the data values should be ignored
};

enum class PointGhostTypes
: std::uint8_t
{
   DUPLICATEPOINT = 1,  // the cell is present on multiple processors
   HIDDENPOINT = 2      // the point is needed to maintain connectivity, but the data values should be ignored.
   HIDDENPOINT = 2      // the point is needed to maintain connectivity, but the data values should be ignored
};

/**