diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000000..43f73e08e5c4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,87 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL: Linear Solvers" + +on: + #push: + # branches: [ "muelu-sync-workflow" ] + pull_request: + branches: [ "develop" ] + schedule: + - cron: '41 23 * * 2' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: c-cpp + build-mode: manual + #- language: python + # build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + config: | + query-filters: + - exclude: + tags: cpp/integer-multiplication-cast-to-long + + - if: matrix.build-mode == 'manual' + name: Configure Trilinos + run: | + mkdir -p trilinos_build + cd trilinos_build + cmake -G 'Unix Makefiles' -DTrilinos_ENABLE_TESTS=OFF -DTrilinos_ENABLE_Epetra=OFF -DTrilinos_ENABLE_AztecOO=OFF -DTrilinos_ENABLE_Ifpack=OFF -DTrilinos_ENABLE_ML=OFF -D Trilinos_ENABLE_Triutils=OFF -DTrilinos_ENABLE_Tpetra=ON -DTrilinos_ENABLE_MueLu=ON -DTrilinos_ENABLE_Krino=OFF .. + + - if: matrix.build-mode == 'manual' + name: Build Trilinos + run: | + cd trilinos_build + make -j 2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 32fe3dbd1fd3..ffdb8bc48497 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -66,6 +66,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 + uses: github/codeql-action/upload-sarif@4355270be187e1b672a7a1c7c7bae5afdc1ab94a # v3.24.10 with: sarif_file: results.sarif diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml index bb9ef762863c..b2b94ab4ade6 100644 --- a/.github/workflows/spack.yml +++ b/.github/workflows/spack.yml @@ -9,8 +9,14 @@ on: - submitted workflow_dispatch: +permissions: + contents: read + jobs: gcc10-openmpi416: + permissions: + actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows + contents: read # for actions/checkout to fetch code runs-on: [self-hosted, gcc-10.3.0_openmpi-4.1.6] steps: - name: Cancel Previous Runs diff --git a/cmake/tribits/doc/sphinx/requirements.txt b/cmake/tribits/doc/sphinx/requirements.txt index 8c7b1fdb5d6f..3255050cc521 100644 --- a/cmake/tribits/doc/sphinx/requirements.txt +++ b/cmake/tribits/doc/sphinx/requirements.txt @@ -1,2 +1,2 @@ -Sphinx==4.0.2 +Sphinx==7.2.6 sphinx-rtd-theme==0.5.2 diff --git a/packages/framework/ini-files/config-specs.ini b/packages/framework/ini-files/config-specs.ini index 12b755ad62a7..1df8ed3219d2 100644 --- a/packages/framework/ini-files/config-specs.ini +++ b/packages/framework/ini-files/config-specs.ini @@ -1722,6 +1722,7 @@ opt-set-cmake-var Tpetra_INST_SERIAL BOOL FORCE : ON opt-set-cmake-var Zoltan_ENABLE_Scotch BOOL FORCE : OFF [CUDA11-RUN-SERIAL-TESTS] +opt-set-cmake-var KokkosKernels_sparse_cuda_MPI_1_SET_RUN_SERIAL BOOL FORCE : ON opt-set-cmake-var KokkosKernels_batched_dla_cuda_MPI_1_SET_RUN_SERIAL BOOL FORCE : ON opt-set-cmake-var Intrepid2_unit-test_MonolithicExecutable_Intrepid2_Tests_MPI_1_SET_RUN_SERIAL BOOL FORCE : ON @@ -2838,6 +2839,48 @@ opt-set-cmake-var Stratimikos_Galeri_xpetra_complex_double_Jacobi_MPI_4_DISABLE use GCC_PACKAGE_SPECIFIC_WARNING_FLAGS use RHEL8_POST +[rhel8_gcc-serial_release-debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_no-mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables] +# gcc-serial containerized environment +use COMPILER|GNU +use NODE-TYPE|SERIAL +use BUILD-TYPE|RELEASE-DEBUG + +use RHEL8_LIB-TYPE|SHARED +use KOKKOS-ARCH|NO-KOKKOS-ARCH + +use USE-ASAN|NO +use USE-COMPLEX|NO +use USE-FPIC|NO +use USE-MPI|NO +use USE-PT|NO +use USE-RDC|NO +use USE-UVM|NO +use USE-DEPRECATED|YES +use PACKAGE-ENABLES|NO-PACKAGE-ENABLES + +use COMMON_SPACK_TPLS + +opt-set-cmake-var CMAKE_CXX_FLAGS STRING : -Wall -Wno-clobbered -Wno-vla -Wno-pragmas -Wno-unknown-pragmas -Wno-parentheses -Wno-unused-local-typedefs -Wno-literal-suffix -Wno-deprecated-declarations -Wno-misleading-indentation -Wno-int-in-bool-context -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-nonnull-compare -Wno-address -Wno-inline -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Werror -DTRILINOS_HIDE_DEPRECATED_HEADER_WARNINGS + +opt-set-cmake-var TPL_BLAS_LIBRARY_DIRS STRING FORCE : ${OPENBLAS_ROOT|ENV}/lib +opt-set-cmake-var TPL_BLAS_LIBRARIES STRING FORCE : ${OPENBLAS_ROOT|ENV}/lib/libopenblas.a;-L${OPENBLAS_ROOT|ENV}/lib;-lgfortran;-lgomp;-lm +opt-set-cmake-var TPL_LAPACK_LIBRARY_DIRS STRING FORCE : ${OPENBLAS_ROOT|ENV}/lib +opt-set-cmake-var TPL_LAPACK_LIBRARIES STRING FORCE : ${OPENBLAS_ROOT|ENV}/lib/libopenblas.a;-L${OPENBLAS_ROOT|ENV}/lib;-lgfortran;-lgomp;-lm + +opt-set-cmake-var TPL_Netcdf_LIBRARIES STRING FORCE : "" + +opt-set-cmake-var TPL_ENABLE_ParMETIS BOOL FORCE : OFF +opt-set-cmake-var TPL_ENABLE_Pnetcdf BOOL FORCE : OFF + +opt-set-cmake-var Trilinos_ENABLE_TrilinosFrameworkTests BOOL FORCE : OFF +opt-set-cmake-var Trilinos_ENABLE_TrilinosBuildStats BOOL FORCE : OFF + +# Turned off to bypass: ML CONFIGURATION ERROR: SuperLU_5.0 detected - only SuperLU version < 5.0 currently supported for this package. +opt-set-cmake-var ML_ENABLE_SuperLU BOOL FORCE : OFF + +use GCC_PACKAGE_SPECIFIC_WARNING_FLAGS +use RHEL8_POST + [rhel8_aue-gcc-openmpi_debug_shared_no-kokkos-arch_no-asan_complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables] use COMPILER|GNU use NODE-TYPE|SERIAL @@ -2886,6 +2929,10 @@ use PACKAGE-ENABLES|ALL opt-set-cmake-var Trilinos_ENABLE_TrilinosFrameworkTests BOOL FORCE : OFF opt-set-cmake-var Trilinos_ENABLE_TrilinosBuildStats BOOL FORCE : OFF +[rhel8_gcc-serial_release-debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_no-mpi_no-pt_no-rdc_no-uvm_deprecated-on_all] +use rhel8_gcc-serial_release-debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_no-mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables +use PACKAGE-ENABLES|ALL + [rhel8_aue-gcc-openmpi_debug_shared_no-kokkos-arch_no-asan_complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_all] use rhel8_aue-gcc-openmpi_debug_shared_no-kokkos-arch_no-asan_complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables use PACKAGE-ENABLES|ALL diff --git a/packages/framework/ini-files/environment-specs.ini b/packages/framework/ini-files/environment-specs.ini index b01ec608614f..9dae944f28eb 100644 --- a/packages/framework/ini-files/environment-specs.ini +++ b/packages/framework/ini-files/environment-specs.ini @@ -158,6 +158,8 @@ envvar-find-in-path MPIF90 : mpif90 [rhel8_gcc-openmpi] +[rhel8_gcc-serial] + [rhel8_aue-gcc-openmpi] [rhel8_oneapi-intelmpi] diff --git a/packages/framework/ini-files/supported-envs.ini b/packages/framework/ini-files/supported-envs.ini index 0673827fdaa5..076adec316b0 100644 --- a/packages/framework/ini-files/supported-envs.ini +++ b/packages/framework/ini-files/supported-envs.ini @@ -174,6 +174,7 @@ gnu [rhel8] oneapi-intelmpi gcc-openmpi +gcc-serial aue-gcc-openmpi sems-cuda-11.4.2-sems-gnu-10.1.0-sems-openmpi-4.1.4 diff --git a/packages/kokkos-kernels/batched/dense/impl/KokkosBatched_Trsm_Team_Impl.hpp b/packages/kokkos-kernels/batched/dense/impl/KokkosBatched_Trsm_Team_Impl.hpp index a7430775ea4e..9f5f857e444d 100644 --- a/packages/kokkos-kernels/batched/dense/impl/KokkosBatched_Trsm_Team_Impl.hpp +++ b/packages/kokkos-kernels/batched/dense/impl/KokkosBatched_Trsm_Team_Impl.hpp @@ -99,6 +99,48 @@ struct TeamTrsm +struct TeamTrsm { + template + KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, + const ScalarType alpha, + const AViewType &A, + const BViewType &B) { + return TeamTrsmInternalLeftUpper::invoke( + member, ArgDiag::use_unit_diag, B.extent(1), B.extent(0), alpha, + A.data(), A.stride_1(), A.stride_0(), B.data(), B.stride_1(), + B.stride_0()); + } +}; + +template +struct TeamTrsm { + template + KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, + const ScalarType alpha, + const AViewType &A, + const BViewType &B) { + return TeamTrsmInternalLeftUpper::invoke( + member, ArgDiag::use_unit_diag, B.extent(1), B.extent(0), alpha, + A.data(), A.stride_1(), A.stride_0(), B.data(), B.stride_1(), + B.stride_0()); + } +}; + +/// +/// R/U/T +/// +/// B := (alpha*B) inv(triu(A)) +/// A(n x n), B(m x n) + template struct TeamTrsm { @@ -107,7 +149,7 @@ struct TeamTrsm::invoke( + return TeamTrsmInternalLeftUpper::invoke( member, ArgDiag::use_unit_diag, B.extent(1), B.extent(0), alpha, A.data(), A.stride_0(), A.stride_1(), B.data(), B.stride_1(), B.stride_0()); @@ -122,7 +164,7 @@ struct TeamTrsm::invoke( + return TeamTrsmInternalLeftUpper::invoke( member, ArgDiag::use_unit_diag, B.extent(1), B.extent(0), alpha, A.data(), A.stride_0(), A.stride_1(), B.data(), B.stride_1(), B.stride_0()); diff --git a/packages/kokkos-kernels/sparse/impl/KokkosSparse_spiluk_numeric_impl.hpp b/packages/kokkos-kernels/sparse/impl/KokkosSparse_spiluk_numeric_impl.hpp index b3b5dfa27761..415ccf87a094 100644 --- a/packages/kokkos-kernels/sparse/impl/KokkosSparse_spiluk_numeric_impl.hpp +++ b/packages/kokkos-kernels/sparse/impl/KokkosSparse_spiluk_numeric_impl.hpp @@ -32,6 +32,9 @@ #include "KokkosBatched_Gemm_Decl.hpp" #include "KokkosBatched_Gemm_Serial_Impl.hpp" #include "KokkosBlas1_set.hpp" +#include "KokkosBatched_LU_Decl.hpp" +#include "KokkosBatched_Trmm_Decl.hpp" +#include "KokkosBatched_Trmm_Serial_Impl.hpp" //#define NUMERIC_OUTPUT_INFO @@ -107,6 +110,17 @@ struct IlukWrap { lno_t lev_start; using reftype = scalar_t &; + using valtype = scalar_t; + + static constexpr size_type BUFF_SIZE = 1; + + struct SBlock { + template + KOKKOS_INLINE_FUNCTION SBlock(T, size_type, size_type) {} + + KOKKOS_INLINE_FUNCTION + scalar_t *data() { return nullptr; } + }; Common(const ARowMapType &A_row_map_, const AEntriesType &A_entries_, const AValuesType &A_values_, const LRowMapType &L_row_map_, @@ -131,6 +145,9 @@ struct IlukWrap { "Tried to use blocks with the unblocked Common?"); } + KOKKOS_INLINE_FUNCTION + size_type get_block_size() const { return 0; } + // lset KOKKOS_INLINE_FUNCTION void lset(const size_type nnz, const scalar_t &value) const { @@ -154,12 +171,18 @@ struct IlukWrap { // divide. lhs /= rhs KOKKOS_INLINE_FUNCTION - void divide(const member_type &team, scalar_t &lhs, - const scalar_t &rhs) const { + void divide(const member_type &team, scalar_t &lhs, const scalar_t &rhs, + scalar_t *) const { Kokkos::single(Kokkos::PerTeam(team), [&]() { lhs /= rhs; }); team.team_barrier(); } + // divide_left. lhs /= rhs + KOKKOS_INLINE_FUNCTION + void divide_left(scalar_t &lhs, const scalar_t &rhs, scalar_t *) const { + lhs /= rhs; + } + // multiply_subtract. C -= A * B KOKKOS_INLINE_FUNCTION void multiply_subtract(const scalar_t &A, const scalar_t &B, @@ -171,6 +194,18 @@ struct IlukWrap { KOKKOS_INLINE_FUNCTION scalar_t &lget(const size_type nnz) const { return L_values(nnz); } + // lcopy + KOKKOS_INLINE_FUNCTION + scalar_t lcopy(const size_type nnz, scalar_t *) const { + return L_values(nnz); + } + + // ucopy + KOKKOS_INLINE_FUNCTION + scalar_t ucopy(const size_type nnz, scalar_t *) const { + return U_values(nnz); + } + // uget KOKKOS_INLINE_FUNCTION scalar_t &uget(const size_type nnz) const { return U_values(nnz); } @@ -188,6 +223,12 @@ struct IlukWrap { // print KOKKOS_INLINE_FUNCTION void print(const scalar_t &item) const { std::cout << item << std::endl; } + + // report + KOKKOS_INLINE_FUNCTION + void report() const { + std::cout << "JGF using unblocked version" << std::endl; + } }; // Partial specialization for block support @@ -197,6 +238,30 @@ struct IlukWrap { struct Common { + // BSR data is in LayoutRight! + using Layout = Kokkos::LayoutRight; + using value_type = typename LValuesType::value_type; + using cvalue_type = typename LValuesType::const_value_type; + + using Block = Kokkos::View< + value_type **, Layout, typename LValuesType::device_type, + Kokkos::MemoryTraits >; + + // const block + using CBlock = Kokkos::View< + cvalue_type **, Layout, typename UValuesType::device_type, + Kokkos::MemoryTraits >; + + // scratch block + using SBlock = Kokkos::View< + value_type **, Layout, typename execution_space::scratch_memory_space, + Kokkos::MemoryTraits >; + + using reftype = Block; + using valtype = Block; + + static constexpr size_type BUFF_SIZE = 128; + ARowMapType A_row_map; AEntriesType A_entries; AValuesType A_values; @@ -212,26 +277,6 @@ struct IlukWrap { size_type block_size; size_type block_items; - // BSR data is in LayoutRight! - using Layout = Kokkos::LayoutRight; - - using LBlock = Kokkos::View< - typename LValuesType::value_type **, Layout, - typename LValuesType::device_type, - Kokkos::MemoryTraits >; - - using UBlock = Kokkos::View< - typename UValuesType::value_type **, Layout, - typename UValuesType::device_type, - Kokkos::MemoryTraits >; - - using ABlock = Kokkos::View< - typename AValuesType::value_type **, Layout, - typename AValuesType::device_type, - Kokkos::MemoryTraits >; - - using reftype = LBlock; - Common(const ARowMapType &A_row_map_, const AEntriesType &A_entries_, const AValuesType &A_values_, const LRowMapType &L_row_map_, const LEntriesType &L_entries_, LValuesType &L_values_, @@ -255,8 +300,12 @@ struct IlukWrap { block_items(block_size * block_size) { KK_REQUIRE_MSG(block_size > 0, "Tried to use block_size=0 with the blocked Common?"); + KK_REQUIRE_MSG(block_size <= 11, "Max supported block size is 11"); } + KOKKOS_INLINE_FUNCTION + size_type get_block_size() const { return block_size; } + // lset KOKKOS_INLINE_FUNCTION void lset(const size_type block, const scalar_t &value) const { @@ -264,13 +313,9 @@ struct IlukWrap { } KOKKOS_INLINE_FUNCTION - void lset(const size_type block, const ABlock &rhs) const { + void lset(const size_type block, const CBlock &rhs) const { auto lblock = lget(block); - for (size_type i = 0; i < block_size; ++i) { - for (size_type j = 0; j < block_size; ++j) { - lblock(i, j) = rhs(i, j); - } - } + assign(lblock, rhs); } // uset @@ -280,13 +325,9 @@ struct IlukWrap { } KOKKOS_INLINE_FUNCTION - void uset(const size_type block, const ABlock &rhs) const { + void uset(const size_type block, const CBlock &rhs) const { auto ublock = uget(block); - for (size_type i = 0; i < block_size; ++i) { - for (size_type j = 0; j < block_size; ++j) { - ublock(i, j) = rhs(i, j); - } - } + assign(ublock, rhs); } // lset_id @@ -295,49 +336,111 @@ struct IlukWrap { KokkosBatched::TeamSetIdentity::invoke(team, lget(block)); } - // divide. lhs /= rhs + // assign + template + KOKKOS_INLINE_FUNCTION void assign(const ViewT &lhs, + const CBlock &rhs) const { + for (size_type i = 0; i < block_size; ++i) { + for (size_type j = 0; j < block_size; ++j) { + lhs(i, j) = rhs(i, j); + } + } + } + + // divide. lhs /= rhs (lhs = lhs * rhs^-1) KOKKOS_INLINE_FUNCTION - void divide(const member_type &team, const LBlock &lhs, - const UBlock &rhs) const { + void divide(const member_type &team, const Block &lhs, const CBlock &rhs, + scalar_t *buff) const { + // Need a temp block to do LU of rhs + Block LU(buff, block_size, block_size); + assign(LU, rhs); + KokkosBatched::TeamLU::invoke(team, LU); + + // rhs = LU + // rhs^-1 = U^-1 * L^-1 + // lhs = (lhs * U^-1) * L^-1, so do U trsm first KokkosBatched::TeamTrsm< member_type, KokkosBatched::Side::Right, KokkosBatched::Uplo::Upper, - KokkosBatched::Trans::NoTranspose, // not 100% on this - KokkosBatched::Diag::NonUnit, - KokkosBatched::Algo::Trsm::Unblocked>:: // not 100% on this - invoke(team, 1.0, rhs, lhs); + KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::NonUnit, + KokkosBatched::Algo::Trsm::Blocked>::invoke(team, 1.0, LU, lhs); + + KokkosBatched::TeamTrsm< + member_type, KokkosBatched::Side::Right, KokkosBatched::Uplo::Lower, + KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::Unit, + KokkosBatched::Algo::Trsm::Blocked>::invoke(team, 1.0, LU, lhs); + } + + // divide_left. lhs /= rhs (lhs = rhs^-1 * lhs) + KOKKOS_INLINE_FUNCTION + void divide_left(const Block &lhs, const CBlock &rhs, + scalar_t *buff) const { + Block LU(buff, block_size, block_size); + assign(LU, rhs); + KokkosBatched::SerialLU::invoke(LU); + + // rhs = LU + // rhs^-1 = U^-1 * L^-1 + // lhs = U^-1 * (L^-1 * lhs), so do L trsm first + KokkosBatched::SerialTrsm< + KokkosBatched::Side::Left, KokkosBatched::Uplo::Lower, + KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::Unit, + KokkosBatched::Algo::Trsm::Blocked>::invoke(1.0, LU, lhs); + + KokkosBatched::SerialTrsm< + KokkosBatched::Side::Left, KokkosBatched::Uplo::Upper, + KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::NonUnit, + KokkosBatched::Algo::Trsm::Blocked>::invoke(1.0, LU, lhs); } // multiply_subtract. C -= A * B - template - KOKKOS_INLINE_FUNCTION void multiply_subtract(const UBlock &A, - const LBlock &B, - CView &C) const { + KOKKOS_INLINE_FUNCTION + void multiply_subtract(const CBlock &A, const CBlock &B, + const Block &C) const { // Use gemm. alpha is hardcoded to -1, beta hardcoded to 1 KokkosBatched::SerialGemm< KokkosBatched::Trans::NoTranspose, KokkosBatched::Trans::NoTranspose, - KokkosBatched::Algo::Gemm::Unblocked>::invoke( - -1.0, A, B, 1.0, C); + KokkosBatched::Algo::Gemm::Blocked>::invoke(-1.0, A, B, 1.0, + C); } // lget KOKKOS_INLINE_FUNCTION - LBlock lget(const size_type block) const { - return LBlock(L_values.data() + (block * block_items), block_size, - block_size); + Block lget(const size_type block) const { + return Block(L_values.data() + (block * block_items), block_size, + block_size); + } + + // lcopy + KOKKOS_INLINE_FUNCTION + Block lcopy(const size_type block, scalar_t *buff) const { + Block result(buff, block_size, block_size); + auto lblock = lget(block); + assign(result, lblock); + return result; + } + + // ucopy + KOKKOS_INLINE_FUNCTION + Block ucopy(const size_type block, scalar_t *buff) const { + Block result(buff, block_size, block_size); + auto ublock = uget(block); + assign(result, ublock); + return result; } // uget KOKKOS_INLINE_FUNCTION - UBlock uget(const size_type block) const { - return UBlock(U_values.data() + (block * block_items), block_size, - block_size); + Block uget(const size_type block) const { + return Block(U_values.data() + (block * block_items), block_size, + block_size); } // aget KOKKOS_INLINE_FUNCTION - ABlock aget(const size_type block) const { - return ABlock(A_values.data() + (block * block_items), block_size, + CBlock aget(const size_type block) const { + return CBlock(A_values.data() + (block * block_items), block_size, block_size); } @@ -357,7 +460,7 @@ struct IlukWrap { // print KOKKOS_INLINE_FUNCTION - void print(const LBlock &item) const { + void print(const CBlock &item) const { for (size_type i = 0; i < block_size; ++i) { std::cout << " "; for (size_type j = 0; j < block_size; ++j) { @@ -366,6 +469,13 @@ struct IlukWrap { std::cout << std::endl; } } + + // report + KOKKOS_INLINE_FUNCTION + void report() const { + std::cout << "JGF using blocked version with block_size=" << block_size + << std::endl; + } }; template struct SpilukTest { @@ -130,6 +128,7 @@ struct SpilukTest { using EntriesType = Kokkos::View; using ValuesType = Kokkos::View; using AT = Kokkos::ArithTraits; + using mag_t = typename Kokkos::ArithTraits::mag_type; using RowMapType_hostmirror = typename RowMapType::HostMirror; using EntriesType_hostmirror = typename EntriesType::HostMirror; @@ -138,6 +137,9 @@ struct SpilukTest { using memory_space = typename device::memory_space; using range_policy = Kokkos::RangePolicy; + static constexpr double EPS = + std::is_same::value ? 1e-7 : 1e-4; + using KernelHandle = KokkosKernels::Experimental::KokkosKernelsHandle< size_type, lno_t, scalar_t, execution_space, memory_space, memory_space>; @@ -243,11 +245,7 @@ struct SpilukTest { } if (fill_lev > 1) { - if (UseBlocks) { - EXPECT_LT(result, 1e-2); - } else { - EXPECT_LT(result, 1e-4); - } + EXPECT_LT(result, 1e-4); } } diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C index 3058e08dbf01..af70a4ba3f26 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C @@ -44,6 +44,7 @@ #endif #include "cgns/Iocgns_StructuredZoneData.h" #include "cgns/Iocgns_Utils.h" +#include #include #include #include diff --git a/packages/stratimikos/adapters/belos/src/BelosThyraAdapter.hpp b/packages/stratimikos/adapters/belos/src/BelosThyraAdapter.hpp index 6162105800d7..547d55788914 100644 --- a/packages/stratimikos/adapters/belos/src/BelosThyraAdapter.hpp +++ b/packages/stratimikos/adapters/belos/src/BelosThyraAdapter.hpp @@ -360,7 +360,8 @@ namespace Belos { RTOpPack::SubMultiVectorView( 0, m, 0, n, arcpFromArrayView(arrayView(&B(0,0), B.stride()*B.numCols())), B.stride() - ) + ), + false ); Thyra::apply(A, Thyra::CONJTRANS, mv, B_thyra.ptr(), alpha); } diff --git a/packages/teko/cmake/Teko_Config.h.in b/packages/teko/cmake/Teko_Config.h.in index 643008ff9c1e..9e4a947c4140 100644 --- a/packages/teko/cmake/Teko_Config.h.in +++ b/packages/teko/cmake/Teko_Config.h.in @@ -1,4 +1,7 @@ /* src/Teko_config.h.in. Generated by me! */ +#cmakedefine Teko_ENABLE_Amesos + +#cmakedefine Teko_ENABLE_Amesos2 #cmakedefine HAVE_Teko_ENABLE_Ifpack2 diff --git a/packages/teko/src/NS/Teko_InvLSCStrategy.cpp b/packages/teko/src/NS/Teko_InvLSCStrategy.cpp index de9d4e97f518..0cb9e0fa9269 100644 --- a/packages/teko/src/NS/Teko_InvLSCStrategy.cpp +++ b/packages/teko/src/NS/Teko_InvLSCStrategy.cpp @@ -523,8 +523,12 @@ void InvLSCStrategy::initializeFromParameterList(const Teuchos::ParameterList& p pl.print(DEBUG_STREAM); Teko_DEBUG_MSG_END() - // set defaults as needed + // set defaults as needed +#if defined(Teko_ENABLE_Amesos) if (invStr == "") invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + if (invStr == "") invStr = "Amesos2"; +#endif if (invVStr == "") invVStr = invStr; if (invPStr == "") invPStr = invStr; diff --git a/packages/teko/src/NS/Teko_LSCSIMPLECStrategy.cpp b/packages/teko/src/NS/Teko_LSCSIMPLECStrategy.cpp index 0a06e35bb023..3537d5e5698e 100644 --- a/packages/teko/src/NS/Teko_LSCSIMPLECStrategy.cpp +++ b/packages/teko/src/NS/Teko_LSCSIMPLECStrategy.cpp @@ -250,8 +250,12 @@ void LSCSIMPLECStrategy::initializeFromParameterList(const Teuchos::ParameterLis pl.print(DEBUG_STREAM); Teko_DEBUG_MSG_END() - // set defaults as needed + // set defaults as needed +#if defined(Teko_ENABLE_Amesos) if (invStr == "") invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + if (invStr == "") invStr = "Amesos2"; +#endif if (invVStr == "") invVStr = invStr; if (invPStr == "") invPStr = invStr; diff --git a/packages/teko/src/NS/Teko_PCDStrategy.cpp b/packages/teko/src/NS/Teko_PCDStrategy.cpp index 039161523c03..60ad8180b5c7 100644 --- a/packages/teko/src/NS/Teko_PCDStrategy.cpp +++ b/packages/teko/src/NS/Teko_PCDStrategy.cpp @@ -234,7 +234,13 @@ void PCDStrategy::initializeFromParameterList(const Teuchos::ParameterList& pl, const InverseLibrary& invLib) { Teko_DEBUG_SCOPE("PCDStrategy::initializeFromParameterList", 10); - std::string invStr = "Amesos", invFStr = "", invSStr = ""; + std::string invStr = "", invFStr = "", invSStr = ""; +#if defined(Teko_ENABLE_Amesos) + invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + invStr = "Amesos2"; +#endif + massInverseType_ = Diagonal; // "parse" the parameter list diff --git a/packages/teko/src/NS/Teko_PresLaplaceLSCStrategy.cpp b/packages/teko/src/NS/Teko_PresLaplaceLSCStrategy.cpp index 65166f6e2a10..636e2630588c 100644 --- a/packages/teko/src/NS/Teko_PresLaplaceLSCStrategy.cpp +++ b/packages/teko/src/NS/Teko_PresLaplaceLSCStrategy.cpp @@ -291,7 +291,13 @@ void PresLaplaceLSCStrategy::computeInverses(const BlockedLinearOp& A, void PresLaplaceLSCStrategy::initializeFromParameterList(const Teuchos::ParameterList& pl, const InverseLibrary& invLib) { // get string specifying inverse - std::string invStr = "Amesos", invVStr = "", invPStr = ""; + std::string invStr = "", invVStr = "", invPStr = ""; +#if defined(Teko_ENABLE_Amesos) + invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + invStr = "Amesos2"; +#endif + bool useLDU = false; scaleType_ = AbsRowSum; diff --git a/packages/teko/src/NS/Teko_SIMPLEPreconditionerFactory.cpp b/packages/teko/src/NS/Teko_SIMPLEPreconditionerFactory.cpp index 406a8d1c36a3..f0c202d900ec 100644 --- a/packages/teko/src/NS/Teko_SIMPLEPreconditionerFactory.cpp +++ b/packages/teko/src/NS/Teko_SIMPLEPreconditionerFactory.cpp @@ -265,8 +265,13 @@ void SIMPLEPreconditionerFactory::initializeFromParameterList(const Teuchos::Par pl.print(DEBUG_STREAM); Teko_DEBUG_MSG_END() - // set defaults as needed + // set defaults as needed +#if defined(Teko_ENABLE_Amesos) if (invStr == "") invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + if (invStr == "") invStr = "Amesos2"; +#endif + if (invVStr == "") invVStr = invStr; if (invPStr == "") invPStr = invStr; diff --git a/packages/teko/src/NS/Teko_TimingsSIMPLEPreconditionerFactory.cpp b/packages/teko/src/NS/Teko_TimingsSIMPLEPreconditionerFactory.cpp index 7af5d7380829..a104bd26e8cb 100644 --- a/packages/teko/src/NS/Teko_TimingsSIMPLEPreconditionerFactory.cpp +++ b/packages/teko/src/NS/Teko_TimingsSIMPLEPreconditionerFactory.cpp @@ -335,8 +335,12 @@ void TimingsSIMPLEPreconditionerFactory::initializeFromParameterList( pl.print(DEBUG_STREAM); Teko_DEBUG_MSG_END() - // set defaults as needed + // set defaults as needed +#if defined(Teko_ENABLE_Amesos) if (invStr == "") invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + if (invStr == "") invStr = "Amesos2"; +#endif if (invVStr == "") invVStr = invStr; if (invPStr == "") invPStr = invStr; diff --git a/packages/teko/src/Teko_GaussSeidelPreconditionerFactory.cpp b/packages/teko/src/Teko_GaussSeidelPreconditionerFactory.cpp index a22c7d755213..84e8fbe4a9b1 100644 --- a/packages/teko/src/Teko_GaussSeidelPreconditionerFactory.cpp +++ b/packages/teko/src/Teko_GaussSeidelPreconditionerFactory.cpp @@ -110,7 +110,12 @@ void GaussSeidelPreconditionerFactory::initializeFromParameterList( RCP invLib = getInverseLibrary(); // get string specifying default inverse - std::string invStr = "Amesos"; + std::string invStr = ""; +#if defined(Teko_ENABLE_Amesos) + invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + invStr = "Amesos2"; +#endif std::string precStr = "None"; if (pl.isParameter(inverse_type)) invStr = pl.get(inverse_type); if (pl.isParameter(preconditioner_type)) precStr = pl.get(preconditioner_type); diff --git a/packages/teko/src/Teko_JacobiPreconditionerFactory.cpp b/packages/teko/src/Teko_JacobiPreconditionerFactory.cpp index a0d9cfbff370..f83ce1a73a6e 100644 --- a/packages/teko/src/Teko_JacobiPreconditionerFactory.cpp +++ b/packages/teko/src/Teko_JacobiPreconditionerFactory.cpp @@ -106,7 +106,11 @@ void JacobiPreconditionerFactory::initializeFromParameterList(const Teuchos::Par // get string specifying inverse std::string invStr = pl.get("Inverse Type"); +#if defined(Teko_ENABLE_Amesos) if(invStr=="") invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + if(invStr=="") invStr= "Amesos2"; +#endif // based on parameter type build a strategy invOpsStrategy_ = rcp(new InvFactoryDiagStrategy(invLib->getInverseFactory(invStr))); @@ -127,7 +131,13 @@ void JacobiPreconditionerFactory::initializeFromParameterList(const Teuchos::Par RCP invLib = getInverseLibrary(); // get string specifying default inverse - std::string invStr = "Amesos"; + std::string invStr = ""; +#if defined(Teko_ENABLE_Amesos) + invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + invStr = "Amesos2"; +#endif + std::string precStr = "None"; if (pl.isParameter(inverse_type)) invStr = pl.get(inverse_type); RCP defaultPrec; diff --git a/packages/teko/src/Teko_LU2x2DiagonalStrategy.cpp b/packages/teko/src/Teko_LU2x2DiagonalStrategy.cpp index edbcec5beef9..57271ef5248c 100644 --- a/packages/teko/src/Teko_LU2x2DiagonalStrategy.cpp +++ b/packages/teko/src/Teko_LU2x2DiagonalStrategy.cpp @@ -181,7 +181,12 @@ void LU2x2DiagonalStrategy::initializeFromParameterList(const Teuchos::Parameter const InverseLibrary& invLib) { Teko_DEBUG_SCOPE("LU2x2DiagonalStrategy::initializeFromParameterList", 10); - std::string invStr = "Amesos", invA00Str = "", invSStr = ""; + std::string invStr = "", invA00Str = "", invSStr = ""; +#if defined(Teko_ENABLE_Amesos) + invStr = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + invStr = "Amesos2"; +#endif // "parse" the parameter list if (pl.isParameter("Inverse Type")) invStr = pl.get("Inverse Type"); diff --git a/packages/teko/src/Teko_StratimikosFactory.cpp b/packages/teko/src/Teko_StratimikosFactory.cpp index a3ee32f15167..e0798651da63 100644 --- a/packages/teko/src/Teko_StratimikosFactory.cpp +++ b/packages/teko/src/Teko_StratimikosFactory.cpp @@ -464,7 +464,13 @@ Teuchos::RCP StratimikosFactory::getValidParameter "velocity and pressure forming an inner two-by-two block, and then the\n" "temperature unknowns forming a two-by-two system with the velocity-pressure\n" "block."); - pl->set("Inverse Type", "Amesos", + std::string defaultInverseType = ""; +#if defined(Teko_ENABLE_Amesos) + defaultInverseType = "Amesos"; +#elif defined(Teko_ENABLE_Amesos2) + defaultInverseType = "Amesos2"; +#endif + pl->set("Inverse Type", defaultInverseType, "The type of inverse operator the user wants. This can be one of the defaults\n" "from Stratimikos, or a Teko preconditioner defined in the\n" "\"Inverse Factory Library\"."); diff --git a/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_decl.hpp b/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_decl.hpp index 58147d70b63e..3737d28273d5 100644 --- a/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_decl.hpp +++ b/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_decl.hpp @@ -121,7 +121,7 @@ class TpetraVectorSpace : public SpmdVectorSpaceDefaultBase public: RCP > - createCachedMembersView( const RTOpPack::SubMultiVectorView &raw_mv ) const; + createCachedMembersView( const RTOpPack::SubMultiVectorView &raw_mv, bool initialize = true) const; RCP > createCachedMembersView( const RTOpPack::ConstSubMultiVectorView &raw_mv ) const; diff --git a/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_def.hpp b/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_def.hpp index 2c43427aa77c..87cbc368ee78 100644 --- a/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_def.hpp +++ b/packages/thyra/adapters/tpetra/src/Thyra_TpetraVectorSpace_def.hpp @@ -155,7 +155,8 @@ class CopyTpetraMultiVectorViewBack { template RCP< MultiVectorBase > TpetraVectorSpace::createCachedMembersView( - const RTOpPack::SubMultiVectorView &raw_mv ) const + const RTOpPack::SubMultiVectorView &raw_mv, + const bool initialize) const { #ifdef TEUCHOS_DEBUG TEUCHOS_TEST_FOR_EXCEPT( raw_mv.subDim() != this->dim() ); @@ -189,14 +190,16 @@ TpetraVectorSpace::createCachedMembersVi RCP > tmv = Teuchos::rcp_dynamic_cast >(mv,true)->getTpetraMultiVector(); Teuchos::set_extra_data(inUse,"inUse",Teuchos::outArg(tmv)); } - // Copy initial values in raw_mv into multi-vector - RTOpPack::SubMultiVectorView smv; - mv->acquireDetachedView(Range1D(),Range1D(),&smv); - RTOpPack::assign_entries( - Ptr >(Teuchos::outArg(smv)), - raw_mv - ); - mv->commitDetachedView(&smv); + if (initialize) { + // Copy initial values in raw_mv into multi-vector + RTOpPack::SubMultiVectorView smv; + mv->acquireDetachedView(Range1D(),Range1D(),&smv); + RTOpPack::assign_entries( + Ptr >(Teuchos::outArg(smv)), + raw_mv + ); + mv->commitDetachedView(&smv); + } // Setup smart pointer to multi-vector to copy view back out just before multi-vector is destroyed Teuchos::set_extra_data( // We create a duplicate of the RCP, otherwise the ref count does not go to zero. diff --git a/packages/thyra/core/src/interfaces/operator_vector/fundamental/Thyra_VectorSpaceBase_decl.hpp b/packages/thyra/core/src/interfaces/operator_vector/fundamental/Thyra_VectorSpaceBase_decl.hpp index 21b70e2728f5..55e21746f1aa 100644 --- a/packages/thyra/core/src/interfaces/operator_vector/fundamental/Thyra_VectorSpaceBase_decl.hpp +++ b/packages/thyra/core/src/interfaces/operator_vector/fundamental/Thyra_VectorSpaceBase_decl.hpp @@ -745,7 +745,7 @@ class VectorSpaceBase : virtual public Teuchos::Describable { * MultiVectorBase object using explicit vector access. */ virtual RCP > - createCachedMembersView( const RTOpPack::SubMultiVectorView &raw_mv ) const { return this->createMembersView(raw_mv); }; + createCachedMembersView( const RTOpPack::SubMultiVectorView &raw_mv, bool initialize = true) const { return this->createMembersView(raw_mv); }; /** \brief Create a (possibly) cached multi-vector member that is a const view of raw * multi-vector data. The caching mechanism must be implemented by child classes, by default diff --git a/packages/tpetra/core/src/Tpetra_LocalCrsMatrixOperator_def.hpp b/packages/tpetra/core/src/Tpetra_LocalCrsMatrixOperator_def.hpp index 15a68f7a7092..523b1c862ba4 100644 --- a/packages/tpetra/core/src/Tpetra_LocalCrsMatrixOperator_def.hpp +++ b/packages/tpetra/core/src/Tpetra_LocalCrsMatrixOperator_def.hpp @@ -112,12 +112,9 @@ apply (Kokkos::View diff --git a/packages/tpetra/core/src/Tpetra_computeRowAndColumnOneNorms_def.hpp b/packages/tpetra/core/src/Tpetra_computeRowAndColumnOneNorms_def.hpp index f7b7dfbd796e..a526d4438f9e 100644 --- a/packages/tpetra/core/src/Tpetra_computeRowAndColumnOneNorms_def.hpp +++ b/packages/tpetra/core/src/Tpetra_computeRowAndColumnOneNorms_def.hpp @@ -805,7 +805,7 @@ bool findZero (const OneDViewType& x) using functor_type = FindZero; Kokkos::RangePolicy range (0, x.extent (0)); - range.set (Kokkos::ChunkSize (500)); // adjust as needed + range.set_chunk_size (500); // adjust as needed int foundZero = 0; Kokkos::parallel_reduce ("findZero", range, functor_type (x), foundZero); diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp index 13c77b9bd6c4..554748047727 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp @@ -303,7 +303,6 @@ int main(int argc, char *argv[]) { const char* rawKokkosNumDevices = std::getenv("KOKKOS_NUM_DEVICES"); if(rawKokkosNumDevices) numgpus = std::atoi(rawKokkosNumDevices); - int skipgpu = 999; bool useSYCL = false; bool useHIP = false; @@ -316,7 +315,6 @@ int main(int argc, char *argv[]) { cmdp.setOption("verbose","quiet",&verbose,"Print messages and results."); cmdp.setOption("numthreads",&numthreads,"Number of threads per thread team."); cmdp.setOption("numgpus",&numgpus,"Number of GPUs."); - cmdp.setOption("skipgpu",&skipgpu,"Do not use this GPU."); cmdp.setOption("hostname",&hostname,"Override of hostname for PerfTest entry."); cmdp.setOption("testarchive",&testarchive,"Set filename for Performance Test archive."); cmdp.setOption("filename",&filename,"Filename for test matrix."); @@ -405,7 +403,6 @@ int main(int argc, char *argv[]) { Kokkos::InitializationSettings kokkosArgs; kokkosArgs.set_num_threads(numthreads); kokkosArgs.set_device_id(myRank % numgpus); - kokkosArgs.set_skip_device(skipgpu); kokkosArgs.set_disable_warnings(!verbose); Kokkos::initialize (kokkosArgs); diff --git a/packages/xpetra/CMakeLists.txt b/packages/xpetra/CMakeLists.txt index 6d56bbd2efec..c829412f67d7 100644 --- a/packages/xpetra/CMakeLists.txt +++ b/packages/xpetra/CMakeLists.txt @@ -60,6 +60,7 @@ ENDIF() # If Epetra is enabled, does it provide 64-bit global indices? IF(${PACKAGE_NAME}_ENABLE_Epetra) + MESSAGE(WARNING "Epetra support in Xpetra is deprecated") # Set default value of whether Xpetra should allow for 32 bit Epetra data structures or not. IF(Trilinos_NO_32BIT_GLOBAL_INDICES) diff --git a/packages/xpetra/scripts/README b/packages/xpetra/scripts/README deleted file mode 100644 index be0a8694f6bc..000000000000 --- a/packages/xpetra/scripts/README +++ /dev/null @@ -1,23 +0,0 @@ -PREREQUISITES -------------- -python 2.4 or greater, lxml -doxygen 1.4.7 - -HOW TO GENERATE XML SOURCE FILES --------------------------------- - -$cd package/tpetra/doc -** edit doxygen configuration file 'Doxyfile': GENERATE_XML = YES -$doxygen Doxyfile - - -HOW TO GENERATE XPETRA HEADERS -------------------------------- - -$cd xpetra/script/ - -You might need to edit lib/XpetraLibConfig.py to set the value of "trilinosRoot_dir" to the path of your Trilinos root directory. - -python interfaces.py -python tpetra.py -python epetra.py diff --git a/packages/xpetra/scripts/build-xpetra.sh b/packages/xpetra/scripts/build-xpetra.sh deleted file mode 100755 index cf6cea8fd697..000000000000 --- a/packages/xpetra/scripts/build-xpetra.sh +++ /dev/null @@ -1,24 +0,0 @@ - -echo Running Tpetra/Doxygen ... -cd ../../tpetra/doc -sed -i 's/GENERATE_XML = NO/GENERATE_XML = YES/' Doxyfile -doxygen Doxyfile >/dev/null 2>/dev/null -git checkout Doxyfile -cd - >/dev/null - -echo Generating Xpetra ... -python interfaces.py -python tpetra.py -python epetra.py - -echo Removing trailing whitespace... -find ../src -iname "*.?pp" -exec sed -i 's/[ \t]*$//' {} \; - -echo Removing tpetra/doc/xml ... -rm -rf ../../tpetra/doc/xml - -# TMP -echo Warning\(TMP\): git checkout Xpetra_TpetraRowMatrix.hpp -git checkout ../src/RowMatrix/Xpetra_TpetraRowMatrix.hpp - -echo done. diff --git a/packages/xpetra/scripts/epetra.py b/packages/xpetra/scripts/epetra.py deleted file mode 100644 index 59576378b813..000000000000 --- a/packages/xpetra/scripts/epetra.py +++ /dev/null @@ -1,168 +0,0 @@ -import sys -sys.path.append('lib/') - -import os -from string import Template -from ConfigParser import SafeConfigParser -from XpetraLib import * -from XpetraLibConfig import * - - -def buildFuncLineEpetra( functionNode ): - -#TODO: clean up - tree = etree.parse(conf_XMLclass) - root = tree.getroot() # root == - classNode = root[0] # classNode == - - fullClassName = classNode.xpath('compoundname')[0].text # Tpetra::Map - baseClassName = fullClassName.lstrip('Tpetra::') # Map - className = 'Epetra'+baseClassName # EpetraMap -## - - # = function name - name = functionNode.xpath('name')[0].text - if name == baseClassName: name = className - if name == '~'+baseClassName: name = '~'+className - - # = return type of the function - type = functionNode.xpath('type')[0].xpath("string()") - - # - argsstring = functionNode.xpath('argsstring')[0].text - - # hack for Vector: - # - add missing 'typename' - # - do not add MultiVector inherited methods - if 'magnitudeType' in type: type = 'typename ' + type - if functionNode.xpath('//compoundname')[0].text == 'Tpetra::Vector': - if name in ['replaceGlobalValue','sumIntoGlobalValue','replaceLocalValue','sumIntoLocalValue'] and 'size_t vectorIndex' in argsstring: return '' - - # -> get list of arg name as a string 'GIDList, nodeIDList, LIDList' - # Simple version - # paramList = functionNode.xpath('param/declname/text()') - # paramStr = ', '.join(param for param in paramList) - - # More complete version - paramStr = '' - paramNodes = functionNode.xpath('param') - #print name - for paramNode in paramNodes: - n = paramNode.xpath('declname')[0].xpath("string()") - if paramNode.xpath('type')[0].xpath("string()") in conf_TypeWrapped: - paramStr += "toEpetra(" + n + ")" - else: - paramStr += n - - paramStr += ", " - - paramStr = paramStr.rstrip(', ') - - # briefdescription - briefdescription = functionNode.xpath("briefdescription")[0].xpath("string()") - - if len(type) > 0: - declStr = type + " " + name + argsstring - else: - declStr = name + argsstring - declStr = declStr.rstrip().replace('typename ','') - - if 'TPETRA_DEPRECATED' in type: return '' - if "const =0" in argsstring: return '' #hack for CrsMatrix - - # hack for MultiVector - if name == "scale" and "Teuchos::ArrayView< const Scalar > alpha" in argsstring: return '' - if name == "scale" and "const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A" in argsstring: return '' - - # hack for Vector - if name == 'EpetraVector' and 'Map' in argsstring: declStr = 'explicit ' + declStr - if className == "EpetraVector" and 'ArrayView' in argsstring: return '' - - # hack for CrsMatrix - if name == "EpetraCrsMatrix" and "const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &graph" in argsstring: return '' - - if name in conf_RemoveRefFunctionList: declStr = declStr.replace('&', '') - - descStr = " //! " + briefdescription.lstrip().rstrip() + "\n" - defStr = " " + declStr - - # implemented in .cpp - if name in conf_FunctionInCppFile: - defStr += ';' - return descStr + defStr + "\n" + "\n"; - - if name != className and name != "~"+className: - defStr += " { " - defStr += "XPETRA_MONITOR(\"" + className + "::" + name + "\"); " - if len(type) > 0 and type != 'void': defStr += 'return ' - if type in conf_TypeWrapped: defStr += "toXpetra(" - - if parser.has_option('replace',name): - name = parser.get('replace', name) - - defStr += conf_memberName + "->" + name - defStr += "(" + paramStr - if type in conf_TypeWrapped: defStr += ")" - defStr += "); }" - - # constructor - if name == className: - defStr += "\n " + ": " + conf_memberName + "(Teuchos::rcp(new " + fullClassName.replace('Tpetra::','Epetra_') - defStr += "(" + paramStr + "))) { }" - - # destructor - if name == '~'+className: - defStr += " { }" - - return descStr + defStr + "\n" + "\n"; - -#### - -xml_dir = trilinosRoot_dir + '/packages/tpetra/doc/xml/' -conf_dir = 'epetra/conf/' -tmpl_dir = 'epetra/tmpl/' -out_dir = '../src/' - -for file in os.listdir(conf_dir): - basename, extension = os.path.splitext(file) - if extension == ".conf": -#### READ CONFIG #### - parser = SafeConfigParser() - parser.read(conf_dir + file) - - conf_XMLheaders = xml_dir + parser.get('io', 'XMLheaders') - conf_XMLclass = xml_dir + parser.get('io', 'XMLclass') - conf_template = tmpl_dir + parser.get('io', 'template') - conf_output = parser.get('io', 'output') - - conf_SkipFunctionList = set(parser.get('function', 'skip').split(';')) - conf_RemoveRefFunctionList = set(parser.get('function', 'removeref').split(';')) - if parser.has_option('function', 'inCppFile'): - conf_FunctionInCppFile = set(parser.get('function', 'inCppFile').split(';')) - else: - conf_FunctionInCppFile = [] - conf_SkipHeaderList = set(parser.get('header', 'skip').split(';')) - conf_memberName = parser.get('member', 'name') - conf_TypeWrapped = set(parser.get('type', 'wrapped').split(';')) -# - - template = open(conf_template, 'r').read() - out = Template(template) - - className = buildClassDefinition(conf_XMLclass, 'Epetra') -#unused templateParam = buildTemplateParam2(conf_XMLclass) - - out = out.substitute( - TMPL_HEADERS=buildHeader(className, 'epetra.py'), - TMPL_INCLUDES=buildInclude(conf_XMLheaders, conf_SkipHeaderList), - TMPL_TEMPLATE_PARAM=buildTemplateParam(conf_XMLclass), - TMPL_CLASS=className, - TMPL_INHERITANCE=' ' + parser.get('inheritance', 'parent').rstrip(), - TMPL_DESTRUCTOR=buildDestructor(className), - TMPL_PUBLIC_FUNCTIONS=buildClassFunctions(conf_XMLclass, conf_SkipFunctionList, buildFuncLineEpetra), - TMPL_FOOTERS=buildFooter(className, short=False) - ) - f = open(out_dir + conf_output, 'w') - f.write(out) - f.close() - diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraCrsGraph.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraCrsGraph.hpp.conf deleted file mode 100644 index f4beddfa671e..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraCrsGraph.hpp.conf +++ /dev/null @@ -1,52 +0,0 @@ -[io] -XMLheaders = Tpetra__CrsGraph__decl_8hpp.xml -XMLclass = classTpetra_1_1CrsGraph.xml -template = Xpetra_EpetraCrsGraph.hpp.tmpl -output = CrsGraph/Xpetra_EpetraCrsGraph.hpp - -[header] -skip = Epetra_RowGraph.hpp;Epetra_DistObject.hpp;Epetra_Util.hpp - -[function] -skip = globalAssemble;resumeFill;getNode;getNodeAllocationSize;isFillActive;getGlobalRowCopy;getLocalRowCopy;checkSizes;copyAndPermute;packAndPrepare;unpackAndCombine;getNodeRowBegs;getNodePackedIndices;optimizeStorage;isSorted;setParameterList;getValidParameters;getNodeRowPtrs;clone;pack;setAllIndices;replaceColMap;replaceDomainMapAndImporter;removeEmptyProcessesInPlace;expertStaticFillComplete -removeref = getComm;getRowMap;getColMap;getDomainMap;getRangeMap -inCppFile = EpetraCrsGraph;insertGlobalIndices;insertLocalIndices;getGlobalRowView;getLocalRowView;description;describe;fillComplete - -[inheritance] -parent = : public CrsGraph - -[member] -name = graph_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > >;const RCP< const Comm< int > > & - -[replace] -removeLocalIndices = RemoveMyIndices -fillComplete = FillComplete -getComm = Comm -getRowMap = RowMap -getColMap = ColMap -getDomainMap = DomainMap -getRangeMap = RangeMap -getGlobalNumRows = NumGlobalRows -getGlobalNumCols = NumGlobalCols -getLocalNumRows = NumMyRows -getLocalNumCols = NumMyCols -etIndexBase = IndexBase -getGlobalNumEntries = NumGlobalEntries -getLocalNumEntries = NumMyEntries -getNumEntriesInGlobalRow = NumGlobalIndices -getNumEntriesInLocalRow = NumMyIndices -getNumAllocatedEntriesInGlobalRow = NumAllocatedGlobalIndices -getNumAllocatedEntriesInLocalRow = NumAllocatedMyIndices -getGlobalMaxNumRowEntries = GlobalMaxNumIndices -getLocalMaxNumRowEntries = MaxNumIndices -hasColMap = HaveColMap -isLocallyIndexed = IndicesAreLocal -isGloballyIndexed = IndicesAreGlobal -isFillComplete = Filled -isStorageOptimized = StorageOptimized -getIndexBase = IndexBase -getImporter = Importer -getExporter = Exporter diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraCrsMatrix.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraCrsMatrix.hpp.conf deleted file mode 100644 index 90ee9dcde1c6..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraCrsMatrix.hpp.conf +++ /dev/null @@ -1,56 +0,0 @@ -[io] -XMLheaders = Tpetra__CrsMatrix__decl_8hpp.xml -XMLclass = classTpetra_1_1CrsMatrix.xml -template = Xpetra_EpetraCrsMatrix.hpp.tmpl -output = CrsMatrix/Xpetra_EpetraCrsMatrix.hpp - -[header] -skip = Epetra_RowMatrix.hpp;Epetra_CrsMatrixMultiplyOp_decl.hpp - -[function] -skip = sumIntoGlobalValues;sumIntoLocalValues;globalAssemble;getNode;getGraph;getIndexBase;getNumEntriesInGlobalRow;hasColMap;isStorageOptimized;isStaticGraph;solve;hasTransposeApply;checkSizes;copyAndPermute;packAndPrepare;unpackAndCombine;optimizeStorage;leftScale;rightScale;localMultiply;localSolve;convert -removeref = getRowMap;getColMap;getDomainMap;getRangeMap;getComm -inCppFile = EpetraCrsMatrix;insertGlobalValues;insertLocalValues;replaceGlobalValues;replaceLocalValues;resumeFill;supportsRowViews;getLocalRowCopy;getGlobalRowView;getLocalRowView;description;describe;doImport;doExport;apply;fillComplete;isFillComplete;isFillActive;getGlobalRowCopy - -[inheritance] -parent = : public CrsMatrix - -[member] -name = mtx_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;const RCP< const Comm< int > > & - -[replace] -removeLocalIndices = RemoveMyEntries -fillComplete = FillComplete -getComm = Comm -getRowMap = RowMap -getColMap = ColMap -getDomainMap = DomainMap -getRangeMap = RangeMap -getGlobalNumRows = NumGlobalRows -getGlobalNumCols = NumGlobalCols -getLocalNumRows = NumMyRows -getLocalNumCols = NumMyCols -getIndexBase = IndexBase -getGlobalNumEntries = NumGlobalNonzeros -getLocalNumEntries = NumMyNonzeros -getNumEntriesInGlobalRow = NumGlobalIndices -getNumEntriesInLocalRow = NumMyEntries -getNumAllocatedEntriesInGlobalRow = NumAllocatedGlobalIndices -getNumAllocatedEntriesInLocalRow = NumAllocatedMyEntries -getGlobalMaxNumRowEntries = GlobalMaxNumEntries -getLocalMaxNumRowEntries = MaxNumEntries -hasColMap = HaveColMap -insertLocalValues = InsertMyValues -isLocallyIndexed = IndicesAreLocal -isGloballyIndexed = IndicesAreGlobal -isStorageOptimized = StorageOptimized -getIndexBase = IndexBase -getImporter = Importer -scale = Scale -getCrsGraph = Graph -getLocalDiagCopy = ExtractDiagonalCopy -getFrobeniusNorm = NormFrobenius -setAllToScalar = PutScalar diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraExport.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraExport.hpp.conf deleted file mode 100644 index 5ecd75952dff..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraExport.hpp.conf +++ /dev/null @@ -1,28 +0,0 @@ -[io] -XMLheaders = Tpetra__Export__decl_8hpp.xml -XMLclass = classTpetra_1_1Export.xml -template = Xpetra_EpetraExport.hpp.tmpl -output = Export/Xpetra_EpetraExport.hpp - -[header] -skip = Epetra_Util.hpp;Epetra_ImportExportData.hpp - -[function] -skip = getDistributor;operator=;setParameterList -removeref = getSourceMap;getTargetMap -inCppFile = EpetraExport;getExportImageIDs;getPermuteFromLIDs;getExportPIDs;getPermuteToLIDs;getNumRemoteIDs;getRemoteLIDs;getNumExportIDs;getExportLIDs;print - -[inheritance] -parent = : public Export - -[member] -name = export_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Export< LocalOrdinal, GlobalOrdinal, Node > & - -[replace] -getNumSameIDs = NumSameIDs -getNumPermuteIDs = NumPermuteIDs -getSourceMap = SourceMap -getTargetMap = TargetMap diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraImport.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraImport.hpp.conf deleted file mode 100644 index 38b6296809c2..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraImport.hpp.conf +++ /dev/null @@ -1,30 +0,0 @@ -[io] -XMLheaders = Tpetra__Import__decl_8hpp.xml -XMLclass = classTpetra_1_1Import.xml -template = Xpetra_EpetraImport.hpp.tmpl -output = Import/Xpetra_EpetraImport.hpp - -[header] -skip = Epetra_Util.hpp;Epetra_ImportExportData.hpp;Epetra_Distributor.hpp - -[function] -skip = getDistributor;operator=;setParameterList;setUnion;createRemoteOnlyImport -removeref = getSourceMap;getTargetMap -inCppFile = EpetraImport;getExportImageIDs;getPermuteFromLIDs;getNumRemoteIDs;getNumExportIDs;getExportPIDs;getPermuteToLIDs;getNumRemoteIDs;getRemoteLIDs;getRemotePIDs;getNumExportIDs;getExportLIDs;print - -[inheritance] -parent = : public Import - -[member] -name = import_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Import< LocalOrdinal, GlobalOrdinal, Node > & - -[replace] -getNumSameIDs = NumSameIDs -getNumPermuteIDs = NumPermuteIDs -getSourceMap = SourceMap -getTargetMap = TargetMap -getNumRemoteIds = NumRemoteIDs -getNumExportIds = NumExportIDs diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraMap.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraMap.hpp.conf deleted file mode 100644 index 5598b0e41be5..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraMap.hpp.conf +++ /dev/null @@ -1,41 +0,0 @@ -[io] -XMLheaders = Tpetra__Map__decl_8hpp.xml -XMLclass = classTpetra_1_1Map.xml -template = Xpetra_EpetraMap.hpp.tmpl -output = Map/Xpetra_EpetraMap.hpp - -[header] -skip = - -[function] -skip = getGlobalElement;~Map;clone;isUniform -removeref = getComm;getNode -inCppFile = EpetraMap;getRemoteIndexList;getLocalElementList;description;describe;getNode;getGlobalElement;removeEmptyProcesses;replaceCommWithSubset - -[inheritance] -parent = : public virtual Map - -[member] -name = map_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const Teuchos::RCP< const Teuchos::Comm< int > > & - -[replace] -getGlobalNumElements = NumGlobalElements -getLocalNumElements = NumMyElements -getIndexBase = IndexBase -getMinLocalIndex = MinLID -getMaxLocalIndex = MaxLID -getMinGlobalIndex = MinMyGID -getMaxGlobalIndex = MaxMyGID -getMinAllGlobalIndex = MinAllGID -getMaxAllGlobalIndex = MaxAllGID -getLocalElement = LID -isNodeLocalElement = MyLID -isNodeGlobalElement = MyGID -isContiguous = LinearMap -isDistributed = DistributedGlobal -isCompatible = PointSameAs -isSameAs = SameAs -getComm = Comm diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraMultiVector.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraMultiVector.hpp.conf deleted file mode 100644 index d61671fa4fdf..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraMultiVector.hpp.conf +++ /dev/null @@ -1,38 +0,0 @@ -[io] -XMLheaders = Tpetra__MultiVector__decl_8hpp.xml -XMLclass = classTpetra_1_1MultiVector.xml -template = Xpetra_EpetraMultiVector.hpp.tmpl -output = MultiVector/Xpetra_EpetraMultiVector.hpp - -[header] -skip = - -[function] -skip = MultiVector;~MultiVector;replaceMap;operator=;subCopy;subCopy;subView;subView;subViewNonConst;subViewNonConst;offsetView;offsetViewNonConst;getLocalMV;getStride;isConstantStride;get1dCopy;get2dCopy;get1dView;get2dView;get1dViewNonConst;get2dViewNonConst;reduce;randomize;setSeed;clone -removeref = -inCppFile = getData;getDataNonConst;getVector;getVectorNonConst;dot;normWeighted;meanValue;describe;description;doImport;doExport;norm1;norm2;normInf - -[inheritance] -parent = : public virtual MultiVector - -[member] -name = vec_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Teuchos::ETransp - -[replace] -getNumVectors = NumVectors -getLocalLength = MyLength -getGlobalLength = GlobalLength -elementWiseMultiply = Multiply -multiply = Multiply -abs = Abs -reciprocal = Reciprocal -scale = Scale -update = Update -putScalar = PutScalar -replaceGlobalValue = ReplaceGlobalValue -sumIntoGlobalValue = SumIntoGlobalValue -replaceLocalValue = ReplaceMyValue -sumIntoLocalValue = SumIntoMyValue diff --git a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraVector.hpp.conf b/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraVector.hpp.conf deleted file mode 100644 index f18c6c38c04d..000000000000 --- a/packages/xpetra/scripts/epetra/conf/Xpetra_EpetraVector.hpp.conf +++ /dev/null @@ -1,38 +0,0 @@ -[io] -XMLheaders = Tpetra__Vector__decl_8hpp.xml -XMLclass = classTpetra_1_1Vector.xml -template = Xpetra_EpetraVector.hpp.tmpl -output = Vector/Xpetra_EpetraVector.hpp - -[header] -skip = Epetra_MultiVector_decl.hpp - -[function] -skip = putScalar;randomize;replaceMap;reduce;subCopy;subCopy;subView;subView;subViewNonConst;subViewNonConst;offsetView;offsetViewNonConst;getVector;getVectorNonConst;getData;getDataNonConst;get1dCopy;get2dCopy;get1dView;get2dView;get1dViewNonConst;get2dViewNonConst;getLocalMV;abs;reciprocal;scale;update;update;multiply;elementWiseMultiply;getNumVectors;getLocalLength;getGlobalLength;getStride;isConstantStride -removeref = -inCppFile = EpetraVector;describe;description;dot;normWeighted;meanValue;norm1;norm2;normInf;replaceGlobalValue;sumIntoGlobalValue;replaceLocalValue;sumIntoLocalValue - -[inheritance] -parent = : public virtual Vector, public EpetraMultiVector - -[member] -name = getEpetra_Vector() - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & - -[replace] -getNumVectors = NumVectors -getLocalLength = MyLength -getGlobalLength = GlobalLength -elementWiseMultiply = Multiply -multiply = Multiply -abs = Abs -reciprocal = Reciprocal -scale = Scale -update = Update -putScalar = PutScalar -replaceGlobalValue = ReplaceGlobalValue -sumIntoGlobalValue = SumIntoGlobalValue -replaceLocalValue = ReplaceMyValue -sumIntoLocalValue = SumIntoMyValue diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraCrsGraph.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraCrsGraph.hpp.tmpl deleted file mode 100644 index a73a2379d1c1..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraCrsGraph.hpp.tmpl +++ /dev/null @@ -1,73 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_CrsGraph.hpp" - -#include "Xpetra_EpetraExport.hpp" -#include "Xpetra_EpetraImport.hpp" -#include "Xpetra_EpetraMap.hpp" -#include "Xpetra_EpetraUtils.hpp" - -#include - -namespace Xpetra { - - // TODO: move that elsewhere - RCP< const CrsGraph > toXpetra(const Epetra_CrsGraph& graph); - const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph > &graph); - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef CrsGraph::node_type Node; - //! The specialization of Map used by this class. - typedef Map map_type; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! Implements DistObject interface - //{@ - - //! Access function for the Tpetra::Map this DistObject was constructed with. - const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraph::getMap"); return toXpetra(graph_->Map()); } - - //! Import. - void doImport(const DistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM); - - //! Export. - void doExport(const DistObject &dest, const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM); - - //! Import (using an Exporter). - void doImport(const DistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM); - - //! Export (using an Importer). - void doExport(const DistObject &dest, const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM); - - //@} - - //! @name Xpetra specific - //@{ - - //! EpetraCrsGraph constructor to wrap a Epetra_CrsGraph object - EpetraCrsGraph(const Teuchos::RCP &graph) : graph_(graph) { } - - //! Get the underlying Epetra graph - RCP< const Epetra_CrsGraph> getEpetra_CrsGraph() const { return graph_; } - - //@} - - private: - - RCP graph_; - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraCrsMatrix.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraCrsMatrix.hpp.tmpl deleted file mode 100644 index 119df184b2b0..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraCrsMatrix.hpp.tmpl +++ /dev/null @@ -1,81 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_CrsMatrix.hpp" - -#include -#include - -#include "Xpetra_EpetraMap.hpp" -#include "Xpetra_EpetraVector.hpp" -#include "Xpetra_EpetraMultiVector.hpp" -#include "Xpetra_EpetraCrsGraph.hpp" - -#include "Xpetra_Utils.hpp" -#include "Xpetra_Exceptions.hpp" - -namespace Xpetra { - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - typedef double Scalar; - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef CrsMatrix::node_type Node; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! Deep copy constructor - $TMPL_CLASS(const $TMPL_CLASS& matrix); - - //! Implements DistObject interface - //{@ - - //! Access function for the Tpetra::Map this DistObject was constructed with. - const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsMatrix::getMap"); return toXpetra(mtx_->Map()); } - - //! Import. - void doImport(const DistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM); - - //! Export. - void doExport(const DistObject &dest, const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM); - - //! Import (using an Exporter). - void doImport(const DistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM); - - //! Export (using an Importer). - void doExport(const DistObject &dest, const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM); - - //@} - - //! @name Xpetra specific - //@{ - - //! EpetraCrsMatrix constructor to wrap a Epetra_CrsMatrix object - EpetraCrsMatrix(const Teuchos::RCP &mtx) : mtx_(mtx), isFillResumed_(false) { } - - //! Get the underlying Epetra matrix - RCP getEpetra_CrsMatrix() const { return mtx_; } - - //! Get the underlying Epetra matrix - RCP getEpetra_CrsMatrixNonConst() const { return mtx_; } //TODO: remove - - //@} - - private: - - RCP mtx_; - - bool isFillResumed_; //< For Epetra, fillResume() is a fictive operation but we need to keep track of it. This boolean is true only is resumeFill() have been called and fillComplete() have not been called afterward. - - }; // EpetraImport class - -} // Xpetra namespace - -#define XPETRA_EPETRACRSMATRIX_SHORT -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraExport.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraExport.hpp.tmpl deleted file mode 100644 index dc34c650a203..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraExport.hpp.tmpl +++ /dev/null @@ -1,52 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_Export.hpp" - -#include "Xpetra_EpetraMap.hpp"//TMP - -#include "Epetra_Export.h" - -// Note: 'export' is a reserved keyword in C++. Do not use 'export' as a variable name. - -namespace Xpetra { - - // TODO: move that elsewhere - const Epetra_Export & toEpetra(const Export &); - RCP > toXpetra(const Epetra_Export *exp); - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef Export::node_type Node; - //! The specialization of Map used by this class. - typedef Map map_type; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! EpetraExport constructor to wrap a Epetra_Export object - EpetraExport(const RCP &exp) : export_(exp) { } - - //! Get the underlying Epetra export - RCP< const Epetra_Export> getEpetra_Export() const { return export_; } - - //@} - - private: - - RCP export_; - - }; // EpetraExport class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraImport.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraImport.hpp.tmpl deleted file mode 100644 index c302c80b4dde..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraImport.hpp.tmpl +++ /dev/null @@ -1,55 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_Import.hpp" - -#include "Xpetra_EpetraMap.hpp"//TMP - -#include "Epetra_Import.h" - -namespace Xpetra { - - // TODO: move that elsewhere - // const Epetra_Import & toEpetra(const Import &); - - RCP< const Import > toXpetra(const Epetra_Import *import); - // - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef Import::node_type Node; - //! The specialization of Map used by this class. - typedef Map map_type; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! List of entries in the target Map to receive from other processes. - ArrayView< const LocalOrdinal > getRemotePIDs() const; - - //! @name Xpetra specific - //@{ - - //! EpetraImport constructor to wrap a Epetra_Import object - EpetraImport(const RCP &import) : import_(import) { } - - //! Get the underlying Epetra import - RCP< const Epetra_Import> getEpetra_Import() const { return import_; } - - //@} - - private: - - RCP import_; - - }; // EpetraImport class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraMap.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraMap.hpp.tmpl deleted file mode 100644 index 58d635e64daa..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraMap.hpp.tmpl +++ /dev/null @@ -1,75 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_Map.hpp" - -#include -#include - -#include "Xpetra_Utils.hpp" -#include "Xpetra_EpetraUtils.hpp" - -#include "Xpetra_ConfigDefs.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - const Epetra_Map & toEpetra(const Map &); - const Epetra_Map & toEpetra(const RCP< const Map > &); - //const RCP< const Map > toXpetra(const RCP< const Epetra_Map > &); - const RCP< const Map > toXpetra(const Epetra_BlockMap &); - // - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef Map::node_type Node; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! Return the global index for a given local index. Note that this returns -1 if not found on this processor. (This is different than Epetra's behavior!) - GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const { - XPETRA_MONITOR("EpetraMap::getGlobalElement"); - - GlobalOrdinal gid = map_->GID(localIndex); - if (gid == map_->IndexBase()-1) return (-1); - else return (gid); - } - - //! @name Xpetra specific - //@{ - - //! Destructor. - virtual ~EpetraMap() { } // virtual because EpetraMap used as a base class of EpetraStridedMap - - //! EpetraMap constructor to wrap a Epetra_Map object - EpetraMap(const Teuchos::RCP &map) - : map_(map) { } - - //! Get the library used by this object (Epetra or Epetra?) - UnderlyingLib lib() const { return Xpetra::UseEpetra; } - - //! Get the underlying Epetra map - //const RCP< const Epetra_Map > & getEpetra_Map() const { return map_; } - const Epetra_BlockMap& getEpetra_BlockMap() const { return *map_; } - const Epetra_Map& getEpetra_Map() const { return (Epetra_Map &)*map_; } // Ugly, but the same is done in Epetra_CrsMatrix.h to get the map. - - //@} - - protected: - - RCP map_; - //const RCP< const Epetra_BlockMap > map_; - //const RCP< const Epetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_; - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraMultiVector.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraMultiVector.hpp.tmpl deleted file mode 100644 index 98ae56fbeb1b..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraMultiVector.hpp.tmpl +++ /dev/null @@ -1,118 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_MultiVector.hpp" -#include "Xpetra_Vector.hpp" - -#include "Xpetra_EpetraMap.hpp" -#include "Xpetra_EpetraExport.hpp" -#include "Xpetra_Utils.hpp" -#include "Xpetra_EpetraUtils.hpp" - -#include - -namespace Xpetra { - - // TODO: move that elsewhere - const Epetra_MultiVector & toEpetra(const MultiVector &); - Epetra_MultiVector & toEpetra(MultiVector &); - RCP > toXpetra(RCP vec); - - // #ifndef DOXYGEN_SHOULD_SKIP_THIS - // // forward declaration of EpetraVector, needed to prevent circular inclusions - // template class EpetraVector; - // #endif - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - typedef double Scalar; - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef MultiVector::node_type Node; - - public: - - //! @name Constructor/Destructor Methods - //@{ - - //! Basic MultiVector constuctor. - EpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true) - : vec_(Teuchos::rcp(new Epetra_MultiVector(toEpetra(map), Teuchos::as(NumVectors), zeroOut))) { } - - //! MultiVector copy constructor. - EpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source) - : vec_(Teuchos::rcp(new Epetra_MultiVector(toEpetra(source)))) { } - - //! Set multi-vector values from array of pointers using Teuchos memory management classes. (copy). - EpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors); - - //! MultiVector destructor. - virtual ~EpetraMultiVector() { } - - //@} - -$TMPL_PUBLIC_FUNCTIONS - - //! Set multi-vector values to random numbers. - void randomize(bool bUseXpetraImplementation = false) { - XPETRA_MONITOR("EpetraMultiVector::randomize"); - - if (bUseXpetraImplementation) - Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Xpetra_randomize(); - else - vec_->Random(); - } - - //! Implements DistObject interface - //{@ - - //! Access function for the Tpetra::Map this DistObject was constructed with. - const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraMultiVector::getMap"); return toXpetra(vec_->Map()); } - - //! Import. - void doImport(const DistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM); - - //! Export. - void doExport(const DistObject &dest, const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM); - - //! Import (using an Exporter). - void doImport(const DistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM); - - //! Export (using an Importer). - void doExport(const DistObject &dest, const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM); - - //! Replace the underlying Map in place. - void replaceMap(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map); - - //@} - - //! @name Xpetra specific - //@{ - - //! EpetraMultiVector constructor to wrap a Epetra_MultiVector object - EpetraMultiVector(const RCP &vec) : vec_(vec) { } //TODO removed const - - //! Get the underlying Epetra multivector - RCP getEpetra_MultiVector() const { return vec_; } - - //! Set seed for Random function. - void setSeed(unsigned int seed) { - XPETRA_MONITOR("EpetraMultiVector::seedrandom"); - - Teuchos::ScalarTraits< Scalar >::seedrandom(seed); - vec_->SetSeed(seed); - } - - //@} - - private: - - RCP< Epetra_MultiVector > vec_; - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraVector.hpp.tmpl b/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraVector.hpp.tmpl deleted file mode 100644 index 3283d421ed0c..000000000000 --- a/packages/xpetra/scripts/epetra/tmpl/Xpetra_EpetraVector.hpp.tmpl +++ /dev/null @@ -1,63 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_EpetraConfigDefs.hpp" - -#include "Xpetra_Vector.hpp" -#include "Xpetra_EpetraMultiVector.hpp" -#include "Xpetra_EpetraMap.hpp" //TMP -#include "Xpetra_Utils.hpp" -#include "Xpetra_EpetraImport.hpp" -#include "Xpetra_EpetraExport.hpp" -#include "Xpetra_Exceptions.hpp" - -#include - -namespace Xpetra { - - // TODO: move that elsewhere - Epetra_Vector & toEpetra(Vector &); - - const Epetra_Vector & toEpetra(const Vector &); - // - - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - typedef double Scalar; - typedef int LocalOrdinal; - typedef int GlobalOrdinal; - typedef Vector::node_type Node; - - public: - - using EpetraMultiVector::dot; // overloading, not hiding - using EpetraMultiVector::norm1; // overloading, not hiding - using EpetraMultiVector::norm2; // overloading, not hiding - using EpetraMultiVector::normInf; // overloading, not hiding - using EpetraMultiVector::normWeighted; // overloading, not hiding - using EpetraMultiVector::meanValue; // overloading, not hiding - using EpetraMultiVector::replaceGlobalValue; // overloading, not hiding - using EpetraMultiVector::sumIntoGlobalValue; // overloading, not hiding - using EpetraMultiVector::replaceLocalValue; // overloading, not hiding - using EpetraMultiVector::sumIntoLocalValue; // overloading, not hiding - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! EpetraMultiVector constructor to wrap a Epetra_Vector object - EpetraVector(const Teuchos::RCP &vec) : EpetraMultiVector(vec) { } // TODO: removed const of Epetra::Vector - - //! Get the underlying Epetra vector - Epetra_Vector * getEpetra_Vector() const { return (*this->EpetraMultiVector::getEpetra_MultiVector())(0); } - //RCP getEpetra_Vector() const { return this->EpetraMultiVector::getEpetra_MultiVector()->getVectorNonConst(0); } - - //@} - - }; // EpetraVector class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/interfaces.py b/packages/xpetra/scripts/interfaces.py deleted file mode 100644 index 727d4a2eef59..000000000000 --- a/packages/xpetra/scripts/interfaces.py +++ /dev/null @@ -1,98 +0,0 @@ -import sys -sys.path.append('lib/') - -import os -from string import Template -from ConfigParser import SafeConfigParser -from XpetraLib import * -from XpetraLibConfig import * - - -def buildFuncLineInterface( functionNode ): - - # = function name - name = functionNode.xpath('name')[0].text - - # = return type of the function - type = functionNode.xpath('type')[0].xpath("string()") - - # - argsstring = functionNode.xpath('argsstring')[0].text - - # briefdescription - briefdescription = functionNode.xpath("briefdescription")[0].xpath("string()") - - #hack for Vector - if 'magnitudeType' in type: type = 'typename ' + type - if functionNode.xpath('//compoundname')[0].text == 'Tpetra::Vector': - if name in ['dot','norm1','norm2','normInf','normWeighted','meanValue'] and 'ArrayView' in argsstring: return '' - - # - if len(type) > 0 : - declStr = type + " " + name + argsstring - else: - declStr = name + argsstring -# declStr = declStr.rstrip() - - if 'TPETRA_DEPRECATED' in type: return '' -# if "const =0" in argsstring: return '' #hack for CrsMatrix #JJH commenting this out, otherwise Tpetra::RowGraph is empty - - # hack for MultiVector - if name == "scale" and "Teuchos::ArrayView< const Scalar > alpha" in argsstring: return '' - if name == "scale" and "const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A" in argsstring: return '' - - # hack for Vector: - # - do not add MultiVector inherited methods - if functionNode.xpath('//compoundname')[0].text == 'Tpetra::Vector': - if name in ['replaceGlobalValue','sumIntoGlobalValue','replaceLocalValue','sumIntoLocalValue'] and 'size_t vectorIndex' in argsstring: return '' - - # - if name in conf_RemoveRefFunctionList: declStr = declStr.replace('&', '') - - descStr = " //! " + briefdescription.lstrip().rstrip() + "\n" - declStr = " virtual " + declStr + "= 0;" - declStr = declStr.replace('=0= 0', '= 0') #there may be repeated =0's, so fix that here - - return descStr + declStr + "\n" + "\n" -#### - -xml_dir = trilinosRoot_dir + '/packages/tpetra/doc/xml/' -conf_dir = 'interfaces/conf/' -tmpl_dir = 'interfaces/tmpl/' -out_dir = '../src/' - -for file in os.listdir(conf_dir): - basename, extension = os.path.splitext(file) - if extension == ".conf": - -#### READ CONFIG #### - parser = SafeConfigParser() - parser.read(conf_dir + file) - - conf_XMLheaders = xml_dir + parser.get('io', 'XMLheaders') - conf_XMLclass = xml_dir + parser.get('io', 'XMLclass') - conf_template = tmpl_dir + parser.get('io', 'template') - conf_output = parser.get('io', 'output') - - conf_SkipFunctionList = set(parser.get('function', 'skip').split(';')) - conf_RemoveRefFunctionList = set(parser.get('function', 'removeref').split(';')) - conf_SkipHeaderList = set(parser.get('header', 'skip').split(';')) -# - - template = open(conf_template, 'r').read() - out = Template(template) - - className = buildClassDefinition(conf_XMLclass) - out = out.substitute( - TMPL_HEADERS=buildHeader(className, 'interfaces.py'), - TMPL_INCLUDES=buildInclude(conf_XMLheaders, conf_SkipHeaderList), - TMPL_TEMPLATE_PARAM=buildTemplateParam(conf_XMLclass), - TMPL_CLASS=className, - TMPL_INHERITANCE=' ' + parser.get('inheritance', 'parent').rstrip(), - TMPL_DESTRUCTOR=buildDestructor(className), - TMPL_PUBLIC_FUNCTIONS=buildClassFunctions(conf_XMLclass, conf_SkipFunctionList, buildFuncLineInterface), - TMPL_FOOTERS=buildFooter(className) - ) - f = open(out_dir + conf_output, 'w') - f.write(out) - f.close() diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_CrsGraph.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_CrsGraph.hpp.conf deleted file mode 100644 index 656e212cfb37..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_CrsGraph.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__CrsGraph__decl_8hpp.xml -XMLclass = classTpetra_1_1CrsGraph.xml -template = Xpetra_CrsGraph.hpp.tmpl -output = CrsGraph/Xpetra_CrsGraph.hpp - -[header] -skip = Tpetra_RowGraph.hpp;Tpetra_Util.hpp;Kokkos_CrsGraph.hpp;Teuchos_SerialDenseMatrix.hpp;Teuchos_CompileTimeAssert.hpp;Teuchos_ParameterListAcceptorDefaultBase.hpp - -[function] -skip = CrsGraph;~CrsGraph;globalAssemble;resumeFill;getNode;getNodeAllocationSize;isFillActive;getGlobalRowCopy;getLocalRowCopy;checkSizes;copyAndPermute;packAndPrepare;unpackAndCombine;getNodeRowBegs;getNodePackedIndices;optimizeStorage;isSorted;setParameterList;getValidParameters;getNodeRowPtrs;clone;pack;expertStaticFillComplete;setAllIndices;replaceColMap;replaceDomainMapAndImporter;removeEmptyProcessesInPlace -removeref = getComm;getRowMap;getColMap;getDomainMap;getRangeMap - -[inheritance] -parent = : /*public RowGraph<>,*/ public DistObject diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_CrsMatrix.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_CrsMatrix.hpp.conf deleted file mode 100644 index 6851edf478d6..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_CrsMatrix.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__CrsMatrix__decl_8hpp.xml -XMLclass = classTpetra_1_1CrsMatrix.xml -template = Xpetra_CrsMatrix.hpp.tmpl -output = CrsMatrix/Xpetra_CrsMatrix.hpp - -[header] -skip = Kokkos_CrsMatrix.hpp - -[function] -skip = CrsMatrix;~CrsMatrix;sumIntoGlobalValues;sumIntoLocalValues;globalAssemble;getComm;getNode;getGraph;getLocalNumCols;getIndexBase;getNumEntriesInGlobalRow;hasColMap;isStorageOptimized;isStaticGraph;multiply;solve;hasTransposeApply;checkSizes;copyAndPermute;packAndPrepare;unpackAndCombine;optimizeStorage;leftScale;rightScale;localMultiply;localSolve;getLocalRowCopy;convert -removeref = getRowMap;getColMap;getDomainMap;getRangeMap - -[inheritance] -parent = : public RowMatrix, public DistObject diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_DistObject.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_DistObject.hpp.conf deleted file mode 100644 index 5fa0c3031098..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_DistObject.hpp.conf +++ /dev/null @@ -1,17 +0,0 @@ -[io] -XMLheaders = Tpetra__DistObject__decl_8hpp.xml -XMLclass = classTpetra_1_1DistObject.xml -template = default.hpp.tmpl -output = DistObject/Xpetra_DistObject.hpp - -[header] -skip = Tpetra_Distributor.hpp;Tpetra_SrcDistObject.hpp - -[function] -skip = DistObject;~DistObject;isDistributed;print;removeEmptyProcessesInPlace -removeref = getMap - -[inheritance] -parent = : virtual public Teuchos::Describable - -#TODO change comment //! Access function for the Tpetra::Map this DistObject was constructed with. diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_Export.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_Export.hpp.conf deleted file mode 100644 index 786f19b9f4fc..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_Export.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__Export__decl_8hpp.xml -XMLclass = classTpetra_1_1Export.xml -template = default.hpp.tmpl -output = Export/Xpetra_Export.hpp - -[header] -skip = Tpetra_Util.hpp;Tpetra_ImportExportData.hpp - -[function] -skip = Export;~Export;getDistributor;operator=;setParameterList -removeref = getSourceMap;getTargetMap - -[inheritance] -parent = : public Teuchos::Describable diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_Import.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_Import.hpp.conf deleted file mode 100644 index 703a62d76005..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_Import.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__Import__decl_8hpp.xml -XMLclass = classTpetra_1_1Import.xml -template = default.hpp.tmpl -output = Import/Xpetra_Import.hpp - -[header] -skip = Tpetra_Util.hpp;Tpetra_ImportExportData.hpp;Tpetra_Distributor.hpp - -[function] -skip = Import;~Import;getDistributor;operator=;setParameterList;setUnion;createRemoteOnlyImport -removeref = getSourceMap;getTargetMap - -[inheritance] -parent = : public Teuchos::Describable diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_Map.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_Map.hpp.conf deleted file mode 100644 index 17d8c6101bad..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_Map.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__Map__decl_8hpp.xml -XMLclass = classTpetra_1_1Map.xml -template = Xpetra_Map.hpp.tmpl -output = Map/Xpetra_Map.hpp - -[header] -skip = Tpetra_Directory_decl.hpp - -[function] -skip = Map;~Map;clone;isUniform -removeref = getComm;getNode - -[inheritance] -parent = : public Teuchos::Describable diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_MultiVector.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_MultiVector.hpp.conf deleted file mode 100644 index 069294f4184e..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_MultiVector.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__MultiVector__decl_8hpp.xml -XMLclass = classTpetra_1_1MultiVector.xml -template = Xpetra_MultiVector.hpp.tmpl -output = MultiVector/Xpetra_MultiVector.hpp - -[header] -skip = Kokkos_MultiVector.hpp - -[function] -skip = MultiVector;~MultiVector;replaceMap;reduce;operator=;subCopy;subCopy;subView;subView;subViewNonConst;subViewNonConst;offsetView;offsetViewNonConst;get1dCopy;get2dCopy;get1dView;get2dView;get1dViewNonConst;get2dViewNonConst;getLocalMV;getStride;isConstantStride;randomize -removeref = - -[inheritance] -parent = : public DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_RowGraph.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_RowGraph.hpp.conf deleted file mode 100644 index e8db76d5b5cc..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_RowGraph.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__RowGraph__decl_8hpp.xml -XMLclass = classTpetra_1_1RowGraph.xml -template = default.hpp.tmpl -output = RowGraph/Xpetra_RowGraph.hpp - -[header] -skip = - -[function] -skip = RowGraph;~RowGraph -removeref = getComm;getRowMap;getColMap;getDomainMap;getRangeMap - -[inheritance] -parent = : virtual public Teuchos::Describable diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_RowMatrix.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_RowMatrix.hpp.conf deleted file mode 100644 index ef68d719a5b2..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_RowMatrix.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__RowMatrix__decl_8hpp.xml -XMLclass = classTpetra_1_1RowMatrix.xml -template = Xpetra_RowMatrix.hpp.tmpl -output = RowMatrix/Xpetra_RowMatrix.hpp - -[header] -skip = Tpetra_Operator.hpp;Tpetra_RowGraph.hpp - -[function] -skip = RowMatrix;~RowMatrix;getGraph;getComm;getNode;getIndexBase;getNumEntriesInGlobalRow;hasColMap;getGlobalRowCopy;leftScale;rightScale;hasTransposeApply -removeref = getRowMap;getColMap;getDomainMap;getRangeMap;getComm - -[inheritance] -parent = diff --git a/packages/xpetra/scripts/interfaces/conf/Xpetra_Vector.hpp.conf b/packages/xpetra/scripts/interfaces/conf/Xpetra_Vector.hpp.conf deleted file mode 100644 index 000dc227fddc..000000000000 --- a/packages/xpetra/scripts/interfaces/conf/Xpetra_Vector.hpp.conf +++ /dev/null @@ -1,15 +0,0 @@ -[io] -XMLheaders = Tpetra__Vector__decl_8hpp.xml -XMLclass = classTpetra_1_1Vector.xml -template = Xpetra_Vector.hpp.tmpl -output = Vector/Xpetra_Vector.hpp - -[header] -skip = Tpetra_MultiVector_decl.hpp - -[function] -skip = Vector;~Vector;putScalar;randomize;replaceMap;reduce;subCopy;subCopy;subView;subView;subViewNonConst;subViewNonConst;offsetView;offsetViewNonConst;getVector;getVectorNonConst;getData;getDataNonConst;get1dCopy;get2dCopy;get1dView;get2dView;get1dViewNonConst;get2dViewNonConst;getLocalMV;abs;reciprocal;scale;update;update;multiply;elementWiseMultiply;getNumVectors;getLocalLength;getGlobalLength;getStride;isConstantStride -removeref = - -[inheritance] -parent = : public virtual MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > diff --git a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_CrsGraph.hpp.tmpl b/packages/xpetra/scripts/interfaces/tmpl/Xpetra_CrsGraph.hpp.tmpl deleted file mode 100644 index 006cc47eb293..000000000000 --- a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_CrsGraph.hpp.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -$TMPL_HEADERS - -#include - -$TMPL_INCLUDES - -#include "Xpetra_Map.hpp" - -using Teuchos::ParameterList; - -namespace Xpetra { - - struct RowInfo { - size_t localRow; - size_t allocSize; - size_t numEntries; - size_t offset1D; - }; - - enum ELocalGlobal { - LocalIndices, - GlobalIndices - }; - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - -$TMPL_DESTRUCTOR - -$TMPL_PUBLIC_FUNCTIONS - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_CrsMatrix.hpp.tmpl b/packages/xpetra/scripts/interfaces/tmpl/Xpetra_CrsMatrix.hpp.tmpl deleted file mode 100644 index cb1ef2cc3473..000000000000 --- a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_CrsMatrix.hpp.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -$TMPL_HEADERS - -$TMPL_INCLUDES - -namespace Xpetra { - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - -$TMPL_DESTRUCTOR - -$TMPL_PUBLIC_FUNCTIONS - // Adding these functions by hand, as they're in the skip list. - - //! Returns the number of matrix columns owned on the calling node. - virtual size_t getLocalNumCols() const = 0; - - //! Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calling routine. - virtual void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const = 0; - - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_Map.hpp.tmpl b/packages/xpetra/scripts/interfaces/tmpl/Xpetra_Map.hpp.tmpl deleted file mode 100644 index 7c6ec85be909..000000000000 --- a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_Map.hpp.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -$TMPL_HEADERS - -$TMPL_INCLUDES - -namespace Xpetra { - - enum UnderlyingLib { - UseEpetra, - UseTpetra, - NotSpecified - }; - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - -$TMPL_DESTRUCTOR - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! Get the library used by this object (Tpetra or Epetra?) - virtual UnderlyingLib lib() const = 0; - - // TODO: find a better solution for this hack - // The problem is that EpetraMap, TpetraMap and StridedMap all inherit Map. To have proper toEpetra() we - // need to understand the type of underlying matrix. But in src/Map we have no knowledge of StridedMaps, so - // we cannot check for it by casting. This function allows us to avoid the restriction, as StridedMap redefines - // it to return the base map. - virtual RCP getMap() const { return rcpFromRef(*this); } - - - //@} - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_MultiVector.hpp.tmpl b/packages/xpetra/scripts/interfaces/tmpl/Xpetra_MultiVector.hpp.tmpl deleted file mode 100644 index 9253f4e26b52..000000000000 --- a/packages/xpetra/scripts/interfaces/tmpl/Xpetra_MultiVector.hpp.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -$TMPL_HEADERS - -$TMPL_INCLUDES - -namespace Xpetra { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // forward declaration of Vector, needed to prevent circular inclusions - template class Vector; -#endif - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - -$TMPL_DESTRUCTOR - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! Set seed for Random function. - virtual void setSeed(unsigned int seed)= 0; - - - virtual void randomize(bool bUseXpetraImplementation = false)= 0; - - //! Set multi-vector values to random numbers. XPetra implementation - virtual void Xpetra_randomize() - { - typedef Teuchos::ScalarTraits SCT; - - const size_t numVectors = getNumVectors(); - for (size_t i = 0; i < numVectors; i++) - { - Teuchos::ArrayRCP< Scalar > datai = getDataNonConst(i); - - const size_t myLength = getLocalLength(); - for(size_t j=0; j::dot; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normWeighted; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::meanValue; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceGlobalValue; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoGlobalValue; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceLocalValue; // overloading, not hiding - using MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoLocalValue; // overloading, not hiding - -$TMPL_DESTRUCTOR - -$TMPL_PUBLIC_FUNCTIONS - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/interfaces/tmpl/default.hpp.tmpl b/packages/xpetra/scripts/interfaces/tmpl/default.hpp.tmpl deleted file mode 100644 index 614409cd1389..000000000000 --- a/packages/xpetra/scripts/interfaces/tmpl/default.hpp.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -$TMPL_HEADERS - -$TMPL_INCLUDES - -namespace Xpetra { - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - -$TMPL_DESTRUCTOR - -$TMPL_PUBLIC_FUNCTIONS - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/lib/XpetraDoxygenVersion.py b/packages/xpetra/scripts/lib/XpetraDoxygenVersion.py deleted file mode 100644 index 3bc293e405f4..000000000000 --- a/packages/xpetra/scripts/lib/XpetraDoxygenVersion.py +++ /dev/null @@ -1,5 +0,0 @@ -doxygen_ver = "1.4.7" -def checkDoxygenVersion(root): - if root.get("version") != doxygen_ver: - msgStr = 'XML files must be generated with Doxygen ' + doxygen_ver + '.' - raise Exception(msgStr) diff --git a/packages/xpetra/scripts/lib/XpetraLib.py b/packages/xpetra/scripts/lib/XpetraLib.py deleted file mode 100644 index 8fed4f5304ff..000000000000 --- a/packages/xpetra/scripts/lib/XpetraLib.py +++ /dev/null @@ -1,143 +0,0 @@ -from lxml import etree -from XpetraDoxygenVersion import checkDoxygenVersion - -#### GENERATE HEADER / FOOTER #### -def buildHeader( className, script='', prefix='' ): - # python 2.5: with open('../doc/COPYRIGHT_AND_LICENSE', 'r') as f: - f = open('../doc/COPYRIGHT_AND_LICENSE', 'r') - headerStr = f.read() - upperClassName = className.upper() - headerStr += "#ifndef XPETRA_" + prefix + upperClassName + "_HPP\n" - headerStr += "#define XPETRA_" + prefix + upperClassName + "_HPP\n\n" - headerStr += "/* this file is automatically generated - do not edit (see script/" + script + ") */" - return headerStr - -def buildFooter( className, short=True): - upperClassName = className.upper() - footerStr = '' - if short: footerStr += "#define XPETRA_" + upperClassName + "_SHORT\n" - footerStr += "#endif // XPETRA_" + upperClassName + "_HPP" - return footerStr - -#### #### #### #### #### #### #### #### - -#### PARSE INCLUDES #### -def buildInclude( XMLfile, skipList=[] ): - tree = etree.parse(XMLfile) - includes = tree.xpath('//includes/text()') - includesStr = '' - for include in includes: - if include in skipList: continue - if (include[0:6] == 'Tpetra'): - includesStr += "#include \"" + include.replace('Tpetra','Xpetra') + "\"" + "\n" - else: - includesStr += "#include <" + include + ">" + "\n" - - includesStr = includesStr.rstrip() - - return includesStr -#### - -def buildDestructor( className ): - return ' //! @name Constructor/Destructor Methods' + "\n" + ' //@{ ' + "\n" + '' + "\n" + ' //! Destructor.' + "\n" + ' virtual ~' + className + '() { }' + "\n" + "\n" + ' //@}' - -#### PARSE CLASS DEFINITION #### - -def buildClassDefinition( XMLfile, prefix='' ): - tree = etree.parse(XMLfile) - root = tree.getroot() # root == - classNode = root[0] # classNode == - checkDoxygenVersion(root) - - className = classNode.xpath('compoundname')[0].text # Tpetra::Map - className = className.lstrip('Tpetra::') # Map - #print(className) - - className = prefix + className - - return className -#### - -def buildTemplateParam( XMLfile ): - tree = etree.parse(XMLfile) - root = tree.getroot() # root == - classNode = root[0] # classNode == - checkDoxygenVersion(root) - - templateParamNode = classNode.xpath('templateparamlist')[0]; - str = '' - for child in templateParamNode: - type = child.xpath('type')[0].text # == 'class' - name = child.xpath('declname')[0].text # == 'GlobalOrdinal' - - defvalStr = '' - defvalNode = child.xpath('defval') - if len(defvalNode) == 1: - defval = defvalNode[0].text # == 'LocalOrdinal' - defvalStr = ' = ' + defval - - str += type + ' ' + name + defvalStr + ', ' # str == 'class GlobalOrdinal = LocalOrdinal, ' - #print(str) - - templateParamStr = 'template <' + str.rstrip(', ') + '>' # template - #print(templateParamStr) - - return templateParamStr - -def buildTemplateParam2( XMLfile ): - tree = etree.parse(XMLfile) - root = tree.getroot() # root == - classNode = root[0] # classNode == - checkDoxygenVersion(root) - - templateParamNode = classNode.xpath('templateparamlist')[0]; - str = '' - for child in templateParamNode: - name = child.xpath('declname')[0].text # == 'GlobalOrdinal' - str += name + ', ' # str == 'GlobalOrdinal, ' - #print(str) - - templateParamStr = str.rstrip(', ') # LocalOrdinal, GlobalOrdinal, Node - #print(templateParamStr) - - return templateParamStr -#### - -#### PARSE MEMBERDEF PUBLIC FUNCTIONS #### -def buildClassFunctions( XMLfile, skipFunctionList, buildFuncLine ): - tree = etree.parse(XMLfile) - root = tree.getroot() # root == - classNode = root[0] # classNode == - checkDoxygenVersion(root) - - functionStr = '' - - sectiondefNodes = classNode.xpath("//sectiondef[@kind='user-defined']") - for sectiondefNode in sectiondefNodes: - header = sectiondefNode.xpath("header//text()") - if len(header) > 0: header = header[0] - else: header = '' - #description = sectiondefNode.xpath("description")[0].xpath("string()") - - ###publicFunctionNodes = classNode.xpath("//memberdef[@kind='function' and @prot='public']") - publicFunctionNodes = sectiondefNode.xpath("memberdef[@kind='function' and @prot='public']") - functionSubStr = '' - for functionNode in publicFunctionNodes: - # skip some functions - name = functionNode.xpath('name')[0].text - if name in skipFunctionList: continue - - # build the line for this function - functionSubStr += buildFuncLine(functionNode) - - if functionSubStr != '': - functionStr += " //! @name " + header + "\n" - functionStr += " //@{\n\n" - functionStr += functionSubStr - functionStr += " //@}\n\n" - - functionStr = functionStr.rstrip() - - return functionStr; - -#### diff --git a/packages/xpetra/scripts/lib/XpetraLibConfig.py b/packages/xpetra/scripts/lib/XpetraLibConfig.py deleted file mode 100644 index 381864104982..000000000000 --- a/packages/xpetra/scripts/lib/XpetraLibConfig.py +++ /dev/null @@ -1 +0,0 @@ -trilinosRoot_dir = "../../.." diff --git a/packages/xpetra/scripts/tpetra.py b/packages/xpetra/scripts/tpetra.py deleted file mode 100644 index cde8a67a25e0..000000000000 --- a/packages/xpetra/scripts/tpetra.py +++ /dev/null @@ -1,161 +0,0 @@ -import sys -sys.path.append('lib/') - -import os -from string import Template -from ConfigParser import SafeConfigParser -from XpetraLib import * -from XpetraLibConfig import * - - -def buildFuncLineTpetra( functionNode ): - -#TODO: clean up - tree = etree.parse(conf_XMLclass) - root = tree.getroot() # root == - classNode = root[0] # classNode == - - fullClassName = classNode.xpath('compoundname')[0].text # Tpetra::Map - baseClassName = fullClassName.lstrip('Tpetra::') # Map - className = 'Tpetra'+baseClassName # TpetraMap -## - - # = function name - name = functionNode.xpath('name')[0].text - if name == baseClassName: name = className - if name == '~'+baseClassName: name = '~'+className - - # = return type of the function - type = functionNode.xpath('type')[0].xpath("string()") - - # - argsstring = functionNode.xpath('argsstring')[0].text - - # skip deprecated functions - if 'TPETRA_DEPRECATED' in type: return '' - - # hack for Vector: - # - add missing 'typename' - # - do not add MultiVector inherited methods - if 'magnitudeType' in type: type = 'typename ' + type - if functionNode.xpath('//compoundname')[0].text == 'Tpetra::Vector': - if name in ['dot','norm1','norm2','normInf','normWeighted','meanValue'] and 'ArrayView' in argsstring: return '' - if functionNode.xpath('//compoundname')[0].text == 'Tpetra::Vector': - if name in ['replaceGlobalValue','sumIntoGlobalValue','replaceLocalValue','sumIntoLocalValue'] and 'size_t vectorIndex' in argsstring: return '' - - # hack for MultiVector - # if name == "scale" and "Teuchos::ArrayView< const Scalar > alpha" in argsstring: return '' - # if name == "scale" and "const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A" in argsstring: return '' - - #hack for CrsMatrix - if name == "getLocalRowCopy" and "const =0" in argsstring: return '' - if name == "TpetraCrsMatrix" and "const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &graph" in argsstring: return '' - if className == "TpetraCrsMatrix" and "const =0" in argsstring: argsstring = argsstring.replace("const =0", "const") - - #hack for RowMatrix - if className == "TpetraRowMatrix" and "const =0" in argsstring: argsstring = argsstring.replace("const =0", "const") - - # -> get list of arg name as a string 'GIDList, nodeIDList, LIDList' - # Simple version - # paramList = functionNode.xpath('param/declname/text()') - # paramStr = ', '.join(param for param in paramList) - - # More complete version - paramStr = '' - paramNodes = functionNode.xpath('param') - #print name - for paramNode in paramNodes: - n = paramNode.xpath('declname')[0].xpath("string()") - if paramNode.xpath('type')[0].xpath("string()") in conf_TypeWrapped: - paramStr += "toTpetra(" + n + ")" - else: - paramStr += n - - paramStr += ", " - - paramStr = paramStr.rstrip(', ') - - # briefdescription - briefdescription = functionNode.xpath("briefdescription")[0].xpath("string()") - - if len(type) > 0: - declStr = type + " " + name + argsstring - else: - declStr = name + argsstring - declStr = declStr.rstrip() - - if name in conf_RemoveRefFunctionList: declStr = declStr.replace('&', '') - - descStr = " //! " + briefdescription.lstrip().rstrip() + "\n" - defStr = " " + declStr - - if name != className and name != "~"+className: - defStr += " { " - defStr += "XPETRA_MONITOR(\"" + className + "::" + name + "\"); " - if len(type) > 0 and type != 'void': defStr += 'return ' - if type in conf_TypeWrapped: defStr += "toXpetra(" - defStr += conf_memberName + "->" + name - defStr += "(" + paramStr - if type in conf_TypeWrapped: defStr += ")" - defStr += "); }" - - # constructor - if name == className: - defStr += "\n " + ": " + conf_memberName + "(Teuchos::rcp(new " + fullClassName + "< "+templateParam+" >" - defStr += "(" + paramStr + "))) { " - defStr += " }" - - # destructor - if name == '~'+className: - defStr += " { " - defStr += " }" - - return descStr + defStr + "\n" + "\n"; - -#### - -xml_dir = trilinosRoot_dir + '/packages/tpetra/doc/xml/' -conf_dir = 'tpetra/conf/' -tmpl_dir = 'tpetra/tmpl/' -out_dir = '../src/' - -for file in os.listdir(conf_dir): - basename, extension = os.path.splitext(file) - if extension == ".conf": - -#### READ CONFIG #### - parser = SafeConfigParser() - parser.read(conf_dir + file) - - conf_XMLheaders = xml_dir + parser.get('io', 'XMLheaders') - conf_XMLclass = xml_dir + parser.get('io', 'XMLclass') - conf_template = tmpl_dir + parser.get('io', 'template') - conf_output = parser.get('io', 'output') - - conf_SkipFunctionList = set(parser.get('function', 'skip').split(';')) - conf_RemoveRefFunctionList = set(parser.get('function', 'removeref').split(';')) - conf_SkipHeaderList = set(parser.get('header', 'skip').split(';')) - conf_memberName = parser.get('member', 'name') - conf_TypeWrapped = set(parser.get('type', 'wrapped').split(';')) -# - - template = open(conf_template, 'r').read() - out = Template(template) - - className = buildClassDefinition(conf_XMLclass, 'Tpetra') - templateParam = buildTemplateParam2(conf_XMLclass) - - out = out.substitute( - TMPL_HEADERS=buildHeader(className, 'tpetra.py'), - TMPL_INCLUDES=buildInclude(conf_XMLheaders, conf_SkipHeaderList), - TMPL_TEMPLATE_PARAM=buildTemplateParam(conf_XMLclass), - TMPL_CLASS=className, - TMPL_INHERITANCE=' ' + parser.get('inheritance', 'parent').rstrip(), - TMPL_DESTRUCTOR=buildDestructor(className), - TMPL_PUBLIC_FUNCTIONS=buildClassFunctions(conf_XMLclass, conf_SkipFunctionList, buildFuncLineTpetra), - TMPL_FOOTERS=buildFooter(className) - ) - f = open(out_dir + conf_output, 'w') - f.write(out) - f.close() - diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraCrsGraph.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraCrsGraph.hpp.conf deleted file mode 100644 index 06cc7c3c70db..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraCrsGraph.hpp.conf +++ /dev/null @@ -1,21 +0,0 @@ -[io] -XMLheaders = Tpetra__CrsGraph__decl_8hpp.xml -XMLclass = classTpetra_1_1CrsGraph.xml -template = Xpetra_TpetraCrsGraph.hpp.tmpl -output = CrsGraph/Xpetra_TpetraCrsGraph.hpp - -[header] -skip = Tpetra_RowGraph.hpp;Tpetra_DistObject.hpp;Tpetra_Util.hpp - -[function] -skip = globalAssemble;resumeFill;getNode;getNodeAllocationSize;isFillActive;getGlobalRowCopy;getLocalRowCopy;checkSizes;copyAndPermute;packAndPrepare;unpackAndCombine;getNodeRowBegs;getNodePackedIndices;optimizeStorage;isSorted;setParameterList;getValidParameters;clone;pack;setAllIndices;replaceColMap;replaceDomainMapAndImporter;removeEmptyProcessesInPlace;expertStaticFillComplete -removeref = getComm;getRowMap;getColMap;getDomainMap;getRangeMap - -[inheritance] -parent = : public CrsGraph - -[member] -name = graph_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > >;const RCP< const map_type > & diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraCrsMatrix.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraCrsMatrix.hpp.conf deleted file mode 100644 index 72705544126e..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraCrsMatrix.hpp.conf +++ /dev/null @@ -1,20 +0,0 @@ -[io] -XMLheaders = Tpetra__CrsMatrix__decl_8hpp.xml -XMLclass = classTpetra_1_1CrsMatrix.xml -template = Xpetra_TpetraCrsMatrix.hpp.tmpl -output = CrsMatrix/Xpetra_TpetraCrsMatrix.hpp - -[header] - -[function] -skip = sumIntoGlobalValues;sumIntoLocalValues;globalAssemble;getComm;getNode;getGraph;getIndexBase;getNumEntriesInGlobalRow;hasColMap;isStorageOptimized;isStaticGraph;multiply;solve;hasTransposeApply;checkSizes;copyAndPermute;packAndPrepare;unpackAndCombine;optimizeStorage;leftScale;rightScale;localMultiply;localSolve;getLocalDiagCopy;convert -removeref = getRowMap;getColMap;getDomainMap;getRangeMap - -[inheritance] -parent = : public CrsMatrix//, public TpetraRowMatrix - -[member] -name = mtx_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > & diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraExport.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraExport.hpp.conf deleted file mode 100644 index 33efe79b557e..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraExport.hpp.conf +++ /dev/null @@ -1,21 +0,0 @@ -[io] -XMLheaders = Tpetra__Export__decl_8hpp.xml -XMLclass = classTpetra_1_1Export.xml -template = Xpetra_TpetraExport.hpp.tmpl -output = Export/Xpetra_TpetraExport.hpp - -[header] -skip = Tpetra_Util.hpp;Tpetra_ImportExportData.hpp - -[function] -skip = getDistributor;operator=;setParameterList -removeref = getSourceMap;getTargetMap - -[inheritance] -parent = : public Export - -[member] -name = export_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Export< LocalOrdinal, GlobalOrdinal, Node > &;const Teuchos::RCP< const map_type > & diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraImport.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraImport.hpp.conf deleted file mode 100644 index 93a1b62769fc..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraImport.hpp.conf +++ /dev/null @@ -1,21 +0,0 @@ -[io] -XMLheaders = Tpetra__Import__decl_8hpp.xml -XMLclass = classTpetra_1_1Import.xml -template = Xpetra_TpetraImport.hpp.tmpl -output = Import/Xpetra_TpetraImport.hpp - -[header] -skip = Tpetra_Util.hpp;Tpetra_ImportExportData.hpp;Tpetra_Distributor.hpp - -[function] -skip = getDistributor;operator=;setParameterList;setUnion;createRemoteOnlyImport -removeref = getSourceMap;getTargetMap - -[inheritance] -parent = : public Import - -[member] -name = import_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Import< LocalOrdinal, GlobalOrdinal, Node > &;const Teuchos::RCP< const map_type > & diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraMap.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraMap.hpp.conf deleted file mode 100644 index 87847bcbaf21..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraMap.hpp.conf +++ /dev/null @@ -1,21 +0,0 @@ -[io] -XMLheaders = Tpetra__Map__decl_8hpp.xml -XMLclass = classTpetra_1_1Map.xml -template = Xpetra_TpetraMap.hpp.tmpl -output = Map/Xpetra_TpetraMap.hpp - -[header] -skip = - -[function] -skip = -removeref = getComm;getNode - -[inheritance] -parent = : public virtual Map { - -[member] -name = map_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraMultiVector.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraMultiVector.hpp.conf deleted file mode 100644 index 2238b8712fd8..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraMultiVector.hpp.conf +++ /dev/null @@ -1,21 +0,0 @@ -[io] -XMLheaders = Tpetra__MultiVector__decl_8hpp.xml -XMLclass = classTpetra_1_1MultiVector.xml -template = Xpetra_TpetraMultiVector.hpp.tmpl -output = MultiVector/Xpetra_TpetraMultiVector.hpp - -[header] -skip = - -[function] -skip = replaceMap;operator=;subCopy;subCopy;subView;subView;subViewNonConst;subViewNonConst;offsetView;offsetViewNonConst;getLocalMV;getStride;isConstantStride;randomize;elementWiseMultiply -removeref = - -[inheritance] -parent = : public virtual MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > - -[member] -name = vec_ - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraRowMatrix.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraRowMatrix.hpp.conf deleted file mode 100644 index b02dde203498..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraRowMatrix.hpp.conf +++ /dev/null @@ -1,23 +0,0 @@ -[io] -XMLheaders = Tpetra__RowMatrix__decl_8hpp.xml -XMLclass = classTpetra_1_1RowMatrix.xml -template = Xpetra_TpetraRowMatrix.hpp.tmpl -output = RowMatrix/Xpetra_TpetraRowMatrix.hpp - -[header] -skip = Tpetra_Operator.hpp;KokkosCompat_DefaultNode.hpp - -[function] -skip = getGraph;getComm;getNode;getIndexBase;getNumEntriesInGlobalRow;hasColMap;getGlobalRowCopy;leftScale;rightScale;hasTransposeApply -removeref = getRowMap;getColMap;getDomainMap;getRangeMap;getComm - -[inheritance] -parent = : public RowMatrix - -[member] -name = mtx_ - -[type] -wrapped = - - diff --git a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraVector.hpp.conf b/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraVector.hpp.conf deleted file mode 100644 index fbf891fb6d66..000000000000 --- a/packages/xpetra/scripts/tpetra/conf/Xpetra_TpetraVector.hpp.conf +++ /dev/null @@ -1,22 +0,0 @@ -[io] -XMLheaders = Tpetra__Vector__decl_8hpp.xml -XMLclass = classTpetra_1_1Vector.xml -template = Xpetra_TpetraVector.hpp.tmpl -output = Vector/Xpetra_TpetraVector.hpp - -[header] -skip = Tpetra_MultiVector_decl.hpp - -[function] -skip = Vector;~Vector;putScalar;randomize;replaceMap;reduce;subCopy;subCopy;subView;subView;subViewNonConst;subViewNonConst;offsetView;offsetViewNonConst;getVector;getVectorNonConst;getData;getDataNonConst;get1dCopy;get2dCopy;get1dView;get2dView;get1dViewNonConst;get2dViewNonConst;getLocalMV;abs;reciprocal;scale;update;update;multiply;elementWiseMultiply;getNumVectors;getLocalLength;getGlobalLength;getStride;isConstantStride;dot;normWeighted;clone -removeref = - -[inheritance] -parent = : public virtual Vector, public TpetraMultiVector - -[member] -name = getTpetra_Vector() - -[type] -wrapped = const Map< LocalOrdinal, GlobalOrdinal, Node > &;LookupStatus;LocalGlobal;const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &;OptimizeOption;const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &;RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >;const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &;const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & - diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraCrsGraph.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraCrsGraph.hpp.tmpl deleted file mode 100644 index 327caada56f9..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraCrsGraph.hpp.tmpl +++ /dev/null @@ -1,133 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Xpetra_CrsGraph.hpp" - -#include "Tpetra_CrsGraph.hpp" - -#include "Xpetra_Utils.hpp" - -#include "Xpetra_TpetraMap.hpp" - -#include "Xpetra_TpetraImport.hpp" - -#include "Xpetra_TpetraExport.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - template - RCP< const CrsGraph > toXpetra(RCP< const Tpetra::CrsGraph > graph); - - template - RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> >& graph); - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro. - typedef TpetraCrsGraph TpetraCrsGraphClass; - typedef Map map_type; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! Implements DistObject interface - //{@ - - //! Access function for the Tpetra::Map this DistObject was constructed with. - const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("TpetraCrsGraph::getMap"); return rcp( new TpetraMap< LocalOrdinal, GlobalOrdinal, Node >(graph_->getMap()) ); } - - //! Import. - void doImport(const DistObject &source, - const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsGraph::doImport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsGraph > v = tSource.getTpetra_CrsGraph(); - //graph_->doImport(toTpetraCrsGraph(source), *tImporter.getTpetra_Import(), toTpetra(CM)); - - graph_->doImport(*v, toTpetra(importer), toTpetra(CM)); - } - - //! Export. - void doExport(const DistObject &dest, - const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsGraph::doExport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsGraph > v = tDest.getTpetra_CrsGraph(); - graph_->doExport(*v, toTpetra(importer), toTpetra(CM)); - - } - - //! Import (using an Exporter). - void doImport(const DistObject &source, - const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsGraph::doImport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsGraph > v = tSource.getTpetra_CrsGraph(); - - graph_->doImport(*v, toTpetra(exporter), toTpetra(CM)); - - } - - //! Export (using an Importer). - void doExport(const DistObject &dest, - const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsGraph::doExport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsGraph > v = tDest.getTpetra_CrsGraph(); - - graph_->doExport(*v, toTpetra(exporter), toTpetra(CM)); - - } - - // @} - - //! @name Xpetra specific - //@{ - - //! TpetraCrsGraph constructor to wrap a Tpetra::CrsGraph object - TpetraCrsGraph(const Teuchos::RCP > &graph) : graph_(graph) { } - - //! Get the underlying Tpetra graph - RCP< const Tpetra::CrsGraph > getTpetra_CrsGraph() const { return graph_; } - - //@} - - private: - - RCP< Tpetra::CrsGraph > graph_; - - }; // $TMPL_CLASS class - - // TODO: move that elsewhere - template - RCP > toXpetra(RCP > graph) { //TODO: return TpetraCrsGraph instead of CrsGraph - // typedef TpetraCrsGraph TpetraCrsGraphClass; - // XPETRA_RCP_DYNAMIC_CAST(const TpetraCrsGraphClass, graph, tGraph, "toTpetra"); - if (graph.is_null()) - return Teuchos::null; - - RCP > tGraph = Teuchos::rcp_const_cast >(graph); //TODO: can I avoid the const_cast ? - return rcp(new Xpetra::TpetraCrsGraph(tGraph)); - } - - template - RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node> > &graph) { - typedef TpetraCrsGraph TpetraCrsGraphClass; - XPETRA_RCP_DYNAMIC_CAST(const TpetraCrsGraphClass, graph, tpetraCrsGraph, "toTpetra"); - return tpetraCrsGraph->getTpetra_CrsGraph(); - } - // - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraCrsMatrix.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraCrsMatrix.hpp.tmpl deleted file mode 100644 index 04071c17d6ee..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraCrsMatrix.hpp.tmpl +++ /dev/null @@ -1,130 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Tpetra_CrsMatrix.hpp" - -#include "Xpetra_CrsMatrix.hpp" -#include "Xpetra_TpetraMap.hpp" -#include "Xpetra_TpetraMultiVector.hpp" -#include "Xpetra_TpetraVector.hpp" -#include "Xpetra_TpetraCrsGraph.hpp" -//#include "Xpetra_TpetraRowMatrix.hpp" -#include "Xpetra_Exceptions.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - // template - // const Tpetra::CrsMatrix toTpetraCrsMatrix(const Xpetra::DistObject &); - // - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro. - typedef TpetraCrsMatrix TpetraCrsMatrixClass; - typedef TpetraVector TpetraVectorClass; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! Deep copy constructor - $TMPL_CLASS(const $TMPL_CLASS& matrix) - : mtx_(matrix.mtx_->template clone(rcp(new Node()))) { } - - //! Get a copy of the diagonal entries owned by this node, with local row idices. - void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const { - XPETRA_MONITOR("TpetraCrsMatrix::getLocalDiagCopy"); - XPETRA_DYNAMIC_CAST(TpetraVectorClass, diag, tDiag, "Xpetra::TpetraCrsMatrix.getLocalDiagCopy() only accept Xpetra::TpetraVector as input arguments."); - mtx_->getLocalDiagCopy(*tDiag.getTpetra_Vector()); - // mtx_->getLocalDiagCopy(toTpetra(diag)); - } - - //! Implements DistObject interface - //{@ - - //! Access function for the Tpetra::Map this DistObject was constructed with. - const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("TpetraCrsMatrix::getMap"); return rcp( new TpetraMap< LocalOrdinal, GlobalOrdinal, Node >(mtx_->getMap()) ); } - - //! Import. - void doImport(const DistObject &source, - const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsMatrix::doImport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, source, tSource, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsMatrix > v = tSource.getTpetra_CrsMatrix(); - //mtx_->doImport(toTpetraCrsMatrix(source), *tImporter.getTpetra_Import(), toTpetra(CM)); - mtx_->doImport(*v, toTpetra(importer), toTpetra(CM)); - } - - //! Export. - void doExport(const DistObject &dest, - const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsMatrix::doExport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, dest, tDest, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsMatrix > v = tDest.getTpetra_CrsMatrix(); - mtx_->doExport(*v, toTpetra(importer), toTpetra(CM)); - - } - - //! Import (using an Exporter). - void doImport(const DistObject &source, - const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsMatrix::doImport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, source, tSource, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsMatrix > v = tSource.getTpetra_CrsMatrix(); - mtx_->doImport(*v, toTpetra(exporter), toTpetra(CM)); - - } - - //! Export (using an Importer). - void doExport(const DistObject &dest, - const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { - XPETRA_MONITOR("TpetraCrsMatrix::doExport"); - - XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, dest, tDest, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra() - RCP< const Tpetra::CrsMatrix > v = tDest.getTpetra_CrsMatrix(); - mtx_->doExport(*v, toTpetra(exporter), toTpetra(CM)); - - } - - // @} - - //! @name Xpetra specific - //@{ - - //! TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object - TpetraCrsMatrix(const Teuchos::RCP > &mtx) : mtx_(mtx) { } - - //! Get the underlying Tpetra matrix - RCP > getTpetra_CrsMatrix() const { return mtx_; } - - //! Get the underlying Tpetra matrix - RCP > getTpetra_CrsMatrixNonConst() const { return mtx_; } //TODO: remove - - //@} - - private: - - RCP< Tpetra::CrsMatrix > mtx_; - - }; // $TMPL_CLASS class - - // TODO: move that elsewhere - // template - // const Tpetra::DistObject toTpetraCrsMatrix(const DistObject &mtx) { - // typedef TpetraCrsMatrix TpetraCrsMatrixClass; - // XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, mtx, tMtx, "toTpetra"); - // return *tMtx.getTpetra_CrsMatrix(); - // } - // - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraExport.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraExport.hpp.tmpl deleted file mode 100644 index c520b9a9972e..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraExport.hpp.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Xpetra_Export.hpp" -#include "Xpetra_Exceptions.hpp" - -#include "Xpetra_TpetraMap.hpp" -#include "Tpetra_Export.hpp" - -// Note: 'export' is a reserved keyword in C++. Do not use 'export' as a variable name. - -namespace Xpetra { - - // TODO: move that elsewhere - template - const Tpetra::Export & toTpetra(const Export &); - template -] - RCP > toXpetra(const RCP >& exp); - - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - - //! The specialization of Map used by this class. - typedef Map map_type; - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! TpetraExport constructor to wrap a Tpetra::Export object - TpetraExport(const RCP > &exp) : export_(exp) { } - - RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const { return export_; } - - //@} - - private: - - RCP > export_; - - }; // $TMPL_CLASS class - - // TODO: move that elsewhere - template - const Tpetra::Export & toTpetra(const Export &exp) { - // TODO: throw exception - const TpetraExport & tpetraExport = dynamic_cast &>(exp); - return *tpetraExport.getTpetra_Export(); - } - - template - RCP > toXpetra(const RCP >& exp) { - if (!exp.is_null()) - return rcp(new TpetraExport(exp)); - - return Teuchos::null; - } - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraImport.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraImport.hpp.tmpl deleted file mode 100644 index e5293b71b2b9..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraImport.hpp.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Xpetra_Import.hpp" -#include "Xpetra_Exceptions.hpp" - -#include "Xpetra_TpetraMap.hpp" -#include "Tpetra_Import.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - template - const Tpetra::Import & toTpetra(const Import &); - - template - RCP > toXpetra(const RCP > &import); - // - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - - //! The specialization of Map used by this class. - typedef Map map_type; - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! TpetraImport constructor to wrap a Tpetra::Import object - TpetraImport(const RCP > &import) : import_(import) { } - - RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Import() const { return import_; } - - //@} - - private: - - RCP > import_; - - }; // $TMPL_CLASS class - - // TODO: move that elsewhere - template - const Tpetra::Import & toTpetra(const Import &import) { - // TODO: throw exception - const TpetraImport & tpetraImport = dynamic_cast &>(import); - return *tpetraImport.getTpetra_Import(); - } - - template - RCP > toXpetra(const RCP< const Tpetra::Import >& import) { - if (!import.is_null()) - return rcp(new TpetraImport(import)); - - return Teuchos::null; - } - - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraMap.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraMap.hpp.tmpl deleted file mode 100644 index 881900fa1030..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraMap.hpp.tmpl +++ /dev/null @@ -1,123 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include - -#include "Xpetra_Map.hpp" -#include "Xpetra_Utils.hpp" - -#include "Xpetra_Exceptions.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - template - const Tpetra::Map & toTpetra(const Xpetra::Map &); - - template - const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & toTpetra(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &); - - template - const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > toXpetra(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &); - // - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! TpetraMap constructor to wrap a Tpetra::Map object - TpetraMap(const Teuchos::RCP > &map) - : map_(map) { } - - //! Get the library used by this object (Tpetra or Epetra?) - UnderlyingLib lib() const { return Xpetra::UseTpetra; } - - //! Get the underlying Tpetra map - const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getTpetra_Map() const { return map_; } - - //@} - - protected: - - RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_; - - }; // $TMPL_CLASS class - - // TODO: move that elsewhere - template - const Tpetra::Map & toTpetra(const Map &map) { - // TODO: throw exception - const TpetraMap & tpetraMap = dynamic_cast &>(map); - return *tpetraMap.getTpetra_Map(); - } - - template - const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & toTpetra(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map) { - typedef TpetraMap TpetraMapClass; - XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map, tpetraMap, "toTpetra"); - return tpetraMap->getTpetra_Map(); - } - - template - const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > toXpetra(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map) { - return rcp( new TpetraMap(map)); - } - // - - // TODO: removed (but currently used in unit test) - namespace useTpetra { - - //! Non-member function to create a locally replicated Map with a specified node. - template - Teuchos::RCP< const TpetraMap > - createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node) { - XPETRA_MONITOR("useTpetra::createLocalMapWithNode"); - - return rcp(new TpetraMap(Tpetra::createLocalMapWithNode(numElements, comm, node))); - } - - //! Non-member function to create a (potentially) non-uniform, contiguous Map with the default node. - template - Teuchos::RCP< const TpetraMap > - createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm) { - XPETRA_MONITOR("useTpetra::createContigMap"); - - return rcp(new TpetraMap(Tpetra::createContigMap(numElements, localNumElements, comm))); - } - - //! Non-member function to create a (potentially) non-uniform, contiguous Map with a user-specified node. - template - Teuchos::RCP< const TpetraMap > - createContigMapWithNode(global_size_t numElements, size_t localNumElements, - const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > & /* node */ = Teuchos::null) { - XPETRA_MONITOR("useTpetra::createContigMap"); - return rcp(new TpetraMap(Tpetra::createContigMapWithNode(numElements, localNumElements, comm))); - } - } // useTpetra namespace - -} // Xpetra namespace - -// TODO: remove? -//! Returns true if \c map is identical to this map. Implemented in TpetraMap::isSameAs(). -template -bool operator== (const Xpetra::TpetraMap &map1, const Xpetra::TpetraMap &map2) { - XPETRA_MONITOR("TpetraMap==TpetraMap"); - return map1.isSameAs(map2); -} - -//! Returns true if \c map is not identical to this map. Implemented in TpetraMap::isSameAs(). -template -bool operator!= (const Xpetra::TpetraMap &map1, const Xpetra::TpetraMap &map2) { - XPETRA_MONITOR("TpetraMap!=TpetraMap"); - return !map1.isSameAs(map2); -} - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraMultiVector.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraMultiVector.hpp.tmpl deleted file mode 100644 index bc32f856b327..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraMultiVector.hpp.tmpl +++ /dev/null @@ -1,154 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Xpetra_MultiVector.hpp" - -#include "Xpetra_TpetraMap.hpp" //TMP -#include "Xpetra_Utils.hpp" -#include "Xpetra_TpetraImport.hpp" -#include "Xpetra_TpetraExport.hpp" - -#include "Tpetra_MultiVector.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - template - const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node> & toTpetra(const MultiVector< Scalar,LocalOrdinal, GlobalOrdinal, Node> &); - - template - Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node> & toTpetra(MultiVector< Scalar,LocalOrdinal, GlobalOrdinal, Node> &); - // - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // forward declaration of TpetraVector, needed to prevent circular inclusions - template class TpetraVector; -#endif - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro. - typedef TpetraMultiVector TpetraMultiVectorClass; - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! Element-wise multiply of a Vector A with a TpetraMultiVector B. - void elementWiseMultiply(Scalar scalarAB, const Vector &A, const MultiVector &B, Scalar scalarThis); // definition at the end of this file - //TODO: void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis){ vec_->elementWiseMultiply(scalarAB, toTpetra(A), toTpetra(B), scalarThis); } - - //! Set multi-vector values to random numbers. - void randomize(bool bUseXpetraImplementation = false) { - XPETRA_MONITOR("TpetraMultiVector::randomize"); - - if(bUseXpetraImplementation) - Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Xpetra_randomize(); - else - vec_->randomize(); - } - - //{@ - // Implements DistObject interface - - const Teuchos::RCP< const Map > getMap() const { XPETRA_MONITOR("TpetraMultiVector::getMap"); return toXpetra(vec_->getMap()); } - - void doImport(const DistObject< Scalar, LocalOrdinal,GlobalOrdinal,Node> &source, const Import &importer, CombineMode CM) { - XPETRA_MONITOR("TpetraMultiVector::doImport"); - - XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); //TODO: remove and use toTpetra() - RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal,Node> > v = tSource.getTpetra_MultiVector(); - this->getTpetra_MultiVector()->doImport(*v, toTpetra(importer), toTpetra(CM)); - } - - void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import& importer, CombineMode CM) { - XPETRA_MONITOR("TpetraMultiVector::doExport"); - - XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); //TODO: remove and use toTpetra() - RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal,Node> > v = tDest.getTpetra_MultiVector(); - this->getTpetra_MultiVector()->doExport(*v, toTpetra(importer), toTpetra(CM)); - - } - - void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export& exporter, CombineMode CM) { - XPETRA_MONITOR("TpetraMultiVector::doImport"); - - XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); //TODO: remove and use toTpetra() - RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal,Node> > v = tSource.getTpetra_MultiVector(); - this->getTpetra_MultiVector()->doImport(*v, toTpetra(exporter), toTpetra(CM)); - - } - - void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export& exporter, CombineMode CM) { - XPETRA_MONITOR("TpetraMultiVector::doExport"); - - XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); //TODO: remove and use toTpetra() - RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal,Node> > v = tDest.getTpetra_MultiVector(); - this->getTpetra_MultiVector()->doExport(*v, toTpetra(exporter), toTpetra(CM)); - - } - - //@} - - //! @name Xpetra specific - //@{ - - //! TpetraMultiVector constructor to wrap a Tpetra::MultiVector object - TpetraMultiVector(const Teuchos::RCP > &vec) : vec_(vec) { } //TODO removed const - - //! Get the underlying Tpetra multivector - RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_MultiVector() const { return vec_; } - - //! Set seed for Random function. - void setSeed(unsigned int seed) { XPETRA_MONITOR("TpetraMultiVector::seedrandom"); Teuchos::ScalarTraits< Scalar >::seedrandom(seed); } - - //@} - - private: - - RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node> > vec_; - - }; // $TMPL_CLASS class - - // TODO: move that elsewhere - template - const Tpetra::MultiVector< Scalar,LocalOrdinal, GlobalOrdinal, Node> & toTpetra(const MultiVector< Scalar,LocalOrdinal, GlobalOrdinal, Node> &x) { - typedef TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass; - XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, x, tX, "toTpetra"); - return *tX.getTpetra_MultiVector(); - } - - template - Tpetra::MultiVector< Scalar,LocalOrdinal, GlobalOrdinal, Node> & toTpetra(MultiVector< Scalar,LocalOrdinal, GlobalOrdinal, Node> &x) { - typedef TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass; - XPETRA_DYNAMIC_CAST( TpetraMultiVectorClass, x, tX, "toTpetra"); - return *tX.getTpetra_MultiVector(); - } - // -} // Xpetra namespace - -// Following header file inculsion is needed for the dynamic_cast to TpetraVector in elementWiseMultiply (because we cannot dynamic_cast if target is not a complete type) -// It is included here to avoid circular dependency between Vector and MultiVector -// TODO: there is certainly a more elegant solution... -#include "Xpetra_TpetraVector.hpp" - -namespace Xpetra { - template - void TpetraMultiVector::elementWiseMultiply(Scalar scalarAB, const Vector &A, const MultiVector &B, Scalar scalarThis) { - XPETRA_MONITOR("TpetraMultiVector::elementWiseMultiply"); - - // XPETRA_DYNAMIC_CAST won't take TpetraVector - // as an argument, hence the following typedef. - typedef TpetraVector tpv; - XPETRA_DYNAMIC_CAST(const tpv, A, tA, "Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments."); - XPETRA_DYNAMIC_CAST(const TpetraMultiVector, B, tB, "Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments."); - vec_->elementWiseMultiply(scalarAB, *tA.getTpetra_Vector(), *tB.getTpetra_MultiVector(), scalarThis); - } - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraRowMatrix.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraRowMatrix.hpp.tmpl deleted file mode 100644 index 31868d5413e7..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraRowMatrix.hpp.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -$TMPL_HEADERS - -// WARNING: This code is experimental. Backwards compatibility should not be expected. - -$TMPL_INCLUDES - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Tpetra_RowMatrix.hpp" - -#include "Xpetra_RowMatrix.hpp" -#include "Xpetra_Exceptions.hpp" - -namespace Xpetra { - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { - - public: - -$TMPL_PUBLIC_FUNCTIONS - - //! @name Xpetra specific - //@{ - - //! TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object - TpetraRowMatrix(const Teuchos::RCP > &mtx) : mtx_(mtx) { } - - //! Get the underlying Tpetra matrix - RCP > getTpetra_RowMatrix() const { return mtx_; } - - //! Get the underlying Tpetra matrix - RCP > getTpetra_RowMatrixNonConst() const { return mtx_; } //TODO: remove - - //@} - - private: - - RCP< Tpetra::RowMatrix > mtx_; - - }; // $TMPL_CLASS class - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraVector.hpp.tmpl b/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraVector.hpp.tmpl deleted file mode 100644 index 703187f7d9a8..000000000000 --- a/packages/xpetra/scripts/tpetra/tmpl/Xpetra_TpetraVector.hpp.tmpl +++ /dev/null @@ -1,121 +0,0 @@ -$TMPL_HEADERS - -#include "Xpetra_TpetraConfigDefs.hpp" - -#include "Xpetra_Vector.hpp" -#include "Xpetra_MultiVector.hpp" -#include "Xpetra_TpetraMultiVector.hpp" - -#include "Xpetra_TpetraMap.hpp" //TMP -#include "Xpetra_Utils.hpp" -#include "Xpetra_TpetraImport.hpp" -#include "Xpetra_TpetraExport.hpp" - -#include "Tpetra_Vector.hpp" - -namespace Xpetra { - - // TODO: move that elsewhere - template - RCP > toTpetra(Vector &); - - template - RCP > toTpetra(const Vector &); - - template - RCP > toXpetra(RCP > vec); - - template - RCP > toXpetra(RCP > vec); - - - $TMPL_TEMPLATE_PARAM - class $TMPL_CLASS - $TMPL_INHERITANCE - { -#undef XPETRA_TPETRAMULTIVECTOR_SHORT -#include "Xpetra_UseShortNames.hpp" - - public: - - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normWeighted; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::meanValue; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceGlobalValue; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoGlobalValue; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceLocalValue; // overloading, not hiding - using TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoLocalValue; // overloading, not hiding - - //! @name Constructor/Destructor Methods - //@{ - - //! Sets all vector entries to zero. - TpetraVector(const Teuchos::RCP &map, bool zeroOut=true) - : TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >(map,1,zeroOut) { } - - //! Set multi-vector values from an array using Teuchos memory management classes. (copy) - TpetraVector(const Teuchos::RCP< const Map> &map, const Teuchos::ArrayView< const Scalar > &A) - : TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >(map,A,map->getLocalNumElements(),1) { } - - //! Destructor. - virtual ~TpetraVector() { } - - //@} - -$TMPL_PUBLIC_FUNCTIONS - - //! Computes dot product of this Vector against input Vector x. - Scalar dot(const Vector &a) const { XPETRA_MONITOR("TpetraVector::dot"); return getTpetra_Vector()->dot(*toTpetra(a)); } - - //! Compute Weighted 2-norm (RMS Norm) of this Vector. - typename Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector &weights) const { XPETRA_MONITOR("TpetraVector::normWeighted"); return getTpetra_Vector()->normWeighted(*toTpetra(weights)); } - - - //! @name Xpetra specific - //@{ - - //! TpetraMultiVector constructor to wrap a Tpetra::MultiVector object - TpetraVector(const Teuchos::RCP > &vec) : TpetraMultiVector(vec) { } - - //! Get the underlying Tpetra multivector - RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_Vector() const { return this->TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getTpetra_MultiVector()->getVectorNonConst(0); } - - //@} - - }; // TpetraVector class - - // TODO: move that elsewhere - template - RCP > toTpetra(Vector< Scalar,LocalOrdinal, GlobalOrdinal, Node> &x) { - typedef TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraVectorClass; - XPETRA_DYNAMIC_CAST( TpetraVectorClass, x, tX, "toTpetra"); - return tX.getTpetra_Vector(); - } - - template - RCP > toTpetra(const Vector< Scalar,LocalOrdinal, GlobalOrdinal, Node> &x) { - typedef TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraVectorClass; - XPETRA_DYNAMIC_CAST(const TpetraVectorClass, x, tX, "toTpetra"); - return tX.getTpetra_Vector(); - } - - template - RCP > toXpetra(RCP > vec) { - if (!vec.is_null()) - return rcp(new TpetraVector(vec)); - - return Teuchos::null; - } - - template - RCP > toXpetra(RCP > vec) { - // We cast away the const to wrap the Tpetra vector into an Xpetra object. But it's OK because the Xpetra vector is returned as const. - return toXpetra(Teuchos::rcp_const_cast > (vec)); - } - -} // Xpetra namespace - -$TMPL_FOOTERS diff --git a/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp b/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp index ab9686b4399e..e05de1d69760 100644 --- a/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp +++ b/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp @@ -60,19 +60,27 @@ #include +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated." +#endif + namespace Xpetra { // TODO: move that elsewhere template -RCP> +XPETRA_DEPRECATED RCP> toXpetra(const Epetra_CrsGraph &graph); template -const Epetra_CrsGraph & +XPETRA_DEPRECATED const Epetra_CrsGraph & toEpetra(const RCP> &graph); template -class EpetraCrsGraphT +class XPETRA_DEPRECATED EpetraCrsGraphT : public CrsGraph { typedef int LocalOrdinal; diff --git a/packages/xpetra/src/CrsMatrix/Xpetra_EpetraCrsMatrix.hpp b/packages/xpetra/src/CrsMatrix/Xpetra_EpetraCrsMatrix.hpp index 066f4d6edf98..97330059d8e5 100644 --- a/packages/xpetra/src/CrsMatrix/Xpetra_EpetraCrsMatrix.hpp +++ b/packages/xpetra/src/CrsMatrix/Xpetra_EpetraCrsMatrix.hpp @@ -69,11 +69,19 @@ #include "Xpetra_Utils.hpp" #include "Xpetra_Exceptions.hpp" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/CrsMatrix/Xpetra_EpetraCrsMatrix.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/CrsMatrix/Xpetra_EpetraCrsMatrix.hpp is deprecated." +#endif + namespace Xpetra { // general implementation: empty stub template -class EpetraCrsMatrixT +class XPETRA_DEPRECATED EpetraCrsMatrixT : public CrsMatrix { typedef EpetraGlobalOrdinal GlobalOrdinal; typedef typename CrsMatrix::scalar_type Scalar; diff --git a/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp b/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp index ed1e8e5ad087..95d27903c127 100644 --- a/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp +++ b/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp @@ -54,18 +54,26 @@ #include "Epetra_Export.h" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp is deprecated." +#endif + // Note: 'export' is a reserved keyword in C++. Do not use 'export' as a variable name. namespace Xpetra { // TODO: move that elsewhere template -const Epetra_Export &toEpetra(const Export &); +XPETRA_DEPRECATED const Epetra_Export &toEpetra(const Export &); template -RCP > toXpetra(const Epetra_Export *exp); +XPETRA_DEPRECATED RCP > toXpetra(const Epetra_Export *exp); template -class EpetraExportT +class XPETRA_DEPRECATED EpetraExportT : public Export { typedef int LocalOrdinal; typedef EpetraGlobalOrdinal GlobalOrdinal; diff --git a/packages/xpetra/src/Import/Xpetra_EpetraImport.hpp b/packages/xpetra/src/Import/Xpetra_EpetraImport.hpp index d8f56201300c..9d82d9c265c4 100644 --- a/packages/xpetra/src/Import/Xpetra_EpetraImport.hpp +++ b/packages/xpetra/src/Import/Xpetra_EpetraImport.hpp @@ -56,14 +56,22 @@ #include "Epetra_Import.h" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/Import/Xpetra_EpetraImport.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/Import/Xpetra_EpetraImport.hpp is deprecated." +#endif + namespace Xpetra { template -RCP > toXpetra(const Epetra_Import *import); +XPETRA_DEPRECATED RCP > toXpetra(const Epetra_Import *import); // template -class EpetraImportT +class XPETRA_DEPRECATED EpetraImportT : public Import { typedef int LocalOrdinal; typedef EpetraGlobalOrdinal GlobalOrdinal; diff --git a/packages/xpetra/src/Map/Xpetra_EpetraMap.hpp b/packages/xpetra/src/Map/Xpetra_EpetraMap.hpp index 97900d75a685..7e9cd577095e 100644 --- a/packages/xpetra/src/Map/Xpetra_EpetraMap.hpp +++ b/packages/xpetra/src/Map/Xpetra_EpetraMap.hpp @@ -59,24 +59,32 @@ #include "Xpetra_ConfigDefs.hpp" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/Map/Xpetra_EpetraMap.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/Map/Xpetra_EpetraMap.hpp is deprecated." +#endif + namespace Xpetra { // TODO: move that elsewhere template -const Epetra_Map &toEpetra(const Map &); +XPETRA_DEPRECATED const Epetra_Map &toEpetra(const Map &); template -const Epetra_Map &toEpetra(const RCP > &); +XPETRA_DEPRECATED const Epetra_Map &toEpetra(const RCP > &); // template // const RCP< const Map > toXpetra(const RCP< const Epetra_Map > &); template -const RCP > toXpetra(const Epetra_BlockMap &); +XPETRA_DEPRECATED const RCP > toXpetra(const Epetra_BlockMap &); // stub implementation for EpetraMapT template -class EpetraMapT +class XPETRA_DEPRECATED EpetraMapT : public virtual Map { typedef int LocalOrdinal; diff --git a/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp b/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp index 8a4f06a169b2..50bbad2d2b69 100644 --- a/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp +++ b/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp @@ -56,19 +56,27 @@ #include "Xpetra_EpetraMultiVector.hpp" #include "Epetra_IntMultiVector.h" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp is deprecated." +#endif + namespace Xpetra { // TODO: move that elsewhere template -Epetra_IntMultiVector &toEpetra(MultiVector &); +XPETRA_DEPRECATED Epetra_IntMultiVector &toEpetra(MultiVector &); template -const Epetra_IntMultiVector &toEpetra(const MultiVector &); +XPETRA_DEPRECATED const Epetra_IntMultiVector &toEpetra(const MultiVector &); // // stub implementation for EpetraIntMultiVectorT template -class EpetraIntMultiVectorT +class XPETRA_DEPRECATED EpetraIntMultiVectorT : public MultiVector { typedef int Scalar; typedef int LocalOrdinal; diff --git a/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp b/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp index 204de0e44173..3f7bcff43fe7 100644 --- a/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp +++ b/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp @@ -67,15 +67,23 @@ #include #include +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp is deprecated." +#endif + namespace Xpetra { // TODO: move that elsewhere template -const Epetra_MultiVector &toEpetra(const MultiVector &); +XPETRA_DEPRECATED const Epetra_MultiVector &toEpetra(const MultiVector &); template -Epetra_MultiVector &toEpetra(MultiVector &); +XPETRA_DEPRECATED Epetra_MultiVector &toEpetra(MultiVector &); template -RCP > toXpetra(RCP vec); +XPETRA_DEPRECATED RCP > toXpetra(RCP vec); // we need this forward declaration #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -84,7 +92,7 @@ class EpetraVectorT; #endif template -class EpetraMultiVectorT +class XPETRA_DEPRECATED EpetraMultiVectorT : public virtual MultiVector { typedef double Scalar; typedef int LocalOrdinal; diff --git a/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp b/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp index 165d3806a1a3..c0f2dfdd51ea 100644 --- a/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp +++ b/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp @@ -59,10 +59,18 @@ #include "Xpetra_Utils.hpp" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp is deprecated." +#endif + namespace Xpetra { template -class EpetraOperator : public Operator { +class XPETRA_DEPRECATED EpetraOperator : public Operator { typedef double Scalar; typedef int LocalOrdinal; typedef EpetraGlobalOrdinal GlobalOrdinal; diff --git a/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp b/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp index 2981c297dfb9..5fd812f1fc8b 100644 --- a/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp +++ b/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp @@ -57,19 +57,27 @@ #include "Xpetra_EpetraMultiVector.hpp" #include "Epetra_IntVector.h" +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp is deprecated." +#endif + namespace Xpetra { // TODO: move that elsewhere template -Epetra_IntVector &toEpetra(Vector &); +XPETRA_DEPRECATED Epetra_IntVector &toEpetra(Vector &); template -const Epetra_IntVector &toEpetra(const Vector &); +const XPETRA_DEPRECATED Epetra_IntVector &toEpetra(const Vector &); // // stub implementation for EpetraIntVectorT template -class EpetraIntVectorT +class XPETRA_DEPRECATED EpetraIntVectorT : public Vector { typedef int Scalar; typedef int LocalOrdinal; diff --git a/packages/xpetra/src/Vector/Xpetra_EpetraVector.hpp b/packages/xpetra/src/Vector/Xpetra_EpetraVector.hpp index 715927aed168..d66c5ac67ed9 100644 --- a/packages/xpetra/src/Vector/Xpetra_EpetraVector.hpp +++ b/packages/xpetra/src/Vector/Xpetra_EpetraVector.hpp @@ -60,18 +60,26 @@ #include +#if defined(XPETRA_ENABLE_DEPRECATED_CODE) +#ifdef __GNUC__ +#warning "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraVector.hpp is deprecated." +#endif +#else +#error "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraVector.hpp is deprecated." +#endif + namespace Xpetra { // TODO: move that elsewhere template -Epetra_Vector &toEpetra(Vector &); +XPETRA_DEPRECATED Epetra_Vector &toEpetra(Vector &); template -const Epetra_Vector &toEpetra(const Vector &); +XPETRA_DEPRECATED const Epetra_Vector &toEpetra(const Vector &); // template -class EpetraVectorT +class XPETRA_DEPRECATED EpetraVectorT : public virtual Vector, public EpetraMultiVectorT { typedef double Scalar;