5#ifndef IPPL_LAGRANGESPACE_H
6#define IPPL_LAGRANGESPACE_H
14 return static_cast<unsigned>(
power(
static_cast<int>(Order + 1),
static_cast<int>(
Dim)));
30 template <
typename T,
unsigned Dim,
unsigned Order,
typename ElementType,
31 typename QuadratureType,
typename FieldLHS,
typename FieldRHS>
34 :
public FiniteElementSpace<T, Dim, getLagrangeNumElementDOFs(Dim, Order), ElementType,
35 QuadratureType, FieldLHS, FieldRHS> {
42 QuadratureType, FieldLHS, FieldRHS>
::dim;
45 static constexpr unsigned order = Order;
84 const QuadratureType& quadrature,
const Layout_t& layout);
96 const QuadratureType& quadrature);
133 const size_t& globalDOFIndex)
const override;
144 const size_t& localDOFIndex)
const override;
163 const size_t& element_index)
const override;
179 const point_t& localPoint)
const;
192 const size_t& localDOF,
const point_t& localPoint)
const;
206 template <
typename F>
209 template <
typename F>
212 template <
typename F>
215 template <
typename F>
218 template <
typename F>
221 template <
typename F>
234 template <
typename F>
258 template <
typename F>
284 const size_t& globalDOFIndex)
const;
289 const point_t& localPoint)
const;
304 for (
size_t d = 0; d <
Dim; ++d) {
305 if (ndindex[d] <= 0 || ndindex[d] >= this->
nr_m[d] - 1) {
typename ippl::detail::ViewType< ippl::Vector< double, Dim >, 1 >::view_type view_type
constexpr T power(T base, unsigned exponent)
constexpr unsigned getLagrangeNumElementDOFs(unsigned Dim, unsigned Order)
FiniteElementSpace(UniformCartesian< T, Dim > &mesh, ElementType &ref_element, const QuadratureType &quadrature)
Vector< size_t, Dim > nr_m
FiniteElementSpace< T, Dim, numElementDOFs, ElementType, QuadratureType, FieldLHS, FieldRHS >::vertex_points_t vertex_points_t
T computeAvg(const FieldLHS &u_h) const
Given a field, compute the average.
FieldLHS evaluateAx_upperlower(FieldLHS &field, F &evalFunction) const
KOKKOS_FUNCTION size_t numGlobalDOFs() const override
Degree of Freedom operations //////////////////////////////////////.
detail::ViewType< T, Dim, Kokkos::MemoryTraits< Kokkos::Atomic > >::view_type AtomicViewType
LagrangeSpace(UniformCartesian< T, Dim > &mesh, ElementType &ref_element, const QuadratureType &quadrature, const Layout_t &layout)
Construct a new LagrangeSpace object.
FieldLHS evaluateAx_inversediag(FieldLHS &field, F &evalFunction) const
FieldLHS evaluateAx_lift(FieldLHS &field, F &evalFunction) const
Assemble the left stiffness matrix A of the system but only for the boundary values,...
detail::ViewType< T, Dim >::view_type ViewType
FieldLayout< Dim > Layout_t
KOKKOS_FUNCTION Vector< size_t, numElementDOFs > getGlobalDOFIndices(const size_t &element_index) const override
Get the global DOF indices (vector of global DOF indices) of an element.
void evaluateLoadVector(FieldRHS &field) const
Assemble the load vector b of the system Ax = b.
DeviceStruct getDeviceMirror() const
Device struct definitions /////////////////////////////////////////.
KOKKOS_FUNCTION size_t getLocalDOFIndex(const size_t &elementIndex, const size_t &globalDOFIndex) const override
Get the elements local DOF from the element index and global DOF index.
void initialize(UniformCartesian< T, Dim > &mesh, const Layout_t &layout)
Initialize a LagrangeSpace object created with the default constructor.
LagrangeSpace(UniformCartesian< T, Dim > &mesh, ElementType &ref_element, const QuadratureType &quadrature)
Construct a new LagrangeSpace object (without layout) This constructor is made to work with the defau...
KOKKOS_FUNCTION bool isDOFOnBoundary(const indices_t &ndindex) const
Check if a DOF is on the boundary of the mesh.
FieldLHS evaluateAx(FieldLHS &field, F &evalFunction) const
Assembly operations ///////////////////////////////////////////////.
static constexpr unsigned numElementDOFs
KOKKOS_FUNCTION T evaluateRefElementShapeFunction(const size_t &localDOF, const point_t &localPoint) const
Basis functions and gradients /////////////////////////////////////.
KOKKOS_FUNCTION Vector< size_t, numElementDOFs > getLocalDOFIndices() const override
Get the local DOF indices (vector of local DOF indices) They are independent of the specific element ...
T computeErrorL2(const FieldLHS &u_h, const F &u_sol) const
Error norm computations ///////////////////////////////////////////.
KOKKOS_FUNCTION point_t evaluateRefElementShapeFunctionGradient(const size_t &localDOF, const point_t &localPoint) const
Evaluate the gradient of the shape function of a local degree of freedom at a given point in the refe...
Kokkos::View< size_t * > elementIndices
static constexpr unsigned order
static constexpr unsigned dim
FieldLHS evaluateAx_diag(FieldLHS &field, F &evalFunction) const
FiniteElementSpace< T, Dim, numElementDOFs, ElementType, QuadratureType, FieldLHS, FieldRHS >::point_t point_t
FiniteElementSpace< T, Dim, numElementDOFs, ElementType, QuadratureType, FieldLHS, FieldRHS >::indices_t indices_t
FieldLHS evaluateAx_upper(FieldLHS &field, F &evalFunction) const
static constexpr unsigned numElementVertices
void initializeElementIndices(const Layout_t &layout)
Initialize a Kokkos view containing the element indices. This distributes the elements among MPI rank...
FieldLHS evaluateAx_lower(FieldLHS &field, F &evalFunction) const
KOKKOS_FUNCTION size_t getGlobalDOFIndex(const size_t &elementIndex, const size_t &localDOFIndex) const override
Get the global DOF index from the element index and local DOF.
Device struct for copies //////////////////////////////////////////.
KOKKOS_FUNCTION size_t getLocalDOFIndex(const indices_t &elementNDIndex, const size_t &globalDOFIndex) const
KOKKOS_FUNCTION Vector< size_t, numElementDOFs > getGlobalDOFIndices(const indices_t &elementNDIndex) const
ElementType ref_element_m
Vector< size_t, Dim > nr_m
KOKKOS_FUNCTION indices_t getMeshVertexNDIndex(const size_t &vertex_index) const
KOKKOS_FUNCTION T evaluateRefElementShapeFunction(const size_t &localDOF, const point_t &localPoint) const
static constexpr unsigned numElementDOFs
Kokkos::View< typename NPtr< T, Dim >::type, Properties... > view_type