17 #include "axom/core.hpp"
19 #include "serac/serac_config.hpp"
57 class Array<
serac::Nothing, 2, MemorySpace::Dynamic> {
60 Array(uint32_t, uint32_t) {}
64 class ArrayView<
serac::Nothing, 2, MemorySpace::Dynamic> {
66 ArrayView(Array<serac::Nothing, 2, MemorySpace::Dynamic> ) {}
78 class Array<
serac::Empty, 2, MemorySpace::Dynamic> {
81 Array(uint32_t, uint32_t) {}
85 class ArrayView<
serac::Empty, 2, MemorySpace::Dynamic> {
87 ArrayView(Array<serac::Empty, 2, MemorySpace::Dynamic> ) {}
111 template <
typename T>
114 using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
125 constexpr std::array geometries = {mfem::Geometry::SEGMENT, mfem::Geometry::TRIANGLE, mfem::Geometry::SQUARE,
126 mfem::Geometry::TETRAHEDRON, mfem::Geometry::CUBE};
128 for (
auto geom : geometries) {
129 if (elements[uint32_t(geom)] > 0) {
130 data[geom] = axom::Array<T, 2>(elements[uint32_t(geom)], qpts_per_element[uint32_t(geom)]);
131 data[geom].fill(value);
140 axom::ArrayView<T, 2>
operator[](mfem::Geometry::Type geom) {
return axom::ArrayView<T, 2>(
data.at(geom)); }
143 std::map<mfem::Geometry::Type, axom::Array<T, 2> >
data;
149 using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
153 axom::ArrayView<Nothing, 2>
operator[](mfem::Geometry::Type) {
return axom::ArrayView<Nothing, 2>(
data); }
155 axom::Array<Nothing, 2, axom::MemorySpace::Dynamic>
data;
159 struct QuadratureData<Empty> {
160 using geom_array_t = std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES>;
164 axom::ArrayView<Empty, 2>
operator[](mfem::Geometry::Type) {
return axom::ArrayView<Empty, 2>(
data); }
166 axom::Array<Empty, 2, axom::MemorySpace::Dynamic>
data;
171 extern std::shared_ptr<QuadratureData<Nothing> >
NoQData;
172 extern std::shared_ptr<QuadratureData<Empty> >
EmptyQData;
This file contains the interface used for initializing/terminating any hardware accelerator-related f...
#define SERAC_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< Empty > > EmptyQData
a single instance of a QuadratureData container of Emptys, since they are all interchangeable
std::shared_ptr< QuadratureData< Nothing > > NoQData
a single instance of a QuadratureData container of Nothings, since they are all interchangeable
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
std::array< uint32_t, mfem::Geometry::NUM_GEOMETRIES > geom_array_t
a list of integers, one associated with each type of mfem::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::map< mfem::Geometry::Type, axom::Array< T, 2 > > data
a 3D array indexed by (which geometry, which element, which quadrature point)