diff --git a/packages/muelu/doc/UsersGuide/masterList.xml b/packages/muelu/doc/UsersGuide/masterList.xml index 48fbba6e50a1..cd1ba275f8f5 100644 --- a/packages/muelu/doc/UsersGuide/masterList.xml +++ b/packages/muelu/doc/UsersGuide/masterList.xml @@ -781,6 +781,24 @@ eigen-analysis: iterations + + gmg: interpolation order + int + 1 + Interpolation order used to interpolate values from coarse points to fine points. Possible values are 0 for piece-wise constant interpolation and 1 for piece-wise linear interpolation. This parameter is set to 1 by default. + + parameter not existing in ML + + + + gmg: build coarse coordinates + bool + true + If false, skip the calculation of coarse coordinates. + false + not supported by ML + + transfer: params \parameterlist @@ -797,7 +815,6 @@ false - pcoarsen: schedule string diff --git a/packages/muelu/doc/UsersGuide/paramlist_hidden.tex b/packages/muelu/doc/UsersGuide/paramlist_hidden.tex index e18f02201a1c..d9d3a4f770b9 100644 --- a/packages/muelu/doc/UsersGuide/paramlist_hidden.tex +++ b/packages/muelu/doc/UsersGuide/paramlist_hidden.tex @@ -154,6 +154,10 @@ \cbb{sa: eigenvalue estimate num iterations}{int}{10}{Number of power iterations to use to estimate max eigenvalue. This has effect only if estimation occurs during prolongator smoothing.} +\cbb{gmg: interpolation order}{int}{1}{Interpolation order used to interpolate values from coarse points to fine points. Possible values are 0 for piece-wise constant interpolation and 1 for piece-wise linear interpolation. This parameter is set to 1 by default.} + +\cbb{gmg: build coarse coordinates}{bool}{true}{If false, skip the calculation of coarse coordinates.} + \cba{transfer: params}{\parameterlist}{Sublist of options for use by transfer.} \cbb{pcoarsen: element}{string}{""}{Element class for IntrepidPCoarsening} diff --git a/packages/muelu/src/CMakeLists.txt b/packages/muelu/src/CMakeLists.txt index c627c046cd56..f35738136d96 100644 --- a/packages/muelu/src/CMakeLists.txt +++ b/packages/muelu/src/CMakeLists.txt @@ -472,3 +472,4 @@ TRIBITS_ADD_LIBRARY( # touch CMakeLists.txt because a new file was created in Utils/ExplicitInstantiation of Utils/ForwardDeclaration # touch CMakeLists.txt because a new file was created in Utils/ExplicitInstantiation of Utils/ForwardDeclaration # touch CMakeLists.txt because a new file was created in Utils/ExplicitInstantiation of Utils/ForwardDeclaration +# touch CMakeLists.txt because a new file was created in Utils/ExplicitInstantiation of Utils/ForwardDeclaration diff --git a/packages/muelu/src/Graph/MueLu_Aggregates_decl.hpp b/packages/muelu/src/Graph/MueLu_Aggregates_decl.hpp index f125e82d3ba2..6fd5f4ceeec3 100644 --- a/packages/muelu/src/Graph/MueLu_Aggregates_decl.hpp +++ b/packages/muelu/src/Graph/MueLu_Aggregates_decl.hpp @@ -136,7 +136,7 @@ namespace MueLu { This has to be done by the aggregation factory. */ - RCP & GetIndexManager() { return geoData_; } + RCP& GetIndexManager() { return geoData_; } /*! @brief Get the index manager used by structured aggregation algorithms. diff --git a/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_decl.hpp b/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_decl.hpp index 46f6b1e17c4c..b17d01ae2173 100644 --- a/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_decl.hpp +++ b/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_decl.hpp @@ -100,17 +100,28 @@ namespace MueLu { /*! @brief Local aggregation. */ - void BuildAggregates(const ParameterList& params, const GraphBase& graph, Aggregates& aggregates, - std::vector& aggStat, LO& numNonAggregatedNodes) const; + void BuildAggregates(const Teuchos::ParameterList& params, const GraphBase& graph, + Aggregates& aggregates, std::vector& aggStat, + LO& numNonAggregatedNodes) const; /*! @brief Local aggregation. */ - void BuildAggregates(const ParameterList& params, const GraphBase& graph, - RCP& geoData, RCP& myGraph) const; + void BuildAggregates(const GraphBase& graph, RCP& geoData, + RCP& myGraph) const; //@} std::string description() const { return "Aggretation: structured algorithm"; } + private: + + void ComputeGraphDataConstant(const GraphBase& graph, RCP& geoData, + const int numInterpolationPoints, ArrayRCP& nnzOnRow, + Array& rowPtr, Array& colIndex) const; + + void ComputeGraphDataLinear(const GraphBase& graph, RCP& geoData, + const int numInterpolationPoints, ArrayRCP& nnzOnRow, + Array& rowPtr, Array& colIndex) const; + }; } //namespace MueLu diff --git a/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_def.hpp b/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_def.hpp index b09d32806f6d..5fe919d11f6c 100644 --- a/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_def.hpp +++ b/packages/muelu/src/Graph/StructuredAggregation/MueLu_AggregationStructuredAlgorithm_def.hpp @@ -67,7 +67,8 @@ namespace MueLu { template void AggregationStructuredAlgorithm:: - BuildAggregates(const ParameterList& params, const GraphBase& graph, Aggregates& aggregates, std::vector& aggStat, + BuildAggregates(const Teuchos::ParameterList& params, const GraphBase& graph, + Aggregates& aggregates, std::vector& aggStat, LO& numNonAggregatedNodes) const { Monitor m(*this, "BuildAggregates"); @@ -79,22 +80,21 @@ namespace MueLu { out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); } - std::string coupling = params.get("aggregation: coupling"); - const bool coupled = (coupling == "coupled" ? true : false); + RCP geoData = aggregates.GetIndexManager(); + const bool coupled = geoData->isAggregationCoupled(); ArrayRCP vertex2AggId = aggregates.GetVertex2AggId()->getDataNonConst(0); ArrayRCP procWinner = aggregates.GetProcWinner() ->getDataNonConst(0); - RCP geoData = aggregates.GetIndexManager(); - Array ghostedCoarseNodeCoarseLIDs; - Array ghostedCoarseNodeCoarsePIDs; - Array ghostedCoarseNodeCoarseGIDs; + Array ghostedCoarseNodeCoarseLIDs; + Array ghostedCoarseNodeCoarsePIDs; + Array ghostedCoarseNodeCoarseGIDs; *out << "Extract data for ghosted nodes" << std::endl; geoData->getGhostedNodesData(graph.GetDomainMap(), ghostedCoarseNodeCoarseLIDs, ghostedCoarseNodeCoarsePIDs, ghostedCoarseNodeCoarseGIDs); - LO rem; + LO rem, rate; Array ghostedIdx(3), coarseIdx(3); - LO ghostedCoarseNodeCoarseLID, aggId, rate; + LO ghostedCoarseNodeCoarseLID, aggId; *out << "Loop over fine nodes and assign them to an aggregate and a rank" << std::endl; for(LO nodeIdx = 0; nodeIdx < geoData->getNumLocalFineNodes(); ++nodeIdx) { // Compute coarse ID associated with fine LID @@ -109,9 +109,9 @@ namespace MueLu { } else { rate = geoData->getCoarseningEndRate(dim); } - if(rem > (rate / 2)) { ++coarseIdx[dim]; } + if(rem > (rate / 2)) {++coarseIdx[dim];} if(coupled && (geoData->getStartGhostedCoarseNode(dim)*geoData->getCoarseningRate(dim) - > geoData->getStartIndex(dim))) { --coarseIdx[dim]; } + > geoData->getStartIndex(dim))) {--coarseIdx[dim];} } geoData->getCoarseNodeGhostedLID(coarseIdx[0], coarseIdx[1], coarseIdx[2], @@ -124,14 +124,12 @@ namespace MueLu { --numNonAggregatedNodes; } // Loop over fine points - - } + } // BuildAggregates() template void AggregationStructuredAlgorithm:: - BuildAggregates(const ParameterList& params, const GraphBase& graph, RCP& geoData, - RCP& myGraph) const { + BuildAggregates(const GraphBase& graph, RCP& geoData, RCP& myGraph) const { Monitor m(*this, "BuildAggregates"); RCP out; @@ -142,8 +140,7 @@ namespace MueLu { out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); } - std::string coupling = params.get("aggregation: coupling"); - const bool coupled = (coupling == "coupled" ? true : false); + const bool coupled = geoData->isAggregationCoupled(); Array ghostedCoarseNodeCoarseLIDs; Array ghostedCoarseNodeCoarsePIDs; Array ghostedCoarseNodeCoarseGIDs; @@ -152,24 +149,138 @@ namespace MueLu { geoData->getGhostedNodesData(graph.GetDomainMap(), ghostedCoarseNodeCoarseLIDs, ghostedCoarseNodeCoarsePIDs, ghostedCoarseNodeCoarseGIDs); - int numDimensions = geoData->getNumDimensions(); - Array ghostedIdx(3,0); - Array coarseIdx(3,0); - Array ijkRem(3,0); - - LO ghostedCoarseNodeCoarseLID, aggId, rate; - GO myGID; - - bool allCoarse; - int numInterpolationPoints = 1 << numDimensions; // Using bit logic to compute 2^numDimensions + // Compute the number of coarse points needed to interpolate quantities to a fine point + int numInterpolationPoints = 0; + if(geoData->getInterpolationOrder() == 0) { + numInterpolationPoints = 1; + } else if(geoData->getInterpolationOrder() == 1) { + // Compute 2^numDimensions using bit logic to avoid round-off errors + numInterpolationPoints = 1 << geoData->getNumDimensions(); + } *out << "numInterpolationPoints=" << numInterpolationPoints << std::endl; - Array isCoarse(numDimensions); - Array colIndex(geoData->getNumLocalFineNodes()*numInterpolationPoints);// also resize... - Array rowPtr(geoData->getNumLocalFineNodes()+1); + + Array colIndex( geoData->getNumLocalCoarseNodes() + numInterpolationPoints* + (geoData->getNumLocalFineNodes() - geoData->getNumLocalCoarseNodes()) ); + Array rowPtr(geoData->getNumLocalFineNodes()+1); rowPtr[0] = 0; ArrayRCP nnzOnRow(geoData->getNumLocalFineNodes()); - *out << "Loop over fine nodes and assign them to an aggregate and a rank" << std::endl; + *out << "Compute prolongatorGraph data" << std::endl; + if(geoData->getInterpolationOrder() == 0) { + ComputeGraphDataConstant(graph, geoData, numInterpolationPoints, nnzOnRow, rowPtr, colIndex); + } else if(geoData->getInterpolationOrder() == 1) { + ComputeGraphDataLinear(graph, geoData, numInterpolationPoints, nnzOnRow, rowPtr, colIndex); + } + + //Redo colMap using colData to specify the coarse nodes and ghost nodes needed + RCP colMap; + if(coupled){ + // In this case we specify the global number of nodes on the coarse mesh + // as well as the GIDs needed on rank. + colMap = MapFactory::Build(graph.GetDomainMap()->lib(), + geoData->getNumGlobalCoarseNodes(), + ghostedCoarseNodeCoarseGIDs(), + graph.GetDomainMap()->getIndexBase(), + graph.GetDomainMap()->getComm(), + graph.GetDomainMap()->getNode()); + } else { + // In this case the map will compute the global number of nodes on the coarse mesh + // since geoData->getNumGlobalCoarseNodes() == Teuchos::OrdinalTraits::invalid() + // and it will assign GIDs to the local coarse nodes. + colMap = MapFactory::Build(graph.GetDomainMap()->lib(), + geoData->getNumGlobalCoarseNodes(), + geoData->getNumLocalCoarseNodes(), + graph.GetDomainMap()->getIndexBase(), + graph.GetDomainMap()->getComm(), + graph.GetDomainMap()->getNode()); + } + *out << "colMap: " << colMap()->getNodeElementList() << std::endl; + myGraph = CrsGraphFactory::Build(graph.GetDomainMap(), + colMap, + nnzOnRow, + Xpetra::DynamicProfile); + + for(LO nodeIdx = 0; nodeIdx < geoData->getNumLocalFineNodes(); ++nodeIdx) { + myGraph->insertLocalIndices(nodeIdx, colIndex(rowPtr[nodeIdx],nnzOnRow[nodeIdx]) ); + } + myGraph->fillComplete(colMap, graph.GetDomainMap()); + + } // BuildAggregates() + + + template + void AggregationStructuredAlgorithm:: + ComputeGraphDataConstant(const GraphBase& graph, RCP& geoData, + const int numInterpolationPoints, ArrayRCP& nnzOnRow, + Array& rowPtr, Array& colIndex) const { + + RCP out; + if(const char* dbg = std::getenv("MUELU_STRUCTUREDALGORITHM_DEBUG")) { + out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); + out->setShowAllFrontMatter(false).setShowProcRank(true); + } else { + out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); + } + + Array ghostedCoarseNodeCoarseLIDs; + Array ghostedCoarseNodeCoarsePIDs; + Array ghostedCoarseNodeCoarseGIDs; + geoData->getGhostedNodesData(graph.GetDomainMap(), ghostedCoarseNodeCoarseLIDs, + ghostedCoarseNodeCoarsePIDs, ghostedCoarseNodeCoarseGIDs); + + LO ghostedCoarseNodeCoarseLID, rem, rate; + Array ghostedIdx(3), coarseIdx(3); + for(LO nodeIdx = 0; nodeIdx < geoData->getNumLocalFineNodes(); ++nodeIdx) { + // For piece-wise constant interpolation we only get one nnz per row + nnzOnRow[nodeIdx] = Teuchos::as(1); + rowPtr[nodeIdx + 1] = rowPtr[nodeIdx] + 1; + + // Compute coarse ID associated with fine LID + geoData->getFineNodeGhostedTuple(nodeIdx, ghostedIdx[0], ghostedIdx[1], ghostedIdx[2]); + + for(int dim = 0; dim < 3; ++dim) { + coarseIdx[dim] = ghostedIdx[dim] / geoData->getCoarseningRate(dim); + rem = ghostedIdx[dim] % geoData->getCoarseningRate(dim); + if(ghostedIdx[dim] - geoData->getOffset(dim) + < geoData->getLocalFineNodesInDir(dim) - geoData->getCoarseningEndRate(dim)) { + rate = geoData->getCoarseningRate(dim); + } else { + rate = geoData->getCoarseningEndRate(dim); + } + if(rem > (rate / 2)) {++coarseIdx[dim];} + if( (geoData->getStartGhostedCoarseNode(dim)*geoData->getCoarseningRate(dim) + > geoData->getStartIndex(dim)) && geoData->isAggregationCoupled() ) {--coarseIdx[dim];} + } + + geoData->getCoarseNodeGhostedLID(coarseIdx[0], coarseIdx[1], coarseIdx[2], + ghostedCoarseNodeCoarseLID); + colIndex[rowPtr[nodeIdx]] = ghostedCoarseNodeCoarseLIDs[ghostedCoarseNodeCoarseLID]; + } // Loop over fine points + + } // ComputeGraphDataConstant() + + + template + void AggregationStructuredAlgorithm:: + ComputeGraphDataLinear(const GraphBase& graph, RCP& geoData, + const int numInterpolationPoints, ArrayRCP& nnzOnRow, + Array& rowPtr, Array& colIndex) const { + + RCP out; + if(const char* dbg = std::getenv("MUELU_STRUCTUREDALGORITHM_DEBUG")) { + out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); + out->setShowAllFrontMatter(false).setShowProcRank(true); + } else { + out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); + } + + const bool coupled = geoData->isAggregationCoupled(); + const int numDimensions = geoData->getNumDimensions(); + Array ghostedIdx(3,0); + Array coarseIdx(3,0); + Array ijkRem(3,0); + int rate = 0; + for(LO nodeIdx = 0; nodeIdx < geoData->getNumLocalFineNodes(); ++nodeIdx) { // Compute coarse ID associated with fine LID geoData->getFineNodeGhostedTuple(nodeIdx, ghostedIdx[0], ghostedIdx[1], ghostedIdx[2]); @@ -182,15 +293,15 @@ namespace MueLu { } else { rate = geoData->getCoarseningEndRate(dim); } - if(ijkRem[dim] > (rate / 2)) { ++coarseIdx[dim]; } + if(ijkRem[dim] > (rate / 2)) {++coarseIdx[dim];} if(coupled && (geoData->getStartGhostedCoarseNode(dim)*geoData->getCoarseningRate(dim) - > geoData->getStartIndex(dim))) { --coarseIdx[dim]; } + > geoData->getStartIndex(dim))) {--coarseIdx[dim];} } - geoData->getCoarseNodeGhostedLID(coarseIdx[0], coarseIdx[1], coarseIdx[2], ghostedCoarseNodeCoarseLID); // Fill Graph // Check if Fine node lies on Coarse Node - allCoarse = true; + bool allCoarse = true; + Array isCoarse(numDimensions); for(int dim = 0; dim < numDimensions; ++dim) { isCoarse[dim] = false; if(ijkRem[dim] == 0) @@ -198,7 +309,7 @@ namespace MueLu { if(coupled){ if( ghostedIdx[dim]-geoData->getOffset(dim) == geoData->getLocalFineNodesInDir(dim)-1 && - geoData->getMeshEdge(dim*2+1) ) + geoData->getMeshEdge(dim*2+1) ) isCoarse[dim] = true; } else { if( ghostedIdx[dim]-geoData->getOffset(dim) == geoData->getLocalFineNodesInDir(dim)-1) @@ -210,14 +321,15 @@ namespace MueLu { } if(allCoarse) { // Fine node lies on Coarse node - geoData->getCoarseNodeGhostedLID(coarseIdx[0], coarseIdx[1], coarseIdx[2], colIndex[rowPtr[nodeIdx]]); + geoData->getCoarseNodeGhostedLID(coarseIdx[0], coarseIdx[1], coarseIdx[2], + colIndex[rowPtr[nodeIdx]]); nnzOnRow[nodeIdx] = Teuchos::as(1); rowPtr[nodeIdx + 1] = rowPtr[nodeIdx] + 1; } else { nnzOnRow[nodeIdx] = Teuchos::as( numInterpolationPoints ); rowPtr[nodeIdx + 1] = rowPtr[nodeIdx] + Teuchos::as( numInterpolationPoints ); - for(int dim = 0; dim < numDimensions; dim++) { + for(int dim = 0; dim < numDimensions; ++dim) { if(coarseIdx[dim] == geoData->getGhostedNodesInDir(dim) - 1) --coarseIdx[dim]; } @@ -235,36 +347,8 @@ namespace MueLu { } } } - } // Loop over fine points - - //Redo colMap uising colData to specify the coarse nodes and ghost nodes needed - Teuchos::RCP colMap; - if(coupled){ - colMap = MapFactory::Build(graph.GetDomainMap()->lib(), - Teuchos::OrdinalTraits::invalid(), - ghostedCoarseNodeCoarseGIDs(), - graph.GetDomainMap()->getIndexBase(), - graph.GetDomainMap()->getComm(), - graph.GetDomainMap()->getNode()); - } else { - colMap = MapFactory::Build(graph.GetDomainMap()->lib(), - Teuchos::OrdinalTraits::invalid(), - geoData->getNumLocalCoarseNodes(), - graph.GetDomainMap()->getIndexBase(), - graph.GetDomainMap()->getComm(), - graph.GetDomainMap()->getNode()); - } - myGraph = CrsGraphFactory::Build(graph.GetDomainMap(),colMap,nnzOnRow,Xpetra::DynamicProfile); - - for(LO nodeIdx = 0; nodeIdx < geoData->getNumLocalFineNodes(); ++nodeIdx) { - myGraph->insertLocalIndices(nodeIdx, colIndex(rowPtr[nodeIdx],nnzOnRow[nodeIdx]) ); - } - - myGraph->fillComplete(); - } - - + } // ComputeGraphDataLinear() } // end namespace diff --git a/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_decl.hpp b/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_decl.hpp index 726700a9f9db..ffd49383fb04 100644 --- a/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_decl.hpp +++ b/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_decl.hpp @@ -48,6 +48,7 @@ // use for Teuchos:Comm #include "Teuchos_CommHelpers.hpp" +#include "Teuchos_OrdinalTraits.hpp" #include #include diff --git a/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_def.hpp b/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_def.hpp index b9428f3d7fb2..6552f47bf457 100644 --- a/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_def.hpp +++ b/packages/muelu/src/Graph/StructuredAggregation/MueLu_IndexManager_def.hpp @@ -46,6 +46,8 @@ #ifndef MUELU_INDEXMANAGER_DEF_HPP #define MUELU_INDEXMANAGER_DEF_HPP +#include "Teuchos_OrdinalTraits.hpp" + #include "MueLu_ConfigDefs.hpp" #include "MueLu_BaseClass.hpp" #include @@ -77,7 +79,7 @@ namespace MueLu { startIndices.resize(6); startGhostedCoarseNode.resize(3); - } + } // Constructor template void IndexManager::computeMeshParameters() { @@ -90,8 +92,13 @@ namespace MueLu { out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); } - gNumFineNodes10 = gFineNodesPerDir[1]*gFineNodesPerDir[0]; - gNumFineNodes = gFineNodesPerDir[2]*gNumFineNodes10; + if(coupled_) { + gNumFineNodes10 = Teuchos::OrdinalTraits::invalid(); + gNumFineNodes = Teuchos::OrdinalTraits::invalid(); + } else { + gNumFineNodes10 = gFineNodesPerDir[1]*gFineNodesPerDir[0]; + gNumFineNodes = gFineNodesPerDir[2]*gNumFineNodes10; + } lNumFineNodes10 = lFineNodesPerDir[1]*lFineNodesPerDir[0]; lNumFineNodes = lFineNodesPerDir[2]*lNumFineNodes10; for(int dim = 0; dim < 3; ++dim) { diff --git a/packages/muelu/src/Graph/StructuredAggregation/MueLu_StructuredAggregationFactory_def.hpp b/packages/muelu/src/Graph/StructuredAggregation/MueLu_StructuredAggregationFactory_def.hpp index f64abd7aeb71..f4ad18ae582a 100644 --- a/packages/muelu/src/Graph/StructuredAggregation/MueLu_StructuredAggregationFactory_def.hpp +++ b/packages/muelu/src/Graph/StructuredAggregation/MueLu_StructuredAggregationFactory_def.hpp @@ -80,17 +80,20 @@ namespace MueLu { SET_VALID_ENTRY("aggregation: error on nodes with no on-rank neighbors"); #undef SET_VALID_ENTRY - // general variables needed in AggregationFactory - validParamList->set ("aggregation: mesh layout","Global Lexicographic", + // general variables needed in StructuredAggregationFactory + validParamList->set ("aggregation: mesh layout","Global Lexicographic", "Type of mesh ordering"); - validParamList->set ("aggregation: coupling","coupled", + validParamList->set ("aggregation: coupling","coupled", "aggregation coupling mode: coupled or uncoupled"); + validParamList->set ("aggregation: output type", "aggregates", + "Type of object holding the aggregation data: Aggregtes or CrsGraph"); + validParamList->set ("aggregation: coarsening rate", "{3}", + "Coarsening rate per spatial dimensions"); validParamList->set ("aggregation: number of spatial dimensions", 3, "The number of spatial dimensions in the problem"); validParamList->set ("aggregation: coarsening order", 0, "The interpolation order used to construct grid transfer operators based off these aggregates."); - validParamList->set ("aggregation: coarsening rate", "{3}", - "Coarsening rate per spatial dimensions"); + validParamList->set >("aggregation: mesh data", Teuchos::null, "Mesh ordering associated data"); @@ -173,6 +176,8 @@ namespace MueLu { std::string meshLayout = pL.get("aggregation: mesh layout"); std::string coupling = pL.get("aggregation: coupling"); const bool coupled = (coupling == "coupled" ? true : false); + std::string outputType = pL.get("aggregation: output type"); + const bool outputAggregates = (outputType == "Aggregates" ? true : false); Array gFineNodesPerDir(3); Array lFineNodesPerDir(3); if(currentLevel.GetLevelID() == 0) { @@ -284,37 +289,35 @@ namespace MueLu { *out << "Compute coarse mesh data" << std::endl; std::vector > coarseMeshData = geoData->getCoarseMeshData(); - // Create aggregates object and set basic parameters - RCP aggregates = rcp(new Aggregates(fineMap)); - aggregates->setObjectLabel("ST"); - aggregates->SetIndexManager(geoData); - aggregates->AggregatesCrossProcessors(coupled); - std::vector aggStat(geoData->getNumLocalFineNodes(), READY); - aggregates->SetNumAggregates(geoData->getNumLocalCoarseNodes()); - - // Create Coarse Data - RCP myGraph; - - // Now we are ready for the big loop over the fine node that will assign each // node on the fine grid to an aggregate and a processor. - LO numNonAggregatedNodes = geoData->getNumLocalFineNodes(); RCP graphFact = GetFactory("Graph"); RCP > myStructuredAlgorithm = rcp(new AggregationStructuredAlgorithm(graphFact)); - if(interpolationOrder == 0){ - myStructuredAlgorithm->BuildAggregates(pL, *graph, *aggregates, aggStat, numNonAggregatedNodes); + + if(interpolationOrder == 0 && outputAggregates){ + RCP aggregates = rcp(new Aggregates(graph->GetDomainMap())); + aggregates->setObjectLabel("ST"); + aggregates->SetIndexManager(geoData); + aggregates->AggregatesCrossProcessors(coupled); + aggregates->SetNumAggregates(geoData->getNumLocalCoarseNodes()); + std::vector aggStat(geoData->getNumLocalFineNodes(), READY); + LO numNonAggregatedNodes = geoData->getNumLocalFineNodes(); + + myStructuredAlgorithm->BuildAggregates(pL, *graph, *aggregates, aggStat, + numNonAggregatedNodes); + TEUCHOS_TEST_FOR_EXCEPTION(numNonAggregatedNodes, Exceptions::RuntimeError, "MueLu::StructuredAggregationFactory::Build: Leftover nodes found! Error!"); - aggregates->ComputeAggregateSizes(true/*forceRecompute*/); - Set(currentLevel, "Aggregates", aggregates); - GetOStream(Statistics1) << aggregates->description() << std::endl; - } else if(interpolationOrder == 1) { - myStructuredAlgorithm->BuildAggregates(pL, *graph, geoData, myGraph); - // myGraph->describe(*out,Teuchos::VERB_EXTREME); - Set(currentLevel, "prolongatorGraph", myGraph); + Set(currentLevel, "Aggregates", aggregates); + + } else { + // Create Coarse Data + RCP myGraph; + myStructuredAlgorithm->BuildAggregates(*graph, geoData, myGraph); + Set(currentLevel, "prolongatorGraph", myGraph); } Set(currentLevel, "gCoarseNodesPerDim", geoData->getGlobalCoarseNodesPerDir()); diff --git a/packages/muelu/src/Graph/StructuredAggregation/uncoupled/MueLu_UncoupledIndexManager_def.hpp b/packages/muelu/src/Graph/StructuredAggregation/uncoupled/MueLu_UncoupledIndexManager_def.hpp index fb0270b19f19..12d1bae4c92c 100644 --- a/packages/muelu/src/Graph/StructuredAggregation/uncoupled/MueLu_UncoupledIndexManager_def.hpp +++ b/packages/muelu/src/Graph/StructuredAggregation/uncoupled/MueLu_UncoupledIndexManager_def.hpp @@ -46,8 +46,9 @@ #ifndef MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_ #define MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_ -#include #include +#include +#include namespace MueLu { @@ -61,9 +62,6 @@ namespace MueLu { IndexManager(comm, coupled, NumDimensions, interpolationOrder, GFineNodesPerDir, LFineNodesPerDir), myRank(MyRank), numRanks(NumRanks) { - // RCP out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); - // out->setShowAllFrontMatter(false).setShowProcRank(true); - // Load coarse rate, being careful about formating for(int dim = 0; dim < 3; ++dim) { if(dim < this->numDimensions) { @@ -78,13 +76,13 @@ namespace MueLu { } this->computeMeshParameters(); - // *out << "UncoupledIndexManager has been constructed!" << std::endl; + this->gNumCoarseNodes10 = Teuchos::OrdinalTraits::invalid(); + this->gNumCoarseNodes = Teuchos::OrdinalTraits::invalid(); } // Constructor template void UncoupledIndexManager:: computeGlobalCoarseParameters() { - this->gNumCoarseNodes10 = -1; GO input[1] = {as(this->lNumCoarseNodes)}, output[1] = {0}; Teuchos::reduceAll(*(this->comm_), Teuchos::REDUCE_SUM, 1, input, output); this->gNumCoarseNodes = output[0]; diff --git a/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp b/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp index d755eb631ea7..3b07c9396177 100644 --- a/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp +++ b/packages/muelu/src/Headers/MueLu_UseShortNamesScalar.hpp @@ -116,6 +116,9 @@ typedef MueLu::GeneralGeometricPFactory #ifdef MUELU_GENERICRFACTORY_SHORT typedef MueLu::GenericRFactory GenericRFactory; #endif +#ifdef MUELU_GEOMETRICINTERPOLATIONPFACTORY_SHORT +typedef MueLu::GeometricInterpolationPFactory GeometricInterpolationPFactory; +#endif #ifdef MUELU_GMRESSOLVER_SHORT typedef MueLu::GMRESSolver GMRESSolver; #endif diff --git a/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp b/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp index 169203e3f7f8..e186eee3de8b 100644 --- a/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp +++ b/packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp @@ -93,6 +93,7 @@ #include "MueLu_FineLevelInputDataFactory.hpp" #include "MueLu_GeneralGeometricPFactory.hpp" #include "MueLu_GenericRFactory.hpp" +#include "MueLu_GeometricInterpolationPFactory.hpp" #include "MueLu_IndefBlockedDiagonalSmoother.hpp" #include "MueLu_IsorropiaInterface.hpp" #include "MueLu_LineDetectionFactory.hpp" @@ -233,6 +234,7 @@ namespace MueLu { if (factoryName == "FineLevelInputDataFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); if (factoryName == "GeneralGeometricPFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); if (factoryName == "GenericRFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); + if (factoryName == "GeometricInterpolationPFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); if (factoryName == "LineDetectionFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); if (factoryName == "MapTransferFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); if (factoryName == "MatrixAnalysisFactory") return Build2 (paramList, factoryMapIn, factoryManagersIn); diff --git a/packages/muelu/src/MueCentral/MueLu_HierarchyUtils_def.hpp b/packages/muelu/src/MueCentral/MueLu_HierarchyUtils_def.hpp index 897ea5cc1c28..24f10fa94a82 100644 --- a/packages/muelu/src/MueCentral/MueLu_HierarchyUtils_def.hpp +++ b/packages/muelu/src/MueCentral/MueLu_HierarchyUtils_def.hpp @@ -46,6 +46,8 @@ #ifndef MUELU_HIERARCHYUTILS_DEF_HPP #define MUELU_HIERARCHYUTILS_DEF_HPP +#include "Teuchos_ScalarTraits.hpp" + #include #include @@ -67,6 +69,8 @@ namespace MueLu { // calling AddNewLevel as appropriate. template void HierarchyUtils::AddNonSerializableDataToHierarchy(HierarchyManager& HM, Hierarchy& H, const ParameterList& paramList) { + typedef typename Xpetra::MultiVector::magnitudeType, + LocalOrdinal, GlobalOrdinal, Node> realvaluedmultivector_type; for (ParameterList::ConstIterator it = paramList.begin(); it != paramList.end(); it++) { const std::string& levelName = it->first; @@ -113,7 +117,7 @@ namespace MueLu { else if(name == "Coordinates") //Scalar of Coordinates MV is always double { level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData); - level->Set(name, Teuchos::getValue >(it2->second), NoFactory::get()); + level->Set(name, Teuchos::getValue >(it2->second), NoFactory::get()); //M->SetFactory(name, NoFactory::getRCP()); // TAW: generally it is a bad idea to overwrite the factory manager data here } #ifdef HAVE_MUELU_INTREPID2 @@ -183,7 +187,8 @@ namespace MueLu { // One should do this only in very special cases } else if(name == "Coordinates") {//Scalar of Coordinates MV is always double level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData); - level->Set(name, Teuchos::getValue > >(it2->second), NoFactory::get()); + level->Set(name, Teuchos::getValue >(it2->second), NoFactory::get()); + level->print(std::cout, MueLu::VERB_EXTREME); //M->SetFactory(name, NoFactory::getRCP()); // TAW: generally it is a bad idea to overwrite the factory manager data here } else { //Custom variable diff --git a/packages/muelu/src/MueCentral/MueLu_MasterList.cpp b/packages/muelu/src/MueCentral/MueLu_MasterList.cpp index ffa5fca0a290..91c610b7eefa 100644 --- a/packages/muelu/src/MueCentral/MueLu_MasterList.cpp +++ b/packages/muelu/src/MueCentral/MueLu_MasterList.cpp @@ -219,6 +219,8 @@ namespace MueLu { "" "" "" + "" + "" "" "" "" @@ -580,6 +582,10 @@ namespace MueLu { ("eigen-analysis: iterations","sa: eigenvalue estimate num iterations") + ("gmg: interpolation order","gmg: interpolation order") + + ("gmg: build coarse coordinates","gmg: build coarse coordinates") + ("transfer: params","transfer: params") ("pcoarsen: element","pcoarsen: element") diff --git a/packages/muelu/src/Transfers/GeneralGeometric/MueLu_GeometricInterpolationPFactory_decl.hpp b/packages/muelu/src/Transfers/GeneralGeometric/MueLu_GeometricInterpolationPFactory_decl.hpp new file mode 100644 index 000000000000..e658d4c77ab1 --- /dev/null +++ b/packages/muelu/src/Transfers/GeneralGeometric/MueLu_GeometricInterpolationPFactory_decl.hpp @@ -0,0 +1,100 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jonathan Hu (jhu@sandia.gov) +// Andrey Prokopenko (aprokop@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER +#ifndef MUELU_GEOMETRICINTERPOLATIONPFACTORY_DECL_HPP +#define MUELU_GEOMETRICINTERPOLATIONPFACTORY_DECL_HPP + +#include "MueLu_PFactory.hpp" +#include "MueLu_Level_fwd.hpp" +#include "MueLu_Aggregates_fwd.hpp" + +#include "Xpetra_CrsGraph.hpp" + +namespace MueLu{ + + template + class GeometricInterpolationPFactory : public PFactory { +#undef MUELU_GEOMETRICINTERPOLATIONPFACTORY_SHORT +#include "MueLu_UseShortNames.hpp" + + public: + + //! @name Constructors/Destructors. + //@{ + + //! Constructor + GeometricInterpolationPFactory() { } + + //! Destructor. + virtual ~GeometricInterpolationPFactory() { } + //@} + + RCP GetValidParameterList() const; + + //! Input + //@{ + + void DeclareInput(Level& fineLevel, Level& coarseLevel) const; + + //@} + + //! @name Build methods. + //@{ + + void Build (Level& fineLevel, Level& coarseLevel) const; + void BuildP(Level& fineLevel, Level& coarseLevel) const; + + //@} + + private: + void BuildConstantP(RCP& P, RCP& prolongatorGraph, RCP& A) const; + void BuildLinearP(RCP& P, RCP& prolongatorGraph) const; + + }; // class GeometricInterpolationPFactory + +} // namespace MueLu + +#define MUELU_GEOMETRICINTERPOLATIONPFACTORY_SHORT +#endif // MUELU_GEOMETRICINTERPOLATIONPFACTORY_DECL_HPP diff --git a/packages/muelu/src/Transfers/GeneralGeometric/MueLu_GeometricInterpolationPFactory_def.hpp b/packages/muelu/src/Transfers/GeneralGeometric/MueLu_GeometricInterpolationPFactory_def.hpp new file mode 100644 index 000000000000..2160a35dccad --- /dev/null +++ b/packages/muelu/src/Transfers/GeneralGeometric/MueLu_GeometricInterpolationPFactory_def.hpp @@ -0,0 +1,269 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jonathan Hu (jhu@sandia.gov) +// Andrey Prokopenko (aprokop@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER +#ifndef MUELU_GEOMETRICINTERPOLATIONPFACTORY_DEF_HPP +#define MUELU_GEOMETRICINTERPOLATIONPFACTORY_DEF_HPP + +#include "Xpetra_CrsGraph.hpp" + +#include "MueLu_MasterList.hpp" +#include "MueLu_Monitor.hpp" +#include "MueLu_Aggregates.hpp" + +// Including this one last ensure that the short names of the above headers are defined properly +#include "MueLu_GeometricInterpolationPFactory_decl.hpp" + +namespace MueLu { + + template + RCP GeometricInterpolationPFactory::GetValidParameterList() const { + RCP validParamList = rcp(new ParameterList()); + +#define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name)) + SET_VALID_ENTRY("gmg: interpolation order"); + SET_VALID_ENTRY("gmg: build coarse coordinates"); +#undef SET_VALID_ENTRY + + // general variables needed in GeometricInterpolationPFactory + validParamList->set >("A", Teuchos::null, + "Generating factory of the matrix A"); + validParamList->set >("Aggregates", Teuchos::null, + "Aggregates generated by StructuredAggregationFactory used to construct a piece-constant prolongator."); + validParamList->set >("prolongatorGraph", Teuchos::null, + "Graph generated by StructuredAggregationFactory used to construct a piece-linear prolongator."); + validParamList->set >("Coordinates", Teuchos::null, + "Fine level coordinates used to construct piece-wise linear prolongator and coarse level coordinates."); + validParamList->set >("Nullspace", Teuchos::null, + "Fine level nullspace used to construct the coarse level nullspace."); + + return validParamList; + } + + template + void GeometricInterpolationPFactory:: + DeclareInput(Level& fineLevel, Level& coarseLevel) const { + const ParameterList& pL = GetParameterList(); + + Input(fineLevel, "A"); + Input(fineLevel, "Nullspace"); + Input(fineLevel, "prolongatorGraph"); + + if( pL.get("gmg: build coarse coordinates") || + (pL.get("gmg: interpolation order") == 1) ) { + Input(fineLevel, "Coordinates"); + } + + } + + template + void GeometricInterpolationPFactory:: + Build(Level& fineLevel, Level &coarseLevel) const { + return BuildP(fineLevel, coarseLevel); + } + + template + void GeometricInterpolationPFactory:: + BuildP(Level &fineLevel, Level &coarseLevel) const { + FactoryMonitor m(*this, "Geometric Interpolation Prolongator", coarseLevel); + + // Set debug outputs based on environment variable + RCP out; + if(const char* dbg = std::getenv("MUELU_GEOMETRICINTERPOLATIONPFACTORY_DEBUG")) { + out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); + out->setShowAllFrontMatter(false).setShowProcRank(true); + } else { + out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); + } + + // Declare useful types + using real_type = typename Teuchos::ScalarTraits::magnitudeType; + using realvaluedmultivector_type = Xpetra::MultiVector; + + // Get inputs from the parameter list + const ParameterList& pL = GetParameterList(); + const int interpolationOrder = pL.get("gmg: interpolation order"); + const bool buildCoarseCoordinates = pL.get("gmg: build coarse coordinates"); + + // Declared main input/outputs to be retrieved and placed on the fine resp. coarse level + RCP A = Get >(fineLevel, "A"); + RCP prolongatorGraph = Get >(fineLevel, "prolongatorGraph"); + RCP fineCoordinates, coarseCoordinates; + RCP P; + + *out << "Hello from GeometricInterpolationPFactory!" << std::endl; + + if(buildCoarseCoordinates || (interpolationOrder == 1)) { + fineCoordinates = Get< RCP >(fineLevel, "Coordinates"); + } + + if(interpolationOrder == 0) { + // Compute the prolongator using piece-wise constant interpolation + BuildConstantP(P, prolongatorGraph, A); + } else if(interpolationOrder == 1) { + // Compute the prolongator using piece-wise linear interpolation + BuildLinearP(P, prolongatorGraph); + } + + if(buildCoarseCoordinates || (interpolationOrder == 1)) { + Set(coarseLevel, "Coordinates", coarseCoordinates); + } + Set(coarseLevel, "P", P); + + } // BuildP + + template + void GeometricInterpolationPFactory:: + BuildConstantP(RCP& P, RCP& prolongatorGraph, RCP& A) const { + + // Set debug outputs based on environment variable + RCP out; + if(const char* dbg = std::getenv("MUELU_GEOMETRICINTERPOLATIONPFACTORY_DEBUG")) { + out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); + out->setShowAllFrontMatter(false).setShowProcRank(true); + } else { + out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); + } + + *out << "prolongatorGraph->getDomainMap()->getNodeElementList(): " + << prolongatorGraph->getDomainMap()->getNodeElementList() << std::endl; + + int dofsPerNode = A->GetFixedBlockSize(); + ArrayView initialDomainMapLIDs = + prolongatorGraph->getDomainMap()->getNodeElementList(); + Array domainMapLIDs(initialDomainMapLIDs.size()*dofsPerNode); + for(LO elementIdx = 0; elementIdx < as(domainMapLIDs.size()); ++elementIdx) { + for(int dof = 0; dof < dofsPerNode; ++dof) { + domainMapLIDs[elementIdx*dofsPerNode + dof] = + initialDomainMapLIDs[elementIdx]*dofsPerNode + dof; + } + } + RCP domainMap = MapFactory::Build(prolongatorGraph->getRowMap()->lib(), + prolongatorGraph->getGlobalNumRows()*dofsPerNode, + domainMapLIDs(), + prolongatorGraph->getIndexBase(), + prolongatorGraph->getComm(), + prolongatorGraph->getRowMap()->getNode()); + + *out << "domainMap: " << domainMapLIDs << std::endl; + + ArrayView initialColMapLIDs = + prolongatorGraph->getColMap()->getNodeElementList(); + Array colMapLIDs(initialColMapLIDs.size()*dofsPerNode); + for(LO elementIdx = 0; elementIdx < as(colMapLIDs.size()); ++elementIdx) { + for(int dof = 0; dof < dofsPerNode; ++dof) { + colMapLIDs[elementIdx*dofsPerNode + dof] = + initialColMapLIDs[elementIdx]*dofsPerNode + dof; + } + } + RCP colMap = MapFactory::Build(prolongatorGraph->getColMap()->lib(), + prolongatorGraph->getGlobalNumCols()*dofsPerNode, + colMapLIDs(), + prolongatorGraph->getIndexBase(), + prolongatorGraph->getComm(), + prolongatorGraph->getColMap()->getNode()); + + *out << "colMap: " << colMapLIDs << std::endl; + + std::vector strideInfo(1); + strideInfo[0] = dofsPerNode; + RCP stridedDomainMap = StridedMapFactory::Build(domainMap, strideInfo); + + P = rcp(new CrsMatrixWrap(A->getDomainMap(), colMap, 0, Xpetra::StaticProfile)); + // P = rcp(new CrsMatrixWrap(graph)); + RCP PCrs = rcp_dynamic_cast(P)->getCrsMatrix(); + + ArrayRCP iaP; + ArrayRCP jaP; + ArrayRCP valP; + + PCrs->allocateAllValues(A->getDomainMap()->getNodeNumElements(), iaP, jaP, valP); + + ArrayView ia = iaP(); + ArrayView ja = jaP(); + ArrayView val = valP(); + ia[0] = 0; + + int dofIdx; + ArrayView colIdx; + for(LO rowIdx = 0; rowIdx < prolongatorGraph->getNodeNumRows(); ++rowIdx) { + prolongatorGraph->getLocalRowView(rowIdx, colIdx); + for(int dof = 0; dof < dofsPerNode; ++dof) { + dofIdx = rowIdx*dofsPerNode + dof; + ia[dofIdx + 1] = dofIdx + 1; + ja[dofIdx] = colIdx[0]*dofsPerNode + dof; + val[dofIdx] = 1.0; + } + } + + PCrs->setAllValues(iaP, jaP, valP); + PCrs->expertStaticFillComplete(domainMap, A->getDomainMap()); + + // set StridingInformation of P + if (A->IsView("stridedMaps") == true) { + P->CreateView("stridedMaps", A->getRowMap("stridedMaps"), stridedDomainMap); + } else { + P->CreateView("stridedMaps", P->getRangeMap(), stridedDomainMap); + } + + } // BuildConstantP + + template + void GeometricInterpolationPFactory:: + BuildLinearP(RCP& P, RCP& prolongatorGraph) const { + + // Set debug outputs based on environment variable + RCP out; + if(const char* dbg = std::getenv("MUELU_GEOMETRICINTERPOLATIONPFACTORY_DEBUG")) { + out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); + out->setShowAllFrontMatter(false).setShowProcRank(true); + } else { + out = Teuchos::getFancyOStream(rcp(new Teuchos::oblackholestream())); + } + + } // BuildLinearP + +} // namespace MueLu + +#endif // MUELU_GEOMETRICINTERPOLATIONPFACTORY_DEF_HPP diff --git a/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList b/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList index d18c0d34a773..f4e8b64ab805 100644 --- a/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList +++ b/packages/muelu/src/Utils/ClassList/SC-LO-GO-NO.classList @@ -36,6 +36,7 @@ FilteredAFactory FineLevelInputDataFactory GeneralGeometricPFactory GenericRFactory +GeometricInterpolationPFactory GMRESSolver Hierarchy HierarchyManager diff --git a/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake b/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake index 552701af3688..0b4748abd2f9 100644 --- a/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake +++ b/packages/muelu/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake @@ -35,6 +35,7 @@ APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::FilteredAFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::FineLevelInputDataFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::GeneralGeometricPFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::GenericRFactory ) +APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::GeometricInterpolationPFactory ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::GMRESSolver ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::Hierarchy ) APPEND_SET(MUELU_SC_LO_GO_NO_ETI_CLASSES MueLu::HierarchyUtils ) diff --git a/packages/muelu/src/Utils/ForwardDeclaration/MueLu_GeometricInterpolationPFactory_fwd.hpp b/packages/muelu/src/Utils/ForwardDeclaration/MueLu_GeometricInterpolationPFactory_fwd.hpp new file mode 100644 index 000000000000..b94867ac798a --- /dev/null +++ b/packages/muelu/src/Utils/ForwardDeclaration/MueLu_GeometricInterpolationPFactory_fwd.hpp @@ -0,0 +1,63 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jonathan Hu (jhu@sandia.gov) +// Andrey Prokopenko (aprokop@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER +#ifndef MUELU_GEOMETRICINTERPOLATIONPFACTORY_FWD_HPP +#define MUELU_GEOMETRICINTERPOLATIONPFACTORY_FWD_HPP + + + + +namespace MueLu { + template + class GeometricInterpolationPFactory; +} + +#ifndef MUELU_GEOMETRICINTERPOLATIONPFACTORY_SHORT +#define MUELU_GEOMETRICINTERPOLATIONPFACTORY_SHORT +#endif + + + +#endif // MUELU_GEOMETRICINTERPOLATIONPFACTORY_FWD_HPP diff --git a/packages/stokhos/src/muelu/explicit_instantiation/MueLu_AggregationStructuredAlgorithm.cpp b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_AggregationStructuredAlgorithm.cpp new file mode 100644 index 000000000000..bcd43f05d57e --- /dev/null +++ b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_AggregationStructuredAlgorithm.cpp @@ -0,0 +1,65 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jeremie Gaidamour (jngaida@sandia.gov) +// Jonathan Hu (jhu@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +// Sacado headers must be included first so that overloaded operators +// are defined in the muelu template code +#include "Stokhos_Sacado.hpp" +#include "MueLu_AggregationStructuredAlgorithm_def.hpp" + +typedef Stokhos::StandardStorage Storage; +typedef Sacado::PCE::OrthogPoly pce_type; +template class MueLu::AggregationStructuredAlgorithm; + +#endif + + diff --git a/packages/stokhos/src/muelu/explicit_instantiation/MueLu_GeometricInterpolationPFactory.cpp b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_GeometricInterpolationPFactory.cpp new file mode 100644 index 000000000000..914c541d454d --- /dev/null +++ b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_GeometricInterpolationPFactory.cpp @@ -0,0 +1,65 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jeremie Gaidamour (jngaida@sandia.gov) +// Jonathan Hu (jhu@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +// Sacado headers must be included first so that overloaded operators +// are defined in the muelu template code +#include "Stokhos_Sacado.hpp" +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +typedef Stokhos::StandardStorage Storage; +typedef Sacado::PCE::OrthogPoly pce_type; +template class MueLu::GeometricInterpolationPFactory; + +#endif + + diff --git a/packages/stokhos/src/muelu/explicit_instantiation/MueLu_HybridAggregationFactory.cpp b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_HybridAggregationFactory.cpp new file mode 100644 index 000000000000..8d7f5510073e --- /dev/null +++ b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_HybridAggregationFactory.cpp @@ -0,0 +1,65 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jeremie Gaidamour (jngaida@sandia.gov) +// Jonathan Hu (jhu@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +// Sacado headers must be included first so that overloaded operators +// are defined in the muelu template code +#include "Stokhos_Sacado.hpp" +#include "MueLu_HybridAggregationFactory_def.hpp" + +typedef Stokhos::StandardStorage Storage; +typedef Sacado::PCE::OrthogPoly pce_type; +template class MueLu::HybridAggregationFactory; + +#endif + + diff --git a/packages/stokhos/src/muelu/explicit_instantiation/MueLu_InterfaceAggregationAlgorithm.cpp b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_InterfaceAggregationAlgorithm.cpp new file mode 100644 index 000000000000..a548f87d01cb --- /dev/null +++ b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_InterfaceAggregationAlgorithm.cpp @@ -0,0 +1,65 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jeremie Gaidamour (jngaida@sandia.gov) +// Jonathan Hu (jhu@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +// Sacado headers must be included first so that overloaded operators +// are defined in the muelu template code +#include "Stokhos_Sacado.hpp" +#include "MueLu_InterfaceAggregationAlgorithm_def.hpp" + +typedef Stokhos::StandardStorage Storage; +typedef Sacado::PCE::OrthogPoly pce_type; +template class MueLu::InterfaceAggregationAlgorithm; + +#endif + + diff --git a/packages/stokhos/src/muelu/explicit_instantiation/MueLu_UncoupledIndexManager.cpp b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_UncoupledIndexManager.cpp new file mode 100644 index 000000000000..d01fc478dc60 --- /dev/null +++ b/packages/stokhos/src/muelu/explicit_instantiation/MueLu_UncoupledIndexManager.cpp @@ -0,0 +1,65 @@ +// @HEADER +// +// *********************************************************************** +// +// MueLu: A package for multigrid based preconditioning +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact +// Jeremie Gaidamour (jngaida@sandia.gov) +// Jonathan Hu (jhu@sandia.gov) +// Ray Tuminaro (rstumin@sandia.gov) +// +// *********************************************************************** +// +// @HEADER + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +// Sacado headers must be included first so that overloaded operators +// are defined in the muelu template code +#include "Stokhos_Sacado.hpp" +#include "MueLu_UncoupledIndexManager_def.hpp" + +typedef Stokhos::StandardStorage Storage; +typedef Sacado::PCE::OrthogPoly pce_type; +template class MueLu::UncoupledIndexManager; + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Cuda.cpp b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Cuda.cpp new file mode 100644 index 000000000000..33d1d21da1e3 --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Cuda.cpp @@ -0,0 +1,67 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_UQ_PCE.hpp" +#include "Stokhos_MueLu_UQ_PCE.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +#define MUELU_INST_N(N) \ + INSTANTIATE_TPETRA_UQ_PCE_N(MUELU_INST_S_LO_GO_N, N) + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_UQ_PCE_CUDA(MUELU_INST_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_OpenMP.cpp b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_OpenMP.cpp new file mode 100644 index 000000000000..7c23ee3697d3 --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_OpenMP.cpp @@ -0,0 +1,67 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_UQ_PCE.hpp" +#include "Stokhos_MueLu_UQ_PCE.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +#define MUELU_INST_N(N) \ + INSTANTIATE_TPETRA_UQ_PCE_N(MUELU_INST_S_LO_GO_N, N) + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_UQ_PCE_OPENMP(MUELU_INST_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Serial.cpp b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Serial.cpp new file mode 100644 index 000000000000..262ff6dd3339 --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Serial.cpp @@ -0,0 +1,67 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_UQ_PCE.hpp" +#include "Stokhos_MueLu_UQ_PCE.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +#define MUELU_INST_N(N) \ + INSTANTIATE_TPETRA_UQ_PCE_N(MUELU_INST_S_LO_GO_N, N) + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_UQ_PCE_SERIAL(MUELU_INST_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Threads.cpp b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Threads.cpp new file mode 100644 index 000000000000..0b606968dd1a --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/pce/muelu/MueLu_GeometricInterpolationPFactory_UQ_PCE_Threads.cpp @@ -0,0 +1,67 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_UQ_PCE.hpp" +#include "Stokhos_MueLu_UQ_PCE.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +#define MUELU_INST_N(N) \ + INSTANTIATE_TPETRA_UQ_PCE_N(MUELU_INST_S_LO_GO_N, N) + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_UQ_PCE_THREADS(MUELU_INST_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Cuda.cpp b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Cuda.cpp new file mode 100644 index 000000000000..0c3edf137f6a --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Cuda.cpp @@ -0,0 +1,64 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_MP_Vector.hpp" +#include "Stokhos_MueLu_MP_Vector.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_MP_VECTOR_CUDA(MUELU_INST_S_LO_GO_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_OpenMP.cpp b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_OpenMP.cpp new file mode 100644 index 000000000000..11b0e7f8db1e --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_OpenMP.cpp @@ -0,0 +1,64 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_MP_Vector.hpp" +#include "Stokhos_MueLu_MP_Vector.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_MP_VECTOR_OPENMP(MUELU_INST_S_LO_GO_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Serial.cpp b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Serial.cpp new file mode 100644 index 000000000000..48b2a80267de --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Serial.cpp @@ -0,0 +1,64 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_MP_Vector.hpp" +#include "Stokhos_MueLu_MP_Vector.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_MP_VECTOR_SERIAL(MUELU_INST_S_LO_GO_N) + +#endif + + diff --git a/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Threads.cpp b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Threads.cpp new file mode 100644 index 000000000000..295aec13393b --- /dev/null +++ b/packages/stokhos/src/sacado/kokkos/vector/muelu/MueLu_GeometricInterpolationPFactory_MP_Vector_Threads.cpp @@ -0,0 +1,64 @@ +// @HEADER +// *********************************************************************** +// +// Stokhos Package +// Copyright (2009) Sandia Corporation +// +// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// license for use of this work by or on behalf of the U.S. Government. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Eric T. Phipps (etphipp@sandia.gov). +// +// *********************************************************************** +// @HEADER + + + + +#include "MueLu_ExplicitInstantiation.hpp" +#include "Stokhos_ConfigDefs.h" + +#if defined(HAVE_STOKHOS_MUELU) && defined(HAVE_MUELU_EXPLICIT_INSTANTIATION) && defined(HAVE_STOKHOS_SACADO) + +#include "Stokhos_Tpetra_ETI_Helpers_MP_Vector.hpp" +#include "Stokhos_MueLu_MP_Vector.hpp" + +#include "MueLu_GeometricInterpolationPFactory_def.hpp" + +#define MUELU_INST_S_LO_GO_N(S, LO, GO, N) \ + template class MueLu::GeometricInterpolationPFactory; + +TPETRA_ETI_MANGLING_TYPEDEFS() + +INSTANTIATE_TPETRA_MP_VECTOR_THREADS(MUELU_INST_S_LO_GO_N) + +#endif + + diff --git a/packages/trilinoscouplings/examples/scaling/CMakeLists.txt b/packages/trilinoscouplings/examples/scaling/CMakeLists.txt index 6f9288dd1aa2..3c69b57f472b 100644 --- a/packages/trilinoscouplings/examples/scaling/CMakeLists.txt +++ b/packages/trilinoscouplings/examples/scaling/CMakeLists.txt @@ -428,6 +428,7 @@ IF(${PACKAGE_NAME}_ENABLE_Belos AND TRIBITS_COPY_FILES_TO_BINARY_DIR(TestCopyMueLuStructuredFiles SOURCE_FILES muelu_structured_aggregation.xml + muelu_geometric_interpolation.xml SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DEST_DIR ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/packages/trilinoscouplings/examples/scaling/StructuredIntrepidPoisson_Pamgen_Tpetra_main.cpp b/packages/trilinoscouplings/examples/scaling/StructuredIntrepidPoisson_Pamgen_Tpetra_main.cpp index 0e6dc445cc04..cd707d62dea8 100644 --- a/packages/trilinoscouplings/examples/scaling/StructuredIntrepidPoisson_Pamgen_Tpetra_main.cpp +++ b/packages/trilinoscouplings/examples/scaling/StructuredIntrepidPoisson_Pamgen_Tpetra_main.cpp @@ -104,11 +104,11 @@ main (int argc, char *argv[]) typedef TpetraIntrepidPoissonExample::GO GO; #endif // HAVE_TRILINOSCOUPLINGS_MUELU typedef TpetraIntrepidPoissonExample::Node Node; - typedef Teuchos::ScalarTraits STS; - typedef STS::magnitudeType MT; + typedef TpetraIntrepidPoissonExample::MT MT; typedef Teuchos::ScalarTraits STM; typedef TpetraIntrepidPoissonExample::sparse_matrix_type sparse_matrix_type; typedef TpetraIntrepidPoissonExample::vector_type vector_type; + typedef TpetraIntrepidPoissonExample::realmultivector_type realmultivector_type; typedef TpetraIntrepidPoissonExample::operator_type operator_type; bool success = true; @@ -258,13 +258,17 @@ main (int argc, char *argv[]) RCP A; RCP B, X_exact, X; - Teuchos::Array > coordsArray(3); + RCP Coordinates; + Teuchos::Array > coordArrayView(3); + Teuchos::Array > coordsArray(3); Teuchos::Array lNodesPerDim(3); { TEUCHOS_FUNC_TIME_MONITOR_DIFF("Total Assembly", total_assembly); makeMatrixAndRightHandSide (A, B, X_exact, X, coordsArray, lNodesPerDim, comm, node, meshInput, out, err, verbose, debug); } + for(int dim = 0; dim < 3; ++dim) {coordArrayView[dim] = coordsArray[dim]();} + Coordinates = Teuchos::rcp(new realmultivector_type(A->getRowMap(), coordArrayView(), 3)); // Optionally dump the matrix and/or its row Map to files. { @@ -304,6 +308,7 @@ main (int argc, char *argv[]) ParameterList mueluParams = inputList.sublist("MueLu"); const std::string userName = "user data"; Teuchos::ParameterList& userParamList = mueluParams.sublist(userName); + userParamList.set >("Coordinates", Coordinates); userParamList.set >("Array lNodesPerDim", lNodesPerDim); M = MueLu::CreateTpetraPreconditioner(A,mueluParams,mueluParams); } else { diff --git a/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.cpp b/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.cpp index 7cce570f010e..a73ccfb35860 100644 --- a/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.cpp +++ b/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.cpp @@ -156,7 +156,7 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, Teuchos::RCP& B, Teuchos::RCP& X_exact, Teuchos::RCP& X, - Teuchos::Array >& coordArray, + Teuchos::Array >& coordArray, Teuchos::Array& lNodesPerDim, const Teuchos::RCP >& comm, const Teuchos::RCP& node, @@ -183,7 +183,7 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, Teuchos::RCP& B, Teuchos::RCP& X_exact, Teuchos::RCP& X, - Teuchos::Array >& coordArray, + Teuchos::Array >& coordArray, Teuchos::Array& lNodesPerDim, const Teuchos::RCP >& comm, const Teuchos::RCP& node, @@ -357,10 +357,10 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, } // Read node coordinates and place in field container - FieldContainer nodeCoord (numNodes, dim); - ST * nodeCoordx = new ST [numNodes]; - ST * nodeCoordy = new ST [numNodes]; - ST * nodeCoordz = new ST [numNodes]; + FieldContainer nodeCoord (numNodes, dim); + MT * nodeCoordx = new MT [numNodes]; + MT * nodeCoordy = new MT [numNodes]; + MT * nodeCoordz = new MT [numNodes]; im_ex_get_coord_l (id, nodeCoordx, nodeCoordy, nodeCoordz); for (int i=0; i& A, Array ownedGIDs; RCP globalMapG; - Teuchos::Array coordXArray; - Teuchos::Array coordYArray; - Teuchos::Array coordZArray; { TEUCHOS_FUNC_TIME_MONITOR_DIFF("Build global maps", build_maps); @@ -569,9 +566,9 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, // NTS: will need to switch back to long long // Get owned coordinates ownedGIDs.resize(ownedNodes); - coordXArray.resize(ownedNodes); - coordYArray.resize(ownedNodes); - coordZArray.resize(ownedNodes); + coordArray[0].resize(ownedNodes); + coordArray[1].resize(ownedNodes); + coordArray[2].resize(ownedNodes); // It is expected that some nodes are duplicated locally // so the values extracted with lNodePerDim are possibly @@ -619,16 +616,13 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, if (nodeIsOwned[i]) { ownedGIDs[oidx] = as (globalNodeIds[i]); - coordXArray[oidx] = nodeCoord(i,0); - coordYArray[oidx] = nodeCoord(i,1); - coordZArray[oidx] = nodeCoord(i,2); + coordArray[0][oidx] = nodeCoord(i,0); + coordArray[1][oidx] = nodeCoord(i,1); + coordArray[2][oidx] = nodeCoord(i,2); ++oidx; } } - coordArray[0] = coordXArray; - coordArray[1] = coordYArray; - coordArray[2] = coordZArray; globalMapG = rcp (new map_type (-1, ownedGIDs (), 0, comm, node)); } diff --git a/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.hpp b/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.hpp index 7677679d2423..f3f81bf01dc2 100644 --- a/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.hpp +++ b/packages/trilinoscouplings/examples/scaling/TrilinosCouplings_TpetraIntrepidStructuredPoissonExample.hpp @@ -83,6 +83,8 @@ typedef double ST; typedef int LO; typedef int GO; typedef Tpetra::Map<>::node_type Node; +typedef Teuchos::ScalarTraits STS; +typedef STS::magnitudeType MT; // // mfh 19 Apr 2012: If you want to change the template parameters of @@ -91,6 +93,7 @@ typedef Tpetra::Map<>::node_type Node; typedef Tpetra::CrsMatrix sparse_matrix_type; typedef Tpetra::Operator operator_type; typedef Tpetra::MultiVector multivector_type; +typedef Tpetra::MultiVector realmultivector_type; typedef Tpetra::Vector vector_type; /// \brief Create the mesh and build the linear system to solve. @@ -159,7 +162,7 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, Teuchos::RCP& B, Teuchos::RCP& X_exact, Teuchos::RCP& X, - Teuchos::Array >& coordArray, + Teuchos::Array >& coordArray, Teuchos::Array& lNodesPerDim, const Teuchos::RCP >& comm, const Teuchos::RCP& node, @@ -175,7 +178,7 @@ makeMatrixAndRightHandSide (Teuchos::RCP& A, Teuchos::RCP& B, Teuchos::RCP& X_exact, Teuchos::RCP& X, - Teuchos::Array >& coordArray, + Teuchos::Array >& coordArray, Teuchos::Array& lNodesPerDim, const Teuchos::RCP >& comm, const Teuchos::RCP& node, diff --git a/packages/trilinoscouplings/examples/scaling/muelu_geometric_interpolation.xml b/packages/trilinoscouplings/examples/scaling/muelu_geometric_interpolation.xml new file mode 100644 index 000000000000..b6d62bc384a3 --- /dev/null +++ b/packages/trilinoscouplings/examples/scaling/muelu_geometric_interpolation.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/trilinoscouplings/examples/scaling/muelu_structured_aggregation.xml b/packages/trilinoscouplings/examples/scaling/muelu_structured_aggregation.xml index 94aaaceb64cf..44913e4e616e 100644 --- a/packages/trilinoscouplings/examples/scaling/muelu_structured_aggregation.xml +++ b/packages/trilinoscouplings/examples/scaling/muelu_structured_aggregation.xml @@ -40,6 +40,11 @@ + + + + + @@ -89,12 +94,12 @@ - + + - - +