6 #include "axom/core.hpp"
7 #include "geometry.hpp"
9 inline bool isH1(
const mfem::FiniteElementSpace& fes)
11 return (fes.FEColl()->GetContType() == mfem::FiniteElementCollection::CONTINUOUS);
14 inline bool isHcurl(
const mfem::FiniteElementSpace& fes)
16 return (fes.FEColl()->GetContType() == mfem::FiniteElementCollection::TANGENTIAL);
19 inline bool isDG(
const mfem::FiniteElementSpace& fes)
21 return (fes.FEColl()->GetContType() == mfem::FiniteElementCollection::DISCONTINUOUS);
37 static constexpr uint64_t
sign_mask = 0x8000'0000'0000'0000;
39 static constexpr uint64_t
index_mask = 0x0000'FFFF'FFFF'FFFF'FFFF;
118 Array2D(
int m,
int n) :
values(uint64_t(m) * uint64_t(n), 0),
dim{uint64_t(m), uint64_t(n)} {}
121 Array2D(std::vector<T>&& data,
int m,
int n) :
values(data),
dim{uint64_t(m), uint64_t(n)} {}
151 ElementRestriction(
const mfem::FiniteElementSpace* fes, mfem::Geometry::Type elem_geom);
157 uint64_t
ESize()
const;
160 uint64_t
LSize()
const;
174 void Gather(
const mfem::Vector& L_vector, mfem::Vector& E_vector)
const;
177 void ScatterAdd(
const mfem::Vector& E_vector, mfem::Vector& L_vector)
const;
198 axom::Array<DoF, 2, axom::MemorySpace::Host>
dof_info;
220 uint64_t
ESize()
const;
223 uint64_t
LSize()
const;
229 void Gather(
const mfem::Vector& L_vector, mfem::BlockVector& E_block_vector)
const;
232 void ScatterAdd(
const mfem::BlockVector& E_block_vector, mfem::Vector& L_vector)
const;
246 Array2D<DoF> GetElementDofs(mfem::FiniteElementSpace* fes, mfem::Geometry::Type geom);
255 Array2D<DoF> GetFaceDofs(mfem::FiniteElementSpace* fes, mfem::Geometry::Type face_geom, FaceType
type);
Accelerator functionality.
bool isHcurl(const mfem::ParFiniteElementSpace &fes)
return whether or not the underlying function space is Hcurl or not
constexpr SERAC_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....
BlockElementRestriction()
default ctor leaves this object uninitialized
mfem::Array< int > bOffsets() const
block offsets used when constructing mfem::HypreParVectors
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...
uint64_t ESize() const
the size of the "E-vector" associated with this restriction operator
std::map< mfem::Geometry::Type, ElementRestriction > restrictions
the individual ElementRestriction operators for each element geometry
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...
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"
uint64_t num_nodes
the total number of nodes in the mesh
ElementRestriction()
default ctor leaves this object uninitialized
uint64_t nodes_per_elem
the number of nodes in each element
uint64_t lsize
the size of the "L-vector"
void GetElementVDofs(int i, std::vector< DoF > &dofs) const
Get a list of DoFs for element i
axom::Array< DoF, 2, axom::MemorySpace::Host > dof_info
a 2D array (num_elements-by-nodes_per_elem) holding the dof info extracted from the finite element sp...
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 esize
the size of the "E-vector"
uint64_t num_elements
the number of elements of the given geometry
uint64_t components
the number of components at each node
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 LSize() const
the size of the "L-vector" associated with this restriction operator
uint64_t ESize() const
the size of the "E-vector" associated with this restriction operator
DoF GetVDof(DoF node, uint64_t component) const
get the dof information for a given node / component