10#ifndef MUELU_BOUNDARYDETECTION_HPP
11#define MUELU_BOUNDARYDETECTION_HPP
15#include "Kokkos_Core.hpp"
16#if KOKKOS_VERSION >= 40799
17#include "KokkosKernels_ArithTraits.hpp"
19#include "Kokkos_ArithTraits.hpp"
21#include "MueLu_LWGraph_kokkos.hpp"
22#include "MueLu_Utilities.hpp"
23#include "Teuchos_RCP.hpp"
24#include "Xpetra_ConfigDefs.hpp"
25#include "Xpetra_CrsGraph.hpp"
26#include "Xpetra_MultiVector.hpp"
37template <
class local_matrix_type>
44#if KOKKOS_VERSION >= 40799
45 using ATS = KokkosKernels::ArithTraits<scalar_type>;
47 using ATS = Kokkos::ArithTraits<scalar_type>;
64 KOKKOS_FORCEINLINE_FUNCTION
66 auto row =
A.rowConst(rlid);
91template <
class local_matrix_type,
bool useGreedyDirichlet>
98#if KOKKOS_VERSION >= 40799
99 using ATS = KokkosKernels::ArithTraits<scalar_type>;
101 using ATS = Kokkos::ArithTraits<scalar_type>;
120 KOKKOS_FORCEINLINE_FUNCTION
123 auto row =
A.rowConst(rlid);
125 bool rowIsDirichlet =
true;
127 auto clid = row.colidx(k);
128 auto val = row.value(k);
132 rowIsDirichlet =
false;
137 if constexpr (useGreedyDirichlet) {
138 if (rowIsDirichlet) {
143 if (!rowIsDirichlet) {
148 if constexpr (!useGreedyDirichlet)
160template <
class local_matrix_type>
167#if KOKKOS_VERSION >= 40799
168 using ATS = KokkosKernels::ArithTraits<scalar_type>;
170 using ATS = Kokkos::ArithTraits<scalar_type>;
173#if KOKKOS_VERSION >= 40799
174 using magATS = KokkosKernels::ArithTraits<magnitudeType>;
176 using magATS = Kokkos::ArithTraits<magnitudeType>;
190 KOKKOS_FORCEINLINE_FUNCTION
194 auto row =
A.rowConst(rlid);
196 auto clid = row.colidx(k);
197 auto val = row.value(k);
202 if (ATS::magnitude(rowsum) > ATS::magnitude(diagval) *
rowSumTol) {
212template <
class local_matrix_type,
class Functor,
class... RemainingFunctors>
221 BoundaryFunctor(local_matrix_type& A_, Functor& functor_, RemainingFunctors&... remainingFunctors_)
231template <
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
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
Kokkos::ArithTraits< scalar_type > ATS
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_)
Kokkos::ArithTraits< magnitudeType > magATS
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::memory_space memory_space
typename ATS::magnitudeType magnitudeType
boundary_nodes_view boundaryNodes
Kokkos::ArithTraits< scalar_type > ATS
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
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
Kokkos::ArithTraits< scalar_type > ATS
typename local_matrix_type::value_type scalar_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(const local_ordinal_type rblid) const
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_)