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