10 #ifndef MUELU_BOUNDARYDETECTION_HPP
11 #define MUELU_BOUNDARYDETECTION_HPP
14 #include <type_traits>
15 #include "Kokkos_Core.hpp"
16 #include "Kokkos_ArithTraits.hpp"
17 #include "MueLu_LWGraph_kokkos.hpp"
18 #include "MueLu_Utilities.hpp"
24 namespace MueLu::BoundaryDetection {
33 template <
class local_matrix_type>
40 using ATS = Kokkos::ArithTraits<scalar_type>;
56 KOKKOS_FORCEINLINE_FUNCTION
58 auto row =
A.rowConst(rlid);
63 if ((rlid != static_cast<local_ordinal_type>(clid)) && (ATS::magnitude(val) >
dirichletThreshold)) {
83 template <
class local_matrix_type,
bool useGreedyDirichlet>
90 using ATS = Kokkos::ArithTraits<scalar_type>;
108 KOKKOS_FORCEINLINE_FUNCTION
111 auto row =
A.rowConst(rlid);
113 bool rowIsDirichlet =
true;
115 auto clid = row.colidx(k);
116 auto val = row.value(k);
117 if ((rlid != static_cast<local_ordinal_type>(clid)) && (ATS::magnitude(val) >
dirichletThreshold)) {
120 rowIsDirichlet =
false;
125 if constexpr (useGreedyDirichlet) {
126 if (rowIsDirichlet) {
131 if (!rowIsDirichlet) {
136 if constexpr (!useGreedyDirichlet)
148 template <
class local_matrix_type>
155 using ATS = Kokkos::ArithTraits<scalar_type>;
157 using magATS = Kokkos::ArithTraits<magnitudeType>;
170 KOKKOS_FORCEINLINE_FUNCTION
174 auto row =
A.rowConst(rlid);
176 auto clid = row.colidx(k);
177 auto val = row.value(k);
178 if (rlid == static_cast<local_ordinal_type>(clid))
182 if (ATS::magnitude(rowsum) > ATS::magnitude(diagval) *
rowSumTol) {
192 template <
class local_matrix_type,
class Functor,
class... RemainingFunctors>
201 BoundaryFunctor(local_matrix_type& A_, Functor& functor_, RemainingFunctors&... remainingFunctors_)
211 template <
class local_matrix_type,
class Functor>
Kokkos::ArithTraits< scalar_type > ATS
typename local_matrix_type::value_type scalar_type
magnitudeType dirichletThreshold
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::memory_space memory_space
typename ATS::magnitudeType magnitudeType
Kokkos::View< bool *, memory_space > boundary_nodes_view
boundary_nodes_view boundaryNodes
BoundaryFunctor< local_matrix_type, RemainingFunctors...> remainingFunctors
Kokkos::ArithTraits< magnitudeType > magATS
KOKKOS_FUNCTION void operator()(const local_ordinal_type rlid) const
Kokkos::View< bool *, memory_space > boundary_nodes_view
local_ordinal_type blockSize
BoundaryFunctor(local_matrix_type &A_, Functor &functor_, RemainingFunctors &...remainingFunctors_)
boundary_nodes_view boundaryNodes
KOKKOS_FUNCTION void operator()(const local_ordinal_type rlid) const
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::ArithTraits< scalar_type > ATS
typename local_matrix_type::memory_space memory_space
VectorDirichletFunctor(local_matrix_type &A_, local_ordinal_type blockSize_, boundary_nodes_view boundaryNodes_, magnitudeType dirichletThreshold_, local_ordinal_type dirichletNonzeroThreshold_)
Functor for marking nodes as Dirichlet.
typename local_matrix_type::value_type scalar_type
BoundaryFunctor(local_matrix_type &A_, Functor &functor_)
boundary_nodes_view boundaryNodes
local_ordinal_type dirichletNonzeroThreshold
KOKKOS_FORCEINLINE_FUNCTION void operator()(const local_ordinal_type rblid) const
Kokkos::ArithTraits< scalar_type > ATS
typename ATS::magnitudeType magnitudeType
Functor for marking nodes as Dirichlet based on rowsum.
Functor that serially applies sub-functors to rows.
magnitudeType dirichletThreshold
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< bool *, memory_space > boundary_nodes_view
Functor for marking nodes as Dirichlet in a block operator.
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::ordinal_type local_ordinal_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(const local_ordinal_type rlid) const
typename local_matrix_type::ordinal_type local_ordinal_type
RowSumFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, magnitudeType rowSumTol_)
typename ATS::magnitudeType magnitudeType
local_ordinal_type dirichletNonzeroThreshold
PointDirichletFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, magnitudeType dirichletThreshold_, local_ordinal_type dirichletNonzeroThreshold_)
KOKKOS_FORCEINLINE_FUNCTION void operator()(const local_ordinal_type rlid) const