48 template <
typename Derived>
122 template <
typename Derived>
130 template <
typename Derived>
133 _u(kokkosSystems(), _var),
135 _default_diag(&Derived::computeQpJacobian == &
NodalKernel::computeQpJacobian),
136 _default_offdiag(&Derived::computeQpOffDiagJacobian == &
NodalKernel::computeQpOffDiagJacobian)
140 template <
typename Derived>
144 ::Kokkos::RangePolicy<ResidualLoop, ExecSpace, ::Kokkos::IndexType<ThreadID>> policy(
145 0, _boundary_restricted ? numKokkosBoundaryNodes() : numKokkosBlockNodes());
146 ::Kokkos::parallel_for(policy, *static_cast<Derived *>(
this));
150 template <
typename Derived>
156 ::Kokkos::RangePolicy<JacobianLoop, ExecSpace, ::Kokkos::IndexType<ThreadID>> policy(
157 0, _boundary_restricted ? numKokkosBoundaryNodes() : numKokkosBlockNodes());
158 ::Kokkos::parallel_for(policy, *static_cast<Derived *>(
this));
162 if (!_default_offdiag)
164 auto & sys = kokkosSystem(_kokkos_var.sys());
166 _thread.resize({sys.getCoupling(_kokkos_var.var()).size(),
167 _boundary_restricted ? numKokkosBoundaryNodes() : numKokkosBlockNodes()});
169 ::Kokkos::RangePolicy<OffDiagJacobianLoop, ExecSpace, ::Kokkos::IndexType<ThreadID>> policy(
171 ::Kokkos::parallel_for(policy, *static_cast<Derived *>(
this));
176 template <
typename Derived>
180 auto kernel =
static_cast<const Derived *
>(
this);
181 auto node = _boundary_restricted ? kokkosBoundaryNodeID(tid) : kokkosBlockNodeID(tid);
182 auto & sys = kokkosSystem(_kokkos_var.sys());
184 if (!sys.isNodalDefined(node, _kokkos_var.var()))
187 Real local_re = kernel->computeQpResidual(node);
189 accumulateTaggedNodalResidual(
true, local_re, node);
192 template <
typename Derived>
196 auto kernel =
static_cast<const Derived *
>(
this);
197 auto node = _boundary_restricted ? kokkosBoundaryNodeID(tid) : kokkosBlockNodeID(tid);
198 auto & sys = kokkosSystem(_kokkos_var.sys());
200 if (!sys.isNodalDefined(node, _kokkos_var.var()))
203 Real local_ke = kernel->computeQpJacobian(node);
205 accumulateTaggedNodalMatrix(
true, local_ke, node, _kokkos_var.var());
208 template <
typename Derived>
212 auto kernel =
static_cast<const Derived *
>(
this);
213 auto node = _boundary_restricted ? kokkosBoundaryNodeID(_thread(tid, 1))
214 : kokkosBlockNodeID(_thread(tid, 1));
215 auto & sys = kokkosSystem(_kokkos_var.sys());
216 auto jvar = sys.getCoupling(_kokkos_var.var())[_thread(tid, 0)];
218 if (!sys.isNodalDefined(node, _kokkos_var.var()))
221 Real local_ke = kernel->computeQpOffDiagJacobian(jvar, node);
223 accumulateTaggedNodalMatrix(
true, local_ke, node, jvar);
229 #define usingKokkosNodalKernelMembers(T) \ 230 usingKokkosNodalKernelBaseMembers; \ 233 using Moose::Kokkos::NodalKernel<T>::_u; \ 236 using Moose::Kokkos::NodalKernel<T>::operator() const bool _default_offdiag
Flag whether computeQpOffDiagJacobian() was not defined in the derived class.
static InputParameters validParams()
const InputParameters & parameters() const
Get the parameters of the object.
The base class for a user to derive their own Kokkos nodal kernels.
virtual void computeJacobian() override
Compute the Jacobian at one node.
The base class for Kokkos nodal kernels.
virtual void computeResidual() override
Dispatch residual calculation.
KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int, const ContiguousNodeID) const
Compute off-diagonal Jacobian contribution on a node.
dof_id_type ContiguousNodeID
virtual void computeResidual() override
Compute the residual at the current node.
KOKKOS_FUNCTION Real computeQpJacobian(const ContiguousNodeID) const
Default methods to prevent compile errors even when these methods were not defined in the derived cla...
static InputParameters validParams()
virtual void computeJacobian() override
Dispatch diagonal and off-diagonal Jacobian calculation.
const VariableNodalValue _u
Current solution at nodes.
const bool _boundary_restricted
Flag whether this kernel is boundary-restricted.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
NodalKernel(const InputParameters ¶meters)
Constructor.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
bool boundaryRestricted(const std::set< BoundaryID > &boundary_ids)
const bool _default_diag
Flag whether computeJacobian() was not defined in the derived class.
KOKKOS_FUNCTION void operator()(ResidualLoop, const ThreadID tid) const
The parallel computation entry functions called by Kokkos.