//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. // // Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS). // Copyright 2015 UT-Battelle, LLC. // Copyright 2015 Los Alamos National Security. // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ #ifndef vtk_m_rendering_raytracing_MeshConnectivityContainer_h #define vtk_m_rendering_raytracing_MeshConnectivityContainer_h #include #include #include namespace vtkm { namespace rendering { namespace raytracing { class MeshConnContainer { public: MeshConnContainer(); virtual ~MeshConnContainer(); virtual const MeshConnectivityBase* Construct(const vtkm::cont::DeviceAdapterId deviceId) = 0; template VTKM_CONT void FindEntryImpl(Ray& rays, const vtkm::cont::DeviceAdapterId deviceId); void FindEntry(Ray& rays, const vtkm::cont::DeviceAdapterId deviceId); void FindEntry(Ray& rays, const vtkm::cont::DeviceAdapterId deviceId); protected: using Id4Handle = typename vtkm::cont::ArrayHandle>; // Mesh Boundary Id4Handle ExternalTriangles; TriangleIntersector Intersector; MeshConnHandle Handle; }; class UnstructuredContainer : public MeshConnContainer { public: typedef vtkm::cont::ArrayHandle IdHandle; typedef vtkm::cont::ArrayHandle> Id4Handle; typedef vtkm::cont::ArrayHandle UCharHandle; // Control Environment Handles // FaceConn IdHandle FaceConnectivity; IdHandle FaceOffsets; //Cell Set IdHandle CellConn; IdHandle CellOffsets; UCharHandle Shapes; vtkm::Bounds CoordinateBounds; vtkm::cont::CellSetExplicit<> Cellset; vtkm::cont::CoordinateSystem Coords; private: VTKM_CONT UnstructuredContainer(){}; public: VTKM_CONT UnstructuredContainer(const vtkm::cont::CellSetExplicit<>& cellset, const vtkm::cont::CoordinateSystem& coords, IdHandle& faceConn, IdHandle& faceOffsets, Id4Handle& externalTriangles); virtual ~UnstructuredContainer(); const MeshConnectivityBase* Construct(const vtkm::cont::DeviceAdapterId deviceId); }; class StructuredContainer : public MeshConnContainer { protected: typedef vtkm::cont::ArrayHandle> Id4Handle; vtkm::Id3 CellDims; vtkm::Id3 PointDims; vtkm::Bounds CoordinateBounds; vtkm::cont::CoordinateSystem Coords; vtkm::cont::CellSetStructured<3> Cellset; private: VTKM_CONT StructuredContainer() {} public: VTKM_CONT StructuredContainer(const vtkm::cont::CellSetStructured<3>& cellset, const vtkm::cont::CoordinateSystem& coords, Id4Handle& externalTriangles); const MeshConnectivityBase* Construct(const vtkm::cont::DeviceAdapterId deviceId) override; }; //structure mesh conn class UnstructuredSingleContainer : public MeshConnContainer { public: typedef vtkm::cont::ArrayHandle IdHandle; typedef vtkm::cont::ArrayHandle> Id4Handle; typedef vtkm::cont::ArrayHandleCounting CountingHandle; typedef vtkm::cont::ArrayHandleConstant ShapesHandle; typedef vtkm::cont::ArrayHandleConstant NumIndicesHandle; // Control Environment Handles IdHandle FaceConnectivity; CountingHandle CellOffsets; IdHandle CellConnectivity; vtkm::Bounds CoordinateBounds; vtkm::cont::CoordinateSystem Coords; vtkm::cont::CellSetSingleType<> Cellset; vtkm::Int32 ShapeId; vtkm::Int32 NumIndices; vtkm::Int32 NumFaces; private: VTKM_CONT UnstructuredSingleContainer(); public: VTKM_CONT UnstructuredSingleContainer(const vtkm::cont::CellSetSingleType<>& cellset, const vtkm::cont::CoordinateSystem& coords, IdHandle& faceConn, Id4Handle& externalFaces); const MeshConnectivityBase* Construct(const vtkm::cont::DeviceAdapterId deviceId) override; }; //UnstructuredSingleContainer } } } //namespace vtkm::rendering::raytracing #endif