14 #include "axom/core.hpp"
15 #include "geometry.hpp"
19 #include "smith/numerics/functional/typedefs.hpp"
21 inline bool isH1(
const mfem::FiniteElementSpace& fes)
23 return (fes.FEColl()->GetContType() == mfem::FiniteElementCollection::CONTINUOUS);
26 inline bool isHcurl(
const mfem::FiniteElementSpace& fes)
28 return (fes.FEColl()->GetContType() == mfem::FiniteElementCollection::TANGENTIAL);
31 inline bool isDG(
const mfem::FiniteElementSpace& fes)
33 return (fes.FEColl()->GetContType() == mfem::FiniteElementCollection::DISCONTINUOUS);
49 static constexpr uint64_t
sign_mask = 0x8000'0000'0000'0000;
51 static constexpr uint64_t
index_mask = 0x0000'FFFF'FFFF'FFFF'FFFF;
107 template <
typename T>
130 Array2D(
int m,
int n) :
values(uint64_t(m) * uint64_t(n), 0),
dim{uint64_t(m), uint64_t(n)} {}
133 Array2D(std::vector<T>&& data,
int m,
int n) :
values(data),
dim{uint64_t(m), uint64_t(n)} {}
165 ElementRestriction(
const fes_t* fes, mfem::Geometry::Type elem_geom,
const std::vector<int>& domain_elements);
168 uint64_t
ESize()
const;
171 uint64_t
LSize()
const;
185 void Gather(
const mfem::Vector& L_vector, mfem::Vector& E_vector)
const;
188 void ScatterAdd(
const mfem::Vector& E_vector, mfem::Vector& L_vector)
const;
209 axom::Array<DoF, 2, smith::detail::host_memory_space>
dof_info;
228 uint64_t
ESize()
const;
231 uint64_t
LSize()
const;
237 void Gather(
const mfem::Vector& L_vector, mfem::BlockVector& E_block_vector)
const;
240 void ScatterAdd(
const mfem::BlockVector& E_block_vector, mfem::Vector& L_vector)
const;
254 axom::Array<DoF, 2, smith::detail::host_memory_space> GetElementDofs(
const smith::fes_t* fes,
255 mfem::Geometry::Type geom);
264 axom::Array<DoF, 2, smith::detail::host_memory_space> GetFaceDofs(
const smith::fes_t* fes,
265 mfem::Geometry::Type face_geom, FaceType
type);
268 axom::Array<DoF, 2, smith::detail::host_memory_space> GetFaceDofs(
const smith::fes_t* fes,
269 mfem::Geometry::Type face_geom,
270 const std::vector<int>& mfem_face_ids);
many of the functions in this file amount to extracting element indices from an mesh_t like
This file defines the host memory space.
Accelerator functionality.
constexpr SMITH_HOST_DEVICE auto type(const tuple< T... > &values)
a function intended to be used for extracting the ith type from a tuple.
Array2D(std::vector< T > &&data, uint64_t m, uint64_t n)
create an m-by-n two-dimensional array initialized with the values in data (assuming row-major)
uint64_t dim[2]
the number of rows and columns in the array, respectively
Range< T > operator()(int i)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const T & operator()(int i, int j) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< T > values
the values of each element in the array
Range< const T > operator()(int i) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Array2D(uint64_t m, uint64_t n)
create an uninitialized m-by-n two-dimensional array
Range< const T > operator()(uint64_t i) const
access an immutable "row" of this Array2D
Range< T > operator()(uint64_t i)
access a mutable "row" of this Array2D
Array2D(int m, int n)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Array2D(std::vector< T > &&data, int m, int n)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T & operator()(int i, int j)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T & operator()(uint64_t i, uint64_t j)
access a mutable element of this Array2D
const T & operator()(uint64_t i, uint64_t j) const
access an immutable element of this Array2D
a struct of metadata (index, sign, orientation) associated with a degree of freedom
static constexpr uint64_t sign_shift
number of trailing zeros in sign_mask
static constexpr uint64_t orientation_shift
number of trailing zeros in orientation_mask
static constexpr uint64_t sign_mask
bits for sign field
int sign() const
get the sign field of this DoF
static constexpr uint64_t index_shift
number of trailing zeros in index_mask
static constexpr uint64_t orientation_mask
bits for orientation field
static constexpr uint64_t index_mask
bits for the index field
DoF(uint64_t index, uint64_t sign=0, uint64_t orientation=0)
create a DoF from the given index, sign and orientation values
uint64_t index() const
get the index field of this DoF
void operator=(const DoF &other)
copy assignment operator
uint64_t bits
a 64-bit word encoding the following metadata (laid out from MSB to LSB);
DoF(const DoF &other)
copy ctor
uint64_t orientation() const
get the orientation field of this DoF
a small struct used to enable range-based for loops in Array2D
T * end()
the end of the range
T * begin()
the beginning of the range
T * ptr[2]
the beginning and end of the range
a generalization of mfem::ElementRestriction that works with multiple kinds of element geometries....
uint64_t ESize() const
the size of the "E-vector" associated with this restriction operator
void Gather(const mfem::Vector &L_vector, mfem::BlockVector &E_block_vector) const
"L->E" in mfem parlance, each element gathers the values that belong to it, and stores them in the "E...
BlockElementRestriction()
default ctor leaves this object uninitialized
uint64_t LSize() const
the size of the "L-vector" associated with this restriction operator
void ScatterAdd(const mfem::BlockVector &E_block_vector, mfem::Vector &L_vector) const
"E->L" in mfem parlance, each element scatter-adds its local vector into the appropriate place in the...
std::map< mfem::Geometry::Type, ElementRestriction > restrictions
the individual ElementRestriction operators for each element geometry
mfem::Array< int > bOffsets() const
block offsets used when constructing mfem::HypreParVectors
a class for representing a geometric region that can be used for integration
void GetElementVDofs(int i, std::vector< DoF > &dofs) const
Get a list of DoFs for element i
uint64_t esize
the size of the "E-vector"
uint64_t LSize() const
the size of the "L-vector" associated with this restriction operator
mfem::Ordering::Type ordering
whether the underlying dofs are arranged "byNodes" or "byVDim"
void ScatterAdd(const mfem::Vector &E_vector, mfem::Vector &L_vector) const
"E->L" in mfem parlance, each element scatter-adds its local vector into the appropriate place in the...
uint64_t lsize
the size of the "L-vector"
ElementRestriction()
default ctor leaves this object uninitialized
uint64_t num_nodes
the total number of nodes in the mesh
axom::Array< DoF, 2, smith::detail::host_memory_space > dof_info
a 2D array (num_elements-by-nodes_per_elem) holding the dof info extracted from the finite element sp...
void Gather(const mfem::Vector &L_vector, mfem::Vector &E_vector) const
"L->E" in mfem parlance, each element gathers the values that belong to it, and stores them in the "E...
uint64_t components
the number of components at each node
uint64_t num_elements
the number of elements of the given geometry
DoF GetVDof(DoF node, uint64_t component) const
get the dof information for a given node / component
uint64_t nodes_per_elem
the number of nodes in each element
uint64_t ESize() const
the size of the "E-vector" associated with this restriction operator