20 #include <string_view>
23 #include "axom/core.hpp"
24 #include "smith/smith_config.hpp"
61 class Array<
smith::Nothing, 2, MemorySpace::Dynamic> {
64 Array(uint32_t, uint32_t) {}
68 class ArrayView<
smith::Nothing, 2, MemorySpace::Dynamic> {
70 ArrayView(Array<smith::Nothing, 2, MemorySpace::Dynamic> ) {}
82 class Array<
smith::Empty, 2, MemorySpace::Dynamic> {
85 Array(uint32_t, uint32_t) {}
89 class ArrayView<
smith::Empty, 2, MemorySpace::Dynamic> {
91 ArrayView(Array<smith::Empty, 2, MemorySpace::Dynamic> ) {}
111 constexpr std::array<mfem::Geometry::Type, 5>
qdata_geometries = {mfem::Geometry::SEGMENT, mfem::Geometry::TRIANGLE,
112 mfem::Geometry::SQUARE, mfem::Geometry::TETRAHEDRON,
113 mfem::Geometry::CUBE};
115 constexpr std::array<std::string_view, 5>
qdata_geometry_names = {
"Segment",
"Triangle",
"Square",
"Tetrahedron",
127 template <
typename T>
130 using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
141 for (
auto geom : detail::qdata_geometries) {
142 if (elements[uint32_t(geom)] > 0) {
143 data[geom] = axom::Array<T, 2>(elements[uint32_t(geom)], qpts_per_element[uint32_t(geom)]);
144 data[geom].fill(value);
153 axom::ArrayView<T, 2>
operator[](mfem::Geometry::Type geom) {
return axom::ArrayView<T, 2>(
data.at(geom)); }
156 std::map<mfem::Geometry::Type, axom::Array<T, 2>>
data;
162 using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
166 axom::ArrayView<Nothing, 2>
operator[](mfem::Geometry::Type) {
return axom::ArrayView<Nothing, 2>(
data); }
168 axom::Array<Nothing, 2, axom::MemorySpace::Dynamic>
data;
172 struct QuadratureData<Empty> {
173 using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
177 axom::ArrayView<Empty, 2>
operator[](mfem::Geometry::Type) {
return axom::ArrayView<Empty, 2>(
data); }
179 axom::Array<Empty, 2, axom::MemorySpace::Dynamic>
data;
184 extern std::shared_ptr<QuadratureData<Nothing>>
NoQData;
185 extern std::shared_ptr<QuadratureData<Empty>>
EmptyQData;
This file contains the interface used for initializing/terminating any hardware accelerator-related f...
#define SMITH_HOST_DEVICE
Macro that evaluates to __host__ __device__ when compiling with nvcc and does nothing on a host compi...
Accelerator functionality.
std::shared_ptr< QuadratureData< Nothing > > NoQData
a single instance of a QuadratureData container of Nothings, since they are all interchangeable
std::shared_ptr< QuadratureData< Empty > > EmptyQData
a single instance of a QuadratureData container of Emptys, since they are all interchangeable
constexpr std::array< std::string_view, 5 > qdata_geometry_names
a list of strings associated with the corresponding mfem::Geometry type supported by QuadratureData
constexpr std::array< mfem::Geometry::Type, 5 > qdata_geometries
a list of mfem::Geometry types supported by QuadratureData
see Nothing for a complete description of this class and when to use it
these classes are a little confusing. These two special types represent the similar (but different) c...
A class for storing and access user-defined types at quadrature points.
axom::ArrayView< T, 2 > operator[](mfem::Geometry::Type geom)
return the 2D array of quadrature point values for elements of the specified geometry
QuadratureData(geom_array_t elements, geom_array_t qpts_per_element, T value=T{})
Initialize a new quadrature data buffer, optionally with some initial value.
std::array< uint32_t, mfem::Geometry::NUM_GEOMETRIES > geom_array_t
a list of integers, one associated with each type of mfem::Geometry
std::map< mfem::Geometry::Type, axom::Array< T, 2 > > data
a 3D array indexed by (which geometry, which element, which quadrature point)