//@HEADER // ************************************************************************ // // Kokkos v. 4.0 // Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // // Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. // See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //@HEADER // Use "scalar" version of mean-based preconditioner (i.e., a preconditioner // with double as the scalar type). This is currently necessary to get the // MueLu tests to pass on OpenMP and Cuda due to various kernels that don't // work with the PCE scalar type. #define USE_SCALAR_MEAN_BASED_PREC 1 #include "Stokhos_Tpetra_UQ_PCE.hpp" #include "Stokhos_Sacado_Kokkos_MP_Vector.hpp" #if defined( HAVE_STOKHOS_BELOS ) #include "Belos_TpetraAdapter_UQ_PCE.hpp" #endif #if defined( HAVE_STOKHOS_MUELU ) #include "Stokhos_MueLu_UQ_PCE.hpp" #endif #include #include #include #include #if defined(HAVE_TRILINOSCOUPLINGS_BELOS) && defined(HAVE_TRILINOSCOUPLINGS_MUELU) #include #include "Stokhos_Tpetra_Utilities.hpp" namespace Kokkos { namespace Example { // Overload of build_mean_based_muelu_preconditioner() for UQ::PCE scalar type template Teuchos::RCP,LO,GO,N> > build_mean_based_muelu_preconditioner( const Teuchos::RCP,LO,GO,N> >& A, const Teuchos::RCP& precParams, const Teuchos::RCP >& coords) { typedef Sacado::UQ::PCE Scalar; typedef typename Scalar::value_type BaseScalar; using Teuchos::RCP; using Teuchos::rcp; #if USE_SCALAR_MEAN_BASED_PREC RCP > mean_scalar = build_mean_scalar_matrix(*A); RCP > prec_scalar = build_muelu_preconditioner(mean_scalar, precParams, coords); RCP > prec = rcp(new Stokhos::MeanBasedTpetraOperator(prec_scalar)); #else RCP > mean = Stokhos::build_mean_matrix(*A); RCP > prec = build_muelu_preconditioner(mean, precParams, coords); #endif return prec; } } } #endif #include