diff --git a/packages/muelu/src/Misc/MueLu_CoordinatesTransferFactory_kokkos_def.hpp b/packages/muelu/src/Misc/MueLu_CoordinatesTransferFactory_kokkos_def.hpp index 44cd29fa0ef8..03369f09ec18 100644 --- a/packages/muelu/src/Misc/MueLu_CoordinatesTransferFactory_kokkos_def.hpp +++ b/packages/muelu/src/Misc/MueLu_CoordinatesTransferFactory_kokkos_def.hpp @@ -70,6 +70,9 @@ namespace MueLu { validParamList->set< RCP >("CoarseMap", Teuchos::null, "Generating factory of the coarse map"); validParamList->set< int > ("write start", -1, "First level at which coordinates should be written to file"); validParamList->set< int > ("write end", -1, "Last level at which coordinates should be written to file"); + validParamList->set< bool > ("structured aggregation", false, "Flag specifying that the geometric data is transferred for StructuredAggregationFactory"); + validParamList->set > ("lCoarseNodesPerDim", Teuchos::null, "Factory providing the local number of nodes per spatial dimensions of the mesh"); + validParamList->set > ("numDimensions", Teuchos::null, "Factory providing the number of spatial dimensions of the mesh"); return validParamList; } @@ -78,13 +81,19 @@ namespace MueLu { void CoordinatesTransferFactory_kokkos>::DeclareInput(Level& fineLevel, Level& coarseLevel) const { static bool isAvailableCoords = false; - if (coarseLevel.GetRequestMode() == Level::REQUEST) - isAvailableCoords = coarseLevel.IsAvailable("Coordinates", this); + const ParameterList& pL = GetParameterList(); + if(pL.get("structured aggregation") == true) { + Input(fineLevel, "lCoarseNodesPerDim"); + Input(fineLevel, "numDimensions"); + } else { + if (coarseLevel.GetRequestMode() == Level::REQUEST) + isAvailableCoords = coarseLevel.IsAvailable("Coordinates", this); - if (isAvailableCoords == false) { - Input(fineLevel, "Coordinates"); - Input(fineLevel, "Aggregates"); - Input(fineLevel, "CoarseMap"); + if (isAvailableCoords == false) { + Input(fineLevel, "Coordinates"); + Input(fineLevel, "Aggregates"); + Input(fineLevel, "CoarseMap"); + } } } @@ -101,6 +110,17 @@ namespace MueLu { return; } + + const ParameterList& pL = GetParameterList(); + if(pL.get("structured aggregation") == true) { + Array lCoarseNodesPerDir = Get >(fineLevel, "lCoarseNodesPerDim"); + Set >(coarseLevel, "lNodesPerDim", lCoarseNodesPerDir); + int numDimensions = Get(fineLevel, "numDimensions"); + Set(coarseLevel, "numDimensions", numDimensions); + + return; + } + auto aggregates = Get >(fineLevel, "Aggregates"); auto fineCoords = Get >(fineLevel, "Coordinates"); auto coarseMap = Get > (fineLevel, "CoarseMap"); @@ -184,7 +204,6 @@ namespace MueLu { Set >(coarseLevel, "Coordinates", coarseCoords); - const ParameterList& pL = GetParameterList(); int writeStart = pL.get("write start"), writeEnd = pL.get("write end"); if (writeStart == 0 && fineLevel.GetLevelID() == 0 && writeStart <= writeEnd) { std::string fileName = "coordinates_before_rebalance_level_" + toString(fineLevel.GetLevelID()) + ".m"; diff --git a/packages/muelu/test/structured/CMakeLists.txt b/packages/muelu/test/structured/CMakeLists.txt index afe47367c407..52038dabf20c 100644 --- a/packages/muelu/test/structured/CMakeLists.txt +++ b/packages/muelu/test/structured/CMakeLists.txt @@ -40,8 +40,24 @@ IF (${PACKAGE_NAME}_ENABLE_Belos AND ${PACKAGE_NAME}_ENABLE_Amesos2) IF (${PACKAGE_NAME}_ENABLE_Kokkos_Refactor) TRIBITS_ADD_TEST( Structured - NAME "Structured_Laplace2D_kokkos" - ARGS "--linAlgebra=Tpetra --xml=structured_1dof_kokkos.xml --matrixType=Laplace2D --nx=25 --ny=25 --nz=25" + NAME "Structured_Interp_Laplace2D_kokkos" + ARGS "--linAlgebra=Tpetra --xml=structured_interp_kokkos.xml --matrixType=Laplace2D --nx=25 --ny=25" + COMM serial mpi + NUM_MPI_PROCS 4 + ) + + TRIBITS_ADD_TEST( + Structured + NAME "Structured_Interp_SA_Laplace2D_kokkos" + ARGS "--linAlgebra=Tpetra --xml=structured_interp_sa_kokkos.xml --matrixType=Laplace2D --nx=25 --ny=25" + COMM serial mpi + NUM_MPI_PROCS 4 + ) + + TRIBITS_ADD_TEST( + Structured + NAME "Structured_Tentative_Laplace2D_kokkos" + ARGS "--linAlgebra=Tpetra --xml=structured_tentative_kokkos.xml --matrixType=Laplace2D --nx=25 --ny=25" COMM serial mpi NUM_MPI_PROCS 4 ) @@ -69,7 +85,7 @@ IF (${PACKAGE_NAME}_ENABLE_Belos AND ${PACKAGE_NAME}_ENABLE_Amesos2) TRIBITS_COPY_FILES_TO_BINARY_DIR(Structured_cp - SOURCE_FILES structured_1dof.xml structured_2dof.xml structured_3dof.xml structured_1dof_kokkos.xml + SOURCE_FILES structured_1dof.xml structured_2dof.xml structured_3dof.xml structured_interp_kokkos.xml structured_interp_sa_kokkos.xml structured_tentative_kokkos.xml ) diff --git a/packages/muelu/test/structured/structured_interp_kokkos.xml b/packages/muelu/test/structured/structured_interp_kokkos.xml new file mode 100644 index 000000000000..a9b855e5f673 --- /dev/null +++ b/packages/muelu/test/structured/structured_interp_kokkos.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/muelu/test/structured/structured_interp_sa_kokkos.xml b/packages/muelu/test/structured/structured_interp_sa_kokkos.xml new file mode 100644 index 000000000000..c44fcfecce01 --- /dev/null +++ b/packages/muelu/test/structured/structured_interp_sa_kokkos.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/muelu/test/structured/structured_tentative_kokkos.xml b/packages/muelu/test/structured/structured_tentative_kokkos.xml new file mode 100644 index 000000000000..ee9bad861ec1 --- /dev/null +++ b/packages/muelu/test/structured/structured_tentative_kokkos.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +