Loading src/TNL/Meshes/Writers/VTKWriter_impl.h +41 −44 Original line number Diff line number Diff line Loading @@ -10,6 +10,8 @@ #pragma once #include <type_traits> #include <TNL/Meshes/Writers/VTKWriter.h> #include <TNL/Meshes/Readers/EntityShape.h> Loading @@ -19,68 +21,63 @@ namespace Writers { namespace __impl { template< typename Entity > struct VerticesPerEntity template< typename T, typename R = void > struct enable_if_type { static constexpr int count = Entity::getVerticesCount(); using type = R; }; template< typename MeshConfig, typename Device > struct VerticesPerEntity< MeshEntity< MeshConfig, Device, Topologies::Vertex > > { static constexpr int count = 1; }; template< typename T, typename Enable = void > struct has_entity_topology : std::false_type {}; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 0, Config > > { static constexpr int count = 1; }; template< typename T > struct has_entity_topology< T, typename enable_if_type< typename T::EntityTopology >::type > : std::true_type {}; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 1, Config > > { static constexpr int count = 2; }; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 2, Config > > template< typename Entity, bool _is_mesh_entity = has_entity_topology< Entity >::value > struct VerticesPerEntity { static constexpr int count = 4; static constexpr int count = Entity::getVerticesCount(); }; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 3, Config > > template< typename MeshConfig, typename Device > struct VerticesPerEntity< MeshEntity< MeshConfig, Device, Topologies::Vertex >, true > { static constexpr int count = 8; static constexpr int count = 1; }; template< typename GridEntity > struct GridEntityShape {}; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 0, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Vertex; struct VerticesPerEntity< GridEntity, false > { private: static constexpr int dim = GridEntity::getEntityDimension(); static_assert( dim >= 0 && dim <= 3, "unexpected dimension of the grid entity" ); public: static constexpr int count = (dim == 0) ? 1 : (dim == 1) ? 2 : (dim == 2) ? 4 : 8; }; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 1, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Line; }; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 2, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Pixel; }; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 3, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Voxel; template< typename GridEntity > struct GridEntityShape { private: static constexpr int dim = GridEntity::getEntityDimension(); static_assert( dim >= 0 && dim <= 3, "unexpected dimension of the grid entity" ); public: static constexpr Readers::EntityShape shape = (dim == 0) ? Readers::EntityShape::Vertex : (dim == 1) ? Readers::EntityShape::Line : (dim == 2) ? Readers::EntityShape::Pixel : Readers::EntityShape::Voxel; }; Loading Loading
src/TNL/Meshes/Writers/VTKWriter_impl.h +41 −44 Original line number Diff line number Diff line Loading @@ -10,6 +10,8 @@ #pragma once #include <type_traits> #include <TNL/Meshes/Writers/VTKWriter.h> #include <TNL/Meshes/Readers/EntityShape.h> Loading @@ -19,68 +21,63 @@ namespace Writers { namespace __impl { template< typename Entity > struct VerticesPerEntity template< typename T, typename R = void > struct enable_if_type { static constexpr int count = Entity::getVerticesCount(); using type = R; }; template< typename MeshConfig, typename Device > struct VerticesPerEntity< MeshEntity< MeshConfig, Device, Topologies::Vertex > > { static constexpr int count = 1; }; template< typename T, typename Enable = void > struct has_entity_topology : std::false_type {}; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 0, Config > > { static constexpr int count = 1; }; template< typename T > struct has_entity_topology< T, typename enable_if_type< typename T::EntityTopology >::type > : std::true_type {}; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 1, Config > > { static constexpr int count = 2; }; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 2, Config > > template< typename Entity, bool _is_mesh_entity = has_entity_topology< Entity >::value > struct VerticesPerEntity { static constexpr int count = 4; static constexpr int count = Entity::getVerticesCount(); }; template< typename Grid, typename Config > struct VerticesPerEntity< GridEntity< Grid, 3, Config > > template< typename MeshConfig, typename Device > struct VerticesPerEntity< MeshEntity< MeshConfig, Device, Topologies::Vertex >, true > { static constexpr int count = 8; static constexpr int count = 1; }; template< typename GridEntity > struct GridEntityShape {}; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 0, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Vertex; struct VerticesPerEntity< GridEntity, false > { private: static constexpr int dim = GridEntity::getEntityDimension(); static_assert( dim >= 0 && dim <= 3, "unexpected dimension of the grid entity" ); public: static constexpr int count = (dim == 0) ? 1 : (dim == 1) ? 2 : (dim == 2) ? 4 : 8; }; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 1, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Line; }; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 2, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Pixel; }; template< typename Grid, typename Config > struct GridEntityShape< GridEntity< Grid, 3, Config > > { static constexpr Readers::EntityShape shape = Readers::EntityShape::Voxel; template< typename GridEntity > struct GridEntityShape { private: static constexpr int dim = GridEntity::getEntityDimension(); static_assert( dim >= 0 && dim <= 3, "unexpected dimension of the grid entity" ); public: static constexpr Readers::EntityShape shape = (dim == 0) ? Readers::EntityShape::Vertex : (dim == 1) ? Readers::EntityShape::Line : (dim == 2) ? Readers::EntityShape::Pixel : Readers::EntityShape::Voxel; }; Loading