From 7552687981deb27ce0763340e4fd7d53bd41aa64 Mon Sep 17 00:00:00 2001 From: Peter Ohm Date: Wed, 4 Sep 2019 09:30:53 -0600 Subject: [PATCH 01/44] MueLu: region mg chebyshev relaxation added --- .../src/SetupRegionSmoothers_def.hpp | 228 +++++++++++++++++- 1 file changed, 227 insertions(+), 1 deletion(-) diff --git a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp index d49e648f47d4..4defcdfad74b 100644 --- a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp +++ b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp @@ -258,6 +258,230 @@ void GSIterate(RCP smootherParams, return; } // GS + +template +typename Teuchos::ScalarTraits::magnitudeType +calcNorm2(Array > >& regVec, + const RCP > mapComp, + const int maxRegPerProc, + const std::vector > > rowMapPerGrp, + const std::vector > > revisedRowMapPerGrp, + const std::vector > > rowImportPerGrp) +{ +#include "Xpetra_UseShortNames.hpp" + RCP compVec = VectorFactory::Build(mapComp, true); + regionalToComposite(regVec, compVec, maxRegPerProc, rowMapPerGrp, rowImportPerGrp, Xpetra::ADD); + typename Teuchos::ScalarTraits::magnitudeType norm = compVec->norm2(); + + return norm; +} // calcNorm2 + +template +Scalar +dotProd(Array > >& regX, + Array > >& regY, + const RCP > mapComp, + const int maxRegPerProc, + const std::vector > > rowMapPerGrp, + const std::vector > > revisedRowMapPerGrp, + const std::vector > > rowImportPerGrp) +{ +#include "Xpetra_UseShortNames.hpp" + RCP compX = VectorFactory::Build(mapComp, true); + RCP compY = VectorFactory::Build(mapComp, true); + regionalToComposite(regX, compX, maxRegPerProc, rowMapPerGrp, rowImportPerGrp, Xpetra::ADD); + regionalToComposite(regY, compY, maxRegPerProc, rowMapPerGrp, rowImportPerGrp, Xpetra::ADD); + SC dotVal = compX->dot(*compY); + + return dotVal; +} // dotProd + +template +Scalar +powerMethod(RCP params, + const int maxRegPerProc, + const std::vector > > regionGrpMats, + const Array > > regionInterfaceScaling, + // const std::vector > > regionInterfaceScaling, + const RCP > mapComp, + const std::vector > > rowMapPerGrp, + const std::vector > > revisedRowMapPerGrp, + const std::vector > > rowImportPerGrp, + const int numIters) +{ +#include "Xpetra_UseShortNames.hpp" + + Teuchos::Array > diagInv = params->get > >("chebyshev: inverse diagonal"); + const SC SC_ZERO = Teuchos::ScalarTraits::zero(); + const SC SC_ONE = Teuchos::ScalarTraits::one(); + SC lambdaMax = SC_ZERO; + SC RQ_top, RQ_bottom, norm; + + Array > regX(maxRegPerProc); + createRegionalVector(regX, maxRegPerProc, revisedRowMapPerGrp); + Array > regY(maxRegPerProc); + createRegionalVector(regY, maxRegPerProc, revisedRowMapPerGrp); + + for( int j = 0; j < maxRegPerProc; j++){ + regX[j]->randomize(); + } + norm = calcNorm2(regX, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); + for (int j = 0; j < maxRegPerProc; j++) { + regX[j]->scale( SC_ONE / norm ); + } + + for (int iter = 0; iter < numIters; ++iter) { + + for (int j = 0; j < maxRegPerProc; j++) { // step 1 + regionGrpMats[j]->apply(*regX[j], *regY[j]); // A.apply (x, y); + } + sumInterfaceValues( regY, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); // step 2 + + // Scale by inverse of diagonal + for (int j = 0; j < maxRegPerProc; j++){ + regY[j]->elementWiseMultiply(SC_ONE, *diagInv[j], *regY[j], SC_ZERO); + } + + RQ_top = dotProd( regY, regX, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); + RQ_bottom = dotProd( regX, regX, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); + lambdaMax = RQ_top / RQ_bottom; + + norm = calcNorm2(regY, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); + + if (norm == SC_ZERO) { // Return something reasonable. + return SC_ZERO; + } + for (int j = 0; j < maxRegPerProc; j++) { + regX[j]->update( SC_ONE / norm, *regY[j], SC_ZERO); + } + + } + + return lambdaMax; +} // powerMethod + +/*! \brief performs Chebyshev setup + */ +template +void chebyshevSetup(RCP params, + const int maxRegPerProc, + const std::vector > > regionGrpMats, + const Array > > regionInterfaceScaling, + // const std::vector > > regionInterfaceScaling, + const RCP > mapComp, + const std::vector > > rowMapPerGrp, + const std::vector > > revisedRowMapPerGrp, + const std::vector > > rowImportPerGrp) { +#include "Xpetra_UseShortNames.hpp" + const Scalar SC_ZERO = Teuchos::ScalarTraits::zero(); + const Scalar SC_ONE = Teuchos::ScalarTraits::one(); + + Array > regRes(maxRegPerProc); + createRegionalVector(regRes, maxRegPerProc, revisedRowMapPerGrp); + + // extract diagonal from region matrices, recover true diagonal values, invert diagonal + Teuchos::Array > diag(maxRegPerProc); + for (int j = 0; j < maxRegPerProc; j++) { + // extract inverse of diagonal from matrix + diag[j] = VectorFactory::Build(regionGrpMats[j]->getRowMap(), true); + regionGrpMats[j]->getLocalDiagCopy(*diag[j]); + diag[j]->elementWiseMultiply(SC_ONE, *diag[j], *regionInterfaceScaling[j], SC_ZERO); // ToDo Does it work to pass in diag[j], but also return into the same variable? + diag[j]->reciprocal(*diag[j]); + } + + params->set > >("chebyshev: inverse diagonal", diag); + + // Calculate lambdaMax + Scalar lambdaMax = 1; + lambdaMax = powerMethod( params, + maxRegPerProc, + regionGrpMats, + regionInterfaceScaling, + mapComp, + rowMapPerGrp, + revisedRowMapPerGrp, + rowImportPerGrp, + 1000); + params->set< Scalar >("chebyshev: lambda max", lambdaMax ); + +} // chebyshevSetup + +template +void chebyshevIterate ( RCP params, + Array > >& regX, // left-hand side (or solution) + const Array > > regB, // right-hand side (or residual) + const std::vector > > regionGrpMats, // matrices in true region layout + const Array > > regionInterfaceScaling, // recreate on coarse grid by import Add on region vector of ones + const int maxRegPerProc, ///< max number of regions per proc [in] + const RCP > mapComp, ///< composite map + const std::vector > > rowMapPerGrp, ///< row maps in region layout [in] requires the mapping of GIDs on fine mesh to "filter GIDs" + const std::vector > > revisedRowMapPerGrp, ///< revised row maps in region layout [in] (actually extracted from regionGrpMats) + const std::vector > > rowImportPerGrp ///< row importer in region layout [in] + ) +{ +#include "Xpetra_UseShortNames.hpp" + const int maxIter = params->get ("smoother: sweeps"); + Scalar lambdaMax = params->get("chebyshev: lambda max"); + + Teuchos::Array > diag_inv = params->get > >("chebyshev: inverse diagonal"); + + const Scalar eigRatio = 4; // 30 is Ifpack2 default + const Scalar lambdaMin = lambdaMax / eigRatio; + + const Scalar SC_ZERO = Teuchos::ScalarTraits::zero(); + const Scalar SC_ONE = Teuchos::ScalarTraits::one(); + const Scalar SC_TWO = Teuchos::as (2); + + const Scalar d = (lambdaMax + lambdaMin) / SC_TWO;// Ifpack2 calls this theta + const Scalar c = (lambdaMax - lambdaMin) / SC_TWO;// Ifpack2 calls this 1/delta + + Array > regRes(maxRegPerProc); + createRegionalVector(regRes, maxRegPerProc, revisedRowMapPerGrp); + + Array > regP(maxRegPerProc); + createRegionalVector(regP, maxRegPerProc, revisedRowMapPerGrp); + Array > regZ(maxRegPerProc); + createRegionalVector(regZ, maxRegPerProc, revisedRowMapPerGrp); + + Scalar alpha, beta; + + for (int i = 0; i < maxIter; ++i) { + // Compute residual vector + for (int j = 0; j < maxRegPerProc; j++) { // step 1 + regionGrpMats[j]->apply(*regX[j], *regRes[j]); + } + sumInterfaceValues(regRes, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); // step 2 + for (int j = 0; j < maxRegPerProc; j++) { // step 3 + regRes[j]->update(1.0, *regB[j], -1.0); + } + + //solve (Z, D_inv, R); // z = D_inv * R, that is, D \ R. + for(int j = 0; j < maxRegPerProc; j++) { + regZ[j]->elementWiseMultiply(SC_ONE, *diag_inv[j], *regRes[j], SC_ZERO); + } + if (i == 0) { + for (int j=0; j < maxRegPerProc; j++) { + regP[j]->update( SC_ONE, *regZ[j], SC_ZERO); // P = Z + } + alpha = SC_TWO / d;//if2 + } else { + beta = alpha * ( c / SC_TWO ) * ( c / SC_TWO ); //if2 + alpha = SC_ONE / ( d - beta ); //if2 + for (int j=0; j < maxRegPerProc; j++) { + regP[j]->update( SC_ONE, *regZ[j], beta);// P = Z + beta*P + } + } + for (int j=0; j < maxRegPerProc; j++) { + regX[j]->update( alpha, *regP[j], SC_ONE);// X = X + alpha*P + } + + // If we compute the residual here, we could either do R = B - + // A*X, or R = R - alpha*A*P. Since we choose the former, we + // can move the computeResidual call to the top of the loop. + } +} // chebyshevIterate + + template void smootherSetup(RCP params, const int maxRegPerProc, @@ -286,7 +510,7 @@ void smootherSetup(RCP params, } case 3: { - std::cout << "Chebyshev smoother not implemented yet. No smoother is applied" << std::endl; + chebyshevSetup(params, maxRegPerProc, regionGrpMats, regionInterfaceScaling, mapComp, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); break; } default: @@ -330,6 +554,8 @@ void smootherApply(RCP params, break; } case 3: + chebyshevIterate(params, regX, regB, regionGrpMats, regionInterfaceScaling, maxRegPerProc, + mapComp, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); { break; } From 3dc2e308645ce3ba8ea85d00245b86914394fdab Mon Sep 17 00:00:00 2001 From: Peter Ohm Date: Tue, 24 Sep 2019 11:35:59 -0600 Subject: [PATCH 02/44] MueLu: for regionMG moved computeResidual to SetupRegionMatrix_def. Smoothers now use computeResidual --- .../src/SetupRegionHierarchy_def.hpp | 56 ------------------- .../src/SetupRegionMatrix_def.hpp | 55 ++++++++++++++++++ .../src/SetupRegionSmoothers_def.hpp | 51 +++++------------ .../structured/Driver_Structured_Regions.cpp | 2 + 4 files changed, 70 insertions(+), 94 deletions(-) diff --git a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionHierarchy_def.hpp b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionHierarchy_def.hpp index 3c87183c6526..c51e74d30f91 100644 --- a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionHierarchy_def.hpp +++ b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionHierarchy_def.hpp @@ -717,62 +717,6 @@ void createRegionHierarchy(const int maxRegPerProc, } -/*! \brief Compute the residual \f$r = b - Ax\f$ - * - * The residual is computed based on matrices and vectors in a regional layout. - * 1. Compute y = A*x in regional layout. - * 2. Sum interface values of y to account for duplication of interface DOFs. - * 3. Compute r = b - y - */ -template -Array > > -computeResidual(Array > >& regRes, ///< residual (to be evaluated) - const Array > > regX, ///< left-hand side (solution) - const Array > > regB, ///< right-hand side (forcing term) - const std::vector > > regionGrpMats, - const RCP > mapComp, ///< composite map, computed by removing GIDs > numDofs in revisedRowMapPerGrp - const std::vector > > rowMapPerGrp, ///< row maps in region layout [in] requires the mapping of GIDs on fine mesh to "filter GIDs" - const std::vector > > revisedRowMapPerGrp, ///< revised row maps in region layout [in] (actually extracted from regionGrpMats) - const std::vector > > rowImportPerGrp ///< row importer in region layout [in] - ) -{ -#include "Xpetra_UseShortNames.hpp" - using Teuchos::TimeMonitor; - const int maxRegPerProc = regX.size(); - - RCP tm = rcp(new TimeMonitor(*TimeMonitor::getNewTimer("computeResidual: 1 - Rreg = Areg*Xreg"))); - - /* Update the residual vector - * 1. Compute tmp = A * regX in each region - * 2. Sum interface values in tmp due to duplication (We fake this by scaling to reverse the basic splitting) - * 3. Compute r = B - tmp - */ - for (int j = 0; j < maxRegPerProc; j++) { // step 1 - regionGrpMats[j]->apply(*regX[j], *regRes[j]); - // TEUCHOS_ASSERT(regionGrpMats[j]->getDomainMap()->isSameAs(*regX[j]->getMap())); - // TEUCHOS_ASSERT(regionGrpMats[j]->getRangeMap()->isSameAs(*regRes[j]->getMap())); - } - - tm = Teuchos::null; - tm = rcp(new TimeMonitor(*TimeMonitor::getNewTimer("computeResidual: 2 - sumInterfaceValues"))); - - sumInterfaceValues(regRes, mapComp, maxRegPerProc, rowMapPerGrp, - revisedRowMapPerGrp, rowImportPerGrp); - - tm = Teuchos::null; - tm = rcp(new TimeMonitor(*TimeMonitor::getNewTimer("computeResidual: 3 - Rreg = Breg - Rreg"))); - - for (int j = 0; j < maxRegPerProc; j++) { // step 3 - regRes[j]->update(1.0, *regB[j], -1.0); - // TEUCHOS_ASSERT(regRes[j]->getMap()->isSameAs(*regB[j]->getMap())); - } - - tm = Teuchos::null; - - return regRes; -} // computeResidual - - //! Recursive V-cycle in region fashion template void vCycle(const int l, ///< ID of current level diff --git a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionMatrix_def.hpp b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionMatrix_def.hpp index 1e91a3750230..cacefa853cb4 100644 --- a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionMatrix_def.hpp +++ b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionMatrix_def.hpp @@ -712,4 +712,59 @@ void regionalToComposite(const std::vector +Array > > +computeResidual(Array > >& regRes, ///< residual (to be evaluated) + const Array > > regX, ///< left-hand side (solution) + const Array > > regB, ///< right-hand side (forcing term) + const std::vector > > regionGrpMats, + const RCP > mapComp, ///< composite map, computed by removing GIDs > numDofs in revisedRowMapPerGrp + const std::vector > > rowMapPerGrp, ///< row maps in region layout [in] requires the mapping of GIDs on fine mesh to "filter GIDs" + const std::vector > > revisedRowMapPerGrp, ///< revised row maps in region layout [in] (actually extracted from regionGrpMats) + const std::vector > > rowImportPerGrp ///< row importer in region layout [in] + ) +{ +#include "Xpetra_UseShortNames.hpp" + using Teuchos::TimeMonitor; + const int maxRegPerProc = regX.size(); + + RCP tm = rcp(new TimeMonitor(*TimeMonitor::getNewTimer("computeResidual: 1 - Rreg = Areg*Xreg"))); + + /* Update the residual vector + * 1. Compute tmp = A * regX in each region + * 2. Sum interface values in tmp due to duplication (We fake this by scaling to reverse the basic splitting) + * 3. Compute r = B - tmp + */ + for (int j = 0; j < maxRegPerProc; j++) { // step 1 + regionGrpMats[j]->apply(*regX[j], *regRes[j]); + // TEUCHOS_ASSERT(regionGrpMats[j]->getDomainMap()->isSameAs(*regX[j]->getMap())); + // TEUCHOS_ASSERT(regionGrpMats[j]->getRangeMap()->isSameAs(*regRes[j]->getMap())); + } + + tm = Teuchos::null; + tm = rcp(new TimeMonitor(*TimeMonitor::getNewTimer("computeResidual: 2 - sumInterfaceValues"))); + + sumInterfaceValues(regRes, mapComp, maxRegPerProc, rowMapPerGrp, + revisedRowMapPerGrp, rowImportPerGrp); + + tm = Teuchos::null; + tm = rcp(new TimeMonitor(*TimeMonitor::getNewTimer("computeResidual: 3 - Rreg = Breg - Rreg"))); + + for (int j = 0; j < maxRegPerProc; j++) { // step 3 + regRes[j]->update(1.0, *regB[j], -1.0); + // TEUCHOS_ASSERT(regRes[j]->getMap()->isSameAs(*regB[j]->getMap())); + } + + tm = Teuchos::null; + + return regRes; +} // computeResidual + #endif // MUELU_SETUPREGIONMATRIX_DEF_HPP diff --git a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp index 4defcdfad74b..0be2d8dac996 100644 --- a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp +++ b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp @@ -163,17 +163,7 @@ void jacobiIterate(RCP smootherParams, * 2. Sum interface values in tmp due to duplication (We fake this by scaling to reverse the basic splitting) * 3. Compute r = B - tmp */ - for (int j = 0; j < maxRegPerProc; j++) { // step 1 - - regionGrpMats[j]->apply(*regX[j], *regRes[j]); - } - - sumInterfaceValues(regRes, mapComp, maxRegPerProc, rowMapPerGrp, - revisedRowMapPerGrp, rowImportPerGrp); // step 2 - - for (int j = 0; j < maxRegPerProc; j++) { // step 3 - regRes[j]->update(SC_ONE, *regB[j], -SC_ONE); - } + computeResidual( regRes, regX, regB, regionGrpMats, mapComp, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp ); // update solution according to Jacobi's method for (int j = 0; j < maxRegPerProc; j++) { @@ -218,16 +208,7 @@ void GSIterate(RCP smootherParams, * 2. Sum interface values in tmp due to duplication (We fake this by scaling to reverse the basic splitting) * 3. Compute r = B - tmp */ - for (int j = 0; j < maxRegPerProc; j++) { // step 1 - regionGrpMats[j]->apply(*regX[j], *regRes[j]); - } - - sumInterfaceValues(regRes, mapComp, maxRegPerProc, rowMapPerGrp, - revisedRowMapPerGrp, rowImportPerGrp); - - for (int j = 0; j < maxRegPerProc; j++) { // step 3 - regRes[j]->update(1.0, *regB[j], -1.0); - } + computeResidual( regRes, regX, regB, regionGrpMats, mapComp, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp ); // update the solution and the residual @@ -302,7 +283,6 @@ powerMethod(RCP params, const int maxRegPerProc, const std::vector > > regionGrpMats, const Array > > regionInterfaceScaling, - // const std::vector > > regionInterfaceScaling, const RCP > mapComp, const std::vector > > rowMapPerGrp, const std::vector > > revisedRowMapPerGrp, @@ -367,7 +347,6 @@ void chebyshevSetup(RCP params, const int maxRegPerProc, const std::vector > > regionGrpMats, const Array > > regionInterfaceScaling, - // const std::vector > > regionInterfaceScaling, const RCP > mapComp, const std::vector > > rowMapPerGrp, const std::vector > > revisedRowMapPerGrp, @@ -406,6 +385,8 @@ void chebyshevSetup(RCP params, } // chebyshevSetup +/*! \brief The textbook Chebyshev algorithm from Ifpack2 translated into the region format + */ template void chebyshevIterate ( RCP params, Array > >& regX, // left-hand side (or solution) @@ -420,14 +401,14 @@ void chebyshevIterate ( RCP params, ) { #include "Xpetra_UseShortNames.hpp" - const int maxIter = params->get ("smoother: sweeps"); - Scalar lambdaMax = params->get("chebyshev: lambda max"); + const int maxIter = params->get ("smoother: sweeps"); + const Scalar eigRatio = params->get("smoother: eigRatio"); + const Scalar lambdaMax = params->get("chebyshev: lambda max"); + const Scalar lambdaMin = lambdaMax / eigRatio; + std::cout< > diag_inv = params->get > >("chebyshev: inverse diagonal"); - const Scalar eigRatio = 4; // 30 is Ifpack2 default - const Scalar lambdaMin = lambdaMax / eigRatio; - const Scalar SC_ZERO = Teuchos::ScalarTraits::zero(); const Scalar SC_ONE = Teuchos::ScalarTraits::one(); const Scalar SC_TWO = Teuchos::as (2); @@ -447,13 +428,7 @@ void chebyshevIterate ( RCP params, for (int i = 0; i < maxIter; ++i) { // Compute residual vector - for (int j = 0; j < maxRegPerProc; j++) { // step 1 - regionGrpMats[j]->apply(*regX[j], *regRes[j]); - } - sumInterfaceValues(regRes, mapComp, maxRegPerProc, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp); // step 2 - for (int j = 0; j < maxRegPerProc; j++) { // step 3 - regRes[j]->update(1.0, *regB[j], -1.0); - } + computeResidual( regRes, regX, regB, regionGrpMats, mapComp, rowMapPerGrp, revisedRowMapPerGrp, rowImportPerGrp ); //solve (Z, D_inv, R); // z = D_inv * R, that is, D \ R. for(int j = 0; j < maxRegPerProc; j++) { @@ -463,10 +438,10 @@ void chebyshevIterate ( RCP params, for (int j=0; j < maxRegPerProc; j++) { regP[j]->update( SC_ONE, *regZ[j], SC_ZERO); // P = Z } - alpha = SC_TWO / d;//if2 + alpha = SC_TWO / d; } else { - beta = alpha * ( c / SC_TWO ) * ( c / SC_TWO ); //if2 - alpha = SC_ONE / ( d - beta ); //if2 + beta = alpha * ( c / SC_TWO ) * ( c / SC_TWO ); + alpha = SC_ONE / ( d - beta ); for (int j=0; j < maxRegPerProc; j++) { regP[j]->update( SC_ONE, *regZ[j], beta);// P = Z + beta*P } diff --git a/packages/muelu/research/regionMG/examples/structured/Driver_Structured_Regions.cpp b/packages/muelu/research/regionMG/examples/structured/Driver_Structured_Regions.cpp index 984bcb1fef23..03bec79b5c9e 100644 --- a/packages/muelu/research/regionMG/examples/structured/Driver_Structured_Regions.cpp +++ b/packages/muelu/research/regionMG/examples/structured/Driver_Structured_Regions.cpp @@ -169,6 +169,7 @@ int main_(Teuchos::CommandLineProcessor &clp, Xpetra::UnderlyingLib& lib, int ar std::string smootherType = "Jacobi"; clp.setOption("smootherType", &smootherType, "smoother to be used: (None | Jacobi | Gauss | Chebyshev)"); int smootherIts = 2; clp.setOption("smootherIts", &smootherIts, "number of smoother iterations"); double smootherDamp = 0.67; clp.setOption("smootherDamp", &smootherDamp, "damping parameter for the level smoother"); + double smootherEigRatio = 2.0; clp.setOption("smootherEigRatio", &smootherEigRatio, "eigenvalue ratio max/min used to approximate the smallest eigenvalue for Chebyshev relaxation"); double tol = 1e-12; clp.setOption("tol", &tol, "solver convergence tolerance"); bool scaleResidualHist = true; clp.setOption("scale", "noscale", &scaleResidualHist, "scaled Krylov residual history"); bool serialRandom = false; clp.setOption("use-serial-random", "no-use-serial-random", &serialRandom, "generate the random vector serially and then broadcast it"); @@ -218,6 +219,7 @@ int main_(Teuchos::CommandLineProcessor &clp, Xpetra::UnderlyingLib& lib, int ar smootherParams[0]->set("smoother: type", smootherType); smootherParams[0]->set("smoother: sweeps", smootherIts); smootherParams[0]->set("smoother: damping", smootherDamp); + smootherParams[0]->set("smoother: eigRatio", smootherEigRatio); bool useUnstructured = false; Array unstructuredRanks = Teuchos::fromStringToArray(unstructured); From 35ee68c091a06fe85d024b4a74a56f38243f879e Mon Sep 17 00:00:00 2001 From: Matthias Mayr Date: Tue, 24 Sep 2019 20:28:54 +0200 Subject: [PATCH 03/44] MueLu: remove regionMG Chebyshev debut output --- .../mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp index 0be2d8dac996..c33a4390b2aa 100644 --- a/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp +++ b/packages/muelu/research/mmayr/composite_to_regions/src/SetupRegionSmoothers_def.hpp @@ -405,7 +405,6 @@ void chebyshevIterate ( RCP params, const Scalar eigRatio = params->get("smoother: eigRatio"); const Scalar lambdaMax = params->get("chebyshev: lambda max"); const Scalar lambdaMin = lambdaMax / eigRatio; - std::cout< > diag_inv = params->get > >("chebyshev: inverse diagonal"); From 478a52c37e00d41a2d7802a87d91aa948319cc1e Mon Sep 17 00:00:00 2001 From: Matthias Mayr Date: Tue, 24 Sep 2019 20:29:22 +0200 Subject: [PATCH 04/44] MueLu: add regionMG Chebyshev completion tests --- .../regionMG/examples/structured/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/muelu/research/regionMG/examples/structured/CMakeLists.txt b/packages/muelu/research/regionMG/examples/structured/CMakeLists.txt index 690f957d6c5f..631b5c59df4e 100644 --- a/packages/muelu/research/regionMG/examples/structured/CMakeLists.txt +++ b/packages/muelu/research/regionMG/examples/structured/CMakeLists.txt @@ -74,6 +74,22 @@ IF (${PACKAGE_NAME}_ENABLE_Tpetra AND ${PACKAGE_NAME}_ENABLE_Amesos2) NUM_MPI_PROCS 4 ) + TRIBITS_ADD_TEST( + StructuredRegionDriver + NAME "Structured_Region_Star2D_Tpetra_Chebyshev" + ARGS "--linAlgebra=Tpetra --xml=structured_1dof.xml --matrixType=Star2D --nx=10 --ny=10 --smootherIts=2 --convergence-log=Star2D_Chebyshev_1.log --smootherType=Chebyshev" + COMM serial mpi + NUM_MPI_PROCS 1 + ) + + TRIBITS_ADD_TEST( + StructuredRegionDriver + NAME "Structured_Region_Star2D_Tpetra_Chebyshev" + ARGS "--linAlgebra=Tpetra --xml=structured_1dof.xml --matrixType=Star2D --nx=10 --ny=10 --smootherIts=2 --convergence-log=Star2D_Chebyshev_4.log --smootherType=Chebyshev" + COMM serial mpi + NUM_MPI_PROCS 4 + ) + TRIBITS_ADD_TEST( StructuredRegionDriver NAME "Structured_Region_Star2D_AMG_CoarseSolver_Tpetra" From 2aaf324d446373c6432a0fc941a3bc5aa1471667 Mon Sep 17 00:00:00 2001 From: Alan Williams Date: Tue, 15 Oct 2019 13:08:23 -0600 Subject: [PATCH 05/44] Bring stk snapshot to trilinos as of 10/14/2019 --- .../stk/stk_balance/stk_balance/balance.cpp | 30 +- .../stk/stk_io/stk_io/ProcessSetsOrBlocks.cpp | 2 +- .../stk/stk_io/stk_io/StkMeshIoBroker.hpp | 2 - .../stk/stk_mesh/stk_mesh/base/Bucket.cpp | 11 +- .../stk/stk_mesh/stk_mesh/base/Bucket.hpp | 6 +- .../stk/stk_mesh/stk_mesh/base/BulkData.cpp | 653 +++++++++++------- .../stk/stk_mesh/stk_mesh/base/BulkData.hpp | 99 ++- .../stk_mesh/base/BulkDataInlinedMethods.hpp | 93 ++- .../stk_mesh/base/CommListUpdater.hpp | 7 +- .../stk_mesh/base/EntityCommDatabase.cpp | 32 +- .../stk_mesh/base/EntityCommDatabase.hpp | 21 +- .../stk_mesh/base/EntityCommListInfo.hpp | 1 - .../stk_mesh/base/FieldDataManager.cpp | 6 +- .../stk_mesh/stk_mesh/base/FieldParallel.cpp | 18 +- .../stk_mesh/stk_mesh/base/FieldParallel.hpp | 96 +-- .../stk/stk_mesh/stk_mesh/base/Ghosting.cpp | 10 +- .../stk/stk_mesh/stk_mesh/base/Ghosting.hpp | 10 +- .../stk/stk_mesh/stk_mesh/base/MetaData.cpp | 100 ++- .../stk/stk_mesh/stk_mesh/base/MetaData.hpp | 12 +- .../stk_mesh/base/ModificationSummary.hpp | 5 + .../stk_mesh/baseImpl/MeshImplUtils.cpp | 171 ++++- .../stk_mesh/baseImpl/MeshImplUtils.hpp | 82 ++- .../stk_mesh/baseImpl/MeshModification.cpp | 2 +- .../stk_mesh/baseImpl/check_comm_list.cpp | 33 +- .../stk_mesh/baseImpl/check_comm_list.hpp | 4 +- packages/stk/stk_ngp/stk_ngp/NgpField.hpp | 9 +- .../stk/stk_ngp/stk_ngp/NgpFieldManager.hpp | 6 + .../UnitTestNaluPerformance.cpp | 2 +- .../stk/stk_search/stk_search/BoundingBox.hpp | 30 +- packages/stk/stk_search/stk_search/Box.hpp | 16 +- packages/stk/stk_search/stk_search/Point.hpp | 7 + .../unit_tests/UnitTestBoundingBox.cpp | 216 ++++-- packages/stk/stk_simd.tar.gz | Bin 47807 -> 0 bytes .../stk_tools/mesh_clone/MeshClone.cpp | 7 +- .../mesh_tools/DisconnectBlocksImpl.cpp | 2 +- .../copy_by_id/SearchByIdGeometric.cpp | 2 +- .../stk_unit_test_utils/BulkDataTester.hpp | 19 +- .../stk_io/UnitTestMeshData.cpp | 36 + .../stk_mesh/UnitTestBulkData.cpp | 55 +- .../stk_mesh/UnitTestBulkData_new.cpp | 2 +- .../stk_mesh/UnitTestCEOCommonUtils.cpp | 24 +- .../stk_mesh/UnitTestCheckCommList.cpp | 106 --- .../stk_mesh/UnitTestEntityCommDatabase.cpp | 5 +- .../stk_mesh/UnitTestGhostingWithShared.cpp | 20 + .../stk_mesh/UnitTestMetaData.cpp | 2 +- .../stk_mesh/UnitTestPartitions.cpp | 1 - .../BulkDataElementGraphTester.hpp | 7 +- .../element_graph/UnitTestElementDeath.cpp | 13 +- .../stk/stk_unit_tests/stk_ngp/howToNgp.cpp | 88 ++- .../mesh_clone/UnitTestMeshClone.cpp | 4 +- .../stk_unit_tests/stk_util/schedulerTest.cpp | 18 + .../stk_util/environment/Scheduler.cpp | 2 +- .../stk_util/parallel/CommNeighbors.hpp | 2 +- 53 files changed, 1392 insertions(+), 815 deletions(-) delete mode 100644 packages/stk/stk_simd.tar.gz delete mode 100644 packages/stk/stk_unit_tests/stk_mesh/UnitTestCheckCommList.cpp diff --git a/packages/stk/stk_balance/stk_balance/balance.cpp b/packages/stk/stk_balance/stk_balance/balance.cpp index 6a383104e346..ba8e8b98c6f1 100644 --- a/packages/stk/stk_balance/stk_balance/balance.cpp +++ b/packages/stk/stk_balance/stk_balance/balance.cpp @@ -390,7 +390,7 @@ void initial_decomp_and_balance(stk::mesh::BulkData &bulk, run_static_stk_balance_with_settings(stkInput, bulk, outputFilename, bulk.parallel(), graphOptions); } -void run_stk_balance_with_settings(const std::string& outputFilename, const std::string& exodusFilename, MPI_Comm comm, stk::balance::BalanceSettings& graphOptions) +void run_stk_balance_with_settings(const std::string& outputFilename, const std::string& exodusFilename, MPI_Comm comm, stk::balance::BalanceSettings& balanceSettings) { const std::string trimmedInputName = (exodusFilename.substr(0,2) == "./") ? exodusFilename.substr(2) : exodusFilename; const std::string trimmedOutputName = (outputFilename.substr(0,2) == "./") ? outputFilename.substr(2) : outputFilename; @@ -404,26 +404,40 @@ void run_stk_balance_with_settings(const std::string& outputFilename, const std: const std::string initialDecompMethod = "RIB"; stk::mesh::MetaData meta; stk::mesh::BulkData bulk(meta, comm); - initial_decomp_and_balance(bulk, graphOptions, exodusFilename, outputFilename, initialDecompMethod); + meta.set_coordinate_field_name(balanceSettings.getCoordinateFieldName()); + + initial_decomp_and_balance(bulk, balanceSettings, exodusFilename, outputFilename, initialDecompMethod); } +class StkBalanceSettings : public GraphCreationSettings +{ +public: + StkBalanceSettings() + : GraphCreationSettings() + {} + + std::string getCoordinateFieldName() const override { + return "balance_coordinates"; + } +}; + void run_stk_rebalance(const std::string& outputDirectory, const std::string& inputFile, stk::balance::AppTypeDefaults appType, MPI_Comm comm) { - stk::balance::GraphCreationSettings graphOptions; + StkBalanceSettings balanceSettings; if (appType == stk::balance::SD_DEFAULTS) { - graphOptions.setShouldFixSpiders(true); + balanceSettings.setShouldFixSpiders(true); } else if (appType == stk::balance::SM_DEFAULTS) { - graphOptions.setEdgeWeightForSearch(3.0); - graphOptions.setVertexWeightMultiplierForVertexInSearch(10.0); - graphOptions.setToleranceFunctionForFaceSearch(std::make_shared()); + balanceSettings.setEdgeWeightForSearch(3.0); + balanceSettings.setVertexWeightMultiplierForVertexInSearch(10.0); + balanceSettings.setToleranceFunctionForFaceSearch(std::make_shared()); } std::string outputFilename = construct_output_file_name(outputDirectory, inputFile); - run_stk_balance_with_settings(outputFilename, inputFile, comm, graphOptions); + run_stk_balance_with_settings(outputFilename, inputFile, comm, balanceSettings); } } diff --git a/packages/stk/stk_io/stk_io/ProcessSetsOrBlocks.cpp b/packages/stk/stk_io/stk_io/ProcessSetsOrBlocks.cpp index 26d14825a129..2dc6d668a128 100644 --- a/packages/stk/stk_io/stk_io/ProcessSetsOrBlocks.cpp +++ b/packages/stk/stk_io/stk_io/ProcessSetsOrBlocks.cpp @@ -46,7 +46,7 @@ void process_nodeblocks(Ioss::Region ®ion, stk::mesh::MetaData &meta) assert(node_blocks.size() == 1); stk::mesh::Field& coord_field = - meta.declare_field >(stk::topology::NODE_RANK, stk::io::CoordinateFieldName); + meta.declare_field >(stk::topology::NODE_RANK, meta.coordinate_field_name()); stk::io::set_field_role(coord_field, Ioss::Field::MESH); meta.set_coordinate_field(&coord_field); diff --git a/packages/stk/stk_io/stk_io/StkMeshIoBroker.hpp b/packages/stk/stk_io/stk_io/StkMeshIoBroker.hpp index a49e9e72c822..fc5341752dbf 100644 --- a/packages/stk/stk_io/stk_io/StkMeshIoBroker.hpp +++ b/packages/stk/stk_io/stk_io/StkMeshIoBroker.hpp @@ -76,8 +76,6 @@ namespace Ioss { class DatabaseIO; } namespace stk { namespace io { - static std::string CoordinateFieldName("coordinates"); - struct QaRecord { std::string name; diff --git a/packages/stk/stk_mesh/stk_mesh/base/Bucket.cpp b/packages/stk/stk_mesh/stk_mesh/base/Bucket.cpp index 6a6f8f378271..f01c88cb71f8 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/Bucket.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/Bucket.cpp @@ -270,9 +270,7 @@ Bucket::Bucket( BulkData & arg_mesh , , m_capacity(arg_capacity) , m_size(0) , m_bucket_id(bucket_id) -// TODO: Move owner ranks to BulkData , m_entities(arg_capacity) - , m_owner_ranks(arg_capacity) , m_partition(nullptr) , m_node_kind(INVALID_CONNECTIVITY_TYPE) , m_edge_kind(INVALID_CONNECTIVITY_TYPE) @@ -314,7 +312,6 @@ size_t Bucket::memory_size_in_bytes() const { size_t bytes = sizeof(Bucket); bytes += impl::capacity_in_bytes(m_entities); - bytes += impl::capacity_in_bytes(m_owner_ranks); bytes += m_fixed_node_connectivity.heap_memory_in_bytes(); bytes += m_fixed_edge_connectivity.heap_memory_in_bytes(); bytes += m_fixed_face_connectivity.heap_memory_in_bytes(); @@ -640,20 +637,22 @@ size_t Bucket::get_others_index_count(size_type bucket_ordinal, EntityRank rank) void Bucket::initialize_slot(size_type ordinal, Entity entity) { m_entities[ordinal] = entity; - m_owner_ranks[ordinal] = 0; if (mesh().is_valid(entity)) { mesh().set_state(entity, Created); } } +int Bucket::parallel_owner_rank(size_type ordinal) const +{ + return m_mesh.parallel_owner_rank(m_entities[ordinal]); +} + void Bucket::reset_entity_location(Entity entity, size_type to_ordinal, const FieldVector* fields) { Bucket & from_bucket = mesh().bucket(entity); const Bucket::size_type from_ordinal = mesh().bucket_ordinal(entity); - const int owner_rank = mesh().parallel_owner_rank(entity); m_entities[to_ordinal] = entity; - m_owner_ranks[to_ordinal] = owner_rank; mesh().set_mesh_index(entity, this, to_ordinal); diff --git a/packages/stk/stk_mesh/stk_mesh/base/Bucket.hpp b/packages/stk/stk_mesh/stk_mesh/base/Bucket.hpp index 086c0660e4e6..141be5613b91 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/Bucket.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/Bucket.hpp @@ -143,7 +143,6 @@ class Bucket // Entity data std::vector m_entities; // Array of entity handles; will be removed soon - std::vector m_owner_ranks; impl::Partition *m_partition; @@ -267,10 +266,7 @@ class Bucket /// Entity member functions are moved here: /// - int parallel_owner_rank(size_type ordinal) const - { - return m_owner_ranks[ordinal]; - } + int parallel_owner_rank(size_type ordinal) const; void check_size_invariant() const; diff --git a/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp b/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp index 425545517c3c..9653a88593d4 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp @@ -476,7 +476,9 @@ BulkData::BulkData( MetaData & mesh_meta_data m_mesh_indexes(), m_entity_repo(new impl::EntityRepository()), m_entity_comm_list(), - m_comm_list_updater(m_entity_comm_list), + m_entitycomm(), + m_owner(), + m_comm_list_updater(m_entity_comm_list, m_entitycomm), m_deleted_entities_current_modification_cycle(), m_ghost_reuse_map(), m_entity_keys(), @@ -744,6 +746,8 @@ Entity BulkData::generate_new_entity(unsigned preferred_offset) if (new_local_offset == m_mesh_indexes.size()) { m_mesh_indexes.push_back(mesh_index); m_entity_keys.push_back(invalid_key); + m_entitycomm.push_back(nullptr); + m_owner.push_back(parallel_rank()); m_meshModification.add_created_entity_state(); m_mark_entity.push_back(NOT_MARKED); m_closure_count.push_back(static_cast(0)); @@ -761,6 +765,8 @@ Entity BulkData::generate_new_entity(unsigned preferred_offset) m_mesh_indexes[new_local_offset] = mesh_index; m_entity_keys[new_local_offset] = invalid_key; + m_entitycomm[new_local_offset] = nullptr; + m_owner[new_local_offset] = parallel_rank(); m_mark_entity[new_local_offset] = NOT_MARKED; m_meshModification.mark_entity_as_created(new_local_offset); m_closure_count[new_local_offset] = static_cast(0); @@ -789,6 +795,8 @@ void BulkData::initialize_arrays() EntityKey invalid_key; m_entity_keys.push_back(invalid_key); + m_entitycomm.push_back(nullptr); + m_owner.push_back(parallel_rank()); m_mark_entity.push_back(NOT_MARKED); m_closure_count.push_back(static_cast(0)); @@ -1021,6 +1029,38 @@ Entity BulkData::declare_element_side_with_id(const stk::mesh::EntityId globalSi template Entity BulkData::declare_element_side_with_id(const stk::mesh::EntityId, Entity, const unsigned, const stk::mesh::PartVector&); template Entity BulkData::declare_element_side_with_id(const stk::mesh::EntityId, Entity, const unsigned, const stk::mesh::ConstPartVector&); + +//---------------------------------------------------------------------- + +namespace { + +// A method for quickly finding an entity within a comm list +const EntityCommListInfo& find_entity(const BulkData& mesh, + const EntityCommListInfoVector& entities, + const EntityKey& key) +{ + EntityCommListInfoVector::const_iterator lb_itr = std::lower_bound(entities.begin(), entities.end(), key); + ThrowAssertMsg(lb_itr != entities.end() && lb_itr->key == key, + "proc " << mesh.parallel_rank() << " Cannot find entity-key " << key << " in comm-list" ); + return *lb_itr; +} + +} + +void BulkData::entity_comm_list_insert(Entity node) +{ + stk::mesh::EntityKey key = entity_key(node); + EntityCommListInfoVector::const_iterator lb_itr = std::lower_bound(m_entity_comm_list.begin(), m_entity_comm_list.end(), key); + if(lb_itr == m_entity_comm_list.end() || lb_itr->key != key) + { + const EntityComm* entity_comm = m_entity_comm_map.entity_comm(key); + const MeshIndex& mesh_index = this->mesh_index(node); + EntityCommListInfo comm_info = {key, node, mesh_index.bucket, mesh_index.bucket_ordinal, + entity_comm}; + m_entity_comm_list.insert(lb_itr, comm_info); + } +} + void BulkData::add_node_sharing( Entity node, int sharing_proc ) { // Only valid to specify sharing information for non-deleted nodes @@ -1038,6 +1078,7 @@ void BulkData::add_node_sharing( Entity node, int sharing_proc ) internal_mark_entity(node, IS_SHARED); entity_comm_map_insert(node, EntityCommInfo(stk::mesh::BulkData::SHARED, sharing_proc)); + entity_comm_list_insert(node); } EntityId BulkData::get_solo_side_id() @@ -1195,7 +1236,7 @@ Entity BulkData::internal_declare_entity( EntityRank ent_rank , EntityId ent_id internal_verify_and_change_entity_parts( declared_entity , add , rem ); if ( result.second ) { - this->internal_set_parallel_owner_rank_but_not_comm_lists(declared_entity, parallel_rank()); + this->internal_set_owner(declared_entity, parallel_rank()); } m_check_invalid_rels = true; @@ -1273,7 +1314,6 @@ bool BulkData::internal_destroy_entity_with_notification(Entity entity, bool was bool BulkData::internal_destroy_entity(Entity entity, bool wasGhost) { - const stk::mesh::EntityKey key = entity_key(entity); require_ok_to_modify(); m_check_invalid_rels = false; @@ -1282,7 +1322,7 @@ bool BulkData::internal_destroy_entity(Entity entity, bool wasGhost) return false; } - const bool ghost = wasGhost || in_receive_ghost(key); + const bool ghost = wasGhost || in_receive_ghost(entity); const stk::mesh::EntityRank erank = entity_rank(entity); const stk::mesh::EntityRank end_rank = static_cast(m_mesh_meta_data.entity_rank_count()); @@ -1329,6 +1369,7 @@ bool BulkData::internal_destroy_entity(Entity entity, bool wasGhost) // If this is a ghosted entity, store key->local_offset so that local_offset can be // reused if the entity is recreated in the next aura-regen. This will prevent clients // from having their handles to ghosted entities go invalid when the ghost is refreshed. + const stk::mesh::EntityKey key = entity_key(entity); if ( ghost ) { m_ghost_reuse_map[key] = entity.local_offset(); } @@ -1559,7 +1600,7 @@ void BulkData::declare_entities(stk::topology::rank_t rank, const IDVECTOR& newI internal_move_entity_to_new_bucket(new_entity, newBucketPartList, scratchSpace); internal_propagate_induced_part_changes_to_downward_connected_entities(new_entity, inducible_parts_added, inducible_parts_removed); - this->internal_set_parallel_owner_rank_but_not_comm_lists(new_entity, parallel_rank()); + this->internal_set_owner(new_entity, parallel_rank()); } //now clear the created-entity cache... begin_entities(rank); @@ -1581,25 +1622,44 @@ bool BulkData::in_shared(EntityKey key, int proc) const return false ; } +bool BulkData::in_shared(Entity entity, int proc) const +{ + if (m_entitycomm[entity.local_offset()] != nullptr) { + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + EntityCommInfoVector::const_iterator it = vec.begin(); + EntityCommInfoVector::const_iterator end = vec.end(); + + while(it!=end && it->ghost_id == SHARED) { + if (it->proc == proc) { + return true; + } + ++it; + } + } + return false ; +} + bool BulkData::is_aura_ghosted_onto_another_proc( EntityKey key ) const { - const int proc = parallel_rank(); - const int owner_rank = internal_entity_comm_map_owner(key); - if ( proc == owner_rank ) - { - for ( PairIterEntityComm ec = internal_entity_comm_map(key); ! ec.empty() ; ++ec ) { - if ( ec->ghost_id == BulkData::AURA && - ec->proc != proc ) { - return true; + if (key.is_valid()) { + const int proc = parallel_rank(); + const int owner_rank = parallel_owner_rank(get_entity(key)); + if ( proc == owner_rank ) + { + for ( PairIterEntityComm ec = internal_entity_comm_map(key); ! ec.empty() ; ++ec ) { + if ( ec->ghost_id == BulkData::AURA && + ec->proc != proc ) { + return true; + } } - } + } } return false; } bool BulkData::in_send_ghost( EntityKey key , int proc ) const { - const int owner_rank = internal_entity_comm_map_owner(key); + const int owner_rank = parallel_owner_rank(get_entity(key)); for ( PairIterEntityComm ec = internal_entity_comm_map(key); ! ec.empty() ; ++ec ) { if ( ec->ghost_id != BulkData::SHARED && ec->proc != owner_rank && @@ -1622,10 +1682,35 @@ bool BulkData::in_ghost( const Ghosting & ghost , EntityKey key , int proc ) con return i != ec.end() && tmp == *i ; } +bool BulkData::in_ghost( const Ghosting & ghost , Entity entity , int proc ) const +{ + if (m_entitycomm[entity.local_offset()] == nullptr) { + return false; + } + + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + + EntityCommInfoVector::const_iterator i = vec.begin(); + EntityCommInfoVector::const_iterator end = vec.end(); + + while(i!=end && i->ghost_id < ghost.ordinal()) { + ++i; + } + + while(i!=end && i->ghost_id == ghost.ordinal()) { + if (i->proc == proc) { + return true; + } + ++i; + } + + return false; +} + bool BulkData::in_send_ghost( const Ghosting & ghost , EntityKey key , int proc ) const { bool ret_val = false; - const int owner_rank = internal_entity_comm_map_owner(key); + const int owner_rank = parallel_owner_rank(get_entity(key)); if (owner_rank == parallel_rank()) { @@ -1696,6 +1781,23 @@ void BulkData::comm_shared_procs(EntityKey key, std::vector & procs ) const } } +void BulkData::comm_shared_procs(Entity entity, std::vector & procs ) const +{ + procs.clear(); + const EntityComm* entityComm = m_entitycomm[entity.local_offset()]; + if (entityComm != nullptr && !entityComm->comm_map.empty()) { + const EntityCommInfoVector& comm_map = entityComm->comm_map; + for(const EntityCommInfo& commInfo : comm_map) { + if (commInfo.ghost_id == BulkData::SHARED) { + procs.push_back(commInfo.proc); + } + else { + break; + } + } + } +} + void BulkData::shared_procs_intersection(const std::vector & keys, std::vector & procs ) const { procs.clear(); @@ -1730,34 +1832,13 @@ void BulkData::comm_procs( const Ghosting & ghost , fill_ghosting_procs(internal_entity_comm_map(key), ghost.ordinal(), procs); } -void BulkData::internal_change_owner_in_comm_data(const EntityKey& key, int new_owner) +void BulkData::internal_set_owner(Entity entity, int new_owner) { - const bool changed = m_entity_comm_map.change_owner_rank(key, new_owner); - if (changed) { - EntityCommListInfoVector::iterator lb_itr = std::lower_bound(m_entity_comm_list.begin(), - m_entity_comm_list.end(), - key); - if (lb_itr != m_entity_comm_list.end() && lb_itr->key == key) - { - if(lb_itr->owner != new_owner) - { - m_modSummary.track_change_owner_in_comm_data(key, lb_itr->owner, new_owner); - notifier.notify_local_entity_comm_info_changed(key.rank()); - lb_itr->owner = new_owner; - } - - } - } + m_owner[entity.local_offset()] = new_owner; } void BulkData::internal_sync_comm_list_owners() { - for (size_t i = 0, e = m_entity_comm_list.size(); i < e; ++i) { - if(is_valid(m_entity_comm_list[i].entity)) - { - m_entity_comm_list[i].owner = parallel_owner_rank(m_entity_comm_list[i].entity); - } - } } void BulkData::deactivate_field_updating() @@ -2485,7 +2566,6 @@ void BulkData::internal_declare_relation( Entity e_from , impl::get_part_ordinals_to_induce_on_lower_ranks(*this, e_from, entity_rank(e_to), scratch1); OrdinalVector emptyParts; - internal_change_entity_parts(e_to, scratch1, emptyParts, scratch2, scratch3); } @@ -2554,7 +2634,7 @@ bool BulkData::internal_destroy_relation( Entity e_from , m_check_invalid_rels = false; // OK to have gaps when deleting OrdinalVector scratchOrdinalVec, scratchSpace; - if ( parallel_size() < 2 || internal_entity_comm_map_shared(entity_key(e_to)).empty() ) { + if ( parallel_size() < 2 || internal_entity_comm_map_shared(e_to).empty() ) { //------------------------------ // 'keep' contains the parts deduced from kept relations @@ -2957,21 +3037,21 @@ void BulkData::internal_change_entity_owner( const std::vector & arg // changing entity in their closure. All modified ghosts will be removed. { impl::OnlyVisitGhostsOnce only_visit_ghosts_once(*this); - StoreEntityKeyInSet store_entity_key(*this); + StoreEntityInSet store_entity; for ( std::vector::const_iterator i = ghosted_change.begin() ; i != ghosted_change.end() ; ++i) { - impl::VisitAuraClosureGeneral(*this,i->first,store_entity_key,only_visit_ghosts_once); + impl::VisitAuraClosureGeneral(*this,i->first,store_entity,only_visit_ghosts_once); } for ( std::vector::const_iterator i = shared_change.begin() ; i != shared_change.end() ; ++i) { - impl::VisitAuraClosureGeneral(*this,i->first,store_entity_key,only_visit_ghosts_once); + impl::VisitAuraClosureGeneral(*this,i->first,store_entity,only_visit_ghosts_once); } for ( std::set::const_iterator i = send_closure.begin() ; i != send_closure.end() ; ++i) { - impl::VisitAuraClosureGeneral(*this,i->first,store_entity_key,only_visit_ghosts_once); + impl::VisitAuraClosureGeneral(*this,i->first,store_entity,only_visit_ghosts_once); } - std::set & modified_ghosts = store_entity_key.entity_key_set; + std::set & modified_ghosts = store_entity.entity_set; - std::set::iterator iter = modified_ghosts.begin(); - std::vector keysThatAreBothSharedAndCustomGhosted; + std::set::iterator iter = modified_ghosts.begin(); + std::vector keysThatAreBothSharedAndCustomGhosted; for (;iter!=modified_ghosts.end();++iter) { @@ -2984,16 +3064,14 @@ void BulkData::internal_change_entity_owner( const std::vector & arg for(size_t i=0;i empty_add ; - std::vector remove_modified_ghosts( modified_ghosts.begin() , - modified_ghosts.end() ); - + std::vector remove_modified_ghosts( modified_ghosts.begin(), modified_ghosts.end() ); // Skip 'm_ghosting[0]' which is the shared subset. for ( std::vector::iterator @@ -3022,20 +3100,14 @@ void BulkData::internal_change_entity_owner( const std::vector & arg internal_verify_and_change_entity_parts( entity , ConstPartVector() , owned ); - const bool changed = this->internal_set_parallel_owner_rank_but_not_comm_lists( entity, i->second ); - if (changed) { - internal_change_owner_in_comm_data(entity_key(entity), i->second); - } + internal_set_owner(entity, i->second); } for ( std::vector::iterator i = shared_change.begin() ; i != shared_change.end() ; ++i ) { Entity entity = i->first; - const bool changed = this->internal_set_parallel_owner_rank_but_not_comm_lists( entity, i->second ); - if (changed) { - internal_change_owner_in_comm_data(entity_key(entity), i->second); - } - if ( p_rank == i->second ) { // I receive ownership + internal_set_owner(entity, i->second); + if ( p_rank == i->second ) { // I received ownership internal_verify_and_change_entity_parts( entity , owned , ConstPartVector() ); } } @@ -3125,10 +3197,7 @@ void BulkData::internal_change_entity_owner( const std::vector & arg log_created_parallel_copy( entity ); - const bool changed = this->internal_set_parallel_owner_rank_but_not_comm_lists( entity, owner ); - if (changed) { - internal_change_owner_in_comm_data(entity_key(entity), owner); - } + internal_set_owner(entity, owner); internal_declare_relation( entity , relations ); @@ -3219,7 +3288,7 @@ Ghosting & BulkData::internal_create_ghosting( const std::string & name ) } Ghosting * const g = - new Ghosting( *this , name , m_ghosting.size() , m_meshModification.synchronized_count() ); + new Ghosting( *this , name , m_ghosting.size() ); m_ghosting.push_back( g ); @@ -3266,14 +3335,6 @@ void BulkData::destroy_all_ghosting() { require_ok_to_modify(); - // Clear Ghosting data - - for ( std::vector::iterator - ig = m_ghosting.begin() ; ig != m_ghosting.end() ; ++ig ) { - Ghosting & gh = **ig ; - gh.m_sync_count = m_meshModification.synchronized_count() ; - } - // Iterate backwards so as not to invalidate a closure. for ( EntityCommListInfoVector::reverse_iterator @@ -3445,7 +3506,7 @@ void BulkData::internal_verify_inputs_and_change_ghosting( //---------------------------------------------------------------------- -void BulkData::ghost_entities_and_fields(Ghosting & ghosting, const std::set& entitiesToGhostOntoOtherProcessors) +void BulkData::ghost_entities_and_fields(Ghosting & ghosting, const std::set& sendGhosts) { //------------------------------------ // Push newly ghosted entities to the receivers and update the comm list. @@ -3454,15 +3515,14 @@ void BulkData::ghost_entities_and_fields(Ghosting & ghosting, const std::set::iterator - j = entitiesToGhostOntoOtherProcessors.begin(); j != entitiesToGhostOntoOtherProcessors.end() ; ++j ) { + j = sendGhosts.begin(); j != sendGhosts.end() ; ++j ) { Entity entity = j->first; const int proc = j->second; - if ( ! in_ghost( ghosting , entity_key(entity) , proc ) ) { + if ( ! in_ghost(ghosting , entity, proc) ) { // Not already being sent , must send it. CommBuffer & buf = commSparse.send_buffer( proc ); buf.pack( entity_rank(entity) ); @@ -3470,12 +3530,12 @@ void BulkData::ghost_entities_and_fields(Ghosting & ghosting, const std::set result = entity_comm_map_insert(entity, EntityCommInfo(ghosting.ordinal(), proc)); + const EntityComm* entity_comm = result.first; const MeshIndex& mesh_index = this->mesh_index(entity); EntityCommListInfo comm_info = {entity_key(entity), entity, mesh_index.bucket, mesh_index.bucket_ordinal, - parallel_owner_rank(entity), entity_comm}; + entity_comm}; m_entity_comm_list.push_back( comm_info ); } } @@ -3555,25 +3615,28 @@ void BulkData::ghost_entities_and_fields(Ghosting & ghosting, const std::setinternal_set_parallel_owner_rank_but_not_comm_lists( entity, owner); - } - - internal_declare_relation( entity , relations, ordinal_scratch); - - if ( ! unpack_field_values(*this, buf , entity , error_msg ) ) { - ++error_count ; } const EntityCommInfo tmp( ghosting.ordinal() , owner ); - if ( entity_comm_map_insert(entity, tmp) ) { - const EntityComm* entity_comm = m_entity_comm_map.entity_comm(entity_key(entity)); + std::pair insertResult = entity_comm_map_insert(entity, tmp); + if ( insertResult.second ) { + const EntityComm* entity_comm = insertResult.first; const MeshIndex& mesh_index = this->mesh_index(entity); EntityCommListInfo comm_info = {entity_key(entity), entity, mesh_index.bucket, mesh_index.bucket_ordinal, - parallel_owner_rank(entity), entity_comm}; + entity_comm}; m_entity_comm_list.push_back( comm_info ); } + + //now, change owner. (needed to wait until comm-info was created) + internal_set_owner( entity, owner); + + internal_declare_relation( entity , relations, ordinal_scratch); + + if ( ! unpack_field_values(*this, buf , entity , error_msg ) ) { + ++error_count ; + } } } } @@ -3596,10 +3659,7 @@ void BulkData::ghost_entities_and_fields(Ghosting & ghosting, const std::set &entitiesWithClosure) @@ -3664,16 +3724,86 @@ void BulkData::internal_add_to_ghosting( ghost_entities_and_fields(ghosting, entitiesToGhostOntoOtherProcessors); } +bool is_ghost(const EntityCommInfoVector& vec, const Ghosting& ghosting) +{ + EntityCommInfoVector::const_iterator i = vec.begin(); + EntityCommInfoVector::const_iterator end = vec.end(); + for(; i!=end; ++i) { + if (i->ghost_id == ghosting.ordinal()) { + return true; + } + } + return false; +} + +void BulkData::generate_ghosting_receive_list(const stk::mesh::Ghosting &ghosting, const std::vector &remove_receive, + std::vector &recvGhosts, std::vector& ghostStatus) +{ + // Remove any entities that are in the remove list. + + for ( Entity rmEntity : remove_receive) { + if (is_valid(rmEntity) && in_receive_ghost(ghosting, rmEntity)) { + ghostStatus[rmEntity.local_offset()] = true; + } + } + + // Iterate over all entities with communication information, adding + // the entity if it's a ghost on this process. recvGhosts will contain + // all received-ghosts on this process by the end of the loop. + for ( EntityCommListInfoVector::const_iterator + i = internal_comm_list().begin() ; i != internal_comm_list().end() ; ++i ) { + const bool inRemoveReceive = ghostStatus[i->entity.local_offset()]; + if ( is_valid(i->entity) && !inRemoveReceive && in_receive_ghost(ghosting, i->entity) ) { + recvGhosts.push_back(i->entity); + ghostStatus[i->entity.local_offset()] = true; + } + else { + ghostStatus[i->entity.local_offset()] = false; + } + } + + //Add back in the closure-entities of each recv-ghost, if those closure-entities were + //removed due to being in the remove_receive list + // + impl::OnlyRecvGhosts org(*this,ghosting,ghostStatus); + impl::VecPushBack vpb(recvGhosts, ghostStatus); + + unsigned len = recvGhosts.size(); + for (unsigned ii=0; ii stk::topology::ELEM_RANK) { + impl::VisitClosureGeneral(*this, *rels_i, vpb, org); + } + else { + if ( is_valid(*rels_i) && + in_receive_ghost( ghosting , *rels_i ) && !ghostStatus[(*rels_i).local_offset()] ) + { + recvGhosts.push_back(*rels_i); + ghostStatus[(*rels_i).local_offset()] = true; + } + } + } + } + } +} + void BulkData::generate_ghosting_receive_list(const stk::mesh::Ghosting &ghosting, const std::vector &remove_receive, - std::set &entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs) + std::set &recvGhosts) { // Iterate over all entities with communication information, adding // the entity if it's a ghost on this process. new_recv will contain // all ghosts on this process by the end of the loop. for ( EntityCommListInfoVector::const_iterator i = internal_comm_list().begin() ; i != internal_comm_list().end() ; ++i ) { - if ( is_valid(i->entity) && in_receive_ghost( ghosting , i->key ) ) { - entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.insert( i->key ); + if ( is_valid(i->entity) && in_receive_ghost(ghosting, i->entity) ) { + recvGhosts.insert( i->key ); } } @@ -3681,7 +3811,7 @@ void BulkData::generate_ghosting_receive_list(const stk::mesh::Ghosting &ghostin for ( std::vector::const_iterator i = remove_receive.begin() ; i != remove_receive.end() ; ++i ) { - entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.erase( *i ); + recvGhosts.erase( *i ); } // Keep the closure of the remaining received ghosts. @@ -3692,7 +3822,7 @@ void BulkData::generate_ghosting_receive_list(const stk::mesh::Ghosting &ghostin // Insertion will not invalidate the associative container's iterator. for ( std::set::reverse_iterator - i = entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.rbegin() ; i != entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.rend() ; ++i) { + i = recvGhosts.rbegin() ; i != recvGhosts.rend() ; ++i) { const unsigned erank = i->rank(); Entity e = get_entity(*i); // Could be performance issue? Not if you're just doing full regens @@ -3702,9 +3832,9 @@ void BulkData::generate_ghosting_receive_list(const stk::mesh::Ghosting &ghostin Entity const *rels_e = end(e, irank); for (; rels_i != rels_e; ++rels_i) { - if ( is_valid(*rels_i) && in_receive_ghost( ghosting , entity_key(*rels_i) ) ) + if ( is_valid(*rels_i) && in_receive_ghost( ghosting , *rels_i ) ) { - entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.insert( entity_key(*rels_i) ); + recvGhosts.insert( entity_key(*rels_i) ); } } } @@ -3719,6 +3849,116 @@ void BulkData::delete_unneeded_entries_from_the_comm_list() m_entity_comm_list.erase( i , m_entity_comm_list.end() ); } +void BulkData::internal_change_ghosting( + Ghosting & ghosting , + const std::vector & add_send , + const std::vector & remove_receive, + bool is_full_regen) +{ + m_modSummary.track_change_ghosting(ghosting, add_send, remove_receive); + + //------------------------------------ + // Copy ghosting lists into more efficiently edited container. + // The send and receive lists must be in entity rank-order. + + std::set sendGhosts(EntityLess(*this)); + std::vector recvGhosts; + std::vector ghostStatus(get_size_of_entity_index_space(), false); + + //------------------------------------ + // Insert the current ghost receives and then remove from that list. + + // This if-check is an optimization; if doing a full regen then we are + // removing all ghosting information and recvGhosts should be left empty. + if ( !is_full_regen ) { + generate_ghosting_receive_list(ghosting, remove_receive, recvGhosts, ghostStatus); + } + + // Initialize sendGhosts from recvGhosts + stk::mesh::impl::send_entity_keys_to_owners(*this , recvGhosts , sendGhosts); + + //------------------------------------ + // Add the specified entities and their closure to the send ghosting + + impl::StoreInEntityProcSet sieps(*this,sendGhosts); + impl::OnlyGhosts og(*this); + for ( std::vector< EntityProc >::const_iterator + i = add_send.begin() ; i != add_send.end() ; ++i ) { + og.proc = i->second; + sieps.proc = i->second; + impl::VisitClosureGeneral(*this,i->first,sieps,og); + } + + // Synchronize the send and receive list. + // If the send list contains a not-owned entity + // inform the owner and receiver to add that entity + // to their ghost send and receive lists. + + stk::mesh::impl::comm_sync_send_recv( *this , sendGhosts , recvGhosts, ghostStatus ); + + // The sendGhosts list is now parallel complete and parallel accurate + // recvGhosts has those ghost entities that are to be kept. + //------------------------------------ + // Remove the ghost entities that will not remain. + // If the last reference to the receive ghost entity then delete it. + + OrdinalVector addParts; + OrdinalVector removeParts(1, m_ghost_parts[ghosting.ordinal()]->mesh_meta_data_ordinal()); + OrdinalVector scratchOrdinalVec, scratchSpace; + bool removed = false ; + + std::vector comm_ghost ; + for ( EntityCommListInfoVector::reverse_iterator + i = m_entity_comm_list.rbegin() ; i != m_entity_comm_list.rend() ; ++i) { + + const bool is_owner = parallel_owner_rank(i->entity) == parallel_rank() ; + const bool remove_recv = ( ! is_owner ) && + !ghostStatus[i->entity.local_offset()] && in_receive_ghost(ghosting, i->entity); + + if(is_valid(i->entity)) + { + if ( is_owner ) { + // Is owner, potentially removing ghost-sends + // Have to make a copy + + const PairIterEntityComm ec = internal_entity_comm_map(i->entity, ghosting); + comm_ghost.assign( ec.first , ec.second ); + + for ( ; ! comm_ghost.empty() ; comm_ghost.pop_back() ) { + const EntityCommInfo tmp = comm_ghost.back(); + + if ( 0 == sendGhosts.count( EntityProc( i->entity , tmp.proc ) ) ) { + entity_comm_map_erase(i->key, tmp); + } + } + } + else if ( remove_recv ) { + entity_comm_map_erase(i->key, ghosting); + internal_change_entity_parts(i->entity, addParts, removeParts, scratchOrdinalVec, scratchSpace); + } + + if ( internal_entity_comm_map(i->entity).empty() ) { + removed = true ; + i->key = EntityKey(); // No longer communicated + if ( remove_recv ) { + ThrowRequireMsg( internal_destroy_entity_with_notification( i->entity, remove_recv ), + "P[" << this->parallel_rank() << "]: FAILED attempt to destroy entity: " + << entity_key(i->entity) ); + } + } + } + } + + // if an entry in the comm_list has the EntityKey() value, it is invalid, + // and removed from the comm_list + + if ( removed ) { + delete_unneeded_entries_from_the_comm_list(); + } + + ghost_entities_and_fields(ghosting, sendGhosts); +} + void BulkData::internal_change_ghosting( Ghosting & ghosting , const std::vector & add_send , @@ -3731,8 +3971,8 @@ void BulkData::internal_change_ghosting( // Copy ghosting lists into more efficiently edited container. // The send and receive lists must be in entity rank-order. - std::set entitiesToGhostOntoOtherProcessors(EntityLess(*this)); - std::set entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs; + std::set sendGhosts(EntityLess(*this)); + std::set recvGhosts; //------------------------------------ // Insert the current ghost receives and then remove from that list. @@ -3741,16 +3981,16 @@ void BulkData::internal_change_ghosting( // then we are removing all ghosting information and new_recv should // be left empty. if ( !is_full_regen ) { - generate_ghosting_receive_list(ghosting, remove_receive, entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs); + generate_ghosting_receive_list(ghosting, remove_receive, recvGhosts); } // Initialize the new_send from the new_recv - stk::mesh::impl::send_entity_keys_to_owners( *this , entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs , entitiesToGhostOntoOtherProcessors ); + stk::mesh::impl::send_entity_keys_to_owners( *this , recvGhosts , sendGhosts ); //------------------------------------ // Add the specified entities and their closure to the send ghosting - impl::StoreInEntityProcSet sieps(*this,entitiesToGhostOntoOtherProcessors); + impl::StoreInEntityProcSet sieps(*this,sendGhosts); impl::OnlyGhosts og(*this); for ( std::vector< EntityProc >::const_iterator i = add_send.begin() ; i != add_send.end() ; ++i ) { @@ -3764,7 +4004,7 @@ void BulkData::internal_change_ghosting( // inform the owner and receiver to add that entity // to their ghost send and receive lists. - stk::mesh::impl::comm_sync_send_recv( *this , entitiesToGhostOntoOtherProcessors , entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs ); + stk::mesh::impl::comm_sync_send_recv( *this , sendGhosts , recvGhosts ); // The new_send list is now parallel complete and parallel accurate // The new_recv has those ghost entities that are to be kept. @@ -3777,12 +4017,13 @@ void BulkData::internal_change_ghosting( OrdinalVector scratchOrdinalVec, scratchSpace; bool removed = false ; + std::vector comm_ghost ; for ( EntityCommListInfoVector::reverse_iterator i = m_entity_comm_list.rbegin() ; i != m_entity_comm_list.rend() ; ++i) { - const bool is_owner = i->owner == parallel_rank() ; + const bool is_owner = parallel_owner_rank(i->entity) == parallel_rank() ; const bool remove_recv = ( ! is_owner ) && - 0 == entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.count(i->key); + 0 == recvGhosts.count(i->key); if(is_valid(i->entity)) { @@ -3790,14 +4031,13 @@ void BulkData::internal_change_ghosting( // Is owner, potentially removing ghost-sends // Have to make a copy - std::vector comm_ghost ; - const PairIterEntityComm ec = internal_entity_comm_map(i->key, ghosting); + const PairIterEntityComm ec = internal_entity_comm_map(i->entity, ghosting); comm_ghost.assign( ec.first , ec.second ); for ( ; ! comm_ghost.empty() ; comm_ghost.pop_back() ) { const EntityCommInfo tmp = comm_ghost.back(); - if ( 0 == entitiesToGhostOntoOtherProcessors.count( EntityProc( i->entity , tmp.proc ) ) ) { + if ( 0 == sendGhosts.count( EntityProc( i->entity , tmp.proc ) ) ) { entity_comm_map_erase(i->key, tmp); } } @@ -3807,7 +4047,7 @@ void BulkData::internal_change_ghosting( internal_change_entity_parts(i->entity, addParts, removeParts, scratchOrdinalVec, scratchSpace); } - if ( internal_entity_comm_map(i->key).empty() ) { + if ( internal_entity_comm_map(i->entity).empty() ) { removed = true ; i->key = EntityKey(); // No longer communicated if ( remove_recv ) { @@ -3826,7 +4066,7 @@ void BulkData::internal_change_ghosting( delete_unneeded_entries_from_the_comm_list(); } - ghost_entities_and_fields(ghosting, entitiesToGhostOntoOtherProcessors); + ghost_entities_and_fields(ghosting, sendGhosts); } //---------------------------------------------------------------------- @@ -3851,11 +4091,11 @@ void BulkData::fill_list_of_entities_to_send_for_aura_ghosting(std::vector(i->key.rank()); - const PairIterEntityComm aura = internal_entity_comm_map_shared(i->key); + const PairIterEntityComm shared = internal_entity_comm_map_shared(i->entity); - for ( size_t j = 0 ; j < aura.size() ; ++j ) { + for ( size_t j = 0 ; j < shared.size() ; ++j ) { - const int share_proc = aura[j].proc ; + const int share_proc = shared[j].proc ; for (EntityRank k_rank = static_cast(erank + 1); k_rank < end_rank; ++k_rank) { @@ -3865,7 +4105,7 @@ void BulkData::fill_list_of_entities_to_send_for_aura_ghosting(std::vector send ; fill_list_of_entities_to_send_for_aura_ghosting(send); - internal_change_ghosting( aura_ghosting() , send , std::vector(), true /*full regen*/ ); + internal_change_ghosting( aura_ghosting() , send , std::vector(), true /*full regen*/ ); } @@ -3912,23 +4152,6 @@ int BulkData::determine_new_owner( Entity entity ) const return new_owner ; } -//---------------------------------------------------------------------- - -namespace { - -// A method for quickly finding an entity within a comm list -const EntityCommListInfo& find_entity(const BulkData& mesh, - const EntityCommListInfoVector& entities, - const EntityKey& key) -{ - EntityCommListInfoVector::const_iterator lb_itr = std::lower_bound(entities.begin(), entities.end(), key); - ThrowAssertMsg(lb_itr != entities.end() && lb_itr->key == key, - "proc " << mesh.parallel_rank() << " Cannot find entity-key " << key << " in comm-list" ); - return *lb_itr; -} - -} - bool BulkData::pack_entity_modification( const bool packShared , stk::CommSparse & comm ) { bool flag = false; @@ -4212,11 +4435,7 @@ void BulkData::internal_establish_new_owner(stk::mesh::Entity entity) { const int new_owner = determine_new_owner(entity); - const bool changed = this->internal_set_parallel_owner_rank_but_not_comm_lists(entity, new_owner); - if(changed) - { - internal_change_owner_in_comm_data(entity_key(entity), new_owner); - } + internal_set_owner(entity, new_owner); } void BulkData::internal_update_parts_for_shared_entity(stk::mesh::Entity entity, const bool is_entity_shared, const bool did_i_just_become_owner) @@ -4259,33 +4478,28 @@ void BulkData::internal_resolve_ghosted_modify_delete() const size_t ghosting_count = m_ghosting.size(); const size_t ghosting_count_minus_shared = ghosting_count - 1; - std::vector< int > ghosting_change_flags( ghosting_count , 0 ); - // We iterate backwards over remote_mod to ensure that we hit the // higher-ranking entities first. This is important because higher-ranking // entities like element must be deleted before the nodes they have are // deleted. for ( std::vector::reverse_iterator - i = remotely_modified_ghosted_entities.rbegin(); i != remotely_modified_ghosted_entities.rend() ; ++i ) { + i = remotely_modified_ghosted_entities.rbegin(); i != remotely_modified_ghosted_entities.rend() ; ++i ) + { Entity entity = i->comm_info.entity; const EntityKey key = i->comm_info.key; const int remote_proc = i->from_proc; - const bool local_owner = i->comm_info.owner == parallel_rank() ; + const bool local_owner = parallel_owner_rank(entity) == parallel_rank() ; const bool remotely_destroyed = Deleted == i->state ; - const bool remote_proc_is_owner = remote_proc == i->comm_info.owner; + const bool remote_proc_is_owner = remote_proc == parallel_owner_rank(entity); const bool isAlreadyDestroyed = !is_valid(entity); - if ( local_owner ) { // Sending to 'remote_proc' for ghosting if ( remotely_destroyed ) { // remove from ghost-send list - // j=2, j=1, for ( size_t j = ghosting_count_minus_shared ; j>=1 ; --j) { - if ( entity_comm_map_erase( key, EntityCommInfo( j , remote_proc ) ) ) { - ghosting_change_flags[ j ] = true ; - } + entity_comm_map_erase( key, EntityCommInfo( j , remote_proc ) ); } } @@ -4310,10 +4524,8 @@ void BulkData::internal_resolve_ghosted_modify_delete() } } - if ( isAuraGhost ) - { - entity_comm_map_erase(key, aura_ghosting()); - ghosting_change_flags[AURA] = true ; + if ( isAuraGhost ) { + entity_comm_map_erase(key, aura_ghosting()); } if(!isAlreadyDestroyed) @@ -4324,9 +4536,7 @@ void BulkData::internal_resolve_ghosted_modify_delete() if (shouldRemoveFromGhosting) { for ( size_t j = ghosting_count_minus_shared ; j >=1 ; --j ) { - if ( entity_comm_map_erase( key, *m_ghosting[j] ) ) { - ghosting_change_flags[ j ] = true ; - } + entity_comm_map_erase( key, *m_ghosting[j] ); } } @@ -4350,33 +4560,15 @@ void BulkData::internal_resolve_ghosted_modify_delete() const bool locally_destroyed = !is_valid(entity); const bool locally_owned_and_modified = locally_destroyed ? false : - Modified == state(entity) && - parallel_rank() == i->owner ; + (Modified == state(entity) && (parallel_rank() == parallel_owner_rank(entity))); if ( locally_destroyed ) { for ( size_t j = ghosting_count_minus_shared ; j >=1 ; --j ) { - if ( entity_comm_map_erase( i->key, *m_ghosting[j] ) ) { - ghosting_change_flags[ j ] = true ; - } + entity_comm_map_erase( i->key, *m_ghosting[j] ); } } else if ( locally_owned_and_modified ) { - if ( entity_comm_map_erase( i->key, aura_ghosting() ) ) { - ghosting_change_flags[ AURA ] = true ; - } - } - } - - std::vector< int > ghosting_change_flags_global( ghosting_count , 0 ); - - all_reduce_sum( parallel() , - ghosting_change_flags.data() , - ghosting_change_flags_global.data() , - ghosting_change_flags.size() ); - - for ( unsigned ic = 0 ; ic < ghosting_change_flags_global.size() ; ++ic ) { - if ( ghosting_change_flags_global[ic] ) { - m_ghosting[ic]->m_sync_count = m_meshModification.synchronized_count() ; + entity_comm_map_erase( i->key, aura_ghosting() ); } } } @@ -4410,10 +4602,7 @@ void BulkData::resolve_ownership_of_modified_entities( const std::vector Entity entity = get_entity( key ); // Set owner, will correct part membership later - const bool changed = this->internal_set_parallel_owner_rank_but_not_comm_lists( entity, receive_proc); - if (changed) { - internal_change_owner_in_comm_data(key, receive_proc); - } + internal_set_owner(entity, receive_proc); } } } @@ -4439,12 +4628,7 @@ void BulkData::move_entities_to_proper_part_ownership( const std::vector const int new_owner = determine_new_owner(entity); - const bool changed = this->internal_set_parallel_owner_rank_but_not_comm_lists(entity, - new_owner); - if(changed) - { - internal_change_owner_in_comm_data(entity_key(entity), new_owner); - } + internal_set_owner(entity, new_owner); } if(parallel_owner_rank(entity) != parallel_rank()) @@ -4515,7 +4699,7 @@ void BulkData::add_comm_list_entries_for_entities(const std::vectorparallel_rank(); for(size_t i=0; i < m_entity_comm_list.size(); ++i) { - const int owner = m_entity_comm_list[i].owner; + const int owner = parallel_owner_rank(m_entity_comm_list[i].entity); stk::mesh::Entity entity = m_entity_comm_list[i].entity; if(owner == p_rank && is_modified_or_created(*this, entity)) { const EntityComm* entity_comm = m_entity_comm_list[i].entity_comm; - if (entity_comm != nullptr) { - for(PairIterEntityComm ec(entity_comm->comm_map); !ec.empty(); ++ec) - { - EntityProc tmp(entity, ec->proc); - send_list.push_back(tmp); - } + for(PairIterEntityComm ec(entity_comm->comm_map); !ec.empty(); ++ec) + { + EntityProc tmp(entity, ec->proc); + send_list.push_back(tmp); } } } @@ -5143,26 +5331,27 @@ bool shared_with_proc(const EntityCommListInfo& info, int proc) { return false; } -void pack_induced_memberships_for_entities_less_than_element_rank( BulkData& bulk_data, stk::CommSparse& comm, const EntityCommListInfoVector & entity_comm ) +void pack_induced_memberships_for_entities_less_than_element_rank( BulkData& bulk_data, stk::CommSparse& comm, const EntityCommListInfoVector & entityCommListInfoVec ) { OrdinalVector induced; - for(size_t i = 0; i < entity_comm.size(); ++i) + for(size_t i = 0; i < entityCommListInfoVec.size(); ++i) { - stk::mesh::Entity entity = entity_comm[i].entity; + stk::mesh::Entity entity = entityCommListInfoVec[i].entity; + const int owner = bulk_data.parallel_owner_rank(entity); - if (is_less_than_element_rank(bulk_data, entity) && shared_with_proc(entity_comm[i], entity_comm[i].owner) ) + if (is_less_than_element_rank(bulk_data, entity) && shared_with_proc(entityCommListInfoVec[i], owner) ) { if(is_modified_or_created(bulk_data, entity)) { induced.clear(); - induced_part_membership(bulk_data, entity_comm[i].entity, induced); + induced_part_membership(bulk_data, entityCommListInfoVec[i].entity, induced); - CommBuffer & buf = comm.send_buffer(entity_comm[i].owner); + CommBuffer & buf = comm.send_buffer(owner); unsigned tmp = induced.size(); - buf.pack(entity_comm[i].key); + buf.pack(entityCommListInfoVec[i].key); buf.pack(tmp); for(size_t j = 0; j < induced.size(); ++j) @@ -5196,24 +5385,24 @@ void append_parts_from_sharer_to_owner(stk::mesh::BulkData& bulk, stk::mesh::Ent void pack_induced_memberships( BulkData& bulk_data, stk::CommSparse & comm , - const EntityCommListInfoVector & entity_comm ) + const EntityCommListInfoVector & entityCommListInfoVec ) { OrdinalVector induced ; - for ( size_t i=0; i(entity_comm[i].key); + buf.pack(entityCommListInfoVec[i].key); buf.pack( tmp ); for ( size_t j=0; jcomm_map, part_storage, comm); @@ -5411,7 +5600,7 @@ void BulkData::internal_resolve_shared_part_membership_for_element_death() if(is_less_than_element_rank(*this, entity) && is_modified_or_created(*this, entity)) { - bool i_own_this_entity_in_comm_list = i->owner == p_rank; + bool i_own_this_entity_in_comm_list = parallel_owner_rank(i->entity) == p_rank; if( i_own_this_entity_in_comm_list ) { remove_unneeded_induced_parts(entity, i->entity_comm->comm_map, part_storage, comm); @@ -5811,7 +6000,7 @@ void BulkData::internal_move_entity_to_new_bucket(stk::mesh::Entity entity, cons Bucket *bucketOld = meshIndex.bucket; if (bucketOld != nullptr) { - bool isEntityCommunicated = (bucketOld->shared() || in_send_ghost(entity_key(entity)) || in_receive_ghost(entity_key(entity))); + bool isEntityCommunicated = (bucketOld->shared() || in_send_ghost(entity) || in_receive_ghost(entity)); if (!m_meshModification.did_any_shared_entity_change_parts() && isEntityCommunicated) { m_meshModification.set_shared_entity_changed_parts(); @@ -6520,16 +6709,11 @@ void BulkData::unpack_not_owned_verify_report_errors(Entity entity, //---------------------------------------------------------------------------- // Unpacking all of my not-owned entities. - bool BulkData::unpack_not_owned_verify( CommSparse & commSparse , std::ostream & error_log ) { const int p_rank = parallel_rank(); const EntityCommListInfoVector & entity_comm = internal_comm_list(); -#if (defined(DEBUG_PRINT_COMM_LIST) && defined(DEBUG_PRINT_COMM_LIST_UNPACK)) - par_verify_print_comm_list(mesh, true, "unpack_not_owned_verify"); -#endif - bool result = true ; EntityKey recv_entity_key ; @@ -6547,10 +6731,10 @@ bool BulkData::unpack_not_owned_verify( CommSparse & commSparse , std::ostream & ThrowRequire( entity_key(entity) == key ); - if ( i->owner != p_rank ) { + if ( parallel_owner_rank(i->entity) != p_rank ) { bool broken_tag = false; - CommBuffer & buf = commSparse.recv_buffer( i->owner ); + CommBuffer & buf = commSparse.recv_buffer( parallel_owner_rank(i->entity)); broken_tag = broken_tag || check_tag(*this, buf, PACK_TAG_ENTITY_SHARED, PACK_TAG_ENTITY_GHOST); if(!broken_tag) @@ -6651,7 +6835,7 @@ void BulkData::pack_owned_verify( CommSparse & commSparse ) for ( EntityCommListInfoVector::const_iterator i = entity_comm.begin() ; i != entity_comm.end() ; ++i ) { - if ( i->owner == p_rank ) { + if ( parallel_owner_rank(i->entity) == p_rank ) { std::vector share_procs ; std::vector ghost_procs ; @@ -6793,13 +6977,12 @@ bool BulkData::verify_parallel_attributes_for_bucket( Bucket const& bucket, std: Bucket::iterator j = bucket.begin(); while ( j != j_end ) { - size_t idx = j - bucket.begin(); Entity entity = *j ; ++j ; bool this_result = true; const EntityKey key = entity_key(entity); - const int p_owner = bucket.parallel_owner_rank(idx); + const int p_owner = parallel_owner_rank(entity); const bool ordered = is_comm_ordered(internal_entity_comm_map(key)); const bool shares = in_shared( key ); const bool recv_aura = in_receive_ghost( aura_ghosting(), key ); @@ -6921,7 +7104,7 @@ bool BulkData::verify_parallel_attributes( std::ostream & error_log ) } } - bool isGloballyConsistentCommList = impl::is_comm_list_globally_consistent(this->parallel(), this->m_entity_comm_list, error_log); + bool isGloballyConsistentCommList = impl::is_comm_list_globally_consistent(*this, this->m_entity_comm_list, error_log); result = result && isGloballyConsistentCommList; return result ; @@ -7012,6 +7195,7 @@ void BulkData::destroy_dependent_ghosts( Entity entity, EntityProcVec& entitiesT void BulkData::delete_shared_entities_which_are_no_longer_in_owned_closure(EntityProcVec& entitiesToRemoveFromSharing) { + std::vector shared_procs; for ( EntityCommListInfoVector::const_reverse_iterator i = internal_comm_list().rbegin() ; i != internal_comm_list().rend() ; ++i) { @@ -7019,8 +7203,7 @@ void BulkData::delete_shared_entities_which_are_no_longer_in_owned_closure(Entit Entity entity = i->entity; bool entityisValid = is_valid(entity); - std::vector shared_procs; - comm_shared_procs(i->key,shared_procs); + comm_shared_procs(entity,shared_procs); bool isSharedEntity = !shared_procs.empty(); bool isNotInOwnedClosure = !owned_closure(entity); bool entityIsSharedButNotInClosure = entityisValid && isSharedEntity && isNotInOwnedClosure; @@ -7071,16 +7254,17 @@ bool is_node_connected_to_active_element_locally(const stk::mesh::BulkData &mesh void BulkData::delete_sides_on_all_procs(const stk::mesh::EntityVector& deletedSides) { stk::CommSparse comm(this->parallel()); + std::vector procs; for(int phase = 0; phase < 2; ++phase) { for(size_t i = 0; i < deletedSides.size(); ++i) { stk::mesh::Entity side = deletedSides[i]; stk::mesh::EntityKey key = this->entity_key(side); - const bool is_comm_entity_and_locally_owned = this->m_entity_comm_map.owner_rank(key) == this->parallel_rank(); + const bool is_comm_entity_and_locally_owned = this->parallel_owner_rank(side) == this->parallel_rank(); if(is_comm_entity_and_locally_owned) { - std::vector procs; + procs.clear(); for ( PairIterEntityComm ec = internal_entity_comm_map(key); ! ec.empty() ; ++ec ) { procs.push_back( ec->proc ); @@ -7145,12 +7329,11 @@ void BulkData::set_shared_owned_parts_and_ownership_on_comm_data(const std::vect stk::mesh::Entity entity = shared_modified[i].m_entity; int sharing_proc = shared_modified[i].m_sharing_proc; entity_comm_map_insert(entity, stk::mesh::EntityCommInfo(stk::mesh::BulkData::SHARED, sharing_proc)); + int old_owner = parallel_owner_rank(entity); int owning_proc = shared_modified[i].m_owner; - const bool am_not_owner = this->internal_set_parallel_owner_rank_but_not_comm_lists(entity, owning_proc); - if(am_not_owner) + if(old_owner != owning_proc) { - stk::mesh::EntityKey key = this->entity_key(entity); - internal_change_owner_in_comm_data(key, owning_proc); + internal_set_owner(entity, owning_proc); internal_change_entity_parts(entity, shared_part /*add*/, owned_part /*remove*/, scratchOrdinalVec, scratchSpace); } else diff --git a/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp b/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp index 6e1015bd064c..5a73c686bc5e 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp @@ -606,23 +606,30 @@ class BulkData { size_t get_num_communicated_entities() const { return m_entity_comm_list.size(); } - bool in_shared(EntityKey key) const { return !internal_entity_comm_map_shared(key).empty(); } // CLEANUP: only used for testing - bool in_shared(EntityKey key, int proc) const; // CLEANUP: only used for testing - bool in_receive_ghost( EntityKey key ) const; // CLEANUP: only used for testing - bool in_receive_ghost( const Ghosting & ghost , EntityKey entity ) const; + bool in_shared(EntityKey key) const { return !internal_entity_comm_map_shared(key).empty(); } + bool in_shared(Entity entity) const { return !internal_entity_comm_map_shared(entity).empty(); } + bool in_shared(EntityKey key, int proc) const; + bool in_shared(Entity entity, int proc) const; + bool in_receive_ghost( EntityKey key ) const; + bool in_receive_ghost( Entity entity ) const; + bool in_receive_ghost( const Ghosting & ghost , EntityKey key ) const; + bool in_receive_ghost( const Ghosting & ghost , Entity entity ) const; bool in_receive_custom_ghost( EntityKey key ) const; - bool in_send_ghost( EntityKey key) const; // CLEANUP: only used for testing - bool in_send_ghost( EntityKey key , int proc ) const; // CLEANUP: only used for testing + bool in_send_ghost( EntityKey key) const; + bool in_send_ghost( Entity entity) const; + bool in_send_ghost( EntityKey key , int proc ) const; bool in_send_ghost( const Ghosting & ghosting, EntityKey key, int proc) const; - bool is_aura_ghosted_onto_another_proc( EntityKey key ) const; // CLEANUP: used only by modification_end_for_entity_creation - bool in_ghost( const Ghosting & ghost , EntityKey key , int proc ) const; // CLEANUP: can be moved protected + bool is_aura_ghosted_onto_another_proc( EntityKey key ) const; + bool in_ghost( const Ghosting & ghost , EntityKey key , int proc ) const; + bool in_ghost( const Ghosting & ghost , Entity entity , int proc ) const; void shared_procs_intersection(const std::vector & keys, std::vector & procs ) const; // CLEANUP: only used by aero // Comm-related convenience methods void comm_procs( EntityKey key, std::vector & procs ) const; //shared and ghosted entities void comm_procs( const Ghosting & ghost , EntityKey key, std::vector & procs ) const; - void comm_shared_procs( EntityKey key, std::vector & procs ) const; // shared entities + void comm_shared_procs( EntityKey key, std::vector & procs ) const; + void comm_shared_procs( Entity entity, std::vector & procs ) const; inline bool in_index_range(Entity entity) const; inline bool is_valid(Entity entity) const; @@ -900,17 +907,52 @@ class BulkData { const EntityCommListInfoVector & internal_comm_list() const { return m_entity_comm_list; } PairIterEntityComm internal_entity_comm_map(const EntityKey & key) const { return m_entity_comm_map.comm(key); } + + PairIterEntityComm internal_entity_comm_map(Entity entity) const + { + if (m_entitycomm[entity.local_offset()] != nullptr) { + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + return PairIterEntityComm(vec.begin(), vec.end()); + } + return PairIterEntityComm(); + } + PairIterEntityComm internal_entity_comm_map(const EntityKey & key, const Ghosting & sub ) const { return m_entity_comm_map.comm(key,sub); } - int internal_entity_comm_map_owner(const EntityKey & key) const; + + PairIterEntityComm internal_entity_comm_map(Entity entity, const Ghosting & sub ) const + { + if (m_entitycomm[entity.local_offset()] != nullptr) { + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + const EntityCommInfo s_begin( sub.ordinal() , 0 ); + const EntityCommInfo s_end( sub.ordinal() + 1 , 0 ); + + EntityCommInfoVector::const_iterator i = vec.begin(); + EntityCommInfoVector::const_iterator e = vec.end(); + + i = std::lower_bound( i , e , s_begin ); + e = std::lower_bound( i , e , s_end ); + + return PairIterEntityComm( i , e ); + } + return PairIterEntityComm(); + } inline EntitySharing internal_is_entity_marked(Entity entity) const; PairIterEntityComm internal_entity_comm_map_shared(const EntityKey & key) const { return m_entity_comm_map.shared_comm_info(key); } + PairIterEntityComm internal_entity_comm_map_shared(Entity entity) const + { + if (m_entitycomm[entity.local_offset()] != nullptr) { + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + return shared_comm_info_range(vec); + } + return PairIterEntityComm(); + } + void markEntitiesForResolvingSharingInfoUsingNodes(stk::mesh::EntityRank entityRank, bool onlyConsiderSoloSides, std::vector& shared_entities); virtual void sortNodesIfNeeded(std::vector& nodes); void gather_shared_nodes(std::vector & shared_nodes); - inline bool internal_set_parallel_owner_rank_but_not_comm_lists(Entity entity, int in_owner_rank); inline void set_state(Entity entity, EntityState entity_state); inline void set_entity_key(Entity entity, EntityKey key); @@ -954,6 +996,11 @@ class BulkData { bool internal_destroy_entity_with_notification(Entity entity, bool wasGhost = false); // Mod Mark virtual bool internal_destroy_entity(Entity entity, bool wasGhost = false); + void internal_change_ghosting( Ghosting & ghosts, + const std::vector & add_send , + const std::vector & remove_receive, + bool is_full_regen = false); // Mod Mark + void internal_change_ghosting( Ghosting & ghosts, const std::vector & add_send , const std::vector & remove_receive, @@ -1024,17 +1071,23 @@ class BulkData { void add_comm_list_entries_for_entities(const std::vector& shared_modified); - bool entity_comm_map_insert(Entity entity, const EntityCommInfo &val) + std::pair entity_comm_map_insert(Entity entity, const EntityCommInfo &val) { EntityKey key = entity_key(entity); - bool didInsert = m_entity_comm_map.insert(key, val, parallel_owner_rank(entity)); - if(didInsert) + std::pair result = m_entity_comm_map.insert(key, val, parallel_owner_rank(entity)); + if(result.second) { + m_entitycomm[entity.local_offset()] = result.first; m_modSummary.track_comm_map_insert(entity, val); notifier.notify_local_entity_comm_info_changed(key.rank()); } - return didInsert; + return result; } + void remove_entity_comm(Entity entity) + { + m_entitycomm[entity.local_offset()] = nullptr; + } + bool entity_comm_map_erase(const EntityKey &key, const EntityCommInfo &val) { bool didErase = m_entity_comm_map.erase(key, val); @@ -1114,13 +1167,6 @@ class BulkData { ThrowAssertMsg(in_index_range(entity) , "Entity has out-of-bounds offset: " << entity.local_offset() << ", maximum offset is: " << m_entity_keys.size() - 1); } - void fix_up_ownership(stk::mesh::Entity entity, int new_owner) - { - stk::mesh::EntityKey key = entity_key(entity); - this->internal_change_owner_in_comm_data(key, new_owner); - this->internal_set_parallel_owner_rank_but_not_comm_lists(entity, new_owner); - } - void require_good_rank_and_id(EntityRank ent_rank, EntityId ent_id) const; void remove_entity_callback(EntityRank rank, unsigned bucket_id, Bucket::size_type bucket_ord); @@ -1157,7 +1203,7 @@ class BulkData { void internal_finish_modification_end(impl::MeshModification::modification_optimization opt); // Mod Mark - void internal_change_owner_in_comm_data(const EntityKey& key, int new_owner); // Mod Mark + void internal_set_owner(Entity entity, int new_owner); std::vector internal_get_ids_in_use(stk::topology::rank_t rank, const std::vector& reserved_ids = std::vector()) const; @@ -1193,7 +1239,9 @@ class BulkData { void mark_entities_as_deleted(stk::mesh::Bucket * bucket); void generate_ghosting_receive_list(const stk::mesh::Ghosting &ghosting, const std::vector &remove_receive, - std::set &entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs); + std::set &recvGhosts); + void generate_ghosting_receive_list(const stk::mesh::Ghosting &ghosting, const std::vector &remove_receive, + std::vector &recvGhosts, std::vector& ghostStatus); void verify_and_filter_add_send(Ghosting & ghosts, const std::vector & add_send, bool &need_to_change_ghosting, bool &add_send_is_owned, std::vector &filtered_add_send ); @@ -1461,6 +1509,7 @@ class BulkData { const PARTVECTOR& parts); stk::mesh::EntityId select_side_id(Entity elem, unsigned sideOrdinal); + void entity_comm_list_insert(Entity node); public: // data mutable bool m_check_invalid_rels; // TODO REMOVE @@ -1477,6 +1526,8 @@ class BulkData { std::vector m_mesh_indexes; //indexed by Entity impl::EntityRepository* m_entity_repo; EntityCommListInfoVector m_entity_comm_list; + std::vector m_entitycomm; + std::vector m_owner; CommListUpdater m_comm_list_updater; std::list m_deleted_entities_current_modification_cycle; GhostReuseMap m_ghost_reuse_map; diff --git a/packages/stk/stk_mesh/stk_mesh/base/BulkDataInlinedMethods.hpp b/packages/stk/stk_mesh/stk_mesh/base/BulkDataInlinedMethods.hpp index d8248364afbc..d2a07a96a274 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/BulkDataInlinedMethods.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/BulkDataInlinedMethods.hpp @@ -442,22 +442,24 @@ bool BulkData::has_permutation(Entity entity, EntityRank rank) const } inline -int BulkData::internal_entity_comm_map_owner(const EntityKey & key) const +bool BulkData::in_receive_ghost( EntityKey key ) const { - const int owner_rank = m_entity_comm_map.owner_rank(key); - ThrowAssertMsg(owner_rank == InvalidProcessRank || owner_rank == parallel_owner_rank(get_entity(key)), - "Expected entity " << key.id() << " with rank " << key.rank() << " to have owner " << - parallel_owner_rank(get_entity(key)) << " but in comm map, found " << owner_rank); - return owner_rank; + const std::vector & ghosts= ghostings(); + for (size_t i=ghosts.size()-1;i>=AURA;--i) + { + if ( in_receive_ghost(*ghosts[i], key) ) + return true; + } + return false; } inline -bool BulkData::in_receive_ghost( EntityKey key ) const +bool BulkData::in_receive_ghost( Entity entity ) const { const std::vector & ghosts= ghostings(); for (size_t i=ghosts.size()-1;i>=AURA;--i) { - if ( in_receive_ghost(*ghosts[i], key) ) + if ( in_receive_ghost(*ghosts[i], entity) ) return true; } return false; @@ -478,14 +480,38 @@ bool BulkData::in_receive_custom_ghost( EntityKey key ) const inline bool BulkData::in_receive_ghost( const Ghosting & ghost , EntityKey key ) const { - const int owner_rank = internal_entity_comm_map_owner(key); + const int owner_rank = parallel_owner_rank(get_entity(key)); return in_ghost( ghost , key , owner_rank ); } +inline +bool BulkData::in_receive_ghost( const Ghosting & ghost , Entity entity ) const +{ + if (m_entitycomm[entity.local_offset()] == nullptr) { + return false; + } + + const int owner_rank = parallel_owner_rank(entity); + if (owner_rank == parallel_rank()) { + return false; + } + + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + EntityCommInfoVector::const_iterator i = vec.begin(); + EntityCommInfoVector::const_iterator end = vec.end(); + for(; i!=end; ++i) { + if (i->ghost_id == ghost.ordinal()) { + return true; + } + } + + return false; +} + inline bool BulkData::in_send_ghost( EntityKey key) const { - const int owner_rank = internal_entity_comm_map_owner(key); + const int owner_rank = parallel_owner_rank(get_entity(key)); for ( PairIterEntityComm ec = internal_entity_comm_map(key); ! ec.empty() ; ++ec ) { if ( ec->ghost_id != 0 && @@ -497,6 +523,21 @@ bool BulkData::in_send_ghost( EntityKey key) const return false; } +inline +bool BulkData::in_send_ghost( Entity entity) const +{ + const int owner_rank = parallel_owner_rank(entity); + for ( PairIterEntityComm ec = internal_entity_comm_map(entity); ! ec.empty() ; ++ec ) + { + if ( ec->ghost_id != 0 && + ec->proc != owner_rank) + { + return true; + } + } + return false; +} + inline void BulkData::internal_check_unpopulated_relations(Entity entity, EntityRank rank) const { @@ -597,14 +638,13 @@ struct EntityGhostData } }; -struct StoreEntityKeyInSet +struct StoreEntityInSet { - StoreEntityKeyInSet(const BulkData & mesh_in) : mesh(mesh_in) {} + StoreEntityInSet() : entity_set() {} void operator()(Entity entity) { - entity_key_set.insert(mesh.entity_key(entity)); + entity_set.insert(entity); } - std::set entity_key_set; - const BulkData & mesh; + std::set entity_set; }; struct StoreEntityProcInSet @@ -722,6 +762,10 @@ inline bool BulkData::in_index_range(Entity entity) const inline bool BulkData::is_valid(Entity entity) const { + ThrowAssertMsg(in_index_range(entity), + "Error in stk::mesh::BulkData::is_valid, entity not in index range. " + " entity.local_offset()="<& entity_comms) + : m_comm_list(comm_list), m_entity_comms(entity_comms) + {} virtual ~CommListUpdater(){} virtual void removedKey(const EntityKey& key) { @@ -51,11 +54,13 @@ class CommListUpdater : public CommMapChangeListener { std::lower_bound(m_comm_list.begin(), m_comm_list.end(), key); if (iter != m_comm_list.end() && iter->key == key) { iter->entity_comm = nullptr; + m_entity_comms[iter->entity.local_offset()] = nullptr; } } private: EntityCommListInfoVector& m_comm_list; + std::vector& m_entity_comms; }; } diff --git a/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.cpp b/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.cpp index 1820f039e6ab..30df12899384 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.cpp @@ -357,21 +357,15 @@ bool EntityCommDatabase::cached_find(const EntityKey& key) const } -void EntityCommDatabase::insert(const EntityKey& key) +const EntityComm* EntityCommDatabase::insert(const EntityKey& key) { if (!cached_find(key)) { m_last_lookup = m_comm_map.insert(std::make_pair(key, EntityComm())).first; } + return &(m_last_lookup->second); } -int EntityCommDatabase::owner_rank( const EntityKey & key ) const -{ - if (!cached_find(key)) return InvalidProcessRank; - - return m_last_lookup->second.owner_rank; -} - PairIterEntityComm EntityCommDatabase::shared_comm_info( const EntityKey & key ) const { if (!cached_find(key)) return PairIterEntityComm(); @@ -422,18 +416,18 @@ PairIterEntityComm EntityCommDatabase::comm( const EntityKey & key, const Ghosti } -bool EntityCommDatabase::insert( const EntityKey & key, const EntityCommInfo & val, int owner ) +std::pair EntityCommDatabase::insert( const EntityKey & key, const EntityCommInfo & val, int /*owner*/ ) { insert(key); EntityCommInfoVector & comm_map = m_last_lookup->second.comm_map; - m_last_lookup->second.owner_rank = owner; EntityCommInfoVector::iterator i = std::lower_bound( comm_map.begin() , comm_map.end() , val ); - const bool result = ((i == comm_map.end()) || (val != *i)); + const bool didInsert = ((i == comm_map.end()) || (val != *i)); + std::pair result = std::make_pair(&(m_last_lookup->second), didInsert); - if ( result ) { + if ( didInsert ) { comm_map.insert( i , val ); } @@ -537,20 +531,6 @@ bool EntityCommDatabase::comm_clear(const EntityKey & key) return did_clear; } - -bool EntityCommDatabase::change_owner_rank(const EntityKey& key, int owner) -{ - // Do not add key to map, only update rank if it was already in the map - if (cached_find(key)) { - const int orig_owner = m_last_lookup->second.owner_rank; - m_last_lookup->second.owner_rank = owner; - return orig_owner != owner; - } - return false; -} - - - } // namespace mesh } diff --git a/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.hpp b/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.hpp index 43c6a3e50896..2f52a1fbb6a3 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/EntityCommDatabase.hpp @@ -66,12 +66,10 @@ class CommMapChangeListener { }; // Struct containing things the system must know about an entity to -// handle communication. The Entity object itself won't necessarily be -// available, so there's some duplication here (owner_rank). +// handle communication. struct EntityComm { EntityCommInfoVector comm_map; - int owner_rank; }; class EntityCommDatabase @@ -90,14 +88,12 @@ class EntityCommDatabase PairIterEntityComm shared_comm_info( const EntityKey & key ) const; PairIterEntityComm comm( const EntityKey & key ) const; PairIterEntityComm comm( const EntityKey & key, const Ghosting & sub ) const; - int owner_rank( const EntityKey & key ) const; - bool insert( const EntityKey & key, const EntityCommInfo & val, int owner ); + std::pair insert( const EntityKey & key, const EntityCommInfo & val, int owner ); bool erase( const EntityKey & key, const EntityCommInfo & val ); bool erase( const EntityKey & key, const Ghosting & ghost ); bool comm_clear_ghosting(const EntityKey & key ); bool comm_clear(const EntityKey & key ); - bool change_owner_rank(const EntityKey& key, int owner); const EntityComm* entity_comm(const EntityKey& key) const; EntityComm* entity_comm(const EntityKey& key); @@ -107,7 +103,7 @@ class EntityCommDatabase private: bool cached_find(const EntityKey& key) const; - void insert(const EntityKey& key); + const EntityComm* insert(const EntityKey& key); map_type m_comm_map; mutable map_type::iterator m_last_lookup; @@ -118,14 +114,13 @@ class EntityCommDatabase inline PairIterEntityComm shared_comm_info_range(const EntityCommInfoVector& comm_info_vector) { EntityCommInfoVector::const_iterator i = comm_info_vector.begin(); - EntityCommInfoVector::const_iterator e = comm_info_vector.end(); + EntityCommInfoVector::const_iterator end = comm_info_vector.end(); + EntityCommInfoVector::const_iterator e = i; - // EntityCommInfo(1,0) is the smallest entry in the table that is not shared, - // and we want everything before this, i.e. the shared stuff. - e = std::lower_bound( i , e , EntityCommInfo(1, // ghost id, 1->aura - 0 ) ); // proc + while(e != end && e->ghost_id < 1) { + ++e; + } - // Contains everything up to the first aura comm (IE, only contains shared comms) return PairIterEntityComm( i , e ); } diff --git a/packages/stk/stk_mesh/stk_mesh/base/EntityCommListInfo.hpp b/packages/stk/stk_mesh/stk_mesh/base/EntityCommListInfo.hpp index 584737d96ef8..1da8f74dc33a 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/EntityCommListInfo.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/EntityCommListInfo.hpp @@ -50,7 +50,6 @@ struct EntityCommListInfo Entity entity; // Might be invalid if entity has been deleted. Bucket* bucket; size_t bucket_ordinal; - int owner; const EntityComm* entity_comm; // Might be NULL if entity has been deleted. }; diff --git a/packages/stk/stk_mesh/stk_mesh/base/FieldDataManager.cpp b/packages/stk/stk_mesh/stk_mesh/base/FieldDataManager.cpp index 049e92dc3e53..dc8833284ef9 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/FieldDataManager.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/FieldDataManager.cpp @@ -207,7 +207,7 @@ std::vector DefaultFieldDataManager::get_old_bucket_field_offsets(const } } oldOffsetForField.push_back(currentFieldOldOffset); - return std::move(oldOffsetForField); + return oldOffsetForField; } std::vector DefaultFieldDataManager::get_new_bucket_field_offsets(const EntityRank rank, @@ -234,7 +234,7 @@ std::vector DefaultFieldDataManager::get_new_bucket_field_offsets(const } } newOffsetForField.push_back(currentFieldNewOffset); - return std::move(newOffsetForField); + return newOffsetForField; } void DefaultFieldDataManager::copy_field_data_from_old_to_new_bucket(const EntityRank rank, @@ -686,7 +686,7 @@ std::vector ContiguousFieldDataManager::get_field_bucket_offsets(const s currentBucketOffset += bucketDataSizeThisField; } offsetForBucket.push_back(currentBucketOffset); - return std::move(offsetForBucket); + return offsetForBucket; } void ContiguousFieldDataManager::copy_bucket_data_from_old_to_new_field(const std::vector& oldOffsetForBucket, diff --git a/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.cpp b/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.cpp index 0512a715b5f6..9d99ea24bc17 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.cpp @@ -78,7 +78,7 @@ void communicate_field_data( const unsigned bucketId = meshIdx.bucket->bucket_id(); EntityRank erank = meshIdx.bucket->entity_rank(); - const bool owned = ecli.owner == parallel_rank ; + const bool owned = meshIdx.bucket->owned(); unsigned e_size = 0 ; for ( const FieldBase* fptr : fields) { @@ -93,6 +93,7 @@ void communicate_field_data( continue; } + const int owner = mesh.parallel_owner_rank(ecli.entity); const EntityCommInfoVector& infovec = ecli.entity_comm->comm_map; if ( owned ) { for (const EntityCommInfo& ec : infovec) { @@ -104,7 +105,7 @@ void communicate_field_data( else { for (const EntityCommInfo& ec : infovec) { if (ec.ghost_id == ghost_id) { - recv_size[ ecli.owner ] += e_size ; + recv_size[ owner ] += e_size ; break;//jump out since we know we're only recving 1 msg for this entity from the 1-and-only owner } } @@ -134,7 +135,8 @@ void communicate_field_data( for (int phase = 0; phase < 2; ++phase) { for ( const EntityCommListInfo& ecli : mesh.internal_comm_list()) { - if ( (phase == 0 && ecli.owner == parallel_rank) || (phase == 1 && ecli.owner != parallel_rank) ) { + const int owner = mesh.parallel_owner_rank(ecli.entity); + if ( (phase == 0 && owner == parallel_rank) || (phase == 1 && owner != parallel_rank) ) { Entity e = ecli.entity; const MeshIndex meshIdx = mesh.mesh_index(e); const unsigned bucketId = meshIdx.bucket->bucket_id(); @@ -163,7 +165,7 @@ void communicate_field_data( else { //recv for (const EntityCommInfo& ec : infovec) { if (ec.ghost_id == ghost_id) { - CommBufferV & b = sparse.recv_buffer( ecli.owner ); + CommBufferV & b = sparse.recv_buffer( owner ); b.unpack( ptr , size ); break; } @@ -448,10 +450,10 @@ void parallel_op_including_ghosts_impl(const BulkData & mesh, const std::vector< continue; } - const bool owned = comm_info_vec[i].owner == parallel_rank ; + const bool owned = bucket->owned(); if ( !owned ) { - send_size[ comm_info_vec[i].owner ] += e_size ; + send_size[ mesh.parallel_owner_rank(comm_info_vec[i].entity) ] += e_size ; } else { const EntityCommInfoVector& infovec = comm_info_vec[i].entity_comm->comm_map; @@ -489,7 +491,7 @@ void parallel_op_including_ghosts_impl(const BulkData & mesh, const std::vector< const FieldBase & f = **fi ; for (size_t i=0; i 0 ) { - int owner = comm_info_vec[i].owner; + const int owner = mesh.parallel_owner_rank(comm_info_vec[i].entity); if (f.data_traits().is_floating_point && f.data_traits().size_of == 8) { diff --git a/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.hpp b/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.hpp index 6de16efa62e0..066050eeca81 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/FieldParallel.hpp @@ -95,62 +95,68 @@ inline bool find_proc_before_index(const EntityCommInfoVector& infovec, int proc return false; } +struct InfoRankLess { + bool operator()(const EntityCommListInfo& info, EntityRank rank) const + { return info.bucket->entity_rank() < rank; } + bool operator()(EntityRank rank, const EntityCommListInfo& info) const + { return rank < info.bucket->entity_rank(); } +}; + inline void communicate_field_data( const BulkData & mesh , const std::vector< const FieldBase *> & fields ) { - if ( fields.empty() ) { return; } - const int parallel_size = mesh.parallel_size(); - const int parallel_rank = mesh.parallel_rank(); + if ( fields.empty() || parallel_size == 1) { return; } - const std::vector::const_iterator fe = fields.end(); - const std::vector::const_iterator fb = fields.begin(); - std::vector::const_iterator fi ; + const int numFields = fields.size(); std::vector > send_data(parallel_size); std::vector > recv_data(parallel_size); const EntityCommListInfoVector &comm_info_vec = mesh.internal_comm_list(); - size_t comm_info_vec_size = comm_info_vec.size(); std::vector send_sizes(parallel_size, 0); std::vector recv_sizes(parallel_size, 0); + std::vector > fieldRange(fields.size(), std::make_pair(-1,-1)); + for(int fi=0; fientity_rank(); + EntityCommListInfoVector::const_iterator startIter = std::lower_bound(comm_info_vec.begin(), comm_info_vec.end(), fieldRank, InfoRankLess()); + EntityCommListInfoVector::const_iterator endIter = std::upper_bound(startIter, comm_info_vec.end(), fieldRank, InfoRankLess()); + fieldRange[fi].first = std::distance(comm_info_vec.begin(), startIter); + fieldRange[fi].second = std::distance(comm_info_vec.begin(), endIter); + } + //this first loop calculates send_sizes and recv_sizes. - for(fi = fb; fi != fe; ++fi) + for(int fi=0; fibucket_id(); - unsigned size = field_bytes_per_entity(f, bucketId); - e_size += size; - } + const unsigned bucketId = bucket->bucket_id(); + const unsigned size = field_bytes_per_entity(f, bucketId); + e_size += size; if(e_size == 0) { continue; } + const bool owned = bucket->owned(); if(owned) { const EntityCommInfoVector& infovec = comm_info_vec[i].entity_comm->comm_map; - size_t infovec_size = infovec.size(); - for(size_t j=0; j0 && find_proc_before_index(infovec, proc, j); if (!proc_already_found) { send_sizes[proc] += e_size; } @@ -158,6 +164,8 @@ inline void communicate_field_data( } else { + const int owner = mesh.parallel_owner_rank(comm_info_vec[i].entity); + recv_sizes[owner] += e_size; } } @@ -182,22 +190,20 @@ inline void communicate_field_data( std::vector field_data(max_len); unsigned char* field_data_ptr = field_data.data(); - for(fi = fb; fi != fe; ++fi) + for(int fi=0; fiowned(); unsigned e_size = 0; - if(is_matching_rank(f, *bucket)) { const unsigned bucketId = bucket->bucket_id(); - unsigned size = field_bytes_per_entity(f, bucketId); + const unsigned size = field_bytes_per_entity(f, bucketId); if (owned && size > 0) { unsigned char * ptr = reinterpret_cast(stk::mesh::field_data(f, bucketId, comm_info_vec[i].bucket_ordinal, size)); @@ -214,15 +220,15 @@ inline void communicate_field_data( if(owned) { const EntityCommInfoVector& infovec = comm_info_vec[i].entity_comm->comm_map; - size_t infovec_size = infovec.size(); - for(size_t j=0; j0 && find_proc_before_index(infovec, proc, j); if (!proc_already_found) { unsigned char* dest_ptr = send_data[proc].data()+send_sizes[proc]; - unsigned char* src_ptr = field_data_ptr; + const unsigned char* src_ptr = field_data_ptr; std::memcpy(dest_ptr, src_ptr, e_size); send_sizes[proc] += e_size; } @@ -243,26 +249,26 @@ inline void communicate_field_data( parallel_data_exchange_nonsym_known_sizes_t(send_data, recv_data, mesh.parallel()); //now unpack and store the recvd data - for(fi = fb; fi != fe; ++fi) + for(int fi=0; fiowned()) { + continue; + } - if(owned || recv_data[owner].size() == 0) + const int owner = mesh.parallel_owner_rank(comm_info_vec[i].entity); + if(recv_data[owner].size() == 0) { continue; } - const Bucket* bucket = comm_info_vec[i].bucket; - - if(is_matching_rank(f, *bucket)) { const unsigned bucketId = bucket->bucket_id(); - unsigned size = field_bytes_per_entity(f, bucketId); + const unsigned size = field_bytes_per_entity(f, bucketId); if (size > 0) { unsigned char * ptr = reinterpret_cast(stk::mesh::field_data(f, bucketId, comm_info_vec[i].bucket_ordinal, size)); diff --git a/packages/stk/stk_mesh/stk_mesh/base/Ghosting.cpp b/packages/stk/stk_mesh/stk_mesh/base/Ghosting.cpp index 7c7df98d60e1..4a54ab9645d4 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/Ghosting.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/Ghosting.cpp @@ -45,7 +45,7 @@ namespace mesh { void Ghosting::send_list( std::vector< EntityProc > & v ) const { for ( const EntityCommListInfo& commListInfo : m_mesh.internal_comm_list() ) { - if ( commListInfo.owner == m_mesh.parallel_rank() ) { + if ( m_mesh.parallel_owner_rank(commListInfo.entity) == m_mesh.parallel_rank() ) { for ( PairIterEntityComm ec = m_mesh.internal_entity_comm_map(commListInfo.key) ; ! ec.empty() ; ++ec ) { if ( ec->ghost_id == m_ordinal ) { v.push_back( EntityProc( commListInfo.entity , ec->proc ) ); @@ -58,7 +58,7 @@ void Ghosting::send_list( std::vector< EntityProc > & v ) const void Ghosting::receive_list( std::vector & v ) const { for ( const EntityCommListInfo& commListInfo : m_mesh.internal_comm_list() ) { - if ( commListInfo.owner != m_mesh.parallel_rank() ) { + if ( m_mesh.parallel_owner_rank(commListInfo.entity) != m_mesh.parallel_rank() ) { for ( PairIterEntityComm ec = m_mesh.internal_entity_comm_map(commListInfo.key) ; ! ec.empty() ; ++ec ) { if ( ec->ghost_id == m_ordinal ) { v.push_back(commListInfo.key); @@ -76,7 +76,7 @@ std::ostream& Ghosting::operator<<(std::ostream& out) const out << " Locally owned entities ghosted on other processors (send list):\n"; for ( const EntityCommListInfo& commListInfo : m_mesh.internal_comm_list() ) { - if ( commListInfo.owner == m_mesh.parallel_rank() ) { + if ( m_mesh.parallel_owner_rank(commListInfo.entity) == m_mesh.parallel_rank() ) { for ( PairIterEntityComm ec = m_mesh.internal_entity_comm_map(commListInfo.key) ; ! ec.empty() ; ++ec ) { if ( ec->ghost_id == m_ordinal ) { out << " "; @@ -90,12 +90,12 @@ std::ostream& Ghosting::operator<<(std::ostream& out) const out << " Entities ghosted on this processor from the owner (recv list):\n"; for ( const EntityCommListInfo& commListInfo : m_mesh.internal_comm_list() ) { - if ( commListInfo.owner != m_mesh.parallel_rank() ) { + if ( m_mesh.parallel_owner_rank(commListInfo.entity) != m_mesh.parallel_rank() ) { for ( PairIterEntityComm ec = m_mesh.internal_entity_comm_map(commListInfo.key); !ec.empty(); ++ec ) { if ( ec->ghost_id == m_ordinal ) { out << " "; out << commListInfo.key.id(); - out << ", owner of ghost is " << commListInfo.owner + out << ", owner of ghost is " << m_mesh.parallel_owner_rank(commListInfo.entity) << ", status is: " << m_mesh.state(commListInfo.entity) << "\n"; } } diff --git a/packages/stk/stk_mesh/stk_mesh/base/Ghosting.hpp b/packages/stk/stk_mesh/stk_mesh/base/Ghosting.hpp index bbd4875fb3d8..d6b4fece9d62 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/Ghosting.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/Ghosting.hpp @@ -62,11 +62,6 @@ class Ghosting { /** \brief Ordinal to identify the ghosting subset */ unsigned ordinal() const { return m_ordinal ; } - /** \brief Bulk data synchronization count when this - * ghosting object was last modified. - */ - size_t synchronized_count() const { return m_sync_count ; } - /** \brief Locally owned entities ghosted on other processors. * * This generated communication list for sending updates @@ -96,11 +91,10 @@ class Ghosting { BulkData & m_mesh ; ///< Owner const std::string m_name ; ///< Name for printing purposes - size_t m_sync_count ; ///< Bulk data sync count unsigned m_ordinal ; - Ghosting( BulkData & M , const std::string & n , unsigned ord , size_t count ) - : m_mesh( M ) , m_name( n ), m_sync_count( count ), m_ordinal( ord ) {} + Ghosting( BulkData & M , const std::string & n , unsigned ord ) + : m_mesh( M ) , m_name( n ), m_ordinal( ord ) {} ~Ghosting() {} diff --git a/packages/stk/stk_mesh/stk_mesh/base/MetaData.cpp b/packages/stk/stk_mesh/stk_mesh/base/MetaData.cpp index 7efa929c8c5c..bf30d31392dc 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/MetaData.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/MetaData.cpp @@ -88,32 +88,6 @@ void find_topologies_in_part_and_subsets_of_same_rank(const Part & part, EntityR } } -//---------------------------------------------------------------------- - -stk::mesh::FieldBase* try_to_find_coord_field(const stk::mesh::MetaData& meta) -{ - //attempt to initialize the coordinate-field pointer, trying a couple - //of commonly-used names. It is expected that the client code will initialize - //the coordinates field using set_coordinate_field, but this is an - //attempt to be helpful for existing client codes which aren't yet calling that. - - stk::mesh::FieldBase* coord_field = meta.get_field(stk::topology::NODE_RANK, "mesh_model_coordinates"); - if (coord_field == NULL) { - coord_field = meta.get_field(stk::topology::NODE_RANK, "mesh_model_coordinates_0"); - } - if (coord_field == NULL) { - coord_field = meta.get_field(stk::topology::NODE_RANK, "model_coordinates"); - } - if (coord_field == NULL) { - coord_field = meta.get_field(stk::topology::NODE_RANK, "model_coordinates_0"); - } - if (coord_field == NULL) { - coord_field = meta.get_field(stk::topology::NODE_RANK, "coordinates"); - } - - return coord_field; -} - } // namespace void MetaData::assign_topology(Part& part, stk::topology stkTopo) @@ -257,7 +231,9 @@ MetaData::MetaData() //---------------------------------------------------------------------- -void MetaData::initialize(size_t spatial_dimension, const std::vector &rank_names) +void MetaData::initialize(size_t spatial_dimension, + const std::vector &rank_names, + const std::string &coordinate_field_name) { ThrowErrorMsgIf( !m_entity_rank_names.empty(), "already initialized"); ThrowErrorMsgIf( spatial_dimension == 0, "Min spatial dimension is 1"); @@ -275,6 +251,10 @@ void MetaData::initialize(size_t spatial_dimension, const std::vectorname(); +} + +stk::mesh::FieldBase* try_to_find_coord_field(const stk::mesh::MetaData& meta) +{ + //attempt to initialize the coordinate-field pointer, trying a couple + //of commonly-used names. It is expected that the client code will initialize + //the coordinates field using set_coordinate_field, but this is an + //attempt to be helpful for existing client codes which aren't yet calling that. + + stk::mesh::FieldBase* coord_field = meta.get_field(stk::topology::NODE_RANK, "mesh_model_coordinates"); + + if (coord_field == nullptr) { + coord_field = meta.get_field(stk::topology::NODE_RANK, "mesh_model_coordinates_0"); + } + if (coord_field == nullptr) { + coord_field = meta.get_field(stk::topology::NODE_RANK, "model_coordinates"); + } + if (coord_field == nullptr) { + coord_field = meta.get_field(stk::topology::NODE_RANK, "model_coordinates_0"); + } + if (coord_field == nullptr) { + coord_field = meta.get_field(stk::topology::NODE_RANK, "coordinates"); + } + if (coord_field == nullptr) { + coord_field = meta.get_field(stk::topology::NODE_RANK, meta.coordinate_field_name()); + } + + return coord_field; +} + FieldBase const* MetaData::coordinate_field() const { - if (m_coord_field == NULL) { - m_coord_field = try_to_find_coord_field(*this); + if (m_coord_field == nullptr) { + if (!m_coord_field_name.empty()) { + m_coord_field = get_field(stk::topology::NODE_RANK, m_coord_field_name); + } + else { + m_coord_field = try_to_find_coord_field(*this); + if (m_coord_field != nullptr) { + m_coord_field_name = m_coord_field->name(); + } + } } - ThrowErrorMsgIf( m_coord_field == NULL, + ThrowErrorMsgIf( m_coord_field == nullptr, "MetaData::coordinate_field: Coordinate field has not been defined" ); return m_coord_field; diff --git a/packages/stk/stk_mesh/stk_mesh/base/MetaData.hpp b/packages/stk/stk_mesh/stk_mesh/base/MetaData.hpp index 6c95a4f8f5ed..fb3dc5cacbbe 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/MetaData.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/MetaData.hpp @@ -332,7 +332,9 @@ class MetaData { /** \brief initialize * */ - void initialize(size_t spatial_dimension, const std::vector &rank_names = std::vector()); + void initialize(size_t spatial_dimension, + const std::vector &rank_names = std::vector(), + const std::string & coordinate_field_name = std::string()); bool is_initialized() const { return !m_entity_rank_names.empty(); } @@ -393,9 +395,12 @@ class MetaData { */ FieldBase* get_field( stk::mesh::EntityRank entity_rank, const std::string& name ) const; + std::string coordinate_field_name() const; + void set_coordinate_field_name(const std::string & coordFieldName); + /** \brief Get/Set the coordinate field */ - FieldBase const* coordinate_field() const; - void set_coordinate_field(FieldBase* coord_field) { m_coord_field = coord_field; } + const FieldBase * coordinate_field() const; + void set_coordinate_field(FieldBase* coord_field); /** \brief Get all defined fields */ const FieldVector & get_fields() const { @@ -639,6 +644,7 @@ class MetaData { Part * m_aura_part ; impl::FieldRepository m_field_repo ; + mutable std::string m_coord_field_name; mutable FieldBase* m_coord_field; std::vector< std::string > m_entity_rank_names ; diff --git a/packages/stk/stk_mesh/stk_mesh/base/ModificationSummary.hpp b/packages/stk/stk_mesh/stk_mesh/base/ModificationSummary.hpp index 5b5beeb32898..11011dbadc45 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/ModificationSummary.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/ModificationSummary.hpp @@ -65,6 +65,10 @@ class EmptyModificationSummary { } + void track_change_ghosting(const stk::mesh::Ghosting & ghosts, const std::vector & add_send , const std::vector & remove_receive ) + { + } + void track_add_to_ghosting(const stk::mesh::Ghosting & ghosts, const std::vector & add_send ) { } @@ -156,6 +160,7 @@ class ModificationSummary void track_induced_parts(stk::mesh::Entity entity, stk::mesh::Entity e_to, const stk::mesh::OrdinalVector& add_parts, const stk::mesh::OrdinalVector& emptyParts); void track_change_ghosting(const stk::mesh::Ghosting & ghosts, const std::vector & add_send , const std::vector & remove_receive ); + void track_change_ghosting(const stk::mesh::Ghosting & ghosts, const std::vector & add_send , const std::vector & remove_receive ); void track_add_to_ghosting(const stk::mesh::Ghosting & ghosts, const std::vector & add_send ); diff --git a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.cpp b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.cpp index a64c9bf6768c..9f6c4ae1e7fc 100644 --- a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.cpp +++ b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.cpp @@ -924,8 +924,8 @@ bool check_permutations_on_all(stk::mesh::BulkData& mesh) // Fill a new send list from the receive list. void send_entity_keys_to_owners( BulkData & mesh , - const std::set< EntityKey > & entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs, - std::set< EntityProc , EntityLess > & entitiesToGhostOntoOtherProcessors ) + const std::set< EntityKey > & recvGhosts, + std::set< EntityProc , EntityLess > & sendGhosts ) { const int parallel_size = mesh.parallel_size(); @@ -934,7 +934,7 @@ void send_entity_keys_to_owners( // For all entity keys in new recv, send the entity key to the owning proc for ( int phase = 0; phase < 2; ++phase) { for ( std::set::const_iterator - i = entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.begin() ; i != entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.end() ; ++i ) { + i = recvGhosts.begin() ; i != recvGhosts.end() ; ++i ) { Entity e = mesh.get_entity(*i); // Performance issue? Not if you're just doing full regens const int owner = mesh.parallel_owner_rank(e); const EntityKey key = mesh.entity_key(e); @@ -948,14 +948,51 @@ void send_entity_keys_to_owners( } } - // Insert into entitiesToGhostOntoOtherProcessors that there is an entity on another proc + // Insert into sendGhosts that there is an entity on another proc for ( int proc_rank = 0 ; proc_rank < parallel_size ; ++proc_rank ) { stk::CommBuffer & buf = sparse.recv_buffer(proc_rank); while ( buf.remaining() ) { EntityKey key ; buf.unpack( key ); EntityProc tmp( mesh.get_entity( key ) , proc_rank ); - entitiesToGhostOntoOtherProcessors.insert( tmp ); + sendGhosts.insert( tmp ); + } + } +} + +void send_entity_keys_to_owners( + BulkData & mesh , + const std::vector & recvGhosts, + std::set< EntityProc , EntityLess > & sendGhosts) +{ + const int parallel_size = mesh.parallel_size(); + + stk::CommSparse sparse( mesh.parallel() ); + + // For all entity keys in recvGhosts, send the entity key to the owning proc + for ( int phase = 0; phase < 2; ++phase) { + for (Entity recvGhost : recvGhosts) { + const int owner = mesh.parallel_owner_rank(recvGhost); + const EntityKey key = mesh.entity_key(recvGhost); + sparse.send_buffer( owner ).pack( key ); + } + if (phase == 0) { //allocation phase + sparse.allocate_buffers(); + } + else { //communication phase + sparse.communicate(); + } + } + + // Insert into sendGhosts that entities need to be recvd on another proc + for ( int proc_rank = 0 ; proc_rank < parallel_size ; ++proc_rank ) { + stk::CommBuffer & buf = sparse.recv_buffer(proc_rank); + while ( buf.remaining() ) { + EntityKey key ; + buf.unpack( key ); + Entity entity = mesh.get_entity(key); + EntityProc tmp( entity, proc_rank ); + sendGhosts.insert( tmp ); } } } @@ -964,8 +1001,8 @@ void send_entity_keys_to_owners( void comm_sync_send_recv( BulkData & mesh , - std::set< EntityProc , EntityLess > & entitiesToGhostOntoOtherProcessors , - std::set< EntityKey > & entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs ) + std::set< EntityProc , EntityLess > & sendGhosts , + std::set< EntityKey > & recvGhosts ) { const int parallel_rank = mesh.parallel_rank(); const int parallel_size = mesh.parallel_size(); @@ -975,7 +1012,7 @@ void comm_sync_send_recv( // Communication sizing: for ( std::set< EntityProc , EntityLess >::iterator - i = entitiesToGhostOntoOtherProcessors.begin() ; i != entitiesToGhostOntoOtherProcessors.end() ; ++i ) { + i = sendGhosts.begin() ; i != sendGhosts.end() ; ++i ) { const int owner = mesh.parallel_owner_rank(i->first); all.send_buffer( i->second ).skip(1).skip(1); if ( owner != parallel_rank ) { @@ -985,12 +1022,12 @@ void comm_sync_send_recv( all.allocate_buffers(); - // Loop thru all entities in entitiesToGhostOntoOtherProcessors, send the entity key to the sharing/ghosting proc + // Loop thru all entities in sendGhosts, send the entity key to the sharing/ghosting proc // Also, if the owner of the entity is NOT me, also send the entity key to the owing proc // Communication packing (with message content comments): for ( std::set< EntityProc , EntityLess >::iterator - i = entitiesToGhostOntoOtherProcessors.begin() ; i != entitiesToGhostOntoOtherProcessors.end() ; ) { + i = sendGhosts.begin() ; i != sendGhosts.end() ; ) { const int owner = mesh.parallel_owner_rank(i->first); // Inform receiver of ghosting, the receiver does not own @@ -1012,7 +1049,103 @@ void comm_sync_send_recv( // Erase it from my processor's ghosting responsibility: // The iterator passed to the erase method will be invalidated. std::set< EntityProc , EntityLess >::iterator jrem = i ; ++i ; - entitiesToGhostOntoOtherProcessors.erase( jrem ); + sendGhosts.erase( jrem ); + } + else { + ++i ; + } + } + + all.communicate(); + + // Loop thru all the buffers, and insert ghosting request for entity e to other proc + // if the proc sending me the data is me, then insert into new_recv. + // Communication unpacking: + for ( int p = 0 ; p < parallel_size ; ++p ) { + CommBuffer & buf = all.recv_buffer(p); + while ( buf.remaining() ) { + + EntityKey entity_key; + int proc = 0; + + buf.unpack(entity_key).unpack(proc); + + Entity const e = mesh.get_entity( entity_key ); + + if ( parallel_rank != proc ) { + // Receiving a ghosting need for an entity I own. + // Add it to my send list. + ThrowRequireMsg(mesh.is_valid(e), + "Unknown entity key: " << + MetaData::get(mesh).entity_rank_name(entity_key.rank()) << + "[" << entity_key.id() << "]"); + EntityProc tmp( e , proc ); + sendGhosts.insert( tmp ); + } + else if ( mesh.is_valid(e) ) { + // I am the receiver for this ghost. + // If I already have it add it to the receive list, + // otherwise don't worry about it - I will receive + // it in the final new-ghosting communication. + recvGhosts.insert( mesh.entity_key(e) ); + } + } + } +} + +void comm_sync_send_recv( + BulkData & mesh , + std::set< EntityProc , EntityLess > & sendGhosts , + std::vector & recvGhosts, + std::vector& ghostStatus ) +{ + const int parallel_rank = mesh.parallel_rank(); + const int parallel_size = mesh.parallel_size(); + + stk::CommSparse all( mesh.parallel() ); + + // Communication sizing: + + for ( std::set< EntityProc , EntityLess >::iterator + i = sendGhosts.begin() ; i != sendGhosts.end() ; ++i ) { + const int owner = mesh.parallel_owner_rank(i->first); + all.send_buffer( i->second ).skip(1).skip(1); + if ( owner != parallel_rank ) { + all.send_buffer( owner ).skip(1).skip(1); + } + } + + all.allocate_buffers(); + + // Loop thru all entities in sendGhosts, send the entity key to the sharing/ghosting proc + // Also, if the owner of the entity is NOT me, also send the entity key to the owing proc + + // Communication packing (with message content comments): + for ( std::set< EntityProc , EntityLess >::iterator + i = sendGhosts.begin() ; i != sendGhosts.end() ; ) { + const int owner = mesh.parallel_owner_rank(i->first); + + // Inform receiver of ghosting, the receiver does not own + // and does not share this entity. + // The ghost either already exists or is a to-be-done new ghost. + // This status will be resolved on the final communication pass + // when new ghosts are packed and sent. + + const Entity entity = i->first; + const EntityKey entity_key = mesh.entity_key(entity); + const int proc = i->second; + + all.send_buffer( proc ).pack(entity_key).pack(proc); + + if ( owner != parallel_rank ) { + // I am not the owner of this entity. + // Inform the owner of this ghosting need. + all.send_buffer( owner ).pack(entity_key).pack(proc); + + // Erase it from my processor's ghosting responsibility: + // The iterator passed to the erase method will be invalidated. + std::set< EntityProc , EntityLess >::iterator jrem = i ; ++i ; + sendGhosts.erase( jrem ); } else { ++i ; @@ -1043,14 +1176,15 @@ void comm_sync_send_recv( MetaData::get(mesh).entity_rank_name(entity_key.rank()) << "[" << entity_key.id() << "]"); EntityProc tmp( e , proc ); - entitiesToGhostOntoOtherProcessors.insert( tmp ); + sendGhosts.insert( tmp ); } else if ( mesh.is_valid(e) ) { // I am the receiver for this ghost. // If I already have it add it to the receive list, // otherwise don't worry about it - I will receive // it in the final new-ghosting communication. - entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs.insert( mesh.entity_key(e) ); + recvGhosts.push_back( e ); + ghostStatus[e.local_offset()] = true; } } } @@ -1058,7 +1192,6 @@ void comm_sync_send_recv( void insert_upward_relations(const BulkData& bulk_data, Entity rel_entity, const EntityRank rank_of_orig_entity, - const int my_rank, const int share_proc, std::vector& send) { @@ -1067,24 +1200,22 @@ void insert_upward_relations(const BulkData& bulk_data, Entity rel_entity, // If related entity is higher rank, I own it, and it is not // already shared by proc, ghost it to the sharing processor. - if ( bulk_data.parallel_owner_rank(rel_entity) == my_rank && - ! bulk_data.in_shared( bulk_data.entity_key(rel_entity) , share_proc ) ) { + if ( bulk_data.bucket(rel_entity).owned() && ! bulk_data.in_shared(rel_entity, share_proc) ) { - EntityProc entry( rel_entity , share_proc ); - send.push_back( entry ); + send.emplace_back(rel_entity,share_proc); // There may be even higher-ranking entities that need to be ghosted, so we must recurse const EntityRank end_rank = static_cast(bulk_data.mesh_meta_data().entity_rank_count()); for (EntityRank irank = static_cast(rel_entity_rank + 1); irank < end_rank; ++irank) { - int num_rels = bulk_data.num_connectivity(rel_entity, irank); + const int num_rels = bulk_data.num_connectivity(rel_entity, irank); Entity const* rels = bulk_data.begin(rel_entity, irank); for (int r = 0; r < num_rels; ++r) { Entity const rel_of_rel_entity = rels[r]; if (bulk_data.is_valid(rel_of_rel_entity)) { - insert_upward_relations(bulk_data, rel_of_rel_entity, rel_entity_rank, my_rank, share_proc, send); + insert_upward_relations(bulk_data, rel_of_rel_entity, rel_entity_rank, share_proc, send); } } } diff --git a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.hpp b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.hpp index c0328e7ff78a..30924229b979 100644 --- a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.hpp +++ b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshImplUtils.hpp @@ -108,7 +108,6 @@ class GlobalIdEntitySorter : public EntitySorterBase } }; - template void VisitClosureGeneral( const BulkData & mesh, @@ -121,11 +120,13 @@ void VisitClosureGeneral( if (mesh.is_valid(entity_of_interest)) { EntityRank entity_of_interest_rank = mesh.entity_rank(entity_of_interest); for (EntityRank rank = stk::topology::NODE_RANK ; rank < entity_of_interest_rank ; ++rank) { - size_t num_entities_of_rank = mesh.num_connectivity(entity_of_interest,rank); - const Entity * entity_it = mesh.begin(entity_of_interest,rank); - - for (size_t i=0 ; i 0) { + const Entity * entities = mesh.begin(entity_of_interest,rank); + + for (unsigned i=0 ; i& status) + : mesh(mesh_in), ghosting(ghost), ghostStatus(status) {} + bool operator()(Entity entity) { + return mesh.is_valid(entity) && mesh.in_receive_ghost(ghosting, entity) && !ghostStatus[entity.local_offset()]; + } + const BulkData& mesh; + const Ghosting& ghosting; + const std::vector& ghostStatus; +}; + +struct VecPushBack { + VecPushBack(std::vector& rcvGhosts, std::vector& status) + : recvGhosts(rcvGhosts), ghostStatus(status) {} + void operator()(Entity entity) { + recvGhosts.push_back(entity); + ghostStatus[entity.local_offset()] = true; + } + std::vector& recvGhosts; + std::vector& ghostStatus; +}; + +void send_entity_keys_to_owners( + BulkData & mesh , + const std::set< EntityKey > & recvGhosts , + std::set< EntityProc , EntityLess > & sendGhosts ); + void send_entity_keys_to_owners( BulkData & mesh , - const std::set< EntityKey > & entitiesGhostedOnThisProcThatNeedInfoFromOtherProcs , - std::set< EntityProc , EntityLess > & entitiesToGhostOntoOtherProcessors ); + const std::vector & recvGhosts , + std::set< EntityProc , EntityLess > & sendGhosts); void comm_sync_send_recv( BulkData & mesh , std::set< EntityProc , EntityLess > & new_send , std::set< EntityKey > & new_recv ); +void comm_sync_send_recv( + BulkData & mesh , + std::set< EntityProc , EntityLess > & new_send , + std::vector & new_recv, + std::vector& ghostStatus ); + void insert_upward_relations(const BulkData& bulk_data, Entity rel_entity, const EntityRank rank_of_orig_entity, - const int my_rank, const int share_proc, std::vector& send); diff --git a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp index 2eb94d0e0c70..f4af0dce8dc6 100644 --- a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp +++ b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp @@ -232,7 +232,7 @@ void MeshModification::internal_resolve_shared_modify_delete(stk::mesh::EntityVe Entity entity = i->comm_info.entity; EntityKey key = i->comm_info.key; - int owner = i->comm_info.owner; + const int owner = m_bulkData.parallel_owner_rank(entity); const bool locally_destroyed = !m_bulkData.is_valid(entity); bool remote_owner_destroyed = false; diff --git a/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.cpp b/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.cpp index 5a6710f75961..190b449e2cc4 100644 --- a/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.cpp +++ b/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -50,10 +51,11 @@ void pack_key_and_ghost_ids(EntityKey key, bool locally_owned, const EntityCommI } } -void pack_send_data(int local_proc, const EntityCommListInfoVector& comm_list, stk::CommSparse& comm) +void pack_send_data(const stk::mesh::BulkData& mesh, int local_proc, + const EntityCommListInfoVector& comm_list, stk::CommSparse& comm) { for(const EntityCommListInfo& commInfo : comm_list) { - pack_key_and_ghost_ids(commInfo.key, commInfo.owner==local_proc, commInfo.entity_comm->comm_map, comm); + pack_key_and_ghost_ids(commInfo.key, mesh.parallel_owner_rank(commInfo.entity)==local_proc, commInfo.entity_comm->comm_map, comm); } } @@ -73,10 +75,10 @@ void push_back_key_procs_ghost_ids(EntityKey key, bool locally_owned, const Enti } } -void fill_expected_recv_data(int local_proc, const EntityCommListInfoVector& comm_list, std::vector& recv_data) +void fill_expected_recv_data(const stk::mesh::BulkData& mesh, const EntityCommListInfoVector& comm_list, std::vector& recv_data) { for(const EntityCommListInfo& commInfo : comm_list) { - push_back_key_procs_ghost_ids(commInfo.key, commInfo.owner==local_proc, commInfo.entity_comm->comm_map, recv_data); + push_back_key_procs_ghost_ids(commInfo.key, mesh.parallel_owner_rank(commInfo.entity)==mesh.parallel_rank(), commInfo.entity_comm->comm_map, recv_data); } stk::util::sort_and_unique(recv_data); } @@ -110,10 +112,11 @@ void check_for_expected_recv_data_that_failed_to_arrive(const std::vector expected_recv_data; - fill_expected_recv_data(local_proc, comm_list, expected_recv_data); + fill_expected_recv_data(mesh, comm_list, expected_recv_data); - stk::CommSparse comm(communicator); - pack_and_send_comm_list_data(local_proc, comm_list, comm); + stk::CommSparse comm(mesh.parallel()); + pack_and_send_comm_list_data(mesh, comm_list, comm); std::ostringstream os; unpack_and_check_recvd_data(comm, local_proc, num_procs, expected_recv_data, os); diff --git a/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.hpp b/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.hpp index a3544c128231..e9d8150d25fd 100644 --- a/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.hpp +++ b/packages/stk/stk_mesh/stk_mesh/baseImpl/check_comm_list.hpp @@ -10,8 +10,8 @@ namespace stk { namespace mesh { namespace impl { -bool is_comm_list_globally_consistent(stk::ParallelMachine communicator, const EntityCommListInfoVector& comm_list); -bool is_comm_list_globally_consistent(stk::ParallelMachine communicator, const EntityCommListInfoVector& comm_list, std::ostream& error_msg); +bool is_comm_list_globally_consistent(const stk::mesh::BulkData& mesh, const EntityCommListInfoVector& comm_list); +bool is_comm_list_globally_consistent(const stk::mesh::BulkData& mesh, const EntityCommListInfoVector& comm_list, std::ostream& error_msg); } //namespace impl } //namespace mesh diff --git a/packages/stk/stk_ngp/stk_ngp/NgpField.hpp b/packages/stk/stk_ngp/stk_ngp/NgpField.hpp index 83a21d7751e8..8e8ade0057c8 100644 --- a/packages/stk/stk_ngp/stk_ngp/NgpField.hpp +++ b/packages/stk/stk_ngp/stk_ngp/NgpField.hpp @@ -56,6 +56,7 @@ class FieldBase public: STK_FUNCTION FieldBase() = default; STK_FUNCTION virtual ~FieldBase() {} + virtual void sync_to_host() {} }; @@ -108,7 +109,7 @@ class StkFieldAdapter : public FieldBase }); } - void sync_to_host() { } + void sync_to_host() override { } void sync_to_device() { } @@ -192,7 +193,7 @@ class ConstStkFieldAdapter : public FieldBase unsigned get_ordinal() const { return stkFieldAdapter.get_ordinal(); } - void sync_to_host() { } + void sync_to_host() override { } void sync_to_device() { } @@ -298,7 +299,7 @@ class StaticField : public FieldBase Kokkos::deep_copy(deviceFieldExistsOnBucket, hostFieldExistsOnBucket); } - void sync_to_host() + void sync_to_host() override { if (need_sync_to_host()) { ProfilingBlock prof("copy_to_host for " + hostField->name()); @@ -563,7 +564,7 @@ class ConstStaticField : public FieldBase STK_FUNCTION unsigned get_ordinal() const { return staticField.get_ordinal(); } - void sync_to_host() + void sync_to_host() override { if (need_sync_to_host()) { copy_device_to_host(); diff --git a/packages/stk/stk_ngp/stk_ngp/NgpFieldManager.hpp b/packages/stk/stk_ngp/stk_ngp/NgpFieldManager.hpp index b1ee183560e4..61235f3ae8c2 100644 --- a/packages/stk/stk_ngp/stk_ngp/NgpFieldManager.hpp +++ b/packages/stk/stk_ngp/stk_ngp/NgpFieldManager.hpp @@ -96,6 +96,9 @@ class FieldManager const stk::mesh::BulkData& get_bulk() const {return *m_bulk;} + std::vector >& get_fields() { return m_fields; } + const std::vector >& get_fields() const { return m_fields; } + private: void construct_ngp_field( stk::mesh::Ordinal fieldOrdinal ) const { stk::mesh::FieldBase & field = *(m_bulk->mesh_meta_data().get_fields()[fieldOrdinal]); @@ -137,6 +140,9 @@ class FieldManager void clear_fields() { for ( std::shared_ptr & field : m_fields) { + if (nullptr != field.get()) { + field->sync_to_host(); //cheap/no-op if not needed + } field.reset(); } m_fields.clear(); diff --git a/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp b/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp index 5d8fee067c80..2ac1cbde86f3 100644 --- a/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp +++ b/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp @@ -309,7 +309,7 @@ TEST(NaluPerformance, BoxBoxIntersections) } } } - + TEST(stkSearch, boxSphereIntersection) { FloatBox box(0,0,0,1,1,1); diff --git a/packages/stk/stk_search/stk_search/BoundingBox.hpp b/packages/stk/stk_search/stk_search/BoundingBox.hpp index 20a6faee5317..cd7327d71139 100644 --- a/packages/stk/stk_search/stk_search/BoundingBox.hpp +++ b/packages/stk/stk_search/stk_search/BoundingBox.hpp @@ -207,18 +207,26 @@ template inline bool intersects(Sphere const& a, Box const& b) { Point const& ac = a.center(); - Point const& bmin = b.min_corner(); - Point const& bmax = b.max_corner(); - - const T1 r2 = a.radius() * a.radius(); - - // check that the nearest point in the bounding box is within the sphere - T1 dmin = 0; - for( int i = 0; i < 3; ++i ) { - if( ac[i] < bmin[i] ) dmin += (ac[i]-bmin[i])*(ac[i]-bmin[i]); - else if( ac[i] > bmax[i] ) dmin += (ac[i]-bmax[i])*(ac[i]-bmax[i]); + const T1 ar = a.radius(); + T1 distToBoxSquared = 0.0; + for(unsigned idir=0; idir<3; ++idir) { + const T2 boxMin = b.min_corner()[idir]; + const T2 boxMax = b.max_corner()[idir]; + const T1 sphereCenter = ac[idir]; + + if( sphereCenter + ar < boxMin) { + return false; + } else if(sphereCenter - ar > boxMax) { + return false; + } else if(sphereCenter < boxMin) { + T1 dist = boxMin-sphereCenter; + distToBoxSquared += dist*dist; + } else if(sphereCenter > boxMax) { + T1 dist = sphereCenter-boxMax; + distToBoxSquared += dist*dist; + } } - return dmin <= r2; + return (distToBoxSquared <= ar*ar); } // intersects: Box,Sphere diff --git a/packages/stk/stk_search/stk_search/Box.hpp b/packages/stk/stk_search/stk_search/Box.hpp index bfc1e9a8c9ff..64a7ecb38727 100644 --- a/packages/stk/stk_search/stk_search/Box.hpp +++ b/packages/stk/stk_search/stk_search/Box.hpp @@ -49,7 +49,14 @@ class Box static const int Dim = 3; static KOKKOS_FUNCTION constexpr value_type max() { return Kokkos::Details::ArithTraits::max() ;} - static KOKKOS_FUNCTION constexpr value_type min() { return Kokkos::Details::ArithTraits::min() ;} + static KOKKOS_FUNCTION constexpr value_type min() { + // Kokkos documentation claims this function is equivalent to numeric_limits::min() which returns the + // smallest positive representatble real value. However, ArithTraits::min() actually returns the most + // negative real value (which would be equilvalent to numeric_limits::lowest). If Kokkos ever changes + // the behavior of this min function to be consistent with Kokkos documentation this class will break badly + // as it is the 'lowest' value we really want here. + return Kokkos::Details::ArithTraits::min(); + } KOKKOS_FUNCTION Box( point_type const& x_min_corner = point_type(max(), max(), max()), point_type const& x_max_corner = point_type(min(), min(), min())) @@ -112,6 +119,13 @@ std::ostream& operator<<(std::ostream & out, Box const& b) return out; } +template +std::istream& operator>>(std::istream& in, Box& b) { + char c; + in >> c >> b.min_corner() >> c >> c >> b.max_corner() >> c; + return in; +} + }} //namespace stk::search #endif //STK_SEARCH_BOX_HPP diff --git a/packages/stk/stk_search/stk_search/Point.hpp b/packages/stk/stk_search/stk_search/Point.hpp index 9f33b55c967c..35e7a68c22ad 100644 --- a/packages/stk/stk_search/stk_search/Point.hpp +++ b/packages/stk/stk_search/stk_search/Point.hpp @@ -102,6 +102,13 @@ std::ostream& operator<<(std::ostream & out, Point const& p) return out; } +template +std::istream& operator>>(std::istream& in, Point& p) { + char c; + in >> c >> p[0] >> c >> p[1] >> c >> p[2] >> c; + return in; +} + }} // stk::search diff --git a/packages/stk/stk_search/unit_tests/UnitTestBoundingBox.cpp b/packages/stk/stk_search/unit_tests/UnitTestBoundingBox.cpp index 0a1a927b9cfe..ffe746d13ab3 100644 --- a/packages/stk/stk_search/unit_tests/UnitTestBoundingBox.cpp +++ b/packages/stk/stk_search/unit_tests/UnitTestBoundingBox.cpp @@ -271,77 +271,175 @@ TEST( stk_search_bounding_box, min_max_center) } -TEST( stk_search_bounding_box, intersects) +template +void CheckIntersections(T1 obj1, T2 obj2, bool expectedResult) { + using stk::search::intersects; + EXPECT_EQ(intersects(obj1, obj2), expectedResult); + EXPECT_EQ(intersects(obj2, obj1), expectedResult); +} + + +TEST( stk_search_bounding_box, intersects_point_point) +{ + typedef stk::search::Point Point; + + + Point a(0,0,0); + Point b(0,0,0); + Point c(1,0,0); + CheckIntersections(a, b, true); + CheckIntersections(a, c, false); +} + + +TEST( stk_search_bounding_box, intersects_point_sphere) { typedef stk::search::Sphere Sphere; + typedef stk::search::Point Point; + + Point a(0,0,0); + Sphere b(Point(0,0,0),1); + Point c(2, 0, 0); + + CheckIntersections(a, b, true); + CheckIntersections(a, c, false); +} + +TEST( stk_search_bounding_box, intersects_point_box) +{ typedef stk::search::Box Box; typedef stk::search::Point Point; + + Point a(0.5,0.5,0.5); + Box b(Point(0,0,0),Point(1,1,1)); + Point c(2, 0, 0); + + CheckIntersections(a, b, true); + CheckIntersections(a, c, false); +} + + +TEST( stk_search_bounding_box, intersects_sphere_sphere) +{ + typedef stk::search::Sphere Sphere; + using stk::search::intersects; - //Point,Point - { - Point a(0,0,0); - Point b(0,0,0); - EXPECT_TRUE( intersects(a,b) ); - a[0] = 1; - EXPECT_FALSE( intersects(a,b) ); - } + Sphere a(Point(0,0,0),2); + Sphere b(Point(1,1,1),2); + Sphere c(Point(-3, -3, -3), 2); - //Point,Sphere - { - Point a(0,0,0); - Sphere b(Point(0,0,0),1); - EXPECT_TRUE( intersects(a,b) ); - EXPECT_TRUE( intersects(b,a) ); - a[0] = 2; - EXPECT_FALSE( intersects(a,b) ); - EXPECT_FALSE( intersects(b,a) ); - } + CheckIntersections(a, b, true); + CheckIntersections(a, c, false); - //Point,Box - { - Point a(0.5,0.5,0.5); - Box b(Point(0,0,0),Point(1,1,1)); - EXPECT_TRUE( intersects(a,b) ); - EXPECT_TRUE( intersects(b,a) ); - a[0] = 2; - EXPECT_FALSE( intersects(a,b) ); - EXPECT_FALSE( intersects(b,a) ); - } +} - //Sphere,Sphere - { - Sphere a(Point(0,0,0),2); - Sphere b(Point(1,1,1),2); - EXPECT_TRUE( intersects(a,b) ); - EXPECT_TRUE( intersects(b,a) ); - a.set_center(Point(-3,-3,-3)); - EXPECT_FALSE( intersects(a,b) ); - EXPECT_FALSE( intersects(b,a) ); - } - //Sphere,Box - { - Sphere a(Point(0,0,0),1); - Box b(Point(.3,.3,.3),Point(2,2,2)); - EXPECT_TRUE( intersects(a,b) ); - EXPECT_TRUE( intersects(b,a) ); - b.set_min_corner(Point(.9,.9,.9)); - EXPECT_FALSE( intersects(a,b) ); - EXPECT_FALSE( intersects(b,a) ); - } +TEST( stk_search_bounding_box, intersects_sphere_box) +{ + typedef stk::search::Sphere Sphere; + typedef stk::search::Box Box; + using stk::search::intersects; - //Box,Box - { - Box a(Point(0,0,0),Point(1.5,1.5,1.5)); - Box b(Point(1,1,1),Point(3,3,3)); - EXPECT_TRUE( intersects(a,b) ); - EXPECT_TRUE( intersects(b,a) ); - b.set_min_corner(Point(2,1,1)); - EXPECT_FALSE( intersects(a,b) ); - EXPECT_FALSE( intersects(b,a) ); - } + Box unitBox(Point(1, 1, 1), Point(2, 2, 2)); + Box nullSetBox; + + Sphere wayLeft (Point(-5, 1.5, 1.5), 0.5); + Sphere wayRight (Point( 5, 1.5, 1.5), 0.5); + Sphere diagonallyOutside1(Point(0.5, 0.5, 0.5), 0.8); + Sphere diagonallyInside1 (Point(0.5, 0.5, 0.5), 0.9); + Sphere diagonallyOutside2(Point(2.5, 2.5, 2.5), 0.8); + Sphere diagonallyInside2 (Point(2.5, 2.5, 2.5), 0.9); + Sphere justOutsideLeft (Point(0.5, 1.5, 1.5), 0.4999999); + Sphere justTouchingLeft (Point(0.5, 1.5, 1.5), 0.5); + Sphere justTouchingRight (Point(2.5, 1.5, 1.5), 0.5); + Sphere justOutsideRight (Point(2.5, 1.5, 1.5), 0.4999999); + Sphere encompassing (Point(4, 3, 1), 20); + Sphere inside (Point(1.1, 1.2, 1.3), 0.01); + + CheckIntersections(unitBox, wayLeft, false); + CheckIntersections(unitBox, wayRight, false); + CheckIntersections(unitBox, diagonallyOutside1, false); + CheckIntersections(unitBox, diagonallyInside1, true); + CheckIntersections(unitBox, diagonallyOutside2, false); + CheckIntersections(unitBox, diagonallyInside2, true); + CheckIntersections(unitBox, justOutsideLeft, false); + CheckIntersections(unitBox, justTouchingLeft, true); + CheckIntersections(unitBox, justTouchingRight, true); + CheckIntersections(unitBox, justOutsideRight, false); + CheckIntersections(unitBox, encompassing, true); + CheckIntersections(unitBox, inside, true); + + CheckIntersections(nullSetBox, wayLeft, false); + CheckIntersections(nullSetBox, wayRight, false); + CheckIntersections(nullSetBox, diagonallyOutside1, false); + CheckIntersections(nullSetBox, diagonallyInside1, false); + CheckIntersections(nullSetBox, diagonallyOutside2, false); + CheckIntersections(nullSetBox, diagonallyInside2, false); + CheckIntersections(nullSetBox, justOutsideLeft, false); + CheckIntersections(nullSetBox, justTouchingLeft, false); + CheckIntersections(nullSetBox, justTouchingRight, false); + CheckIntersections(nullSetBox, justOutsideRight, false); + CheckIntersections(nullSetBox, encompassing, false); + CheckIntersections(nullSetBox, inside, false); + +} + +TEST( stk_search_bounding_box, intersects_box_box) +{ + typedef stk::search::Box Box; + using stk::search::intersects; + + Box unitBox(Point(1, 1, 1), Point(2, 2, 2)); + Box nullSetBox; + + Box wayLeft (Point(-5, 1, 1), Point(-4, 2, 2)); + Box wayRight (Point( 5, 1, 1), Point( 6, 2, 2)); + Box diagonallyOutside(Point(0.5, 0.5, 0.5), Point(0.9, 0.9, 0.9)); + Box diagonallyInside (Point(0.5, 0.5, 0.5), Point(1.1, 1.1, 1.1)); + Box justOutsideLeft (Point(0, 1, 1), Point(0.999999, 2, 2)); + Box justTouchingLeft (Point(0, 1, 1), Point(1, 2, 2)); + Box justTouchingRight(Point(2, 1, 1), Point(3, 2, 2)); + Box justOutsideRight (Point(2.000001, 1, 1), Point(3, 2, 2)); + Box encompassing (Point(-7, -8, -9), Point(10, 11, 12)); + Box inside (Point(1.1, 1.2, 1.3), Point(1.4, 1.5, 1.6)); + Box alsoNull; + + CheckIntersections(unitBox, wayLeft, false); + CheckIntersections(unitBox, wayRight, false); + CheckIntersections(unitBox, diagonallyOutside, false); + CheckIntersections(unitBox, diagonallyInside, true); + CheckIntersections(unitBox, justOutsideLeft, false); + CheckIntersections(unitBox, justTouchingLeft, true); + CheckIntersections(unitBox, justTouchingRight, true); + CheckIntersections(unitBox, justOutsideRight, false); + CheckIntersections(unitBox, encompassing, true); + CheckIntersections(unitBox, inside, true); + CheckIntersections(unitBox, alsoNull, false); + + CheckIntersections(nullSetBox, wayLeft, false); + CheckIntersections(nullSetBox, wayRight, false); + CheckIntersections(nullSetBox, diagonallyOutside, false); + CheckIntersections(nullSetBox, diagonallyInside, false); + CheckIntersections(nullSetBox, justOutsideLeft, false); + CheckIntersections(nullSetBox, justTouchingLeft, false); + CheckIntersections(nullSetBox, justTouchingRight, false); + CheckIntersections(nullSetBox, justOutsideRight, false); + CheckIntersections(nullSetBox, encompassing, false); + CheckIntersections(nullSetBox, inside, false); + CheckIntersections(nullSetBox, alsoNull, false); +} + +TEST( stk_search_bounding_box, read_box_as_written) { + std::stringstream ss; + stk::search::Box box({0,0,0}, {1,1,1}); + stk::search::Box readBox, readBox2; + ss << box << "\n" << box << "\n"; + ss >> readBox >> readBox2; + + EXPECT_EQ(box, readBox ); + EXPECT_EQ(box, readBox2 ); } diff --git a/packages/stk/stk_simd.tar.gz b/packages/stk/stk_simd.tar.gz deleted file mode 100644 index f3f6d15bee8016e7a4d68bb24df69d4052b93c64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 47807 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%0A6yv`rI{*j^yt4Oan*x*U+?N(OARKVa5xdItr=lR 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 diff --git a/packages/stk/stk_tools/stk_tools/mesh_clone/MeshClone.cpp b/packages/stk/stk_tools/stk_tools/mesh_clone/MeshClone.cpp index b3a106dd56ce..6815f01225a4 100644 --- a/packages/stk/stk_tools/stk_tools/mesh_clone/MeshClone.cpp +++ b/packages/stk/stk_tools/stk_tools/mesh_clone/MeshClone.cpp @@ -126,7 +126,12 @@ void copy_surface_to_block_mapping(const stk::mesh::MetaData &oldMeta, stk::mesh void copy_meta(const stk::mesh::MetaData &inputMeta, stk::mesh::MetaData &outputMeta) { - outputMeta.initialize(inputMeta.spatial_dimension(), inputMeta.entity_rank_names()); + // Query the coordinate field, to figure out the final name (if none set by the user) + inputMeta.coordinate_field(); + + outputMeta.initialize(inputMeta.spatial_dimension(), + inputMeta.entity_rank_names(), + inputMeta.coordinate_field_name()); copy_parts(inputMeta, outputMeta); copy_fields(inputMeta, outputMeta); copy_surface_to_block_mapping(inputMeta, outputMeta); diff --git a/packages/stk/stk_tools/stk_tools/mesh_tools/DisconnectBlocksImpl.cpp b/packages/stk/stk_tools/stk_tools/mesh_tools/DisconnectBlocksImpl.cpp index f27c87a85239..5fbc893a366a 100644 --- a/packages/stk/stk_tools/stk_tools/mesh_tools/DisconnectBlocksImpl.cpp +++ b/packages/stk/stk_tools/stk_tools/mesh_tools/DisconnectBlocksImpl.cpp @@ -168,7 +168,7 @@ std::vector get_block_pairs_to_disconnect(const stk::mesh::BulkDa } } - return std::move(blockPairsToDisconnect); + return blockPairsToDisconnect; } void disconnect_elements(stk::mesh::BulkData & bulk, diff --git a/packages/stk/stk_transfer/stk_transfer/copy_by_id/SearchByIdGeometric.cpp b/packages/stk/stk_transfer/stk_transfer/copy_by_id/SearchByIdGeometric.cpp index 274f1007af13..814e29bd3bef 100644 --- a/packages/stk/stk_transfer/stk_transfer/copy_by_id/SearchByIdGeometric.cpp +++ b/packages/stk/stk_transfer/stk_transfer/copy_by_id/SearchByIdGeometric.cpp @@ -101,7 +101,7 @@ void SearchByIdGeometric::do_search(const TransferCopyByIdMeshAdapter & mesha, EntityProcRelationVec source_to_target_vector; stk::search::coarse_search(source_bbox_vector, target_bbox_vector, - stk::search::BOOST_RTREE, + stk::search::KDTREE, mesha.comm(), source_to_target_vector ); diff --git a/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp b/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp index 0e850330c145..ee523aeac257 100644 --- a/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp +++ b/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp @@ -163,7 +163,7 @@ class BulkDataTester : public stk::mesh::BulkData this->resolve_ownership_of_modified_entities(shared_new); } - bool my_entity_comm_map_insert(stk::mesh::Entity entity, const stk::mesh::EntityCommInfo & val) + std::pair my_entity_comm_map_insert(stk::mesh::Entity entity, const stk::mesh::EntityCommInfo & val) { return BulkData::entity_comm_map_insert(entity, val); } @@ -208,16 +208,6 @@ class BulkDataTester : public stk::mesh::BulkData this->update_sharing_after_change_entity_owner(); } - inline bool my_set_parallel_owner_rank_but_not_comm_lists(stk::mesh::Entity entity, int in_owner_rank) - { - return this->internal_set_parallel_owner_rank_but_not_comm_lists(entity, in_owner_rank); - } - - void my_fix_up_ownership(stk::mesh::Entity entity, int new_owner) - { - this->fix_up_ownership(entity, new_owner); - } - stk::mesh::PairIterEntityComm my_internal_entity_comm_map_shared(const stk::mesh::EntityKey & key) const { return internal_entity_comm_map_shared(key); @@ -225,7 +215,7 @@ class BulkDataTester : public stk::mesh::BulkData int my_internal_entity_comm_map_owner(const stk::mesh::EntityKey & key) const { - return internal_entity_comm_map_owner(key); + return parallel_owner_rank(get_entity(key)); } const stk::mesh::EntityCommListInfoVector & my_internal_comm_list() const @@ -348,6 +338,11 @@ class BulkDataTester : public stk::mesh::BulkData unpackEntityFromOtherProcAndUpdateInfoIfSharedLocally(comm, shared_entity_map); } + void my_internal_change_owner_in_comm_data(stk::mesh::Entity entity, int owner) + { + this->internal_set_owner(entity, owner); + } + void my_internal_change_entity_key(stk::mesh::EntityKey old_key, stk::mesh::EntityKey new_key, stk::mesh::Entity entity) { internal_change_entity_key(old_key, new_key, entity); diff --git a/packages/stk/stk_unit_tests/stk_io/UnitTestMeshData.cpp b/packages/stk/stk_unit_tests/stk_io/UnitTestMeshData.cpp index a00b5d21b12d..e5200540a9b8 100644 --- a/packages/stk/stk_unit_tests/stk_io/UnitTestMeshData.cpp +++ b/packages/stk/stk_unit_tests/stk_io/UnitTestMeshData.cpp @@ -54,6 +54,7 @@ #include "stk_mesh/baseImpl/MeshImplUtils.hpp" #include "stk_mesh/base/FEMHelpers.hpp" #include "stk_mesh/base/Field.hpp" +#include namespace { @@ -343,3 +344,38 @@ TEST( StkMeshIoBroker, large_mesh_test ) } } +class StkIoFixture : public stk::unit_test_util::MeshFixture +{ +protected: + void setup_mesh(const std::string & meshSpec, stk::mesh::BulkData::AutomaticAuraOption auraOption) + { + setup_empty_mesh(auraOption); + +// stk::mesh::Field & field = get_meta().declare_field>(stk::topology::NODE_RANK, "nodal_field"); +// const int initValue = 0; +// stk::mesh::put_field_on_mesh(field, get_meta().universal_part(), &initValue); + + stk::io::fill_mesh(meshSpec, get_bulk()); + } +}; + +TEST_F(StkIoFixture, customCoordinateName) +{ + if (stk::parallel_machine_size(MPI_COMM_WORLD) != 1) return; + + setup_mesh("generated:1x1x2", stk::mesh::BulkData::NO_AUTO_AURA); + const std::string meshName = "meshWithCoordinates.g"; + stk::io::write_mesh(meshName, get_bulk()); + + stk::mesh::MetaData meta(3); + stk::mesh::BulkData bulk(meta, MPI_COMM_WORLD, stk::mesh::BulkData::NO_AUTO_AURA); + meta.set_coordinate_field_name("custom_coordinates"); + + stk::io::fill_mesh(meshName, bulk); + + const stk::mesh::FieldBase * coordField = meta.coordinate_field(); + EXPECT_EQ("custom_coordinates", coordField->name()); + + unlink(meshName.c_str()); +} + diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData.cpp index a18e6697d751..3741ace2b84b 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData.cpp @@ -3154,59 +3154,6 @@ TEST(BulkData, ModificationEnd) } } -TEST(BulkData, set_parallel_owner_rank_but_not_comm_lists) -{ - MPI_Comm communicator = MPI_COMM_WORLD; - int numProcs = stk::parallel_machine_size(communicator); - - if (numProcs != 1){ - return; - } - - const int spatialDim = 3; - stk::mesh::MetaData stkMeshMetaData(spatialDim); - stk::unit_test_util::BulkDataTester mesh(stkMeshMetaData, communicator); - std::string exodusFileName = stk::unit_test_util::get_option("-i", "generated:1x1x1|sideset:xXyYzZ"); - { - stk::io::StkMeshIoBroker exodusFileReader(communicator); - exodusFileReader.set_bulk_data(mesh); - exodusFileReader.add_mesh_database(exodusFileName, stk::io::READ_MESH); - exodusFileReader.create_input_mesh(); - exodusFileReader.populate_bulk_data(); - //int index = exodusFileReader.create_output_mesh("1x1x1.exo", stk::io::WRITE_RESULTS); - //exodusFileReader.write_output_mesh(index); - } - std::vector modified_entities; - mesh.modification_begin(); - mesh.modification_end(); - modified_entities.push_back(mesh.get_entity(stk::topology::NODE_RANK, 1)); - int destProc = 12; - mesh.my_set_parallel_owner_rank_but_not_comm_lists(mesh.get_entity(NODE_RANK, 1), destProc); - - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 1), CEOUtils::STATE_OWNED, destProc)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 1), CEOUtils::STATE_MESH_MODIFIED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 2), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 3), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 4), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 5), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 6), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 7), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(NODE_RANK, 8), CEOUtils::STATE_MESH_UNCHANGED)); - - EXPECT_TRUE(check_state(mesh, EntityKey(ELEM_RANK, 1), CEOUtils::STATE_MESH_MODIFIED)); - - EXPECT_TRUE(check_state(mesh, EntityKey(FACE_RANK, 11), CEOUtils::STATE_MESH_MODIFIED)); - EXPECT_TRUE(check_state(mesh, EntityKey(FACE_RANK, 14), CEOUtils::STATE_MESH_MODIFIED)); - EXPECT_TRUE(check_state(mesh, EntityKey(FACE_RANK, 15), CEOUtils::STATE_MESH_MODIFIED)); - - EXPECT_TRUE(check_state(mesh, EntityKey(FACE_RANK, 12), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(FACE_RANK, 13), CEOUtils::STATE_MESH_UNCHANGED)); - EXPECT_TRUE(check_state(mesh, EntityKey(FACE_RANK, 16), CEOUtils::STATE_MESH_UNCHANGED)); - - mesh.state(mesh.get_entity(NODE_RANK, 1)); -} - - TEST(BulkData, resolve_ownership_of_modified_entities_trivial) { MPI_Comm communicator = MPI_COMM_WORLD; @@ -4359,7 +4306,7 @@ TEST(BulkData, show_how_one_could_add_a_shared_node) { owner = std::min(owner, procs[j]); } - bulk.my_fix_up_ownership(shared_modified[i], owner); + bulk.my_internal_change_owner_in_comm_data(shared_modified[i], owner); } ASSERT_NO_THROW(bulk.modification_end()); diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData_new.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData_new.cpp index e707cd2edcb3..10222ea11aa8 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData_new.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestBulkData_new.cpp @@ -360,7 +360,7 @@ TEST ( UnitTestBulkData_new , verifyParallelAddParts ) i = bulk.my_internal_comm_list().begin(); i != bulk.my_internal_comm_list().end() ; ++i ) { if ( i->key.rank() == 0 ) { - if ( i->owner == fixture.comm_rank() ) { + if ( bulk.parallel_owner_rank(i->entity) == fixture.comm_rank() ) { bulk.change_entity_parts ( i->entity, add_part, ConstPartVector() ); } } diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOCommonUtils.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOCommonUtils.cpp index 25c039441209..e5444f4558f1 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOCommonUtils.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOCommonUtils.cpp @@ -158,9 +158,10 @@ bool check_state(const stk::unit_test_util::BulkDataTester & mesh, const EntityK oss << "check_state(): Must provide one processor with STATE_GHOSTED_FROM_FROM check." << std::endl; break; //need to break otherwise following call can segfault } - bool entityIsInvalid = mesh.get_entity(entityKey) == Entity(); + stk::mesh::Entity thisEntity = mesh.get_entity(entityKey); + bool entityIsInvalid = !mesh.is_valid(thisEntity); bool inGhost = mesh.in_ghost(mesh.aura_ghosting() , entityKey , expectedProcs[0] ); - const int owner_rank_directly_from_comm_map = mesh.my_entity_comm_map().owner_rank(entityKey); + const int owner_rank = mesh.parallel_owner_rank(thisEntity); if ( entityIsInvalid && inGhost ) { @@ -168,7 +169,7 @@ bool check_state(const stk::unit_test_util::BulkDataTester & mesh, const EntityK } else if ( entityIsInvalid && !inGhost ) { - oss << "check_state(): Entity " << entityKey << " was not ghosted from proc " << owner_rank_directly_from_comm_map << "." << std::endl; + oss << "check_state(): Entity " << entityKey << " was not ghosted from proc " << owner_rank << "." << std::endl; break; } if (!mesh.in_receive_ghost( mesh.aura_ghosting() , entityKey )) { @@ -176,9 +177,9 @@ bool check_state(const stk::unit_test_util::BulkDataTester & mesh, const EntityK << " been ghosted from proc " << expectedProcs[0] << "." << std::endl; } else { - const int owner_rank = mesh.my_internal_entity_comm_map_owner(entityKey); - if (owner_rank != expectedProcs[0]) { - oss << "check_state(): Entity " << entityKey << " was ghosted from proc " << owner_rank << std::endl + const int this_owner_rank = mesh.my_internal_entity_comm_map_owner(entityKey); + if (this_owner_rank != expectedProcs[0]) { + oss << "check_state(): Entity " << entityKey << " was ghosted from proc " << this_owner_rank << std::endl << " when it should have been ghosted from proc " << expectedProcs[0] << "." << std::endl; } } @@ -186,10 +187,11 @@ bool check_state(const stk::unit_test_util::BulkDataTester & mesh, const EntityK } case STATE_NOT_GHOSTED_FROM: { - bool entityIsInvalid = mesh.get_entity(entityKey) == Entity(); - const int owner_rank_directly_from_comm_map = mesh.my_entity_comm_map().owner_rank(entityKey); + stk::mesh::Entity thisEntity = mesh.get_entity(entityKey); + bool entityIsInvalid = !mesh.is_valid(thisEntity); + const int owner_rank = mesh.parallel_owner_rank(thisEntity); - if ( entityIsInvalid && owner_rank_directly_from_comm_map == stk::mesh::InvalidProcessRank) + if ( entityIsInvalid && owner_rank == stk::mesh::InvalidProcessRank) { break; } @@ -209,8 +211,8 @@ bool check_state(const stk::unit_test_util::BulkDataTester & mesh, const EntityK oss << "check_state(): Cannot provide processors with STATE_NOT_GHOSTED_FROM_FROM check." << std::endl; } if (mesh.in_receive_ghost( mesh.aura_ghosting() , entityKey )) { - const int owner_rank = mesh.my_internal_entity_comm_map_owner(entityKey); - oss << "check_state(): Entity " << entityKey << " was ghosted from proc " << owner_rank << std::endl + const int this_owner_rank = mesh.my_internal_entity_comm_map_owner(entityKey); + oss << "check_state(): Entity " << entityKey << " was ghosted from proc " << this_owner_rank << std::endl << " when it shouldn't have been ghosted." << std::endl; } break; diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCheckCommList.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCheckCommList.cpp deleted file mode 100644 index 2093ff2ec09d..000000000000 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCheckCommList.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * 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. -// -// * Neither the name of NTESS nor the names of its contributors -// may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "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 THE COPYRIGHT -// OWNER OR 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. -// - -#include // for AssertHelper, EXPECT_EQ, etc -#include -#include // for EntityCommDatabase -#include -#include "stk_mesh/base/Entity.hpp" // for Entity -#include "stk_mesh/base/EntityKey.hpp" // for EntityKey -#include "stk_topology/topology.hpp" -#include "stk_mesh/base/Types.hpp" // for EntityCommInfo -#include - -namespace { - -std::vector all_procs_except_local_proc(int num_procs, int local_proc) -{ - std::vector all_other_procs; - for(int p=0; p sharing_procs = all_procs_except_local_proc(num_procs, local_proc); - stk::mesh::EntityComm entity_comm; - entity_comm.owner_rank = owner; - entity_comm.comm_map.push_back(stk::mesh::EntityCommInfo(0, sharing_procs[0])); - entity_comm.comm_map.push_back(stk::mesh::EntityCommInfo(0, sharing_procs[1])); - stk::mesh::EntityCommListInfo comm_info = {key, entity, nullptr, 0, owner, &entity_comm}; - comm_list.push_back(comm_info); - - EXPECT_TRUE(stk::mesh::impl::is_comm_list_globally_consistent(communicator, comm_list)); - } -} - -TEST(CheckCommList, test_ghosted) -{ - stk::ParallelMachine communicator = MPI_COMM_WORLD; - int num_procs = stk::parallel_machine_size(communicator); - if (num_procs == 3) { - - int local_proc = stk::parallel_machine_rank(communicator); - int owner = 1; - stk::mesh::EntityCommListInfoVector comm_list; - stk::mesh::EntityKey key(stk::topology::NODE_RANK, 99); - stk::mesh::Entity entity;//don't need valid entity for this test - stk::mesh::EntityComm entity_comm; - entity_comm.owner_rank = owner; - if (local_proc == owner) { - entity_comm.comm_map.push_back(stk::mesh::EntityCommInfo(3, 0)); - entity_comm.comm_map.push_back(stk::mesh::EntityCommInfo(3, 2)); - } - else { - entity_comm.comm_map.push_back(stk::mesh::EntityCommInfo(3, owner)); - } - stk::mesh::EntityCommListInfo comm_info = {key, entity, nullptr, 0, owner, &entity_comm}; - comm_list.push_back(comm_info); - - EXPECT_TRUE(stk::mesh::impl::is_comm_list_globally_consistent(communicator, comm_list)); - } -} - -} - diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestEntityCommDatabase.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestEntityCommDatabase.cpp index 6849373d4b8d..976abfad5a45 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestEntityCommDatabase.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestEntityCommDatabase.cpp @@ -48,7 +48,8 @@ TEST(EntityCommDatabase, testCommMapChangeListener) { stk::mesh::EntityCommDatabase comm_map; stk::mesh::EntityCommListInfoVector comm_list; - stk::mesh::CommListUpdater comm_list_updater(comm_list); + std::vector entity_comms(200); + stk::mesh::CommListUpdater comm_list_updater(comm_list, entity_comms); comm_map.setCommMapChangeListener(&comm_list_updater); int owner = 0; @@ -61,7 +62,7 @@ TEST(EntityCommDatabase, testCommMapChangeListener) //CommListUpdater only manages removing entries from comm-list, //so we must add an entry manually to set up the test. stk::mesh::EntityCommListInfo comm_list_info = - {key, stk::mesh::Entity(), nullptr, 0, owner, comm_map.entity_comm(key)}; + {key, stk::mesh::Entity(), nullptr, 0, comm_map.entity_comm(key)}; comm_list.push_back(comm_list_info); EXPECT_EQ(1u, comm_list.size()); diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp index 92f66620e177..5fe32e7f940f 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp @@ -356,3 +356,23 @@ TEST(UnitTestGhosting, WithShared) } } +TEST(UnitTestGhosting, basic1Elem) +{ + if (stk::parallel_machine_size(MPI_COMM_WORLD) != 2) return; + + unsigned spatialDim = 3; + stk::mesh::MetaData meta(spatialDim); + stk::mesh::BulkData bulk(meta, MPI_COMM_WORLD, stk::mesh::BulkData::NO_AUTO_AURA); + const std::string generatedMeshSpecification = "generated:1x1x2"; + stk::io::fill_mesh(generatedMeshSpecification, bulk); + + std::vector send; + if (bulk.parallel_rank() == 0) { + send.emplace_back(bulk.get_entity(stk::topology::ELEM_RANK, 1), 1); + } + bulk.modification_begin(); + stk::mesh::Ghosting& ghosting = bulk.create_ghosting("custom1"); + bulk.change_ghosting(ghosting, send, std::vector()); + bulk.modification_end(); +} + diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestMetaData.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestMetaData.cpp index 6d2ed6b63d77..b72afb3b6677 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestMetaData.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestMetaData.cpp @@ -208,7 +208,7 @@ TEST( UnitTestMetaData, testEntityRepository ) const stk::mesh::EntityCommInfo comm_info( ghost.ordinal() , 0 ); ASSERT_FALSE(bulk.my_entity_comm_map_erase(bulk.entity_key(elem), comm_info)); - ASSERT_TRUE(bulk.my_entity_comm_map_insert(elem, comm_info)); + ASSERT_TRUE(bulk.my_entity_comm_map_insert(elem, comm_info).second); } TEST( UnitTestMetaData, noEntityTypes ) diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestPartitions.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestPartitions.cpp index 66d41f87b543..eb704128b8d3 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestPartitions.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestPartitions.cpp @@ -68,7 +68,6 @@ struct ReversePartition std::reverse(b.m_entities.begin(), b.m_entities.begin()+b.size()); //std::reverse(b.m_relations.begin(), b.m_relations.end()); - std::reverse(b.m_owner_ranks.begin(), b.m_owner_ranks.begin()+b.size()); const unsigned n = b.size(); for ( unsigned i = 0 ; i < n ; ++i) diff --git a/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/BulkDataElementGraphTester.hpp b/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/BulkDataElementGraphTester.hpp index ee92e65a10f9..20fef01b0433 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/BulkDataElementGraphTester.hpp +++ b/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/BulkDataElementGraphTester.hpp @@ -117,12 +117,11 @@ class BulkDataElementGraphTester : public stk::mesh::BulkData stk::mesh::Entity entity = shared_modified[i].m_entity; int sharing_proc = shared_modified[i].m_sharing_proc; entity_comm_map_insert(entity, stk::mesh::EntityCommInfo(stk::mesh::BulkData::SHARED, sharing_proc)); + int old_owner = parallel_owner_rank(entity); int owning_proc = shared_modified[i].m_owner; - const bool am_not_owner = this->internal_set_parallel_owner_rank_but_not_comm_lists(entity, owning_proc); - if (am_not_owner) + if (old_owner != owning_proc) { - stk::mesh::EntityKey key = this->entity_key(entity); - internal_change_owner_in_comm_data(key, owning_proc); + internal_set_owner(entity, owning_proc); this->internal_change_entity_parts(entity, shared_part /*add*/, owned_part /*remove*/, scratch1, scratch2); } else diff --git a/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/UnitTestElementDeath.cpp b/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/UnitTestElementDeath.cpp index d4a1b2373443..b03e71cd9989 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/UnitTestElementDeath.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/face_creation/element_graph/UnitTestElementDeath.cpp @@ -357,7 +357,18 @@ TEST(ElementDeath, keep_faces_after_element_death_without_calling_create_faces) } boundary_mesh_parts.push_back(&active); - +std::ostringstream os; +for(auto elem : deactivated_elems){ +os<<"P"< +void check_field_on_host(const stk::mesh::BulkData & bulk, + unsigned fieldOrdinal, + T expectedFieldValue) +{ + const stk::mesh::MetaData& meta = bulk.mesh_meta_data(); + const stk::mesh::FieldBase* field = meta.get_fields()[fieldOrdinal]; + + const stk::mesh::BucketVector& buckets = bulk.get_buckets(stk::topology::ELEM_RANK, meta.locally_owned_part()); + for(const stk::mesh::Bucket* bptr : buckets) { + for(stk::mesh::Entity elem : *bptr) { + const double* fieldData = static_cast(stk::mesh::field_data(*field, elem)); + EXPECT_EQ(*fieldData, expectedFieldValue); + } + } +} + NGP_TEST_F(NgpHowTo, ReuseNgpField) { int numStates = 1; @@ -975,38 +992,47 @@ NGP_TEST_F(NgpHowTo, ReuseNgpField) setup_mesh("generated:1x1x4", stk::mesh::BulkData::AUTO_AURA); - ngp::Mesh ngpMesh(get_bulk()); - ngp::FieldManager fieldManager(get_bulk()); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, shortStkField.mesh_meta_data_ordinal(), (short)42); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, shortStkField.mesh_meta_data_ordinal(), (short)42); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, ushortStkField.mesh_meta_data_ordinal(), (unsigned short)43); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, ushortStkField.mesh_meta_data_ordinal(), (unsigned short)43); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, intStkField.mesh_meta_data_ordinal(), (int)44); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, intStkField.mesh_meta_data_ordinal(), (int)44); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, uintStkField.mesh_meta_data_ordinal(), (unsigned int)45); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, uintStkField.mesh_meta_data_ordinal(), (unsigned int)45); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, longStkField.mesh_meta_data_ordinal(), (long)46); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, longStkField.mesh_meta_data_ordinal(), (long)46); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongStkField.mesh_meta_data_ordinal(), (unsigned long)47); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongStkField.mesh_meta_data_ordinal(), (unsigned long)47); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, longLongStkField.mesh_meta_data_ordinal(), (long long)48); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, longLongStkField.mesh_meta_data_ordinal(), (long long)48); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongLongStkField.mesh_meta_data_ordinal(), (unsigned long long)49); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongLongStkField.mesh_meta_data_ordinal(), (unsigned long long)49); - - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, floatStkField.mesh_meta_data_ordinal(), (float)3.14); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, floatStkField.mesh_meta_data_ordinal(), (float)3.14); + { + ngp::Mesh ngpMesh(get_bulk()); + ngp::FieldManager fieldManager(get_bulk()); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, shortStkField.mesh_meta_data_ordinal(), (short)42); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, shortStkField.mesh_meta_data_ordinal(), (short)42); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, ushortStkField.mesh_meta_data_ordinal(), (unsigned short)43); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, ushortStkField.mesh_meta_data_ordinal(), (unsigned short)43); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, intStkField.mesh_meta_data_ordinal(), (int)44); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, intStkField.mesh_meta_data_ordinal(), (int)44); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, uintStkField.mesh_meta_data_ordinal(), (unsigned int)45); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, uintStkField.mesh_meta_data_ordinal(), (unsigned int)45); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, longStkField.mesh_meta_data_ordinal(), (long)46); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, longStkField.mesh_meta_data_ordinal(), (long)46); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongStkField.mesh_meta_data_ordinal(), (unsigned long)47); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongStkField.mesh_meta_data_ordinal(), (unsigned long)47); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, longLongStkField.mesh_meta_data_ordinal(), (long long)48); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, longLongStkField.mesh_meta_data_ordinal(), (long long)48); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongLongStkField.mesh_meta_data_ordinal(), (unsigned long long)49); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, ulongLongStkField.mesh_meta_data_ordinal(), (unsigned long long)49); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, floatStkField.mesh_meta_data_ordinal(), (float)3.14); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, floatStkField.mesh_meta_data_ordinal(), (float)3.14); + + fill_field_on_device(get_bulk(), ngpMesh, fieldManager, doubleStkField.mesh_meta_data_ordinal(), (double)3.141); + check_field_on_device(get_bulk(), ngpMesh, fieldManager, doubleStkField.mesh_meta_data_ordinal(), (double)3.141); + } - fill_field_on_device(get_bulk(), ngpMesh, fieldManager, doubleStkField.mesh_meta_data_ordinal(), (double)3.141); - check_field_on_device(get_bulk(), ngpMesh, fieldManager, doubleStkField.mesh_meta_data_ordinal(), (double)3.141); +//now check field on host to see if FieldManager::clear_fields() (called by FieldManager dtor) +//sync'd device fields back to host. +//Only do this check if cuda, because if not cuda then host == device. +#ifdef KOKKOS_ENABLE_CUDA + check_field_on_host(get_bulk(), doubleStkField.mesh_meta_data_ordinal(), (double)3.141); +#endif } NGP_TEST_F(NgpHowTo, ReuseNgpFieldNewFieldManager) diff --git a/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp b/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp index b2b4876a5d15..6a2adf8ae47e 100644 --- a/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp +++ b/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp @@ -318,11 +318,13 @@ TEST_F(CopyingMesh, copyingMeshWithOrphanNodes_same) expect_equal_entity_counts(get_bulk(), newBulk); } +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) TEST(MetaDataSize, sizeChanges_needToUpdateCopyMesh) { stk::mesh::MetaData meta; - EXPECT_EQ(520u, sizeof(meta)) << "Size of MetaData changed. Does mesh copying capability need to be updated?"; + EXPECT_EQ(552u, sizeof(meta)) << "Size of MetaData changed. Does mesh copying capability need to be updated?"; } +#endif TEST(MetaData, cloneDoubleField) { diff --git a/packages/stk/stk_unit_tests/stk_util/schedulerTest.cpp b/packages/stk/stk_unit_tests/stk_util/schedulerTest.cpp index cf77ba4169bb..b2d9bd6b0f68 100644 --- a/packages/stk/stk_unit_tests/stk_util/schedulerTest.cpp +++ b/packages/stk/stk_unit_tests/stk_util/schedulerTest.cpp @@ -37,6 +37,24 @@ namespace { +TEST(SchedulerTest, noBonusTimeWithRestart) +{ + stk::util::Scheduler scheduler; + + const stk::util::Time startTime = 0.0; + const stk::util::Time dt = 0.1; + scheduler.add_interval(startTime, dt); + + const stk::util::Time terminationTime = 10; + scheduler.set_termination_time(terminationTime); + + const stk::util::Step unusedStep = 0; + const stk::util::Time restartTime = 5.0; + scheduler.set_restart_time(restartTime); + EXPECT_TRUE(scheduler.is_it_time(5.0,unusedStep)); + EXPECT_FALSE(scheduler.is_it_time(5.02,unusedStep)); + EXPECT_TRUE(scheduler.is_it_time(5.1,unusedStep)); +} TEST(SchedulerTest, timeInterval) { diff --git a/packages/stk/stk_util/stk_util/environment/Scheduler.cpp b/packages/stk/stk_util/stk_util/environment/Scheduler.cpp index 9931126d38b0..b2169264d376 100644 --- a/packages/stk/stk_util/stk_util/environment/Scheduler.cpp +++ b/packages/stk/stk_util/stk_util/environment/Scheduler.cpp @@ -325,7 +325,7 @@ bool Scheduler::internal_is_it_time(Time time) int intervals = static_cast((delta.max - start) / tdelta); if (lastInterval_ < 0 && lastTime_ > -TIME_MAX) { - lastInterval_ = static_cast((lastTime_ - start) / tdelta); + lastInterval_ = static_cast((delta.min- start) / tdelta); } // If the last output time was in the same interval as the current time, diff --git a/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp b/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp index 21c751d8d314..2d8213012493 100644 --- a/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp +++ b/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp @@ -128,7 +128,7 @@ class CommNeighbors { */ void reset_buffers(); - ~CommNeighbors(); + virtual ~CommNeighbors(); const std::vector& send_procs() const { return m_send_procs; } const std::vector& recv_procs() const { return m_recv_procs; } From 881a0b548265083b52939a048c846adf68c230b9 Mon Sep 17 00:00:00 2001 From: Alan Williams Date: Tue, 15 Oct 2019 14:28:14 -0600 Subject: [PATCH 06/44] Fix gcc 4.8.4 compile error in stk BulkData --- packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp b/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp index 9653a88593d4..4a06de6be549 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp @@ -1050,7 +1050,7 @@ const EntityCommListInfo& find_entity(const BulkData& mesh, void BulkData::entity_comm_list_insert(Entity node) { stk::mesh::EntityKey key = entity_key(node); - EntityCommListInfoVector::const_iterator lb_itr = std::lower_bound(m_entity_comm_list.begin(), m_entity_comm_list.end(), key); + EntityCommListInfoVector::iterator lb_itr = std::lower_bound(m_entity_comm_list.begin(), m_entity_comm_list.end(), key); if(lb_itr == m_entity_comm_list.end() || lb_itr->key != key) { const EntityComm* entity_comm = m_entity_comm_map.entity_comm(key); @@ -4750,14 +4750,6 @@ void BulkData::internal_resolve_parallel_create(const std::vector Date: Tue, 15 Oct 2019 16:16:23 -0600 Subject: [PATCH 07/44] Fix minor testing issues. --- packages/stk/stk_unit_tests/stk_ngp/CMakeLists.txt | 2 +- packages/stk/stk_unit_tests/stk_ngp/howToNgp.cpp | 10 +++------- .../stk_tools/mesh_clone/UnitTestMeshClone.cpp | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/stk/stk_unit_tests/stk_ngp/CMakeLists.txt b/packages/stk/stk_unit_tests/stk_ngp/CMakeLists.txt index 83da27e48d53..717a37f08a1e 100644 --- a/packages/stk/stk_unit_tests/stk_ngp/CMakeLists.txt +++ b/packages/stk/stk_unit_tests/stk_ngp/CMakeLists.txt @@ -45,7 +45,7 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST( SOURCES ${SOURCES} TESTONLYLIBS stk_unit_main DEPLIBS - ARGS "--gtest_filter=-NgpParallelSum.Performance:NgpParallelSum.DeviceMPIVersion" + ARGS "--gtest_filter=-NGP_Kokkos.*:NgpParallelSum.Performance:NgpParallelSum.DeviceMPIVersion" COMM serial mpi NUM_MPI_PROCS 1-4 ) diff --git a/packages/stk/stk_unit_tests/stk_ngp/howToNgp.cpp b/packages/stk/stk_unit_tests/stk_ngp/howToNgp.cpp index 25128ab70de0..3077a9710514 100644 --- a/packages/stk/stk_unit_tests/stk_ngp/howToNgp.cpp +++ b/packages/stk/stk_unit_tests/stk_ngp/howToNgp.cpp @@ -1053,14 +1053,10 @@ NGP_TEST_F(NgpHowTo, ReuseNgpFieldNewFieldManager) // Reassign the FieldManager, which will blow away the internal ngp::Field instances fieldManager = ngp::FieldManager(get_bulk()); -#ifdef KOKKOS_ENABLE_CUDA - // On the GPU, the new ngp::Field instances will get the initial values from the stk Fields - const double expectedValue = initialValue; -#else - // On the CPU, the new ngp::Field instances are just wrappers around stk Fields, so the values - // assigned above will persist. + //When the ngp::Field instances are blown away, their field-data values should first + //be sync'd back to host. Which means that when the other field-manager re-copies the + //field to device, it should still have the same values that were set on device above... const double expectedValue = specialValue; -#endif check_field_on_device(get_bulk(), ngpMesh, fieldManager, stkField.mesh_meta_data_ordinal(), expectedValue); } diff --git a/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp b/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp index 6a2adf8ae47e..1ac36429fc49 100644 --- a/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp +++ b/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp @@ -322,7 +322,7 @@ TEST_F(CopyingMesh, copyingMeshWithOrphanNodes_same) TEST(MetaDataSize, sizeChanges_needToUpdateCopyMesh) { stk::mesh::MetaData meta; - EXPECT_EQ(552u, sizeof(meta)) << "Size of MetaData changed. Does mesh copying capability need to be updated?"; + EXPECT_GE(552u, sizeof(meta)) << "Size of MetaData changed. Does mesh copying capability need to be updated?"; } #endif From 8a79adaa7017de09936d32a418cd86da955731b0 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 15 Oct 2019 16:25:53 -0600 Subject: [PATCH 08/44] Allow enable of Intrepid and therefore Percept in ATDM Trilinos builds (#6017) However, we don't want to be enabling any Intrepid tests since Intrepid is legacy code and we want Percept to change over to use Intrepid2 at some point soon. The usage of Intrepid by Percept will be tested through Panzer and that is all. Therefore, we disable the implicit enable of the Intrepid tests. --- cmake/std/atdm/ATDMDisables.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/std/atdm/ATDMDisables.cmake b/cmake/std/atdm/ATDMDisables.cmake index 7df9689c24ef..eef6f6c3b767 100644 --- a/cmake/std/atdm/ATDMDisables.cmake +++ b/cmake/std/atdm/ATDMDisables.cmake @@ -24,7 +24,6 @@ SET(ATDM_SE_PACKAGE_DISABLES Trios FEI TriKota - Intrepid STKClassic STKSearchUtil STKUnit_tests @@ -77,6 +76,7 @@ SET(ATDM_SE_PACKAGE_TEST_DISABLES Pamgen Ifpack ML + Intrepid ) # From 0e8c093c276332d396c5a46de2c0c62ff2609405 Mon Sep 17 00:00:00 2001 From: "K. Devine" Date: Tue, 15 Oct 2019 17:00:48 -0600 Subject: [PATCH 09/44] stk: changes that check for appropriate global ordinal type during configure rather than waiting to flag problem during compilation. #5541 --- cmake/RepositoryDependenciesSetup.cmake | 75 ++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/cmake/RepositoryDependenciesSetup.cmake b/cmake/RepositoryDependenciesSetup.cmake index defc6fce736a..ff12d9d7e5ef 100644 --- a/cmake/RepositoryDependenciesSetup.cmake +++ b/cmake/RepositoryDependenciesSetup.cmake @@ -10,4 +10,77 @@ if (TPL_ENABLE_CUDA AND NOT Kokkos_ENABLE_Cuda_Relocatable_Device_Code) elseif (${PROJECT_NAME}_ENABLE_ShyLU_NodeTacho) message(FATAL_ERROR "ERROR: ${PROJECT_NAME}_ENABLE_ShyLU_NodeTacho=ON but TPL_ENABLE_CUDA='${TPL_ENABLE_CUDA}' AND Kokkos_ENABLE_Cuda_Relocatable_Device_Code='${Kokkos_ENABLE_Cuda_Relocatable_Device_Code}' which is not allowed!") endif() -endif() \ No newline at end of file +endif() + +######################################################################### +# STKBalance does not work with GO=INT or GO=UNSIGNED +# Warn and disable it if it was set as a dependence of STK +# Error out if it was explicitly requested by user + +IF ("${Tpetra_ENABLE_DEPRECATED_CODE}" STREQUAL "OFF") # Remove this test when + # Tpetra DEPRECATED + # code is removed + SET(KDD_ENABLE_DEPRECATED OFF) # Remove this line when DEPRECATED is removed + SET(KDD_INT_INT OFF) # Current default +ELSE() # Remove this "else" section when Tpetra DEPRECATED code is removed + SET(KDD_ENABLE_DEPRECATED ON) # Remove this line when DEPRECATED is removed + SET(KDD_INT_INT ON) # Deprecated default +ENDIF() + +SET(KDD_INT_UNSIGNED OFF) # Current default +SET(KDD_INT_LONG OFF) # Current default +SET(KDD_INT_LONG_LONG ON) # Current default + +IF (NOT ("${Tpetra_INST_INT_INT}" STREQUAL "")) + SET(KDD_INT_INT ${Tpetra_INST_INT_INT}) + if (${KDD_INT_INT} # Keep this test but + AND (NOT ${KDD_ENABLE_DEPRECATED})) # remove this test when DEPRECATED + # is removed + SET(KDD_INT_LONG_LONG OFF) + ENDIF() +ENDIF() + +IF(NOT ("${Tpetra_INST_INT_UNSIGNED}" STREQUAL "")) + SET(KDD_INT_UNSIGNED ${Tpetra_INST_INT_UNSIGNED}) + if (${KDD_INT_UNSIGNED} # Keep this test but + AND (NOT ${KDD_ENABLE_DEPRECATED})) # remove this test when DEPRECATED + # is removed + SET(KDD_INT_LONG_LONG OFF) + ENDIF() +ENDIF() + +IF(NOT ("${Tpetra_INST_INT_LONG}" STREQUAL "")) + SET(KDD_INT_LONG ${Tpetra_INST_INT_LONG}) + if (${KDD_INT_LONG} # Keep this test but + AND (NOT ${KDD_ENABLE_DEPRECATED})) # remove this test when DEPRECATED + # is removed + SET(KDD_INT_LONG_LONG OFF) + ENDIF() +ENDIF() + +IF(NOT ("${Tpetra_INST_INT_LONG_LONG}" STREQUAL "")) + SET(KDD_INT_LONG_LONG ${Tpetra_INST_INT_LONG_LONG}) +ENDIF() + +IF ((NOT ${KDD_INT_LONG}) AND (NOT ${KDD_INT_LONG_LONG})) + IF ("${${PROJECT_NAME}_ENABLE_STKBalance}" STREQUAL "") + # STKBalance was enabled but only implicitly (as a dependence of STK); + # give a warning but turn off STKBalance support + MESSAGE(WARNING "int global indices are enabled in Trilinos. " + "Because STKBalance requires long or long long " + "global indices, STKBalance will be disabled. " + "To make this warning go away, do not request " + "int global indices in Trilinos (that is, do not " + "set Tpetra_INST_INT_INT=ON or " + "Tpetra_INST_INT_UNSIGNED=ON)." ) + SET(${PROJECT_NAME}_ENABLE_STKBalance OFF) + ELSE() + # STKBalance was explicitly enabled by the user, so error out + MESSAGE(FATAL_ERROR + "STKBalance requires long or long long global indices, " + "but Trilinos is using int indices " + "(likely via Tpetra_INST_INT_INT or Tpetra_INST_INT_UNSIGNED). " + "Disable STKBalance or specify Tpetra_INST_INT_LONG_LONG.") + ENDIF() +ENDIF() + From 088341c48fc62397108a7db5408244643babb65c Mon Sep 17 00:00:00 2001 From: "K. Devine" Date: Tue, 15 Oct 2019 17:21:29 -0600 Subject: [PATCH 10/44] stk: handle case where STKBalance is explicitly set off --- cmake/RepositoryDependenciesSetup.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/RepositoryDependenciesSetup.cmake b/cmake/RepositoryDependenciesSetup.cmake index ff12d9d7e5ef..54e15a5347a2 100644 --- a/cmake/RepositoryDependenciesSetup.cmake +++ b/cmake/RepositoryDependenciesSetup.cmake @@ -64,7 +64,7 @@ ENDIF() IF ((NOT ${KDD_INT_LONG}) AND (NOT ${KDD_INT_LONG_LONG})) IF ("${${PROJECT_NAME}_ENABLE_STKBalance}" STREQUAL "") - # STKBalance was enabled but only implicitly (as a dependence of STK); + # STKBalance may be enabled but only implicitly (as a dependence of STK); # give a warning but turn off STKBalance support MESSAGE(WARNING "int global indices are enabled in Trilinos. " "Because STKBalance requires long or long long " @@ -74,7 +74,7 @@ IF ((NOT ${KDD_INT_LONG}) AND (NOT ${KDD_INT_LONG_LONG})) "set Tpetra_INST_INT_INT=ON or " "Tpetra_INST_INT_UNSIGNED=ON)." ) SET(${PROJECT_NAME}_ENABLE_STKBalance OFF) - ELSE() + ELSEIF (${${PROJECT_NAME}_ENABLE_STKBalance}) # STKBalance was explicitly enabled by the user, so error out MESSAGE(FATAL_ERROR "STKBalance requires long or long long global indices, " From 341d535fa293a69c5d636c087f9984f8c2bf0af1 Mon Sep 17 00:00:00 2001 From: Alan Williams Date: Tue, 15 Oct 2019 19:55:30 -0600 Subject: [PATCH 11/44] Small tweak to mesh-clone unit-test, only test for gcc version > 4 --- .../stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp b/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp index 1ac36429fc49..331b97b8c664 100644 --- a/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp +++ b/packages/stk/stk_unit_tests/stk_tools/mesh_clone/UnitTestMeshClone.cpp @@ -318,7 +318,7 @@ TEST_F(CopyingMesh, copyingMeshWithOrphanNodes_same) expect_equal_entity_counts(get_bulk(), newBulk); } -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#if defined(__GNUC__) && (__GNUC__ > 4) && !defined(__INTEL_COMPILER) TEST(MetaDataSize, sizeChanges_needToUpdateCopyMesh) { stk::mesh::MetaData meta; From ce9eeeb9c909c425ea95b3c9ef7752abccbf1a22 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 16 Oct 2019 08:29:12 -0600 Subject: [PATCH 12/44] ATDM: Set Amesos2_ENABLE_Epetra=OFF unconditionally (ATDV-202) This is set in EMPIRE's native configuration driver and therefore should be set unconditionally. Before, it was only set for the SPARC configuration. --- cmake/std/atdm/ATDMDevEnvSettings.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/std/atdm/ATDMDevEnvSettings.cmake b/cmake/std/atdm/ATDMDevEnvSettings.cmake index 053e8b6df84a..a3bc0f565bcb 100644 --- a/cmake/std/atdm/ATDMDevEnvSettings.cmake +++ b/cmake/std/atdm/ATDMDevEnvSettings.cmake @@ -282,6 +282,7 @@ ATDM_SET_CACHE(Tpetra_INST_CUDA "${ATDM_USE_CUDA}" CACHE BOOL) ATDM_SET_CACHE(Tpetra_INST_SERIAL "${ATDM_INST_SERIAL}" CACHE BOOL) ATDM_SET_CACHE(Tpetra_INST_INT_INT OFF CACHE BOOL) ATDM_SET_CACHE(Xpetra_ENABLE_Epetra OFF CACHE BOOL) +ATDM_SET_CACHE(Amesos2_ENABLE_Epetra OFF CACHE BOOL) ATDM_SET_CACHE(MueLu_ENABLE_Kokkos_Refactor_Use_By_Default ON CACHE BOOL) ATDM_SET_CACHE(MueLu_ENABLE_Epetra OFF CACHE BOOL) ATDM_SET_CACHE(Piro_ENABLE_MueLu OFF CACHE BOOL) @@ -292,7 +293,6 @@ ATDM_SET_CACHE(DART_TESTING_TIMEOUT 600 CACHE STRING) IF (ATDM_ENABLE_SPARC_SETTINGS) ATDM_SET_CACHE(Zoltan_ENABLE_ULLONG_IDS ON CACHE BOOL) ATDM_SET_CACHE(Anasazi_ENABLE_RBGen ON CACHE BOOL) - ATDM_SET_CACHE(Amesos2_ENABLE_Epetra OFF CACHE BOOL) ENDIF() # From a30d1003f0f4b8d9aab6a18a1e98e68c44007bfa Mon Sep 17 00:00:00 2001 From: bcarnes Date: Wed, 2 Oct 2019 11:23:46 -0600 Subject: [PATCH 13/44] Sync Percept from Sierra to Trilinos * remove most boost usage (will build w/out boost) --- packages/percept/cmake/Dependencies.cmake | 1 - .../percept/src/adapt/AdaptedMeshVerifier.cpp | 4 +- packages/percept/src/adapt/Allocate.cpp | 99 ------ packages/percept/src/adapt/Colorer.cpp | 4 - packages/percept/src/adapt/Colorer.hpp | 27 +- packages/percept/src/adapt/DiscretizeHex.hpp | 28 +- packages/percept/src/adapt/DiscretizePyr.hpp | 32 +- .../percept/src/adapt/DiscretizeWedge.hpp | 54 +-- packages/percept/src/adapt/FixSideSets.cpp | 2 +- .../percept/src/adapt/HangingNodeAdapter.hpp | 59 +--- packages/percept/src/adapt/NodeRegistry.cpp | 325 ++++++++---------- packages/percept/src/adapt/NodeRegistry.hpp | 14 +- .../percept/src/adapt/NodeRegistryDef.hpp | 25 +- .../percept/src/adapt/NodeRegistryType.hpp | 45 +-- .../percept/src/adapt/NodeRegistry_KOKKOS.cpp | 119 +++---- .../percept/src/adapt/NodeRegistry_KOKKOS.hpp | 14 +- .../Percept_MOAB_SimplexTemplateRefiner.cpp | 36 +- .../Percept_MOAB_SimplexTemplateRefiner.hpp | 28 +- .../adapt/PredicateBasedElementAdapter.hpp | 6 +- .../src/adapt/PredicateTemplateAdapter.hpp | 6 +- .../src/adapt/RefinementInfoByType.cpp | 2 +- packages/percept/src/adapt/Refiner.cpp | 45 +-- packages/percept/src/adapt/Refiner.hpp | 3 - .../src/adapt/RefinerPattern_Hex8_Het_N.hpp | 10 +- .../adapt/RefinerPattern_Line2_Line2_N.hpp | 6 +- .../src/adapt/RefinerPattern_Quad4_Het_N.hpp | 18 +- .../src/adapt/RefinerPattern_Tet4_Tet4_N.hpp | 67 +--- .../src/adapt/RefinerPattern_Tri3_Tri3_2.hpp | 26 +- .../src/adapt/RefinerPattern_Tri3_Tri3_N.hpp | 12 +- .../percept/src/adapt/RefinerUnrefine.cpp | 21 +- packages/percept/src/adapt/RefinerUtil.cpp | 33 +- .../src/adapt/SerializeNodeRegistry.hpp | 121 +++---- packages/percept/src/adapt/SubDimCell.hpp | 183 +--------- .../percept/src/adapt/SubDimCell_KOKKOS.hpp | 13 +- .../src/adapt/TransitionElementAdapter.hpp | 2 +- .../percept/src/adapt/TriangulateQuad.hpp | 60 ++-- packages/percept/src/adapt/TriangulateTri.hpp | 30 +- .../src/adapt/UniformRefinerPattern.cpp | 238 ++++++++----- .../src/adapt/UniformRefinerPattern.hpp | 12 +- ...ormRefinerPattern_Beam2_Beam3_1_sierra.hpp | 2 +- ...ormRefinerPattern_Hex20_Hex20_8_sierra.hpp | 2 +- ...ormRefinerPattern_Hex27_Hex27_8_sierra.hpp | 2 +- .../UniformRefinerPattern_Hex8_Tet4_24.hpp | 21 +- .../UniformRefinerPattern_Hex8_Tet4_6_12.hpp | 37 +- ...ormRefinerPattern_Line2_Line2_2_sierra.hpp | 17 +- ...ormRefinerPattern_Line2_Line3_1_sierra.hpp | 2 +- .../UniformRefinerPattern_Pyramid5_Tet4_2.hpp | 26 +- .../UniformRefinerPattern_Quad4_Quad4_4.hpp | 18 +- .../UniformRefinerPattern_Quad4_Tri3_2.hpp | 12 +- .../UniformRefinerPattern_Quad4_Tri3_4.hpp | 16 +- .../UniformRefinerPattern_Quad4_Tri3_6.hpp | 30 +- ...Pattern_ShellLine2_ShellLine2_2_sierra.hpp | 23 +- ...ormRefinerPattern_Tet10_Tet10_8_sierra.hpp | 2 +- ...iformRefinerPattern_Tet4_Tet4_8_sierra.hpp | 38 +- .../UniformRefinerPattern_Wedge6_Tet4_3.hpp | 36 +- .../src/adapt/UniformRefinerPattern_def.hpp | 206 ----------- packages/percept/src/adapt/main/MeshAdapt.cpp | 3 +- packages/percept/src/adapt/main/MeshAdapt.hpp | 2 - .../percept/src/adapt/main/RunAdaptRun.hpp | 8 +- packages/percept/src/adapt/markers/Marker.cpp | 2 +- packages/percept/src/adapt/markers/Marker.hpp | 6 +- .../src/adapt/markers/MarkerInterval.cpp | 4 +- .../adapt/markers/MarkerPhysicallyBased.cpp | 16 +- .../markers/MarkerUsingErrIndFraction.cpp | 16 +- .../src/adapt/sierra_element/CellTopology.cpp | 21 +- .../sierra_element/StdMeshObjTopologies.cpp | 3 +- .../percept/src/percept/GeometryVerifier.cpp | 6 +- packages/percept/src/percept/Histograms.hpp | 2 +- .../Intrepid_HGRAD_HEX_C2_Serendipity_FEM.hpp | 19 +- ...trepid_HGRAD_HEX_C2_Serendipity_FEMDef.hpp | 19 +- ...Intrepid_HGRAD_QUAD_C2_Serendipity_FEM.hpp | 19 +- ...repid_HGRAD_QUAD_C2_Serendipity_FEMDef.hpp | 19 +- ...ntrepid_HGRAD_WEDGE_C2_Serendipity_FEM.hpp | 19 +- ...epid_HGRAD_WEDGE_C2_Serendipity_FEMDef.hpp | 19 +- packages/percept/src/percept/MeshType.hpp | 10 - .../percept/src/percept/NoMallocArray.hpp | 5 +- packages/percept/src/percept/Percept.hpp | 23 -- .../percept/src/percept/PerceptBoostArray.hpp | 9 +- packages/percept/src/percept/PerceptMesh.cpp | 193 ++--------- packages/percept/src/percept/PerceptMesh.hpp | 26 +- .../percept/src/percept/SameRankRelation.hpp | 46 --- .../percept/src/percept/SetOfEntities.hpp | 56 +-- .../src/percept/ShardsInterfaceTable.cpp | 12 +- .../src/percept/ShardsInterfaceTable.hpp | 4 +- .../src/percept/SmoothingHelperFunctions.cpp | 4 +- packages/percept/src/percept/Stacktrace.hpp | 5 +- packages/percept/src/percept/Util.hpp | 5 +- .../src/percept/eigen_verify/EigenVerify.cpp | 2 +- .../src/percept/fixtures/BeamFixture.cpp | 3 +- .../src/percept/fixtures/PyramidFixture.cpp | 1 - .../src/percept/fixtures/QuadFixture.hpp | 25 +- .../percept/fixtures/TriQuadSurfaceMesh3D.hpp | 2 +- .../src/percept/fixtures/WedgeFixture.hpp | 12 +- .../src/percept/function/StringFunction.cpp | 11 +- packages/percept/src/percept/math/Math.hpp | 96 ------ .../src/percept/mesh/gen/SweepMesher.cpp | 4 +- .../src/percept/mesh/gen/SweepMesher.hpp | 8 +- .../src/percept/mesh/gen/TransformPath.hpp | 2 +- .../mesh/geometry/kernel/GeometryFactory.cpp | 8 +- .../kernel/GeometryKernelGregoryPatch.cpp | 2 +- .../kernel/GeometryKernelGregoryPatch.hpp | 2 +- .../mesh/geometry/kernel/MeshGeometry.cpp | 5 - .../mesh/geometry/kernel/MeshGeometry.hpp | 7 +- .../kernel/xfer/GPSTKMeshTransferSetup.hpp | 10 +- .../stk_geom/3D/FitGregoryPatches.cpp | 10 +- .../stk_geom/3D/FitGregoryPatches.hpp | 2 +- .../stk_geom/3D/GregoryPatch_FitUtil.mcpp | 13 +- .../stk_geom/3D/GregoryPatch_Quad.mcpp | 13 +- .../stk_geom/3D/GregoryPatch_Tri.mcpp | 13 +- .../volume/sierra_only/FiniteVolumeMesh.cpp | 1 - .../ReferenceMeshSmootherAlgebraic.cpp | 1 - .../smoother/ReferenceMeshSmootherBase.hpp | 5 +- ...ReferenceMeshSmootherConjugateGradient.cpp | 1 - .../mesh/mod/smoother/ScalingMatricesGen.mhpp | 13 +- .../mesh/mod/smoother/SmootherMetric.hpp | 1 - .../mesh/mod/smoother/SmootherMetricGen.mhpp | 13 +- .../future-dev/ReferenceMeshSmoother2.cpp | 1 - .../future-dev/ReferenceMeshSmoother3.cpp | 1 - .../percept/mesh_transfer/MeshTransfer.cpp | 2 +- packages/percept/src/percept/pool.cpp | 6 +- packages/percept/src/percept/pool.h | 12 +- .../percept/stk_rebalance/ZoltanPartition.hpp | 26 +- .../structured/StructuredCellIndex.hpp | 14 + .../structured/StructuredGridRefiner.cpp | 36 +- .../percept/src/percept/xfer/LinInterp.hpp | 7 + .../src/percept/xfer/STKMeshTransferSetup.hpp | 16 +- packages/percept/src/percept/xfer/ToMesh.hpp | 1 - 127 files changed, 1109 insertions(+), 2220 deletions(-) delete mode 100644 packages/percept/src/adapt/Allocate.cpp delete mode 100644 packages/percept/src/percept/SameRankRelation.hpp diff --git a/packages/percept/cmake/Dependencies.cmake b/packages/percept/cmake/Dependencies.cmake index 3f62f47c913c..298764cda6bb 100644 --- a/packages/percept/cmake/Dependencies.cmake +++ b/packages/percept/cmake/Dependencies.cmake @@ -1,6 +1,5 @@ TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( LIB_REQUIRED_PACKAGES SEACASIoss STKUtil STKIO STKMesh STKExprEval STKSearch STKTransfer Intrepid TEST_OPTIONAL_PACKAGES Gtest - LIB_REQUIRED_TPLS BoostLib LIB_OPTIONAL_TPLS OpenNURBS ) diff --git a/packages/percept/src/adapt/AdaptedMeshVerifier.cpp b/packages/percept/src/adapt/AdaptedMeshVerifier.cpp index 09d4ec1e53e4..07005bf8752e 100644 --- a/packages/percept/src/adapt/AdaptedMeshVerifier.cpp +++ b/packages/percept/src/adapt/AdaptedMeshVerifier.cpp @@ -315,12 +315,12 @@ namespace percept std::string stol = eMesh.getProperty("AdaptedMeshVerifier::checkParentChildVol::edgeTol"); if (stol.length()) { - edgeTol = boost::lexical_cast(stol); + edgeTol = std::stod(stol); } stol = eMesh.getProperty("AdaptedMeshVerifier::checkParentChildVol::volumeTol"); if (stol.length()) { - volumeTol = boost::lexical_cast(stol); + volumeTol = std::stod(stol); } bool badVol = false; bool badNode = false; diff --git a/packages/percept/src/adapt/Allocate.cpp b/packages/percept/src/adapt/Allocate.cpp deleted file mode 100644 index 8338444ca2a6..000000000000 --- a/packages/percept/src/adapt/Allocate.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -/* - * Allocate.cpp - * - * Created on: Jan 22, 2011 - * Author: kdcopps - */ - -// this is here only to avoid a warning on Mac builds - it was complaining about no symbols existing in this file - - namespace percept { - void dummyAllocateMethodForMacBuildWarning() - { - } - } - -#ifdef STK_ADAPT_REPLACE_NEW_DELETE - -#ifdef STK_HAVE_TBB -#include - -#pragma GCC visibility push(hidden) - -extern "C++" -{ - void* operator new(std::size_t) throw (std::bad_alloc); - void* operator new[](std::size_t) throw (std::bad_alloc); - void* operator new(std::size_t, const std::nothrow_t&) throw(); - void* operator new[](std::size_t, const std::nothrow_t&) throw(); - void operator delete(void*) throw(); - void operator delete[](void*) throw(); - void operator delete(void*, const std::nothrow_t&) throw(); - void operator delete[](void*, const std::nothrow_t&) throw(); -} // extern "C++" - -#pragma GCC visibility pop - - -// See Intel Threading Building Blocks, James Reinders (2007). -// chapter 11.11.1. Replacing new and delete -// -// No retry loop because we assume that scalable_malloc does -// all it takes to allocate the memory, so calling it repeatedly -// will not improve the situation at all -// -// No use of std::new_handler because it cannot be done in portable -// and thread-safe way (see sidebar) -// -// We throw std::bad_alloc() when scalable_malloc returns NULL -//(we return NULL if it is a no-throw implementation) - - -void* operator new (size_t size) throw (std::bad_alloc) { - if (size == 0) size = 1; - if (void* ptr = scalable_malloc (size)) - return ptr; - throw std::bad_alloc (); -} - -void* operator new[] (size_t size) throw (std::bad_alloc) { - return operator new (size); -} - -void* operator new (size_t size, const std::nothrow_t&) throw () { - if (size == 0) size = 1; - if (void* ptr = scalable_malloc (size)) - return ptr; - return NULL; -} - -void* operator new[] (size_t size, const std::nothrow_t&) throw () { - return operator new (size, std::nothrow); -} - -void operator delete (void* ptr) throw () { - if (ptr != 0) scalable_free (ptr); -} - -void operator delete[] (void* ptr) throw () { - operator delete (ptr); -} - -void operator delete (void* ptr, const std::nothrow_t&) throw () { - if (ptr != 0) scalable_free (ptr); -} - -void operator delete[] (void* ptr, const std::nothrow_t&) throw () { - operator delete (ptr, std::nothrow); -} - -#endif // STK_HAVE_TBB - -#endif // STK_ADAPT_REPLACE_NEW_DELETE diff --git a/packages/percept/src/adapt/Colorer.cpp b/packages/percept/src/adapt/Colorer.cpp index 4c7a70092478..28dd81c013ad 100644 --- a/packages/percept/src/adapt/Colorer.cpp +++ b/packages/percept/src/adapt/Colorer.cpp @@ -154,11 +154,7 @@ double *fdata = stk::mesh::field_data( *static_cast(element_color_field) , element ); fdata[0] = double(icolor); } -#if STK_ADAPT_COLORER_SET_TYPE_USE_VECTOR m_element_colors[icolor].push_back(element); -#else - m_element_colors[icolor].insert(element); -#endif if (!m_noColoring) { all_elements.insert(elem_id); diff --git a/packages/percept/src/adapt/Colorer.hpp b/packages/percept/src/adapt/Colorer.hpp index 575494798dea..9d7208a65d5e 100644 --- a/packages/percept/src/adapt/Colorer.hpp +++ b/packages/percept/src/adapt/Colorer.hpp @@ -26,37 +26,16 @@ #include -#define STK_ADAPT_COLORER_STORED_ENTITYID 0 - -#define STK_ADAPT_COLORER_SET_TYPE_USE_VECTOR 1 - -/// define only one of these to be 1 -#define STK_ADAPT_COLORER_SET_TYPE_BOOST 1 - -#if STK_ADAPT_COLORER_SET_TYPE_BOOST -#include -#endif - +#include namespace percept { -#if STK_ADAPT_COLORER_STORED_ENTITYID - typedef stk::mesh::EntityId ColorerStoredEntity; -#else typedef stk::mesh::Entity ColorerStoredEntity; -#endif -#if STK_ADAPT_COLORER_SET_TYPE_USE_VECTOR typedef std::vector ColorerSetType; -#endif -#if STK_ADAPT_COLORER_SET_TYPE_BOOST -# if !STK_ADAPT_COLORER_SET_TYPE_USE_VECTOR - typedef boost::unordered_set ColorerSetType; -# endif - typedef boost::unordered_set ColorerNodeSetType; - typedef boost::unordered_set ColorerElementSetType; -#endif + typedef std::unordered_set ColorerNodeSetType; + typedef std::unordered_set ColorerElementSetType; class Colorer { diff --git a/packages/percept/src/adapt/DiscretizeHex.hpp b/packages/percept/src/adapt/DiscretizeHex.hpp index 5324dc1b94d3..07ec9a9e1647 100644 --- a/packages/percept/src/adapt/DiscretizeHex.hpp +++ b/packages/percept/src/adapt/DiscretizeHex.hpp @@ -15,13 +15,13 @@ namespace percept { - typedef boost::array hex_to_tet_tuple_type_local; - typedef boost::array hex_to_pyr_tuple_type_local; - typedef boost::array hex_to_tet_tuple_type; - typedef boost::array hex_to_pyr_tuple_type; + typedef std::array hex_to_tet_tuple_type_local; + typedef std::array hex_to_pyr_tuple_type_local; + typedef std::array hex_to_tet_tuple_type; + typedef std::array hex_to_pyr_tuple_type; - typedef boost::array hex_to_hex_tuple_type_local; - typedef boost::array hex_to_hex_tuple_type; + typedef std::array hex_to_hex_tuple_type_local; + typedef std::array hex_to_hex_tuple_type; /** * @@ -252,7 +252,7 @@ namespace percept { if (elems_tri.size() == 0 && elems_quad.size() == 0) { VERIFY_OP_ON(num_quad_edge_marks, ==, 0, "hmm"); - elems_quad.push_back(quad_to_quad_tuple_type_local(0,1,2,3)); + elems_quad.push_back({0,1,2,3}); } if (m_debug) { @@ -274,10 +274,10 @@ namespace percept { hex_to_pyr_tuple_type_local hp; // reverse order to get proper volume - hp[3] = elems_quad[iquad].get<0>(); - hp[2] = elems_quad[iquad].get<1>(); - hp[1] = elems_quad[iquad].get<2>(); - hp[0] = elems_quad[iquad].get<3>(); + hp[3] = elems_quad[iquad][0]; + hp[2] = elems_quad[iquad][1]; + hp[1] = elems_quad[iquad][2]; + hp[0] = elems_quad[iquad][3]; for (unsigned ii=0; ii < 4; ++ii) { int hpii = quad_local_nodes[hp[ii]]; @@ -296,9 +296,9 @@ namespace percept { } hex_to_tet_tuple_type_local ht; // reverse order to get proper volume - ht[2] = elems_tri[itri].get<0>(); - ht[1] = elems_tri[itri].get<1>(); - ht[0] = elems_tri[itri].get<2>(); + ht[2] = elems_tri[itri][0]; + ht[1] = elems_tri[itri][1]; + ht[0] = elems_tri[itri][2]; for (unsigned ii=0; ii < 3; ++ii) { int htii = quad_local_nodes[ht[ii]]; diff --git a/packages/percept/src/adapt/DiscretizePyr.hpp b/packages/percept/src/adapt/DiscretizePyr.hpp index 58ab739c05de..a342811245c8 100644 --- a/packages/percept/src/adapt/DiscretizePyr.hpp +++ b/packages/percept/src/adapt/DiscretizePyr.hpp @@ -16,10 +16,10 @@ namespace percept { - typedef boost::array pyr_to_tet_tuple_type_local; - typedef boost::array pyr_to_pyr_tuple_type_local; - typedef boost::array pyr_to_tet_tuple_type; - typedef boost::array pyr_to_pyr_tuple_type; + typedef std::array pyr_to_tet_tuple_type_local; + typedef std::array pyr_to_pyr_tuple_type_local; + typedef std::array pyr_to_tet_tuple_type; + typedef std::array pyr_to_pyr_tuple_type; /** @@ -226,7 +226,7 @@ namespace percept { if (elems_tri.size() == 0 && elems_quad.size() == 0) { VERIFY_OP_ON(num_quad_edge_marks, ==, 0, "hmm"); - elems_quad.push_back(quad_to_quad_tuple_type_local(0,1,2,3)); + elems_quad.push_back({0,1,2,3}); } if (m_debug) { @@ -249,10 +249,10 @@ namespace percept { pyr_to_pyr_tuple_type_local hp; // reverse order to get proper volume - hp[3] = elems_quad[iquad].get<0>(); - hp[2] = elems_quad[iquad].get<1>(); - hp[1] = elems_quad[iquad].get<2>(); - hp[0] = elems_quad[iquad].get<3>(); + hp[3] = elems_quad[iquad][0]; + hp[2] = elems_quad[iquad][1]; + hp[1] = elems_quad[iquad][2]; + hp[0] = elems_quad[iquad][3]; for (unsigned ii=0; ii < 4; ++ii) { int hpii = quad_local_nodes[hp[ii]]; @@ -271,9 +271,9 @@ namespace percept { } pyr_to_tet_tuple_type_local ht; // reverse order to get proper volume - ht[2] = elems_tri[itri].get<0>(); - ht[1] = elems_tri[itri].get<1>(); - ht[0] = elems_tri[itri].get<2>(); + ht[2] = elems_tri[itri][0]; + ht[1] = elems_tri[itri][1]; + ht[0] = elems_tri[itri][2]; for (unsigned ii=0; ii < 3; ++ii) { int htii = quad_local_nodes[ht[ii]]; @@ -319,7 +319,7 @@ namespace percept { if (elems_tri.size() == 0) { VERIFY_OP_ON(num_tri_edge_marks, ==, 0, "hmm"); - elems_tri.push_back(tri_tuple_type_local(0,1,2)); + elems_tri.push_back({0,1,2}); } if (m_debug) @@ -339,9 +339,9 @@ namespace percept { } pyr_to_tet_tuple_type_local ht; // reverse order to get proper volume - ht[2] = elems_tri[itri].get<0>(); - ht[1] = elems_tri[itri].get<1>(); - ht[0] = elems_tri[itri].get<2>(); + ht[2] = elems_tri[itri][0]; + ht[1] = elems_tri[itri][1]; + ht[0] = elems_tri[itri][2]; for (unsigned ii=0; ii < 3; ++ii) { int htii = tri_local_nodes[ht[ii]]; diff --git a/packages/percept/src/adapt/DiscretizeWedge.hpp b/packages/percept/src/adapt/DiscretizeWedge.hpp index 55b963560b16..644564fb46aa 100644 --- a/packages/percept/src/adapt/DiscretizeWedge.hpp +++ b/packages/percept/src/adapt/DiscretizeWedge.hpp @@ -16,12 +16,12 @@ namespace percept { - typedef boost::array wedge_to_tet_tuple_type_local; - typedef boost::array wedge_to_pyr_tuple_type_local; - typedef boost::array wedge_to_wedge_tuple_type_local; - typedef boost::array wedge_to_tet_tuple_type; - typedef boost::array wedge_to_pyr_tuple_type; - typedef boost::array wedge_to_wedge_tuple_type; + typedef std::array wedge_to_tet_tuple_type_local; + typedef std::array wedge_to_pyr_tuple_type_local; + typedef std::array wedge_to_wedge_tuple_type_local; + typedef std::array wedge_to_tet_tuple_type; + typedef std::array wedge_to_pyr_tuple_type; + typedef std::array wedge_to_wedge_tuple_type; /** @@ -490,9 +490,9 @@ namespace percept { for (unsigned ii=0; ii < elems_tri[0].size(); ++ii) { tri_tuple_type_local tl; - tl.get<0>() = elems_tri[0][ii].get<0>(); - tl.get<1>() = elems_tri[0][ii].get<2>(); - tl.get<2>() = elems_tri[0][ii].get<1>(); + tl[0] = elems_tri[0][ii][0]; + tl[1] = elems_tri[0][ii][2]; + tl[2] = elems_tri[0][ii][1]; elems_tri[0][ii] = tl; } } @@ -533,13 +533,13 @@ namespace percept { wedge_to_wedge_tuple_type_local hw; for (unsigned ii=0; ii < elems_tri[0].size(); ++ii) { - hw[0] = map_to_wedge(tri_local_nodes[0][elems_tri[0][ii].get<0>()], edge_map_rev, face_map_rev); - hw[1] = map_to_wedge(tri_local_nodes[0][elems_tri[0][ii].get<1>()], edge_map_rev, face_map_rev); - hw[2] = map_to_wedge(tri_local_nodes[0][elems_tri[0][ii].get<2>()], edge_map_rev, face_map_rev); + hw[0] = map_to_wedge(tri_local_nodes[0][elems_tri[0][ii][0]], edge_map_rev, face_map_rev); + hw[1] = map_to_wedge(tri_local_nodes[0][elems_tri[0][ii][1]], edge_map_rev, face_map_rev); + hw[2] = map_to_wedge(tri_local_nodes[0][elems_tri[0][ii][2]], edge_map_rev, face_map_rev); - hw[3] = map_to_wedge(tri_local_nodes[1][elems_tri[1][ii].get<0>()], edge_map_rev, face_map_rev); - hw[4] = map_to_wedge(tri_local_nodes[1][elems_tri[1][ii].get<1>()], edge_map_rev, face_map_rev); - hw[5] = map_to_wedge(tri_local_nodes[1][elems_tri[1][ii].get<2>()], edge_map_rev, face_map_rev); + hw[3] = map_to_wedge(tri_local_nodes[1][elems_tri[1][ii][0]], edge_map_rev, face_map_rev); + hw[4] = map_to_wedge(tri_local_nodes[1][elems_tri[1][ii][1]], edge_map_rev, face_map_rev); + hw[5] = map_to_wedge(tri_local_nodes[1][elems_tri[1][ii][2]], edge_map_rev, face_map_rev); elems_wedge.push_back(hw); } @@ -627,7 +627,7 @@ namespace percept { if (elems_tri.size() == 0 && elems_quad.size() == 0) { VERIFY_OP_ON(num_quad_edge_marks, ==, 0, "hmm"); - elems_quad.push_back(quad_to_quad_tuple_type_local(0,1,2,3)); + elems_quad.push_back({0,1,2,3}); } if (m_debug) { @@ -649,10 +649,10 @@ namespace percept { wedge_to_pyr_tuple_type_local hp; // reverse order to get proper volume - not here since faces have proper outward-pointing normals - hp[3] = elems_quad[iquad].get<0>(); - hp[2] = elems_quad[iquad].get<1>(); - hp[1] = elems_quad[iquad].get<2>(); - hp[0] = elems_quad[iquad].get<3>(); + hp[3] = elems_quad[iquad][0]; + hp[2] = elems_quad[iquad][1]; + hp[1] = elems_quad[iquad][2]; + hp[0] = elems_quad[iquad][3]; for (unsigned ii=0; ii < 4; ++ii) { int hpii = quad_local_nodes[hp[ii]]; @@ -671,9 +671,9 @@ namespace percept { } wedge_to_tet_tuple_type_local ht; // reverse order to get proper volume - ht[2] = elems_tri[itri].get<0>(); - ht[1] = elems_tri[itri].get<1>(); - ht[0] = elems_tri[itri].get<2>(); + ht[2] = elems_tri[itri][0]; + ht[1] = elems_tri[itri][1]; + ht[0] = elems_tri[itri][2]; for (unsigned ii=0; ii < 3; ++ii) { int htii = quad_local_nodes[ht[ii]]; @@ -719,7 +719,7 @@ namespace percept { if (elems_tri.size() == 0) { VERIFY_OP_ON(num_tri_edge_marks, ==, 0, "hmm"); - elems_tri.push_back(tri_tuple_type_local(0,1,2)); + elems_tri.push_back({0,1,2}); } if (m_debug) @@ -739,9 +739,9 @@ namespace percept { } wedge_to_tet_tuple_type_local ht; // reverse order to get proper volume - ht[2] = elems_tri[itri].get<0>(); - ht[1] = elems_tri[itri].get<1>(); - ht[0] = elems_tri[itri].get<2>(); + ht[2] = elems_tri[itri][0]; + ht[1] = elems_tri[itri][1]; + ht[0] = elems_tri[itri][2]; for (unsigned ii=0; ii < 3; ++ii) { int htii = tri_local_nodes[ht[ii]]; diff --git a/packages/percept/src/adapt/FixSideSets.cpp b/packages/percept/src/adapt/FixSideSets.cpp index cbea8e707cb4..1c51e67ddf86 100644 --- a/packages/percept/src/adapt/FixSideSets.cpp +++ b/packages/percept/src/adapt/FixSideSets.cpp @@ -761,7 +761,7 @@ namespace percept { stk::mesh::EntityVector sides; stk::mesh::Selector sel = stk::mesh::Selector(*partp) & m_eMesh.get_fem_meta_data()->locally_owned_part(); - stk::mesh::get_selected_entities(sel , m_eMesh.get_bulk_data()->buckets(m_eMesh.side_rank()), sides); + stk::mesh::get_selected_entities(sel , m_eMesh.get_bulk_data()->buckets(m_eMesh.side_rank()), sides, false/*don't sort*/); for (auto side : sides) { diff --git a/packages/percept/src/adapt/HangingNodeAdapter.hpp b/packages/percept/src/adapt/HangingNodeAdapter.hpp index 40750eb909bd..6ebcbd11b606 100644 --- a/packages/percept/src/adapt/HangingNodeAdapter.hpp +++ b/packages/percept/src/adapt/HangingNodeAdapter.hpp @@ -11,13 +11,13 @@ #include #include +#include #include #include +#include #include -#include -#include #include @@ -28,42 +28,14 @@ namespace percept { - // this is the expected number of elements that are node neighbors of any element - enum { HNA_POOL_SIZE = 100 }; - -#define USE_HNA_USET 1 -#define USE_BOOST_POOL_ALLOC 1 - - template > + template, typename Allocator = std::allocator > struct PooledStdSet { -#if USE_BOOST_POOL_ALLOC - typedef std::set - > Type; -#else - typedef std::set > Type; -#endif + typedef std::set Type; typedef Less less; - }; - //typedef boost::unordered_set LocalSetType; - //typedef std::set , percept::pool_allocator > LocalSetType; - -#if USE_HNA_USET typedef SetOfEntities LocalSetType; -#else - typedef PooledStdSet::Type LocalSetType; - typedef PooledStdSet LocalSet; -#endif - - //typedef PooledUSet::Type LocalSetType; - //typedef PooledUSet LocalSet; - //typedef boost::unordered_set LocalSetType; class HangingNodeAdapterBase { @@ -267,10 +239,6 @@ SelectIfRefined sir(*this); HNRefinerSelector ters(*this, sir); -#if !USE_BOOST_POOL_ALLOC - Pool pool( sizeof(stk::mesh::Entity), HNA_POOL_SIZE ); -#endif - stk::mesh::Selector on_locally_owned_part = ( m_pMesh.get_fem_meta_data()->locally_owned_part() ); const stk::mesh::BucketVector & buckets = m_pMesh.get_bulk_data()->buckets( m_pMesh.element_rank() ); @@ -330,12 +298,8 @@ int *refine_field_elem = stk::mesh::field_data( *refine_field , element ); if (refine_field_elem[0] <= 0) { -#if USE_BOOST_POOL_ALLOC LocalSetType selected_neighbors; -#else - pool.Reset(); - LocalSetType selected_neighbors(LocalSet::less(), &pool); -#endif + get_node_neighbors(element, selected_neighbors); for (LocalSetType::iterator neighbor = selected_neighbors.begin(); @@ -482,9 +446,6 @@ SelectIfUnrefined sir; HNRefinerSelector ters(*this, sir); -#if !USE_BOOST_POOL_ALLOC - Pool pool( sizeof(stk::mesh::Entity), HNA_POOL_SIZE ); -#endif stk::mesh::Selector on_locally_owned_part = ( m_pMesh.get_fem_meta_data()->locally_owned_part() ); const stk::mesh::BucketVector & buckets = m_pMesh.get_bulk_data()->buckets( m_pMesh.element_rank() ); for ( stk::mesh::BucketVector::const_iterator k = buckets.begin() ; k != buckets.end() ; ++k ) @@ -508,12 +469,8 @@ int *refine_field_elem = stk::mesh::field_data( *refine_field , element ); if (refine_field_elem[0] < 0) { -#if USE_BOOST_POOL_ALLOC LocalSetType selected_neighbors; -#else - pool.Reset(); - LocalSetType selected_neighbors(LocalSet::less(), &pool); -#endif + get_node_neighbors(element, selected_neighbors); for (LocalSetType::iterator neighbor = selected_neighbors.begin(); @@ -639,8 +596,8 @@ class HNRefinerSelector : public RefinerSelector { HangingNodeAdapter& m_hna; LocalSelector& m_localSelector; - boost::unordered_set m_elements; - boost::unordered_set m_nodes; + std::unordered_set> m_elements; + std::unordered_set> m_nodes; typedef HangingNodeAdapter Base; public: diff --git a/packages/percept/src/adapt/NodeRegistry.cpp b/packages/percept/src/adapt/NodeRegistry.cpp index 726eec5c7de6..d4fd35cf9312 100644 --- a/packages/percept/src/adapt/NodeRegistry.cpp +++ b/packages/percept/src/adapt/NodeRegistry.cpp @@ -48,10 +48,9 @@ static SubDimCellData new_SubDimCellData; static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; - //bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; if (is_empty) { return 0.5; } @@ -64,7 +63,7 @@ double alpsum=0.0; for (unsigned ipts=0; ipts < nsz; ipts++) { - alp[ipts] = nodeId_elementOwnderId.get()[ipts]; + alp[ipts] = std::get(nodeId_elementOwnerId)[ipts]; alps[ipts] = alp[ipts]; VERIFY_OP_ON(alp[ipts], >=, 0.0, "hmmm33"); alpsum += alp[ipts]; @@ -362,22 +361,22 @@ for (iter = iter_begin; iter != iter_end; ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; if (do_respect_spacing && *subDimSize_in == 2 && subDimEntity.size() != 2) continue; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.size() == 0) continue; - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank owning_elementRank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank owning_elementRank = std::get(nodeId_elementOwnerId).rank(); - unsigned char owning_elementSubDimOrd = nodeId_elementOwnderId.get(); + unsigned char owning_elementSubDimOrd = std::get(nodeId_elementOwnerId); VERIFY_OP_ON(owning_elementSubDimOrd, >, 0, "hmm 2"); --owning_elementSubDimOrd ; #if !defined(NO_GEOM_SUPPORT) - Double2& nodeId_spacing = nodeId_elementOwnderId.get(); + Double2& nodeId_spacing = std::get(nodeId_elementOwnerId); #endif if (nodeIds_onSE.size() != 1) continue; @@ -801,9 +800,9 @@ for (iter = m_cell_2_data_map.begin(); iter != m_cell_2_data_map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); bool found = false; @@ -942,11 +941,6 @@ m_comm_all = new stk::CommSparse(m_eMesh.parallel()); } - void NodeRegistry::init_entity_repo() - { - for (unsigned i = 0; i < percept::EntityRankEnd; i++) m_entity_repo[i].clear(); - } - void NodeRegistry::clear_dangling_nodes(SetOfEntities* nodes_to_be_deleted) { bool debug = false; @@ -967,10 +961,10 @@ for (iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank owning_element_rank = nodeId_elementOwnderId.get().rank(); - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank owning_element_rank = std::get(nodeId_elementOwnerId).rank(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); VERIFY_OP_ON(nodeIds_onSE.size(), ==, nodeIds_onSE.m_entity_id_vector.size(), "NodeRegistry::clear_dangling_nodes id vector/size mismatch"); unsigned nnodes = nodeIds_onSE.size(); @@ -1057,8 +1051,8 @@ { for (iter = map.begin(); iter != map.end(); ++iter) { - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); VERIFY_OP_ON(nodeIds_onSE.size(), ==, nodeIds_onSE.m_entity_id_vector.size(), "NodeRegistry::clear_dangling_nodes id vector/size mismatch after erase"); } } @@ -1069,7 +1063,6 @@ void NodeRegistry::initialize() { m_cell_2_data_map.clear(); - init_entity_repo(); } void NodeRegistry:: @@ -1225,9 +1218,9 @@ for (iter = m_cell_2_data_map.begin(); iter != m_cell_2_data_map.end(); ++iter) { - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.m_entity_id_vector.size() != nodeIds_onSE.size()) { @@ -1248,8 +1241,8 @@ stk::mesh::Entity node = get_entity(*m_eMesh.get_bulk_data(), stk::topology::NODE_RANK, nodeIds_onSE.m_entity_id_vector[ii]); if (!m_eMesh.is_valid(node)) { - stk::mesh::EntityId db_id = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank db_rank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId db_id = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank db_rank = std::get(nodeId_elementOwnerId).rank(); std::cout << "tmp P[" << m_eMesh.get_rank() << "] NodeRegistry::setAllReceivedNodeData id= " << nodeIds_onSE.m_entity_id_vector[ii] << " owning_elementId= " << db_id << " owning_element_rank= " << db_rank << std::endl; @@ -1411,8 +1404,8 @@ for (iter = m_cell_2_data_map.begin(); iter != m_cell_2_data_map.end(); ++iter) { - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (debug) std::cout << "tmp SRK nodeIds_onSE.size= " << nodeIds_onSE.size() << std::endl; if (nodeIds_onSE.size()) { @@ -1465,8 +1458,7 @@ nodeIds_onSE[ii] = vecNodes[ii]; nodeIds_onSE.m_entity_id_vector[ii] = m_eMesh.identifier(vecNodes[ii]); } - SubDimCellData data( nodeIds_onSE, - stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_rank, iSubDimOrd+1 ); + SubDimCellData data {nodeIds_onSE, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), (unsigned char)needed_rank, (unsigned char)(iSubDimOrd+1), {} }; putInMap(subDimEntity, data); } @@ -1486,14 +1478,14 @@ static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; - bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; + bool is_not_empty_but_data_cleared = (!is_empty && std::get(nodeId_elementOwnerId).size() == 0); // if empty or if my id is the smallest, make this element the owner - stk::mesh::EntityId db_id = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank db_rank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId db_id = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank db_rank = std::get(nodeId_elementOwnerId).rank(); stk::mesh::EntityId element_id = m_eMesh.identifier(element); stk::mesh::EntityId element_rank = m_eMesh.entity_rank(element); @@ -1505,7 +1497,7 @@ unsigned smark=0; if (!is_empty) { - unsigned& mark = nodeId_elementOwnderId.get().m_mark; + unsigned& mark = std::get(nodeId_elementOwnerId).m_mark; if (needNodes) mark |= NR_MARK; else @@ -1526,9 +1518,9 @@ { unsigned numNewNodes = needed_entity_rank.second; - SubDimCellData data( NodeIdsOnSubDimEntityType(numNewNodes, stk::mesh::Entity(), smark), - stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); - NodeIdsOnSubDimEntityType& nid_new = data.get(); + SubDimCellData data { NodeIdsOnSubDimEntityType(numNewNodes, stk::mesh::Entity(), smark), + stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), (unsigned char)needed_entity_rank.first, (unsigned char)(iSubDimOrd+1), {} }; + NodeIdsOnSubDimEntityType& nid_new = std::get(data); if (needNodes) nid_new.m_mark |= NR_MARK; else @@ -1541,53 +1533,12 @@ { stk::mesh::Entity owning_element = m_eMesh.get_entity(db_rank, db_id); VERIFY_OP_ON(m_eMesh.is_valid(owning_element), ==, true, "hmmm"); - NodeIdsOnSubDimEntityType& nid = nodeId_elementOwnderId.get(); - m_cell_2_data_map[subDimEntity] = SubDimCellData(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); + NodeIdsOnSubDimEntityType& nid = std::get(nodeId_elementOwnerId); + m_cell_2_data_map[subDimEntity] = std::forward_as_tuple(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)),(unsigned char) needed_entity_rank.first, (unsigned char)(iSubDimOrd+1), Double2()); } ret_val = true; } - // all debug code from here on - - bool debug = false; - if (debug && !is_empty) - { - unsigned originalMark = nodeId_elementOwnderId.get().m_mark; - std::cout << m_eMesh.rank() << " registerNeedNewNode element= " << m_eMesh.print_entity_compact(element) << "\n needNodes= " << needNodes << " iSubDimOrd= " << iSubDimOrd - << " is_empty= " << is_empty << " is_not_empty_but_data_cleared= " << is_not_empty_but_data_cleared << " should_put_in= " << should_put_in - << " originalMark= " << originalMark << " currentMark= " << smark << " NR_MARK= " << NR_MARK - << m_eMesh.demangled_stacktrace(20) - << std::endl; - } - if (debug) - { - SubDimCellData* a_nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& a_nodeId_elementOwnderId = (a_nodeId_elementOwnderId_ptr ? *a_nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool a_is_empty = a_nodeId_elementOwnderId_ptr == 0; - unsigned& gotMark = a_nodeId_elementOwnderId.get().m_mark; - unsigned nidSize = a_nodeId_elementOwnderId.get().size(); - - std::ostringstream sout; - sout << "P[" << m_eMesh.get_rank() << "] registerNeedNewNode:: element= " << m_eMesh.identifier(element) << " nidSize= " << nidSize - << " nid= " << (nidSize ? (int)m_eMesh.identifier(nodeId_elementOwnderId.get()[0]) : -1); - - sout << " smark= " << smark << " gotMark= " << gotMark << " needNodes= " << needNodes << " isG= " << m_eMesh.isGhostElement(element) - << " is_empty= " << is_empty - << " a_is_empty= " << a_is_empty - << " should_put_in= " << should_put_in - << " should_put_in_id= " << should_put_in_id - << " should_put_in_rank_gt= " << should_put_in_rank_gt - << " should_put_in_rank_gte= " << should_put_in_rank_gte - << " needed_entity_rank= " - << needed_entity_rank.first << " subDimEntity= "; - - for (unsigned k=0; k < subDimEntity.size(); k++) - { - sout << " " << m_eMesh.identifier(subDimEntity[k]) << " "; - } - std::cout << sout.str() << std::endl; - } - return ret_val; } @@ -1601,15 +1552,15 @@ static SubDimCellData new_SubDimCellData; static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; - bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; + bool is_not_empty_but_data_cleared = (!is_empty && std::get(nodeId_elementOwnerId).size() == 0); (void)is_not_empty_but_data_cleared; // if empty or if my id is the smallest, make this element the owner - stk::mesh::EntityId db_id = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityId db_rank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId db_id = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityId db_rank = std::get(nodeId_elementOwnerId).rank(); bool should_put_in_id = (m_eMesh.identifier(element) < db_id); bool should_put_in_rank_gt = (m_eMesh.entity_rank(element) > db_rank); @@ -1620,9 +1571,9 @@ if (!is_empty && should_put_in) { - nodeId_elementOwnderId.get() = stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)); - nodeId_elementOwnderId.get() = static_cast(iSubDimOrd + 1); - nodeId_elementOwnderId.get() = static_cast(needed_entity_rank.first); + std::get(nodeId_elementOwnerId) = stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)); + std::get(nodeId_elementOwnerId) = static_cast(iSubDimOrd + 1); + std::get(nodeId_elementOwnerId) = static_cast(needed_entity_rank.first); return true; } @@ -1642,14 +1593,14 @@ static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; - bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; + bool is_not_empty_but_data_cleared = (!is_empty && std::get(nodeId_elementOwnerId).size() == 0); // if empty or if my id is the smallest, make this element the owner - stk::mesh::EntityId db_id = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank db_rank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId db_id = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank db_rank = std::get(nodeId_elementOwnerId).rank(); stk::mesh::EntityId element_id = m_eMesh.identifier(element); stk::mesh::EntityId element_rank = m_eMesh.entity_rank(element); @@ -1661,7 +1612,7 @@ unsigned smark=0; if (!is_empty) { - unsigned& mark = nodeId_elementOwnderId.get().m_mark; + unsigned& mark = std::get(nodeId_elementOwnerId).m_mark; if (needNodes) mark |= NR_MARK; else @@ -1681,9 +1632,8 @@ if (is_empty || is_not_empty_but_data_cleared) { unsigned numNewNodes = 0; // needed_entity_rank.second; - SubDimCellData data( NodeIdsOnSubDimEntityType(numNewNodes, stk::mesh::Entity(), smark), - stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); - NodeIdsOnSubDimEntityType& nid_new = data.get(); + SubDimCellData data = std::forward_as_tuple(NodeIdsOnSubDimEntityType(numNewNodes, stk::mesh::Entity(), smark), stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), (unsigned char)needed_entity_rank.first, (unsigned char)(iSubDimOrd+1), Double2() ); + NodeIdsOnSubDimEntityType& nid_new = std::get(data); if (needNodes) nid_new.m_mark |= NR_MARK; else @@ -1696,8 +1646,8 @@ { stk::mesh::Entity owning_element = m_eMesh.get_entity(db_rank, db_id); VERIFY_OP_ON(m_eMesh.is_valid(owning_element), ==, true, "hmmm"); - NodeIdsOnSubDimEntityType& nid = nodeId_elementOwnderId.get(); - m_cell_2_data_map[subDimEntity] = SubDimCellData(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); + NodeIdsOnSubDimEntityType& nid = std::get(nodeId_elementOwnerId); + m_cell_2_data_map[subDimEntity] = std::forward_as_tuple(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), (unsigned char)needed_entity_rank.first, (unsigned char)(iSubDimOrd+1), Double2() ); } ret_val = true; } @@ -1837,9 +1787,9 @@ if (!need_to_send) return true; if (hasGhostNode) return true; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; if (is_empty) { @@ -1847,7 +1797,7 @@ str << m_eMesh.rank() << "ERROR: element= " << m_eMesh.print_entity_compact(element) << " needed_entity_rank= " << needed_entity_rank.first<< " " << needed_entity_rank.second << std::endl; str << "subDimEntity= " << subDimEntity << std::endl; - str << "nodeId_elementOwnderId= " << nodeId_elementOwnderId << std::endl; + str << "nodeId_elementOwnerId= " << nodeId_elementOwnerId << std::endl; str << "empty_SubDimCellData= " << empty_SubDimCellData << std::endl; std::cout << str.str() << std::endl; throw std::logic_error("NodeRegistry::checkForRemote no data (is_empty=true) - logic error."); @@ -1855,10 +1805,10 @@ } else { - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank owning_elementRank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank owning_elementRank = std::get(nodeId_elementOwnerId).rank(); - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned nidsz = nodeIds_onSE.size(); // error check @@ -1867,7 +1817,7 @@ if ( isNotOK ) { std::cout << "P[" << proc_rank << "] elem id = " << m_eMesh.identifier(element) - << " nodeId_elementOwnderId.get() = " + << " std::get(nodeId_elementOwnerId) = " << owning_elementId << std::endl; throw std::logic_error("NodeRegistry::checkForRemote logic: owning element info is wrong"); @@ -1895,11 +1845,11 @@ for (unsigned i_other_proc = 0; i_other_proc < procs_to_send_to.size(); ++i_other_proc) { - buffer_entry.get() = subDimEntity.size(); - buffer_entry.get() = needed_entity_rank.first; + std::get(buffer_entry) = subDimEntity.size(); + std::get(buffer_entry) = needed_entity_rank.first; for (unsigned inode=0; inode < subDimEntity.size(); ++inode) - buffer_entry.get()[inode] = m_eMesh.entity_key(subDimEntity[inode]); + std::get(buffer_entry)[inode] = m_eMesh.entity_key(subDimEntity[inode]); if (nodeIds_onSE.m_entity_id_vector.size() != nodeIds_onSE.size()) { @@ -1928,7 +1878,7 @@ { m_comm_all->send_buffer( procs_to_send_to[i_other_proc] ).pack< CommDataType > (buffer_entry); - NodeIdsOnSubDimEntityType& nids = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nids = std::get(nodeId_elementOwnerId); nids.pack(m_eMesh, m_comm_all->send_buffer( procs_to_send_to[i_other_proc] )); } } @@ -1962,8 +1912,8 @@ for (iter = map.begin(); iter != map.end(); ++iter) { - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.size() != 1) { @@ -2051,9 +2001,9 @@ getSubDimEntity(subDimEntity, element, needed_entity_rank, iSubDimOrd); static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; if (s_allow_empty_sub_dims && is_empty) { @@ -2072,7 +2022,7 @@ << "\n iSubDimOrd= " << iSubDimOrd << std::endl; throw std::runtime_error("prolongateField: no node found"); } - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.size() != 1) { if (nodeIds_onSE.size() > 1) @@ -2203,9 +2153,9 @@ SubDimCell_SDCEntityType subDimEntity(&m_eMesh); getSubDimEntity(subDimEntity, element, needed_entity_rank, iSubDimOrd); static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; if (s_allow_empty_sub_dims && is_empty) { @@ -2216,7 +2166,7 @@ { throw std::runtime_error("addToExistingParts: no node found"); } - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned nidsz = nodeIds_onSE.size(); for (unsigned i_nid = 0; i_nid < nidsz; i_nid++) @@ -2321,9 +2271,9 @@ for (iter = m_cell_2_data_map.begin(); iter != m_cell_2_data_map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); bool found = true; stk::mesh::EntityRank needed_entity_rank = stk::topology::NODE_RANK; @@ -2531,7 +2481,7 @@ for (SubDimCellToDataMap::iterator cell_iter = m_cell_2_data_map.begin(); cell_iter != m_cell_2_data_map.end(); ++cell_iter) { SubDimCellData& data = (*cell_iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = data.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(data); sz += nodeIds_onSE.size(); } @@ -2545,12 +2495,12 @@ { SubDimCellData& data = (*cell_iter).second; - stk::mesh::EntityId owning_elementId = data.get().id(); + stk::mesh::EntityId owning_elementId = std::get(data).id(); - NodeIdsOnSubDimEntityType& nodeIds_onSE = data.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(data); if (nodeIds_onSE.size()) { - stk::mesh::EntityRank erank = data.get().rank(); + stk::mesh::EntityRank erank = std::get(data).rank(); stk::mesh::Entity owning_element = get_entity_element(*m_eMesh.get_bulk_data(), erank, owning_elementId); if (!m_eMesh.is_valid(owning_element)) @@ -2617,7 +2567,7 @@ while ( recv_buffer.remaining() ) { - // Rank of sub-dim cells needing new nodes, which sub-dim entity, one non-owning element identifier, nodeId_elementOwnderId.first + // Rank of sub-dim cells needing new nodes, which sub-dim entity, one non-owning element identifier, nodeId_elementOwnerId.first recv_buffer.unpack< CommDataType >( buffer_entry ); NodeIdsOnSubDimEntityType nodeIds_onSE; @@ -2673,7 +2623,7 @@ m_eMesh.createEntities( stk::topology::NODE_RANK, num_nodes_needed, new_nodes); #else m_eMesh.initializeIdServer(); - stk::mesh::Part& nodePart = m_eMesh.get_fem_meta_data()->get_cell_topology_root_part(stk::mesh::get_cell_topology(stk::topology::NODE)); + stk::mesh::Part& nodePart = m_eMesh.get_fem_meta_data()->get_topology_root_part(stk::topology::NODE); stk::mesh::PartVector nodeParts(1, &nodePart); m_eMesh.getEntitiesUsingIdServer( m_eMesh.node_rank(), num_nodes_needed, new_nodes, nodeParts); #endif @@ -2709,18 +2659,18 @@ for (SubDimCellToDataMap::iterator cell_iter = m_cell_2_data_map.begin(); cell_iter != m_cell_2_data_map.end(); ++cell_iter) { SubDimCellData& data = (*cell_iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = data.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(data); if (!nodeIds_onSE.size()) continue; - stk::mesh::EntityId owning_elementId = data.get().id(); + stk::mesh::EntityId owning_elementId = std::get(data).id(); if (!owning_elementId) { throw std::logic_error("logic: hmmm #5.4.0"); } - stk::mesh::EntityRank erank = data.get().rank(); + stk::mesh::EntityRank erank = std::get(data).rank(); stk::mesh::Entity owning_element = get_entity_element(*m_eMesh.get_bulk_data(), erank, owning_elementId); if (!m_eMesh.is_valid(owning_element)) @@ -2782,8 +2732,7 @@ void NodeRegistry:: createNodeAndConnect(CommDataType& buffer_entry, NodeIdsOnSubDimEntityType& nodeIds_onSE, unsigned from_proc, vector& nodes_to_ghost) { - //stk::mesh::EntityRank needed_entity_rank = buffer_entry.get(); - unsigned subDimEntitySize = buffer_entry.get(); + unsigned subDimEntitySize = std::get(buffer_entry); for (unsigned iid = 0; iid < nodeIds_onSE.size(); iid++) { @@ -2800,7 +2749,7 @@ //getSubDimEntity(subDimEntity, element, needed_entity_rank, iSubDimOrd); for (unsigned inode = 0; inode < subDimEntitySize; ++inode) { - stk::mesh::EntityKey key = buffer_entry.get()[inode]; + stk::mesh::EntityKey key = std::get(buffer_entry)[inode]; stk::mesh::Entity node = m_eMesh.get_entity(key); VERIFY_OP_ON(m_eMesh.is_valid(node), ==, true, "bad node"); subDimEntity.insert(node); @@ -2813,7 +2762,7 @@ if (subDimCellDataPtr) { SubDimCellData& subDimCellData = *subDimCellDataPtr; - NodeIdsOnSubDimEntityType& nodeIds_onSE_existing = subDimCellData.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE_existing = std::get(subDimCellData); nodeIds_onSE.m_mark |= nodeIds_onSE_existing.m_mark; VERIFY_OP_ON(nodeIds_onSE_existing.size(), ==, nodeIds_onSE_existing.m_entity_id_vector.size(), "bad nodeIds_onSE_existing"); @@ -2866,9 +2815,9 @@ for (iter = map.begin(); iter != map.end(); ++iter) { //const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); bool found = false; for (unsigned ii = 0; ii < nodeIds_onSE.size(); ii++) @@ -2914,9 +2863,9 @@ for (iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned jj = 0; bool found = false; @@ -2926,7 +2875,7 @@ { if (kept_nodes_orig_minus_kept_nodes.find(nodeIds_onSE[ii]) != kept_nodes_orig_minus_kept_nodes.end()) { - to_save[subDimEntity] = nodeId_elementOwnderId; + to_save[subDimEntity] = nodeId_elementOwnerId; } found = true; jj = ii; @@ -2989,10 +2938,10 @@ for (iter = map.begin(); iter != map.end(); ++iter) { - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank owning_elementRank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank owning_elementRank = std::get(nodeId_elementOwnerId).rank(); if (owning_elementId) { @@ -3000,17 +2949,17 @@ if (!m_eMesh.is_valid(owning_element)) { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (resize_nodeId_data) { nodeIds_onSE.resize(0); } - nodeId_elementOwnderId.get() = stk::mesh::EntityKey(owning_elementRank, 0u); + std::get(nodeId_elementOwnerId) = stk::mesh::EntityKey(owning_elementRank, 0u); } } else { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (resize_nodeId_data) nodeIds_onSE.resize(0); } } @@ -3033,16 +2982,16 @@ for (iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - stk::mesh::Entity owning_elem = m_eMesh.get_bulk_data()->get_entity(nodeId_elementOwnderId.get()); + stk::mesh::Entity owning_elem = m_eMesh.get_bulk_data()->get_entity(std::get(nodeId_elementOwnerId)); std::cout << "tmp ddb:: owning element id = " << m_eMesh.identifier(owning_elem) << std::endl; - std::cout << "tmp ddb:: owning element subdim rank = " << static_cast( nodeId_elementOwnderId.get()) << std::endl; + std::cout << "tmp ddb:: owning element subdim rank = " << static_cast( std::get(nodeId_elementOwnerId)) << std::endl; - std::cout << "tmp ddb:: owning element subdim ordinal = " << static_cast(nodeId_elementOwnderId.get()) << std::endl; + std::cout << "tmp ddb:: owning element subdim ordinal = " << static_cast(std::get(nodeId_elementOwnerId)) << std::endl; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); for (unsigned ii = 0; ii < nodeIds_onSE.size(); ii++) { @@ -3068,11 +3017,11 @@ for (iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; mem += sizeof(SDCEntityType)*subDimEntity.size(); mem += sizeof(stk::mesh::EntityKey); - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); size_t mem1 = (sizeof(stk::mesh::Entity)+ sizeof(stk::mesh::EntityId))*nodeIds_onSE.size() +sizeof(unsigned); @@ -3140,9 +3089,9 @@ for (SubDimCellToDataMap::iterator iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; - stk::mesh::EntityRank owning_element_subDim_rank = static_cast(nodeId_elementOwnderId.get()); + stk::mesh::EntityRank owning_element_subDim_rank = static_cast(std::get(nodeId_elementOwnerId)); static std::vector procs_to_send_to; @@ -3159,7 +3108,7 @@ if (!need_to_send) continue; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.size()) { @@ -3169,11 +3118,11 @@ // only need to send if it's got non-zero mark info if (is_marked || is_not_marked) { - buffer_entry.get() = subDimEntity.size(); - buffer_entry.get() = owning_element_subDim_rank; + std::get(buffer_entry) = subDimEntity.size(); + std::get(buffer_entry) = owning_element_subDim_rank; for (unsigned inode=0; inode < subDimEntity.size(); ++inode) - buffer_entry.get()[inode] = m_eMesh.entity_key(subDimEntity[inode]); + std::get(buffer_entry)[inode] = m_eMesh.entity_key(subDimEntity[inode]); for (unsigned jprocs = 0; jprocs < procs_to_send_to.size(); ++jprocs) { @@ -3207,28 +3156,26 @@ recv_buffer.unpack< unsigned > (mark); { - //stk::mesh::EntityRank needed_entity_rank = buffer_entry.get(); - unsigned subDimEntitySize = buffer_entry.get(); + unsigned subDimEntitySize = std::get(buffer_entry); SubDimCell_SDCEntityType subDimEntity(&m_eMesh); - //getSubDimEntity(subDimEntity, owning_element, needed_entity_rank, iSubDimOrd); for (unsigned inode = 0; inode < subDimEntitySize; ++inode) { - stk::mesh::Entity node = m_eMesh.get_entity(buffer_entry.get()[inode]); + stk::mesh::Entity node = m_eMesh.get_entity(std::get(buffer_entry)[inode]); VERIFY_OP_ON(m_eMesh.is_valid(node), ==, true, "bad node"); subDimEntity.insert(node); } static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; //VERIFY_OP_ON(is_empty, !=, true, "hmmm"); if (!is_empty) { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); // accumulation from all other procs nodeIds_onSE.m_mark |= mark; @@ -3267,43 +3214,43 @@ std::cout << "NodeRegistry::compare_to_kokkos_NR : key with m_HashCode = " << subDimEntity_BOOST.getHash() << " NOT FOUND kokkos map\n"; noKeysNotInCommon++; } - else //compare data fields typedef boost::tuple SubDimCellData; + else { - if ( !( data_KOKKOS->get<0>() == data_BOOST.get<0>() )) + if ( !( std::get<0>(*data_KOKKOS) == std::get<0>(data_BOOST) )) { // kUOmap_contains_bUOmap = false; std::cout << "NodeRegistry::compare_to_kokkos_NR : NodeIdsOnSubDimEntityType on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap NodeIdsOnSubDimEntityType = "<< data_KOKKOS->get<0>() << " bOUmap NodeIdsOnSubDimEntityType = " << data_BOOST.get<0>() << "\n"; + std::cout << " kOUmap NodeIdsOnSubDimEntityType = "<< std::get<0>(*data_KOKKOS) << " bOUmap NodeIdsOnSubDimEntityType = " << std::get<0>(data_BOOST) << "\n"; } - if(!( data_KOKKOS->get<1>() == data_BOOST.get<1>() )) + if(!( std::get<1>(*data_KOKKOS) == std::get<1>(data_BOOST) )) { // kUOmap_contains_bUOmap = false; std::cout << "NodeRegistry::compare_to_kokkos_NR : EntityKey on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap EntityKey = "<< data_KOKKOS->get<1>() << " bOUmap EntityKey = " << data_BOOST.get<1>() << "\n"; + std::cout << " kOUmap EntityKey = "<< std::get<1>(*data_KOKKOS) << " bOUmap EntityKey = " << std::get<1>(data_BOOST) << "\n"; } - if(!( data_KOKKOS->get<2>() == data_BOOST.get<2>() ) ) + if(!( std::get<2>(*data_KOKKOS) == std::get<2>(data_BOOST) ) ) { // kUOmap_contains_bUOmap = false; std::cout << "NodeRegistry::compare_to_kokkos_NR : unsigned char on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap unsigned char = "<< data_KOKKOS->get<2>() << " bOUmap unsigned char = " << data_BOOST.get<2>() << "\n"; + std::cout << " kOUmap unsigned char = "<< std::get<2>(*data_KOKKOS) << " bOUmap unsigned char = " << std::get<2>(data_BOOST) << "\n"; } - if(!( data_KOKKOS->get<3>() == data_BOOST.get<3>() ) ) + if(!( std::get<3>(*data_KOKKOS) == std::get<3>(data_BOOST) ) ) { // kUOmap_contains_bUOmap = false; std::cout << "NodeRegistry::compare_to_kokkos_NR : unsigned char on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap unsigned char = "<< data_KOKKOS->get<3>() << " bOUmap unsigned char = " << data_BOOST.get<3>() << "\n"; + std::cout << " kOUmap unsigned char = "<< std::get<3>(*data_KOKKOS) << " bOUmap unsigned char = " << std::get<3>(data_BOOST) << "\n"; } - if(!( data_KOKKOS->get<4>() == data_BOOST.get<4>() ) ) + if(!( std::get<4>(*data_KOKKOS) == std::get<4>(data_BOOST) ) ) { // kUOmap_contains_bUOmap = false; std::cout << "NodeRegistry::compare_to_kokkos_NR : Double2 on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap Double2 = "<< data_KOKKOS->get<4>() << " bOUmap Double2 = " << data_BOOST.get<4>() << "\n"; + std::cout << " kOUmap Double2 = "<< std::get<4>(*data_KOKKOS) << " bOUmap Double2 = " << std::get<4>(data_BOOST) << "\n"; } } if(!kUOmap_contains_bUOmap) std::cout << "NodeRegistry::compare_to_kokkos_NR : key with m_HashCode = " << subDimEntity_BOOST.getHash() << " doesn't match anything in kokkos map\n\n"; - for(unsigned iEnt=0;iEnt().m_entity_id_vector.size();iEnt++){ - unsigned ent_val = data_BOOST.get<0>().m_entity_id_vector[iEnt]; + for(unsigned iEnt=0;iEnt(data_BOOST).m_entity_id_vector.size();iEnt++){ + unsigned ent_val = std::get<0>(data_BOOST).m_entity_id_vector[iEnt]; nodesMappedTo.insert(stk::mesh::Entity(ent_val)); } } diff --git a/packages/percept/src/adapt/NodeRegistry.hpp b/packages/percept/src/adapt/NodeRegistry.hpp index 553a40efd0fa..0a3df61ddc28 100644 --- a/packages/percept/src/adapt/NodeRegistry.hpp +++ b/packages/percept/src/adapt/NodeRegistry.hpp @@ -45,17 +45,10 @@ #include -#include -#include - #define DEBUG_PRINT_11 0 #define NR_PRINT(a) do { if (DEBUG_PRINT_11) std::cout << #a << " = " << a ; } while(0) #define NR_PRINT_OUT(a,out) do { if (DEBUG_PRINT_11) out << #a << " = " << a << std::endl; } while(0) -/// define only one of these to be 1 -/// current best setting is NODE_REGISTRY_MAP_TYPE_BOOST = 1 - - #define STK_ADAPT_NODEREGISTRY_USE_ENTITY_REPO 0 #define STK_ADAPT_NODEREGISTRY_DO_REHASH 1 @@ -104,7 +97,6 @@ m_useAddNodeSharing(false), m_checkForGhostedNodes(false), m_gee_cnt(0), m_gen_cnt(0), - m_entity_repo(percept::EntityRankEnd), m_debug(false), m_state(NRS_NONE) { @@ -118,7 +110,6 @@ } void init_comm_all(); - void init_entity_repo(); void clear_dangling_nodes(SetOfEntities* nodes_to_be_deleted); void initialize(); @@ -212,8 +203,8 @@ { SubDimCellData& nodeId_elementOwnderId = data; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnderId); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnderId).id(); if (1) std::cout << "put in map: nodeIds_onSE.size= " << (nodeIds_onSE.size()) @@ -376,7 +367,6 @@ public: int m_gee_cnt; int m_gen_cnt; - std::vector m_entity_repo; bool m_debug; diff --git a/packages/percept/src/adapt/NodeRegistryDef.hpp b/packages/percept/src/adapt/NodeRegistryDef.hpp index 62e5e18a26cd..b85c43b52487 100644 --- a/packages/percept/src/adapt/NodeRegistryDef.hpp +++ b/packages/percept/src/adapt/NodeRegistryDef.hpp @@ -21,9 +21,9 @@ getSubDimEntity(subDimEntity, element, needed_entity_rank, iSubDimOrd); static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; bool debug = false; if (debug) @@ -37,13 +37,13 @@ << "\n eMesh.entity_rank(element) = " << m_eMesh.entity_rank(element) << "\n needed_entity_rank= " << needed_entity_rank << "\n iSubDimOrd= " << iSubDimOrd - << "\n nodeId_elementOwnderId.size= " << nodeId_elementOwnderId.get().size() - << "\n node_valid= " << m_eMesh.is_valid(nodeId_elementOwnderId.get()[0]) - << "\n node_id= " << nodeId_elementOwnderId.get().m_entity_id_vector[0] + << "\n nodeId_elementOwnerId.size= " << std::get(nodeId_elementOwnerId).size() + << "\n node_valid= " << m_eMesh.is_valid(std::get(nodeId_elementOwnerId)[0]) + << "\n node_id= " << std::get(nodeId_elementOwnerId).m_entity_id_vector[0] << "\n is_empty= " << is_empty - << "\n owningElementKey= " << (is_empty ? stk::mesh::EntityKey(m_eMesh.node_rank(),0) : nodeId_elementOwnderId.get()) - << "\n owningElementSubDimRank= " << (is_empty ? 0 : nodeId_elementOwnderId.get()) - << "\n owningElementSubDimOrd= " << (is_empty ? 0 : nodeId_elementOwnderId.get()) + << "\n owningElementKey= " << (is_empty ? stk::mesh::EntityKey(m_eMesh.node_rank(),0) : std::get(nodeId_elementOwnerId)) + << "\n owningElementSubDimRank= " << (is_empty ? 0 : std::get(nodeId_elementOwnerId)) + << "\n owningElementSubDimOrd= " << (is_empty ? 0 : std::get(nodeId_elementOwnerId)) << std::endl; } @@ -51,7 +51,7 @@ { return 0; } - NodeIdsOnSubDimEntityType& nodeId = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeId = std::get(nodeId_elementOwnerId); if (debug) { std::cout << "NodeRegistry::getNewNodesOnSubDimEntity: nodeId.size= " << nodeId.size() << " node= " << nodeId[0] << " " << nodeId.m_entity_id_vector[0] << std::endl; @@ -65,9 +65,8 @@ getSubDimEntity(subDimEntity, element, needed_entity_rank, iSubDimOrd); static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - //SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + bool is_empty = nodeId_elementOwnerId_ptr == 0; return is_empty; } diff --git a/packages/percept/src/adapt/NodeRegistryType.hpp b/packages/percept/src/adapt/NodeRegistryType.hpp index 5a4f18dedaca..a0811e36fc35 100644 --- a/packages/percept/src/adapt/NodeRegistryType.hpp +++ b/packages/percept/src/adapt/NodeRegistryType.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -40,18 +40,12 @@ #include -#include -#include +#include #include #include #include -#define NODE_REGISTRY_MAP_TYPE_BOOST 1 -#if NODE_REGISTRY_MAP_TYPE_BOOST -#include -#endif - namespace percept { // pair of rank and number of entities of that rank needed on a SubDimCell struct NeededEntityType @@ -63,14 +57,14 @@ namespace percept { : first(f), second(s), third(0) {} }; - inline std::ostream &operator<<(std::ostream& out, const boost::array& arr) + inline std::ostream &operator<<(std::ostream& out, const std::array& arr) { out << arr[0]; return out; } #define DOUBLE2LEN 2 - typedef boost::array Double2; + typedef std::array Double2; inline std::ostream &operator<<(std::ostream& out, const Double2 arr) { @@ -80,7 +74,7 @@ namespace percept { } // tuple storage: SDC_DATA_GLOBAL_NODE_IDS, SDC_DATA_OWNING_ELEMENT_KEY, SDC_DATA_OWNING_SUBDIM_RANK, SDC_DATA_OWNING_SUBDIM_ORDINAL, SDC_DATA_SPACING - typedef boost::tuple SubDimCellData; + typedef std::tuple SubDimCellData; enum { MAX_NODES_ON_A_FACE = 4 }; typedef MySubDimCell SubDimCell_SDCEntityType; @@ -104,32 +98,21 @@ namespace percept { { std::ostringstream ostr; ostr << "SDC:: node ids= ["; - for (unsigned ii=0; ii < val.get().size(); ++ii) + for (unsigned ii=0; ii < std::get(val).size(); ++ii) { - ostr << " " << val.get().m_entity_id_vector[ii]; + ostr << " " << std::get(val).m_entity_id_vector[ii]; } - ostr << "] owning element rank= " << val.get().rank() - << " id= " << val.get().id() - << " subDim-ord= " << (int)val.get() - << " subDim-rank= " << (int)val.get() - << " spacing info= " << val.get()[0] << " " << val.get()[1]; + ostr << "] owning element rank= " << std::get(val).rank() + << " id= " << std::get(val).id() + << " subDim-ord= " << (int)std::get(val) + << " subDim-rank= " << (int)std::get(val) + << " spacing info= " << std::get(val)[0] << " " << std::get(val)[1]; out << ostr.str() << std::endl; return out; } /// map of the node ids on a sub-dim entity to the data on the sub-dim entity - -#if NODE_REGISTRY_MAP_TYPE_BOOST -# ifdef STK_HAVE_TBB - - typedef tbb::scalable_allocator > RegistryAllocator; - typedef boost::unordered_map, my_fast_equal_to, RegistryAllocator > SubDimCellToDataMap; - -# else - typedef boost::unordered_map, my_fast_equal_to > SubDimCellToDataMap; - typedef boost::unordered_map EntityRepo; -# endif -#endif + typedef std::unordered_map, my_fast_equal_to > SubDimCellToDataMap; // Size and rank of sub-dim cells needing new nodes, actual nodes' EntityKeys stored in a SubDimCell enum CommDataTypeEnum { @@ -139,7 +122,7 @@ namespace percept { }; // decode: size of SubDimCell, SubDimCell, sub-dim entity rank, non-owning element RANK - typedef boost::tuple > CommDataType; + typedef std::tuple > CommDataType; enum NodeRegistryState { NRS_NONE, diff --git a/packages/percept/src/adapt/NodeRegistry_KOKKOS.cpp b/packages/percept/src/adapt/NodeRegistry_KOKKOS.cpp index 4e274dc58446..51c0ea41eed2 100644 --- a/packages/percept/src/adapt/NodeRegistry_KOKKOS.cpp +++ b/packages/percept/src/adapt/NodeRegistry_KOKKOS.cpp @@ -22,15 +22,9 @@ #include namespace percept { - void NodeRegistry_KOKKOS::init_entity_repo() - { - for (unsigned i = 0; i < percept::EntityRankEnd; i++) m_entity_repo[i].clear(); - } - void NodeRegistry_KOKKOS::initialize() { m_cell_2_data_map.clear(); - init_entity_repo(); } void NodeRegistry_KOKKOS:: @@ -99,15 +93,15 @@ // for (iter = m_cell_2_data_map.begin(); iter != m_cell_2_data_map.end(); ++iter) // { -// SubDimCellData& nodeId_elementOwnderId = (*iter).second; +// SubDimCellData& nodeId_elementOwnerId = (*iter).second; for(unsigned iMapIndx = 0; iMapIndx(); + SubDimCellData& nodeId_elementOwnerId = m_cell_2_data_map.value_at(iData); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (debug) std::cout << "tmp SRK nodeIds_onSE.size= " << nodeIds_onSE.size() << std::endl; if (nodeIds_onSE.size()) { @@ -164,14 +158,14 @@ static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; - bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; + bool is_not_empty_but_data_cleared = (!is_empty && std::get(nodeId_elementOwnerId).size() == 0); // if empty or if my id is the smallest, make this element the owner - stk::mesh::EntityId db_id = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank db_rank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId db_id = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank db_rank = std::get(nodeId_elementOwnerId).rank(); stk::mesh::EntityId element_id = m_eMesh.identifier(element); stk::mesh::EntityId element_rank = m_eMesh.entity_rank(element); @@ -183,7 +177,7 @@ unsigned smark=0; if (!is_empty) { - unsigned& mark = nodeId_elementOwnderId.get().m_mark; + unsigned& mark = std::get(nodeId_elementOwnerId).m_mark; if (needNodes) mark |= NR_MARK; else @@ -204,9 +198,8 @@ { unsigned numNewNodes = needed_entity_rank.second; - SubDimCellData data( NodeIdsOnSubDimEntityType(numNewNodes, stk::mesh::Entity(), smark), - stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); - NodeIdsOnSubDimEntityType& nid_new = data.get(); + SubDimCellData data = std::forward_as_tuple( NodeIdsOnSubDimEntityType(numNewNodes, stk::mesh::Entity(), smark), stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), (unsigned char)needed_entity_rank.first, (unsigned char)(iSubDimOrd+1), Double2() ); + NodeIdsOnSubDimEntityType& nid_new = std::get(data); if (needNodes) nid_new.m_mark |= NR_MARK; else @@ -219,9 +212,8 @@ { stk::mesh::Entity owning_element = m_eMesh.get_entity(db_rank, db_id); VERIFY_OP_ON(m_eMesh.is_valid(owning_element), ==, true, "hmmm"); - NodeIdsOnSubDimEntityType& nid = nodeId_elementOwnderId.get(); -// m_cell_2_data_map[subDimEntity] = SubDimCellData(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); - SubDimCellData data(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), needed_entity_rank.first, iSubDimOrd+1 ); + NodeIdsOnSubDimEntityType& nid = std::get(nodeId_elementOwnerId); + SubDimCellData data = std::forward_as_tuple(nid, stk::mesh::EntityKey(m_eMesh.entity_rank(element), m_eMesh.identifier(element)), (unsigned char)needed_entity_rank.first, (unsigned char)(iSubDimOrd+1), Double2() ); putInMap(subDimEntity,data); } ret_val = true; @@ -232,7 +224,7 @@ bool debug = false; if (debug && !is_empty) { - unsigned originalMark = nodeId_elementOwnderId.get().m_mark; + unsigned originalMark = std::get(nodeId_elementOwnerId).m_mark; std::cout << m_eMesh.rank() << " registerNeedNewNode element= " << m_eMesh.print_entity_compact(element) << "\n needNodes= " << needNodes << " iSubDimOrd= " << iSubDimOrd << " is_empty= " << is_empty << " is_not_empty_but_data_cleared= " << is_not_empty_but_data_cleared << " should_put_in= " << should_put_in << " originalMark= " << originalMark << " currentMark= " << smark << " NR_MARK= " << NR_MARK @@ -241,15 +233,15 @@ } if (debug) { - SubDimCellData* a_nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& a_nodeId_elementOwnderId = (a_nodeId_elementOwnderId_ptr ? *a_nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool a_is_empty = a_nodeId_elementOwnderId_ptr == 0; - unsigned& gotMark = a_nodeId_elementOwnderId.get().m_mark; - unsigned nidSize = a_nodeId_elementOwnderId.get().size(); + SubDimCellData* a_nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& a_nodeId_elementOwnerId = (a_nodeId_elementOwnerId_ptr ? *a_nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool a_is_empty = a_nodeId_elementOwnerId_ptr == 0; + unsigned& gotMark = std::get(a_nodeId_elementOwnerId).m_mark; + unsigned nidSize = std::get(a_nodeId_elementOwnerId).size(); std::ostringstream sout; sout << "P[" << m_eMesh.get_rank() << "] registerNeedNewNode:: element= " << m_eMesh.identifier(element) << " nidSize= " << nidSize - << " nid= " << (nidSize ? (int)m_eMesh.identifier(nodeId_elementOwnderId.get()[0]) : -1); + << " nid= " << (nidSize ? (int)m_eMesh.identifier(std::get(nodeId_elementOwnerId)[0]) : -1); sout << " smark= " << smark << " gotMark= " << gotMark << " needNodes= " << needNodes << " isG= " << m_eMesh.isGhostElement(element) << " is_empty= " << is_empty @@ -416,13 +408,13 @@ unsigned iData = m_cell_2_data_map.find(subDimEntity); if(iData == Kokkos::UnorderedMapInvalidIndex) continue; - SubDimCellData& nodeId_elementOwnderId = m_cell_2_data_map.value_at(iData); - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); + SubDimCellData& nodeId_elementOwnerId = m_cell_2_data_map.value_at(iData); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnerId).id(); - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.size()) { - stk::mesh::EntityRank erank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityRank erank = std::get(nodeId_elementOwnerId).rank(); stk::mesh::Entity owning_element = get_entity_element(*m_eMesh.get_bulk_data(), erank, owning_elementId); if (!m_eMesh.is_valid(owning_element)) @@ -469,7 +461,7 @@ m_eMesh.createEntities( stk::topology::NODE_RANK, num_nodes_needed, new_nodes); #else m_eMesh.initializeIdServer(); - stk::mesh::Part& nodePart = m_eMesh.get_fem_meta_data()->get_cell_topology_root_part(stk::mesh::get_cell_topology(stk::topology::NODE)); + stk::mesh::Part& nodePart = m_eMesh.get_fem_meta_data()->get_topology_root_part(stk::topology::NODE); stk::mesh::PartVector nodeParts(1, &nodePart); m_eMesh.getEntitiesUsingIdServer( m_eMesh.node_rank(), num_nodes_needed, new_nodes, nodeParts); #endif @@ -522,12 +514,12 @@ (void)iData; else{ SubDimCellData& data = m_cell_2_data_map.value_at(iData); - NodeIdsOnSubDimEntityType& nodeIds_onSE = data.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(data); if (!nodeIds_onSE.size()) // continue; //continue doesn't work the same way in pf (void)iData; else{ - stk::mesh::EntityId owning_elementId = data.get().id(); + stk::mesh::EntityId owning_elementId = std::get(data).id(); #ifndef __CUDACC__ if (!owning_elementId) @@ -536,7 +528,7 @@ } #endif - stk::mesh::EntityRank erank = data.get().rank(); + stk::mesh::EntityRank erank = std::get(data).rank(); stk::mesh::Entity owning_element = get_entity_element(*m_eMesh.get_bulk_data(), erank, owning_elementId); if (!m_eMesh.is_valid(owning_element)) @@ -656,15 +648,15 @@ // for (SubDimCellToDataMap_KOKKOS::iterator iter = map.begin(); iter != map.end(); ++iter) // { // const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; -// SubDimCellData& nodeId_elementOwnderId = (*iter).second; +// SubDimCellData& nodeId_elementOwnerId = (*iter).second; for(unsigned iMapIndx = 0; iMapIndx(nodeId_elementOwnderId.get()); + SubDimCellData& nodeId_elementOwnerId = map.value_at(iData); + stk::mesh::EntityRank owning_element_subDim_rank = static_cast(std::get(nodeId_elementOwnerId)); static std::vector procs_to_send_to; @@ -681,7 +673,7 @@ if (!need_to_send) continue; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); if (nodeIds_onSE.size()) { @@ -691,11 +683,11 @@ // only need to send if it's got non-zero mark info if (is_marked || is_not_marked) { - buffer_entry.get() = subDimEntity.size(); - buffer_entry.get() = owning_element_subDim_rank; + std::get(buffer_entry) = subDimEntity.size(); + std::get(buffer_entry) = owning_element_subDim_rank; for (unsigned inode=0; inode < subDimEntity.size(); ++inode) - buffer_entry.get()[inode] = m_eMesh.entity_key(subDimEntity[inode]); + std::get(buffer_entry)[inode] = m_eMesh.entity_key(subDimEntity[inode]); for (unsigned jprocs = 0; jprocs < procs_to_send_to.size(); ++jprocs) { @@ -729,28 +721,27 @@ recv_buffer.unpack< unsigned > (mark); { - //stk::mesh::EntityRank needed_entity_rank = buffer_entry.get(); - unsigned subDimEntitySize = buffer_entry.get(); + unsigned subDimEntitySize = std::get(buffer_entry); SubDimCell_SDCEntityType subDimEntity(&m_eMesh); //getSubDimEntity(subDimEntity, owning_element, needed_entity_rank, iSubDimOrd); for (unsigned inode = 0; inode < subDimEntitySize; ++inode) { - stk::mesh::Entity node = m_eMesh.get_entity(buffer_entry.get()[inode]); + stk::mesh::Entity node = m_eMesh.get_entity(std::get(buffer_entry)[inode]); VERIFY_OP_ON(m_eMesh.is_valid(node), ==, true, "bad node"); subDimEntity.insert(node); } static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; //VERIFY_OP_ON(is_empty, !=, true, "hmmm"); if (!is_empty) { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); // accumulation from all other procs nodeIds_onSE.m_mark |= mark; @@ -792,44 +783,44 @@ std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : key with m_HashCode = " << subDimEntity_KOKKOS.getHash() << " NOT FOUND kokkos map\n"; noKeysNotInCommon++; } - else //compare data fields typedef boost::tuple SubDimCellData; + else { - if ( !( data_KOKKOS.get<0>() == data_BOOST->get<0>() )) + if ( !( std::get<0>(data_KOKKOS) == std::get<0>(*data_BOOST) )) { // bUOmap_contains_kUOmap = false; std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : NodeIdsOnSubDimEntityType on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap NodeIdsOnSubDimEntityType = "<< data_KOKKOS.get<0>() << " bOUmap NodeIdsOnSubDimEntityType = " << data_BOOST->get<0>() << "\n"; + std::cout << " kOUmap NodeIdsOnSubDimEntityType = "<< std::get<0>(data_KOKKOS) << " bOUmap NodeIdsOnSubDimEntityType = " << std::get<0>(*data_BOOST) << "\n"; } - if(!( data_KOKKOS.get<1>() == data_BOOST->get<1>() )) + if(!( std::get<1>(data_KOKKOS) == std::get<1>(*data_BOOST) )) { // bUOmap_contains_kUOmap = false; std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : EntityKey on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap EntityKey = "<< data_KOKKOS.get<1>() << " bOUmap EntityKey = " << data_BOOST->get<1>() << "\n"; + std::cout << " kOUmap EntityKey = "<< std::get<1>(data_KOKKOS) << " bOUmap EntityKey = " << std::get<1>(*data_BOOST) << "\n"; } - if(!( data_KOKKOS.get<2>() == data_BOOST->get<2>() ) ) + if(!( std::get<2>(data_KOKKOS) == std::get<2>(*data_BOOST) ) ) { // bUOmap_contains_kUOmap = false; std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : unsigned char on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap unsigned char = "<< data_KOKKOS.get<2>() << " bOUmap unsigned char = " << data_BOOST->get<2>() << "\n"; + std::cout << " kOUmap unsigned char = "<< std::get<2>(data_KOKKOS) << " bOUmap unsigned char = " << std::get<2>(*data_BOOST) << "\n"; } - if(!( data_KOKKOS.get<3>() == data_BOOST->get<3>() ) ) + if(!( std::get<3>(data_KOKKOS) == std::get<3>(*data_BOOST) ) ) { // bUOmap_contains_kUOmap = false; std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : unsigned char on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap unsigned char = "<< data_KOKKOS.get<3>() << " bOUmap unsigned char = " << data_BOOST->get<3>() << "\n"; + std::cout << " kOUmap unsigned char = "<< std::get<3>(data_KOKKOS) << " bOUmap unsigned char = " << std::get<3>(*data_BOOST) << "\n"; } - if(!( data_KOKKOS.get<4>() == data_BOOST->get<4>() ) ) + if(!( std::get<4>(data_KOKKOS) == std::get<4>(*data_BOOST) ) ) { // bUOmap_contains_kUOmap = false; std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : Double2 on tuple's do not match between NodeRegistry and KokkosNodeRegistry\n"; - std::cout << " kOUmap Double2 = "<< data_KOKKOS.get<4>() << " bOUmap Double2 = " << data_BOOST->get<4>() << "\n"; + std::cout << " kOUmap Double2 = "<< std::get<4>(data_KOKKOS) << " bOUmap Double2 = " << std::get<4>(*data_BOOST) << "\n"; } } if(!bUOmap_contains_kUOmap) std::cout << "NodeRegistry_KOKKOS::compare_to_boost_NR : key with m_HashCode = " << subDimEntity_KOKKOS.getHash() << " doesn't match anything in kokkos map\n\n"; - for(unsigned iEnt=0;iEnt().m_entity_id_vector.size();iEnt++){ - unsigned ent_val = data_KOKKOS.get<0>().m_entity_id_vector[iEnt]; + for(unsigned iEnt=0;iEnt(data_KOKKOS).m_entity_id_vector.size();iEnt++){ + unsigned ent_val = std::get<0>(data_KOKKOS).m_entity_id_vector[iEnt]; nodesMappedTo.insert(stk::mesh::Entity(ent_val)); } } diff --git a/packages/percept/src/adapt/NodeRegistry_KOKKOS.hpp b/packages/percept/src/adapt/NodeRegistry_KOKKOS.hpp index da6e11bc99ae..8f0d31ac44d7 100644 --- a/packages/percept/src/adapt/NodeRegistry_KOKKOS.hpp +++ b/packages/percept/src/adapt/NodeRegistry_KOKKOS.hpp @@ -45,9 +45,6 @@ #include -#include -#include - #include #include @@ -55,9 +52,6 @@ #define NR_PRINT(a) do { if (DEBUG_PRINT_11) std::cout << #a << " = " << a ; } while(0) #define NR_PRINT_OUT(a,out) do { if (DEBUG_PRINT_11) out << #a << " = " << a << std::endl; } while(0) -/// define only one of these to be 1 -/// current best setting is NODE_REGISTRY_MAP_TYPE_BOOST = 1 - #define STK_ADAPT_NODEREGISTRY_USE_ENTITY_REPO 0 #define STK_ADAPT_NODEREGISTRY_DO_REHASH 1 @@ -83,7 +77,6 @@ /// map of the node ids on a sub-dim entity to the data on the sub-dim entity typedef Kokkos::UnorderedMap, my_fast_equal_to > SubDimCellToDataMap_KOKKOS; - typedef Kokkos::UnorderedMap EntityRepo_KOKKOS; //======================================================================================================================== //======================================================================================================================== @@ -112,7 +105,6 @@ m_useAddNodeSharing(false), m_checkForGhostedNodes(false), m_gee_cnt(0), m_gen_cnt(0), - m_entity_repo(percept::EntityRankEnd), m_debug(false), m_state(NRS_NONE), m_waste_tolerance(waste_tol) @@ -127,7 +119,6 @@ } void init_comm_all(); - void init_entity_repo(); void clear_dangling_nodes(SetOfEntities* nodes_to_be_deleted); void initialize(); @@ -232,8 +223,8 @@ { SubDimCellData& nodeId_elementOwnderId = data; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnderId); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnderId).id(); if (1) std::cout << "put in map: nodeIds_onSE.size= " << (nodeIds_onSE.size()) @@ -412,7 +403,6 @@ public: int m_gee_cnt; int m_gen_cnt; - std::vector m_entity_repo; bool m_debug; diff --git a/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.cpp b/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.cpp index b0f03e6d570c..6b0340b78f06 100644 --- a/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.cpp +++ b/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.cpp @@ -17,8 +17,6 @@ #include #include -#include - #include #include @@ -39,13 +37,11 @@ static double MBTetParametric[] = { 0., 0., 0., 1., 0., 0., 0., 1., 0., # define MB_TESSELLATOR_INCR_SUBCASE_COUNT(cs,sc) #endif // MB_DEBUG_TESSELLATOR -#define PERCEPT_DEBUG 0 - namespace moab { static void error(int i) { - std::string ii = "Percept_MOAB_SimplexTemplateRefiner:: err # "+ boost::lexical_cast(i); + std::string ii = "Percept_MOAB_SimplexTemplateRefiner:: err # "+ std::to_string(i); throw std::logic_error("test"); } @@ -220,9 +216,6 @@ namespace moab { // edge_length2[ei] = 0.; - if (PERCEPT_DEBUG) - std::cout << "tmp PM edge_code= " << edge_code << std::endl; - if ( ! edge_code ) { // No edges to subdivide @@ -279,9 +272,6 @@ namespace moab { int C = SimplexTemplateRefiner::template_index[edge_code][0]; int P = SimplexTemplateRefiner::template_index[edge_code][1]; - if (PERCEPT_DEBUG) - std::cout << "tmp PM C,P= " << C << " " << P << std::endl; - // 1. Permute the tetrahedron into our canonical configuration for ( int i = 0; i < 14; ++ i ) { @@ -1523,8 +1513,6 @@ namespace moab { output_perm.pop(); output_sign.pop(); - if (PERCEPT_DEBUG) - std::cout << "tmp PM case= " << C << " edge_code= " << edge_code << " ntets= " << ntets << std::endl; int t; if ( sgn > 0 ) { @@ -1538,16 +1526,13 @@ namespace moab { permuted_coords[perm[tets[3]]], permuted_tags[perm[tets[3]]], permuted_hash[perm[tets[3]]] ); #endif - TetTupleInt nt = TetTupleInt(permuted_local_ids[perm[tets[0]]], - permuted_local_ids[perm[tets[1]]], - permuted_local_ids[perm[tets[2]]], - permuted_local_ids[perm[tets[3]]]); + TetTupleInt nt = {permuted_local_ids[perm[tets[0]]], + permuted_local_ids[perm[tets[1]]], + permuted_local_ids[perm[tets[2]]], + permuted_local_ids[perm[tets[3]]]}; new_tets.push_back(nt); - if (PERCEPT_DEBUG) - std::cout << "tmp PM new tet= " << nt << std::endl; - tets += 4; } } @@ -1565,17 +1550,14 @@ namespace moab { permuted_coords[perm[tets[3]]], permuted_tags[perm[tets[3]]], permuted_hash[perm[tets[3]]] ); #endif - TetTupleInt nt = TetTupleInt(permuted_local_ids[perm[tets[1]]], - permuted_local_ids[perm[tets[0]]], - permuted_local_ids[perm[tets[2]]], - permuted_local_ids[perm[tets[3]]]); + TetTupleInt nt = {permuted_local_ids[perm[tets[1]]], + permuted_local_ids[perm[tets[0]]], + permuted_local_ids[perm[tets[2]]], + permuted_local_ids[perm[tets[3]]]}; new_tets.push_back(nt); - if (PERCEPT_DEBUG) - std::cout << "tmp PM new tet= " << nt << std::endl; - tets += 4; } } diff --git a/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.hpp b/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.hpp index 83ab805c25a7..9cf7524d7eba 100644 --- a/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.hpp +++ b/packages/percept/src/adapt/Percept_MOAB_SimplexTemplateRefiner.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -26,10 +30,6 @@ * MOAB, a Mesh-Oriented datABase, is a software component for creating, * storing and accessing finite element mesh data. * - * Copyright 2007 Sandia Corporation. Under the terms of Contract - * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government - * retains certain rights in this software. - * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -56,19 +56,11 @@ #include #include -#include -#include - #include -//p #include "EntityRefiner.hpp" -//p #include "SimplexTemplateTagAssigner.hpp" - -//p #include "moab/Types.hpp" // for MB_DLL_EXPORT - namespace moab { - typedef boost::tuple TetTupleInt; + typedef std::array TetTupleInt; //p typedef int EntityHandle; diff --git a/packages/percept/src/adapt/PredicateBasedElementAdapter.hpp b/packages/percept/src/adapt/PredicateBasedElementAdapter.hpp index 175f3ad6eeb3..1611865702c4 100644 --- a/packages/percept/src/adapt/PredicateBasedElementAdapter.hpp +++ b/packages/percept/src/adapt/PredicateBasedElementAdapter.hpp @@ -173,13 +173,9 @@ SubDimCellData* nodeId_elementOwnderId_ptr = getNodeRegistry().getFromMapPtr(subDimEntity); SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); bool is_empty = nodeId_elementOwnderId_ptr == 0; - //bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); if (!is_empty) { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - //unsigned nidsz = nodeIds_onSE.size(); - //for (unsigned i_nid = 0; i_nid < nidsz; i_nid++) - //stk::mesh::Entity edge_node = nodeIds_onSE[0]; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnderId); if (nodeIds_onSE.size()) { unsigned mark = nodeIds_onSE.m_mark; diff --git a/packages/percept/src/adapt/PredicateTemplateAdapter.hpp b/packages/percept/src/adapt/PredicateTemplateAdapter.hpp index 679383bdd66c..a7ccd29193b9 100644 --- a/packages/percept/src/adapt/PredicateTemplateAdapter.hpp +++ b/packages/percept/src/adapt/PredicateTemplateAdapter.hpp @@ -455,13 +455,9 @@ SubDimCellData* nodeId_elementOwnderId_ptr = getNodeRegistry().getFromMapPtr(subDimEntity); SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); bool is_empty = nodeId_elementOwnderId_ptr == 0; - //bool is_not_empty_but_data_cleared = (!is_empty && nodeId_elementOwnderId.get().size() == 0); if (!is_empty) { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - //unsigned nidsz = nodeIds_onSE.size(); - //for (unsigned i_nid = 0; i_nid < nidsz; i_nid++) - //stk::mesh::Entity edge_node = nodeIds_onSE[0]; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnderId); if (nodeIds_onSE.size()) { unsigned mark = nodeIds_onSE.m_mark; diff --git a/packages/percept/src/adapt/RefinementInfoByType.cpp b/packages/percept/src/adapt/RefinementInfoByType.cpp index 7d3ce520e162..2beb57180679 100644 --- a/packages/percept/src/adapt/RefinementInfoByType.cpp +++ b/packages/percept/src/adapt/RefinementInfoByType.cpp @@ -191,7 +191,7 @@ { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnderId); unsigned idx = map_sde_size[subDimEntity.size()]; if (nodeIds_onSE.size()) diff --git a/packages/percept/src/adapt/Refiner.cpp b/packages/percept/src/adapt/Refiner.cpp index de40ee8412a1..7d22b3526cb0 100644 --- a/packages/percept/src/adapt/Refiner.cpp +++ b/packages/percept/src/adapt/Refiner.cpp @@ -628,10 +628,6 @@ { m_nodeRegistry->initialize(); } - else - { - m_nodeRegistry->init_entity_repo(); - } m_nodeRegistry->init_comm_all(); @@ -967,11 +963,6 @@ m_nodeRegistry->prolongate(m_eMesh.get_coordinates_field()); } - { - TIMER2(ProlongFields,DoRefine_); - m_nodeRegistry->prolongateFields(); - } - #if defined(STK_BUILT_IN_SIERRA) if (m_rbar_names.size()) m_nodeRegistry->add_rbars(m_rbar_names); @@ -1012,6 +1003,11 @@ } /***********************/ TRACE_PRINT("Refiner: fix_side_sets_2...done "); + { + TIMER2(ProlongFields,DoRefine_); + m_nodeRegistry->prolongateFields(); // Needed after mod-end so that parts are parallel consistent so that fields are parallel consistent + } + REF_LTRACE("doRefine: fix_side_sets...done"); if (m_doRemove) @@ -1132,8 +1128,6 @@ getRefinementInfo().countCurrentNodes(m_eMesh); getRefinementInfo().full_stats_after_refine(); - getNodeRegistry().init_entity_repo(); - m_nodeRegistry->dumpDB("after doBreak"); doProgressPrint("Stage: [16/16] Rebalance...done, Refinement done."); @@ -1603,8 +1597,8 @@ double tol = 1.e-4; std::string sni = m_eMesh.getProperty("smoother_niter"); std::string snt = m_eMesh.getProperty("smoother_tol"); - if (sni.length()) niter = boost::lexical_cast(sni); - if (snt.length()) tol = boost::lexical_cast(snt); + if (sni.length()) niter = std::stoi(sni); + if (snt.length()) tol = std::stod(snt); if (m_eMesh.getProperty("smoother_type") == "algebraic") { @@ -2709,14 +2703,8 @@ } //std::cout << "tmp Refiner::set_active_part: child_entities= " << child_entities.size() << " parent_entities= " << parent_entities.size() << std::endl; - for (unsigned iv=0; iv < child_entities.size(); iv++) - { - eMesh.get_bulk_data()->change_entity_parts( child_entities[iv], child_parts, parent_parts ); - } - for (unsigned iv=0; iv < parent_entities.size(); iv++) - { - eMesh.get_bulk_data()->change_entity_parts( parent_entities[iv], parent_parts, child_parts ); - } + eMesh.get_bulk_data()->change_entity_parts(child_entities, child_parts, parent_parts); + eMesh.get_bulk_data()->change_entity_parts(parent_entities, parent_parts, child_parts); } } @@ -2866,9 +2854,9 @@ { const SubDimCell_SDCEntityType& subDimEntity = (*cell_iter).first; SubDimCellData& nodeId_elementOwnderId = (*cell_iter).second; - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - stk::mesh::EntityRank owning_elementRank = nodeId_elementOwnderId.get().rank(); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnderId).id(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnderId); + stk::mesh::EntityRank owning_elementRank = std::get(nodeId_elementOwnderId).rank(); if (0 && debug) std::cout << "P[" << m_eMesh.get_rank() << "] tmp srk1 subDimEntity.size= " << subDimEntity.size() << " owning_elementId= " << owning_elementId << " nodeIds_onSE.size= " << nodeIds_onSE.size() << std::endl; // if (subDimEntity.size() == 1) @@ -3035,10 +3023,7 @@ } } } - for (unsigned ii=0; ii < node_vec.size(); ii++) - { - m_eMesh.get_bulk_data()->change_entity_parts( node_vec[ii], add_parts, remove_parts ); - } + m_eMesh.get_bulk_data()->change_entity_parts( node_vec, add_parts, remove_parts ); } void Refiner:: @@ -3244,7 +3229,7 @@ const stk::mesh::EntityRank FAMILY_TREE_RANK = static_cast(m_eMesh.element_rank() + 1u); std::vector ftvec; - stk::mesh::get_selected_entities(m_eMesh.get_fem_meta_data()->locally_owned_part(), m_eMesh.get_bulk_data()->buckets(FAMILY_TREE_RANK), ftvec); + stk::mesh::get_selected_entities(m_eMesh.get_fem_meta_data()->locally_owned_part(), m_eMesh.get_bulk_data()->buckets(FAMILY_TREE_RANK), ftvec, false/*don't sort*/); for (auto ft : ftvec) { delete_ft_nodes(m_eMesh, ft); @@ -3254,7 +3239,7 @@ { SetOfEntities eset(*m_eMesh.get_bulk_data()); std::vector evec; - stk::mesh::get_selected_entities(m_eMesh.get_fem_meta_data()->locally_owned_part() , m_eMesh.get_bulk_data()->buckets(rank_iter), evec); + stk::mesh::get_selected_entities(m_eMesh.get_fem_meta_data()->locally_owned_part() , m_eMesh.get_bulk_data()->buckets(rank_iter), evec, false/*don't sort*/); for (auto elem : evec) { //eset.insert(elem); diff --git a/packages/percept/src/adapt/Refiner.hpp b/packages/percept/src/adapt/Refiner.hpp index 482b2f78f41d..d148739cc646 100644 --- a/packages/percept/src/adapt/Refiner.hpp +++ b/packages/percept/src/adapt/Refiner.hpp @@ -26,9 +26,6 @@ #include #include -#include -#include - #include #include #include diff --git a/packages/percept/src/adapt/RefinerPattern_Hex8_Het_N.hpp b/packages/percept/src/adapt/RefinerPattern_Hex8_Het_N.hpp index f36ac7552426..0d80034b4d46 100644 --- a/packages/percept/src/adapt/RefinerPattern_Hex8_Het_N.hpp +++ b/packages/percept/src/adapt/RefinerPattern_Hex8_Het_N.hpp @@ -279,6 +279,7 @@ namespace percept { << " num_new_elems= " << num_new_elems << std::endl; + std::vector elemNodes(4); for (unsigned ielem=0; ielem < elems_tet.size(); ielem++) { stk::mesh::Entity newElement = *element_pool; @@ -320,9 +321,9 @@ namespace percept { // 4 nodes of the new tets for (unsigned ii=0; ii < 4; ++ii) { - stk::mesh::Entity n0 = eMesh.createOrGetNode(elems_tet[ielem][ii]); - eMesh.get_bulk_data()->declare_relation(newElement, n0, ii); + elemNodes[ii] = eMesh.createOrGetNode(elems_tet[ielem][ii]); } + eMesh.get_bulk_data()->declare_relation(newElement, elemNodes); unsigned nchild = eMesh.numChildren(element); //set_parent_child_relations(eMesh, element, newElement, ielem); @@ -572,6 +573,7 @@ namespace percept { << " num_new_elems= " << num_new_elems << " elems_pyr.size= " << elems_pyr.size() << std::endl; + std::vector elemNodes(5); for (unsigned ielem=0; ielem < elems_pyr.size(); ielem++) { stk::mesh::Entity newElement = *element_pool; @@ -603,9 +605,9 @@ namespace percept { // 5 nodes of the new pyramids for (unsigned ii=0; ii < 5; ++ii) { - stk::mesh::Entity n0 = eMesh.createOrGetNode(elems_pyr[ielem][ii]); - eMesh.get_bulk_data()->declare_relation(newElement, n0, ii); + elemNodes[ii] = eMesh.createOrGetNode(elems_pyr[ielem][ii]); } + eMesh.get_bulk_data()->declare_relation(newElement, elemNodes); unsigned nchild = eMesh.numChildren(element); //set_parent_child_relations(eMesh, element, newElement, ielem); diff --git a/packages/percept/src/adapt/RefinerPattern_Line2_Line2_N.hpp b/packages/percept/src/adapt/RefinerPattern_Line2_Line2_N.hpp index c123632a4db5..5f8f098f29a9 100644 --- a/packages/percept/src/adapt/RefinerPattern_Line2_Line2_N.hpp +++ b/packages/percept/src/adapt/RefinerPattern_Line2_Line2_N.hpp @@ -49,7 +49,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple line_tuple_type; + typedef std::array line_tuple_type; static vector elems(2); CellTopology cell_topo(cell_topo_data); @@ -128,7 +128,7 @@ EN[jNode] = inode; } - elems[iChild] = line_tuple_type(EN[0], EN[1]); + elems[iChild] = {EN[0], EN[1]}; } #undef CENTROID_N @@ -142,7 +142,7 @@ newElement = *element_pool; - stk::mesh::Entity nodes[2] = {eMesh.createOrGetNode(elems[ielem].get<0>()), eMesh.createOrGetNode(elems[ielem].get<1>())}; + stk::mesh::Entity nodes[2] = {eMesh.createOrGetNode(elems[ielem][0]), eMesh.createOrGetNode(elems[ielem][1])}; create_side_element(eMesh, use_declare_element_side, nodes, 2, newElement); #if 0 diff --git a/packages/percept/src/adapt/RefinerPattern_Quad4_Het_N.hpp b/packages/percept/src/adapt/RefinerPattern_Quad4_Het_N.hpp index 92de0aefa444..79b2bf405197 100644 --- a/packages/percept/src/adapt/RefinerPattern_Quad4_Het_N.hpp +++ b/packages/percept/src/adapt/RefinerPattern_Quad4_Het_N.hpp @@ -284,7 +284,7 @@ namespace percept { << " new_sub_entity_nodes[face][0].size= " << new_sub_entity_nodes[m_primaryEntityRank][0].size() << "\n elem= " << elems[ielem] << std::endl; - elems[ielem] = quad_to_tri_tuple_type( Q_CV_EV(elems_local[ielem].get<0>() ), Q_CV_EV(elems_local[ielem].get<1>() ), Q_CV_EV(elems_local[ielem].get<2>() ) ); + elems[ielem] = { Q_CV_EV(elems_local[ielem][0] ), Q_CV_EV(elems_local[ielem][1] ), Q_CV_EV(elems_local[ielem][2] ) }; } if (0) @@ -302,9 +302,9 @@ namespace percept { // 3 nodes of the new tris - stk::mesh::Entity n0 = eMesh.createOrGetNode(elems[ielem].get<0>()); - stk::mesh::Entity n1 = eMesh.createOrGetNode(elems[ielem].get<1>()); - stk::mesh::Entity n2 = eMesh.createOrGetNode(elems[ielem].get<2>()); + stk::mesh::Entity n0 = eMesh.createOrGetNode(elems[ielem][0]); + stk::mesh::Entity n1 = eMesh.createOrGetNode(elems[ielem][1]); + stk::mesh::Entity n2 = eMesh.createOrGetNode(elems[ielem][2]); stk::mesh::Entity nodes[3] = {n0, n1, n2}; @@ -515,7 +515,7 @@ namespace percept { elems.resize(num_new_elems); for (unsigned ielem=0; ielem < num_new_elems; ielem++) { - elems[ielem] = quad_to_quad_tuple_type( Q_CV_EV(elems_local[ielem].get<0>() ), Q_CV_EV(elems_local[ielem].get<1>() ), Q_CV_EV(elems_local[ielem].get<2>() ), Q_CV_EV(elems_local[ielem].get<3>() ) ); + elems[ielem] = { Q_CV_EV(elems_local[ielem][0] ), Q_CV_EV(elems_local[ielem][1] ), Q_CV_EV(elems_local[ielem][2] ), Q_CV_EV(elems_local[ielem][3] ) }; } bool use_declare_element_side = UniformRefinerPatternBase::USE_DECLARE_ELEMENT_SIDE && m_primaryEntityRank == eMesh.side_rank(); @@ -528,10 +528,10 @@ namespace percept { // 4 nodes of the new quads stk::mesh::Entity nodes[4] = { - eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>()), - eMesh.createOrGetNode(elems[ielem].get<3>()) }; + eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2]), + eMesh.createOrGetNode(elems[ielem][3]) }; create_side_element(eMesh, use_declare_element_side, nodes, 4, newElement); diff --git a/packages/percept/src/adapt/RefinerPattern_Tet4_Tet4_N.hpp b/packages/percept/src/adapt/RefinerPattern_Tet4_Tet4_N.hpp index 8cf01256a29b..2f6c461e4fd4 100644 --- a/packages/percept/src/adapt/RefinerPattern_Tet4_Tet4_N.hpp +++ b/packages/percept/src/adapt/RefinerPattern_Tet4_Tet4_N.hpp @@ -100,8 +100,8 @@ //static unsigned tbl_tet_face_nodes[4][3] = { {0, 1, 3}, {1, 2, 3}, {0, 3, 2}, {0, 2, 1} }; //static unsigned tbl_tet_edge_nodes[6][2] = { {0, 1}, {1, 2}, {2, 0}, {0, 3}, {1, 3}, {2, 3} }; - typedef boost::tuple TetTupleTypeLocal; - typedef boost::tuple TetTupleType; + typedef std::array TetTupleTypeLocal; + typedef std::array TetTupleType; /// general refinement pattern @@ -260,13 +260,10 @@ tets.resize(new_tets.size()); for (unsigned i = 0; i < new_tets.size(); i++) { - tets[i] = TetTupleTypeLocal((unsigned)new_tets[i].get<0>(), - (unsigned)new_tets[i].get<1>(), - (unsigned)new_tets[i].get<2>(), - (unsigned)new_tets[i].get<3>() ); - if (0) - std::cout << "tmp RefPatt::createNewElements new tet= " << tets[i] << std::endl; - + tets[i] = {(unsigned)new_tets[i][0], + (unsigned)new_tets[i][1], + (unsigned)new_tets[i][2], + (unsigned)new_tets[i][3]}; } } } @@ -277,9 +274,6 @@ vector::iterator& ft_element_pool, stk::mesh::FieldBase *proc_rank_field=0) { - bool debug = false; - //if (m_eMesh.getProperty("debugRemesh") == "true") debug = true; - const CellTopologyData * const cell_topo_data = eMesh.get_cell_topology(element); static std::vector elems(8); static std::vector elems_local(8); @@ -327,21 +321,12 @@ elems.resize(num_new_elems); for (unsigned ielem=0; ielem < num_new_elems; ielem++) { - elems[ielem] = TetTupleType( TET_CV_EV(elems_local[ielem].get<0>() ), - TET_CV_EV(elems_local[ielem].get<1>() ), - TET_CV_EV(elems_local[ielem].get<2>() ), - TET_CV_EV(elems_local[ielem].get<3>() ) ); - if (debug) - { - std::cout << "tmp RefPatt::createNewElements old tet= " << eMesh.print_entity_compact(element) << "\n new tet= " << elems[ielem] << " elems_local= " << elems_local[ielem] << std::endl; - } - + elems[ielem] = { TET_CV_EV(elems_local[ielem][0] ), + TET_CV_EV(elems_local[ielem][1] ), + TET_CV_EV(elems_local[ielem][2] ), + TET_CV_EV(elems_local[ielem][3] ) }; } - //std::cout << "tmp RefinerPattern_Tet4_Tet4_N::num_edges_marked= " << num_edges_marked << std::endl; - - //nodeRegistry.prolongateCoords(*const_cast(&element), stk::topology::ELEMENT_RANK, 0u); - for (unsigned ielem=0; ielem < elems.size(); ielem++) { stk::mesh::Entity newElement = *element_pool; @@ -365,43 +350,21 @@ { transition_element[0] = 1; } - if (0) - std::cout << "tmp srk found transition_element = " << m_eMesh.identifier(newElement) << " num_edges_marked= " << num_edges_marked - << " val= " << transition_element[0] - << " element= " << m_eMesh.identifier(element) - << std::endl; } - - //eMesh.get_bulk_data()->change_entity_parts( newElement, add_parts, remove_parts ); change_entity_parts(eMesh, element, newElement); - { - if (!elems[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << "] nid = 0 << " << std::endl; - //exit(1); - } - } - // 4 nodes of the new tets - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<2>()), 2); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<3>()), 3); - + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][0]), 0); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][1]), 1); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][2]), 2); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][3]), 3); + set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); std::vector elements(1,element); eMesh.prolongateElementFields( elements, newElement); - if (0) - { - std::cout << "tmp RefPatt::createNewElements eMesh.identifier(element)= " << eMesh.identifier(element) - << " newElement= " << eMesh.identifier(newElement) << std::endl; - - } - ft_element_pool++; element_pool++; diff --git a/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_2.hpp b/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_2.hpp index f05e02e725b9..30a7cb332273 100644 --- a/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_2.hpp +++ b/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_2.hpp @@ -84,7 +84,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tri_tuple_type; + typedef std::array tri_tuple_type; static vector elems(2); shards::CellTopology cell_topo(cell_topo_data); @@ -120,8 +120,8 @@ if (num_nodes_on_edge) { eMesh.createOrGetNode(EDGE_N(iedge), mp); - elems[0] = tri_tuple_type(VERT_N(iedge), EDGE_N(iedge), VERT_N((iedge+2)%3) ); - elems[1] = tri_tuple_type(EDGE_N(iedge), VERT_N((iedge+1)%3), VERT_N((iedge+2)%3) ); + elems[0] = {VERT_N(iedge), EDGE_N(iedge), VERT_N((iedge+2)%3) }; + elems[1] = {EDGE_N(iedge), VERT_N((iedge+1)%3), VERT_N((iedge+2)%3) }; } } @@ -137,9 +137,9 @@ newElement = *element_pool; //std::cout << "tmp newElement id = " << m_eMesh.identifier(newElement) << std::endl; - stk::mesh::Entity nodes[3] = {eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>())}; + stk::mesh::Entity nodes[3] = {eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2])}; create_side_element(eMesh, use_declare_element_side, nodes, 3, newElement); if (proc_rank_field) @@ -151,18 +151,10 @@ eMesh.get_bulk_data()->change_entity_parts( newElement, add_parts, remove_parts ); - { - if (!elems[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << "] nid = 0 << " << std::endl; - //exit(1); - } - } - // 3 nodes of the new tris - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<2>()), 2); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][0]), 0); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][1]), 1); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem][2]), 2); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); diff --git a/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_N.hpp b/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_N.hpp index 60a36c12f200..ba5e8ddf9053 100644 --- a/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_N.hpp +++ b/packages/percept/src/adapt/RefinerPattern_Tri3_Tri3_N.hpp @@ -99,8 +99,8 @@ } const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tri_tuple_type; - typedef boost::tuple tri_tuple_type_int; + typedef std::array tri_tuple_type; + typedef std::array tri_tuple_type_int; static vector elems(4); static vector elems_local(4); unsigned num_new_elems=0; @@ -149,7 +149,7 @@ elems.resize(num_new_elems); for (unsigned ielem=0; ielem < num_new_elems; ielem++) { - elems[ielem] = tri_tuple_type( CV_EV(elems_local[ielem].get<0>() ), CV_EV(elems_local[ielem].get<1>() ), CV_EV(elems_local[ielem].get<2>() ) ); + elems[ielem] = {CV_EV(elems_local[ielem][0] ), CV_EV(elems_local[ielem][1] ), CV_EV(elems_local[ielem][2] )}; } //std::cout << "tmp RefinerPattern_Tri3_Tri3_N::num_edges_marked= " << num_edges_marked << std::endl; @@ -164,9 +164,9 @@ if (!use_declare_element_side) newElement = *element_pool; - stk::mesh::Entity nodes[3] = {eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>()) }; + stk::mesh::Entity nodes[3] = {eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2])}; create_side_element(eMesh, use_declare_element_side, nodes, 3, newElement); diff --git a/packages/percept/src/adapt/RefinerUnrefine.cpp b/packages/percept/src/adapt/RefinerUnrefine.cpp index a4f0c4a02bf4..523f4500ef2e 100644 --- a/packages/percept/src/adapt/RefinerUnrefine.cpp +++ b/packages/percept/src/adapt/RefinerUnrefine.cpp @@ -117,15 +117,15 @@ SubDimCell_SDCEntityType subDimEntity(&m_eMesh); m_nodeRegistry->getSubDimEntity(subDimEntity, element, needed_entity_rank, iSubDimOrd, cell_topo_data); - SubDimCellData* nodeId_elementOwnderId_ptr = m_nodeRegistry->getFromMapPtr(subDimEntity); - if (nodeId_elementOwnderId_ptr) + SubDimCellData* nodeId_elementOwnerId_ptr = m_nodeRegistry->getFromMapPtr(subDimEntity); + if (nodeId_elementOwnerId_ptr) { - nodeId_elementOwnderId_ptr->get() = m_eMesh.entity_key(element); - nodeId_elementOwnderId_ptr->get() = static_cast(iSubDimOrd + 1); - nodeId_elementOwnderId_ptr->get() = static_cast(needed_entity_rank); + std::get(*nodeId_elementOwnerId_ptr) = m_eMesh.entity_key(element); + std::get(*nodeId_elementOwnerId_ptr) = static_cast(iSubDimOrd + 1); + std::get(*nodeId_elementOwnerId_ptr) = static_cast(needed_entity_rank); - map_new[subDimEntity] = *nodeId_elementOwnderId_ptr; + map_new[subDimEntity] = *nodeId_elementOwnerId_ptr; } } @@ -136,7 +136,6 @@ } } } - //std::cout << m_eMesh.rank() << " old size= " << map.size() << " new= " << map_new.size() << std::endl; map = map_new; } @@ -912,10 +911,10 @@ for (SubDimCellToDataMap::iterator cell_iter = cell_2_data_map.begin(); cell_iter != cell_2_data_map.end(); ++cell_iter) { const SubDimCell_SDCEntityType& subDimEntity = (*cell_iter).first; - SubDimCellData& nodeId_elementOwnderId = (*cell_iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - stk::mesh::EntityId owning_elementId = nodeId_elementOwnderId.get().id(); - stk::mesh::EntityRank owning_elementRank = nodeId_elementOwnderId.get().rank(); + SubDimCellData& nodeId_elementOwnerId = (*cell_iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); + stk::mesh::EntityId owning_elementId = std::get(nodeId_elementOwnerId).id(); + stk::mesh::EntityRank owning_elementRank = std::get(nodeId_elementOwnerId).rank(); if (!nodeIds_onSE.size()) continue; diff --git a/packages/percept/src/adapt/RefinerUtil.cpp b/packages/percept/src/adapt/RefinerUtil.cpp index ef34cb4377bb..a7bb98c87c9b 100644 --- a/packages/percept/src/adapt/RefinerUtil.cpp +++ b/packages/percept/src/adapt/RefinerUtil.cpp @@ -21,7 +21,6 @@ #include #include -#include #include namespace percept { @@ -166,8 +165,8 @@ namespace percept { int id_start = 0; int id_end = 0; try { - id_start = boost::lexical_cast(id_string_start); - id_end = boost::lexical_cast(id_string_end); + id_start = std::stoi(id_string_start); + id_end = std::stoi(id_string_end); } catch (std::exception& X) { @@ -195,7 +194,7 @@ namespace percept { for (int id=id_start; id <= id_end; id++) { - new_names += plus_or_minus + (boost::lexical_cast(id)) + mult + (id == id_end ? "" : ","); + new_names += plus_or_minus + std::to_string(id) + mult + (id == id_end ? "" : ","); } if (!last_one) new_names += ","; @@ -915,25 +914,23 @@ namespace percept { for (iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; // tuple storage: SDC_DATA_GLOBAL_NODE_IDS, SDC_DATA_OWNING_ELEMENT_KEY, SDC_DATA_OWNING_SUBDIM_RANK, SDC_DATA_OWNING_SUBDIM_ORDINAL, SDC_DATA_SPACING - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); - stk::mesh::EntityKey owningElementKey = nodeId_elementOwnderId.get(); + stk::mesh::EntityKey owningElementKey = std::get(nodeId_elementOwnerId); stk::mesh::EntityId owningElementId = owningElementKey.id(); (void)owningElementId; stk::mesh::EntityRank owningElementRank = owningElementKey.rank(); //VERIFY_OP_ON(owningElementRank, ==, eMesh.element_rank(), "bad owningElementRank"); - unsigned owningSubDimRank = nodeId_elementOwnderId.get(); - unsigned owningSubDimOrd = nodeId_elementOwnderId.get(); + unsigned owningSubDimRank = std::get(nodeId_elementOwnerId); + unsigned owningSubDimOrd = std::get(nodeId_elementOwnerId); VERIFY_OP_ON(owningSubDimOrd, >, 0, "hmm 2"); --owningSubDimOrd; unsigned owningSubDimSize = subDimEntity.size(); (void)owningSubDimSize; - //Double3 sdcSpacing = nodeId_elementOwnderId.get(); - stk::mesh::Entity owningElement = eMesh.get_bulk_data()->get_entity(owningElementKey.rank(), owningElementKey.id()); if (!eMesh.is_valid(owningElement)) { @@ -1033,15 +1030,15 @@ namespace percept { VERIFY_OP_ON(eMesh.is_valid(subDimEntity[ii]), ==, true, "bad node in rebuild_node_registry"); } static SubDimCellData empty_SubDimCellData; - SubDimCellData* nodeId_elementOwnderId_ptr = nodeRegistry.getFromMapPtr(subDimEntity); - SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); - bool is_empty = nodeId_elementOwnderId_ptr == 0; + SubDimCellData* nodeId_elementOwnerId_ptr = nodeRegistry.getFromMapPtr(subDimEntity); + SubDimCellData& nodeId_elementOwnerId = (nodeId_elementOwnerId_ptr ? *nodeId_elementOwnerId_ptr : empty_SubDimCellData); + bool is_empty = nodeId_elementOwnerId_ptr == 0; if (is_empty) { - SubDimCellData data( NodeIdsOnSubDimEntityType(1, stk::mesh::Entity(), nodeRegistry.NR_MARK_NONE), - owningElementKey, owningSubDimRank, owningSubDimOrd + 1); - NodeIdsOnSubDimEntityType& nid_new = data.get(); + SubDimCellData data { NodeIdsOnSubDimEntityType(1, stk::mesh::Entity(), nodeRegistry.NR_MARK_NONE), + owningElementKey, (unsigned char)owningSubDimRank, (unsigned char)(owningSubDimOrd + 1), {}}; + NodeIdsOnSubDimEntityType& nid_new = std::get(data); nid_new.resize(1); nid_new[0] = node; nid_new.m_entity_id_vector[0] = eMesh.id(node); @@ -1051,7 +1048,7 @@ namespace percept { } else { - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); nodeIds_onSE.push_back(node); nodeIds_onSE.m_entity_id_vector.push_back(eMesh.id(node)); nodeIds_onSE.m_mark = static_cast(node_data[NR_FIELD_MARK]); diff --git a/packages/percept/src/adapt/SerializeNodeRegistry.hpp b/packages/percept/src/adapt/SerializeNodeRegistry.hpp index 9925e162b369..43123ad13519 100644 --- a/packages/percept/src/adapt/SerializeNodeRegistry.hpp +++ b/packages/percept/src/adapt/SerializeNodeRegistry.hpp @@ -16,6 +16,8 @@ #include #include #include +#include +#include #if defined( STK_HAS_MPI ) #include @@ -29,6 +31,7 @@ #include #include +#include #include @@ -41,10 +44,6 @@ #include #include -#include -#include -#include - #define DEBUG_YAML 0 #include @@ -58,6 +57,17 @@ namespace percept { + inline stk::topology find_topology_by_name(const std::string & topologyName) + { + stk::topology t(stk::topology::BEGIN_TOPOLOGY); + for ( ; t < stk::topology::END_TOPOLOGY; ++t) { + if (topologyName == t.name()) { + return t; + } + } + return stk::topology(stk::topology::INVALID_TOPOLOGY); + } + /** in the following, we are looking at one partition, m_iM, of M-partitioned mesh * */ @@ -71,14 +81,14 @@ typedef std::string TopologyName; typedef std::string PartName; typedef std::vector PartSubsets; - typedef boost::tuple PartMapData; + typedef std::tuple PartMapData; typedef std::map PartMap; typedef stk::mesh::EntityId NodeMapKey; typedef int ProcRank; typedef std::vector SharedProcs; typedef SharedProcs NodeMapValue; - typedef boost::unordered_map NodeMap; + typedef std::unordered_map NodeMap; private: PerceptMesh& m_eMesh; @@ -213,12 +223,12 @@ out << YAML::Value; YAML_CHECK(out); out << YAML::Flow; YAML_CHECK(out); out << YAML::BeginSeq; YAML_CHECK(out); - out << iter->second.get<0>(); - out << iter->second.get<1>(); + out << std::get<0>(iter->second); + out << std::get<1>(iter->second); { out << YAML::Flow; YAML_CHECK(out); out << YAML::BeginSeq; YAML_CHECK(out); - PartSubsets subsets = iter->second.get<2>(); + PartSubsets subsets = std::get<2>(iter->second); for (unsigned isub=0; isub < subsets.size(); isub++) { out << subsets[isub]; @@ -239,21 +249,21 @@ for (iter = m_partMap->begin(); iter != m_partMap->end(); ++iter) { PartName part_name = iter->first; - stk::mesh::EntityRank part_rank = iter->second.get<0>(); - TopologyName topo_name = iter->second.get<1>(); + stk::mesh::EntityRank part_rank = std::get<0>(iter->second); + TopologyName topo_name = std::get<1>(iter->second); const stk::mesh::Part* c_part = m_eMesh.get_fem_meta_data()->get_part(part_name); stk::mesh::Part *part = const_cast(c_part); if (!part) { part = &m_eMesh.get_fem_meta_data()->declare_part(part_name, part_rank); stk::io::put_io_part_attribute(*part); - shards::CellTopology topo = m_eMesh.get_fem_meta_data()->get_cell_topology(topo_name); - if (!topo.getCellTopologyData()) + stk::topology topo = find_topology_by_name(topo_name.c_str()); + if (!topo.is_valid()) { std::cout << "bad cell topo SerializeNodeRegistry::declareGlobalParts topo_name= " << topo_name << std::endl; throw std::runtime_error("bad cell topo SerializeNodeRegistry::declareGlobalParts"); } - stk::mesh::set_cell_topology(*part, topo); + stk::mesh::set_topology(*part, topo); } } // once parts are declared, declare part subsets @@ -266,7 +276,7 @@ { throw std::runtime_error(std::string("no part found SerializeNodeRegistry::declareGlobalParts: part= ")+part_name); } - PartSubsets subsets = iter->second.get<2>(); + PartSubsets subsets = std::get<2>(iter->second); for (unsigned isub=0; isub < subsets.size(); isub++) { const stk::mesh::Part* c_subset = m_eMesh.get_fem_meta_data()->get_part(subsets[isub]); @@ -340,9 +350,9 @@ else { PartMapData& pmd_existing = partMap[part_name]; - pmd_existing.get<0>() = rank; - pmd_existing.get<1>() = topo_name; - PartSubsets& subsets_existing = pmd_existing.get<2>(); + std::get<0>(pmd_existing) = rank; + std::get<1>(pmd_existing) = topo_name; + PartSubsets& subsets_existing = std::get<2>(pmd_existing); //std::cout << "pmd read= " << pmd << std::endl; //std::cout << "pmd existing= " << pmd_existing << std::endl; for (unsigned isub=0; isub < subsets.size(); isub++) @@ -605,18 +615,16 @@ { subsets[isub] = part_subsets[isub]->name(); } - PartMapData pmd(part.primary_entity_rank(), topo_name, subsets); + PartMapData pmd {part.primary_entity_rank(), topo_name, subsets}; PartMap::iterator inMap = m_partMap->find(part.name()); // if not yet in the map, or if already in map, choose to overwrite if this is the one with subset info if (inMap == m_partMap->end()) { - if (m_debug) std::cout << "mergeGlobalParts:: not yet in map, part = " << part.name() << " data= " << pmd << std::endl; (*m_partMap)[part.name()] = pmd; } else { - PartSubsets& inMapSubsets = inMap->second.get<2>(); - if (m_debug) std::cout << "mergeGlobalParts:: in map, before, part = " << part.name() << " data= " << pmd << std::endl; + PartSubsets& inMapSubsets = std::get<2>(inMap->second); for (unsigned isub=0; isub < subsets.size(); isub++) { PartSubsets::iterator iv = find(inMapSubsets.begin(), inMapSubsets.end(), subsets[isub]); @@ -625,7 +633,6 @@ inMapSubsets.push_back(subsets[isub]); } } - if (m_debug) std::cout << "mergeGlobalParts:: in map, after, part = " << part.name() << " data= " << pmd << std::endl; } } // init/fini @@ -1037,7 +1044,7 @@ for (iter = localMap.begin(); iter != localMap.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = iter->first; - SubDimCellData& nodeId_elementOwnderId = iter->second; + SubDimCellData& nodeId_elementOwnerId = iter->second; // special case for "interior" subDimEntity's which are centroid nodes for quad or hex elements - // by definition they aren't shared @@ -1045,8 +1052,8 @@ continue; // lookup from global... - SubDimCellData* global_nodeId_elementOwnderId_ptr = globalNR.getFromMapPtr(subDimEntity); - if (!global_nodeId_elementOwnderId_ptr) + SubDimCellData* global_nodeId_elementOwnerId_ptr = globalNR.getFromMapPtr(subDimEntity); + if (!global_nodeId_elementOwnerId_ptr) { std::cout << "M[" << m_iM << "] SerializeNodeRegistry::lookupAndSetNewNodeIds couldn't find subDimEntity= " << subDimEntity; for (unsigned kk=0; kk < subDimEntity.size(); kk++) @@ -1058,10 +1065,10 @@ else { } - VERIFY_OP_ON(global_nodeId_elementOwnderId_ptr, !=, 0, "SerializeNodeRegistry::lookupAndSetNewNodeIds couldn't find subDimEntity"); + VERIFY_OP_ON(global_nodeId_elementOwnerId_ptr, !=, 0, "SerializeNodeRegistry::lookupAndSetNewNodeIds couldn't find subDimEntity"); - NodeIdsOnSubDimEntityType& global_nodeIds_onSE = global_nodeId_elementOwnderId_ptr->get(); - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& global_nodeIds_onSE = std::get(*global_nodeId_elementOwnerId_ptr); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned global_nnodes = global_nodeIds_onSE.size(); unsigned nnodes = nodeIds_onSE.size(); VERIFY_OP_ON(global_nnodes, ==, nnodes, "SerializeNodeRegistry::lookupAndSetNewNodeIds: mismatch in nnodes"); @@ -1139,10 +1146,10 @@ SubDimCell_SDCEntityType key(&eMesh); // subDimEntity = (*iter).first; stk::mesh::EntityId value_nodeId; - SubDimCellData value; // nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = value.get(); + SubDimCellData value; // nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(value); nodeIds_onSE.resize(0); - stk::mesh::EntityKey& value_entity_key = value.get(); + stk::mesh::EntityKey& value_entity_key = std::get(value); for(unsigned ikeyd=0; ikeyd < KEY.size(); ++ikeyd) { key_nodeId = localNR.getMesh().identifier(KEY[ikeyd]); @@ -1160,11 +1167,11 @@ key.insert( node ); } - stk::mesh::EntityRank rank = static_cast((UInt)VALUE.get().rank()); - size_t id = VALUE.get().id(); + stk::mesh::EntityRank rank = static_cast((UInt)std::get(VALUE).rank()); + size_t id = std::get(VALUE).id(); value_entity_key = stk::mesh::EntityKey(rank,id); - NodeIdsOnSubDimEntityType& NODEIDS_ONSE = VALUE.get(); + NodeIdsOnSubDimEntityType& NODEIDS_ONSE = std::get(VALUE); value_nodeId = NODEIDS_ONSE.m_entity_id_vector[0]; nodeIds_onSE.m_entity_id_vector.push_back(value_nodeId); stk::mesh::Entity entity = eMesh.get_bulk_data()->get_entity(stk::topology::NODE_RANK, value_nodeId); @@ -1209,7 +1216,7 @@ for (iter = localMap.begin(); iter != localMap.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; if (m_debug) { std::cout << "SerializeNodeRegistry::processNodeRegistry inserting localMap entry = " << subDimEntity ; @@ -1217,11 +1224,11 @@ { std::cout << " [" << newLocalNR.getMesh().get_bulk_data()->identifier(subDimEntity[kk]) << "] "; } - std::cout << " data= " << nodeId_elementOwnderId << " nid=" << nodeId_elementOwnderId.get().m_entity_id_vector[0] << std::endl; + std::cout << " data= " << nodeId_elementOwnerId << " nid=" << std::get(nodeId_elementOwnerId).m_entity_id_vector[0] << std::endl; } /// clone subDimEntity... - //globalMap[subDimEntity] = nodeId_elementOwnderId; - addKeyValuePair(globalNR, newLocalNR, subDimEntity, nodeId_elementOwnderId); + //globalMap[subDimEntity] = nodeId_elementOwnerId; + addKeyValuePair(globalNR, newLocalNR, subDimEntity, nodeId_elementOwnerId); } if (m_debug) std::cout << "SerializeNodeRegistry::processNodeRegistry globalMap size= " << globalMap.size() << std::endl; stk::mesh::fixup_ghosted_to_shared_nodes(*globalNR.getMesh().get_bulk_data()); @@ -1393,8 +1400,8 @@ for (iter = map.begin(); iter != map.end(); ++iter) { //const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned nnodes = nodeIds_onSE.size(); for (unsigned inode=0; inode < nnodes; inode++) { @@ -1432,8 +1439,8 @@ for (iter = map.begin(); iter != map.end(); ++iter) { //const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned nnodes = nodeIds_onSE.size(); for (unsigned inode=0; inode < nnodes; inode++) { @@ -1463,8 +1470,8 @@ for (iter = map.begin(); iter != map.end(); ++iter) { //const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned nnodes = nodeIds_onSE.size(); for (unsigned inode=0; inode < nnodes; inode++) { @@ -1480,8 +1487,8 @@ for (iter = map.begin(); iter != map.end(); ++iter) { //const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); + SubDimCellData& nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(nodeId_elementOwnerId); unsigned nnodes = nodeIds_onSE.size(); for (unsigned inode=0; inode < nnodes; inode++) { @@ -1524,7 +1531,7 @@ for (iter = map.begin(); iter != map.end(); ++iter) { const SubDimCell_SDCEntityType& subDimEntity = (*iter).first; - SubDimCellData& nodeId_elementOwnderId = (*iter).second; + SubDimCellData& nodeId_elementOwnerId = (*iter).second; // check if all nodes are on the boundary (defined by shared nodes in the NodeMap) if (nodeMapFilter) @@ -1553,7 +1560,7 @@ emitter << YAML::Key; YAML_ERRCHECK; emitter << YAML::Flow; YAML_ERRCHECK; emitter << YAML::BeginSeq; YAML_ERRCHECK; - if (0) emitter << YAML::Anchor(std::string("seq")+boost::lexical_cast(jj++)); YAML_ERRCHECK; + if (0) emitter << YAML::Anchor(std::string("seq")+std::to_string(jj++)); YAML_ERRCHECK; for (unsigned k=0; k < subDimEntity.size(); k++) { //std::cout << " " << subDimEntity[k]->identifier() << " "; @@ -1561,8 +1568,8 @@ } emitter << YAML::EndSeq; YAML_ERRCHECK; - NodeIdsOnSubDimEntityType& nodeIds_onSE = nodeId_elementOwnderId.get(); - stk::mesh::EntityKey& value_entity_key = nodeId_elementOwnderId.get(); + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get( nodeId_elementOwnerId); + stk::mesh::EntityKey& value_entity_key = std::get(nodeId_elementOwnerId); //emitter << YAML::Scalar << nodeIds_onSE.size() emitter << YAML::Value; YAML_ERRCHECK; @@ -1626,11 +1633,10 @@ stk::mesh::EntityId value_tuple_0_quantum; NodeIdsOnSubDimEntityType value_tuple_0; - //typedef boost::tuple SubDimCellData; - SubDimCellData value; // nodeId_elementOwnderId = (*iter).second; - NodeIdsOnSubDimEntityType& nodeIds_onSE = value.get(); + SubDimCellData value; // nodeId_elementOwnerId = (*iter).second; + NodeIdsOnSubDimEntityType& nodeIds_onSE = std::get(value); nodeIds_onSE.resize(0); - stk::mesh::EntityKey& value_entity_key = value.get(); + stk::mesh::EntityKey& value_entity_key = std::get(value); // value = { {new_node0, new_node1,...}:[vector,vector], {elem_own[rank, ele_id]:EntityKey} } // key = { nodePtr_0,... : set } // value.serialized = { {new_nid0, new_nid1,...}:vector, {elem_own[rank, ele_id]:EntityKey} } @@ -1676,15 +1682,14 @@ stk::mesh::EntityKey entityKey(rank,id); if (DEBUG_YAML) std::cout << "s_r value_tuple_1= " << rank << " " << id << std::endl; value_entity_key = stk::mesh::EntityKey(rank,id); - if (DEBUG_YAML) std::cout << "s_r owning element rank= " << value.get().rank() - << " owning element id= " << value.get().id() + if (DEBUG_YAML) std::cout << "s_r owning element rank= " << std::get(value).rank() + << " owning element id= " << std::get(value).id() << std::endl; } else { value_tuple_0_quantum = itv->as(); - //stk::mesh::EntityId owning_elementId = stk::mesh::entity_id(data.get()); nodeIds_onSE.m_entity_id_vector.push_back(value_tuple_0_quantum); stk::mesh::Entity entity = eMesh.get_bulk_data()->get_entity(stk::topology::NODE_RANK, value_tuple_0_quantum); if (!eMesh.is_valid(entity)) diff --git a/packages/percept/src/adapt/SubDimCell.hpp b/packages/percept/src/adapt/SubDimCell.hpp index 243820100d6d..e74a44c692b0 100644 --- a/packages/percept/src/adapt/SubDimCell.hpp +++ b/packages/percept/src/adapt/SubDimCell.hpp @@ -12,118 +12,20 @@ #include #include - -#define STK_ADAPT_SUBDIMCELL_USES_STL_SET 0 -#define STK_ADAPT_SUBDIMCELL_USES_STL_VECTOR 0 -#define STK_ADAPT_SUBDIMCELL_USES_NO_MALLOC_ARRAY 1 - -#if STK_ADAPT_SUBDIMCELL_USES_NO_MALLOC_ARRAY #include -#endif - -#if STK_ADAPT_SUBDIMCELL_USES_BOOST_ARRAY -#include -#endif #include #include #include -#ifdef STK_HAVE_TBB -#include -#endif - - namespace percept { - template struct SubDimCellCompare { bool operator() (T i, T j) { return (i < j) ; } }; - // only set one of these - -#if STK_ADAPT_SUBDIMCELL_USES_STL_SET - -# ifdef STK_HAVE_TBB - typedef std::set, tbb::scalable_allocator > SubDimCellBaseClass; -# else - typedef std::set SubDimCellBaseClass; -# endif - - /// this class represents the set of node id's defining a sub-dimensional entity of an element (like a face or edge) - template > - class SubDimCell : public SubDimCellBaseClass - { - std::size_t m_hash; - public: - //set m_ids; - SubDimCell() : SubDimCellBaseClass(), m_hash(0u) {} - SubDimCell(unsigned num_ids, Ids *ids) : SubDimCellBaseClass(ids, ids+num_ids), m_hash(0u) - { - } - inline unsigned getHash() const - { - return m_hash; - } - inline void setHash(std::size_t hash) - { - m_hash = hash; - } - void clear() - { - m_hash = 0u; - SubDimCellBaseClass::clear(); - } - }; -#endif - -#if STK_ADAPT_SUBDIMCELL_USES_STL_VECTOR - - //typedef array SubDimCell; - - /// We assume we don't have any sub-dimensional entities with more than 4 nodes - template > - class SubDimCell : public std::vector //: public my_array //: public boost::array - { - public: - //typedef boost::array base_type; - typedef std::vector base_type; - - SubDimCell(unsigned n=4) : base_type() { base_type::reserve(n); } - void insert(T val) - { - bool found = false; - for (unsigned i = 0; i < base_type::size(); i++) - { - if (val == (*this)[i]) - { - found = true; - break; - } - } - if (!found) - { - base_type::push_back(val); - std::sort( base_type::begin(), base_type::end(), CompareClass() ); - - } - } - void sort() - { - std::sort( base_type::begin(), base_type::end(), CompareClass() ); - } - }; -#endif - -#if STK_ADAPT_SUBDIMCELL_USES_NO_MALLOC_ARRAY - - //typedef array SubDimCell; - - - template class SDCHashCode { @@ -149,9 +51,6 @@ //repo always init to 0 size: SubDimCell(unsigned n=4) : base_type(n), m_hash(0u) {} SubDimCell() : base_type(), m_hash(0u), m_HashCode(), m_CompareClass() {} SubDimCell(unsigned n) : base_type(), m_hash(0u), m_HashCode(), m_CompareClass() {} -#if 0 - SubDimCell(const SubDimCell& sdc) : base_type(sdc), m_hash(sdc.m_hash) {} -#endif // behaves like std::set void insert(T val) { @@ -166,25 +65,15 @@ } if (!found) { - //if (size() > max_size() ) throw std::runtime_error("SubDimCell out of range"); base_type::insert(val); sort(); } - //m_hash = hashCode(); updateHashCode(); } void sort() { -#ifdef __GNUC__ -#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 4) - std::stable_sort( base_type::begin(), base_type::end(), m_CompareClass ); -#else - std::sort( base_type::begin(), base_type::end(), m_CompareClass ); -#endif -#else - std::sort( base_type::begin(), base_type::end(), m_CompareClass ); -#endif + std::sort( base_type::begin(), base_type::end(), m_CompareClass ); } void updateHashCode() @@ -227,14 +116,11 @@ for (typename base_type::iterator i = sdc.begin(); i != sdc.end(); i++) { - //sum += static_cast(const_cast(*i)); - //sum += static_cast((*i)->identifier()); sum += (size_t)(*i); } return sum; } - template inline bool SubDimCell:: operator==(const VAL& rhs) const @@ -268,30 +154,8 @@ return false; } - -#endif - -#if 1 - -#define DATA #define GET(x,i) x[i] - template - struct SubDimCell_compare - { - bool operator() (const SubDimCell& lhs, const SubDimCell& rhs) const - { - if (lhs.size() < rhs.size()) return true; - if (lhs.size() > rhs.size()) return false; - for (unsigned i = 0; i < lhs.size(); i++) - { - if (GET(lhs,i) < GET(rhs,i)) return true; - if (GET(lhs,i) > GET(rhs,i)) return false; - } - return false; - } - }; - template struct my_hash : public std::unary_function< SubDimCell, std::size_t> { @@ -375,40 +239,6 @@ } }; - template - struct my_hash_old : public std::unary_function< SubDimCell , std::size_t> - { - typedef SubDimCell _Tp ; - - inline std::size_t - operator()(const _Tp& x) const - { - std::size_t sum = 0; - for (unsigned i = 0; i < x.size(); i++) - { - sum += static_cast(GET(x,i)); - } - return sum; - } - }; - - template - struct my_equal_to_old : public std::binary_function< SubDimCell, SubDimCell, bool> - { - typedef SubDimCell _Tp ; - bool - operator()(const _Tp& x, const _Tp& y) const - { - if (x.size() != y.size()) return false; - for (unsigned i = 0; i < x.size(); i++) - { - if (GET(x,i) != GET(y,i)) return false; - } - return true; - } - }; - - template std::ostream& operator<<(std::ostream& out, const SubDimCell& c) { @@ -426,19 +256,8 @@ return out; } -// template -// std::ostringstream& operator<< (std::ostringstream& out, SubDimCell& c) -// { -// out << t; -// return out; -// } - -#undef DATA #undef GET -#endif - - } #endif diff --git a/packages/percept/src/adapt/SubDimCell_KOKKOS.hpp b/packages/percept/src/adapt/SubDimCell_KOKKOS.hpp index 4e7fa65ad4eb..9dc099ce8166 100644 --- a/packages/percept/src/adapt/SubDimCell_KOKKOS.hpp +++ b/packages/percept/src/adapt/SubDimCell_KOKKOS.hpp @@ -29,11 +29,6 @@ #include #include -#ifdef STK_HAVE_TBB -#include -#endif - - namespace percept { @@ -47,11 +42,7 @@ #if STK_ADAPT_SUBDIMCELL_KOKKOS_USES_STL_SET -# ifdef STK_HAVE_TBB - typedef std::set, tbb::scalable_allocator > SubDimCell_KOKKOSBaseClass; -# else typedef std::set SubDimCell_KOKKOSBaseClass; -# endif /// this class represents the set of node id's defining a sub-dimensional entity of an element (like a face or edge) template > @@ -86,10 +77,10 @@ /// We assume we don't have any sub-dimensional entities with more than 4 nodes template > - class SubDimCell_KOKKOS : public std::vector //: public my_array //: public boost::array + class SubDimCell_KOKKOS : public std::vector //: public my_array //: public std::array { public: - //typedef boost::array base_type; + //typedef std::array base_type; typedef std::vector base_type; SubDimCell_KOKKOS(unsigned n=4) : base_type() { base_type::reserve(n); } diff --git a/packages/percept/src/adapt/TransitionElementAdapter.hpp b/packages/percept/src/adapt/TransitionElementAdapter.hpp index 110049981260..4ed706754a81 100644 --- a/packages/percept/src/adapt/TransitionElementAdapter.hpp +++ b/packages/percept/src/adapt/TransitionElementAdapter.hpp @@ -1206,7 +1206,7 @@ SubDimCellData* nodeId_elementOwnderId_ptr = Base::getNodeRegistry().getFromMapPtr(subDimEntity); SubDimCellData& nodeId_elementOwnderId = (nodeId_elementOwnderId_ptr ? *nodeId_elementOwnderId_ptr : empty_SubDimCellData); bool is_empty = nodeId_elementOwnderId_ptr == 0; - bool is_marked = (!is_empty && nodeId_elementOwnderId.get().size() != 0); + bool is_marked = (!is_empty && std::get(nodeId_elementOwnderId).size() != 0); if (is_marked) throw std::runtime_error("bad mark in checkTransitionElements1"); } diff --git a/packages/percept/src/adapt/TriangulateQuad.hpp b/packages/percept/src/adapt/TriangulateQuad.hpp index 44cf90801543..c3988bb2f064 100644 --- a/packages/percept/src/adapt/TriangulateQuad.hpp +++ b/packages/percept/src/adapt/TriangulateQuad.hpp @@ -15,11 +15,11 @@ namespace percept { - typedef boost::tuple quad_to_tri_tuple_type_local; - typedef boost::tuple quad_to_tri_tuple_type; + typedef std::array quad_to_tri_tuple_type_local; + typedef std::array quad_to_tri_tuple_type; - typedef boost::tuple quad_to_quad_tuple_type_local; - typedef boost::tuple quad_to_quad_tuple_type; + typedef std::array quad_to_quad_tuple_type_local; + typedef std::array quad_to_quad_tuple_type; /** * @@ -101,7 +101,7 @@ namespace percept { //unsigned i1 = (iedge+1) % 4; unsigned jedge = iedge + 4; unsigned kedge = (iedge + 3) % 4 + 4; - elems_quad.push_back(quad_to_quad_tuple_type_local(i0, jedge, Q_CENTROID_N, kedge)); + elems_quad.push_back({i0, jedge, Q_CENTROID_N, kedge}); } return; } @@ -149,12 +149,12 @@ namespace percept { unsigned jedge = iedge + 4; if (edge_marks[iedge]) { - elems.push_back(quad_to_tri_tuple_type_local(i0, jedge, Q_CENTROID_N)); - elems.push_back(quad_to_tri_tuple_type_local(jedge, i1, Q_CENTROID_N)); + elems.push_back({i0, jedge, Q_CENTROID_N}); + elems.push_back({jedge, i1, Q_CENTROID_N}); } else { - elems.push_back(quad_to_tri_tuple_type_local(i0, i1, Q_CENTROID_N)); + elems.push_back({i0, i1, Q_CENTROID_N}); } } } @@ -193,9 +193,9 @@ namespace percept { unsigned i2 = (iedge+2) % 4; unsigned i3 = (iedge+3) % 4; unsigned jedge = iedge + 4; - elems.push_back(quad_to_tri_tuple_type_local(i0, jedge, i3)); - elems.push_back(quad_to_tri_tuple_type_local(jedge, i2, i3)); - elems.push_back(quad_to_tri_tuple_type_local(jedge, i1, i2)); + elems.push_back({i0, jedge, i3}); + elems.push_back({jedge, i2, i3}); + elems.push_back({jedge, i1, i2}); } else if (num_edges_marked == 2) { @@ -246,10 +246,10 @@ namespace percept { if (m_avoid_centroid_node) { - elems.push_back(quad_to_tri_tuple_type_local(i0, jedge0, i3)); - elems.push_back(quad_to_tri_tuple_type_local(jedge0, i1, jedge1)); - elems.push_back(quad_to_tri_tuple_type_local(jedge1, i2, i3)); - elems.push_back(quad_to_tri_tuple_type_local(jedge0, jedge1, i3)); + elems.push_back({i0, jedge0, i3}); + elems.push_back({jedge0, i1, jedge1}); + elems.push_back({jedge1, i2, i3}); + elems.push_back({jedge0, jedge1, i3}); } else { @@ -266,9 +266,9 @@ namespace percept { * o-------*-------o * i0 i0+4 i1 */ - elems_quad.push_back(quad_to_quad_tuple_type_local(i0, jedge0, Q_CENTROID_N, i3)); - elems_quad.push_back(quad_to_quad_tuple_type_local(jedge0, i1, jedge1, Q_CENTROID_N)); - elems_quad.push_back(quad_to_quad_tuple_type_local(jedge1, i2, i3, Q_CENTROID_N)); + elems_quad.push_back({i0, jedge0, Q_CENTROID_N, i3}); + elems_quad.push_back({jedge0, i1, jedge1, Q_CENTROID_N}); + elems_quad.push_back({jedge1, i2, i3, Q_CENTROID_N}); } } else @@ -288,8 +288,8 @@ namespace percept { * i0 i0+4 i1 */ - elems_quad.push_back(quad_to_quad_tuple_type_local(i0, jedge0, jedge1, i3)); - elems_quad.push_back(quad_to_quad_tuple_type_local(jedge0, i1, i2, jedge1)); + elems_quad.push_back({i0, jedge0, jedge1, i3}); + elems_quad.push_back({jedge0, i1, i2, jedge1}); } } else if (num_edges_marked == 3) @@ -330,10 +330,10 @@ namespace percept { unsigned jedge1 = iedge1 + 4; unsigned jedge2 = iedge2 + 4; - elems_quad.push_back(quad_to_quad_tuple_type_local(i0, jedge0, jedge2, i3)); - elems.push_back(quad_to_tri_tuple_type_local(jedge0, i1, jedge1)); - elems.push_back(quad_to_tri_tuple_type_local(jedge0, jedge1, jedge2)); - elems.push_back(quad_to_tri_tuple_type_local(jedge1, i2, jedge2)); + elems_quad.push_back({i0, jedge0, jedge2, i3}); + elems.push_back({jedge0, i1, jedge1}); + elems.push_back({jedge0, jedge1, jedge2}); + elems.push_back({jedge1, i2, jedge2}); } else if (num_edges_marked == 4) { @@ -368,13 +368,13 @@ namespace percept { unsigned jedge2 = iedge2 + 4; unsigned jedge3 = iedge3 + 4; - elems.push_back(quad_to_tri_tuple_type_local(jedge0, i1, jedge1)); - elems.push_back(quad_to_tri_tuple_type_local(jedge0, jedge1, jedge2)); - elems.push_back(quad_to_tri_tuple_type_local(jedge1, i2, jedge2)); + elems.push_back({jedge0, i1, jedge1}); + elems.push_back({jedge0, jedge1, jedge2}); + elems.push_back({jedge1, i2, jedge2}); - elems.push_back(quad_to_tri_tuple_type_local(jedge2, i3, jedge3)); - elems.push_back(quad_to_tri_tuple_type_local(jedge0, jedge2, jedge3)); - elems.push_back(quad_to_tri_tuple_type_local(i0, jedge0, jedge3)); + elems.push_back({jedge2, i3, jedge3}); + elems.push_back({jedge0, jedge2, jedge3}); + elems.push_back({i0, jedge0, jedge3}); } } diff --git a/packages/percept/src/adapt/TriangulateTri.hpp b/packages/percept/src/adapt/TriangulateTri.hpp index 8a648dc410b4..801ac1ca4d24 100644 --- a/packages/percept/src/adapt/TriangulateTri.hpp +++ b/packages/percept/src/adapt/TriangulateTri.hpp @@ -18,8 +18,8 @@ namespace percept { class TriangulateTri { public: - typedef boost::tuple tri_tuple_type_local; - typedef boost::tuple tri_tuple_type; + typedef std::array tri_tuple_type_local; + typedef std::array tri_tuple_type; /** * @@ -75,10 +75,10 @@ namespace percept { { elems.resize(4); - elems[0] = tri_tuple_type( T_VERT_N(0), T_EDGE_N(0), T_EDGE_N(2) ); - elems[1] = tri_tuple_type( T_VERT_N(1), T_EDGE_N(1), T_EDGE_N(0) ); - elems[2] = tri_tuple_type( T_VERT_N(2), T_EDGE_N(2), T_EDGE_N(1) ); - elems[3] = tri_tuple_type( T_EDGE_N(0), T_EDGE_N(1), T_EDGE_N(2) ); + elems[0] = { T_VERT_N(0), T_EDGE_N(0), T_EDGE_N(2) }; + elems[1] = { T_VERT_N(1), T_EDGE_N(1), T_EDGE_N(0) }; + elems[2] = { T_VERT_N(2), T_EDGE_N(2), T_EDGE_N(1) }; + elems[3] = { T_EDGE_N(0), T_EDGE_N(1), T_EDGE_N(2) }; } else if (num_edges_marked == 2) { @@ -207,15 +207,15 @@ namespace percept { int jedgep = (jedge+1)%3; if (jedge_max_edge == jedge) { - elems[0] = tri_tuple_type( T_VERT_N(i0), T_EDGE_N(jedge), T_VERT_N(i2) ); - elems[1] = tri_tuple_type( T_EDGE_N(jedge), T_EDGE_N( jedgep ), T_VERT_N(i2) ); - elems[2] = tri_tuple_type( T_EDGE_N(jedge), T_VERT_N(i1), T_EDGE_N( jedgep ) ); + elems[0] = { T_VERT_N(i0), T_EDGE_N(jedge), T_VERT_N(i2) }; + elems[1] = { T_EDGE_N(jedge), T_EDGE_N( jedgep ), T_VERT_N(i2) }; + elems[2] = { T_EDGE_N(jedge), T_VERT_N(i1), T_EDGE_N( jedgep ) }; } else { - elems[0] = tri_tuple_type( T_VERT_N(i0), T_EDGE_N(jedge), T_EDGE_N( jedgep ) ); - elems[1] = tri_tuple_type( T_VERT_N(i0), T_EDGE_N( jedgep ), T_VERT_N(i2) ); - elems[2] = tri_tuple_type( T_EDGE_N(jedge), T_VERT_N(i1), T_EDGE_N( jedgep ) ); + elems[0] = { T_VERT_N(i0), T_EDGE_N(jedge), T_EDGE_N( jedgep ) }; + elems[1] = { T_VERT_N(i0), T_EDGE_N( jedgep ), T_VERT_N(i2) }; + elems[2] = { T_EDGE_N(jedge), T_VERT_N(i1), T_EDGE_N( jedgep ) }; } } else if (num_edges_marked == 1) @@ -226,8 +226,8 @@ namespace percept { unsigned num_nodes_on_edge = edge_marks[iedge]; if (num_nodes_on_edge) { - elems[0] = tri_tuple_type(T_VERT_N(iedge), T_EDGE_N(iedge), T_VERT_N((iedge+2)%3) ); - elems[1] = tri_tuple_type(T_EDGE_N(iedge), T_VERT_N((iedge+1)%3), T_VERT_N((iedge+2)%3) ); + elems[0] = {T_VERT_N(iedge), T_EDGE_N(iedge), T_VERT_N((iedge+2)%3) }; + elems[1] = {T_EDGE_N(iedge), T_VERT_N((iedge+1)%3), T_VERT_N((iedge+2)%3) }; break; } } @@ -239,7 +239,7 @@ namespace percept { { // this allows each level to be at the same hierarchical level by having a single parent to single child elems.resize(1); - elems[0] = tri_tuple_type(T_VERT_N(0), T_VERT_N(1), T_VERT_N(2) ); + elems[0] = {T_VERT_N(0), T_VERT_N(1), T_VERT_N(2) }; } #else if (elems.size() != 0) diff --git a/packages/percept/src/adapt/UniformRefinerPattern.cpp b/packages/percept/src/adapt/UniformRefinerPattern.cpp index 1bd6a2165ea6..3801225c467a 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern.cpp +++ b/packages/percept/src/adapt/UniformRefinerPattern.cpp @@ -283,7 +283,7 @@ //family_tree = parent_to_family_tree_relations[FAMILY_TREE_LEVEL_1].entity(); // EXPLANATION: stk_mesh inserts back-relations in front of existing relations (it uses the std::vector::insert method) - // FIXME - need a unit test to check if this ever breaks in the future (i.e. going to boost::mesh) + // FIXME - need a unit test to check if this ever breaks in the future //family_tree = parent_to_family_tree_relations[FAMILY_TREE_LEVEL_0].entity(); unsigned parent_elem_ft_level_1 = eMesh.getFamilyTreeRelationIndex(FAMILY_TREE_LEVEL_1, parent_elem); @@ -568,27 +568,69 @@ void UniformRefinerPatternBase::updateSurfaceBlockMap(percept::PerceptMesh& eMesh, stk::mesh::Part* part, stk::mesh::Part* part_to) { - std::vector surfaces = - eMesh.get_fem_meta_data()->get_surfaces_in_surface_to_block_map(); + std::vector surfaces = eMesh.get_fem_meta_data()->get_surfaces_in_surface_to_block_map(); // case 1: part/part_to are blocks if ( part->primary_entity_rank() == stk::topology::ELEMENT_RANK && part_to->primary_entity_rank() == stk::topology::ELEMENT_RANK) + { + // Add the refined block to all of the mappings that already contain the parent block + for (auto iter = surfaces.begin(); iter != surfaces.end(); ++iter) { - for (auto iter = surfaces.begin(); iter != surfaces.end(); ++iter) + const stk::mesh::Part * surface = *iter; + std::vector blocks = eMesh.get_fem_meta_data()->get_blocks_touching_surface(surface); + const bool parentBlockInMapping = (find(blocks.begin(), blocks.end(), part) != blocks.end()); + if (parentBlockInMapping) + { + const bool blockNotAlreadyInMapping = (find(blocks.begin(), blocks.end(), part_to) == blocks.end()); + if (blockNotAlreadyInMapping) { - const stk::mesh::Part * surface = *iter; - std::vector blocks = - eMesh.get_fem_meta_data()->get_blocks_touching_surface(surface); - if (find(blocks.begin(), blocks.end(), part) != blocks.end()) + std::vector new_blocks = blocks; + new_blocks.push_back(part_to); + eMesh.get_fem_meta_data()->set_surface_to_block_mapping(surface, new_blocks); + } + } + } + + if (part->topology() != part_to->topology()) { + // If the element topology changes upon refinement, also map the refined block to all + // surface parts of the appropriate topology that are also subsets of surfaces + // that are mapped to the "parent" block. We have to cascade the surface/block + // mappings down through all topology changes while respecting the original + // surface/block mapping. + + std::set faceTopologies; + for (unsigned i = 0; i < part_to->topology().num_faces(); ++i) + { + faceTopologies.insert(part_to->topology().face_topology(i)); + } + + for (const stk::mesh::Part * surface : surfaces) + { + std::vector blocks = eMesh.get_fem_meta_data()->get_blocks_touching_surface(surface); + const bool parentBlockInMapping = find(blocks.begin(), blocks.end(), part) != blocks.end(); + if (parentBlockInMapping) + { + for (const stk::mesh::Part * subsetSurface : surfaces) + { + const stk::mesh::PartVector supersetSurfaces = subsetSurface->supersets(); + const bool isSubsetOfAParentBlockSurface = (std::find(supersetSurfaces.begin(), supersetSurfaces.end(), surface) != supersetSurfaces.end()); + const bool subsetSurfaceTopologyMatchesBlock = (std::find(faceTopologies.begin(), faceTopologies.end(), subsetSurface->topology()) != faceTopologies.end()); + if (isSubsetOfAParentBlockSurface && subsetSurfaceTopologyMatchesBlock) { - std::vector new_blocks = blocks; - if (find(new_blocks.begin(), new_blocks.end(), part_to) == new_blocks.end()) - new_blocks.push_back(part_to); - eMesh.get_fem_meta_data()->set_surface_to_block_mapping(surface, new_blocks); + std::vector subsetSurfaceBlocks = eMesh.get_fem_meta_data()->get_blocks_touching_surface(subsetSurface); + const bool blockNotAlreadyInMapping = (find(subsetSurfaceBlocks.begin(), subsetSurfaceBlocks.end(), part_to) == subsetSurfaceBlocks.end()); + if (blockNotAlreadyInMapping) + { + subsetSurfaceBlocks.push_back(part_to); + eMesh.get_fem_meta_data()->set_surface_to_block_mapping(subsetSurface, subsetSurfaceBlocks); + } } + } } + } } + } // case 2: part/part_to are surfaces if (part->primary_entity_rank() == eMesh.get_fem_meta_data()->side_rank() && @@ -618,106 +660,114 @@ void UniformRefinerPatternBase::setNeededParts(percept::PerceptMesh& eMesh, BlockNamesType block_names_ranks, bool sameTopology, bool skipConvertedParts) { - EXCEPTWATCH; + EXCEPTWATCH; - if (DEBUG_SET_NEEDED_PARTS) - std::cout << "\n\n ============= setNeededParts start \n\n " << PerceptMesh::demangle(typeid(*this).name()) << std::endl; + if (DEBUG_SET_NEEDED_PARTS) + std::cout << "\n\n ============= setNeededParts start \n\n " << PerceptMesh::demangle(typeid(*this).name()) << std::endl; - addRefineNewNodesPart(eMesh); + addRefineNewNodesPart(eMesh); - addActiveParentParts(eMesh); + addActiveParentParts(eMesh); - if (block_names_ranks.size() == 0) - { - block_names_ranks.resize(percept::EntityRankEnd); - } + if (block_names_ranks.size() == 0) + { + block_names_ranks.resize(percept::EntityRankEnd); + } - m_fromParts.resize(0); - m_toParts.resize(0); + m_fromParts.resize(0); + m_toParts.resize(0); - setNeededParts_debug1(eMesh); + setNeededParts_debug1(eMesh); - std::vector& block_names_include = block_names_ranks[m_primaryEntityRank]; + std::vector& block_names_include = block_names_ranks[m_primaryEntityRank]; - stk::mesh::PartVector all_parts = eMesh.get_fem_meta_data()->get_parts(); + stk::mesh::PartVector all_parts = eMesh.get_fem_meta_data()->get_parts(); - bool found_include_only_block = foundIncludeOnlyBlock(eMesh, block_names_include); + bool found_include_only_block = foundIncludeOnlyBlock(eMesh, block_names_include); - for (stk::mesh::PartVector::iterator i_part = all_parts.begin(); i_part != all_parts.end(); ++i_part) - { - stk::mesh::Part * part = *i_part ; + for (stk::mesh::PartVector::iterator i_part = all_parts.begin(); i_part != all_parts.end(); ++i_part) + { + stk::mesh::Part * part = *i_part ; - if ( stk::mesh::is_auto_declared_part(*part) ) - continue; - bool is_auto_part = part->attribute() != 0; - if (is_auto_part) - continue; + if ( stk::mesh::is_auto_declared_part(*part) ) + continue; + bool is_auto_part = part->attribute() != 0; + if (is_auto_part) + continue; - bool doThisPart = shouldDoThisPart(eMesh, block_names_ranks, - found_include_only_block, block_names_include, part); + bool doThisPart = shouldDoThisPart(eMesh, block_names_ranks, + found_include_only_block, block_names_include, part); - if (!doThisPart) continue; + if (!doThisPart) continue; - stk::mesh::EntityRank switch_part_primary_entity_rank = part->primary_entity_rank() ; + stk::mesh::EntityRank switch_part_primary_entity_rank = part->primary_entity_rank() ; - if (switch_part_primary_entity_rank == eMesh.edge_rank() || - switch_part_primary_entity_rank == stk::topology::ELEMENT_RANK || - switch_part_primary_entity_rank == eMesh.face_rank()) - { - stk::mesh::Part * block_to=0; - if (sameTopology) - { - block_to = part; - } - else - { - std::string toTopoPartName = getToTopoPartName(); - if (REMOVE_UNDERSCORE_FROM_TOPO_NAME) Util::replace(toTopoPartName,"_",""); - std::string newPartName = part->name() + getConvertSeparatorString() + toTopoPartName + getConvertSeparatorString() + getAppendConvertString(); - block_to = &eMesh.get_fem_meta_data()->declare_part(newPartName, part->primary_entity_rank()); - if (DEBUG_SET_NEEDED_PARTS) std::cout << "tmp setNeededParts:: declare_part name= " << newPartName - << " with topo= " << getToTopoPartName() << std::endl; - stk::mesh::set_cell_topology(*block_to, shards::CellTopology(getToTopology())); - - if (block_to->attribute() == 0) { - stk::io::put_io_part_attribute(*block_to); - } - - addDistributionFactorToNewPart(*eMesh.get_fem_meta_data(), part, block_to); - - updateSurfaceBlockMap(eMesh, part, block_to); - - stk::mesh::PartVector *pv = const_cast(part->attribute()); - if (pv == 0) - { - pv = new stk::mesh::PartVector; - eMesh.get_fem_meta_data()->declare_attribute_with_delete(*part, pv); - } - pv->push_back(block_to); - if (DEBUG_SET_NEEDED_PARTS) - { - for (unsigned ii=0; ii < pv->size(); ii++) - { - std::cout << "tmp srk part.attr = " << part->name() << " block_to= " << (*pv)[ii]->name() << std::endl; - } - } - } + if (switch_part_primary_entity_rank == eMesh.edge_rank() || + switch_part_primary_entity_rank == stk::topology::ELEMENT_RANK || + switch_part_primary_entity_rank == eMesh.face_rank()) + { + stk::mesh::Part * block_to=0; + if (sameTopology) + { + block_to = part; + } + else + { + std::string toTopoPartName = getToTopoPartName(); + if (REMOVE_UNDERSCORE_FROM_TOPO_NAME) Util::replace(toTopoPartName,"_",""); + std::string newPartName = part->name() + getConvertSeparatorString() + toTopoPartName + getConvertSeparatorString() + getAppendConvertString(); + block_to = &eMesh.get_fem_meta_data()->declare_part(newPartName, part->primary_entity_rank()); + if (DEBUG_SET_NEEDED_PARTS) std::cout << "tmp setNeededParts:: declare_part name= " << newPartName + << " with topo= " << getToTopoPartName() << std::endl; + stk::mesh::set_topology(*block_to, stk::mesh::get_topology(shards::CellTopology(getToTopology()), eMesh.get_fem_meta_data()->spatial_dimension())); + + if (block_to->attribute() == 0) { + stk::io::put_io_part_attribute(*block_to); + } - if (!((part->name()).find(UniformRefinerPatternBase::getOldElementsPartName()) != std::string::npos)) - { - if (DEBUG_SET_NEEDED_PARTS) std::cout << "tmp setNeededParts:: fromPart = " << part->name() << " toPart = " << block_to->name() << std::endl; - m_fromParts.push_back(part); - m_toParts.push_back(block_to); - } - } - } + addDistributionFactorToNewPart(*eMesh.get_fem_meta_data(), part, block_to); + + updateSurfaceBlockMap(eMesh, part, block_to); + + if (switch_part_primary_entity_rank == stk::topology::ELEMENT_RANK) { + // Add the new surface parts needed by topology change upon refinement and make + // another pass at updating the surface to block mapping for these new parts + fixSubsets(eMesh); + addExtraSurfaceParts(eMesh); + updateSurfaceBlockMap(eMesh, part, block_to); + } + + stk::mesh::PartVector *pv = const_cast(part->attribute()); + if (pv == 0) + { + pv = new stk::mesh::PartVector; + eMesh.get_fem_meta_data()->declare_attribute_with_delete(*part, pv); + } + pv->push_back(block_to); + if (DEBUG_SET_NEEDED_PARTS) + { + for (unsigned ii=0; ii < pv->size(); ii++) + { + std::cout << "tmp srk part.attr = " << part->name() << " block_to= " << (*pv)[ii]->name() << std::endl; + } + } + } + + if (!((part->name()).find(UniformRefinerPatternBase::getOldElementsPartName()) != std::string::npos)) + { + if (DEBUG_SET_NEEDED_PARTS) std::cout << "tmp setNeededParts:: fromPart = " << part->name() << " toPart = " << block_to->name() << std::endl; + m_fromParts.push_back(part); + m_toParts.push_back(block_to); + } + } + } - if (!sameTopology) fixSubsets(eMesh); - addExtraSurfaceParts(eMesh); + if (!sameTopology) fixSubsets(eMesh); + addExtraSurfaceParts(eMesh); - addOldPart(eMesh); + addOldPart(eMesh); - setNeededParts_debug2(); + setNeededParts_debug2(); } #define DEBUG_fixSubSets 0 @@ -1612,7 +1662,7 @@ } if (!ctopo) { - stk::mesh::Part& root_part = eMesh.get_fem_meta_data()->get_cell_topology_root_part(getToTopology()); + stk::mesh::Part& root_part = eMesh.get_fem_meta_data()->get_topology_root_part(stk::mesh::get_topology(getToTopology(), eMesh.get_fem_meta_data()->spatial_dimension())); add_parts.push_back( &root_part); } eMesh.get_bulk_data()->change_entity_parts( newElement, add_parts, remove_parts ); diff --git a/packages/percept/src/adapt/UniformRefinerPattern.hpp b/packages/percept/src/adapt/UniformRefinerPattern.hpp index b304e2dd4037..d39d780a80a8 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern.hpp @@ -24,8 +24,6 @@ #include "Teuchos_RCP.hpp" #include -#include -#include #include @@ -38,10 +36,6 @@ #include #include #include -#include - -#include - #include #include @@ -482,16 +476,12 @@ virtual std::string getName() { return std::string("UniformRefinerPattern_")+getFromTopoPartName()+"_"+getToTopoPartName(); } - // draw - /// draw a picture of the element's topology and its refinement pattern (using the "dot" program from AT&T's graphviz program) - static std::string draw(bool showRefined = false, bool showEdgeNodes = false); - protected: percept::PerceptMesh& m_eMesh; URP(percept::PerceptMesh& eMesh) : m_eMesh(eMesh) {} typedef ToTopology TTopo; - typedef boost::array refined_element_type; + typedef std::array refined_element_type; diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Beam2_Beam3_1_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Beam2_Beam3_1_sierra.hpp index be8b0d6ed41e..9df570dcb3e7 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Beam2_Beam3_1_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Beam2_Beam3_1_sierra.hpp @@ -61,7 +61,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::array quadratic_type; + typedef std::array quadratic_type; static vector elems(1); CellTopology cell_topo(cell_topo_data); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Hex20_Hex20_8_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Hex20_Hex20_8_sierra.hpp index 61471ec382a2..09dcb6670259 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Hex20_Hex20_8_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Hex20_Hex20_8_sierra.hpp @@ -81,7 +81,7 @@ virtual unsigned getNumNewElemPerElem() { return 8; } - //typedef boost::array refined_element_type; + //typedef std::array refined_element_type; void diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Hex27_Hex27_8_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Hex27_Hex27_8_sierra.hpp index a36745ac83b3..2fc15916ba47 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Hex27_Hex27_8_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Hex27_Hex27_8_sierra.hpp @@ -79,7 +79,7 @@ virtual unsigned getNumNewElemPerElem() { return 8; } - //typedef boost::array refined_element_type; + //typedef std::array refined_element_type; void diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_24.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_24.hpp index 7a00cdf3b7a4..cec9a2caa0a7 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_24.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_24.hpp @@ -136,7 +136,7 @@ { EXCEPTWATCH; const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tet_tuple_type; + typedef std::array tet_tuple_type; static vector elems(24); shards::CellTopology cell_topo(cell_topo_data); @@ -191,7 +191,7 @@ throw std::logic_error("UniformRefinerPattern_Hex8_Tet4_20 logic err"); } - elems[iele++] = tet_tuple_type(CENTROID_N, VERT_N(itf), VERT_N(itfp), FACE_N(i_face)); + elems[iele++] = {CENTROID_N, VERT_N(itf), VERT_N(itfp), FACE_N(i_face)}; } } @@ -203,6 +203,7 @@ #endif + std::vector elemNodes(4); for (unsigned ielem=0; ielem < elems.size(); ielem++) { //stk::mesh::Entity newElement = eMesh.get_bulk_data()->declare_entity(Element, *element_id_pool, eMesh.getPart(interface_table::shards_Triangle_3) ); @@ -218,17 +219,11 @@ change_entity_parts(eMesh, element, newElement); - { - if (!elems[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << " nid = 0 << " << std::endl; - exit(1); - } - } - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<2>()), 2); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<3>()), 3); + elemNodes[0] = eMesh.createOrGetNode(elems[ielem][0]); + elemNodes[1] = eMesh.createOrGetNode(elems[ielem][1]); + elemNodes[2] = eMesh.createOrGetNode(elems[ielem][2]); + elemNodes[3] = eMesh.createOrGetNode(elems[ielem][3]); + eMesh.get_bulk_data()->declare_relation(newElement, elemNodes); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_6_12.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_6_12.hpp index f147f2bbf68d..7956e972aab1 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_6_12.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Hex8_Tet4_6_12.hpp @@ -142,7 +142,7 @@ { EXCEPTWATCH; const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tet_tuple_type; + typedef std::array tet_tuple_type; vector new_elements(6); shards::CellTopology cell_topo(cell_topo_data); @@ -242,7 +242,7 @@ } new_elements.resize(12); - // boost::array centroid = {{0,0,0}}; + // std::array centroid = {{0,0,0}}; // for (unsigned iv = 0; iv < 8; iv++) // { // centroid[0] += m_node_coords[element_globalIds[iv]][0]/8.0; @@ -264,10 +264,10 @@ // m_elems[shards_Tetrahedron_4].push_back(element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][jTriNodeIndex]]); // } - new_elements[iele++] = tet_tuple_type(CENTROID_N, - element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][0]], - element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][1]], - element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][2]]); + new_elements[iele++] = {CENTROID_N, + element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][0]], + element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][1]], + element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][2]]}; } } @@ -299,10 +299,10 @@ // { // m_elems[shards_Tetrahedron_4].push_back(element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][jTriNodeIndex]]); // } - new_elements[count] = tet_tuple_type(element_globalIds[vmaxIndx], - element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][0]], - element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][1]], - element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][2]]); + new_elements[count] = {element_globalIds[vmaxIndx], + element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][0]], + element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][1]], + element_globalIds[loc_trifaces[iQuadFace][kTriOnQuadFace][2]]}; ++count; @@ -315,6 +315,7 @@ } // to here <<<<<< ----------------------- + std::vector elemNodes(4); for (unsigned ielem=0; ielem < new_elements.size(); ielem++) { //stk::mesh::Entity newElement = eMesh.get_bulk_data()->declare_entity(Element, *element_id_pool, eMesh.getPart(interface_table::shards_Triangle_3) ); @@ -332,17 +333,11 @@ unsigned nchild = new_elements.size(); - { - if (!new_elements[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << " nid = 0 << " << std::endl; - exit(123); - } - } - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<2>()), 2); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<3>()), 3); + elemNodes[0] = eMesh.createOrGetNode(new_elements[ielem][0]); + elemNodes[1] = eMesh.createOrGetNode(new_elements[ielem][1]); + elemNodes[2] = eMesh.createOrGetNode(new_elements[ielem][2]); + elemNodes[3] = eMesh.createOrGetNode(new_elements[ielem][3]); + eMesh.get_bulk_data()->declare_relation(newElement, elemNodes); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem, &nchild); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line2_2_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line2_2_sierra.hpp index f697335a6dc1..2f3742a05ff0 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line2_2_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line2_2_sierra.hpp @@ -49,7 +49,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple line_tuple_type; + typedef std::array line_tuple_type; static vector elems(2); CellTopology cell_topo(cell_topo_data); @@ -123,7 +123,7 @@ EN[jNode] = inode; } - elems[iChild] = line_tuple_type(EN[0], EN[1]); + elems[iChild] = {EN[0], EN[1]}; } #undef CENTROID_N @@ -141,18 +141,9 @@ if (!use_declare_element_side) newElement = *element_pool; - stk::mesh::Entity nodes[2] = {eMesh.createOrGetNode(elems[ielem].get<0>()), eMesh.createOrGetNode(elems[ielem].get<1>())}; + stk::mesh::Entity nodes[2] = {eMesh.createOrGetNode(elems[ielem][0]), eMesh.createOrGetNode(elems[ielem][1])}; create_side_element(eMesh, use_declare_element_side, nodes, 2, newElement); -#if 0 - if (proc_rank_field && proc_rank_field->field_array_rank() == m_eMesh.edge_rank()) //&& m_eMesh.get_spatial_dim()==1) - { - double *fdata =stk::mesh::field_data( *static_cast(proc_rank_field) , newElement ); - //fdata[0] = double(m_eMesh.get_rank()); - fdata[0] = double(eMesh.owner_rank(newElement)); - } -#endif - stk::mesh::FieldBase * proc_rank_field_edge = m_eMesh.get_field(stk::topology::EDGE_RANK, "proc_rank_edge"); if (proc_rank_field_edge && proc_rank_field_edge->field_array_rank() != m_eMesh.edge_rank()) { @@ -172,8 +163,6 @@ << std::endl; } - //eMesh.get_bulk_data()->change_entity_parts( newElement, add_parts, remove_parts ); - change_entity_parts(eMesh, element, newElement); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line3_1_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line3_1_sierra.hpp index 7c0399e52966..68e9daa1f9e6 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line3_1_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Line2_Line3_1_sierra.hpp @@ -72,7 +72,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::array quadratic_type; + typedef std::array quadratic_type; static vector elems(1); CellTopology cell_topo(cell_topo_data); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Pyramid5_Tet4_2.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Pyramid5_Tet4_2.hpp index 5942d951e352..158087d88d8d 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Pyramid5_Tet4_2.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Pyramid5_Tet4_2.hpp @@ -123,7 +123,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { EXCEPTWATCH; - typedef boost::tuple tet_tuple_type; + typedef std::array tet_tuple_type; vector new_elements(2); static unsigned element_globalIds[5] = {0,0,0,0,0}; @@ -149,15 +149,15 @@ } unsigned istart = indxMinVal; - new_elements[0] = tet_tuple_type(element_globalIds[(0+istart)%4], - element_globalIds[(1+istart)%4], - element_globalIds[(2+istart)%4], - element_globalIds[4]); + new_elements[0] = {element_globalIds[(0+istart)%4], + element_globalIds[(1+istart)%4], + element_globalIds[(2+istart)%4], + element_globalIds[4]}; - new_elements[1] = tet_tuple_type(element_globalIds[(0+istart)%4], - element_globalIds[(2+istart)%4], - element_globalIds[(3+istart)%4], - element_globalIds[4]); + new_elements[1] = {element_globalIds[(0+istart)%4], + element_globalIds[(2+istart)%4], + element_globalIds[(3+istart)%4], + element_globalIds[4]}; for (unsigned ielem=0; ielem < new_elements.size(); ielem++) { @@ -173,10 +173,10 @@ unsigned nchild = new_elements.size(); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<2>()), 2); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<3>()), 3); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][0]), 0); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][1]), 1); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][2]), 2); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][3]), 3); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem, &nchild); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Quad4_4.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Quad4_4.hpp index 11931edfad2d..281e3499a342 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Quad4_4.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Quad4_4.hpp @@ -50,7 +50,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple quad_tuple_type; + typedef std::array quad_tuple_type; static vector elems(4); CellTopology cell_topo(cell_topo_data); @@ -86,10 +86,10 @@ // new_sub_entity_nodes[i][j] #define CENTROID_N NN(m_primaryEntityRank,0) - elems[0] = quad_tuple_type(VERT_N(0), EDGE_N(0), CENTROID_N, EDGE_N(3)); - elems[1] = quad_tuple_type(VERT_N(1), EDGE_N(1), CENTROID_N, EDGE_N(0)); - elems[2] = quad_tuple_type(VERT_N(2), EDGE_N(2), CENTROID_N, EDGE_N(1)); - elems[3] = quad_tuple_type(VERT_N(3), EDGE_N(3), CENTROID_N, EDGE_N(2)); + elems[0] = {VERT_N(0), EDGE_N(0), CENTROID_N, EDGE_N(3)}; + elems[1] = {VERT_N(1), EDGE_N(1), CENTROID_N, EDGE_N(0)}; + elems[2] = {VERT_N(2), EDGE_N(2), CENTROID_N, EDGE_N(1)}; + elems[3] = {VERT_N(3), EDGE_N(3), CENTROID_N, EDGE_N(2)}; #undef CENTROID_N @@ -107,10 +107,10 @@ newElement = *element_pool; stk::mesh::Entity nodes[4] = { - eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>()), - eMesh.createOrGetNode(elems[ielem].get<3>()) }; + eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2]), + eMesh.createOrGetNode(elems[ielem][3]) }; create_side_element(eMesh, use_declare_element_side, nodes, 4, newElement); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_2.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_2.hpp index 794517780e80..2e0d213516ea 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_2.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_2.hpp @@ -66,7 +66,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tri_tuple_type; + typedef std::array tri_tuple_type; static vector elems(2); CellTopology cell_topo(cell_topo_data); @@ -91,8 +91,8 @@ } unsigned istart = indxMinVal; - elems[0] = tri_tuple_type(VERT_N((0 + istart) % 4), VERT_N((1 + istart) % 4), VERT_N((2 + istart) % 4)); - elems[1] = tri_tuple_type(VERT_N((0 + istart) % 4), VERT_N((2 + istart) % 4), VERT_N((3 + istart) % 4)); + elems[0] = {VERT_N((0 + istart) % 4), VERT_N((1 + istart) % 4), VERT_N((2 + istart) % 4)}; + elems[1] = {VERT_N((0 + istart) % 4), VERT_N((2 + istart) % 4), VERT_N((3 + istart) % 4)}; } bool use_declare_element_side = UniformRefinerPatternBase::USE_DECLARE_ELEMENT_SIDE && m_primaryEntityRank == eMesh.side_rank(); @@ -105,9 +105,9 @@ // 3 nodes of the new quads stk::mesh::Entity nodes[3] = { - eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>()) }; + eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2]) }; create_side_element(eMesh, use_declare_element_side, nodes, 3, newElement); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_4.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_4.hpp index 07e0df7f10bb..72e9a8e824aa 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_4.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_4.hpp @@ -57,7 +57,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tri_tuple_type; + typedef std::array tri_tuple_type; static vector elems(4); CellTopology cell_topo(cell_topo_data); @@ -81,10 +81,10 @@ #define CENTROID_N NN(m_primaryEntityRank, 0) - elems[0] = tri_tuple_type(VERT_N(0), VERT_N(1), CENTROID_N); - elems[1] = tri_tuple_type(VERT_N(1), VERT_N(2), CENTROID_N); - elems[2] = tri_tuple_type(VERT_N(2), VERT_N(3), CENTROID_N); - elems[3] = tri_tuple_type(VERT_N(3), VERT_N(0), CENTROID_N); + elems[0] = {VERT_N(0), VERT_N(1), CENTROID_N}; + elems[1] = {VERT_N(1), VERT_N(2), CENTROID_N}; + elems[2] = {VERT_N(2), VERT_N(3), CENTROID_N}; + elems[3] = {VERT_N(3), VERT_N(0), CENTROID_N}; #undef CENTROID_N @@ -110,9 +110,9 @@ newElement = *element_pool; stk::mesh::Entity nodes[3] = { - eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>())}; + eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2])}; create_side_element(eMesh, use_declare_element_side, nodes, 3, newElement); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_6.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_6.hpp index d05d96f0edc0..c5b46e401670 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_6.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Quad4_Tri3_6.hpp @@ -92,7 +92,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple tri_tuple_type; + typedef std::array tri_tuple_type; static vector elems(6); CellTopology cell_topo(cell_topo_data); @@ -132,13 +132,13 @@ } - elems[0] = tri_tuple_type(VERT_N(0), EDGE_N(0), EDGE_N(3)); - elems[1] = tri_tuple_type(VERT_N(1), EDGE_N(1), EDGE_N(0)); - elems[2] = tri_tuple_type(EDGE_N(0), EDGE_N(1), EDGE_N(3)); + elems[0] = {VERT_N(0), EDGE_N(0), EDGE_N(3)}; + elems[1] = {VERT_N(1), EDGE_N(1), EDGE_N(0)}; + elems[2] = {EDGE_N(0), EDGE_N(1), EDGE_N(3)}; - elems[3] = tri_tuple_type(VERT_N(2), EDGE_N(2), EDGE_N(1)); - elems[4] = tri_tuple_type(VERT_N(3), EDGE_N(3), EDGE_N(2)); - elems[5] = tri_tuple_type(EDGE_N(2), EDGE_N(3), EDGE_N(1)); + elems[3] = {VERT_N(2), EDGE_N(2), EDGE_N(1)}; + elems[4] = {VERT_N(3), EDGE_N(3), EDGE_N(2)}; + elems[5] = {EDGE_N(2), EDGE_N(3), EDGE_N(1)}; // write a diagram of the refinement pattern as a vtk file, or a latex/tikz/pgf file #define WRITE_DIAGRAM 0 @@ -158,9 +158,9 @@ newElement = *element_pool; stk::mesh::Entity nodes[3] = { - eMesh.createOrGetNode(elems[ielem].get<0>()), - eMesh.createOrGetNode(elems[ielem].get<1>()), - eMesh.createOrGetNode(elems[ielem].get<2>())}; + eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2])}; create_side_element(eMesh, use_declare_element_side, nodes, 3, newElement); @@ -171,18 +171,8 @@ fdata[0] = double(eMesh.owner_rank(newElement)); } - //eMesh.get_bulk_data()->change_entity_parts( newElement, add_parts, remove_parts ); change_entity_parts(eMesh, element, newElement); - { - if (!elems[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << " nid = 0 << " << std::endl; - exit(1); - } - - } - set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); ft_element_pool++; diff --git a/packages/percept/src/adapt/UniformRefinerPattern_ShellLine2_ShellLine2_2_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_ShellLine2_ShellLine2_2_sierra.hpp index 4a6b09762c9d..182cec6eb4b7 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_ShellLine2_ShellLine2_2_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_ShellLine2_ShellLine2_2_sierra.hpp @@ -49,7 +49,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { const CellTopologyData * const cell_topo_data = m_eMesh.get_cell_topology(element); - typedef boost::tuple line_tuple_type; + typedef std::array line_tuple_type; static vector elems(2); CellTopology cell_topo(cell_topo_data); @@ -123,7 +123,7 @@ EN[jNode] = inode; } - elems[iChild] = line_tuple_type(EN[0], EN[1]); + elems[iChild] = {EN[0], EN[1]}; } #undef CENTROID_N @@ -142,28 +142,11 @@ if (!use_declare_element_side) newElement = *element_pool; - stk::mesh::Entity nodes[2] = {eMesh.createOrGetNode(elems[ielem].get<0>()), eMesh.createOrGetNode(elems[ielem].get<1>())}; + stk::mesh::Entity nodes[2] = {eMesh.createOrGetNode(elems[ielem][0]), eMesh.createOrGetNode(elems[ielem][1])}; create_side_element(eMesh, use_declare_element_side, nodes, 2, newElement); -#if 0 - if (proc_rank_field && proc_rank_field->rank() == m_eMesh.edge_rank()) //&& m_eMesh.get_spatial_dim()==1) - { - double *fdata = stk::mesh::field_data( *static_cast(proc_rank_field) , newElement ); - //fdata[0] = double(m_eMesh.get_rank()); - fdata[0] = double(eMesh.owner_rank(newElement)); - } -#endif change_entity_parts(eMesh, element, newElement); - { - if (!elems[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << " nid = 0 " << std::endl; - exit(1); - } - - } - set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); ft_element_pool++; diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Tet10_Tet10_8_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Tet10_Tet10_8_sierra.hpp index 98b614ff699f..e53d8eb166f2 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Tet10_Tet10_8_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Tet10_Tet10_8_sierra.hpp @@ -80,7 +80,7 @@ virtual unsigned getNumNewElemPerElem() { return 8; } - //typedef boost::array refined_element_type; + //typedef std::array refined_element_type; void diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Tet4_Tet4_8_sierra.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Tet4_Tet4_8_sierra.hpp index 4cf8fbf9b53b..b1ed08796fb2 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Tet4_Tet4_8_sierra.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Tet4_Tet4_8_sierra.hpp @@ -15,8 +15,6 @@ #include #include -#include -#include #define USE_FACE_BREAKER_T4_T4_8 1 #if USE_FACE_BREAKER_T4_T4_8 @@ -90,8 +88,8 @@ virtual unsigned getNumNewElemPerElem() { return 8; } #if USE_PERCEPT_MOAB_TET_REFINE - typedef boost::tuple TetTupleTypeLocal; - typedef boost::tuple TetTupleType; + typedef std::array TetTupleTypeLocal; + typedef std::array TetTupleType; #define TET_VERT_N(i) (i) #define TET_EDGE_N(i) ((i)+4) @@ -150,10 +148,10 @@ tets.resize(new_tets.size()); for (unsigned i = 0; i < new_tets.size(); i++) { - tets[i] = TetTupleTypeLocal((unsigned)new_tets[i].get<0>(), - (unsigned)new_tets[i].get<1>(), - (unsigned)new_tets[i].get<2>(), - (unsigned)new_tets[i].get<3>() ); + tets[i] = {(unsigned)new_tets[i][0], + (unsigned)new_tets[i][1], + (unsigned)new_tets[i][2], + (unsigned)new_tets[i][3]}; if (0) std::cout << "tmp RefPatt::createNewElements new tet= " << tets[i] << std::endl; @@ -197,10 +195,10 @@ elems.resize(num_new_elems); for (unsigned ielem=0; ielem < num_new_elems; ielem++) { - elems[ielem] = TetTupleType( TET_CV_EV(elems_local[ielem].get<0>() ), - TET_CV_EV(elems_local[ielem].get<1>() ), - TET_CV_EV(elems_local[ielem].get<2>() ), - TET_CV_EV(elems_local[ielem].get<3>() ) ); + elems[ielem] = { TET_CV_EV(elems_local[ielem][0] ), + TET_CV_EV(elems_local[ielem][1] ), + TET_CV_EV(elems_local[ielem][2] ), + TET_CV_EV(elems_local[ielem][3] ) }; if (0) std::cout << "tmp RefPatt::createNewElements new tet= " << elems[ielem] << std::endl; @@ -224,19 +222,11 @@ //eMesh.get_bulk_data()->change_entity_parts( newElement, add_parts, remove_parts ); change_entity_parts(eMesh, element, newElement); - { - if (!elems[ielem].get<0>()) - { - std::cout << "P[" << eMesh.get_rank() << "] nid = 0 << " << std::endl; - //exit(1); - } - } - // 4 nodes of the new tets - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<2>()), 2); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(elems[ielem].get<3>()), 3); + eMesh.get_bulk_data()->declare_relation(newElement, {eMesh.createOrGetNode(elems[ielem][0]), + eMesh.createOrGetNode(elems[ielem][1]), + eMesh.createOrGetNode(elems[ielem][2]), + eMesh.createOrGetNode(elems[ielem][3])}); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_Wedge6_Tet4_3.hpp b/packages/percept/src/adapt/UniformRefinerPattern_Wedge6_Tet4_3.hpp index 5a905c10487d..215700049dac 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_Wedge6_Tet4_3.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_Wedge6_Tet4_3.hpp @@ -76,7 +76,7 @@ stk::mesh::FieldBase *proc_rank_field=0) { EXCEPTWATCH; - typedef boost::tuple tet_tuple_type; + typedef std::array tet_tuple_type; vector new_elements(3); stk::mesh::EntityId element_globalIds[6] = {0,0,0,0,0,0}; @@ -115,21 +115,21 @@ } // tet connected to min ID vertex but not opposite quad faces - new_elements[0] = tet_tuple_type(element_globalIds[min_vertex_renumber[indxMinVal][0]], - element_globalIds[min_vertex_renumber[indxMinVal][4]], - element_globalIds[min_vertex_renumber[indxMinVal][5]], - element_globalIds[min_vertex_renumber[indxMinVal][3]]); + new_elements[0] = {element_globalIds[min_vertex_renumber[indxMinVal][0]], + element_globalIds[min_vertex_renumber[indxMinVal][4]], + element_globalIds[min_vertex_renumber[indxMinVal][5]], + element_globalIds[min_vertex_renumber[indxMinVal][3]]}; // tets formed from splitting opposite quad faces using its min ID vertex - new_elements[1] = tet_tuple_type(element_globalIds[indxMinVal], - element_globalIds[opposite_quad_face_nodes[(0+indxMinValFace)%4]], - element_globalIds[opposite_quad_face_nodes[(1+indxMinValFace)%4]], - element_globalIds[opposite_quad_face_nodes[(2+indxMinValFace)%4]]); - - new_elements[2] = tet_tuple_type(element_globalIds[indxMinVal], - element_globalIds[opposite_quad_face_nodes[(0+indxMinValFace)%4]], - element_globalIds[opposite_quad_face_nodes[(2+indxMinValFace)%4]], - element_globalIds[opposite_quad_face_nodes[(3+indxMinValFace)%4]]); + new_elements[1] = {element_globalIds[indxMinVal], + element_globalIds[opposite_quad_face_nodes[(0+indxMinValFace)%4]], + element_globalIds[opposite_quad_face_nodes[(1+indxMinValFace)%4]], + element_globalIds[opposite_quad_face_nodes[(2+indxMinValFace)%4]]}; + + new_elements[2] = {element_globalIds[indxMinVal], + element_globalIds[opposite_quad_face_nodes[(0+indxMinValFace)%4]], + element_globalIds[opposite_quad_face_nodes[(2+indxMinValFace)%4]], + element_globalIds[opposite_quad_face_nodes[(3+indxMinValFace)%4]]}; for (unsigned ielem=0; ielem < new_elements.size(); ielem++) { @@ -145,10 +145,10 @@ unsigned nchild = new_elements.size(); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<0>()), 0); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<1>()), 1); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<2>()), 2); - eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem].get<3>()), 3); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][0]), 0); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][1]), 1); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][2]), 2); + eMesh.get_bulk_data()->declare_relation(newElement, eMesh.createOrGetNode(new_elements[ielem][3]), 3); set_parent_child_relations(eMesh, element, newElement, *ft_element_pool, ielem, &nchild); diff --git a/packages/percept/src/adapt/UniformRefinerPattern_def.hpp b/packages/percept/src/adapt/UniformRefinerPattern_def.hpp index 2c39956d7d65..a888fa7d8712 100644 --- a/packages/percept/src/adapt/UniformRefinerPattern_def.hpp +++ b/packages/percept/src/adapt/UniformRefinerPattern_def.hpp @@ -13,212 +13,6 @@ namespace percept { - template - std::string - URP:: - draw(bool showRefined , bool showEdgeNodes ) - { - Elem::StdMeshObjTopologies::bootstrap(); - -#define EXPRINT 0 - - const CellTopologyData * const cell_topo_data = shards::getCellTopologyData(); - shards::CellTopology cell_topo(cell_topo_data); - - std::ostringstream graph_str; - - unsigned n_vert = FromTopology::vertex_count; - unsigned n_node = FromTopology::node_count; - unsigned n_edge = cell_topo.getEdgeCount(); - unsigned n_face = cell_topo.getFaceCount(); - unsigned n_side = cell_topo.getSideCount(); - - graph_str << - "graph " << cell_topo.getName() << " {\n" - << "# name= " << cell_topo.getName() << "\n" - << "# n_vert = " << n_vert << "\n" - << "# n_node = " << n_node << "\n" - << "# n_edge = " << n_edge << "\n" - << "# n_face = " << n_face << "\n" - << "# n_side = " << n_side << "\n" - << - " ratio=1;\n" - " layout=nop;\n" - " size=\"4,4\";\n" - " bb=\"-50,-50,150,150\";\n" - " node [color=Green, fontcolor=Blue, font=Courier, width=0.125, height=0.125, shape=circle, fontsize=6, fixedsize=true, penwidth=0.2]; \n" - //" edge [style=dashed]; \n" - " edge [penwidth=0.1]; \n" - ; - - - //" node [color=Green, fontcolor=Blue, font=Courier, width=\"0.1\", height=\"0.1\", shape=none];\n" ; - - std::vector needed_entities; - - Elem::CellTopology elem_celltopo = Elem::getCellTopology< FromTopology >(); - const Elem::RefinementTopology* ref_topo_p = Elem::getRefinementTopology(elem_celltopo); - if (!ref_topo_p) - throw std::runtime_error("draw:: error, no refinement topology found"); - const Elem::RefinementTopology& ref_topo = *ref_topo_p; - - unsigned num_child = ref_topo.num_child(); - unsigned num_child_nodes = ref_topo.num_child_nodes(); - bool homogeneous_child = ref_topo.homogeneous_child(); - - //bool edge_exists[num_child_nodes][num_child_nodes]; - bool edge_exists[128][128]; - - - typedef Elem::StdMeshObjTopologies::RefTopoX RefTopoX; - RefTopoX& ref_topo_x = Elem::StdMeshObjTopologies::RefinementTopologyExtra< FromTopology > ::refinement_topology; - - if (0) std::cout << num_child << " " << homogeneous_child << " " << n_vert; - - //if (n_face == 0) n_face = 1; // 2D face has one "face" - if (0) - std::cout << "tmp n_face= " << n_face << " n_side= " << n_side << std::endl; - - - Math::MyVector delta; - double len_max = 0.0; - for (unsigned i_edge = 0; i_edge < n_edge; i_edge++) - { - Math::MyVector pc0( ref_topo_x[ cell_topo_data->edge[i_edge].node[0] ].parametric_coordinates ); - Math::MyVector pc1( ref_topo_x[ cell_topo_data->edge[i_edge].node[1] ].parametric_coordinates ); - pc0 -= pc1; - double len = norm_2(pc0); - len_max = std::max(len_max, len); - } - - double scv = 80.0; - Math::Matrix scm = Math::scalingMatrix(scv / len_max); - Math::Matrix rm = scm; - - Math::MyVector centroid; - for (unsigned i_node = 0; i_node < n_node; i_node++) - { - Math::MyVector pc( ref_topo_x[i_node].parametric_coordinates ); - centroid += pc/(double(n_node)); - } - if (0) std::cout << "len_max= " << len_max << " centroid= " << centroid << std::endl; - - if (cell_topo.getDimension() == 3) - { - - // good one - Math::Matrix rmx = Math::rotationMatrix(0, -60.0); - Math::Matrix rmy = Math::rotationMatrix(1, 0.0); - Math::Matrix rmz = Math::rotationMatrix(2, -30.0); - - //rm = ublas::prod(rmy, rmz); - rm = ublas::prod(rmx, rmz); - rm = ublas::prod(rmy, rm); - rm = ublas::prod(scm, rm); - } - - if (0) - std::cout << rm; - for (unsigned i_node = 0; i_node < n_node; i_node++) - { - double *pc = ref_topo_x[i_node].parametric_coordinates; - Math::MyVector v(pc); - v -= centroid; - v = ublas::prod(rm, v); - - v(0) += scv/2.; - v(1) += scv/2.; - v(2) += scv/2.; - - graph_str << " " << i_node << " [ pos=\"" << v(0) << "," << v(1) << "\"];\n"; - } - - // draw edges - if (!showRefined) - //if (showEdges) - for (unsigned i_edge = 0; i_edge < n_edge; i_edge++) - { - unsigned nn = cell_topo_data->edge[i_edge].topology->vertex_count; - if (showEdgeNodes) - nn = cell_topo_data->edge[i_edge].topology->node_count; - for (unsigned j_node = 0; j_node < nn - 1; j_node++) - { - graph_str << " " - << cell_topo_data->edge[i_edge].node[j_node] << " -- " - << cell_topo_data->edge[i_edge].node[(j_node + 1) % nn] << " ; \n" ; - } - } - - bool ft = (fromTopoKey == toTopoKey); - - if (showRefined && ft) - { - // draw edges - for (unsigned i=0; i < num_child_nodes; i++) - for (unsigned j = 0; j < num_child_nodes; j++) - { - edge_exists[i][j]=false; - } - for (unsigned iChild = 0; iChild < num_child; iChild++) - { - // draw nodes - unsigned nvn = (showEdgeNodes? FromTopology::node_count : FromTopology::vertex_count); - for (unsigned jNode = 0; jNode < nvn; jNode++) - { - unsigned childNodeIdx = ref_topo.child_node(iChild)[jNode]; -#ifndef NDEBUG - unsigned childNodeIdxCheck = ref_topo_x[childNodeIdx].ordinal_of_node; - VERIFY_OP(childNodeIdx, ==, childNodeIdxCheck, "childNodeIdxCheck"); -#endif - - double *pc = ref_topo_x[childNodeIdx].parametric_coordinates; - Math::MyVector v(pc); - v -= centroid; - v = ublas::prod(rm, v); - - v(0) += scv/2.; - v(1) += scv/2.; - v(2) += scv/2.; - - //graph_str << " " << i_node << " [ pos=\"" << pc[0] << "," << pc[1] << "\"];\n"; - std::string color="green"; - //if (childNodeIdx >= FromTopology::node_count) - if (childNodeIdx >= FromTopology::vertex_count) - color = "red"; - graph_str << " " << childNodeIdx << " [color=" << color << ", pos=\"" << v(0) << "," << v(1) << "\"];\n"; - - } - - for (unsigned i_edge = 0; i_edge < n_edge; i_edge++) - { - //unsigned nn = cell_topo_data->edge[i_edge].topology->vertex_count; - //unsigned nn = cell_topo_data->edge[i_edge].topology->node_count; - - unsigned nn = cell_topo_data->edge[i_edge].topology->vertex_count; - if (showEdgeNodes) - nn = cell_topo_data->edge[i_edge].topology->node_count; - - for (unsigned j_node = 0; j_node < nn - 1; j_node++) - { - unsigned j0 = ref_topo.child_node(iChild)[ cell_topo_data->edge[i_edge].node[j_node] ]; - unsigned j1 = ref_topo.child_node(iChild)[ cell_topo_data->edge[i_edge].node[(j_node + 1) % nn] ]; - unsigned j00 = std::min(j0,j1); - unsigned j10 = std::max(j0,j1); - if (!edge_exists[j00][j10]) - graph_str << " " << std::min(j0,j1) << " -- " << std::max(j0,j1) << " ; \n" ; - edge_exists[j00][j10]=true; - } - } - - } - } - - graph_str << "}\n"; - - return std::string(graph_str.str()); - - } - /// utility methods for converting Sierra tables to new format (which groups DOF's on sub-entities) template bool diff --git a/packages/percept/src/adapt/main/MeshAdapt.cpp b/packages/percept/src/adapt/main/MeshAdapt.cpp index e7ad69fad77a..12afac0f9699 100644 --- a/packages/percept/src/adapt/main/MeshAdapt.cpp +++ b/packages/percept/src/adapt/main/MeshAdapt.cpp @@ -6,6 +6,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include #include #include @@ -210,7 +211,7 @@ namespace percept { bool isInt = false; { try { - i = boost::lexical_cast(s); + i = std::stoi(s); (void)i; isInt = true; } diff --git a/packages/percept/src/adapt/main/MeshAdapt.hpp b/packages/percept/src/adapt/main/MeshAdapt.hpp index e220bd738c64..b1463f10625a 100644 --- a/packages/percept/src/adapt/main/MeshAdapt.hpp +++ b/packages/percept/src/adapt/main/MeshAdapt.hpp @@ -50,8 +50,6 @@ #include #include -#include -#include #include #include diff --git a/packages/percept/src/adapt/main/RunAdaptRun.hpp b/packages/percept/src/adapt/main/RunAdaptRun.hpp index efae7147111b..3f8726f33ccf 100644 --- a/packages/percept/src/adapt/main/RunAdaptRun.hpp +++ b/packages/percept/src/adapt/main/RunAdaptRun.hpp @@ -16,7 +16,9 @@ #include #include #include +#include #include +#include #if HAVE_YAML #include @@ -96,7 +98,7 @@ static void copy_error_indicator(PerceptMesh& eMesh_no_ft,PerceptMesh& eMesh, ErrorFieldType * error_field_no_ft, ErrorFieldType * error_field) { #if STK_PERCEPT_LITE==0 - boost::shared_ptr mesh_transfer = + std::shared_ptr mesh_transfer = buildSTKMeshTransfer(*(eMesh_no_ft.get_bulk_data()), eMesh_no_ft.get_coordinates_field(), error_field_no_ft, @@ -286,6 +288,7 @@ static void copy_error_indicator(PerceptMesh& eMesh_no_ft,PerceptMesh& eMesh, YamlUtils::emit(fout, node); } } + } #endif private: @@ -613,6 +616,7 @@ static void copy_error_indicator(PerceptMesh& eMesh_no_ft,PerceptMesh& eMesh, &eMesh_error.get_fem_meta_data()->declare_field(stk::topology::ELEMENT_RANK, rar.m_error_indicator_field); stk::mesh::FieldTraits::data_type* init_np = nullptr; // gcc 4.8 hack stk::mesh::put_field_on_mesh( *from_error_field , eMesh_error.get_fem_meta_data()->universal_part(), 1, init_np); + eMesh_error.add_input_field(from_error_field); eMesh_error.commit(); @@ -668,7 +672,7 @@ static void copy_error_indicator(PerceptMesh& eMesh_no_ft,PerceptMesh& eMesh, if (part->primary_entity_rank() != stk::topology::ELEMENT_RANK || stk::mesh::is_auto_declared_part(*part)) continue; - stk::topology stk_topo = stk::mesh::get_topology(eMesh.get_fem_meta_data()->get_cell_topology(*part)); + stk::topology stk_topo = eMesh.get_fem_meta_data()->get_topology(*part); if (stk_topo == stk::topology::WEDGE_6) { rar.m_wedge_block_names.push_back(part->name()); diff --git a/packages/percept/src/adapt/markers/Marker.cpp b/packages/percept/src/adapt/markers/Marker.cpp index d4a1f7932027..2dd0c6817fd1 100644 --- a/packages/percept/src/adapt/markers/Marker.cpp +++ b/packages/percept/src/adapt/markers/Marker.cpp @@ -97,7 +97,7 @@ stk::mesh::Selector *Marker::getSelector() { return m_globalSelector; } struct CompareErrIndRefFieldVec : public std::binary_function { bool operator()( ErrIndInfoTuple a, ErrIndInfoTuple b) { - return *a.get<0>() < *b.get<0>(); + return std::get<0>(a) < std::get<0>(b); } }; diff --git a/packages/percept/src/adapt/markers/Marker.hpp b/packages/percept/src/adapt/markers/Marker.hpp index 7e0a4f3d7197..c4d647f577a3 100644 --- a/packages/percept/src/adapt/markers/Marker.hpp +++ b/packages/percept/src/adapt/markers/Marker.hpp @@ -11,9 +11,7 @@ #define Marker_h #include - -#include -#include +#include #include #include @@ -33,7 +31,7 @@ class BoundingRegion; * */ //-------------------------------------------------------------------- -typedef boost::tuple ErrIndInfoTuple; +typedef std::tuple ErrIndInfoTuple; struct MarkerInfo { diff --git a/packages/percept/src/adapt/markers/MarkerInterval.cpp b/packages/percept/src/adapt/markers/MarkerInterval.cpp index 6dceffcf7960..4de6d247443f 100644 --- a/packages/percept/src/adapt/markers/MarkerInterval.cpp +++ b/packages/percept/src/adapt/markers/MarkerInterval.cpp @@ -81,8 +81,8 @@ size_t MarkerInterval::estimateNewElements(double errIndRefineThreshold, std::ve { size_t numRefinedLocal = 0, numRefinedGlobal = 0; for (size_t i = 0; i < errIndRefFieldVec.size(); ++i) { - if (refine_element(*errIndRefFieldVec[i].get<0>()) - && !errIndRefFieldVec[i].get<2>()) + if (refine_element(*std::get<0>(errIndRefFieldVec[i])) + && !std::get<2>(errIndRefFieldVec[i])) ++numRefinedLocal; } diff --git a/packages/percept/src/adapt/markers/MarkerPhysicallyBased.cpp b/packages/percept/src/adapt/markers/MarkerPhysicallyBased.cpp index 63fe129625f9..bd17cb088b66 100644 --- a/packages/percept/src/adapt/markers/MarkerPhysicallyBased.cpp +++ b/packages/percept/src/adapt/markers/MarkerPhysicallyBased.cpp @@ -82,13 +82,13 @@ void MarkerPhysicallyBased::markUsing(double errIndRefineThreshold, std::vector< { for (unsigned i = 0; i < errIndRefFieldVec.size(); ++i) { // reset to 0, then check criterion - *errIndRefFieldVec[i].get<1>() = static_cast(0); - if (*errIndRefFieldVec[i].get<0>() < m_unrefinement_multiplier*errIndRefineThreshold) { - *errIndRefFieldVec[i].get<1>() = static_cast(-1); + *std::get<1>(errIndRefFieldVec[i]) = static_cast(0); + if (*std::get<0>(errIndRefFieldVec[i]) < m_unrefinement_multiplier*errIndRefineThreshold) { + *std::get<1>(errIndRefFieldVec[i]) = static_cast(-1); } - if (do_refine && (*errIndRefFieldVec[i].get<0>() > errIndRefineThreshold) - && !errIndRefFieldVec[i].get<2>()) { - *errIndRefFieldVec[i].get<1>() = static_cast(1); + if (do_refine && (*std::get<0>(errIndRefFieldVec[i]) > errIndRefineThreshold) + && !std::get<2>(errIndRefFieldVec[i])) { + *std::get<1>(errIndRefFieldVec[i]) = static_cast(1); } } } @@ -102,8 +102,8 @@ size_t MarkerPhysicallyBased::estimateNewElements(double errIndRefineThreshold, size_t numRefinedLocal = 0, numRefinedGlobal = 0; for (size_t i = 0; i < errIndRefFieldVec.size(); ++i) { - if ((*errIndRefFieldVec[i].get<0>() > errIndRefineThreshold) - && !errIndRefFieldVec[i].get<2>() ) + if ((*std::get<0>(errIndRefFieldVec[i]) > errIndRefineThreshold) + && !std::get<2>(errIndRefFieldVec[i]) ) ++numRefinedLocal; } diff --git a/packages/percept/src/adapt/markers/MarkerUsingErrIndFraction.cpp b/packages/percept/src/adapt/markers/MarkerUsingErrIndFraction.cpp index e2d0404f5ad7..ba6f0c22a442 100644 --- a/packages/percept/src/adapt/markers/MarkerUsingErrIndFraction.cpp +++ b/packages/percept/src/adapt/markers/MarkerUsingErrIndFraction.cpp @@ -72,14 +72,14 @@ void MarkerUsingErrIndFraction::markUsing(double errIndRefineThreshold, std::vec for (unsigned i = 0; i < errIndRefFieldVec.size(); ++i) { // reset to 0, then check criterion - *errIndRefFieldVec[i].get<1>() = static_cast(0); - if (*errIndRefFieldVec[i].get<0>() < UF*g_maxErrorIndicator) { - *errIndRefFieldVec[i].get<1>() = static_cast(-1); + *std::get<1>(errIndRefFieldVec[i]) = static_cast(0); + if (*std::get<0>(errIndRefFieldVec[i]) < UF*g_maxErrorIndicator) { + *std::get<1>(errIndRefFieldVec[i]) = static_cast(-1); } if (do_refine) { - if ((*errIndRefFieldVec[i].get<0>() > errIndRefineThreshold*g_maxErrorIndicator) - && !errIndRefFieldVec[i].get<2>()) { - *errIndRefFieldVec[i].get<1>() = static_cast(1); + if ((*std::get<0>(errIndRefFieldVec[i]) > errIndRefineThreshold*g_maxErrorIndicator) + && !std::get<2>(errIndRefFieldVec[i])) { + *std::get<1>(errIndRefFieldVec[i]) = static_cast(1); } } } @@ -96,8 +96,8 @@ size_t MarkerUsingErrIndFraction::estimateNewElements(double errIndRefineThresho size_t numRefinedLocal = 0, numRefinedGlobal = 0; for (size_t i = 0; i < errIndRefFieldVec.size(); ++i) { - if ((*errIndRefFieldVec[i].get<0>() > errIndRefineThreshold*g_maxErrorIndicator) - && !errIndRefFieldVec[i].get<2>() ) + if ((*std::get<0>(errIndRefFieldVec[i]) > errIndRefineThreshold*g_maxErrorIndicator) + && !std::get<2>(errIndRefFieldVec[i]) ) ++numRefinedLocal; } diff --git a/packages/percept/src/adapt/sierra_element/CellTopology.cpp b/packages/percept/src/adapt/sierra_element/CellTopology.cpp index 59611c0c1f3d..04d37d7eab47 100644 --- a/packages/percept/src/adapt/sierra_element/CellTopology.cpp +++ b/packages/percept/src/adapt/sierra_element/CellTopology.cpp @@ -1,17 +1,22 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /*------------------------------------------------------------------------*/ /* shards : Shared Discretization Tools */ -/* Copyright (2008, 2011) Sandia Corporation */ +/* Copyright (2002-2008, 2010, 2011) National Technology & */ +/* Engineering Solutions of Sandia, LLC. */ /* */ -/* 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. */ +/* Under terms of Contract DE-NA0003525, there is a non-exclusive */ +/* license for use of this work by or on behalf of the U.S. Government. */ /* */ /* This library is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU Lesser General Public License as */ diff --git a/packages/percept/src/adapt/sierra_element/StdMeshObjTopologies.cpp b/packages/percept/src/adapt/sierra_element/StdMeshObjTopologies.cpp index 07f3288e46be..d50c8bc2106c 100644 --- a/packages/percept/src/adapt/sierra_element/StdMeshObjTopologies.cpp +++ b/packages/percept/src/adapt/sierra_element/StdMeshObjTopologies.cpp @@ -26,7 +26,6 @@ */ #include -#include #include @@ -2760,7 +2759,7 @@ for (unsigned jc=0; jc < M; jc++) { bool end = (child[jc] == EUA || jc== M-1); - std::cout << (jc==0?"{":"") << (child[jc] == EUA?"EUA":boost::lexical_cast(child[jc])) << (end?(ic==(N-1)?"}\n":"},\n"):", "); + std::cout << (jc==0?"{":"") << (child[jc] == EUA?"EUA":std::to_string(child[jc])) << (end?(ic==(N-1)?"}\n":"},\n"):", "); if (end) break; } } diff --git a/packages/percept/src/percept/GeometryVerifier.cpp b/packages/percept/src/percept/GeometryVerifier.cpp index 53c239a6c0e3..b931b140401d 100644 --- a/packages/percept/src/percept/GeometryVerifier.cpp +++ b/packages/percept/src/percept/GeometryVerifier.cpp @@ -299,12 +299,12 @@ using namespace Intrepid; if ( stk::mesh::is_auto_declared_part(*part) ) continue; - const CellTopologyData * const part_cell_topo_data = stk::mesh::MetaData::get(bulk).get_cell_topology(*part).getCellTopologyData(); + const stk::topology part_cell_topo_data = stk::mesh::MetaData::get(bulk).get_topology(*part); //std::cout << "P[" << p_rank << "] part = " << part->name() << " part_cell_topo_data= " << part_cell_topo_data << " topo-name= " // << (part_cell_topo_data ? part_cell_topo_data->name : "null") << std::endl; - if (part_cell_topo_data) - jac_data[part_cell_topo_data->name] = jacData(); + if (part_cell_topo_data.is_valid()) + jac_data[part_cell_topo_data.char_name()] = jacData(); } for (unsigned ipass = 0; ipass < 1; ipass++) diff --git a/packages/percept/src/percept/Histograms.hpp b/packages/percept/src/percept/Histograms.hpp index bd94d1ceae4f..463f9348f9fe 100644 --- a/packages/percept/src/percept/Histograms.hpp +++ b/packages/percept/src/percept/Histograms.hpp @@ -42,7 +42,7 @@ { m_data = other.m_data; m_bar_symbol = other.m_bar_symbol; - m_max_column_width = m_max_column_width; + m_max_column_width = other.m_max_column_width; } std::vector m_data; diff --git a/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEM.hpp b/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEM.hpp index c73872e2a985..5c8037e0df3f 100644 --- a/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEM.hpp +++ b/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEM.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -10,9 +14,10 @@ // ************************************************************************ // // Intrepid Package -// Copyright (2007) Sandia Corporation +// Copyright (2002-2008, 2010, 2011) National Technology & +// Engineering Solutions of Sandia, LLC. // -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// Under terms of Contract DE-NA0003525, there is a non-exclusive // license for use of this work by or on behalf of the U.S. Government. // // This library is free software; you can redistribute it and/or modify diff --git a/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEMDef.hpp b/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEMDef.hpp index 73de2723bf2b..2316bee2b56f 100644 --- a/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEMDef.hpp +++ b/packages/percept/src/percept/Intrepid_HGRAD_HEX_C2_Serendipity_FEMDef.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -12,9 +16,10 @@ // ************************************************************************ // // Intrepid Package -// Copyright (2007) Sandia Corporation +// Copyright (2002-2008, 2010, 2011) National Technology & +// Engineering Solutions of Sandia, LLC. // -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// Under terms of Contract DE-NA0003525, there is a non-exclusive // license for use of this work by or on behalf of the U.S. Government. // // This library is free software; you can redistribute it and/or modify diff --git a/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEM.hpp b/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEM.hpp index 78a574419590..45fb2fe29baf 100644 --- a/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEM.hpp +++ b/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEM.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -10,9 +14,10 @@ // ************************************************************************ // // Intrepid Package -// Copyright (2007) Sandia Corporation +// Copyright (2002-2008, 2010, 2011) National Technology & +// Engineering Solutions of Sandia, LLC. // -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// Under terms of Contract DE-NA0003525, there is a non-exclusive // license for use of this work by or on behalf of the U.S. Government. // // This library is free software; you can redistribute it and/or modify diff --git a/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEMDef.hpp b/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEMDef.hpp index 5545ddc2f5a8..ed484aee21de 100644 --- a/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEMDef.hpp +++ b/packages/percept/src/percept/Intrepid_HGRAD_QUAD_C2_Serendipity_FEMDef.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -13,9 +17,10 @@ // ************************************************************************ // // Intrepid Package -// Copyright (2007) Sandia Corporation +// Copyright (2002-2008, 2010, 2011) National Technology & +// Engineering Solutions of Sandia, LLC. // -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// Under terms of Contract DE-NA0003525, there is a non-exclusive // license for use of this work by or on behalf of the U.S. Government. // // This library is free software; you can redistribute it and/or modify diff --git a/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEM.hpp b/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEM.hpp index 4841b76da6a4..9d6d6824b18f 100644 --- a/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEM.hpp +++ b/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEM.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -10,9 +14,10 @@ // ************************************************************************ // // Intrepid Package -// Copyright (2007) Sandia Corporation +// Copyright (2002-2008, 2010, 2011) National Technology & +// Engineering Solutions of Sandia, LLC. // -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// Under terms of Contract DE-NA0003525, there is a non-exclusive // license for use of this work by or on behalf of the U.S. Government. // // This library is free software; you can redistribute it and/or modify diff --git a/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEMDef.hpp b/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEMDef.hpp index e1e5b894eb7c..1feaff09c157 100644 --- a/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEMDef.hpp +++ b/packages/percept/src/percept/Intrepid_HGRAD_WEDGE_C2_Serendipity_FEMDef.hpp @@ -1,8 +1,12 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -12,9 +16,10 @@ // ************************************************************************ // // Intrepid Package -// Copyright (2007) Sandia Corporation +// Copyright (2002-2008, 2010, 2011) National Technology & +// Engineering Solutions of Sandia, LLC. // -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive +// Under terms of Contract DE-NA0003525, there is a non-exclusive // license for use of this work by or on behalf of the U.S. Government. // // This library is free software; you can redistribute it and/or modify diff --git a/packages/percept/src/percept/MeshType.hpp b/packages/percept/src/percept/MeshType.hpp index e71d12acb510..8ab22ca264ec 100644 --- a/packages/percept/src/percept/MeshType.hpp +++ b/packages/percept/src/percept/MeshType.hpp @@ -391,15 +391,5 @@ struct StructuredGrid { template void set_field(const double * fld, unsigned size, int index, PerceptMesh *eMesh, typename MeshType::MTField *field, typename MeshType::MTNode node); - - template - std::ostream& operator<<(std::ostream& os, const std::array& arr) - { - for (unsigned i=0; i < N; ++i) - os << arr[i] << (i == N-1 ? "" : " "); - return os; - } - - } #endif diff --git a/packages/percept/src/percept/NoMallocArray.hpp b/packages/percept/src/percept/NoMallocArray.hpp index e26c20aac146..d164498a6004 100644 --- a/packages/percept/src/percept/NoMallocArray.hpp +++ b/packages/percept/src/percept/NoMallocArray.hpp @@ -14,7 +14,7 @@ namespace percept { - // patterned after boost::array + // patterned after std::array template class NoMallocArray { @@ -161,9 +161,6 @@ const T* data() const { return m_data; } T* data() { return m_data; } - // use array as C array (direct read/write access to data) - T* c_array() { return m_data; } - // assignment with type conversion template NoMallocArray& operator= (const NoMallocArray& rhs) { diff --git a/packages/percept/src/percept/Percept.hpp b/packages/percept/src/percept/Percept.hpp index 0f1c6b39f24a..74799994dc07 100644 --- a/packages/percept/src/percept/Percept.hpp +++ b/packages/percept/src/percept/Percept.hpp @@ -58,29 +58,6 @@ #endif - -//------------------------------------------------------------------------------------------------------------------------ -//------------------------------------------------------------------------------------------------------------------------ -//----- PGI Compiler old-ness problem - unsupported on boost::ublas -//------------------------------------------------------------------------------------------------------------------------ -//------------------------------------------------------------------------------------------------------------------------ - -/* The following is to avoid the following error from boost::ublas libraries: - -"/scratch/srkenno/code/TPLs_src/boost/boost/numeric/ublas/detail/config.hpp", line 170: catastrophic error: - #error directive: Your compiler and/or configuration is unsupported - by this verions of uBLAS. Define BOOST_UBLAS_UNSUPPORTED_COMPILER=0 - to override this message. Boost 1.32.0 includes uBLAS with support - for many older compilers. - #error Your compiler and/or configuration is unsupported by this verions of uBLAS. Define BOOST_UBLAS_UNSUPPORTED_COMPILER=0 to - override this message. Boost 1.32.0 includes uBLAS with support for many older compilers. -*/ - -#if defined(__PGI) -#define BOOST_UBLAS_UNSUPPORTED_COMPILER 0 -#endif - - //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ //----- Geometry configuration diff --git a/packages/percept/src/percept/PerceptBoostArray.hpp b/packages/percept/src/percept/PerceptBoostArray.hpp index 22c45182bcac..41de384047c7 100644 --- a/packages/percept/src/percept/PerceptBoostArray.hpp +++ b/packages/percept/src/percept/PerceptBoostArray.hpp @@ -13,18 +13,15 @@ #pragma warning disable 2196 2536 279 #endif -#include -#include -#include -#include #include +#include namespace percept { template - inline std::ostream& operator<< (std::ostream& out, const boost::array& coll) + inline std::ostream& operator<< (std::ostream& out, const std::array& coll) { - typedef boost::array Array; + typedef std::array Array; typename Array::const_iterator pos; for (pos=coll.begin(); pos!=coll.end(); ++pos) { diff --git a/packages/percept/src/percept/PerceptMesh.cpp b/packages/percept/src/percept/PerceptMesh.cpp index d2519ea9edc3..5aa503804b5e 100644 --- a/packages/percept/src/percept/PerceptMesh.cpp +++ b/packages/percept/src/percept/PerceptMesh.cpp @@ -13,10 +13,9 @@ #include #include #include +#include #include -#include - #include #include @@ -510,8 +509,7 @@ for (unsigned ipart=0; ipart < nparts; ipart++) { stk::mesh::Part& part = *parts[ipart]; - //const CellTopologyData *const topology = PerceptMesh::get_cell_topology(part); - const CellTopologyData *const topology = metaData.get_cell_topology(part).getCellTopologyData(); + const stk::topology topology = metaData.get_topology(part); std::string subsets = "{"; const stk::mesh::PartVector &part_subsets = part.subsets(); if (part_subsets.size() > 0) { @@ -523,7 +521,7 @@ } subsets += "}"; stream << "P[" << p_rank << "] info> Part[" << ipart << "]= " << part.name() - << " topology = " << (topology?shards::CellTopology(topology).getName():"null") + << " topology = " << topology.name() << " primary_entity_rank = " << static_cast(part.primary_entity_rank()) << " is io_part= " << stk::io::is_part_io_part(part) << " subsets = " << subsets @@ -1099,91 +1097,6 @@ // return perm; // } - - - std::vector PerceptMesh::nodes_in_mesh(const std::vector& listOfNodes, std::vector& results, bool sorted) - { - std::vector resId; - std::vector subDim(1); - results.resize(0); - int numInMesh = 0; - for (unsigned ii=0; ii < listOfNodes.size(); ++ii) - { - std::vector tmp; - subDim[0] = listOfNodes[ii]; - int inM = in_mesh(subDim, tmp, sorted); - if (inM) - { - resId.push_back(listOfNodes[ii]); - numInMesh++; - } - results.insert(results.end(), tmp.begin(), tmp.end()); - } - return resId; - } - - /// return info about elements that contain the given collection of entities, false if none - int PerceptMesh::in_mesh(const std::vector& subDim0, std::vector& results, bool sorted) - { - results.resize(0); - - std::vector subDim = subDim0; - std::sort(subDim.begin(), subDim.end()); - const stk::mesh::BucketVector & element_buckets = get_bulk_data()->buckets( element_rank() ); - - for ( stk::mesh::BucketVector::const_iterator k = element_buckets.begin() ; k != element_buckets.end() ; ++k ) - { - stk::mesh::Bucket & bucket = **k ; - const CellTopologyData * const element_topo_data = PerceptMesh::get_cell_topology(bucket); - shards::CellTopology cell_topo(element_topo_data); - - const unsigned num_elements_in_bucket = bucket.size(); - for (unsigned iElem = 0; iElem < num_elements_in_bucket; iElem++) - { - stk::mesh::Entity element = bucket[iElem]; - for (stk::mesh::EntityRank subDimRank = element_rank(); subDimRank >= stk::topology::NODE_RANK; --subDimRank) - { - unsigned num_subdims = 1; - if (element_topo_data) - { - if (subDimRank == face_rank()) num_subdims = element_topo_data->side_count; - if (subDimRank == edge_rank()) num_subdims = element_topo_data->edge_count; - if (subDimRank == node_rank()) num_subdims = element_topo_data->vertex_count; - } - for (unsigned isubdim = 0; isubdim < num_subdims; isubdim++) - { - std::vector list, sorted_list; - if (!element_topo_data) - { - if (subDimRank == element_rank()) - { - const MyPairIterRelation elem_nodes(*get_bulk_data(), element, stk::topology::NODE_RANK ); - for (unsigned ii=0; ii < elem_nodes.size(); ++ii) - { - list.push_back(identifier(elem_nodes[ii].entity())); - } - } - else - { - continue; - } - } - else - { - get_subdim_entity(list, element, subDimRank, isubdim, sorted); - } - sorted_list = list; - std::sort(sorted_list.begin(), sorted_list.end()); - if (sorted_list == subDim) - results.push_back(SubDimInfoType(element, subDimRank, isubdim, list)); - //std::cout << results.front() << std::endl; - } - } - } - } - return results.size(); - } - std::string PerceptMesh::print_entity_compact_field_name(const stk::mesh::Entity entity, const std::string& fieldName, int prec) { stk::mesh::FieldBase *field = get_fem_meta_data()->get_field(node_rank(), fieldName); @@ -1633,7 +1546,7 @@ min_max_ave.val[2] = 0.0; min_max_ave.count = 0.0; - boost::unordered_map node_normals; + std::unordered_map node_normals; stk::mesh::Selector this_part(part); const stk::mesh::BucketVector & buckets = get_bulk_data()->buckets( side_rank() ); @@ -2271,18 +2184,22 @@ auto & bulk = *get_bulk_data(); requested_entities.clear(); requested_entities.reserve(count); + std::vector ids; + if (entityRank != get_fem_meta_data()->side_rank()) { + ids.reserve(count); + } for(int ii = 0; ii < count; ++ii) { - stk::mesh::Entity elem; if (entityRank == get_fem_meta_data()->side_rank()) { - elem = bulk.declare_solo_side(parts); + requested_entities.push_back(bulk.declare_solo_side(parts)); } else { - stk::mesh::EntityId id = getNextId(entityRank); - elem = bulk.declare_entity(entityRank, id, parts); + ids.push_back(getNextId(entityRank)); } - requested_entities.push_back(elem); + } + if (entityRank != get_fem_meta_data()->side_rank()) { + bulk.declare_entities(entityRank, ids, parts, requested_entities); } return true; } @@ -2772,55 +2689,6 @@ //======================================================================================================================== - /// transform mesh by a given 3x3 matrix -#if !STK_PERCEPT_LITE - void PerceptMesh::transform_mesh(MDArray& matrix) - { - if (matrix.rank() != 2) throw std::runtime_error("pass in a 3x3 matrix"); - if (matrix.dimension(0) != 3 || matrix.dimension(1) != 3) throw std::runtime_error("pass in a 3x3 matrix"); - Math::Matrix mat; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - { - mat(i,j) = matrix(i,j); - } - transform_mesh(mat); - } -#endif - - class MeshTransformer : public GenericFunction - { - Math::Matrix m_rotMat; - public: - - MeshTransformer(){} - MeshTransformer(Math::Matrix& m) : m_rotMat(m) {} - virtual void operator()(MDArray& domain, MDArray& codomain, double time_value_optional=0.0) - { - double x = domain(0); - double y = domain(1); - double z = (domain.dimension(0) == 2 ? 0 : domain(2)); - Math::Vector v; - v(0)=x; - v(1)=y; - v(2)=z; - v = m_rotMat * v; - codomain(0)=v(0); - codomain(1)=v(1); - if (codomain.dimension(0) == 3 ) codomain(2)= v(2); - } - - }; - /// transform mesh by a given 3x3 matrix - void PerceptMesh::transform_mesh(Math::Matrix& matrix) - { -#if defined(STK_PERCEPT_LITE) && STK_PERCEPT_LITE == 1 - VERIFY_MSG("not available in PerceptMeshLite"); -#else - MeshTransformer xform(matrix); - nodalOpLoop(*get_bulk_data(), xform, get_coordinates_field()); -#endif - } void PerceptMesh::checkForPartsToAvoidWriting() { @@ -3837,8 +3705,8 @@ { stk::mesh::Part& part_1 = *parts_1[ipart]; stk::mesh::Part& part_2 = *parts_2[ipart]; - const CellTopologyData *const topology_1 = metaData_1.get_cell_topology(part_1).getCellTopologyData(); - const CellTopologyData *const topology_2 = metaData_2.get_cell_topology(part_2).getCellTopologyData(); + const stk::topology topology_1 = metaData_1.get_topology(part_1); + const stk::topology topology_2 = metaData_2.get_topology(part_2); if (part_1.subsets().size() != part_2.subsets().size()) { msg += std::string("| parts subsets size diff ")+part_1.name()+" "+part_2.name()+" | "; @@ -3846,14 +3714,9 @@ } if (part_1.name() != part_2.name()) { msg += "|part names diff "+part_1.name()+" "+part_2.name()+" | "; diff = true; } - if ((topology_1 != topology_2) || - ((std::string(topology_1?shards::CellTopology(topology_1).getName():"null") != - std::string(topology_2?shards::CellTopology(topology_2).getName():"null") )) - ) + if (topology_1 != topology_2) { - msg += "| part topology diff "+ - std::string(topology_1?shards::CellTopology(topology_1).getName():"null")+" "+ - std::string(topology_2?shards::CellTopology(topology_2).getName():"null"); + msg += "| part topology diff "+ topology_1.name() + " " + topology_2.name(); diff = true; } @@ -5699,7 +5562,7 @@ block = block & owned; get_selected_entities( block, get_bulk_data()->buckets(element_rank()), - owned_elements); + owned_elements, false/*don't sort*/); //Part * skin_part = 0; stk::mesh::EntityVector elements_closure; @@ -5853,7 +5716,7 @@ if (end_bit == "mag") index = -1; else - index = boost::lexical_cast(end_bit); + index = std::stoi(end_bit); fname = fname.substr(0,pos-1); } field_stats(iter->second.m_data, fname, index); @@ -7112,7 +6975,7 @@ { eMesh.get_bulk_data()->modification_begin(); std::vector vecNodes; - stk::mesh::get_selected_entities(sel & stk::mesh::selectUnion(parts) , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.node_rank()), vecNodes); + stk::mesh::get_selected_entities(sel & stk::mesh::selectUnion(parts) , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.node_rank()), vecNodes, false/*don't sort*/); stk::mesh::Part& nodePart = eMesh.get_fem_meta_data()->get_topology_root_part(stk::topology::NODE); for (size_t ii = 0; ii < vecNodes.size(); ++ii) @@ -7121,7 +6984,7 @@ eMesh.get_bulk_data()->set_local_id(node, ii); } - stk::mesh::get_selected_entities(sel & stk::mesh::selectUnion(parts) , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.node_rank()), vecNodes); + stk::mesh::get_selected_entities(sel & stk::mesh::selectUnion(parts) , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.node_rank()), vecNodes, false/*don't sort*/); for (size_t ii = 0; ii < vecNodes.size(); ++ii) { stk::mesh::Entity oldNode = vecNodes[ii]; @@ -7186,8 +7049,8 @@ VERIFY_OP_ON(newPart, !=, 0, "hmm "+ partsAll[iPart]->name()); std::vector vecFaces, vecShells; - stk::mesh::get_selected_entities(sel1 , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.side_rank()), vecFaces); - stk::mesh::get_selected_entities(sel1 , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.element_rank()), vecShells); + stk::mesh::get_selected_entities(sel1 , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.side_rank()), vecFaces, false/*don't sort*/); + stk::mesh::get_selected_entities(sel1 , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.element_rank()), vecShells, false/*don't sort*/); //if (1) std::cout << "P[" << thisPerceptMesh.get_rank() << "] vecFaces.size= " << vecFaces.size() << " vecShells.size= " << vecShells.size() << std::endl; vecFaces.insert(vecFaces.end(), vecShells.begin(), vecShells.end()); for (unsigned ii=0; ii < vecFaces.size(); ++ii) @@ -7236,7 +7099,7 @@ } } std::vector vecNodes; - stk::mesh::get_selected_entities(sel & stk::mesh::selectUnion(partsAll) , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.node_rank()), vecNodes); + stk::mesh::get_selected_entities(sel & stk::mesh::selectUnion(partsAll) , thisPerceptMesh.get_bulk_data()->buckets(thisPerceptMesh.node_rank()), vecNodes, false/*don't sort*/); for (unsigned ii = 0; ii < vecNodes.size(); ++ii) { @@ -7314,11 +7177,11 @@ double uv[2] = {U,V}; TriQuadSurfaceMesh3D::Point p = {{0, 0, 0}}; - evaluator.evaluateGregoryPatch(uv, element, p.c_array()); + evaluator.evaluateGregoryPatch(uv, element, p.data()); if (debug) { std::cout << "crm: face= " << iMesh.id(element) << " uv= " << Math::print_2d(uv) - << " xyz= " << Math::print_3d(p.c_array()) << " idStart= " << idStart << std::endl; + << " xyz= " << Math::print_3d(p.data()) << " idStart= " << idStart << std::endl; } coords.push_back(p); nodeIdMap.push_back(idStart + kk); @@ -7353,11 +7216,11 @@ double U = double(iU)/double(n); double uv[2] = {U,V}; TriQuadSurfaceMesh3D::Point p = {{0, 0, 0}}; - evaluator.evaluateGregoryPatch(uv, element, p.c_array()); + evaluator.evaluateGregoryPatch(uv, element, p.data()); if (debug) { std::cout << "crm: face= " << iMesh.id(element) << " uv= " << Math::print_2d(uv) - << " xyz= " << Math::print_3d(p.c_array()) << std::endl; + << " xyz= " << Math::print_3d(p.data()) << std::endl; } coords.push_back(p); nodeIdMap.push_back(idStart + kk); diff --git a/packages/percept/src/percept/PerceptMesh.hpp b/packages/percept/src/percept/PerceptMesh.hpp index ef41172975e2..c1040a531a9e 100644 --- a/packages/percept/src/percept/PerceptMesh.hpp +++ b/packages/percept/src/percept/PerceptMesh.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -23,9 +24,6 @@ #include #endif -#include - - #include #include #include @@ -74,14 +72,11 @@ #include "Teuchos_RCP.hpp" -//#include "PerceptMeshReadWrite.hpp" #include #include #include -#include - #if !STK_PERCEPT_LITE #include #endif @@ -269,14 +264,7 @@ stk::mesh::Entity& element_found, unsigned& side_ord_found, bool debug=false); - typedef boost::tuple > SubDimInfoType; - - /// return info about elements that contain the given collection of entities - returns the number of results found - int in_mesh(const std::vector& subDim, std::vector& results, bool sorted=true); - - /// treat the listOfNodes individually, calling in_mesh with a single node at a time from the list and - /// coalescing the results - returns which ones in listOfNodes are in the mesh - std::vector nodes_in_mesh(const std::vector& listOfNodes, std::vector& results, bool sorted=true); + typedef std::tuple > SubDimInfoType; /// for surface faces (tri's and quad's) find if the given parametric coords are inside bool in_face(stk::mesh::Entity face, const double *uv, const double tol=1.e-5) const; @@ -439,11 +427,6 @@ /// return the number of steps in the database int get_database_time_step_count(); -#if !STK_PERCEPT_LITE - /// transform mesh by a given 3x3 matrix - void transform_mesh(MDArray& matrix); -#endif - /// add coordinate-like fields needed, for example, to use smoothing of geometry-projected refined meshes /// Must be called before commit() void add_coordinate_state_fields(const bool output_fields=false); @@ -716,9 +699,6 @@ void set_sync_io_regions(bool val) { m_sync_io_regions = val; } void set_remove_io_orig_topo_type(bool val) { m_remove_io_orig_topo_type = val; } - /// transform mesh by a given 3x3 matrix - void transform_mesh(Math::Matrix& matrix); - /// return true if the two meshes are different; if @param print is true, print diffs; set print_all_field_diffs to get more output static bool mesh_difference(stk::mesh::MetaData& metaData_1, stk::mesh::MetaData& metaData_2, @@ -1022,7 +1002,7 @@ } const CellTopologyData * get_cell_topology(const stk::mesh::Part& thing) { - const CellTopologyData * cell_topo_data = get_fem_meta_data()->get_cell_topology(thing).getCellTopologyData(); + const CellTopologyData * cell_topo_data = stk::mesh::get_cell_topology(get_fem_meta_data()->get_topology(thing)).getCellTopologyData(); return cell_topo_data; } diff --git a/packages/percept/src/percept/SameRankRelation.hpp b/packages/percept/src/percept/SameRankRelation.hpp deleted file mode 100644 index 4b9c8c91d5db..000000000000 --- a/packages/percept/src/percept/SameRankRelation.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef percept_SameRankRelation_hpp -#define percept_SameRankRelation_hpp - -//#include - -#include -//#include -//#include - -/// define only one of these to be 1 -#define SAME_RANK_RELATION_MAP_TYPE_BOOST 1 -#define SAME_RANK_RELATION_MAP_TYPE_TR1 0 -#define SAME_RANK_RELATION_MAP_TYPE_STD 0 - -#if SAME_RANK_RELATION_MAP_TYPE_BOOST -#include -#endif - -#if SAME_RANK_RELATION_MAP_TYPE_STD -#include -#endif - -#if SAME_RANK_RELATION_MAP_TYPE_TR1 -#include -#endif - - namespace percept { - - - typedef std::vector PerceptEntityVector; - typedef stk::mesh::Entity SameRankRelationKey; - typedef PerceptEntityVector SameRankRelationValue; - typedef boost::unordered_map SameRankRelation; - - - } - -#endif diff --git a/packages/percept/src/percept/SetOfEntities.hpp b/packages/percept/src/percept/SetOfEntities.hpp index ced1e552b583..e41dc685b8e3 100644 --- a/packages/percept/src/percept/SetOfEntities.hpp +++ b/packages/percept/src/percept/SetOfEntities.hpp @@ -9,60 +9,14 @@ #ifndef SetOfEntities_hpp #define SetOfEntities_hpp -#define PERCEPT_USE_STD_SET 0 -#define PERCEPT_USE_STD_POOLED_SET 1 -#define PERCEPT_USE_STD_USET 0 - -#if PERCEPT_USE_STD_USET -#include -#include -#endif - -#if PERCEPT_USE_STD_POOLED_SET -#include -#include -#endif - namespace percept { -#if PERCEPT_USE_STD_SET - //typedef std::set SetOfEntitiesBase; - typedef std::set SetOfEntitiesBase; - struct SetOfEntities : public SetOfEntitiesBase - { - SetOfEntities() : SetOfEntitiesBase() {} - SetOfEntities(stk::mesh::BulkData& bulk) : SetOfEntitiesBase() {} - }; -#endif - -#if PERCEPT_USE_STD_USET - typedef std::unordered_set SetOfEntitiesBase; - struct SetOfEntities : public SetOfEntitiesBase - { - SetOfEntities() : SetOfEntitiesBase() {} - SetOfEntities(stk::mesh::BulkData& bulk) : SetOfEntitiesBase() {} - }; - -#endif - -#if PERCEPT_USE_STD_POOLED_SET - - // this is the expected number of elements that are node neighbors of any element - enum { PERCEPT_POOLED_SET_POOL_SIZE = 100 }; - - - template > + template, typename Allocator = std::allocator > struct SetOfEntitiesBase { - typedef std::set - > Type; + typedef std::set Type; typedef Less less; - }; struct SetOfEntities : public SetOfEntitiesBase::Type @@ -71,12 +25,6 @@ SetOfEntities(stk::mesh::BulkData& bulk) {} }; - - //typedef std::set ElementUnrefineCollection; - //typedef elements_to_be_destroyed_type ElementUnrefineCollection; - -#endif - } #endif diff --git a/packages/percept/src/percept/ShardsInterfaceTable.cpp b/packages/percept/src/percept/ShardsInterfaceTable.cpp index 425ed7d88426..e2a284c3860c 100644 --- a/packages/percept/src/percept/ShardsInterfaceTable.cpp +++ b/packages/percept/src/percept/ShardsInterfaceTable.cpp @@ -20,7 +20,7 @@ using namespace shards; { shards_Particle , getCellTopologyData< shards::Particle >(), 0, shards::Particle::vertex_count, shards::Particle::node_count , -1 , 0}, { shards_Line_2 , getCellTopologyData< shards::Line<2> >(), 0, shards::Line<2>::vertex_count, shards::Line<2>::node_count , shards_Quadrilateral_4 , - stk::mesh::set_cell_topology< shards::Line<2> > }, + stk::mesh::set_topology< stk::topology::LINE_2 > }, { shards_ShellLine_2 , getCellTopologyData< shards::ShellLine<2> >(), 0, shards::ShellLine<2>::vertex_count, shards::ShellLine<2>::node_count , -1 , 0}, { shards_ShellLine_3 , getCellTopologyData< shards::ShellLine<3> >(), 0, shards::ShellLine<3>::vertex_count, shards::ShellLine<3>::node_count , -1 , 0}, @@ -28,13 +28,13 @@ using namespace shards; { shards_Beam_3 , getCellTopologyData< shards::Beam<3> >(), 0, shards::Beam<3>::vertex_count, shards::Beam<3>::node_count , -1 , 0}, { shards_Triangle_3 , getCellTopologyData< shards::Triangle<3> >(), 0, shards::Triangle<3>::vertex_count, shards::Triangle<3>::node_count , shards_Wedge_6 , - stk::mesh::set_cell_topology< shards::Triangle<3> > }, + stk::mesh::set_topology< stk::topology::TRI_3 > }, { shards_Triangle_6 , getCellTopologyData< shards::Triangle<6> >(), 0, shards::Triangle<6>::vertex_count, shards::Triangle<6>::node_count , -1 , 0}, { shards_ShellTriangle_3 , getCellTopologyData< shards::ShellTriangle<3> >(), 0, shards::ShellTriangle<3>::vertex_count, shards::ShellTriangle<3>::node_count , -1 , 0}, { shards_ShellTriangle_6 , getCellTopologyData< shards::ShellTriangle<6> >(), 0, shards::ShellTriangle<6>::vertex_count, shards::ShellTriangle<6>::node_count , -1 , 0}, { shards_Quadrilateral_4 , getCellTopologyData< shards::Quadrilateral<4> >(), 0, shards::Quadrilateral<4>::vertex_count, shards::Quadrilateral<4>::node_count , shards_Hexahedron_8 , - stk::mesh::set_cell_topology< shards::Quadrilateral<4> > }, + stk::mesh::set_topology< stk::topology::QUAD_4 > }, { shards_Quadrilateral_8 , getCellTopologyData< shards::Quadrilateral<8> >(), 0, shards::Quadrilateral<8>::vertex_count, shards::Quadrilateral<8>::node_count , -1 , 0}, { shards_Quadrilateral_9 , getCellTopologyData< shards::Quadrilateral<9> >(), 0, shards::Quadrilateral<9>::vertex_count, shards::Quadrilateral<9>::node_count , -1 , 0}, { shards_ShellQuadrilateral_4 , getCellTopologyData< shards::ShellQuadrilateral<4> >(), 0, shards::ShellQuadrilateral<4>::vertex_count, shards::ShellQuadrilateral<4>::node_count , -1 , 0}, @@ -45,7 +45,7 @@ using namespace shards; { shards_Hexagon_6 , getCellTopologyData< shards::Hexagon<6> >(), 0, shards::Hexagon<6>::vertex_count, shards::Hexagon<6>::node_count , -1 , 0}, { shards_Tetrahedron_4 , getCellTopologyData< shards::Tetrahedron<4> >(), 0, shards::Tetrahedron<4>::vertex_count, shards::Tetrahedron<4>::node_count , -1 , - stk::mesh::set_cell_topology< shards::Tetrahedron<4> >}, + stk::mesh::set_topology< stk::topology::TET_4 >}, { shards_Tetrahedron_10 , getCellTopologyData< shards::Tetrahedron<10> >(), 0, shards::Tetrahedron<10>::vertex_count, shards::Tetrahedron<10>::node_count , -1 , 0}, { shards_Pyramid_5 , getCellTopologyData< shards::Pyramid<5> >(), 0, shards::Pyramid<5>::vertex_count, shards::Pyramid<5>::node_count , -1 , 0}, @@ -53,12 +53,12 @@ using namespace shards; { shards_Pyramid_14 , getCellTopologyData< shards::Pyramid<14> >(), 0, shards::Pyramid<14>::vertex_count, shards::Pyramid<14>::node_count , -1 , 0}, { shards_Wedge_6 , getCellTopologyData< shards::Wedge<6> >(), 0, shards::Wedge<6>::vertex_count, shards::Wedge<6>::node_count , -1 , - stk::mesh::set_cell_topology< shards::Wedge<6> >}, + stk::mesh::set_topology< stk::topology::WEDGE_6 >}, { shards_Wedge_15 , getCellTopologyData< shards::Wedge<15> >(), 0, shards::Wedge<15>::vertex_count, shards::Wedge<15>::node_count , -1 , 0}, { shards_Wedge_18 , getCellTopologyData< shards::Wedge<18> >(), 0, shards::Wedge<18>::vertex_count, shards::Wedge<18>::node_count , -1 , 0}, { shards_Hexahedron_8 , getCellTopologyData< shards::Hexahedron<8> >(), 0, shards::Hexahedron<8>::vertex_count, shards::Hexahedron<8>::node_count , -1 , - stk::mesh::set_cell_topology< shards::Hexahedron<8> > }, + stk::mesh::set_topology< stk::topology::HEX_8 > }, { shards_Hexahedron_20 , getCellTopologyData< shards::Hexahedron<20> >(), 0, shards::Hexahedron<20>::vertex_count, shards::Hexahedron<20>::node_count , -1 , 0}, { shards_Hexahedron_27 , getCellTopologyData< shards::Hexahedron<27> >(), 0, shards::Hexahedron<27>::vertex_count, shards::Hexahedron<27>::node_count , -1 , 0} diff --git a/packages/percept/src/percept/ShardsInterfaceTable.hpp b/packages/percept/src/percept/ShardsInterfaceTable.hpp index b77704e5f439..0ff90232842a 100644 --- a/packages/percept/src/percept/ShardsInterfaceTable.hpp +++ b/packages/percept/src/percept/ShardsInterfaceTable.hpp @@ -32,7 +32,7 @@ namespace percept { namespace interface_table { - typedef void (*stk_set_cell_topology_fptr)(stk::mesh::Part & ); + typedef void (*stk_set_topology_fptr)(stk::mesh::Part & ); enum ElemTypes { @@ -87,7 +87,7 @@ unsigned vertex_count; unsigned node_count; int sweptElemType; - stk_set_cell_topology_fptr setCellTopoFptr; + stk_set_topology_fptr setCellTopoFptr; } elemInfoType; diff --git a/packages/percept/src/percept/SmoothingHelperFunctions.cpp b/packages/percept/src/percept/SmoothingHelperFunctions.cpp index 777f999011ab..6c1dc0d033c5 100644 --- a/packages/percept/src/percept/SmoothingHelperFunctions.cpp +++ b/packages/percept/src/percept/SmoothingHelperFunctions.cpp @@ -83,8 +83,8 @@ namespace percept unsigned per = parts[ip]->primary_entity_rank(); if (per == stk::topology::ELEMENT_RANK) { - const CellTopologyData *const topology = metaData->get_cell_topology(*parts[ip]).getCellTopologyData(); - if (!topology || topology->dimension != per) + const stk::topology topology = metaData->get_topology(*parts[ip]); + if (!topology.is_valid() || topology.dimension() != per) { std::cout << "Warning: PerceptMesh::get_skin_part: skipping part with dimension < element_rank, part name= " << parts[ip]->name() << std::endl; continue; diff --git a/packages/percept/src/percept/Stacktrace.hpp b/packages/percept/src/percept/Stacktrace.hpp index f4e7985f3ffe..66ce23cffb9d 100644 --- a/packages/percept/src/percept/Stacktrace.hpp +++ b/packages/percept/src/percept/Stacktrace.hpp @@ -17,10 +17,9 @@ #include #endif -#include - #include #include +#include namespace percept { @@ -39,8 +38,6 @@ namespace percept { #else # define STACKTRACE_POS() do { } while(0) #endif - //#define STACKTRACE_POS_I(i) do { Stacktrace::s_position = i + boost::lexical_cast(__LINE__); } while(0) - //#define STACKTRACE_POS() STACKTRACE_POS_I(0) class Stacktrace { public: diff --git a/packages/percept/src/percept/Util.hpp b/packages/percept/src/percept/Util.hpp index 3ee8a0d26005..c3d71ca72e78 100644 --- a/packages/percept/src/percept/Util.hpp +++ b/packages/percept/src/percept/Util.hpp @@ -39,7 +39,6 @@ #include #include -#include #include @@ -261,7 +260,7 @@ namespace shards { //======================================================================================================================== template - std::string toString(T t) { return boost::lexical_cast(t); } + std::string toString(T t) { return std::to_string(t); } inline std::string toString(stk::topology::rank_t t) { return toString(static_cast(t)); } @@ -273,7 +272,7 @@ namespace shards { inline T SQR(T t) { return t*t; } - inline int toInt(std::string t) { return boost::lexical_cast(t); } + inline int toInt(std::string t) { return std::stoi(t); } //======================================================================================================================== diff --git a/packages/percept/src/percept/eigen_verify/EigenVerify.cpp b/packages/percept/src/percept/eigen_verify/EigenVerify.cpp index 9f1da313eb80..89a42d130196 100644 --- a/packages/percept/src/percept/eigen_verify/EigenVerify.cpp +++ b/packages/percept/src/percept/eigen_verify/EigenVerify.cpp @@ -262,7 +262,7 @@ void EigenVerify::run(int argc, char** argv) stk::mesh::Field * coordinates_to = mesh_data[1]->meta_data().get_field >(stk::topology::NODE_RANK, "coordinates"); - boost::shared_ptr mesh_transfer_01 = + std::shared_ptr mesh_transfer_01 = buildSTKMeshTransfer(mesh_data[0]->bulk_data(), coordinates_from, fieldAll[0], diff --git a/packages/percept/src/percept/fixtures/BeamFixture.cpp b/packages/percept/src/percept/fixtures/BeamFixture.cpp index da48009cd169..c1acb74414c9 100644 --- a/packages/percept/src/percept/fixtures/BeamFixture.cpp +++ b/packages/percept/src/percept/fixtures/BeamFixture.cpp @@ -22,7 +22,7 @@ #include #include - +#include #include #include @@ -45,6 +45,7 @@ { // Define where fields exist on the mesh: stk::mesh::Part & universal = m_metaData.universal_part(); + stk::mesh::FieldTraits::data_type* init_c = nullptr; // gcc 4.8 hack stk::mesh::FieldTraits::data_type* init_s = nullptr; // gcc 4.8 hack put_field_on_mesh( m_coordinates_field , universal, init_c); diff --git a/packages/percept/src/percept/fixtures/PyramidFixture.cpp b/packages/percept/src/percept/fixtures/PyramidFixture.cpp index e142a69eb937..884f452ce745 100644 --- a/packages/percept/src/percept/fixtures/PyramidFixture.cpp +++ b/packages/percept/src/percept/fixtures/PyramidFixture.cpp @@ -80,7 +80,6 @@ stk::io::put_io_part_attribute(*m_sideset_tri); m_metaData.declare_part_subset(*m_sideset_tri, *m_sideset_tri_subset); } - stk::mesh::FieldTraits::data_type* init_c = nullptr; // gcc 4.8 hack stk::mesh::FieldTraits::data_type* init_s = nullptr; // gcc 4.8 hack diff --git a/packages/percept/src/percept/fixtures/QuadFixture.hpp b/packages/percept/src/percept/fixtures/QuadFixture.hpp index baa96efc1d98..11c7793fe1fb 100644 --- a/packages/percept/src/percept/fixtures/QuadFixture.hpp +++ b/packages/percept/src/percept/fixtures/QuadFixture.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -53,7 +54,7 @@ /// Topology can also be Triangle<3> - template > + template class QuadFixture { stk::mesh::EntityId exodus_side_id(stk::mesh::EntityId element_id, unsigned which_side_ord) @@ -65,8 +66,8 @@ public: // typedef int Scalar ; //typedef double Scalar ; - typedef Topology QuadOrTriTopo ; - enum { NodesPerElem = QuadOrTriTopo::node_count }; +// typedef Topology QuadOrTriTopo ; + enum { NodesPerElem = stk::topology_detail::topology_data::num_nodes }; typedef stk::mesh::Field CoordFieldType; typedef stk::mesh::Field CoordGatherFieldType; @@ -99,8 +100,7 @@ set_bounding_box(0,(double)NX,0,(double)NY); // Set topology of the element block part - //stk::mesh::set_cell_topology(meta_data, quad_part, CellTopology(shards::getCellTopologyData()) ); - stk::mesh::set_cell_topology(quad_part); + stk::mesh::set_topology(quad_part, Topology); stk::io::put_io_part_attribute(quad_part); //put coord-field on all nodes: @@ -353,13 +353,9 @@ if (!debug_geom_side_sets_as_blocks) { std::string topo_name = NodesPerElem == 4 ? "surface_quad4_edge2_" : "surface_tri3_edge2_" ; - side_parts[i_side] = &meta_data.declare_part(topo_name+boost::lexical_cast(i_side+1), stk::topology::EDGE_RANK); - stk::mesh::Part& side_part = meta_data.declare_part(std::string("surface_")+boost::lexical_cast(i_side+1), stk::topology::EDGE_RANK); - //void set_cell_topology(MetaData & fem_meta, Part &part, CellTopology cell_topology); - - //stk::mesh::set_cell_topology< shards::Line<2> >(*side_parts[i_side]); - //stk::mesh::set_cell_topology(meta_data, *side_parts[i_side], CellTopology(shards::getCellTopologyData()) ); - stk::mesh::set_cell_topology< shards::Line<2> >(*side_parts[i_side]); + side_parts[i_side] = &meta_data.declare_part(topo_name+std::to_string(i_side+1), stk::topology::EDGE_RANK); + stk::mesh::Part& side_part = meta_data.declare_part(std::string("surface_")+std::to_string(i_side+1), stk::topology::EDGE_RANK); + stk::mesh::set_topology< stk::topology::LINE_2 >(*side_parts[i_side]); stk::io::put_io_part_attribute(*side_parts[i_side]); stk::io::put_io_part_attribute(side_part); @@ -367,10 +363,7 @@ } else { - //side_parts[i_side] = &meta_data.declare_part(std::string("block_1000")+boost::lexical_cast(i_side+1), meta_data.edge_rank()); - side_parts[i_side] = &meta_data.declare_part_with_topology(std::string("block_1000")+boost::lexical_cast(i_side+1), stk::topology::BEAM_2); - //, m_block_beam( m_metaData.declare_part< Beam2 >( "block_2" ) ) - //stk::mesh::set_cell_topology< shards::Beam<2> >(*side_parts[i_side]); + side_parts[i_side] = &meta_data.declare_part_with_topology(std::string("block_1000")+std::to_string(i_side+1), stk::topology::BEAM_2); stk::io::put_io_part_attribute(*side_parts[i_side]); } diff --git a/packages/percept/src/percept/fixtures/TriQuadSurfaceMesh3D.hpp b/packages/percept/src/percept/fixtures/TriQuadSurfaceMesh3D.hpp index 77208b522aaa..c9df7c41fd89 100644 --- a/packages/percept/src/percept/fixtures/TriQuadSurfaceMesh3D.hpp +++ b/packages/percept/src/percept/fixtures/TriQuadSurfaceMesh3D.hpp @@ -45,7 +45,7 @@ public: //typedef double Point[3]; - typedef boost::array Point; + typedef std::array Point; typedef stk::mesh::EntityIdVector QuadIds; typedef stk::mesh::EntityIdVector TriIds; diff --git a/packages/percept/src/percept/fixtures/WedgeFixture.hpp b/packages/percept/src/percept/fixtures/WedgeFixture.hpp index 963951d5b48d..4e2ffafe6136 100644 --- a/packages/percept/src/percept/fixtures/WedgeFixture.hpp +++ b/packages/percept/src/percept/fixtures/WedgeFixture.hpp @@ -52,7 +52,7 @@ { bool verbose = false; - std::vector > coordsLine(n_nodes_x); + std::vector > coordsLine(n_nodes_x); for (unsigned ix = 0; ix < n_nodes_x; ix++) { double dx = double(ix)/double(n_nodes_x - 1); @@ -78,7 +78,7 @@ tp2.dump(); // sweep to make a quad mesh from line mesh - boost::array dir = {{0, (ymax-ymin)/double(n_nodes_y - 1),0}}; + std::array dir = {{0, (ymax-ymin)/double(n_nodes_y - 1),0}}; TransformDir xf0 ( dir ); Transform* xf = &xf0; @@ -102,7 +102,7 @@ //tp2.writeSTKMesh("tp2-quad-tri.e"); // sweep again to make a wedge mesh - boost::array dir1 = {{0,0,(zmax-zmin)/double(n_nodes_z - 1)}}; + std::array dir1 = {{0,0,(zmax-zmin)/double(n_nodes_z - 1)}}; TransformDir xf01(dir1); Transform* xf01t = &xf01; std::vector xforms0(n_nodes_z - 1, xf01t); @@ -138,7 +138,7 @@ { bool verbose = true; - boost::array coordsLine[] = { + std::array coordsLine[] = { {{0,0,0}}, {{1,0,0}}, {{2,0,0}}, {{3,0,0}}, {{4,0,0}} }; @@ -170,7 +170,7 @@ tp2.dump(); // sweep to make a quad mesh from line mesh - boost::array dir = {{0,1.234,0}}; + std::array dir = {{0,1.234,0}}; TransformDir xf0 ( dir ); Transform* xf = &xf0; @@ -196,7 +196,7 @@ //tp2.writeSTKMesh("tp2-quad-tri.e"); // sweep again to make a wedge mesh - boost::array dir1 = {{0,0,2.345}}; + std::array dir1 = {{0,0,2.345}}; std::vector xforms0(1); TransformDir xf01(dir1); xforms0[0] = &xf01; diff --git a/packages/percept/src/percept/function/StringFunction.cpp b/packages/percept/src/percept/function/StringFunction.cpp index c4cdf0f89ab1..230439037431 100644 --- a/packages/percept/src/percept/function/StringFunction.cpp +++ b/packages/percept/src/percept/function/StringFunction.cpp @@ -23,7 +23,6 @@ #include #include #include -#include namespace percept { @@ -75,7 +74,7 @@ m_gradient_string = ""; m_spatialDim = len; for (int i = 0; i < len; i++) - m_gradient_string += "v["+boost::lexical_cast(i)+"]= "+gstring[i]+";"; + m_gradient_string += "v["+std::to_string(i)+"]= "+gstring[i]+";"; } void @@ -86,7 +85,7 @@ m_gradient_string = ""; m_spatialDim = len; for (int i = 0; i < len; i++) - m_gradient_string += "v["+boost::lexical_cast(i)+"]= "+gstring(i)+";"; + m_gradient_string += "v["+std::to_string(i)+"]= "+gstring(i)+";"; } // new StringFunction = lhs OP rhs @@ -217,7 +216,7 @@ } if (deriv_spec.dimension(0) > 1) { - out_str += "v["+boost::lexical_cast(iresult)+"]= " + fstr+";"; + out_str += "v["+std::to_string(iresult)+"]= " + fstr+";"; } else { @@ -234,7 +233,7 @@ Teuchos::RCP StringFunction::derivative_test_fd(MDArrayString& deriv_spec, double eps) { - std::string eps_string = boost::lexical_cast(eps); + std::string eps_string = std::to_string(eps); std::string fstr = m_func_string; std::string fstr_p = m_func_string; std::string fstr_m = m_func_string; @@ -259,7 +258,7 @@ } if (deriv_spec.dimension(0) > 1) { - out_str += "v["+boost::lexical_cast(iresult)+"]= " + fstr+";"; + out_str += "v["+std::to_string(iresult)+"]= " + fstr+";"; } else { diff --git a/packages/percept/src/percept/math/Math.hpp b/packages/percept/src/percept/math/Math.hpp index 57128b74236c..052f0d8eae06 100644 --- a/packages/percept/src/percept/math/Math.hpp +++ b/packages/percept/src/percept/math/Math.hpp @@ -21,59 +21,15 @@ #include -#include -#include -#include - #include #include namespace percept { - namespace ublas = boost::numeric::ublas; - class Math { public: - typedef ublas::c_matrix Matrix; - - typedef ublas::c_vector Vector; - - typedef ublas::c_vector ubvec; - - class MyVector : public ubvec - { - public: - - MyVector(double x=0.0) : ubvec() - { - (*this)(0) = x; - (*this)(1) = x; - (*this)(2) = x; - } - - MyVector(double *x) : ubvec() - { - (*this)(0) = x[0]; - (*this)(1) = x[1]; - (*this)(2) = x[2]; - } - //Vector(const ubvec& v) : ubvec(v) {} - - MyVector& operator=(const ubvec& v) - { - //ubvec& v0 = ubvec::operator=(v); - (*this)(0) = v(0); - (*this)(1) = v(1); - (*this)(2) = v(2); - return *this; - } - - //v = ublas::prod(m_rotMat, v); - - }; - static double my_abs_hi(double x, double eps=1.e-6) { return std::sqrt(x*x + eps*eps); } static double my_min_hi(double x, double y, double eps=1.e-6) { return 0.5*(x+y - my_abs_hi(x-y,eps)); } static double my_max_hi(double x, double y, double eps=1.e-6) { return 0.5*(x+y + my_abs_hi(x-y,eps)); } @@ -86,55 +42,6 @@ namespace percept { return (rnd+1.0)/2.0; } - static Matrix rotationMatrix(int axis, double angle_degrees) - { - Matrix rm; - rm.clear(); - double theta = M_PI * angle_degrees / 180.0; - double cost = std::cos(theta); - double sint = std::sin(theta); - if (axis == 2) - { - rm(0,0) = cost; rm(0,1) = -sint; - rm(1,0) = sint; rm(1,1) = cost; - rm(2,2) = 1.0; - } - else if (axis == 1) - { - rm(0,0) = cost; rm(0,2) = -sint; - rm(2,0) = sint; rm(2,2) = cost; - rm(1,1) = 1.0; - } - else if (axis == 0) - { - rm(1,1) = cost; rm(1,2) = -sint; - rm(2,1) = sint; rm(2,2) = cost; - rm(0,0) = 1.0; - } - return rm; - } - - static Matrix scalingMatrix(int axis, double scale) - { - Matrix sm; - sm.clear(); - sm(0,0)=1.0; - sm(1,1)=1.0; - sm(2,2)=1.0; - sm(axis,axis)=scale; - return sm; - } - - static Matrix scalingMatrix( double scale) - { - Matrix sm; - sm.clear(); - sm(0,0)=scale; - sm(1,1)=scale; - sm(2,2)=scale; - return sm; - } - static double norm_3d(const double * vec) { double norm = std::sqrt(vec[0]*vec[0]+ @@ -242,9 +149,6 @@ namespace percept { } }; - inline Math::Vector operator*(Math::Matrix& mat, Math::Vector& vec) { return ublas::prod(mat, vec); } - inline Math::Matrix operator*(Math::Matrix& mat, Math::Matrix& mat2) { return ublas::prod(mat, mat2); } - } #endif diff --git a/packages/percept/src/percept/mesh/gen/SweepMesher.cpp b/packages/percept/src/percept/mesh/gen/SweepMesher.cpp index ffe2cc6b95cc..7459b7c2a2d4 100644 --- a/packages/percept/src/percept/mesh/gen/SweepMesher.cpp +++ b/packages/percept/src/percept/mesh/gen/SweepMesher.cpp @@ -243,7 +243,7 @@ SHARDS_ARRAY_DIM_TAG_SIMPLE_IMPLEMENTATION( Tag1 ) } //exit(1); - boost::array centroid = {{0,0,0}}; + std::array centroid = {{0,0,0}}; for (unsigned iv = 0; iv < 6; iv++) { centroid[0] += m_node_coords[elem[iv]][0]/6.0; @@ -384,7 +384,7 @@ SHARDS_ARRAY_DIM_TAG_SIMPLE_IMPLEMENTATION( Tag1 ) } //exit(1); - boost::array centroid = {{0,0,0}}; + std::array centroid = {{0,0,0}}; for (unsigned iv = 0; iv < 8; iv++) { centroid[0] += m_node_coords[elem[iv]][0]/8.0; diff --git a/packages/percept/src/percept/mesh/gen/SweepMesher.hpp b/packages/percept/src/percept/mesh/gen/SweepMesher.hpp index a0be6dbd4d8e..1ecf471e6ea2 100644 --- a/packages/percept/src/percept/mesh/gen/SweepMesher.hpp +++ b/packages/percept/src/percept/mesh/gen/SweepMesher.hpp @@ -54,7 +54,7 @@ SHARDS_ARRAY_DIM_TAG_SIMPLE_DECLARATION( Tag1 ) dst.insert(dst.end(), src.begin(), src.end()); } - typedef boost::array Coord; + typedef std::array Coord; typedef GeneralFunction< Coord, Coord > VectorFieldGeneralFunction; class Transform : public VectorFieldGeneralFunction { @@ -129,7 +129,7 @@ SHARDS_ARRAY_DIM_TAG_SIMPLE_DECLARATION( Tag1 ) * * Then use sweep to create a hex mesh (this example breaks a quad to create two Tri's, then creates a mixed hex/wedge mesh) * - * boost::array< double, 3> dir = {0,0,1}; + * std::array< double, 3> dir = {0,0,1}; * std::vector xforms(1, &TransformDir( dir ) ); * * // break one of the quads into tris @@ -139,7 +139,7 @@ SHARDS_ARRAY_DIM_TAG_SIMPLE_DECLARATION( Tag1 ) * tp2.dump(); * * // sweep to make a hex mesh - * boost::array< double, 3> dir1 = {0,0,2.345}; + * std::array< double, 3> dir1 = {0,0,2.345}; * xforms[0] = &TransformDir(dir1); * tp2.sweep( SweepMesher::ET_Quad4, SweepMesher::ET_Hex8, xforms); * @@ -399,7 +399,7 @@ SHARDS_ARRAY_DIM_TAG_SIMPLE_DECLARATION( Tag1 ) std::vector xforms(npoints-1); for (unsigned i = 0; i < npoints-1; i++) { - boost::array< double, 3> dir; + std::array< double, 3> dir; dir[0] = path[i+1][0]-path[i][0]; dir[1] = path[i+1][1]-path[i][1]; dir[2] = path[i+1][2]-path[i][2]; diff --git a/packages/percept/src/percept/mesh/gen/TransformPath.hpp b/packages/percept/src/percept/mesh/gen/TransformPath.hpp index 53a0475e028b..11d2edb0f5c6 100644 --- a/packages/percept/src/percept/mesh/gen/TransformPath.hpp +++ b/packages/percept/src/percept/mesh/gen/TransformPath.hpp @@ -19,7 +19,7 @@ class TransformPath : public Transform { - typedef boost::array Coord; + typedef std::array Coord; Coord m_from; Coord m_from_dir; Coord m_to; diff --git a/packages/percept/src/percept/mesh/geometry/kernel/GeometryFactory.cpp b/packages/percept/src/percept/mesh/geometry/kernel/GeometryFactory.cpp index c54aeb9660c3..5af51c05dacd 100644 --- a/packages/percept/src/percept/mesh/geometry/kernel/GeometryFactory.cpp +++ b/packages/percept/src/percept/mesh/geometry/kernel/GeometryFactory.cpp @@ -10,9 +10,7 @@ #include #include -#include - -#define DEBUG_GF2 0 +#include namespace percept { @@ -38,7 +36,7 @@ static stk::mesh::Part* getPart(stk::mesh::MetaData *meta_data, std::string part_name, bool partial_string_match_ok) { stk::mesh::Part* found_part =0; - boost::algorithm::to_lower(part_name); + sierra::make_lower(part_name); if (!partial_string_match_ok) { found_part = meta_data->get_part(part_name); @@ -53,7 +51,6 @@ getPart(stk::mesh::MetaData *meta_data, std::string part_name, bool partial_stri { stk::mesh::Part& part = *parts[ipart]; size_t found = part.name().find(part_name); - if (DEBUG_GF2) std::cout << "part_name= " << part_name << " part.name()= " << part.name() << " found= " << found << std::endl; if (found != std::string::npos) { // skip "old" parts @@ -68,7 +65,6 @@ getPart(stk::mesh::MetaData *meta_data, std::string part_name, bool partial_stri } } } - if (DEBUG_GF2) std::cout << "part_name= " << part_name << " found_part.name()= " << found_part->name() << std::endl; const bool error_check = true; if (error_check && !found_part && part_name != "edgeseams") diff --git a/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.cpp b/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.cpp index a62ac425e859..83dab53ec1cb 100644 --- a/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.cpp +++ b/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.cpp @@ -130,7 +130,7 @@ void GeometryKernelGregoryPatch::snap_to std::set neighbors, neighbors_local; if (!m_geometryMesh->is_valid(closest_face)) { - GeometryKernelGregoryPatch::EntitySet& faceSet = m_meshTransfer->meshb()->m_searchMap[node_hint]; + GeometryKernelGregoryPatch::EntitySet& faceSet = m_meshTransfer->meshB()->m_searchMap[node_hint]; neighbors = faceSet; } diff --git a/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.hpp b/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.hpp index e20e672650b2..9de35f0c9a35 100644 --- a/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.hpp +++ b/packages/percept/src/percept/mesh/geometry/kernel/GeometryKernelGregoryPatch.hpp @@ -62,7 +62,7 @@ class GeometryKernelGregoryPatch : public GeometryKernel stk::mesh::PartVector m_geometryMeshActiveParts; stk::mesh::PartVector m_nodeMeshActiveParts; bool m_debug; - boost::shared_ptr m_meshTransfer; + std::shared_ptr m_meshTransfer; stk::mesh::Entity m_found_face; }; diff --git a/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.cpp b/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.cpp index 0b7134832a96..7b86c9bb5340 100644 --- a/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.cpp +++ b/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.cpp @@ -9,11 +9,6 @@ #include #include -//#include - - - - #include #include diff --git a/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.hpp b/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.hpp index 60e36a825818..5a6cb2a82a82 100644 --- a/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.hpp +++ b/packages/percept/src/percept/mesh/geometry/kernel/MeshGeometry.hpp @@ -15,9 +15,7 @@ #include -#include - -#define DEBUG_GEOM_SNAP 0 +#include namespace percept { @@ -159,8 +157,7 @@ class MeshGeometry const PerceptMesh& m_eMesh; //PerceptMesh * m_eMesh_pntr; typedef std::pair CacheBucketClassifyValueType; - typedef boost::unordered_map CacheBucketClassifyType; -// typedef boost::unordered_map MaxDeltaOnGeometryType; + typedef std::unordered_map CacheBucketClassifyType; MeshGeometry(const PerceptMesh& eMesh, GeometryKernel* geom, double doCheckMovement=0.0, double doCheckCpuTime=0.0, bool cache_bucket_selectors_is_active=false, bool doPrint=false); ~MeshGeometry(); diff --git a/packages/percept/src/percept/mesh/geometry/kernel/xfer/GPSTKMeshTransferSetup.hpp b/packages/percept/src/percept/mesh/geometry/kernel/xfer/GPSTKMeshTransferSetup.hpp index 8a7fbfaf9711..a2dd63db1166 100644 --- a/packages/percept/src/percept/mesh/geometry/kernel/xfer/GPSTKMeshTransferSetup.hpp +++ b/packages/percept/src/percept/mesh/geometry/kernel/xfer/GPSTKMeshTransferSetup.hpp @@ -25,7 +25,7 @@ namespace percept typedef stk::transfer::GeometricTransfer< class LinInterp< class GPFromMesh, class GPToMesh > > GPSTKMeshTransfer; inline - boost::shared_ptr + std::shared_ptr buildGPSTKMeshTransfer(PerceptMesh& fromMesh, const stk::mesh::PartVector& fromParts, const std::vector& fromFields, @@ -45,17 +45,17 @@ namespace percept transferType = TWOD_AXI_TO_THREED; } - boost::shared_ptr + std::shared_ptr from_mesh (new GPFromMesh(fromMesh, fromParts, fromFields)); - boost::shared_ptr + std::shared_ptr to_mesh (new GPToMesh(toMesh, toParts, toFields, transferType)); #if 0 - boost::shared_ptr + std::shared_ptr mesh_transfer(new GPSTKMeshTransfer(from_mesh, to_mesh, transfer_name, 1.5, stk::search::OCTREE)); #else - boost::shared_ptr + std::shared_ptr mesh_transfer(new GPSTKMeshTransfer(from_mesh, to_mesh, transfer_name)); #endif diff --git a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.cpp b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.cpp index d4bd900e219b..08f5120a51e5 100644 --- a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.cpp +++ b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.cpp @@ -612,9 +612,9 @@ namespace percept { std::vector& normalsSet = m_nodeNormalsSetMap[node]; for (unsigned jj=0; jj < normals.size(); ++jj) { - if (normalsSet[jj] && Math::norm_3d(normals[jj].c_array()) > 0.0) + if (normalsSet[jj] && Math::norm_3d(normals[jj].data()) > 0.0) { - Math::normalize_3d(normals[jj].c_array()); + Math::normalize_3d(normals[jj].data()); } else { @@ -1155,7 +1155,7 @@ namespace percept { { tangent[j] = nd1[j] - nd0[j]; } - Math::normalize_3d(tangent.c_array()); + Math::normalize_3d(tangent.data()); return tangent; } @@ -1484,12 +1484,12 @@ namespace percept { if (orient0 >= 0) { - Math::copy_3d(n.getData().get(), normals0[orient0].c_array()); + Math::copy_3d(n.getData().get(), normals0[orient0].data()); VERIFY_OP_ON(Math::norm_3d(n.getData().get()), >, 1.e-8, "bad norm"); } if (orient1 >= 0) { - Math::copy_3d(np.getData().get(), normals1[orient1].c_array()); + Math::copy_3d(np.getData().get(), normals1[orient1].data()); VERIFY_OP_ON(Math::norm_3d(np.getData().get()), >, 1.e-8, "bad normp"); } diff --git a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.hpp b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.hpp index 5e4339bf885e..705943f3fc87 100644 --- a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.hpp +++ b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/FitGregoryPatches.hpp @@ -173,7 +173,7 @@ class FitGregoryPatches * angle criterion; also adds edges to the QA mesh for debugging * and Q/A purposes. */ - typedef boost::array Point; + typedef std::array Point; double edgeAngle(stk::mesh::Entity node, const Edge& e0, const Edge& e1); diff --git a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_FitUtil.mcpp b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_FitUtil.mcpp index cec7e7c92310..2386e28b3a25 100644 --- a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_FitUtil.mcpp +++ b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_FitUtil.mcpp @@ -1,7 +1,12 @@ -// Copyright 2014 Sandia Corporation. Under the terms of -// Contract DE-AC04-94AL85000 with Sandia Corporation, the -// U.S. Government retains certain rights in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Quad.mcpp b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Quad.mcpp index bcb70d8fec54..175fe01fc858 100644 --- a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Quad.mcpp +++ b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Quad.mcpp @@ -1,7 +1,12 @@ -// Copyright 2014 Sandia Corporation. Under the terms of -// Contract DE-AC04-94AL85000 with Sandia Corporation, the -// U.S. Government retains certain rights in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Tri.mcpp b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Tri.mcpp index 3566c2b665b8..7f68af787d1e 100644 --- a/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Tri.mcpp +++ b/packages/percept/src/percept/mesh/geometry/stk_geom/3D/GregoryPatch_Tri.mcpp @@ -1,7 +1,12 @@ -// Copyright 2014 Sandia Corporation. Under the terms of -// Contract DE-AC04-94AL85000 with Sandia Corporation, the -// U.S. Government retains certain rights in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/packages/percept/src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.cpp b/packages/percept/src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.cpp index c9c5afbfea88..aba48cea110e 100644 --- a/packages/percept/src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.cpp +++ b/packages/percept/src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.cpp @@ -21,7 +21,6 @@ #include // for all_reduce_max, etc #include // for basic_string, operator<< #include // for pair -#include "boost/unordered/unordered_set.hpp" #include "stk_mesh/base/Bucket.hpp" // for Bucket, Bucket::iterator #include "stk_mesh/base/BulkData.hpp" // for BulkData #include "stk_mesh/base/Entity.hpp" // for Entity diff --git a/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherAlgebraic.cpp b/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherAlgebraic.cpp index 6e5b1384eb36..470c211fb1a4 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherAlgebraic.cpp +++ b/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherAlgebraic.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherBase.hpp b/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherBase.hpp index 6179d53f0f92..cbe3b5e0a2d1 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherBase.hpp +++ b/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherBase.hpp @@ -14,7 +14,8 @@ #include #include -#include +#include +#include #include #include @@ -29,7 +30,7 @@ class ReferenceMeshSmootherBaseImpl : public MeshSmootherImpl { using Base = MeshSmootherImpl; - typedef boost::unordered_map > NodeMap; + typedef std::unordered_map > NodeMap; ReferenceMeshSmootherBaseImpl(PerceptMesh *eMesh, // typename MeshType::MTSelector *boundary_selector=0, diff --git a/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherConjugateGradient.cpp b/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherConjugateGradient.cpp index cd759143dcab..205a6a1314fa 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherConjugateGradient.cpp +++ b/packages/percept/src/percept/mesh/mod/smoother/ReferenceMeshSmootherConjugateGradient.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include diff --git a/packages/percept/src/percept/mesh/mod/smoother/ScalingMatricesGen.mhpp b/packages/percept/src/percept/mesh/mod/smoother/ScalingMatricesGen.mhpp index eeca23552bab..df885de0679b 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/ScalingMatricesGen.mhpp +++ b/packages/percept/src/percept/mesh/mod/smoother/ScalingMatricesGen.mhpp @@ -1,7 +1,12 @@ -// Copyright 2014 Sandia Corporation. Under the terms of -// Contract DE-AC04-94AL85000 with Sandia Corporation, the -// U.S. Government retains certain rights in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/packages/percept/src/percept/mesh/mod/smoother/SmootherMetric.hpp b/packages/percept/src/percept/mesh/mod/smoother/SmootherMetric.hpp index 84ab33caf2c4..795eff7408d1 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/SmootherMetric.hpp +++ b/packages/percept/src/percept/mesh/mod/smoother/SmootherMetric.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include "SGridJacobianUtil.hpp" #include diff --git a/packages/percept/src/percept/mesh/mod/smoother/SmootherMetricGen.mhpp b/packages/percept/src/percept/mesh/mod/smoother/SmootherMetricGen.mhpp index c6974481c7d1..44135e5c5c96 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/SmootherMetricGen.mhpp +++ b/packages/percept/src/percept/mesh/mod/smoother/SmootherMetricGen.mhpp @@ -1,7 +1,12 @@ -// Copyright 2014 Sandia Corporation. Under the terms of -// Contract DE-AC04-94AL85000 with Sandia Corporation, the -// U.S. Government retains certain rights in this software. -// +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother2.cpp b/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother2.cpp index 55f4009ddf3a..c879daa94769 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother2.cpp +++ b/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother2.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother3.cpp b/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother3.cpp index a61fd571c3c8..2b491d86bb68 100644 --- a/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother3.cpp +++ b/packages/percept/src/percept/mesh/mod/smoother/future-dev/ReferenceMeshSmoother3.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/packages/percept/src/percept/mesh_transfer/MeshTransfer.cpp b/packages/percept/src/percept/mesh_transfer/MeshTransfer.cpp index d99aa274aa94..5d574357da2e 100644 --- a/packages/percept/src/percept/mesh_transfer/MeshTransfer.cpp +++ b/packages/percept/src/percept/mesh_transfer/MeshTransfer.cpp @@ -165,7 +165,7 @@ void MeshTransfer::run(int argc, char** argv) srcMesh.commit(); dstMesh.commit(); - boost::shared_ptr mesh_transfer = + std::shared_ptr mesh_transfer = buildSTKMeshTransfer(*(srcMesh.get_bulk_data()), srcMesh.get_coordinates_field(), fromField, diff --git a/packages/percept/src/percept/pool.cpp b/packages/percept/src/percept/pool.cpp index 9a206aaa4dcc..37ee279db93b 100644 --- a/packages/percept/src/percept/pool.cpp +++ b/packages/percept/src/percept/pool.cpp @@ -13,11 +13,11 @@ Pool::Pool( size_t granularity, size_t size ) { if( m_size > 0 ) { - m_storage.reset( new char[m_size*granularity] ); - m_slots.reset( new void*[m_size] ); + m_storage.resize(m_size*granularity); + m_slots.resize(m_size); for( size_t i = 0; i < m_size; ++i ) - m_slots[i] = reinterpret_cast( m_storage.get() + i*granularity ); + m_slots[i] = reinterpret_cast( m_storage.data() + i*granularity ); } } diff --git a/packages/percept/src/percept/pool.h b/packages/percept/src/percept/pool.h index 38715c1a4e1e..05dfb55aefba 100644 --- a/packages/percept/src/percept/pool.h +++ b/packages/percept/src/percept/pool.h @@ -1,7 +1,9 @@ #ifndef INCL_CORE_POOL #define INCL_CORE_POOL -#include +#include +#include +#include //! Simple pool class. class Pool @@ -13,7 +15,7 @@ class Pool //! Checks for emptiness before destructing. ~Pool(); - void Reset() { m_used = 0; m_overflow = 0; } + void Reset() { m_used = 0; m_overflow = 0; } //! Gets the pool granularity. size_t GetGranularity() const { return m_granularity; } @@ -58,7 +60,7 @@ class Pool bool IsFromPool( void const* instance ) const { char const* block = reinterpret_cast( instance ); - return m_storage.get() <= block && block < ( m_storage.get() + m_size*m_granularity ); + return m_storage.data() <= block && block < ( m_storage.data() + m_size*m_granularity ); } size_t m_granularity; //!< The size of each element in the pool in bytes. @@ -66,8 +68,8 @@ class Pool size_t m_used; //!< The number of pooled allocations. size_t m_overflow; //!< The number of non-pooled allocations. - boost::scoped_array m_storage; //!< The pool storage. - boost::scoped_array m_slots; //!< The free list. + std::vector m_storage; //!< The pool storage. + std::vector m_slots; //!< The free list. }; #endif // ndef INCL_CORE_POOL diff --git a/packages/percept/src/percept/stk_rebalance/ZoltanPartition.hpp b/packages/percept/src/percept/stk_rebalance/ZoltanPartition.hpp index bd28070a68fd..8e225f933ec7 100644 --- a/packages/percept/src/percept/stk_rebalance/ZoltanPartition.hpp +++ b/packages/percept/src/percept/stk_rebalance/ZoltanPartition.hpp @@ -13,15 +13,23 @@ /* filename: ZoltanPartition.h */ /* purpose: header file for stk toolkit zoltan methods */ /* */ -/*----------------------------------------------------------------------*/ -/* Copyright 2001,2010 Sandia Corporation. */ -/* Under the 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. Export of this program may require */ -/* a license from the United States Government. */ -/*----------------------------------------------------------------------*/ - -// Copyright 2001 Sandia Corporation, Albuquerque, NM. +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Copyright 2002 - 2008, 2010, 2011 National Technology & */ +/* Engineering Solutions of Sandia, LLC (NTESS). Under the terms */ +/* of Contract DE-NA0003525 with NTESS, there is a */ +/* non-exclusive license for use of this work by or on behalf */ +/* of the U.S. Government. Export of this program may require */ +/* a license from the United States Government. */ +/*--------------------------------------------------------------------*/ #ifndef stk_rebalance_ZoltanPartition_hpp #define stk_rebalance_ZoltanPartition_hpp diff --git a/packages/percept/src/percept/structured/StructuredCellIndex.hpp b/packages/percept/src/percept/structured/StructuredCellIndex.hpp index 75d17e561212..4a67b07cdad3 100644 --- a/packages/percept/src/percept/structured/StructuredCellIndex.hpp +++ b/packages/percept/src/percept/structured/StructuredCellIndex.hpp @@ -12,10 +12,24 @@ #include #include +#include + namespace percept { using StructuredCellIndex = std::array; // i,j,k, block } +namespace std { + + template<> + struct hash + { + size_t operator()(const percept::StructuredCellIndex& e) const + { + return hash()(e[0]+e[1]+e[2]+e[3]); + } + }; +} + #endif diff --git a/packages/percept/src/percept/structured/StructuredGridRefiner.cpp b/packages/percept/src/percept/structured/StructuredGridRefiner.cpp index cea87d8502d6..c04ba3683842 100644 --- a/packages/percept/src/percept/structured/StructuredGridRefiner.cpp +++ b/packages/percept/src/percept/structured/StructuredGridRefiner.cpp @@ -35,21 +35,21 @@ namespace percept { unsigned StructuredGridRefiner::do_refine_structured() { + unsigned num_refined_cells = 0; + #if HAVE_CGNS m_output->m_sblocks.resize(0); const int my_rank = stk::parallel_machine_rank(m_output->m_comm); - unsigned num_refined_cells = 0; - double runTime = 0; for (unsigned iblock=0; iblock < m_input->m_sblocks.size(); ++iblock) { std::shared_ptr sgi = m_input->m_sblocks[iblock]; std::array nijk{{0,0,0,0,0,0,0,0,0}}; - std::array node_size_global{{sgi->m_sizes.node_size_global[0], + std::array node_size_global{{sgi->m_sizes.node_size_global[0], sgi->m_sizes.node_size_global[1], sgi->m_sizes.node_size_global[2]}}; - + std::shared_ptr sgiNew ( new StructuredBlock(sgi->m_comm, iblock, nijk, node_size_global, sgi->m_name+"_refined", sgi->m_base, sgi->m_zone, m_output.get()) ); m_output->m_sblocks.push_back(sgiNew); @@ -82,7 +82,7 @@ namespace percept { if (debug && my_rank == 0) std::cout << "StructuredGridRefiner: start block " << sgi->m_name << " refine..." << std::endl; - + struct timeval begin, end; gettimeofday(&begin,NULL); { @@ -95,16 +95,16 @@ namespace percept { gettimeofday(&end,NULL); runTime += 1.0*(end.tv_sec-begin.tv_sec) + 1.0e-6*(end.tv_usec-begin.tv_usec); - + // deal with zone connectivity { int nconn = sgi->m_zoneConnectivity.size(); for (int i = 0; i < nconn; i++) { Ioss::ZoneConnectivity& zc = sgi->m_zoneConnectivity[i]; - + std::string connectname = zc.m_connectionName; std::string donorname = zc.m_donorName; - + std::array range_beg = zc.m_ownerRangeBeg; std::array range_end = zc.m_ownerRangeEnd; std::array donor_beg = zc.m_donorRangeBeg; @@ -123,26 +123,24 @@ namespace percept { int owner_zone = zc.m_ownerZone; (void) owner_zone; int donor_zone = zc.m_donorZone; - - bool owns_nodes = sgi->m_zone < donor_zone || donor_zone == -1; + sgiNew->m_zoneConnectivity.emplace_back(connectname, sgi->m_zone, donorname, donor_zone, transform, - range_beg, range_end, donor_beg, donor_end, - owns_nodes); + range_beg, range_end, donor_beg, donor_end); } } - + // deal with boundary conditions { int nbc = sgi->m_boundaryConditions.size(); for (int i = 0; i < nbc; i++) { Ioss::BoundaryCondition& bc = sgi->m_boundaryConditions[i]; - + std::string bcname = bc.m_bcName; //std::string donorname = zc.m_donorName; // FIXME CG_BCType_t bctype = CGNS_ENUMV( BCTypeNull ); (void)bctype; - + Ioss::IJK_t range_beg = bc.m_rangeBeg; Ioss::IJK_t range_end = bc.m_rangeEnd; for (unsigned j=0; j < 3; ++j) @@ -151,7 +149,7 @@ namespace percept { range_end[j] = 2*(range_end[j] - m_index_base) + m_index_base; } - + sgiNew->m_boundaryConditions.emplace_back(bcname, range_beg, range_end); } } @@ -163,11 +161,9 @@ namespace percept { std::cout << "Total number of cells after refinement = " << num_refined_cells << std::endl; std::cout << "Runtime (seconds) over " << m_input->m_sblocks.size() << " blocks was " << runTime << std::endl; } +#endif return num_refined_cells; -#else - return 0; -#endif } unsigned StructuredGridRefiner::do_refine() @@ -293,5 +289,3 @@ namespace percept { } - - diff --git a/packages/percept/src/percept/xfer/LinInterp.hpp b/packages/percept/src/percept/xfer/LinInterp.hpp index 8906bd980452..c661c4b2b84e 100644 --- a/packages/percept/src/percept/xfer/LinInterp.hpp +++ b/packages/percept/src/percept/xfer/LinInterp.hpp @@ -167,6 +167,9 @@ LinInterp::filter_to_nearest ( } dist = std::sqrt(dist); } + else if (topo.getKey()==shards::Beam<2>::key) { + // do nothing + } else { Intrepid::CellTools::mapToReferenceFrame(outputParametricPoints, inputPhysicalPoints, @@ -350,6 +353,10 @@ LinInterp::apply_from_nodal_field ( if (topo.getKey()==shards::Particle::key) { basisVals(0,0) = 1.0; } + else if(topo.getKey()==shards::Beam<2>::key) { + basisVals(0,0) = 0.5; + basisVals(1,0) = 0.5; + } else { Teuchos::RCP > > HGRAD_Basis = BasisTable::getBasis(topo); diff --git a/packages/percept/src/percept/xfer/STKMeshTransferSetup.hpp b/packages/percept/src/percept/xfer/STKMeshTransferSetup.hpp index a9b7e4d878c5..d17ac6f5e726 100644 --- a/packages/percept/src/percept/xfer/STKMeshTransferSetup.hpp +++ b/packages/percept/src/percept/xfer/STKMeshTransferSetup.hpp @@ -27,7 +27,7 @@ typedef stk::transfer::GeometricTransfer< class LinInterp< FMesh, TMesh > > STK template inline -boost::shared_ptr +std::shared_ptr buildSTKMeshTransfer(stk::mesh::BulkData &bulkData_from, stk::mesh::Field * coordinates_from, stk::mesh::FieldBase * field_from, @@ -49,13 +49,13 @@ buildSTKMeshTransfer(stk::mesh::BulkData &bulkData_from, transferType = TWOD_AXI_TO_THREED; } - boost::shared_ptr + std::shared_ptr from_mesh (new FMesh(bulkData_from, coordinates_from, field_from, bulkData_from.parallel())); - boost::shared_ptr + std::shared_ptr to_mesh (new TMesh(bulkData_to, coordinates_to, field_to, @@ -63,7 +63,7 @@ buildSTKMeshTransfer(stk::mesh::BulkData &bulkData_from, transferType, srcFieldType)); - boost::shared_ptr + std::shared_ptr mesh_transfer(new SMT(from_mesh, to_mesh, transfer_name, expansion_factor)); return mesh_transfer; @@ -76,16 +76,16 @@ initializeSTKMeshTransfer(SMT * mesh_transfer) { mesh_transfer->coarse_search(); - mesh_transfer->mesha()->fromBulkData_.modification_begin(); + mesh_transfer->meshA()->fromBulkData_.modification_begin(); // based on Transfer::change_ghosting() in conchas2 // which calls Transfer::ghost_from_elements(); STKMeshTransfer::MeshA::EntityProcVec entity_keys; mesh_transfer->determine_entities_to_copy(entity_keys); - mesh_transfer->mesha()->update_ghosting(entity_keys); + mesh_transfer->meshA()->update_ghosting(entity_keys); - stk::mesh::fixup_ghosted_to_shared_nodes(mesh_transfer->mesha()->fromBulkData_); - mesh_transfer->mesha()->fromBulkData_.modification_end(); + stk::mesh::fixup_ghosted_to_shared_nodes(mesh_transfer->meshA()->fromBulkData_); + mesh_transfer->meshA()->fromBulkData_.modification_end(); mesh_transfer->local_search(); } diff --git a/packages/percept/src/percept/xfer/ToMesh.hpp b/packages/percept/src/percept/xfer/ToMesh.hpp index 3e2e9bfb79b8..d46289c783ed 100644 --- a/packages/percept/src/percept/xfer/ToMesh.hpp +++ b/packages/percept/src/percept/xfer/ToMesh.hpp @@ -24,7 +24,6 @@ #include #include -#include #include #include From 192b39413d94633fb18c386f3d61404a41c4aa74 Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Wed, 25 Sep 2019 16:38:25 -0700 Subject: [PATCH 14/44] Initial Tpetra stack nightly performance tests Tpetra: Added CGSolve strong scaling (MPI procs = 1, 4, 9, ...) tests Kokkos/Zoltan: Fixed test categories, test exectuable names for perf tests MueLu: Perf tests for driver (Laplace3D setup+solve) and mat-mat --- ...rilinosCTestDriverCore.rocketman.gcc.cmake | 4 +- ...release_tpetra_performance_rocketman.cmake | 14 +- .../performance_tests/CMakeLists.txt | 5 +- packages/kokkos/core/perf_test/CMakeLists.txt | 6 +- packages/muelu/test/scaling/CMakeLists.txt | 47 ++++++ .../test/scaling/MatrixMatrixMultiply.cpp | 9 +- .../Finite-Element-Assembly/CMakeLists.txt | 14 +- .../test/PerformanceCGSolve/CMakeLists.txt | 72 +++++++- .../test/PerformanceCGSolve/cg_solve_file.cpp | 3 +- .../{cg-solve_file.hpp => cg_solve_file.hpp} | 155 ++++++++---------- .../cg_solve_file_cudawrapper.cpp | 2 +- .../cg_solve_file_openmpwrapper.cpp | 2 +- .../cg_solve_file_serialwrapper.cpp | 2 +- .../cg_solve_file_threadswrapper.cpp | 2 +- packages/zoltan/src/driver/CMakeLists.txt | 1 + packages/zoltan/test/CMakeLists.txt | 1 + 16 files changed, 216 insertions(+), 123 deletions(-) rename packages/tpetra/core/test/PerformanceCGSolve/{cg-solve_file.hpp => cg_solve_file.hpp} (81%) diff --git a/cmake/ctest/drivers/rocketman/TrilinosCTestDriverCore.rocketman.gcc.cmake b/cmake/ctest/drivers/rocketman/TrilinosCTestDriverCore.rocketman.gcc.cmake index 463472ee274c..f683e469d52e 100644 --- a/cmake/ctest/drivers/rocketman/TrilinosCTestDriverCore.rocketman.gcc.cmake +++ b/cmake/ctest/drivers/rocketman/TrilinosCTestDriverCore.rocketman.gcc.cmake @@ -117,11 +117,13 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER) ${EXTRA_SYSTEM_CONFIGURE_OPTIONS} "-DTPL_ENABLE_MPI=ON" "-DMPI_BASE_DIR:PATH=$ENV{SEMS_OPENMPI_ROOT}" - "-DMPI_EXEC_POST_NUMPROCS_FLAGS:STRING=--bind-to\\\;socket\\\;--map-by\\\;socket" "-DTPL_BLAS_LIBRARIES=/usr/lib64/libblas.so.3.2.1" "-DTPL_LAPACK_LIBRARIES=/usr/lib64/liblapack.so.3.2.1" ) + #NUMA memory binding doesn't work on rocketman currently; TODO: get libnumactl and enable binding again + #"-DMPI_EXEC_POST_NUMPROCS_FLAGS:STRING=--bind-to\\\;core\\\;--map-by\\\;core" + SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=all --error-limit=no --log-file=nightly_suppressions.txt" ${CTEST_MEMORYCHECK_COMMAND_OPTIONS} ) diff --git a/cmake/ctest/drivers/rocketman/ctest_linux_experimental_mpi_release_tpetra_performance_rocketman.cmake b/cmake/ctest/drivers/rocketman/ctest_linux_experimental_mpi_release_tpetra_performance_rocketman.cmake index 73807d21950d..9520f1ef6aa8 100644 --- a/cmake/ctest/drivers/rocketman/ctest_linux_experimental_mpi_release_tpetra_performance_rocketman.cmake +++ b/cmake/ctest/drivers/rocketman/ctest_linux_experimental_mpi_release_tpetra_performance_rocketman.cmake @@ -73,8 +73,10 @@ SET(CTEST_TEST_TYPE Experimental) SET(Trilinos_TRACK Experimental) # Set the CDash track to Nightly SET(CTEST_TEST_TIMEOUT 14400) # twice the default value, for valgrind SET(CTEST_DO_MEMORY_TESTING FALSE) - -SET(Trilinos_PACKAGES Tpetra) +SET(Trilinos_ENABLE_ALL_FORWARD_DEP_PACKAGES FALSE) +SET(Trilinos_DISABLE_ENABLED_FORWARD_DEP_PACKAGES TRUE) +SET(Trilinos_PACKAGES "Tpetra;Galeri;MueLu") +SET(Trilinos_EXCLUDE_PACKAGES "Sacado;RTOp;Stratimikos;Shards;TrilinosSS;Epetra") # If true, this option yields faster builds. In that case, however, it won't disable any upstream package that fails to compile. SET(Trilinos_CTEST_DO_ALL_AT_ONCE TRUE) @@ -82,8 +84,12 @@ SET(Trilinos_CTEST_DO_ALL_AT_ONCE TRUE) SET(EXTRA_CONFIGURE_OPTIONS "-DTrilinos_ENABLE_DEPENDENCY_UNIT_TESTS=OFF" "-DTrilinos_TEST_CATEGORIES:STRING=PERFORMANCE" - "-DMPI_EXEC_MAX_NUMPROCS=36" - "-DMPI_EXEC_DEFAULT_NUMPROCS=36" + "-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION=ON" + "-DXpetra_ENABLE_Experimental:BOOL=ON" + "-DMueLu_ENABLE_Experimental:BOOL=ON" + "-DMueLu_ENABLE_TESTS=ON" + "-DMPI_EXEC_MAX_NUMPROCS=28" + "-DMPI_EXEC_DEFAULT_NUMPROCS=28" ) # diff --git a/packages/kokkos/containers/performance_tests/CMakeLists.txt b/packages/kokkos/containers/performance_tests/CMakeLists.txt index 3c6584bc346b..85194351e0e4 100644 --- a/packages/kokkos/containers/performance_tests/CMakeLists.txt +++ b/packages/kokkos/containers/performance_tests/CMakeLists.txt @@ -37,11 +37,12 @@ TRIBITS_ADD_EXECUTABLE( SOURCES ${SOURCES} COMM serial mpi TESTONLYLIBS kokkos_gtest ${TEST_LINK_TARGETS} + CATEGORIES BASIC PERFORMANCE ) TRIBITS_ADD_TEST( - PerformanceTest - NAME PerfTestExec + PerfTestExec + NAME PerformanceTest COMM serial mpi NUM_MPI_PROCS 1 CATEGORIES PERFORMANCE diff --git a/packages/kokkos/core/perf_test/CMakeLists.txt b/packages/kokkos/core/perf_test/CMakeLists.txt index d92462a357cb..e92958bdd001 100644 --- a/packages/kokkos/core/perf_test/CMakeLists.txt +++ b/packages/kokkos/core/perf_test/CMakeLists.txt @@ -32,11 +32,12 @@ TRIBITS_ADD_EXECUTABLE( SOURCES ${SOURCES} COMM serial mpi TESTONLYLIBS kokkos_gtest ${TEST_LINK_TARGETS} + CATEGORIES BASIC PERFORMANCE ) TRIBITS_ADD_TEST( - PerfTest - NAME PerfTestExec + PerfTestExec + NAME PerfTest COMM serial mpi NUM_MPI_PROCS 1 CATEGORIES PERFORMANCE @@ -48,6 +49,7 @@ TRIBITS_ADD_EXECUTABLE( SOURCES test_taskdag.cpp COMM serial mpi TESTONLYLIBS kokkos_gtest ${TEST_LINK_TARGETS} + CATEGORIES BASIC PERFORMANCE ) TRIBITS_ADD_TEST( diff --git a/packages/muelu/test/scaling/CMakeLists.txt b/packages/muelu/test/scaling/CMakeLists.txt index c8ba65f1d64e..5d96dccb6e91 100644 --- a/packages/muelu/test/scaling/CMakeLists.txt +++ b/packages/muelu/test/scaling/CMakeLists.txt @@ -36,10 +36,34 @@ IF (${PACKAGE_NAME}_HAVE_TPETRA_SOLVER_STACK OR ${PACKAGE_NAME}_HAVE_EPETRA_SOLV Driver SOURCES Driver.cpp COMM serial mpi + CATEGORIES BASIC PERFORMANCE ) + TRIBITS_ADD_TEST( + Driver + NAME SetupSolve_Performance_1 + COMM mpi + ARGS "--stacked-timer --nx=120 --ny=120 --nz=120 --matrixType=Laplace3D" + NUM_MPI_PROCS 1 + PASS_REGULAR_EXPRESSION "Belos converged" + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + + TRIBITS_ADD_TEST( + Driver + NAME SetupSolve_Performance_4 + COMM mpi + ARGS "--stacked-timer --nx=240 --ny=240 --nz=120 --matrixType=Laplace3D" + NUM_MPI_PROCS 4 + PASS_REGULAR_EXPRESSION "Belos converged" + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + TRIBITS_COPY_FILES_TO_BINARY_DIR(Driver_cp SOURCE_FILES scaling.xml scaling.yaml scaling-complex.xml scaling-withglobalconstants.xml scaling-complex-withglobalconstants.xml circ_nsp_dependency.xml isorropia.xml iso_poisson.xml conchas_milestone_zoltan.xml conchas_milestone_zoltan2.xml conchas_milestone_zoltan2_complex.xml sa_with_ilu.xml sa_with_Ifpack2_line_detection.xml rap.xml smoother.xml smoother_complex.xml tripleMatrixProduct.xml scaling-ml.xml elasticity3D.xml amgx.json amgx.xml scaling-with-rerun.xml scaling_distance2_agg.xml + CATEGORIES BASIC PERFORMANCE ) TRIBITS_ADD_EXECUTABLE( @@ -64,8 +88,31 @@ TRIBITS_ADD_EXECUTABLE( MatrixMatrixMultiply SOURCES MatrixMatrixMultiply.cpp COMM mpi + CATEGORIES BASIC PERFORMANCE ) +TRIBITS_ADD_TEST( + MatrixMatrixMultiply + NAME MatrixMultiply_Performance_1 + COMM mpi + ARGS "--timings --seed=12345 --minrows=8000 --maxrows=10000 --nmults=5" + NUM_MPI_PROCS 1 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE +) + +TRIBITS_ADD_TEST( + MatrixMatrixMultiply + NAME MatrixMultiply_Performance_4 + COMM mpi + ARGS "--timings --seed=12345 --minrows=8000 --maxrows=10000 --nmults=5" + NUM_MPI_PROCS 4 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE +) + # not very elegant. The best would probably to make Reuse.cpp work for both Epetra and Tpetra IF (${PACKAGE_NAME}_HAVE_TPETRA_SOLVER_STACK) TRIBITS_ADD_EXECUTABLE( diff --git a/packages/muelu/test/scaling/MatrixMatrixMultiply.cpp b/packages/muelu/test/scaling/MatrixMatrixMultiply.cpp index 4375722e9a16..390779b10e0d 100644 --- a/packages/muelu/test/scaling/MatrixMatrixMultiply.cpp +++ b/packages/muelu/test/scaling/MatrixMatrixMultiply.cpp @@ -129,12 +129,12 @@ int main_(Teuchos::CommandLineProcessor &clp, Xpetra::UnderlyingLib &lib, int ar } - TimeMonitor globalTimeMonitor(*TimeMonitor::getNewTimer("MatrixMatrixMultiplyTest: S - Global Time")); unsigned int seed = generateSeed(*comm, optSeed); Teuchos::ScalarTraits::seedrandom(seed); for (int jj=0; jj A; RCP B; @@ -192,7 +192,6 @@ int main_(Teuchos::CommandLineProcessor &clp, Xpetra::UnderlyingLib &lib, int ar // std::string fileName="checkAB.mm"; // Utils::Write( fileName,*AB); //} - if (comm->getRank() == 0) std::cout << "success" << std::endl; } //scope for multiply @@ -206,8 +205,10 @@ int main_(Teuchos::CommandLineProcessor &clp, Xpetra::UnderlyingLib &lib, int ar TimeMonitor::summarize(); } - bool success = true; - return ( success ? EXIT_SUCCESS : EXIT_FAILURE ); + if (comm->getRank() == 0) + std::cout << "End Result: TEST PASSED"; + + return 0; } //main_ diff --git a/packages/tpetra/core/example/Finite-Element-Assembly/CMakeLists.txt b/packages/tpetra/core/example/Finite-Element-Assembly/CMakeLists.txt index d43cdc71fc06..5799ae62a7fe 100644 --- a/packages/tpetra/core/example/Finite-Element-Assembly/CMakeLists.txt +++ b/packages/tpetra/core/example/Finite-Element-Assembly/CMakeLists.txt @@ -31,7 +31,7 @@ TRIBITS_ADD_TEST( ARGS "--with-insert-global-indices-fe --with-StaticProfile --num-elements-x=200 --num-elements-y=200" COMM serial mpi NUM_MPI_PROCS 4 - STANDARD_PASS_OUTPUT + STANDARD_PASS_OUTPUT ) TRIBITS_ADD_TEST( @@ -40,7 +40,7 @@ TRIBITS_ADD_TEST( ARGS "--with-insert-global-indices-fe --with-StaticProfile --num-elements-x=200 --num-elements-y=200 --kokkos" COMM serial mpi NUM_MPI_PROCS 4 - STANDARD_PASS_OUTPUT + STANDARD_PASS_OUTPUT ) TRIBITS_ADD_TEST( @@ -150,13 +150,3 @@ TRIBITS_ADD_TEST( CATEGORIES PERFORMANCE ) -TRIBITS_ADD_TEST( - FEMAssembly - NAME Performance_StrongScaling_FEMAssembly_InsertGlobalIndicesFESPKokkos - ARGS "--with-insert-global-indices-fe --with-StaticProfile --num-elements-x=480 --num-elements-y=480 --kokkos" - COMM mpi - NUM_MPI_PROCS 36 - STANDARD_PASS_OUTPUT - RUN_SERIAL - CATEGORIES PERFORMANCE -) diff --git a/packages/tpetra/core/test/PerformanceCGSolve/CMakeLists.txt b/packages/tpetra/core/test/PerformanceCGSolve/CMakeLists.txt index 8bbcfe4795b7..1e6cb4c87da8 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/CMakeLists.txt +++ b/packages/tpetra/core/test/PerformanceCGSolve/CMakeLists.txt @@ -11,13 +11,71 @@ APPEND_GLOB(SOURCES ${DIR}/*.cpp) # Otherwise, it does not use anything else in KokkosCore directly. # IF (Tpetra_INST_DOUBLE) - # This test makes sense only for Scalar == double - TRIBITS_ADD_EXECUTABLE( - Performance-CGSolve - SOURCES - ${SOURCES} - COMM mpi - ) + MESSAGE(STATUS "Tpetra: Performance-CGSolve test ENABLED") + + # This test makes sense only for Scalar == double + TRIBITS_ADD_EXECUTABLE( Performance-CGSolve + SOURCES ${SOURCES} + COMM mpi + CATEGORIES BASIC PERFORMANCE + ) + + TRIBITS_ADD_TEST( + Performance-CGSolve + NAME Performance_StrongScaling_CGSolve + ARGS "--size=200" + COMM mpi + NUM_MPI_PROCS 1 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + + TRIBITS_ADD_TEST( + Performance-CGSolve + NAME Performance_StrongScaling_CGSolve + ARGS "--size=200" + COMM mpi + NUM_MPI_PROCS 4 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + + TRIBITS_ADD_TEST( + Performance-CGSolve + NAME Performance_StrongScaling_CGSolve + ARGS "--size=200" + COMM mpi + NUM_MPI_PROCS 9 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + + TRIBITS_ADD_TEST( + + Performance-CGSolve + NAME Performance_StrongScaling_CGSolve + ARGS "--size=200" + COMM mpi + NUM_MPI_PROCS 16 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + + TRIBITS_ADD_TEST( + Performance-CGSolve + NAME Performance_StrongScaling_CGSolve + ARGS "--size=200" + COMM mpi + NUM_MPI_PROCS 25 + STANDARD_PASS_OUTPUT + RUN_SERIAL + CATEGORIES PERFORMANCE + ) + ENDIF() #TRIBITS_COPY_FILES_TO_BINARY_DIR(CopyXmlForTpetraPerfCgSolve diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp index 21c8510b70ac..0854c431640b 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.cpp @@ -41,7 +41,8 @@ // @HEADER */ -#include "cg-solve_file.hpp" +#include "cg_solve_file.hpp" + #ifdef HAVE_TPETRA_INST_CUDA int run_cudawrapper(int& argc, char* argv[]); #endif diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg-solve_file.hpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.hpp similarity index 81% rename from packages/tpetra/core/test/PerformanceCGSolve/cg-solve_file.hpp rename to packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.hpp index d0b0e6ea2493..87c7cb8a5a9c 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg-solve_file.hpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file.hpp @@ -59,13 +59,12 @@ #include "Teuchos_CommandLineProcessor.hpp" #include "Teuchos_XMLPerfTestArchive.hpp" #include "Teuchos_Array.hpp" - -#include +#include "Teuchos_TimeMonitor.hpp" #include #include - +/* struct result_struct { double addtime,dottime,matvectime,final_residual; int niters; @@ -73,7 +72,9 @@ struct result_struct { addtime(add),dottime(dot),matvectime(matvec), final_residual(res),niters(niter) {}; }; +*/ +/* template Teuchos::XMLTestNode test_entry( const std::string& filename_matrix, @@ -127,12 +128,16 @@ Teuchos::XMLTestNode test_entry( test.addChild(entry); return test; } - +*/ template -result_struct -cg_solve (Teuchos::RCP A, Teuchos::RCP b, Teuchos::RCP x, int myproc, double tolerance, int max_iter) +bool cg_solve (Teuchos::RCP A, Teuchos::RCP b, Teuchos::RCP x, int myproc, double tolerance, int max_iter) { + using Teuchos::TimeMonitor; + TimeMonitor timerGlobal(*TimeMonitor::getNewTimer("CG: Global")); + std::string addTimerName = "CG: Vector Add"; + std::string matvecTimerName = "CG: Matvec"; + std::string dotTimerName = "CG: Dot Product"; static_assert (std::is_same::value, "The CrsMatrix and Vector template parameters must have the same scalar_type."); @@ -161,23 +166,22 @@ cg_solve (Teuchos::RCP A, Teuchos::RCP b, Teuchos::RCP50) print_freq = 50; if (print_freq<1) print_freq = 1; - double dottime = 0; - double addtime = 0; - double matvectime = 0; - - Kokkos::Impl::Timer timer; - p->update(1.0,*x,0.0,*x,0.0); - addtime += timer.seconds(); timer.reset(); - - - A->apply(*p, *Ap); - matvectime += timer.seconds(); timer.reset(); - - r->update(1.0,*b,-1.0,*Ap,0.0); - addtime += timer.seconds(); timer.reset(); - - rtrans = r->dot(*r); - dottime += timer.seconds(); timer.reset(); + { + TimeMonitor t(*TimeMonitor::getNewTimer(addTimerName)); + p->update(1.0,*x,0.0,*x,0.0); + } + { + TimeMonitor t(*TimeMonitor::getNewTimer(matvecTimerName)); + A->apply(*p, *Ap); + } + { + TimeMonitor t(*TimeMonitor::getNewTimer(addTimerName)); + r->update(1.0,*b,-1.0,*Ap,0.0); + } + { + TimeMonitor t(*TimeMonitor::getNewTimer(dotTimerName)); + rtrans = r->dot(*r); + } normr = std::sqrt(rtrans); @@ -189,16 +193,20 @@ cg_solve (Teuchos::RCP A, Teuchos::RCP b, Teuchos::RCP tolerance; ++k) { if (k == 1) { - p->update(1.0,*r,0.0); - addtime += timer.seconds(); timer.reset(); + TimeMonitor t(*TimeMonitor::getNewTimer(addTimerName)); + p->update(1.0,*r,0.0); } else { oldrtrans = rtrans; - rtrans = r->dot(*r); - dottime += timer.seconds(); timer.reset(); - magnitude_type beta = rtrans/oldrtrans; - p->update(1.0,*r,beta); - addtime += timer.seconds(); timer.reset(); + { + TimeMonitor t(*TimeMonitor::getNewTimer(dotTimerName)); + rtrans = r->dot(*r); + } + { + TimeMonitor t(*TimeMonitor::getNewTimer(addTimerName)); + magnitude_type beta = rtrans/oldrtrans; + p->update(1.0,*r,beta); + } } normr = std::sqrt(rtrans); if (myproc == 0 && (k%print_freq==0 || k==max_iter)) { @@ -207,37 +215,41 @@ cg_solve (Teuchos::RCP A, Teuchos::RCP b, Teuchos::RCPapply(*p, *Ap); - matvectime += timer.seconds(); timer.reset(); - p_ap_dot = Ap->dot(*p); - dottime += timer.seconds(); timer.reset(); + { + TimeMonitor t(*TimeMonitor::getNewTimer(matvecTimerName)); + A->apply(*p, *Ap); + } + { + TimeMonitor t(*TimeMonitor::getNewTimer(dotTimerName)); + p_ap_dot = Ap->dot(*p); + } if (p_ap_dot < brkdown_tol) { if (p_ap_dot < 0 ) { std::cerr << "miniFE::cg_solve ERROR, numerical breakdown!"<update(alpha,*p,1.0); - r->update(-alpha,*Ap,1.0); - addtime += timer.seconds(); timer.reset(); - + { + TimeMonitor t(*TimeMonitor::getNewTimer(addTimerName)); + x->update(alpha,*p,1.0); + r->update(-alpha,*Ap,1.0); + } + } + { + TimeMonitor t(*TimeMonitor::getNewTimer(dotTimerName)); + rtrans = r->dot(*r); } - rtrans = r->dot(*r); normr = std::sqrt(rtrans); - - - return result_struct(addtime,dottime,matvectime,k-1,normr); + return true; } template -int -run (int argc, char *argv[]) +int run (int argc, char *argv[]) { using Teuchos::RCP; using Teuchos::tuple; @@ -289,7 +301,7 @@ run (int argc, char *argv[]) cmdp.setOption("printMatrix","noPrintMatrix",&printMatrix,"Print the full matrix after reading it."); cmdp.setOption("size",&nsize,"Generate miniFE matrix with X^3 elements."); cmdp.setOption("tol_small",&tol_small,"Tolerance for total CG-Time and final residual."); - cmdp.setOption("tol_large",&tol_small,"Tolerance for individual times."); + cmdp.setOption("tol_large",&tol_large,"Tolerance for individual times."); if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) { return EXIT_FAILURE; } @@ -372,45 +384,16 @@ run (int argc, char *argv[]) RCP x (new vec_type (A->getDomainMap ())); // Solve the linear system Ax=b using CG. - result_struct results = cg_solve (A, b, x, myRank, tolerance, niters); - - // Print results. - if (myRank == 0) { - Teuchos::XMLTestNode machine_config = Teuchos::PerfTest_MachineConfig(); - Teuchos::XMLTestNode test = - test_entry (filename, filename_vector, nsize, comm->getSize (), numteams, - numthreads, A, results, niters, tolerance, tol_small, - tol_large); - Teuchos::PerfTestResult comparison_result = - Teuchos::PerfTest_CheckOrAdd_Test (machine_config, test, testarchive, hostname); - switch (comparison_result) { - case Teuchos::PerfTestPassed: - cout << "PASSED" << endl; - break; - case Teuchos::PerfTestFailed: - cout << "FAILED" << endl; - break; - case Teuchos::PerfTestNewMachine: - cout << "PASSED. Adding new machine entry." << endl; - break; - case Teuchos::PerfTestNewConfiguration: - cout << "PASSED. Adding new machine configuration." << endl; - break; - case Teuchos::PerfTestNewTest: - cout << "PASSED. Adding new test entry." << endl; - break; - case Teuchos::PerfTestNewTestConfiguration: - cout << "PASSED. Adding new test entry configuration." << endl; - break; - case Teuchos::PerfTestUpdatedTest: - cout << "PASSED. Updating test entry." << endl; - break; - default: - cout << "FAILED: Invalid comparison result." << endl; - } - if (verbose) { - cout << test << endl; - } + bool success = cg_solve(A, b, x, myRank, tolerance, niters); + + Teuchos::TimeMonitor::report(comm.ptr(), std::cout, ""); + + if(myRank == 0) + { + if(success) + std::cout << "End Result: TEST PASSED\n"; + else + std::cout << "End Result: TEST FAILED\n"; } return EXIT_SUCCESS; diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_cudawrapper.cpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_cudawrapper.cpp index 5d72befc03fb..2d5031d10b69 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_cudawrapper.cpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_cudawrapper.cpp @@ -41,7 +41,7 @@ // @HEADER */ -#include "cg-solve_file.hpp" +#include "cg_solve_file.hpp" #if defined(HAVE_TPETRA_INST_CUDA) int run_cudawrapper(int& argc, char* argv[]) { diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_openmpwrapper.cpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_openmpwrapper.cpp index a5cce84de4c7..d84e1668621c 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_openmpwrapper.cpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_openmpwrapper.cpp @@ -41,7 +41,7 @@ // @HEADER */ -#include "cg-solve_file.hpp" +#include "cg_solve_file.hpp" #if defined(HAVE_TPETRA_INST_OPENMP) int run_openmpwrapper(int& argc, char* argv[]) { diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_serialwrapper.cpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_serialwrapper.cpp index cdd05c75eb79..5d93bdec7bda 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_serialwrapper.cpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_serialwrapper.cpp @@ -41,7 +41,7 @@ // @HEADER */ -#include "cg-solve_file.hpp" +#include "cg_solve_file.hpp" #if defined(HAVE_TPETRA_INST_SERIAL) int run_serialwrapper(int& argc, char* argv[]) { diff --git a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_threadswrapper.cpp b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_threadswrapper.cpp index f7dd44375740..31617b86c043 100644 --- a/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_threadswrapper.cpp +++ b/packages/tpetra/core/test/PerformanceCGSolve/cg_solve_file_threadswrapper.cpp @@ -41,7 +41,7 @@ // @HEADER */ -#include "cg-solve_file.hpp" +#include "cg_solve_file.hpp" #if defined(HAVE_TPETRA_INST_PTHREAD) int run_threadswrapper(int& argc, char* argv[]) { diff --git a/packages/zoltan/src/driver/CMakeLists.txt b/packages/zoltan/src/driver/CMakeLists.txt index e1c7be05e144..3c6d046653ce 100644 --- a/packages/zoltan/src/driver/CMakeLists.txt +++ b/packages/zoltan/src/driver/CMakeLists.txt @@ -87,6 +87,7 @@ TRIBITS_ADD_EXECUTABLE( NOEXEPREFIX SOURCES ${COMMON_DRIVER_HDRS} ${ZDRIVE_SOURCES} COMM serial mpi + CATEGORIES BASIC NIGHTLY PERFORMANCE ) IF (${PACKAGE_NAME}_ENABLE_CPPDRIVER) diff --git a/packages/zoltan/test/CMakeLists.txt b/packages/zoltan/test/CMakeLists.txt index d014f5435904..c6d0489fbcf8 100644 --- a/packages/zoltan/test/CMakeLists.txt +++ b/packages/zoltan/test/CMakeLists.txt @@ -147,5 +147,6 @@ ENDIF() # Command that copies test perl script to the test directory. TRIBITS_COPY_FILES_TO_BINARY_DIR(zoltan_ctest_zoltan_copy SOURCE_FILES ctest_zoltan.pl ctest_zoltan_purify.sh + CATEGORIES NIGHTLY PERFORMANCE ) From 5b86ab32d586c0cac6d0a6770c597983d4e026a3 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 16 Oct 2019 14:22:11 -0600 Subject: [PATCH 15/44] SEACAS: IOSS - Fix compiler warning Fix incorrect variable type causing compiler warning; found right after last seacas snapshot. Fixed in SEACAS github; applying manually to Trilinos. Reported in #6106 --- packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h b/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h index 6e99446db54f..44545451e030 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h +++ b/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h @@ -467,7 +467,7 @@ int64_t Ioss::GroupingEntity::get_field_data(const std::string &field_name, data.resize(field.raw_count() * field.raw_storage()->component_count()); size_t data_size = data.size() * sizeof(T); - size_t retval = internal_get_field_data(field, TOPTR(data), data_size); + auto retval = internal_get_field_data(field, TOPTR(data), data_size); // At this point, transform the field if specified... if (retval >= 0) { @@ -551,7 +551,7 @@ int64_t Ioss::GroupingEntity::get_field_data(const std::string & field_n T *host_data_ptr = host_data.data(); // Extract the data from disk to the underlying memory pointed to by host_data_ptr. - size_t retval = internal_get_field_data(field, host_data_ptr, data_size); + auto retval = internal_get_field_data(field, host_data_ptr, data_size); // At this point, transform the field if specified... if (retval >= 0) @@ -598,7 +598,7 @@ int64_t Ioss::GroupingEntity::get_field_data(const std::string & field_ typename ViewType::HostMirror host_data = Kokkos::create_mirror_view(data); // Extract the data from disk to the underlying memory pointed to by host_data_ptr. - size_t retval = internal_get_field_data(field, data_array, data_size); + auto retval = internal_get_field_data(field, data_array, data_size); // At this point, transform the field if specified... if (retval >= 0) From 0fdd0499e7241fa61880cf72a113f8a59fd91447 Mon Sep 17 00:00:00 2001 From: "K. Devine" Date: Wed, 16 Oct 2019 15:13:35 -0600 Subject: [PATCH 16/44] stk: addressed review requests in PR #6102 Changed test to be case insensitive and oblivious to choice of "off/false" Changed "warning" to a "note" about disabling STKBalance Changed test of value of Trilinos_ENABLE_STKBalance --- cmake/RepositoryDependenciesSetup.cmake | 27 +++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/cmake/RepositoryDependenciesSetup.cmake b/cmake/RepositoryDependenciesSetup.cmake index 54e15a5347a2..3959a9fc679d 100644 --- a/cmake/RepositoryDependenciesSetup.cmake +++ b/cmake/RepositoryDependenciesSetup.cmake @@ -14,12 +14,13 @@ endif() ######################################################################### # STKBalance does not work with GO=INT or GO=UNSIGNED -# Warn and disable it if it was set as a dependence of STK +# Note and disable it if it was set as a dependence of STK # Error out if it was explicitly requested by user -IF ("${Tpetra_ENABLE_DEPRECATED_CODE}" STREQUAL "OFF") # Remove this test when - # Tpetra DEPRECATED - # code is removed +IF ((NOT ("${Tpetra_ENABLE_DEPRECATED_CODE}" STREQUAL "")) # Remove this test + AND # when removing + (NOT Tpetra_ENABLE_DEPRECATED_CODE)) # Tpetra DEPRECATED + # code SET(KDD_ENABLE_DEPRECATED OFF) # Remove this line when DEPRECATED is removed SET(KDD_INT_INT OFF) # Current default ELSE() # Remove this "else" section when Tpetra DEPRECATED code is removed @@ -65,16 +66,16 @@ ENDIF() IF ((NOT ${KDD_INT_LONG}) AND (NOT ${KDD_INT_LONG_LONG})) IF ("${${PROJECT_NAME}_ENABLE_STKBalance}" STREQUAL "") # STKBalance may be enabled but only implicitly (as a dependence of STK); - # give a warning but turn off STKBalance support - MESSAGE(WARNING "int global indices are enabled in Trilinos. " - "Because STKBalance requires long or long long " - "global indices, STKBalance will be disabled. " - "To make this warning go away, do not request " - "int global indices in Trilinos (that is, do not " - "set Tpetra_INST_INT_INT=ON or " - "Tpetra_INST_INT_UNSIGNED=ON)." ) + # give a message but turn off STKBalance support + MESSAGE("NOTE: int global indices are enabled in Trilinos. " + "Because STKBalance requires long or long long " + "global indices, STKBalance will be disabled. " + "To make this warning go away, do not request " + "int global indices in Trilinos (that is, do not " + "set Tpetra_INST_INT_INT=ON or " + "Tpetra_INST_INT_UNSIGNED=ON)." ) SET(${PROJECT_NAME}_ENABLE_STKBalance OFF) - ELSEIF (${${PROJECT_NAME}_ENABLE_STKBalance}) + ELSEIF (${PROJECT_NAME}_ENABLE_STKBalance) # STKBalance was explicitly enabled by the user, so error out MESSAGE(FATAL_ERROR "STKBalance requires long or long long global indices, " From 99215b26b1d265a8698a86f819ee3f944b7282b2 Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Wed, 16 Oct 2019 16:21:05 -0600 Subject: [PATCH 17/44] Zoltan: Fixed test categories --- packages/zoltan/src/driver/CMakeLists.txt | 2 +- packages/zoltan/test/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/zoltan/src/driver/CMakeLists.txt b/packages/zoltan/src/driver/CMakeLists.txt index 3c6d046653ce..f936ea28085c 100644 --- a/packages/zoltan/src/driver/CMakeLists.txt +++ b/packages/zoltan/src/driver/CMakeLists.txt @@ -87,7 +87,7 @@ TRIBITS_ADD_EXECUTABLE( NOEXEPREFIX SOURCES ${COMMON_DRIVER_HDRS} ${ZDRIVE_SOURCES} COMM serial mpi - CATEGORIES BASIC NIGHTLY PERFORMANCE + CATEGORIES BASIC PERFORMANCE ) IF (${PACKAGE_NAME}_ENABLE_CPPDRIVER) diff --git a/packages/zoltan/test/CMakeLists.txt b/packages/zoltan/test/CMakeLists.txt index c6d0489fbcf8..bc08022ea155 100644 --- a/packages/zoltan/test/CMakeLists.txt +++ b/packages/zoltan/test/CMakeLists.txt @@ -128,6 +128,7 @@ ENDIF() TRIBITS_COPY_FILES_TO_BINARY_DIR(zoltan_zdrive_copy SOURCE_FILES zdrive.exe SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/../src/driver + CATEGORIES BASIC PERFORMANCE ) IF (${PACKAGE_NAME}_ENABLE_CPPDRIVER) @@ -147,6 +148,6 @@ ENDIF() # Command that copies test perl script to the test directory. TRIBITS_COPY_FILES_TO_BINARY_DIR(zoltan_ctest_zoltan_copy SOURCE_FILES ctest_zoltan.pl ctest_zoltan_purify.sh - CATEGORIES NIGHTLY PERFORMANCE + CATEGORIES BASIC PERFORMANCE ) From 11b2e01f7175cc2e23601cf68cda4da5c879b231 Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Mon, 22 Jul 2019 11:23:13 -0600 Subject: [PATCH 18/44] MueLu utils: Add script to convert xml -> yaml --- packages/muelu/utils/paramlist/xml2yaml.py | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 packages/muelu/utils/paramlist/xml2yaml.py diff --git a/packages/muelu/utils/paramlist/xml2yaml.py b/packages/muelu/utils/paramlist/xml2yaml.py new file mode 100755 index 000000000000..536dfbe3225c --- /dev/null +++ b/packages/muelu/utils/paramlist/xml2yaml.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +from xml.etree import ElementTree as ET +import yaml +import argparse + +parser = argparse.ArgumentParser(description="Convert a xml input file to yaml") +parser.add_argument("-o", "--output", dest="output", + default="", help="yaml output file") +parser.add_argument('xml', type=str, + help='input xml') + +options = parser.parse_args() + +def xml_dict(node, path="", dic=None): + if dic == None: + dic = {} + if 'name' in node.attrib: + name = node.attrib['name'] + else: + name = 'root' + if node.tag == 'ParameterList': + dic[name] = {} + for childnode in node: + xml_dict(childnode, name, dic[name]) + else: + if node.attrib['type'] == 'int': + dic[name] = int(node.attrib['value']) + elif node.attrib['type'] == 'double': + dic[name] = float(node.attrib['value']) + elif node.attrib['type'] == 'bool': + dic[name] = node.attrib['value'] == 'true' + else: + dic[name] = node.attrib['value'] + return dic + + +xml = ET.parse(options.xml) +root_element = xml.getroot() +dic = xml_dict(root_element) +if options.output == "": + print(yaml.dump(dic, default_flow_style=False)) +else: + with open(options.output, 'w') as f: + yaml.dump(dic, f, default_flow_style=False) From 39a3e7c1f0bce1362d51852afce4436f9578ee6e Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Tue, 8 Oct 2019 08:45:45 -0600 Subject: [PATCH 19/44] MueLu Utilities: Do not return const view from Dirichlet BC detection --- .../muelu/src/Utils/MueLu_Utilities_kokkos_decl.hpp | 8 ++++---- .../muelu/src/Utils/MueLu_Utilities_kokkos_def.hpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/muelu/src/Utils/MueLu_Utilities_kokkos_decl.hpp b/packages/muelu/src/Utils/MueLu_Utilities_kokkos_decl.hpp index cc9ed1085958..0c9fd559cb16 100644 --- a/packages/muelu/src/Utils/MueLu_Utilities_kokkos_decl.hpp +++ b/packages/muelu/src/Utils/MueLu_Utilities_kokkos_decl.hpp @@ -253,7 +253,7 @@ namespace MueLu { @return boolean array. The ith entry is true iff row i is a Dirichlet row. */ - static Kokkos::View DetectDirichletRows(const Matrix& A, const Magnitude& tol = Teuchos::ScalarTraits::zero(), const bool count_twos_as_dirichlet=false); + static Kokkos::View DetectDirichletRows(const Matrix& A, const Magnitude& tol = Teuchos::ScalarTraits::zero(), const bool count_twos_as_dirichlet=false); /*! @brief Detect Dirichlet columns based on Dirichlet rows @@ -265,7 +265,7 @@ namespace MueLu { @return boolean array. The ith entry is true iff row i is a Dirichlet column. */ - static Kokkos::View DetectDirichletCols(const Matrix& A, const Kokkos::View& dirichletRows); + static Kokkos::View DetectDirichletCols(const Matrix& A, const Kokkos::View& dirichletRows); static void ZeroDirichletRows(RCP& A, const Kokkos::View& dirichletRows, SC replaceWith=Teuchos::ScalarTraits::zero()); @@ -404,9 +404,9 @@ namespace MueLu { } // todo: move this to UtilitiesBase::kokkos - static Kokkos::View DetectDirichletRows(const Matrix& A, const Magnitude& tol = Teuchos::ScalarTraits::zero(), const bool count_twos_as_dirichlet=false); + static Kokkos::View DetectDirichletRows(const Matrix& A, const Magnitude& tol = Teuchos::ScalarTraits::zero(), const bool count_twos_as_dirichlet=false); - static Kokkos::View DetectDirichletCols(const Matrix& A, const Kokkos::View& dirichletRows); + static Kokkos::View DetectDirichletCols(const Matrix& A, const Kokkos::View& dirichletRows); static void ZeroDirichletRows(RCP& A, const Kokkos::View& dirichletRows, SC replaceWith=Teuchos::ScalarTraits::zero()); diff --git a/packages/muelu/src/Utils/MueLu_Utilities_kokkos_def.hpp b/packages/muelu/src/Utils/MueLu_Utilities_kokkos_def.hpp index 639c52db9878..4e2b0422ffca 100644 --- a/packages/muelu/src/Utils/MueLu_Utilities_kokkos_def.hpp +++ b/packages/muelu/src/Utils/MueLu_Utilities_kokkos_def.hpp @@ -345,7 +345,7 @@ namespace MueLu { template - Kokkos::View + Kokkos::View DetectDirichletRows(const Xpetra::Matrix& A, const typename Teuchos::ScalarTraits::magnitudeType& tol, const bool count_twos_as_dirichlet) { @@ -395,14 +395,14 @@ namespace MueLu { } template - Kokkos::View + Kokkos::View Utilities_kokkos:: DetectDirichletRows(const Xpetra::Matrix& A, const typename Teuchos::ScalarTraits::magnitudeType& tol, const bool count_twos_as_dirichlet) { return MueLu::DetectDirichletRows(A, tol, count_twos_as_dirichlet); } template - Kokkos::View + Kokkos::View Utilities_kokkos:: DetectDirichletRows(const Xpetra::Matrix& A, const typename Teuchos::ScalarTraits::magnitudeType& tol, const bool count_twos_as_dirichlet) { return MueLu::DetectDirichletRows(A, tol,count_twos_as_dirichlet); @@ -410,7 +410,7 @@ namespace MueLu { template - Kokkos::View + Kokkos::View DetectDirichletCols(const Xpetra::Matrix& A, const Kokkos::View& dirichletRows) { using ATS = Kokkos::ArithTraits; @@ -462,7 +462,7 @@ namespace MueLu { template - Kokkos::View + Kokkos::View Utilities_kokkos:: DetectDirichletCols(const Xpetra::Matrix& A, const Kokkos::View& dirichletRows) { @@ -470,7 +470,7 @@ namespace MueLu { } template - Kokkos::View + Kokkos::View Utilities_kokkos:: DetectDirichletCols(const Xpetra::Matrix& A, const Kokkos::View& dirichletRows) { From 69fa3041711890dcb104758280b481a6b1cf8fbd Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Thu, 17 Oct 2019 09:22:12 -0600 Subject: [PATCH 20/44] MueLu RefMaxwell: Finer timers --- .../adapters/xpetra/MueLu_RefMaxwell_def.hpp | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp b/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp index 315a3965e859..17f4a93ca67c 100644 --- a/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp +++ b/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp @@ -1738,16 +1738,32 @@ namespace MueLu { Scalar one = Teuchos::ScalarTraits::one(); - { // compute residuals + { // compute residual Teuchos::TimeMonitor tmRes(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: residual calculation")); Utilities::Residual(*SM_Matrix_, X, RHS, *residual_); + } + + { // restrict residual to sub-hierarchies + if (implicitTranspose_) { - P11_->apply(*residual_,*P11res_,Teuchos::TRANS); - D0_Matrix_->apply(*residual_,*D0res_,Teuchos::TRANS); + { + Teuchos::TimeMonitor tmP11(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: restriction coarse (1,1) (implicit)")); + P11_->apply(*residual_,*P11res_,Teuchos::TRANS); + } + { + Teuchos::TimeMonitor tmD0(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: restriction (2,2) (implicit)")); + D0_Matrix_->apply(*residual_,*D0res_,Teuchos::TRANS); + } } else { - R11_->apply(*residual_,*P11res_,Teuchos::NO_TRANS); - D0_T_Matrix_->apply(*residual_,*D0res_,Teuchos::NO_TRANS); + { + Teuchos::TimeMonitor tmP11(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: restriction coarse (1,1) (explicit)")); + R11_->apply(*residual_,*P11res_,Teuchos::NO_TRANS); + } + { + Teuchos::TimeMonitor tmD0(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: restriction (2,2) (explicit)")); + D0_T_Matrix_->apply(*residual_,*D0res_,Teuchos::NO_TRANS); + } } } @@ -1806,22 +1822,30 @@ namespace MueLu { P11x_.swap(P11xTmp_); } - { // update current solution - Teuchos::TimeMonitor tmUp(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: update")); + { // prolongate (1,1) block + Teuchos::TimeMonitor tmP11(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation coarse (1,1)")); P11_->apply(*P11x_,*residual_,Teuchos::NO_TRANS); + } + + { // prolongate (2,2) block + Teuchos::TimeMonitor tmD0(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation (2,2)")); D0_Matrix_->apply(*D0x_,*residual_,Teuchos::NO_TRANS,one,one); - X.update(one, *residual_, one); + } - if (!ImporterH_.is_null()) { - P11res_.swap(P11resTmp_); - P11x_.swap(P11xTmp_); - } - if (!Importer22_.is_null()) { - D0res_.swap(D0resTmp_); - D0x_.swap(D0xTmp_); - } + { // update current solution + Teuchos::TimeMonitor tmUpdate(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: update")); + X.update(one, *residual_, one); + } + if (!ImporterH_.is_null()) { + P11res_.swap(P11resTmp_); + P11x_.swap(P11xTmp_); } + if (!Importer22_.is_null()) { + D0res_.swap(D0resTmp_); + D0x_.swap(D0xTmp_); + } + } From ab5f3f4561995a1246f471fb8fbf8989f298ff56 Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Tue, 18 Jun 2019 08:28:06 -0600 Subject: [PATCH 21/44] MueLu Maxwell test: Hook up ML Maxwell-1 --- packages/muelu/test/maxwell/CMakeLists.txt | 2 +- packages/muelu/test/maxwell/Maxwell3D.cpp | 92 +++++++++++++++++++-- packages/muelu/test/maxwell/Maxwell_ML1.xml | 32 +++++++ 3 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 packages/muelu/test/maxwell/Maxwell_ML1.xml diff --git a/packages/muelu/test/maxwell/CMakeLists.txt b/packages/muelu/test/maxwell/CMakeLists.txt index a43366bc541c..51f83e006ad2 100644 --- a/packages/muelu/test/maxwell/CMakeLists.txt +++ b/packages/muelu/test/maxwell/CMakeLists.txt @@ -72,7 +72,7 @@ IF (${PACKAGE_NAME}_ENABLE_Belos AND ${PACKAGE_NAME}_ENABLE_Amesos2) TRIBITS_COPY_FILES_TO_BINARY_DIR(Maxwell_cp - SOURCE_FILES M0.mat M1.mat S.mat D0.mat coords.mat Maxwell.xml Maxwell_ML.xml Maxwell_ML_MueLu.xml + SOURCE_FILES M0.mat M1.mat S.mat D0.mat coords.mat Maxwell.xml Maxwell_ML.xml Maxwell_ML_MueLu.xml Maxwell_ML1.xml ) IF(HAVE_MUELU_COMPLEX) diff --git a/packages/muelu/test/maxwell/Maxwell3D.cpp b/packages/muelu/test/maxwell/Maxwell3D.cpp index d7ad1aacd318..2099210a25bb 100644 --- a/packages/muelu/test/maxwell/Maxwell3D.cpp +++ b/packages/muelu/test/maxwell/Maxwell3D.cpp @@ -101,9 +101,19 @@ // Helper functions for compilation purposes template struct ML_Wrapper{ + static void Generate_ML_MaxwellPreconditioner(Teuchos::RCP >& SM, + Teuchos::RCP >& D0, + Teuchos::RCP >& Kn, + Teuchos::RCP >& nullspace, + Teuchos::RCP::coordinateType,LocalOrdinal,GlobalOrdinal,Node> >& coords, + Teuchos::ParameterList & mueluList, + Teuchos::RCP >& mlopX) { + throw std::runtime_error("Template parameter mismatch"); + } + static void Generate_ML_RefMaxwellPreconditioner(Teuchos::RCP >& SM, Teuchos::RCP >& D0, - Teuchos::RCP >& Ms, + Teuchos::RCP >& Ms, Teuchos::RCP >& M0inv, Teuchos::RCP >& M1, Teuchos::RCP >& nullspace, @@ -117,6 +127,55 @@ struct ML_Wrapper{ template struct ML_Wrapper { + static void Generate_ML_MaxwellPreconditioner(Teuchos::RCP >& SM, + Teuchos::RCP >& D0, + Teuchos::RCP >& Kn, + Teuchos::RCP >& nullspace, + Teuchos::RCP::coordinateType,int,GlobalOrdinal,Kokkos::Compat::KokkosSerialWrapperNode> >& coords, + Teuchos::ParameterList & mueluList, + Teuchos::RCP >& mlopX) { + typedef double SC; + typedef int LO; + typedef GlobalOrdinal GO; + typedef Kokkos::Compat::KokkosSerialWrapperNode NO; + typedef typename Teuchos::ScalarTraits::coordinateType coordinate_type; + using Teuchos::RCP; + using Teuchos::rcp; + typedef typename Xpetra::Matrix Matrix; + + RCP epetraSM = Xpetra::Helpers::Op2EpetraCrs(SM); + RCP epetraD0 = Xpetra::Helpers::Op2EpetraCrs(D0); + if(!coords.is_null()) { + RCP epetraCoord = MueLu::Utilities::MV2EpetraMV(coords); + if(epetraCoord->NumVectors() > 0) mueluList.set("x-coordinates",(*epetraCoord)[0]); + if(epetraCoord->NumVectors() > 1) mueluList.set("y-coordinates",(*epetraCoord)[1]); + if(epetraCoord->NumVectors() > 2) mueluList.set("z-coordinates",(*epetraCoord)[2]); + } + if(!nullspace.is_null()) { + RCP epetraNullspace = MueLu::Utilities::MV2EpetraMV(nullspace); + mueluList.set("null space: dimension",epetraNullspace->NumVectors()); + mueluList.set("null space: vectors",(*epetraNullspace)[0]); + mueluList.set("null space: type","pre-computed"); + } + RCP epetraKn; + if (Kn.is_null()) { + RCP temp = Xpetra::MatrixFactory::Build(SM->getRangeMap(),0); + Xpetra::MatrixMatrix::Multiply(*SM,false,*D0,false,*temp,true,true); + RCP Kn2 = Xpetra::MatrixFactory::Build(D0->getDomainMap(),0); + Xpetra::MatrixMatrix::Multiply(*D0,true,*temp,false,*Kn2,true,true); + epetraKn = Xpetra::Helpers::Op2EpetraCrs(Kn2); + } else + epetraKn = Xpetra::Helpers::Op2EpetraCrs(Kn); + + RCP mlop = rcp(new ML_Epetra::MultiLevelPreconditioner(*epetraSM,*epetraD0,*epetraKn,mueluList,true)); +#if defined(HAVE_MUELU_BELOS) + // NOTE: Belos needs the Apply() and AppleInverse() routines of ML swapped. So... + mlop = rcp(new Belos::EpetraPrecOp(mlop)); +#endif + + mlopX = rcp(new Xpetra::EpetraOperator(mlop)); + } + static void Generate_ML_RefMaxwellPreconditioner(Teuchos::RCP >& SM, Teuchos::RCP >& D0, Teuchos::RCP >& Ms, @@ -137,8 +196,12 @@ struct ML_Wrapper epetraSM = Xpetra::Helpers::Op2EpetraCrs(SM); RCP epetraD0 = Xpetra::Helpers::Op2EpetraCrs(D0); RCP epetraM0inv = Xpetra::Helpers::Op2EpetraCrs(M0inv); - RCP epetraMs = Xpetra::Helpers::Op2EpetraCrs(Ms); + RCP epetraMs; RCP epetraM1 = Xpetra::Helpers::Op2EpetraCrs(M1); + if (!Ms.is_null()) + epetraMs = Xpetra::Helpers::Op2EpetraCrs(Ms); + else + epetraMs = epetraM1; mueluList.set("D0",epetraD0); mueluList.set("Ms",epetraMs); mueluList.set("M0inv",epetraM0inv); @@ -489,7 +552,7 @@ int MainWrappers::main_(Teuchos::Command double tol = 1e-10; clp.setOption("tol", &tol, "solver convergence tolerance"); bool use_stacked_timer = false; clp.setOption("stacked-timer", "no-stacked-timer", &use_stacked_timer, "use stacked timer"); - std::string S_file, SM_file, M1_file, M0_file, M0inv_file, D0_file, coords_file, rhs_file="", nullspace_file="", Ms_file="", sol_file=""; + std::string S_file, SM_file, M1_file, M0_file, M0inv_file, D0_file, coords_file, rhs_file="", nullspace_file="", Ms_file="", sol_file="", Kn_file=""; S_file = "S.mat"; SM_file = ""; M1_file = "M1.mat"; @@ -503,6 +566,7 @@ int MainWrappers::main_(Teuchos::Command clp.setOption("Ms", &Ms_file); clp.setOption("M1", &M1_file); clp.setOption("M0", &M0_file); + clp.setOption("Kn", &Kn_file); clp.setOption("M0inv", &M0inv_file); clp.setOption("D0", &D0_file); clp.setOption("coords", &coords_file); @@ -522,6 +586,8 @@ int MainWrappers::main_(Teuchos::Command xml = "Maxwell.xml"; else if (precType == "ML-RefMaxwell") xml = "Maxwell_ML.xml"; + else if (precType == "ML-Maxwell") + xml = "Maxwell_ML1.xml"; } comm->barrier(); @@ -548,19 +614,19 @@ int MainWrappers::main_(Teuchos::Command else Ms_Matrix = M1_Matrix; // build stiffness plus mass matrix (SM_Matrix) - RCP SM_Matrix; + RCP SM_Matrix, S_Matrix; if (SM_file == "") { // edge stiffness matrix - RCP S_Matrix = Xpetra::IO::Read(S_file, edge_map); + S_Matrix = Xpetra::IO::Read(S_file, edge_map); Xpetra::MatrixMatrix::TwoMatrixAdd(*S_Matrix,false,(SC)1.0,*M1_Matrix,false,scaling,SM_Matrix,*out); SM_Matrix->fillComplete(); } else { SM_Matrix = Xpetra::IO::Read(SM_file, edge_map); } - RCP M0inv_Matrix; + RCP M0inv_Matrix, M0_Matrix; if (M0inv_file == "") { // nodal mass matrix - RCP M0_Matrix = Xpetra::IO::Read(M0_file, node_map); + M0_Matrix = Xpetra::IO::Read(M0_file, node_map); // build lumped mass matrix inverse (M0inv_Matrix) RCP diag = Utilities::GetLumpedMatrixDiagonal(M0_Matrix); RCP M0inv_MatrixWrap = Teuchos::rcp(new CrsMatrixWrap(node_map, node_map, 0, Xpetra::StaticProfile)); @@ -625,6 +691,17 @@ int MainWrappers::main_(Teuchos::Command M1_Matrix,nullspace,coords,params,preconditioner); #else throw std::runtime_error("ML not available."); +#endif + } else if (precType=="ML-Maxwell") { +#if defined(HAVE_MUELU_ML) and defined(HAVE_MUELU_EPETRA) + TEUCHOS_ASSERT(lib==Xpetra::UseEpetra); + RCP Kn_Matrix; + if (Kn_file!="") + Kn_Matrix = Xpetra::IO::Read(Kn_file, node_map); + ML_Wrapper::Generate_ML_MaxwellPreconditioner(SM_Matrix,D0_Matrix,Kn_Matrix, + nullspace,coords,params,preconditioner); +#else + throw std::runtime_error("ML not available."); #endif } @@ -669,6 +746,7 @@ int MainWrappers::main_(Teuchos::Command belosParams->set("Verbosity", Belos::Errors + Belos::Warnings + Belos::StatusTestDetails); belosParams->set("Output Frequency",1); belosParams->set("Output Style",Belos::Brief); + belosParams->set("Implicit Residual Scaling","None"); solver = factory->create(belosSolverType,belosParams); comm->barrier(); diff --git a/packages/muelu/test/maxwell/Maxwell_ML1.xml b/packages/muelu/test/maxwell/Maxwell_ML1.xml new file mode 100644 index 000000000000..46dee851a08e --- /dev/null +++ b/packages/muelu/test/maxwell/Maxwell_ML1.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ccbfe4665378d85a2dadc7749d5aab4a5dbe0df5 Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Mon, 7 Oct 2019 13:36:42 -0600 Subject: [PATCH 22/44] MiniEM: Read Pamgen meshes --- .../panzer/mini-em/example/BlockPrec/main.cpp | 17 ++++++++++++++--- .../mini-em/example/BlockPrec/maxwell.xml | 8 ++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/panzer/mini-em/example/BlockPrec/main.cpp b/packages/panzer/mini-em/example/BlockPrec/main.cpp index 6efcde79b799..9697ad6608af 100644 --- a/packages/panzer/mini-em/example/BlockPrec/main.cpp +++ b/packages/panzer/mini-em/example/BlockPrec/main.cpp @@ -248,9 +248,20 @@ int main_(Teuchos::CommandLineProcessor &clp, int argc,char * argv[]) mesh_factory->setParameterList(pl); // build mesh mesh = mesh_factory->buildUncommitedMesh(MPI_COMM_WORLD); - //get dt - if (dt <=0.) + // get dt + if (dt <= 0.) dt = input_pl->get("dt"); + } else if (mesh_pl.get("Source") == "Pamgen Mesh") { // Pamgen mesh generator + Teuchos::ParameterList & pamgen_pl = mesh_pl.sublist("Pamgen Mesh"); + Teuchos::RCP pl = Teuchos::rcp(new Teuchos::ParameterList(pamgen_pl.sublist("Pamgen Parameters"))); + pl->set("File Type","Pamgen"); + mesh_factory = Teuchos::rcp(new panzer_stk::STK_ExodusReaderFactory()); + mesh_factory->setParameterList(pl); + // build mesh + mesh = mesh_factory->buildUncommitedMesh(MPI_COMM_WORLD); + // get dt + if (dt <= 0.) + dt = pamgen_pl.get("dt"); } else if (mesh_pl.get("Source") == "Inline Mesh") { // Inline mesh generator // set mesh factory parameters Teuchos::ParameterList & inline_gen_pl = mesh_pl.sublist("Inline Mesh"); @@ -285,7 +296,7 @@ int main_(Teuchos::CommandLineProcessor &clp, int argc,char * argv[]) mesh = mesh_factory->buildUncommitedMesh(MPI_COMM_WORLD); // set dt - if (dt <=0.) { + if (dt <= 0.) { if (inline_gen_pl.isType("dt")) dt = inline_gen_pl.get("dt"); else { diff --git a/packages/panzer/mini-em/example/BlockPrec/maxwell.xml b/packages/panzer/mini-em/example/BlockPrec/maxwell.xml index b37373ddff74..a57540cca7df 100644 --- a/packages/panzer/mini-em/example/BlockPrec/maxwell.xml +++ b/packages/panzer/mini-em/example/BlockPrec/maxwell.xml @@ -2,6 +2,7 @@ + @@ -11,6 +12,13 @@ + + + + + + + From 0642470c4636c397cc1410226eca4414c0b6054b Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Thu, 10 Oct 2019 09:53:32 -0600 Subject: [PATCH 23/44] MiniEM: Handle dt correctly for user provided solver parameter file --- packages/panzer/mini-em/example/BlockPrec/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/panzer/mini-em/example/BlockPrec/main.cpp b/packages/panzer/mini-em/example/BlockPrec/main.cpp index 9697ad6608af..c57932d39aac 100644 --- a/packages/panzer/mini-em/example/BlockPrec/main.cpp +++ b/packages/panzer/mini-em/example/BlockPrec/main.cpp @@ -342,7 +342,6 @@ int main_(Teuchos::CommandLineProcessor &clp, int argc,char * argv[]) return EXIT_FAILURE; else if (solver == ML_REFMAXWELL) { updateParams("solverMLRefMaxwell.xml", lin_solver_pl, comm, out); - lin_solver_pl->sublist("Preconditioner Types").sublist("Teko").sublist("Inverse Factory Library").sublist("Maxwell").set("dt",dt); } else if (solver == MUELU_REFMAXWELL) { if (linAlgebra == linAlgTpetra) { updateParams("solverMueLuRefMaxwell.xml", lin_solver_pl, comm, out); @@ -373,10 +372,13 @@ int main_(Teuchos::CommandLineProcessor &clp, int argc,char * argv[]) if (dim == 2) updateParams("solverMueLuRefMaxwell2D.xml", lin_solver_pl, comm, out); } - lin_solver_pl->sublist("Preconditioner Types").sublist("Teko").sublist("Inverse Factory Library").sublist("Maxwell").set("dt",dt); } } else updateParams(xml, lin_solver_pl, comm, out); + if (lin_solver_pl->sublist("Preconditioner Types").isSublist("Teko") && + lin_solver_pl->sublist("Preconditioner Types").sublist("Teko").isSublist("Inverse Factory Library") && + lin_solver_pl->sublist("Preconditioner Types").sublist("Teko").sublist("Inverse Factory Library").isSublist("Maxwell")) + lin_solver_pl->sublist("Preconditioner Types").sublist("Teko").sublist("Inverse Factory Library").sublist("Maxwell").set("dt",dt); lin_solver_pl->print(*out); // The curl-curl term needs to be scaled by dt, the RefMaxwell augmentation needs 1/dt From f4adc8dff236281b076e6fdf39aacf5e31fbff72 Mon Sep 17 00:00:00 2001 From: Christian Glusa Date: Thu, 17 Oct 2019 09:52:22 -0600 Subject: [PATCH 24/44] MueLu RefMaxwell: Add fused prolongation+update --- .../adapters/xpetra/MueLu_RefMaxwell_decl.hpp | 2 +- .../adapters/xpetra/MueLu_RefMaxwell_def.hpp | 47 ++++++++++++------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_decl.hpp b/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_decl.hpp index 110bb1d59bc2..42cc28fed762 100644 --- a/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_decl.hpp +++ b/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_decl.hpp @@ -403,7 +403,7 @@ namespace MueLu { Teuchos::RCP AH_AP_reuse_data_, AH_RAP_reuse_data_; Teuchos::RCP A22_AP_reuse_data_, A22_RAP_reuse_data_; //! Some options - bool disable_addon_, dump_matrices_,useKokkos_,use_as_preconditioner_,implicitTranspose_; + bool disable_addon_, dump_matrices_,useKokkos_,use_as_preconditioner_,implicitTranspose_,fuseProlongationAndUpdate_; std::string mode_; //! Temporary memory mutable Teuchos::RCP P11res_, P11x_, D0res_, D0x_, residual_, P11resTmp_, P11xTmp_, D0resTmp_, D0xTmp_; diff --git a/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp b/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp index 17f4a93ca67c..d2fd0ca0001d 100644 --- a/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp +++ b/packages/muelu/adapters/xpetra/MueLu_RefMaxwell_def.hpp @@ -127,12 +127,13 @@ namespace MueLu { list = newList; } - parameterList_ = list; - disable_addon_ = list.get("refmaxwell: disable addon",MasterList::getDefault("refmaxwell: disable addon")); - mode_ = list.get("refmaxwell: mode",MasterList::getDefault("refmaxwell: mode")); - use_as_preconditioner_ = list.get("refmaxwell: use as preconditioner",MasterList::getDefault("refmaxwell: use as preconditioner")); - dump_matrices_ = list.get("refmaxwell: dump matrices",MasterList::getDefault("refmaxwell: dump matrices")); - implicitTranspose_ = list.get("transpose: use implicit",MasterList::getDefault("transpose: use implicit")); + parameterList_ = list; + disable_addon_ = list.get("refmaxwell: disable addon",MasterList::getDefault("refmaxwell: disable addon")); + mode_ = list.get("refmaxwell: mode",MasterList::getDefault("refmaxwell: mode")); + use_as_preconditioner_ = list.get("refmaxwell: use as preconditioner",MasterList::getDefault("refmaxwell: use as preconditioner")); + dump_matrices_ = list.get("refmaxwell: dump matrices",MasterList::getDefault("refmaxwell: dump matrices")); + implicitTranspose_ = list.get("transpose: use implicit",MasterList::getDefault("transpose: use implicit")); + fuseProlongationAndUpdate_ = list.get("fuse prolongation and update",MasterList::getDefault("fuse prolongation and update")); if(list.isSublist("refmaxwell: 11list")) precList11_ = list.sublist("refmaxwell: 11list"); @@ -1822,19 +1823,31 @@ namespace MueLu { P11x_.swap(P11xTmp_); } - { // prolongate (1,1) block - Teuchos::TimeMonitor tmP11(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation coarse (1,1)")); - P11_->apply(*P11x_,*residual_,Teuchos::NO_TRANS); - } + if (fuseProlongationAndUpdate_) { + { // prolongate (1,1) block + Teuchos::TimeMonitor tmP11(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation coarse (1,1) (fused)")); + P11_->apply(*P11x_,X,Teuchos::NO_TRANS,one,one); + } - { // prolongate (2,2) block - Teuchos::TimeMonitor tmD0(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation (2,2)")); - D0_Matrix_->apply(*D0x_,*residual_,Teuchos::NO_TRANS,one,one); - } + { // prolongate (2,2) block + Teuchos::TimeMonitor tmD0(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation (2,2) (fused)")); + D0_Matrix_->apply(*D0x_,X,Teuchos::NO_TRANS,one,one); + } + } else { + { // prolongate (1,1) block + Teuchos::TimeMonitor tmP11(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation coarse (1,1) (unfused)")); + P11_->apply(*P11x_,*residual_,Teuchos::NO_TRANS); + } - { // update current solution - Teuchos::TimeMonitor tmUpdate(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: update")); - X.update(one, *residual_, one); + { // prolongate (2,2) block + Teuchos::TimeMonitor tmD0(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: prolongation (2,2) (unfused)")); + D0_Matrix_->apply(*D0x_,*residual_,Teuchos::NO_TRANS,one,one); + } + + { // update current solution + Teuchos::TimeMonitor tmUpdate(*Teuchos::TimeMonitor::getNewTimer("MueLu RefMaxwell: update")); + X.update(one, *residual_, one); + } } if (!ImporterH_.is_null()) { From 02ba25cbd9573fb73e8f9a6c99cffcc6e17d7002 Mon Sep 17 00:00:00 2001 From: "K. Devine" Date: Thu, 17 Oct 2019 15:10:12 -0600 Subject: [PATCH 25/44] rythmos: fixed printing of Teuchos::SerialDense* to remove deprecated behavior. Following pattern in #5374. --- packages/rythmos/src/Rythmos_ExplicitRKStepper_def.hpp | 6 +++--- packages/rythmos/src/Rythmos_RKButcherTableau.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/rythmos/src/Rythmos_ExplicitRKStepper_def.hpp b/packages/rythmos/src/Rythmos_ExplicitRKStepper_def.hpp index 8af89c2dadbc..f132ceb94d81 100644 --- a/packages/rythmos/src/Rythmos_ExplicitRKStepper_def.hpp +++ b/packages/rythmos/src/Rythmos_ExplicitRKStepper_def.hpp @@ -433,9 +433,9 @@ void ExplicitRKStepper::describe( } out << "ktemp_vector = " << std::endl; out << Teuchos::describe(*ktemp_vector_,verbLevel); - out << "ERK Butcher Tableau A matrix: " << erkButcherTableau_->A() << std::endl; - out << "ERK Butcher Tableau b vector: " << erkButcherTableau_->b() << std::endl; - out << "ERK Butcher Tableau c vector: " << erkButcherTableau_->c() << std::endl; + out << "ERK Butcher Tableau A matrix: " << printMat(erkButcherTableau_->A()) << std::endl; + out << "ERK Butcher Tableau b vector: " << printMat(erkButcherTableau_->b()) << std::endl; + out << "ERK Butcher Tableau c vector: " << printMat(erkButcherTableau_->c()) << std::endl; out << "t = " << t_ << std::endl; } } diff --git a/packages/rythmos/src/Rythmos_RKButcherTableau.hpp b/packages/rythmos/src/Rythmos_RKButcherTableau.hpp index 12d95b2e3397..fa2f5ef611fe 100644 --- a/packages/rythmos/src/Rythmos_RKButcherTableau.hpp +++ b/packages/rythmos/src/Rythmos_RKButcherTableau.hpp @@ -200,9 +200,9 @@ class RKButcherTableauDefaultBase : out << this->description() << std::endl; out << this->getMyDescription() << std::endl; out << "number of Stages = " << this->numStages() << std::endl; - out << "A = " << this->A() << std::endl; - out << "b = " << this->b() << std::endl; - out << "c = " << this->c() << std::endl; + out << "A = " << printMat(this->A()) << std::endl; + out << "b = " << printMat(this->b()) << std::endl; + out << "c = " << printMat(this->c()) << std::endl; out << "order = " << this->order() << std::endl; } } From 924de2e4d9e45b7eddda050b38f3d253bae3e599 Mon Sep 17 00:00:00 2001 From: "Curtis C. Ober" Date: Fri, 18 Oct 2019 08:26:27 -0600 Subject: [PATCH 26/44] Tempus: Cleanup some warnings. * Removed some shadow warnings. * Replaced some double declaration types that should be Scalar. * Fixed some "local variable will be copied despite being returned by name [-Wreturn-std-move]" warnings using std::move(). All tests pass on my Mac. --- .../src/Tempus_StepperIMEX_RK_Partition_impl.hpp | 16 ++++++++-------- .../tempus/src/Tempus_StepperIMEX_RK_impl.hpp | 16 ++++++++-------- .../tempus/src/Tempus_StepperSubcycling_impl.hpp | 5 ++--- .../Tempus_WrapperModelEvaluatorBasic_impl.hpp | 4 ++-- ..._WrapperModelEvaluatorPairIMEX_Basic_impl.hpp | 6 +++--- ...pperModelEvaluatorPairPartIMEX_Basic_impl.hpp | 10 +++++----- ...pus_WrapperModelEvaluatorSecondOrder_impl.hpp | 4 ++-- .../test/Subcycling/Tempus_SubcyclingTest.cpp | 4 +--- 8 files changed, 31 insertions(+), 34 deletions(-) diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp index 6ff236e5bd2d..1f96f1a84419 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp @@ -101,11 +101,11 @@ void StepperIMEX_RK_Partition::setTableaus( int order = 1; - auto explicitTableau = Teuchos::rcp(new RKButcherTableau( + auto expTableau = Teuchos::rcp(new RKButcherTableau( "Explicit Tableau - Partitioned IMEX RK 1st order", A,b,c,order,order,order)); - this->setExplicitTableau(explicitTableau); + this->setExplicitTableau(expTableau); } { // Implicit Tableau @@ -129,11 +129,11 @@ void StepperIMEX_RK_Partition::setTableaus( int order = 1; - auto implicitTableau = Teuchos::rcp(new RKButcherTableau( + auto impTableau = Teuchos::rcp(new RKButcherTableau( "Implicit Tableau - Partitioned IMEX RK 1st order", A,b,c,order,order,order)); - this->setImplicitTableau(implicitTableau); + this->setImplicitTableau(impTableau); } this->setStepperType("Partitioned IMEX RK 1st order"); this->setOrder(1); @@ -176,11 +176,11 @@ void StepperIMEX_RK_Partition::setTableaus( int order = 2; - auto explicitTableau = Teuchos::rcp(new RKButcherTableau( + auto expTableau = Teuchos::rcp(new RKButcherTableau( "Explicit Tableau - Partitioned IMEX RK ARS 233", A,b,c,order,order,order)); - this->setExplicitTableau(explicitTableau); + this->setExplicitTableau(expTableau); } { // Implicit Tableau @@ -197,11 +197,11 @@ void StepperIMEX_RK_Partition::setTableaus( int order = 3; - auto implicitTableau = Teuchos::rcp(new RKButcherTableau( + auto impTableau = Teuchos::rcp(new RKButcherTableau( "Implicit Tableau - Partitioned IMEX RK ARS 233", A,b,c,order,order,order)); - this->setImplicitTableau(implicitTableau); + this->setImplicitTableau(impTableau); } this->setStepperType("Partitioned IMEX RK ARS 233"); this->setOrder(3); diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp index c0d1b466ba16..f44f7ad139a7 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp @@ -101,11 +101,11 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, int order = 1; - auto explicitTableau = Teuchos::rcp(new RKButcherTableau( + auto expTableau = Teuchos::rcp(new RKButcherTableau( "Explicit Tableau - IMEX RK 1st order", A,b,c,order,order,order)); - this->setExplicitTableau(explicitTableau); + this->setExplicitTableau(expTableau); } { // Implicit Tableau @@ -129,11 +129,11 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, int order = 1; - auto implicitTableau = Teuchos::rcp(new RKButcherTableau( + auto impTableau = Teuchos::rcp(new RKButcherTableau( "Implicit Tableau - IMEX RK 1st order", A,b,c,order,order,order)); - this->setImplicitTableau(implicitTableau); + this->setImplicitTableau(impTableau); } this->setStepperType("IMEX RK 1st order"); this->setOrder(1); @@ -175,10 +175,10 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, int order = 2; - auto explicitTableau = Teuchos::rcp(new RKButcherTableau( + auto expTableau = Teuchos::rcp(new RKButcherTableau( "Partition IMEX-RK Explicit Stepper",A,b,c,order,order,order)); - this->setExplicitTableau(explicitTableau); + this->setExplicitTableau(expTableau); } { // Implicit Tableau @@ -195,10 +195,10 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, int order = 3; - auto implicitTableau = Teuchos::rcp(new RKButcherTableau( + auto impTableau = Teuchos::rcp(new RKButcherTableau( "Partition IMEX-RK Implicit Stepper",A,b,c,order,order,order)); - this->setImplicitTableau(implicitTableau); + this->setImplicitTableau(impTableau); } this->setStepperType("IMEX RK ARS 233"); this->setOrder(3); diff --git a/packages/tempus/src/Tempus_StepperSubcycling_impl.hpp b/packages/tempus/src/Tempus_StepperSubcycling_impl.hpp index 5d325cc73132..a47a203502e8 100644 --- a/packages/tempus/src/Tempus_StepperSubcycling_impl.hpp +++ b/packages/tempus/src/Tempus_StepperSubcycling_impl.hpp @@ -50,7 +50,7 @@ StepperSubcycling::StepperSubcycling() stepperPL->set("Stepper Type", "Forward Euler"); tempusPL->set("Default Subcycling Stepper", *stepperPL); - auto sf = Teuchos::rcp(new Tempus::StepperFactory()); + auto sf = Teuchos::rcp(new Tempus::StepperFactory()); auto stepperFE = sf->createStepperForwardEuler(Teuchos::null,Teuchos::null); setSubcyclingStepper(stepperFE); } @@ -266,7 +266,6 @@ void StepperSubcycling::initialize() this->getICConsistency() == "App" || this->getICConsistency() == "Consistent") ) { isValidSetup = false; - Teuchos::RCP out = this->getOStream(); *out << "The IC consistency does not have a valid value!\n" << "('None', 'Zero', 'App' or 'Consistent')\n" << " ICConsistency = " << this->getICConsistency() << "\n"; @@ -417,7 +416,7 @@ void StepperSubcycling::takeStep( currentState->getStepperState(), currentState->getPhysicsState())); - auto scSH = rcp(new Tempus::SolutionHistory()); + auto scSH = rcp(new Tempus::SolutionHistory()); scSH->setName("Subcycling States"); scSH->setStorageType(Tempus::STORAGE_TYPE_STATIC); scSH->setStorageLimit(3); diff --git a/packages/tempus/src/Tempus_WrapperModelEvaluatorBasic_impl.hpp b/packages/tempus/src/Tempus_WrapperModelEvaluatorBasic_impl.hpp index 3641de817494..9263843845e5 100644 --- a/packages/tempus/src/Tempus_WrapperModelEvaluatorBasic_impl.hpp +++ b/packages/tempus/src/Tempus_WrapperModelEvaluatorBasic_impl.hpp @@ -22,7 +22,7 @@ createInArgs() const MEB::InArgsSetup inArgs(appModel_->getNominalValues()); inArgs.setModelEvalDescription(this->description()); - return inArgs; + return std::move(inArgs); } @@ -34,7 +34,7 @@ createOutArgsImpl() const typedef Thyra::ModelEvaluatorBase MEB; MEB::OutArgsSetup outArgs(appModel_->createOutArgs()); outArgs.setModelEvalDescription(this->description()); - return outArgs; + return std::move(outArgs); } diff --git a/packages/tempus/src/Tempus_WrapperModelEvaluatorPairIMEX_Basic_impl.hpp b/packages/tempus/src/Tempus_WrapperModelEvaluatorPairIMEX_Basic_impl.hpp index aaef9258b8cf..428f716e2690 100644 --- a/packages/tempus/src/Tempus_WrapperModelEvaluatorPairIMEX_Basic_impl.hpp +++ b/packages/tempus/src/Tempus_WrapperModelEvaluatorPairIMEX_Basic_impl.hpp @@ -99,7 +99,7 @@ getNominalValues() const { typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgsSetup inArgs = this->createInArgs(); - return inArgs; + return std::move(inArgs); } template @@ -111,7 +111,7 @@ createInArgs() const //MEB::InArgsSetup inArgs(implicitModel_->createInArgs()); MEB::InArgsSetup inArgs(implicitModel_->getNominalValues()); inArgs.setModelEvalDescription(this->description()); - return inArgs; + return std::move(inArgs); } template @@ -122,7 +122,7 @@ createOutArgsImpl() const typedef Thyra::ModelEvaluatorBase MEB; MEB::OutArgsSetup outArgs(implicitModel_->createOutArgs()); outArgs.setModelEvalDescription(this->description()); - return outArgs; + return std::move(outArgs); } template diff --git a/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_impl.hpp b/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_impl.hpp index a54acb0a3d05..0f6d055fdff7 100644 --- a/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_impl.hpp +++ b/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_impl.hpp @@ -370,7 +370,7 @@ getNominalValues() const typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgsSetup inArgs = this->createInArgs(); inArgs.set_Np(1); - return inArgs; + return std::move(inArgs); } template @@ -386,13 +386,13 @@ createInArgs() const MEB::InArgsSetup inArgs(implicitInArgs); inArgs.setModelEvalDescription(this->description()); inArgs.set_Np(np); - return inArgs; + return std::move(inArgs); } MEB::InArgsSetup inArgs(explicitInArgs); inArgs.setModelEvalDescription(this->description()); inArgs.set_Np(np); - return inArgs; + return std::move(inArgs); } template @@ -408,13 +408,13 @@ createOutArgsImpl() const MEB::OutArgsSetup outArgs(implicitOutArgs); outArgs.setModelEvalDescription(this->description()); outArgs.set_Np_Ng(np,implicitOutArgs.Ng()); - return outArgs; + return std::move(outArgs); } MEB::OutArgsSetup outArgs(explicitOutArgs); outArgs.setModelEvalDescription(this->description()); outArgs.set_Np_Ng(np,explicitOutArgs.Ng()); - return outArgs; + return std::move(outArgs); } template diff --git a/packages/tempus/src/Tempus_WrapperModelEvaluatorSecondOrder_impl.hpp b/packages/tempus/src/Tempus_WrapperModelEvaluatorSecondOrder_impl.hpp index febc6440f3e1..b86296e68fac 100644 --- a/packages/tempus/src/Tempus_WrapperModelEvaluatorSecondOrder_impl.hpp +++ b/packages/tempus/src/Tempus_WrapperModelEvaluatorSecondOrder_impl.hpp @@ -27,7 +27,7 @@ createInArgs() const inArgs.set_Np(appModel_->Np()); inArgs.setSupports(MEB::IN_ARG_x); - return inArgs; + return std::move(inArgs); } @@ -47,7 +47,7 @@ createOutArgsImpl() const outArgs.setSupports(MEB::OUT_ARG_f); outArgs.setSupports(MEB::OUT_ARG_W_op); - return outArgs; + return std::move(outArgs); } diff --git a/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp b/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp index 03a9ef936524..c58c7d2cd2ca 100644 --- a/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp +++ b/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp @@ -515,9 +515,7 @@ TEUCHOS_UNIT_TEST(Subcycling, VanDerPolOperatorSplit) if ((n == 0) or (n == nTimeStepSizes-1)) { std::string fname = "Tempus_Subcycling_VanDerPol-Ref.dat"; if (n == 0) fname = "Tempus_Subcycling_VanDerPol.dat"; - RCP > solutionHistory = - integrator->getSolutionHistory(); - writeSolution(fname, solutionHistory); + writeSolution(fname, integrator->getSolutionHistory()); //solutionHistory->printHistory("medium"); } } From 2adf1225174865e19c8c92b486e15a4b978a87c0 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 07:30:41 -0600 Subject: [PATCH 27/44] ATDM: Add support for a single /tweaks/Tweaks.cmake file --- cmake/std/atdm/ATDMDevEnvSettings.cmake | 34 ++++--- cmake/std/atdm/README.md | 117 ++++++++++++++---------- 2 files changed, 91 insertions(+), 60 deletions(-) diff --git a/cmake/std/atdm/ATDMDevEnvSettings.cmake b/cmake/std/atdm/ATDMDevEnvSettings.cmake index a3bc0f565bcb..393911651ddc 100644 --- a/cmake/std/atdm/ATDMDevEnvSettings.cmake +++ b/cmake/std/atdm/ATDMDevEnvSettings.cmake @@ -75,7 +75,8 @@ ELSE() SET(ATDM_KOKKOS_SERIAL ON) ENDIF() -# ATDM_CMAKE_BUILD_TYPE and ATDM_BOUNDS_CHECK +# ATDM_CMAKE_BUILD_TYPE and ATDM_BOUNDS_CHECK (Trilinos_ENABLE_DEBUG) + IF ("$ENV{ATDM_CONFIG_BUILD_TYPE}" STREQUAL "RELEASE-DEBUG") SET(ATDM_CMAKE_BUILD_TYPE RELEASE) SET(ATDM_BOUNDS_CHECK ON) @@ -93,6 +94,8 @@ ELSE() ) ENDIF() +ATDM_SET_CACHE(Trilinos_ENABLE_DEBUG "${ATDM_BOUNDS_CHECK}" CACHE BOOL) + ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS "") ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(SHARED_LIBS OFF) ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(PT_PACKAGES OFF) @@ -120,6 +123,10 @@ IF(ATDM_CONFIG_KOKKOS_ARCH_JOB_NAME_KEYS) _${ATDM_CONFIG_KOKKOS_ARCH_JOB_NAME_KEYS}) ENDIF() +# To be used in Tweaks.cmake files logic +SET(ATDM_COMPILER "$(ENV{ATDM_CONFIG_COMPILER}") +SET(ATDM_KOKKOS_ARCH_JOB_NAME_KEYS ${ATDM_CONFIG_KOKKOS_ARCH_JOB_NAME_KEYS}) + SET(ATDM_BUILD_NAME_KEYS_STR "$ENV{ATDM_CONFIG_COMPILER}_$ENV{ATDM_CONFIG_BUILD_TYPE}_${ATDM_NODE_TYPE}${ATDM_CONFIG_KOKKOS_ARCH_JOB_NAME_KEYS}") PRINT_VAR(ATDM_BUILD_NAME_KEYS_STR) @@ -131,17 +138,21 @@ ATDM_SET_ATDM_VAR_FROM_ENV_AND_DEFAULT(MPI_EXEC_NUMPROCS_FLAG -np) # B) Look for tweaks file(s) for this build and load the file(s) if it exists # -SET(ATDM_TWEAKS_FILE_DEFAULT_DEFAULT - "${CMAKE_CURRENT_LIST_DIR}/$ENV{ATDM_CONFIG_SYSTEM_NAME}/tweaks/${ATDM_BUILD_NAME_KEYS_STR}.cmake") -IF (EXISTS "${ATDM_TWEAKS_FILE_DEFAULT_DEFAULT}") - SET(ATDM_TWEAKS_FILES_DEFAULT "${ATDM_TWEAKS_FILE_DEFAULT_DEFAULT}") -ELSE() - SET(ATDM_TWEAKS_FILES_DEFAULT "") -ENDIF() +SET(ATDM_DEFAULT_TWEAK_FILES + "${CMAKE_CURRENT_LIST_DIR}/$ENV{ATDM_CONFIG_SYSTEM_NAME}/tweaks/${ATDM_BUILD_NAME_KEYS_STR}.cmake" + "${CMAKE_CURRENT_LIST_DIR}/$ENV{ATDM_CONFIG_SYSTEM_NAME}/tweaks/Tweaks.cmake" + ) + +SET(ATDM_TWEAKS_FILES_DEFAULT "") +FOREACH(ATDM_DEFAULT_TWEAK_FILE ${ATDM_DEFAULT_TWEAK_FILES}) + IF (EXISTS "${ATDM_DEFAULT_TWEAK_FILE}") + LIST(APPEND ATDM_TWEAKS_FILES_DEFAULT "${ATDM_DEFAULT_TWEAK_FILE}") + ENDIF() +ENDFOREACH() ADVANCED_SET(ATDM_TWEAKS_FILES "${ATDM_TWEAKS_FILES_DEFAULT}" CACHE FILEPATH - "Extra *.cmake file to include to define tweaks for this ATDM build ${ATDM_BUILD_NAME_KEYS_STR}" + "Extra *.cmake file(s) to include to define tweaks for this ATDM build ${ATDM_BUILD_NAME_KEYS_STR}" ) PRINT_VAR(ATDM_TWEAKS_FILES) @@ -257,7 +268,6 @@ ATDM_SET_CACHE(MPI_EXEC_NUMPROCS_FLAG "${ATDM_MPI_EXEC_NUMPROCS_FLAG}" CACHE STR ATDM_SET_CACHE(MPI_EXEC_POST_NUMPROCS_FLAGS "$ENV{ATDM_CONFIG_MPI_POST_FLAGS}" CACHE STRING) ATDM_SET_CACHE(Trilinos_VERBOSE_CONFIGURE OFF CACHE BOOL) -ATDM_SET_CACHE(Trilinos_ENABLE_DEBUG "${ATDM_BOUNDS_CHECK}" CACHE BOOL) ATDM_SET_CACHE(Trilinos_ENABLE_EXPLICIT_INSTANTIATION ON CACHE BOOL) ATDM_SET_CACHE(Trilinos_ENABLE_INSTALL_CMAKE_CONFIG_FILES ON CACHE BOOL) ATDM_SET_CACHE(Trilinos_ENABLE_DEVELOPMENT_MODE OFF CACHE BOOL) @@ -271,8 +281,8 @@ ATDM_SET_CACHE(Kokkos_ENABLE_Cuda_Relocatable_Device_Code "$ENV{ATDM_CONFIG_CUDA CACHE BOOL) ATDM_SET_CACHE(Kokkos_ENABLE_CXX11_DISPATCH_LAMBDA ON CACHE BOOL) ATDM_SET_CACHE(Kokkos_ENABLE_Cuda_Lambda "${ATDM_USE_CUDA}" CACHE BOOL) -ATDM_SET_CACHE(Kokkos_ENABLE_Debug_Bounds_Check "${ATDM_BOUNDS_CHECK}" CACHE BOOL) -ATDM_SET_CACHE(KOKKOS_ENABLE_DEBUG "${ATDM_BOUNDS_CHECK}" CACHE BOOL) +ATDM_SET_CACHE(Kokkos_ENABLE_Debug_Bounds_Check "${Trilinos_ENABLE_DEBUG}" CACHE BOOL) +ATDM_SET_CACHE(KOKKOS_ENABLE_DEBUG "${Trilinos_ENABLE_DEBUG}" CACHE BOOL) ATDM_SET_CACHE(KOKKOS_ARCH "$ENV{ATDM_CONFIG_KOKKOS_ARCH}" CACHE STRING) ATDM_SET_CACHE(EpetraExt_ENABLE_HDF5 OFF CACHE BOOL) ATDM_SET_CACHE(Panzer_ENABLE_FADTYPE "Sacado::Fad::DFad" CACHE STRING) diff --git a/cmake/std/atdm/README.md b/cmake/std/atdm/README.md index 387b210c275b..6ff620515939 100644 --- a/cmake/std/atdm/README.md +++ b/cmake/std/atdm/README.md @@ -301,10 +301,11 @@ application customers and Trilinos developers just needing to enable a subset of packages. But if package X does get enabled, then it will always have the same configuration options independent of any other packages that are enabled. -When `ATDMDevEnv.cmake` is being processed, if there is a "tweaks" file -defined for a build, then it will be picked up in the CMake cache var ATDM_TWEAKS_FILES and that file will be read in -using `INCLUDE()` to process the extra options contained within it. +When `ATDMDevEnv.cmake` (or `ATDMDevEnvSettings.cmake`) is being processed, if +there are "tweaks" files defined for a build, then they will be picked up in +the CMake cache var ATDM_TWEAKS_FILES and +those files will be read in using `INCLUDE()` to process the extra options +contained within it. ## Installation and usage @@ -1112,6 +1113,7 @@ contents: ___.cmake # [Optional] ___.cmake # [Optional] ... + Tweaks.cmake # [Optional] ``` The optional file `/all_supported_builds.sh` contains a list of @@ -1146,9 +1148,9 @@ example, see `atdm/cee-rhel6/custom-builds.sh` and The **ATDM TWEAKS FILES** in the `cmake/std/atdm//tweaks/` directory contain special settings for specific builds for a specific system. -Typically, this file contains (temporary) disables for tests for that given -build. When a configure is performed, the internal CMake variable -`ATDM_BUILD_NAME_KEYS_STR` set to +Typically, these files contains (temporary) disables for tests and test +exectuables for that given build. When a configure is performed, the internal +CMake variable `ATDM_BUILD_NAME_KEYS_STR` set to `___` (printed to STDOUT) is used to define a default file name: @@ -1158,16 +1160,29 @@ used to define a default file name: If that file exists, then it is set as the default for the cmake cache variable `ATDM_TWEAKS_FILES` (prints to STDOUT) and that file is included and -its options are read. For example, this is what the output looks like on -'waterman': +its options are set as CMake cache varaibles. For example, this is what the +output looks like for a build on 'waterman': ``` -- Reading in configuration options from cmake/std/atdm/ATDMDevEnv.cmake ... --- ATDM_BUILD_NAME_KEYS_STR='GNU_RELEASE_OPENMP_POWER9' --- ATDM_TWEAKS_FILES='<...>/Trilinos/cmake/std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake' --- Including ATDM build tweaks file <...>//Trilinos/cmake/std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake ... +-- ATDM_BUILD_NAME_KEYS_STR='CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70' +-- ATDM_TWEAKS_FILES='<...>/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake' +-- Including ATDM build tweaks file <...>/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake ... ``` +In addition, if the file: + +``` + Trilinos/cmake/std/atdm//tweaks/Tweaks.cmake +``` + +exists, then it will be included after the above +`tweaks/${ATDM_BUILD_NAME_KEYS_STR}.cmake` file for the matching build. +Disables for all builds on a system or for many related builds on a system can +go into the `Tweaks.cmake` file to avoid having to duplicate disables across +multiple `${ATDM_BUILD_NAME_KEYS_STR}.cmake` files. Details are in the next +section. + ## Disabling failing tests @@ -1176,8 +1191,8 @@ platforms for certain builds or based on other criteria (see sub-process [Temporarily disable the failing code or test](https://snl-wiki.sandia.gov/display/CoodinatedDevOpsATDM/Triaging+and+addressing+ATDM+Trilinos+Failures#TriagingandaddressingATDMTrilinosFailures-5.Makesuretheissueisaddressedinatimelyway:)). There are various ways to disable tests with the Trilinos TriBITS/CMake-based -build and test system. Tests can be disabled in the `CMakeLists.txt` files -that define the tests themselves using various logic. But the way to +build and test system. First, tests can be disabled in the `CMakeLists.txt` +files that define the tests themselves using various logic. But the way to selectively disable tests for the ATDM Trilinos builds that will be described here will be to only modify files under the `Trilinos/cmake/std/atdm/` directory. This will be done by setting the CMake cache variable @@ -1235,7 +1250,7 @@ file](#ATDM_TWEAKS_FILES) for that build and platform: ``` Trilinos/cmake/std/atdm//tweaks/.cmake - ``` +``` The tweak file being looked for is printed out in the CMake configure output as the line: @@ -1276,52 +1291,58 @@ described below. ### Disable a test for several or all builds on a specific platform It is often the case that a test needs to be disabled for several (or all) -builds for a given platform. An efficient way to do this is to create a new -`*.cmake` file that contains the `ATDM_SET_ENABLE()` statements and then -include that new file in all of the tweaks files on that system where the -tests should be disabled. - -For example, the Trilinos commit -[3450efd421](https://github.com/trilinos/Trilinos/commit/3450efd421f1ce2b47700853aa4c5801f667202a) -shows how a set of tests were disabled for all of the CUDA builds on the -system `ride` through the creation of the file: +builds for a given platform. The best way to do this is to disable these in +the file: ``` - Trilinos/cmake/std/atdm/ride/tweaks/CUDA_COMMON_TWEAKS.cmake +cmake/std/atdm//tweaks/Tweaks.cmake ``` -and then the inclusion of that file in the specific tweak files for each CUDA -build: +If that file exists, it will get included after the +`.cmake` file as described above. + +Typical logic in a `Tweaks.cmake` file may look like: ``` - Trilinos/cmake/std/atdm/ride/tweaks/CUDA_DEBUG_CUDA.cmake - Trilinos/cmake/std/atdm/ride/tweaks/CUDA_RELEASE_CUDA.cmake -``` +# Disable tests for all builds for this system +ATDM_SET_ENABLE(_DISABLE ON) +ATDM_SET_ENABLE(_DISABLE ON) +... -(before `-POWER8-KEPLER37` was added to the names) using the inserted CMake -statement: +IF (Trilinos_ENABLE_DEBUG) + # Disable tests for all debug builds on this system + ... +ENDIF() -``` -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") -``` +IF (ATDM_NODE_TYPE STREQUAL "CUDA") -An example of using a `*.cmake` file to disable the same set of tests in all -of the builds for a given system is shown in Trilinos commit -[33a933b004](https://github.com/trilinos/Trilinos/commit/33a933b004f88710274906fad612380049e1e82e). -This example shows the creation of the file: + # Disable tests for all CUDA builds for this system + ... -``` - Trilinos/cmake/std/atdm/ride/tweaks/ALL_COMMON_TWEAKS.cmake -``` + IF (Trilinos_ENABLE_DEBUG) + # Disable tests for all CUDA debug builds for this system + ... + ENDIF() -and then the inclusion of that file in all of the specific tweaks files on -'ride' with the statement: + IF (ATDM_CUDA_RDC and Trilinos_ENABLE_DEBUG) + # Disable tests for all CUDA, RDC, debug builds for this system + ... + ENDIF() -``` -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") +ENDIF() ``` -in each of those files. +Any variable that has been set in the `ATDMDevEnvSettings.cmake` file before +these tweak files are included can be used in logic in these files. But the +recommended variables to include in if-logic include the CMake variables +`ATDM_COMPILER` (uppercase), `ATDM_KOKKOS_ARCH_JOB_NAME_KEYS` (uppercase +seprated by `_`), `ATDM_NODE_TYPE` (values `CUDA`, `OPENMP`, `SERIAL`), +`ATDM_CUDA_RDC` (`ON`/`OFF`), `ATDM_FPIC` (`ON`/`OFF`), `ATDM_COMPLEX` +(`ON`/`OFF`), `ATDM_SHARED_LIBS` (`ON`/`OFF`), `ATDM_CMAKE_BUILD_TYPE` (values +`DEBUG`, `RELEASE`, and `RELEASE-DEBUG`), `Trilinos_ENABLE_DEBUG` +(`ON`/`OFF`), and `ATDM_PT_PACKAGES (`ON`/`OFF`)`. No other variables should +be used in if-logic in these files as those variables may change in the +future. ### Disable a test for builds on all platforms @@ -1341,7 +1362,7 @@ For example, Trilinos commit [5e52db03ff](https://github.com/trilinos/Trilinos/c ``` # Disable test that fails for all openmp builds (#3035) -IF (ATDM_USE_OPENMP) +IF (ATDM_NODE_TYPE STREQUAL "OPENMP") ATDM_SET_ENABLE(MueLu_UnitTestsTpetra_MPI_4_DISABLE ON) ENDIF() ``` From 43875cdb55a55c165a24b7393677792827260c9a Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 07:36:16 -0600 Subject: [PATCH 28/44] ATDM: Switch to use of Tweaks.cmake file for waterman builds This will make it easier to add disables for tests across many or all builds like for #3009 and #3020. --- .../tweaks/CUDA-9.2_DEBUG_CUDA_POWER9_VOLTA70.cmake | 3 --- ...CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake | 3 --- .../tweaks/GNU_RELEASE-DEBUG_OPENMP_POWER9.cmake | 1 - cmake/std/atdm/waterman/tweaks/Tweaks.cmake | 13 +++++++++++++ 4 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 cmake/std/atdm/waterman/tweaks/GNU_RELEASE-DEBUG_OPENMP_POWER9.cmake create mode 100644 cmake/std/atdm/waterman/tweaks/Tweaks.cmake diff --git a/cmake/std/atdm/waterman/tweaks/CUDA-9.2_DEBUG_CUDA_POWER9_VOLTA70.cmake b/cmake/std/atdm/waterman/tweaks/CUDA-9.2_DEBUG_CUDA_POWER9_VOLTA70.cmake index 24e5a5419e07..af8b013e9347 100644 --- a/cmake/std/atdm/waterman/tweaks/CUDA-9.2_DEBUG_CUDA_POWER9_VOLTA70.cmake +++ b/cmake/std/atdm/waterman/tweaks/CUDA-9.2_DEBUG_CUDA_POWER9_VOLTA70.cmake @@ -8,6 +8,3 @@ ATDM_SET_ENABLE(KokkosContainers_UnitTest_Serial_MPI_1_DISABLE ON) ATDM_SET_CACHE(KokkosKernels_sparse_serial_MPI_1_EXTRA_ARGS "--gtest_filter=-serial.sparse_block_gauss_seidel_double_int_int_TestExecSpace:serial.sparse_block_gauss_seidel_double_int_size_t_TestExecSpace:serial.sparse_trsv_mv_double_int_int_LayoutLeft_TestExecSpace" CACHE STRING ) - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake b/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake index afda3054e68a..c99b49fa2b41 100644 --- a/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake +++ b/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE-DEBUG_CUDA_POWER9_VOLTA70.cmake @@ -1,6 +1,3 @@ -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") - # Tests regularaly failing see issue #3939 ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-1_DISABLE ON) ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-3_DISABLE ON) diff --git a/cmake/std/atdm/waterman/tweaks/GNU_RELEASE-DEBUG_OPENMP_POWER9.cmake b/cmake/std/atdm/waterman/tweaks/GNU_RELEASE-DEBUG_OPENMP_POWER9.cmake deleted file mode 100644 index efdff35b2e89..000000000000 --- a/cmake/std/atdm/waterman/tweaks/GNU_RELEASE-DEBUG_OPENMP_POWER9.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake new file mode 100644 index 000000000000..9684a63a78ee --- /dev/null +++ b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake @@ -0,0 +1,13 @@ +# Disable known failures for SPARC Trilinos configuration (#3632) +ATDM_SET_ENABLE(PanzerAdaptersIOSS_tIOSSConnManager2_MPI_2_DISABLE ON) +ATDM_SET_ENABLE(PanzerAdaptersIOSS_tIOSSConnManager3_MPI_3_DISABLE ON) + +IF (ATDM_NODE_TYPE STREQUAL "CUDA") + + # This test fails consistently (#2751) + ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) + + # Disable known falure for ROL CUDA builds (#3543) + ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) + +ENDIF() From 2361affe176b414a23bae88b75714b7865d21de4 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 07:37:37 -0600 Subject: [PATCH 29/44] ATDM: Disable SEACAS explore build on cuda+rdc builds (#6008) Hopefully this can be fixed later. --- cmake/std/atdm/waterman/tweaks/Tweaks.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake index 9684a63a78ee..d04fb47ad536 100644 --- a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake +++ b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake @@ -10,4 +10,9 @@ IF (ATDM_NODE_TYPE STREQUAL "CUDA") # Disable known falure for ROL CUDA builds (#3543) ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) + # Disable the build of SEACAS 'explore' for all cuda+rdc builds for now (#6008) + IF (ATDM_CUDA_RDC) + ATDM_SET_ENABLE(explore_EXE_DISABLE ON) + ENDIF() + ENDIF() From 7a7fe19bf28519e7e322f12b910915e2887cf013 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 07:52:08 -0600 Subject: [PATCH 30/44] SEACAS: Allow for disable of explore exe (trilinos/Trilinos#6008) Need to be able to disable the build of the SEACAS 'explore' executable for cuda+rdc builds for now with -Dexpore_EXE_DISABLE=ON (see #6008). --- .../seacas/applications/explore/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/seacas/applications/explore/CMakeLists.txt b/packages/seacas/applications/explore/CMakeLists.txt index b4ca43066856..cfde51e27a8b 100644 --- a/packages/seacas/applications/explore/CMakeLists.txt +++ b/packages/seacas/applications/explore/CMakeLists.txt @@ -20,13 +20,17 @@ TRIBITS_ADD_EXECUTABLE( LINKER_LANGUAGE Fortran SOURCES ${SOURCES} COMM serial mpi + ADDED_EXE_TARGET_NAME_OUT explore_added ) -if (${CMAKE_PROJECT_NAME} STREQUAL "SEACASProj") -InstallSymLink(explore ${CMAKE_INSTALL_PREFIX}/bin/grope) -endif() +if (explore_added) -install_executable(explore) + if (${CMAKE_PROJECT_NAME} STREQUAL "SEACASProj") + InstallSymLink(explore ${CMAKE_INSTALL_PREFIX}/bin/grope) + endif() -TRIBITS_SUBPACKAGE_POSTPROCESS() + install_executable(explore) +endif() + +TRIBITS_SUBPACKAGE_POSTPROCESS() From 462d54db2968130408fdfed44140b78b35ff9899 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 08:01:29 -0600 Subject: [PATCH 31/44] ATDM: Disable several Tempus tests in all waterman debug builds (#6009) These started timing out after setting Trilinos_ENABLE_DEBUG=ON --- cmake/std/atdm/waterman/tweaks/Tweaks.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake index d04fb47ad536..933301c2cf02 100644 --- a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake +++ b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake @@ -1,7 +1,24 @@ +# +# Disables across multiple builds on 'waterman' +# + # Disable known failures for SPARC Trilinos configuration (#3632) ATDM_SET_ENABLE(PanzerAdaptersIOSS_tIOSSConnManager2_MPI_2_DISABLE ON) ATDM_SET_ENABLE(PanzerAdaptersIOSS_tIOSSConnManager3_MPI_3_DISABLE ON) +IF (Trilinos_ENABLE_DEBUG) + + # Disable Tempus tests that started timing out in debug builds when + # Trilinos_ENABLE_DEBUG=ON was set PR #5970 (#6009) + ATDM_SET_ENABLE(Tempus_BackwardEuler_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_DIRK_ASA_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_ExplicitRK_ASA_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_HHTAlpha_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_IMEX_RK_Combined_FSA_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_Newmark_MPI_1_DISABLE ON) + +ENDIF() + IF (ATDM_NODE_TYPE STREQUAL "CUDA") # This test fails consistently (#2751) From b8a425020da0256d908c5505c026b1950a20afef Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 10:57:49 -0600 Subject: [PATCH 32/44] ATDM: Switch to usage of Tweaks.cmake file for 'ride' builds This will make it easier to add and maintain tweaks across multiple builds such as for #6009. --- .../atdm/ride/tweaks/ALL_COMMON_TWEAKS.cmake | 0 ...GNU-7.4.0_DEBUG_CUDA_POWER8_KEPLER37.cmake | 4 -- ...GNU-7.2.0_DEBUG_CUDA_POWER8_KEPLER37.cmake | 4 -- ...0_RELEASE-DEBUG_CUDA_POWER8_KEPLER37.cmake | 2 - ...U-7.2.0_RELEASE_CUDA_POWER8_KEPLER37.cmake | 4 -- .../atdm/ride/tweaks/CUDA_COMMON_TWEAKS.cmake | 40 ----------------- .../GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake | 2 - .../GNU-7.2.0_RELEASE_OPENMP_POWER8.cmake | 1 - .../GNU-7.4.0_DEBUG_OPENMP_POWER8.cmake | 2 - cmake/std/atdm/ride/tweaks/Tweaks.cmake | 44 +++++++++++++++++++ 10 files changed, 44 insertions(+), 59 deletions(-) delete mode 100644 cmake/std/atdm/ride/tweaks/ALL_COMMON_TWEAKS.cmake delete mode 100644 cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE-DEBUG_CUDA_POWER8_KEPLER37.cmake delete mode 100644 cmake/std/atdm/ride/tweaks/CUDA_COMMON_TWEAKS.cmake delete mode 100644 cmake/std/atdm/ride/tweaks/GNU-7.2.0_RELEASE_OPENMP_POWER8.cmake create mode 100644 cmake/std/atdm/ride/tweaks/Tweaks.cmake diff --git a/cmake/std/atdm/ride/tweaks/ALL_COMMON_TWEAKS.cmake b/cmake/std/atdm/ride/tweaks/ALL_COMMON_TWEAKS.cmake deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/cmake/std/atdm/ride/tweaks/CUDA-10.0_GNU-7.4.0_DEBUG_CUDA_POWER8_KEPLER37.cmake b/cmake/std/atdm/ride/tweaks/CUDA-10.0_GNU-7.4.0_DEBUG_CUDA_POWER8_KEPLER37.cmake index afd124fea9da..aebdbc93f053 100644 --- a/cmake/std/atdm/ride/tweaks/CUDA-10.0_GNU-7.4.0_DEBUG_CUDA_POWER8_KEPLER37.cmake +++ b/cmake/std/atdm/ride/tweaks/CUDA-10.0_GNU-7.4.0_DEBUG_CUDA_POWER8_KEPLER37.cmake @@ -5,7 +5,3 @@ ATDM_SET_ENABLE(TeuchosNumerics_DISABLE_STEQR_TEST ON) ATDM_SET_CACHE(KokkosKernels_sparse_serial_MPI_1_EXTRA_ARGS "--gtest_filter=-serial.sparse_block_gauss_seidel_double_int_int_TestExecSpace:serial.sparse_block_gauss_seidel_double_int_size_t_TestExecSpace:serial.sparse_trsv_mv_double_int_int_LayoutLeft_TestExecSpace" CACHE STRING ) - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_DEBUG_CUDA_POWER8_KEPLER37.cmake b/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_DEBUG_CUDA_POWER8_KEPLER37.cmake index 5c054333a7d0..4aef83dc95f4 100644 --- a/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_DEBUG_CUDA_POWER8_KEPLER37.cmake +++ b/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_DEBUG_CUDA_POWER8_KEPLER37.cmake @@ -11,7 +11,3 @@ ATDM_SET_CACHE(KokkosKernels_graph_serial_MPI_1_EXTRA_ARGS ATDM_SET_CACHE(KokkosKernels_sparse_serial_MPI_1_EXTRA_ARGS "--gtest_filter=-serial.sparse_block_gauss_seidel_double_int_int_TestExecSpace:serial.sparse_block_gauss_seidel_double_int_size_t_TestExecSpace:serial.sparse_trsv_mv_double_int_int_LayoutLeft_TestExecSpace" CACHE STRING ) - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE-DEBUG_CUDA_POWER8_KEPLER37.cmake b/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE-DEBUG_CUDA_POWER8_KEPLER37.cmake deleted file mode 100644 index 1cf8106c51b6..000000000000 --- a/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE-DEBUG_CUDA_POWER8_KEPLER37.cmake +++ /dev/null @@ -1,2 +0,0 @@ -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE_CUDA_POWER8_KEPLER37.cmake b/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE_CUDA_POWER8_KEPLER37.cmake index ce29afa7d5ba..cd2c3452de41 100644 --- a/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE_CUDA_POWER8_KEPLER37.cmake +++ b/cmake/std/atdm/ride/tweaks/CUDA-9.2_GNU-7.2.0_RELEASE_CUDA_POWER8_KEPLER37.cmake @@ -1,7 +1,3 @@ # Disable test that times out at 10 minutes (#2446) ATDM_SET_ENABLE(PanzerAdaptersSTK_main_driver_energy-ss-loca-eigenvalue_DISABLE ON) ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedCurlLaplacianExample-ConvTest-Tri-Order-1_DISABLE ON) - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/CUDA_COMMON_TWEAKS.cmake b/cmake/std/atdm/ride/tweaks/CUDA_COMMON_TWEAKS.cmake deleted file mode 100644 index ed68e1948c33..000000000000 --- a/cmake/std/atdm/ride/tweaks/CUDA_COMMON_TWEAKS.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# Disable test that runs over 30 min currently (#2446) -ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) - -# Disable test that consistantly times out at 10 minutes (#3579) -ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-4_DISABLE ON) - -# Disable randomly failing MueLu tests (#2311) -ATDM_SET_ENABLE(MueLu_ParameterListInterpreterTpetra_MPI_1_DISABLE ON) -ATDM_SET_ENABLE(MueLu_ParameterListInterpreterTpetraHeavy_MPI_1_DISABLE ON) - -# -# Disable tests already failing in the non-RDC build -# - -IF (ATDM_CUDA_RDC) - # Disable ROL tests (see #3543) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_02_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_poisson_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_stefan-boltzmann_example_03_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_02_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_02_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_obstacle_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_03_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_topo-opt_poisson_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) - # Disable Zoltan tests (see #3749) - ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_1_DISABLE ON) - ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_4_DISABLE ON) - # Disable Zoltan tests (see #4042) - ATDM_SET_ENABLE(Zoltan_ch_ewgt_zoltan_parallel_DISABLE ON) - ATDM_SET_ENABLE(Zoltan_ch_grid20x19_zoltan_parallel_DISABLE ON) - ATDM_SET_ENABLE(Zoltan_ch_nograph_zoltan_parallel_DISABLE ON) - ATDM_SET_ENABLE(Zoltan_ch_simple_zoltan_parallel_DISABLE ON) - # Disable SEACAS tests (see #5784) - ATDM_SET_ENABLE(pamgen_exodus_io_info_DISABLE ON) -ENDIF() diff --git a/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake b/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake index 256e1e6af69e..eb385a9b6bf7 100644 --- a/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake +++ b/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake @@ -24,5 +24,3 @@ ATDM_SET_CACHE(KokkosKernels_sparse_serial_MPI_1_EXTRA_ARGS # Disable entire test that is timing out (or nearly timing out) at 10 minutes # in debug-openmp build (#3168) ATDM_SET_ENABLE(KokkosKernels_sparse_openmp_MPI_1_DISABLE ON) - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/GNU-7.2.0_RELEASE_OPENMP_POWER8.cmake b/cmake/std/atdm/ride/tweaks/GNU-7.2.0_RELEASE_OPENMP_POWER8.cmake deleted file mode 100644 index efdff35b2e89..000000000000 --- a/cmake/std/atdm/ride/tweaks/GNU-7.2.0_RELEASE_OPENMP_POWER8.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/GNU-7.4.0_DEBUG_OPENMP_POWER8.cmake b/cmake/std/atdm/ride/tweaks/GNU-7.4.0_DEBUG_OPENMP_POWER8.cmake index c4ef21c7c24d..aebdbc93f053 100644 --- a/cmake/std/atdm/ride/tweaks/GNU-7.4.0_DEBUG_OPENMP_POWER8.cmake +++ b/cmake/std/atdm/ride/tweaks/GNU-7.4.0_DEBUG_OPENMP_POWER8.cmake @@ -5,5 +5,3 @@ ATDM_SET_ENABLE(TeuchosNumerics_DISABLE_STEQR_TEST ON) ATDM_SET_CACHE(KokkosKernels_sparse_serial_MPI_1_EXTRA_ARGS "--gtest_filter=-serial.sparse_block_gauss_seidel_double_int_int_TestExecSpace:serial.sparse_block_gauss_seidel_double_int_size_t_TestExecSpace:serial.sparse_trsv_mv_double_int_int_LayoutLeft_TestExecSpace" CACHE STRING ) - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/ride/tweaks/Tweaks.cmake b/cmake/std/atdm/ride/tweaks/Tweaks.cmake new file mode 100644 index 000000000000..54d5b414c778 --- /dev/null +++ b/cmake/std/atdm/ride/tweaks/Tweaks.cmake @@ -0,0 +1,44 @@ +IF (ATDM_NODE_TYPE STREQUAL "CUDA") + + # Disable test that runs over 30 min currently (#2446) + ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) + + # Disable test that consistantly times out at 10 minutes (#3579) + ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-4_DISABLE ON) + + # Disable randomly failing MueLu tests (#2311) + ATDM_SET_ENABLE(MueLu_ParameterListInterpreterTpetra_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(MueLu_ParameterListInterpreterTpetraHeavy_MPI_1_DISABLE ON) + + # + # Disable tests already failing in the non-RDC build + # + + IF (ATDM_CUDA_RDC) + # Disable ROL tests (see #3543) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_02_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_poisson_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_stefan-boltzmann_example_03_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_02_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_02_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_obstacle_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_03_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_topo-opt_poisson_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) + # Disable Zoltan tests (see #3749) + ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_4_DISABLE ON) + # Disable Zoltan tests (see #4042) + ATDM_SET_ENABLE(Zoltan_ch_ewgt_zoltan_parallel_DISABLE ON) + ATDM_SET_ENABLE(Zoltan_ch_grid20x19_zoltan_parallel_DISABLE ON) + ATDM_SET_ENABLE(Zoltan_ch_nograph_zoltan_parallel_DISABLE ON) + ATDM_SET_ENABLE(Zoltan_ch_simple_zoltan_parallel_DISABLE ON) + # Disable SEACAS tests (see #5784) + ATDM_SET_ENABLE(pamgen_exodus_io_info_DISABLE ON) + ENDIF() + +ENDIF() \ No newline at end of file From 52fe15784c19440a1dc1a65014159cfeec8557c5 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 11:14:50 -0600 Subject: [PATCH 33/44] ATDM: Disable several Tempus tests in all waterman debug builds (#6009) These started timing out after setting Trilinos_ENABLE_DEBUG=ON --- cmake/std/atdm/ride/tweaks/Tweaks.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cmake/std/atdm/ride/tweaks/Tweaks.cmake b/cmake/std/atdm/ride/tweaks/Tweaks.cmake index 54d5b414c778..082e62aaecba 100644 --- a/cmake/std/atdm/ride/tweaks/Tweaks.cmake +++ b/cmake/std/atdm/ride/tweaks/Tweaks.cmake @@ -1,3 +1,20 @@ +# +# Disables across multiple builds on 'ride' +# + +IF (Trilinos_ENABLE_DEBUG) + + # Disable Tempus tests that started timing out in debug builds when + # Trilinos_ENABLE_DEBUG=ON was set PR #5970 (#6009) + ATDM_SET_ENABLE(Tempus_BackwardEuler_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_DIRK_ASA_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_ExplicitRK_ASA_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_HHTAlpha_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_IMEX_RK_Combined_FSA_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(Tempus_Newmark_MPI_1_DISABLE ON) + +ENDIF() + IF (ATDM_NODE_TYPE STREQUAL "CUDA") # Disable test that runs over 30 min currently (#2446) @@ -15,6 +32,7 @@ IF (ATDM_NODE_TYPE STREQUAL "CUDA") # IF (ATDM_CUDA_RDC) + # Disable ROL tests (see #3543) ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_01_MPI_4_DISABLE ON) ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_02_MPI_4_DISABLE ON) @@ -29,16 +47,20 @@ IF (ATDM_NODE_TYPE STREQUAL "CUDA") ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_03_MPI_4_DISABLE ON) ATDM_SET_ENABLE(ROL_example_PDE-OPT_topo-opt_poisson_example_01_MPI_4_DISABLE ON) ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) + # Disable Zoltan tests (see #3749) ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_1_DISABLE ON) ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_4_DISABLE ON) + # Disable Zoltan tests (see #4042) ATDM_SET_ENABLE(Zoltan_ch_ewgt_zoltan_parallel_DISABLE ON) ATDM_SET_ENABLE(Zoltan_ch_grid20x19_zoltan_parallel_DISABLE ON) ATDM_SET_ENABLE(Zoltan_ch_nograph_zoltan_parallel_DISABLE ON) ATDM_SET_ENABLE(Zoltan_ch_simple_zoltan_parallel_DISABLE ON) + # Disable SEACAS tests (see #5784) ATDM_SET_ENABLE(pamgen_exodus_io_info_DISABLE ON) + ENDIF() ENDIF() \ No newline at end of file From 65d36c9e10fe2c7c2202ca4a8905f0a68f646d6c Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 11:51:47 -0600 Subject: [PATCH 34/44] ATDM: Disable two Intrepid2 tests for gnu+openmp+debug build (#6020) This was due to Trilinos_ENABLE_DEBUG=ON getting set. --- .../std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake b/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake index eb385a9b6bf7..3d763c2bbb94 100644 --- a/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake +++ b/cmake/std/atdm/ride/tweaks/GNU-7.2.0_DEBUG_OPENMP_POWER8.cmake @@ -24,3 +24,8 @@ ATDM_SET_CACHE(KokkosKernels_sparse_serial_MPI_1_EXTRA_ARGS # Disable entire test that is timing out (or nearly timing out) at 10 minutes # in debug-openmp build (#3168) ATDM_SET_ENABLE(KokkosKernels_sparse_openmp_MPI_1_DISABLE ON) + +# Disable Intrepid2 tests that started timing out when +# Trilinos_ENABLE_DEBUG=ON was set (#6020) +ATDM_SET_ENABLE(Intrepid2_unit-test_Projection_Serial_Test_Convergence_TET_MPI_1_DISABLE ON) +ATDM_SET_ENABLE(Intrepid2_unit-test_Projection_Serial_Test_InterpolationProjection_HEX_MPI_1_DISABLE ON) From 5ddc33fc4d4ae82b5e2e2d920ff2cf7cac50d7df Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Fri, 18 Oct 2019 12:24:47 -0600 Subject: [PATCH 35/44] SQUASH AGAINST: ATDM: Add support for a single /tweaks/Tweaks.cmake file --- cmake/std/atdm/README.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/cmake/std/atdm/README.md b/cmake/std/atdm/README.md index 6ff620515939..e0ef45f3fcec 100644 --- a/cmake/std/atdm/README.md +++ b/cmake/std/atdm/README.md @@ -1314,35 +1314,41 @@ IF (Trilinos_ENABLE_DEBUG) ... ENDIF() -IF (ATDM_NODE_TYPE STREQUAL "CUDA") +IF (ATDM_COMPILER STREQUAL "GNU-7.2.0") # See /enviornment.sh + # Disables for all non-CUDA GNU 7.2.0 builds + ... +ENDIF() +IF (ATDM_NODE_TYPE STREQUAL "SERIAL") + # Disable tests for all SERIAL builds for this system + ... +ELSEIF (ATDM_NODE_TYPE STREQUAL "OPENMP") + # Disable tests for all OpenMP builds for this system + ... +ELEIF (ATDM_NODE_TYPE STREQUAL "CUDA") # Disable tests for all CUDA builds for this system ... - IF (Trilinos_ENABLE_DEBUG) # Disable tests for all CUDA debug builds for this system ... ENDIF() - IF (ATDM_CUDA_RDC and Trilinos_ENABLE_DEBUG) # Disable tests for all CUDA, RDC, debug builds for this system ... ENDIF() - ENDIF() ``` -Any variable that has been set in the `ATDMDevEnvSettings.cmake` file before -these tweak files are included can be used in logic in these files. But the -recommended variables to include in if-logic include the CMake variables -`ATDM_COMPILER` (uppercase), `ATDM_KOKKOS_ARCH_JOB_NAME_KEYS` (uppercase -seprated by `_`), `ATDM_NODE_TYPE` (values `CUDA`, `OPENMP`, `SERIAL`), -`ATDM_CUDA_RDC` (`ON`/`OFF`), `ATDM_FPIC` (`ON`/`OFF`), `ATDM_COMPLEX` -(`ON`/`OFF`), `ATDM_SHARED_LIBS` (`ON`/`OFF`), `ATDM_CMAKE_BUILD_TYPE` (values -`DEBUG`, `RELEASE`, and `RELEASE-DEBUG`), `Trilinos_ENABLE_DEBUG` -(`ON`/`OFF`), and `ATDM_PT_PACKAGES (`ON`/`OFF`)`. No other variables should -be used in if-logic in these files as those variables may change in the -future. +Any CMake variable that has been set in the `ATDMDevEnvSettings.cmake` file +before these tweak files are included can be used in if-logic but the +recommended variables are `ATDM_COMPILER` (uppercase), +`ATDM_KOKKOS_ARCH_JOB_NAME_KEYS` (uppercase seprated by `_`), `ATDM_NODE_TYPE` +(values `CUDA`, `OPENMP`, `SERIAL`), `ATDM_CUDA_RDC` (`ON`/`OFF`), `ATDM_FPIC` +(`ON`/`OFF`), `ATDM_COMPLEX` (`ON`/`OFF`), `ATDM_SHARED_LIBS` (`ON`/`OFF`), +`ATDM_CMAKE_BUILD_TYPE` (values `DEBUG`, `RELEASE`, and `RELEASE-DEBUG`), +`Trilinos_ENABLE_DEBUG` (`ON`/`OFF`), and `ATDM_PT_PACKAGES` (`ON`/`OFF`). No +other variables should be used in if-logic in these files as other variables +may change in the future. ### Disable a test for builds on all platforms From bbd8654656e989f05191368db1df6fece24262eb Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sun, 20 Oct 2019 11:11:35 -0600 Subject: [PATCH 36/44] ATDM: Remove unused files after switching to waterman/tweaks/Tweaks.cmake Forgot to remvoe these in commit: 18916b9 "ATDM: Switch to use of Tweaks.cmake file for waterman builds" --- cmake/std/atdm/waterman/tweaks/ALL_COMMON_TWEAKS.cmake | 4 ---- .../tweaks/CUDA-9.2_RELEASE_CUDA_POWER9_VOLTA70.cmake | 2 -- cmake/std/atdm/waterman/tweaks/CUDA_COMMON_TWEAKS.cmake | 5 ----- .../std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake | 1 - 4 files changed, 12 deletions(-) delete mode 100644 cmake/std/atdm/waterman/tweaks/ALL_COMMON_TWEAKS.cmake delete mode 100644 cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE_CUDA_POWER9_VOLTA70.cmake delete mode 100644 cmake/std/atdm/waterman/tweaks/CUDA_COMMON_TWEAKS.cmake delete mode 100644 cmake/std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake diff --git a/cmake/std/atdm/waterman/tweaks/ALL_COMMON_TWEAKS.cmake b/cmake/std/atdm/waterman/tweaks/ALL_COMMON_TWEAKS.cmake deleted file mode 100644 index ba8db49794cb..000000000000 --- a/cmake/std/atdm/waterman/tweaks/ALL_COMMON_TWEAKS.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -# Disable known failures for SPARC Trilinos configuration (#3632) -ATDM_SET_ENABLE(PanzerAdaptersIOSS_tIOSSConnManager2_MPI_2_DISABLE ON) -ATDM_SET_ENABLE(PanzerAdaptersIOSS_tIOSSConnManager3_MPI_3_DISABLE ON) diff --git a/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE_CUDA_POWER9_VOLTA70.cmake b/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE_CUDA_POWER9_VOLTA70.cmake deleted file mode 100644 index 1cf8106c51b6..000000000000 --- a/cmake/std/atdm/waterman/tweaks/CUDA-9.2_RELEASE_CUDA_POWER9_VOLTA70.cmake +++ /dev/null @@ -1,2 +0,0 @@ -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CUDA_COMMON_TWEAKS.cmake") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") diff --git a/cmake/std/atdm/waterman/tweaks/CUDA_COMMON_TWEAKS.cmake b/cmake/std/atdm/waterman/tweaks/CUDA_COMMON_TWEAKS.cmake deleted file mode 100644 index cdd99822447b..000000000000 --- a/cmake/std/atdm/waterman/tweaks/CUDA_COMMON_TWEAKS.cmake +++ /dev/null @@ -1,5 +0,0 @@ -# This test fails consistently (#2751) -ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) - -# Disable known falure for ROL CUDA builds (#3543) -ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) diff --git a/cmake/std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake b/cmake/std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake deleted file mode 100644 index efdff35b2e89..000000000000 --- a/cmake/std/atdm/waterman/tweaks/GNU_RELEASE_OPENMP_POWER9.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/ALL_COMMON_TWEAKS.cmake") From 004951775e0b9b847040a870638e69d79b2e2069 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sun, 20 Oct 2019 11:30:54 -0600 Subject: [PATCH 37/44] ATDM: Move broad disables of individual tests to the ATDMDisables.cmake file These things should only ever be disabled for ATDM builds of Trilinos. For more general Primary Tested (PT) builds of Trilinos, all of this should be enabled to show the true current state of Trilinos as it impacts other Trilinos customers. --- cmake/std/atdm/ATDMDevEnvSettings.cmake | 46 +---------------- cmake/std/atdm/ATDMDisables.cmake | 68 ++++++++++++++++++++++++- cmake/std/atdm/README.md | 7 +-- 3 files changed, 71 insertions(+), 50 deletions(-) diff --git a/cmake/std/atdm/ATDMDevEnvSettings.cmake b/cmake/std/atdm/ATDMDevEnvSettings.cmake index 393911651ddc..5a23cddc00fe 100644 --- a/cmake/std/atdm/ATDMDevEnvSettings.cmake +++ b/cmake/std/atdm/ATDMDevEnvSettings.cmake @@ -423,51 +423,7 @@ ATDM_SET_CACHE(TPL_DLlib_LIBRARIES "-ldl" CACHE FILEPATH) ATDM_SET_ENABLE(TPL_ENABLE_Matio OFF) # -# G) Package and Test Disables -# -# There are some package tests that have to be disabled for a braod set of -# builds for example, if all openmp builds are failing a certain test then it -# makes more sense to disbale it once in this file instead of in every openmp -# buid's tweaks file -# - -# Issue #3638 -ATDM_SET_ENABLE(Teko_ModALPreconditioner_MPI_1_DISABLE ON) - -# Disable MueLu for all cuda+complex builds for now since there are build -# errors in the MueLu library that takes out everything downstream that -# depends on MueLu (see #4599). -IF (ATDM_USE_CUDA AND ATDM_COMPLEX) - ATDM_SET_ENABLE(Trilinos_ENABLE_MueLu OFF) -ENDIF() - -# Disable Zoltan2_XpetraEpertraMatrix exec that does not build with no global -# int instatiation (see #5411) -ATDM_SET_ENABLE(Zoltan2_XpetraEpetraMatrix_EXE_DISABLE ON) -ATDM_SET_ENABLE(Zoltan2_XpetraEpetraMatrix_MPI_4_DISABLE ON) - -# Disable Piro_ThyraSolver exec that does not build with no global int -# instantiation (see #5412) -ATDM_SET_ENABLE(Piro_ThyraSolver_EXE_DISABLE ON) -ATDM_SET_ENABLE(Piro_ThyraSolver_MPI_4_DISABLE ON) - -# Disable Piro_AnalysisDriverTpetra exec that will not build with no global -# int instantiation (see #5446) -ATDM_SET_ENABLE(Piro_AnalysisDriverTpetra_EXE_DISABLE ON) -ATDM_SET_ENABLE(Piro_AnalysisDriverTpetra_MPI_4_DISABLE ON) - -# Disable ROL test exec that will not buld with no global int instantiation -# (see #5447) -ATDM_SET_ENABLE(ROL_adapters_tpetra_test_vector_SimulatedVectorTpetraBatchManagerInterface_EXE_DISABLE ON) -ATDM_SET_ENABLE(ROL_adapters_tpetra_test_vector_SimulatedVectorTpetraBatchManagerInterface_MPI_4_DISABLE ON) - -IF ("${ATDM_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") - ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-4_DISABLE ON) - ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) -ENDIF() - -# -# H) ATDM env config install hooks +# G) ATDM env config install hooks # # Install just enough to allow loading the exact matching env and nothing # else! diff --git a/cmake/std/atdm/ATDMDisables.cmake b/cmake/std/atdm/ATDMDisables.cmake index eef6f6c3b767..7f9252aaa57e 100644 --- a/cmake/std/atdm/ATDMDisables.cmake +++ b/cmake/std/atdm/ATDMDisables.cmake @@ -4,12 +4,25 @@ ### ##################################################### + +# +# A) TPL disables +# + ATDM_SET_CACHE(TPL_ENABLE_GLM OFF CACHE BOOL) ATDM_SET_CACHE(TPL_ENABLE_Matio OFF CACHE BOOL) ATDM_SET_CACHE(TPL_ENABLE_SuperLU OFF CACHE BOOL) ATDM_SET_CACHE(TPL_ENABLE_X11 OFF CACHE BOOL) ATDM_SET_CACHE(TPL_ENABLE_yaml-cpp OFF CACHE BOOL) + +# +# B) SE Package disables +# +# These are SE packages that we don't even want enabled. (This is the +# "black-listing" approach) +# + # Packages and sub-packages disables common to both SPARC and EMPIRE SET(ATDM_SE_PACKAGE_DISABLES MiniTensor @@ -57,10 +70,16 @@ ENDIF() # -# Set of ATDM Trilinos packages for wich we don't want to run the test suite. +# C) SE Package test disables +# +# This is the is the ATDM Trilinos SE packages that we allow to be enabled but +# for wich we don't want to run the test suite. # -# This allows us to use Trilinos_ENABLE_ALL_PACKAGES=ON +# This allows us to use Trilinos_ENABLE_ALL_PACKAGES=ON to enable the ATDM +# Trilinos builds and get the tests for only the packages we want (i.e the +# "black-listing" appraoch. # + SET(ATDM_SE_PACKAGE_TEST_DISABLES TrilinosFrameworkTests Gtest @@ -152,3 +171,48 @@ FOREACH(ATDM_SE_PACKAGE ${ATDM_SE_PACKAGE_TEST_DISABLES}) ATDM_SET_CACHE(${ATDM_SE_PACKAGE}_ENABLE_TESTS OFF CACHE BOOL) ATDM_SET_CACHE(${ATDM_SE_PACKAGE}_ENABLE_EXAMPLES OFF CACHE BOOL) ENDFOREACH() + + +# +# D) Individual Executable and Test Disables +# +# There are some package tests that have to be disabled for a broad set of +# builds for example, if all openmp builds are failing a certain test then it +# makes more sense to disbale it once in this file instead of in every openmp +# buid's tweaks file +# + +# Issue #3638 +ATDM_SET_ENABLE(Teko_ModALPreconditioner_MPI_1_DISABLE ON) + +# Disable MueLu for all cuda+complex builds for now since there are build +# errors in the MueLu library that takes out everything downstream that +# depends on MueLu (see #4599). +IF (ATDM_USE_CUDA AND ATDM_COMPLEX) + ATDM_SET_ENABLE(Trilinos_ENABLE_MueLu OFF) +ENDIF() + +# Disable Zoltan2_XpetraEpertraMatrix exec that does not build with no global +# int instatiation (see #5411) +ATDM_SET_ENABLE(Zoltan2_XpetraEpetraMatrix_EXE_DISABLE ON) +ATDM_SET_ENABLE(Zoltan2_XpetraEpetraMatrix_MPI_4_DISABLE ON) + +# Disable Piro_ThyraSolver exec that does not build with no global int +# instantiation (see #5412) +ATDM_SET_ENABLE(Piro_ThyraSolver_EXE_DISABLE ON) +ATDM_SET_ENABLE(Piro_ThyraSolver_MPI_4_DISABLE ON) + +# Disable Piro_AnalysisDriverTpetra exec that will not build with no global +# int instantiation (see #5446) +ATDM_SET_ENABLE(Piro_AnalysisDriverTpetra_EXE_DISABLE ON) +ATDM_SET_ENABLE(Piro_AnalysisDriverTpetra_MPI_4_DISABLE ON) + +# Disable ROL test exec that will not buld with no global int instantiation +# (see #5447) +ATDM_SET_ENABLE(ROL_adapters_tpetra_test_vector_SimulatedVectorTpetraBatchManagerInterface_EXE_DISABLE ON) +ATDM_SET_ENABLE(ROL_adapters_tpetra_test_vector_SimulatedVectorTpetraBatchManagerInterface_MPI_4_DISABLE ON) + +IF ("${ATDM_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") + ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-4_DISABLE ON) + ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) +ENDIF() diff --git a/cmake/std/atdm/README.md b/cmake/std/atdm/README.md index e0ef45f3fcec..fd61595df09a 100644 --- a/cmake/std/atdm/README.md +++ b/cmake/std/atdm/README.md @@ -1083,7 +1083,8 @@ contains the following files: arbitrary sets of packages. * **ATDMDisables.cmake**: Disables a bunch of Trilinos packages and - subpackages not used by ATDM application customers. This file gets included + subpackages not used by ATDM application customers, disables of test suites + and individual tests across various builds, etc.. This file gets included automatically in `ATDMDevEnv.cmake` (so you don't need to list it in local configures of Trilinos). But this file is also included in the outer `ctest -S` driver script code for ATDM builds of Trilinos which is needed for @@ -1361,7 +1362,7 @@ one can accomplish this by adding a (conditional) `ATDM_SET_ENABLE()` statement for each test disable directly to the file: ``` - Trilinos/cmake/std/atdm/ATDMDevEnvSettings.cmake + Trilinos/cmake/std/atdm/ATDMDisables.cmake ``` For example, Trilinos commit [5e52db03ff](https://github.com/trilinos/Trilinos/commit/5e52db03ff33acb5b9a0be7ba7507a8bb0de6e30) added the CMake code: @@ -1373,7 +1374,7 @@ IF (ATDM_NODE_TYPE STREQUAL "OPENMP") ENDIF() ``` -to the file `ATDMDevEnvSettings.cmake` to disable the test +to the file `ATDMDisables.cmake` to disable the test `MueLu_UnitTestsTpetra_MPI_4` for all OpenMP builds across all platforms. (Note that that disable was later removed in Trilinos commit [62fa6663a6](https://github.com/trilinos/Trilinos/commit/62fa6663a6d5a757d786ac87752c3e2074d28414) From 555e92dbda28b27152439e4be8c3d9b94ec184c1 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sun, 20 Oct 2019 11:18:23 -0600 Subject: [PATCH 38/44] ATDM: Disable ROL tests that don't work with CUDA (#6124) Since these tests will not work on any CUDA build, might as well take them out globally. As part of this I went ahead and disabled some failing Zoltan (#4042) and TrilinosCouplings (#3749) that don't pass for the Primary Tested CUDA builds. NOTE: The file ATDMDisables.cmake is **not** included in a PT (primary tested) build so these will still run therefore the PT builds showd the true state of these different build configurations. --- cmake/std/atdm/ATDMDisables.cmake | 45 +++++++++++++++++---- cmake/std/atdm/ride/tweaks/Tweaks.cmake | 29 ------------- cmake/std/atdm/waterman/tweaks/Tweaks.cmake | 4 +- 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/cmake/std/atdm/ATDMDisables.cmake b/cmake/std/atdm/ATDMDisables.cmake index 7f9252aaa57e..437de1b4ea15 100644 --- a/cmake/std/atdm/ATDMDisables.cmake +++ b/cmake/std/atdm/ATDMDisables.cmake @@ -68,6 +68,13 @@ IF (NOT ATDM_ENABLE_SPARC_SETTINGS) # at a time in an orderly fashion. ENDIF() +# Disable MueLu for all cuda+complex builds for now since there are build +# errors in the MueLu library that takes out everything downstream that +# depends on MueLu (see #4599). +IF (ATDM_USE_CUDA AND ATDM_COMPLEX) + ATDM_SET_ENABLE(Trilinos_ENABLE_MueLu OFF) +ENDIF() + # # C) SE Package test disables @@ -185,13 +192,6 @@ ENDFOREACH() # Issue #3638 ATDM_SET_ENABLE(Teko_ModALPreconditioner_MPI_1_DISABLE ON) -# Disable MueLu for all cuda+complex builds for now since there are build -# errors in the MueLu library that takes out everything downstream that -# depends on MueLu (see #4599). -IF (ATDM_USE_CUDA AND ATDM_COMPLEX) - ATDM_SET_ENABLE(Trilinos_ENABLE_MueLu OFF) -ENDIF() - # Disable Zoltan2_XpetraEpertraMatrix exec that does not build with no global # int instatiation (see #5411) ATDM_SET_ENABLE(Zoltan2_XpetraEpetraMatrix_EXE_DISABLE ON) @@ -213,6 +213,37 @@ ATDM_SET_ENABLE(ROL_adapters_tpetra_test_vector_SimulatedVectorTpetraBatchManage ATDM_SET_ENABLE(ROL_adapters_tpetra_test_vector_SimulatedVectorTpetraBatchManagerInterface_MPI_4_DISABLE ON) IF ("${ATDM_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") + ATDM_SET_ENABLE(PanzerAdaptersSTK_CurlLaplacianExample-ConvTest-Quad-Order-4_DISABLE ON) ATDM_SET_ENABLE(PanzerAdaptersSTK_MixedPoissonExample-ConvTest-Hex-Order-3_DISABLE ON) + +ENDIF() + +IF (ATDM_NODE_TYPE STREQUAL "CUDA") + + # Disable ROL tests that don't work with CUDA builds (see #3543, #6124) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_02_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_poisson_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_stefan-boltzmann_example_03_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_02_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_02_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_obstacle_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_03_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_example_PDE-OPT_topo-opt_poisson_example_01_MPI_4_DISABLE ON) + ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) + + # Disable Zoltan tests (see #3749) + ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_1_DISABLE ON) + ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_4_DISABLE ON) + + # Disable Zoltan tests (see #4042) + ATDM_SET_ENABLE(Zoltan_ch_ewgt_zoltan_parallel_DISABLE ON) + ATDM_SET_ENABLE(Zoltan_ch_grid20x19_zoltan_parallel_DISABLE ON) + ATDM_SET_ENABLE(Zoltan_ch_nograph_zoltan_parallel_DISABLE ON) + ATDM_SET_ENABLE(Zoltan_ch_simple_zoltan_parallel_DISABLE ON) + ENDIF() diff --git a/cmake/std/atdm/ride/tweaks/Tweaks.cmake b/cmake/std/atdm/ride/tweaks/Tweaks.cmake index 082e62aaecba..3f8f90ba56da 100644 --- a/cmake/std/atdm/ride/tweaks/Tweaks.cmake +++ b/cmake/std/atdm/ride/tweaks/Tweaks.cmake @@ -27,37 +27,8 @@ IF (ATDM_NODE_TYPE STREQUAL "CUDA") ATDM_SET_ENABLE(MueLu_ParameterListInterpreterTpetra_MPI_1_DISABLE ON) ATDM_SET_ENABLE(MueLu_ParameterListInterpreterTpetraHeavy_MPI_1_DISABLE ON) - # - # Disable tests already failing in the non-RDC build - # - IF (ATDM_CUDA_RDC) - # Disable ROL tests (see #3543) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_adv-diff-react_example_02_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_poisson_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_0ld_stefan-boltzmann_example_03_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_navier-stokes_example_02_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_nonlinear-elliptic_example_02_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_obstacle_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_stefan-boltzmann_example_03_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_example_PDE-OPT_topo-opt_poisson_example_01_MPI_4_DISABLE ON) - ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) - - # Disable Zoltan tests (see #3749) - ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_1_DISABLE ON) - ATDM_SET_ENABLE(TrilinosCouplings_Example_Maxwell_MueLu_MPI_4_DISABLE ON) - - # Disable Zoltan tests (see #4042) - ATDM_SET_ENABLE(Zoltan_ch_ewgt_zoltan_parallel_DISABLE ON) - ATDM_SET_ENABLE(Zoltan_ch_grid20x19_zoltan_parallel_DISABLE ON) - ATDM_SET_ENABLE(Zoltan_ch_nograph_zoltan_parallel_DISABLE ON) - ATDM_SET_ENABLE(Zoltan_ch_simple_zoltan_parallel_DISABLE ON) - # Disable SEACAS tests (see #5784) ATDM_SET_ENABLE(pamgen_exodus_io_info_DISABLE ON) diff --git a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake index 933301c2cf02..7741682eb8f4 100644 --- a/cmake/std/atdm/waterman/tweaks/Tweaks.cmake +++ b/cmake/std/atdm/waterman/tweaks/Tweaks.cmake @@ -27,9 +27,11 @@ IF (ATDM_NODE_TYPE STREQUAL "CUDA") # Disable known falure for ROL CUDA builds (#3543) ATDM_SET_ENABLE(ROL_test_elementwise_TpetraMultiVector_MPI_4_DISABLE ON) - # Disable the build of SEACAS 'explore' for all cuda+rdc builds for now (#6008) IF (ATDM_CUDA_RDC) + + # Disable the build of SEACAS 'explore' for all cuda+rdc builds for now (#6008) ATDM_SET_ENABLE(explore_EXE_DISABLE ON) + ENDIF() ENDIF() From 71df720945ef8f0c860bb116d9986fc1b00a46c2 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sun, 20 Oct 2019 14:13:28 -0600 Subject: [PATCH 39/44] Clean up handling of compiler parsing matching (#6124) I tried using 'gnu-7.2.0' in the build name and it did not let me do it. So I cleaned up the handling of the parsing and matching some. --- cmake/std/atdm/waterman/environment.sh | 50 ++++++++++++++++++-------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/cmake/std/atdm/waterman/environment.sh b/cmake/std/atdm/waterman/environment.sh index 3794bada2fe0..e32688694f4b 100755 --- a/cmake/std/atdm/waterman/environment.sh +++ b/cmake/std/atdm/waterman/environment.sh @@ -6,11 +6,36 @@ # ################################################################################ -if [ "$ATDM_CONFIG_COMPILER" == "DEFAULT" ] ; then - export ATDM_CONFIG_COMPILER=GNU +# Handle compiler defaults + +if [[ "$ATDM_CONFIG_COMPILER" == "GNU-7.2.0" ]] \ + || [[ "$ATDM_CONFIG_COMPILER" == "GNU" ]] \ + || [[ "$ATDM_CONFIG_COMPILER" == "DEFAULT" ]] \ + ; then + export ATDM_CONFIG_COMPILER=GNU-7.2.0-OPENMPI-2.1.2 + +elif [[ "$ATDM_CONFIG_COMPILER" == "CUDA-9.2_GNU-7.2.0" ]] \ + || [[ "$ATDM_CONFIG_COMPILER" == "CUDA-9.2" ]] \ + || [[ "$ATDM_CONFIG_COMPILER" == "CUDA" ]] \ + ; then + export ATDM_CONFIG_COMPILER=CUDA-9.2-GNU-7.2.0-OPENMPI-2.1.2 + +else + echo + echo "***" + echo "*** ERROR: COMPILER=$ATDM_CONFIG_COMPILER is not supported on this system!" + echo "***" + echo "*** Suppoted compilers include:" + echo "***" + echo "*** gnu-7.2.0 (default and default gnu)" + echo "*** cuda-9.2-gnu-7.2.0 (default cuda, cuda-9.2)" + echo "***" + return fi -if [ "$ATDM_CONFIG_COMPILER" == "GNU" ]; then +# Handle KOKKOS_ARCH + +if [[ "$ATDM_CONFIG_COMPILER" == "GNU"* ]]; then if [[ "$ATDM_CONFIG_KOKKOS_ARCH" == "DEFAULT" ]] ; then export ATDM_CONFIG_KOKKOS_ARCH=Power9 elif [[ "$ATDM_CONFIG_KOKKOS_ARCH" == "Power9" ]] ; then @@ -84,7 +109,8 @@ else export ATDM_CONFIG_CTEST_PARALLEL_LEVEL=40 fi -if [ "$ATDM_CONFIG_COMPILER" == "GNU" ]; then +if [ "$ATDM_CONFIG_COMPILER" == "GNU-7.2.0-OPENMPI-2.1.2" ]; then + module load devpack/20180517/openmpi/2.1.2/gcc/7.2.0/cuda/9.2.88 module swap openblas/0.2.20/gcc/7.2.0 netlib/3.8.0/gcc/7.2.0 export OMPI_CXX=`which g++` @@ -92,11 +118,10 @@ if [ "$ATDM_CONFIG_COMPILER" == "GNU" ]; then export OMPI_FC=`which gfortran` export ATDM_CONFIG_LAPACK_LIBS="-L${LAPACK_ROOT}/lib;-llapack;-lgfortran;-lgomp" export ATDM_CONFIG_BLAS_LIBS="-L${BLAS_ROOT}/lib;-lblas;-lgfortran;-lgomp;-lm" + elif [[ "$ATDM_CONFIG_COMPILER" == "CUDA"* ]] ; then - if [[ "$ATDM_CONFIG_COMPILER" == "CUDA" ]] ; then - export ATDM_CONFIG_COMPILER=CUDA-9.2 # The default CUDA version currently - fi - if [[ "$ATDM_CONFIG_COMPILER" == "CUDA-9.2" ]] ; then + + if [[ "$ATDM_CONFIG_COMPILER" == "CUDA-9.2-GNU-7.2.0-OPENMPI-2.1.2" ]] ; then module load devpack/20180517/openmpi/2.1.2/gcc/7.2.0/cuda/9.2.88 module swap openblas/0.2.20/gcc/7.2.0 netlib/3.8.0/gcc/7.2.0 else @@ -106,11 +131,13 @@ elif [[ "$ATDM_CONFIG_COMPILER" == "CUDA"* ]] ; then echo "***" return fi + export OMPI_CXX=${ATDM_CONFIG_NVCC_WRAPPER} if [ ! -x "$OMPI_CXX" ]; then echo "No nvcc_wrapper found" return fi + export OMPI_CC=`which gcc` export OMPI_FC=`which gfortran` export ATDM_CONFIG_LAPACK_LIBS="-L${LAPACK_ROOT}/lib;-llapack;-lgfortran;-lgomp" @@ -121,12 +148,7 @@ elif [[ "$ATDM_CONFIG_COMPILER" == "CUDA"* ]] ; then export KOKKOS_NUM_DEVICES=2 export ATDM_CONFIG_CTEST_PARALLEL_LEVEL=4 # Avoids timeouts due to not running on separate GPUs (see #2446) -else - echo - echo "***" - echo "*** ERROR: COMPILER=$ATDM_CONFIG_COMPILER is not supported on this system!" - echo "***" - return + fi # CMake and ninja From a4acafa3f66b50e7b788c22b7d70e620cd7ee39a Mon Sep 17 00:00:00 2001 From: "K. Devine" Date: Mon, 21 Oct 2019 09:18:22 -0600 Subject: [PATCH 40/44] Removing dependence on optipack (better guards; removed XML ) #4957 --- packages/piro/cmake/Piro_config.hpp.in | 2 -- packages/piro/src/Piro_PerformAnalysis.hpp | 2 -- packages/piro/test/Main_AnalysisDriver.cpp | 4 ++++ packages/piro/test/_input_Analysis_Dakota.xml | 10 ---------- packages/piro/test/_input_Analysis_MOOCHO.xml | 10 ---------- packages/piro/test/_input_Analysis_ROL.xml | 10 ---------- .../test/_input_Analysis_ROL_AdjointSensitivities.xml | 10 ---------- ..._input_Analysis_ROL_AdjointSensitivities_Tpetra.xml | 10 ---------- packages/piro/test/_input_Analysis_ROL_Tpetra.xml | 10 ---------- 9 files changed, 4 insertions(+), 64 deletions(-) diff --git a/packages/piro/cmake/Piro_config.hpp.in b/packages/piro/cmake/Piro_config.hpp.in index 8acaed395d34..3e8bd4d6be72 100644 --- a/packages/piro/cmake/Piro_config.hpp.in +++ b/packages/piro/cmake/Piro_config.hpp.in @@ -33,11 +33,9 @@ #cmakedefine HAVE_PIRO_STOKHOS /* DEPRECATED */ #cmakedefine Piro_ENABLE_Stokhos -#ifndef OPTIPACK_HIDE_DEPRECATED_CODE #cmakedefine HAVE_PIRO_OPTIPACK /* DEPRECATED */ #cmakedefine Piro_ENABLE_OptiPack -#endif // !OPTIPACK_HIDE_DEPRECATED_CODE #cmakedefine HAVE_PIRO_TRIKOTA /* DEPRECATED */ #cmakedefine Piro_ENABLE_TriKota diff --git a/packages/piro/src/Piro_PerformAnalysis.hpp b/packages/piro/src/Piro_PerformAnalysis.hpp index 6481b7cb000d..8e4f26ba009f 100644 --- a/packages/piro/src/Piro_PerformAnalysis.hpp +++ b/packages/piro/src/Piro_PerformAnalysis.hpp @@ -49,11 +49,9 @@ #include "Thyra_ModelEvaluatorDefaultBase.hpp" #include "Thyra_VectorStdOps.hpp" -#ifndef OPTIPACK_HIDE_DEPRECATED_CODE #ifdef HAVE_PIRO_OPTIPACK #include "OptiPack_Config.h" #endif -#endif namespace Piro { diff --git a/packages/piro/test/Main_AnalysisDriver.cpp b/packages/piro/test/Main_AnalysisDriver.cpp index 0dab6c65b60b..7039eaeb9c16 100644 --- a/packages/piro/test/Main_AnalysisDriver.cpp +++ b/packages/piro/test/Main_AnalysisDriver.cpp @@ -57,6 +57,10 @@ #include "Teuchos_StandardCatchMacros.hpp" #include "Piro_ConfigDefs.hpp" +#ifdef HAVE_PIRO_OPTIPACK +#include "OptiPack_Config.h" +#endif + int main(int argc, char *argv[]) { diff --git a/packages/piro/test/_input_Analysis_Dakota.xml b/packages/piro/test/_input_Analysis_Dakota.xml index 6f6814eed22a..130345fc4364 100644 --- a/packages/piro/test/_input_Analysis_Dakota.xml +++ b/packages/piro/test/_input_Analysis_Dakota.xml @@ -156,15 +156,5 @@ - - - - - - - - - - diff --git a/packages/piro/test/_input_Analysis_MOOCHO.xml b/packages/piro/test/_input_Analysis_MOOCHO.xml index d1ec47f03357..eaccbd0fcc04 100644 --- a/packages/piro/test/_input_Analysis_MOOCHO.xml +++ b/packages/piro/test/_input_Analysis_MOOCHO.xml @@ -163,15 +163,5 @@ - - - - - - - - - - diff --git a/packages/piro/test/_input_Analysis_ROL.xml b/packages/piro/test/_input_Analysis_ROL.xml index 797253d1ea78..60b77eaf68e3 100644 --- a/packages/piro/test/_input_Analysis_ROL.xml +++ b/packages/piro/test/_input_Analysis_ROL.xml @@ -303,15 +303,5 @@ - - - - - - - - - - diff --git a/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities.xml b/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities.xml index dbefe2686bbd..1ae60b8a9c33 100644 --- a/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities.xml +++ b/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities.xml @@ -304,15 +304,5 @@ - - - - - - - - - - diff --git a/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities_Tpetra.xml b/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities_Tpetra.xml index bc7f53927112..1ef894854cd5 100644 --- a/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities_Tpetra.xml +++ b/packages/piro/test/_input_Analysis_ROL_AdjointSensitivities_Tpetra.xml @@ -304,15 +304,5 @@ - - - - - - - - - - diff --git a/packages/piro/test/_input_Analysis_ROL_Tpetra.xml b/packages/piro/test/_input_Analysis_ROL_Tpetra.xml index 65f822ffdfe6..3594a4a70dbc 100644 --- a/packages/piro/test/_input_Analysis_ROL_Tpetra.xml +++ b/packages/piro/test/_input_Analysis_ROL_Tpetra.xml @@ -303,15 +303,5 @@ - - - - - - - - - - From 85b4066ad2e5bdaef4284495c744087dc6f99eac Mon Sep 17 00:00:00 2001 From: Chris Siefert Date: Mon, 21 Oct 2019 10:24:50 -0600 Subject: [PATCH 41/44] MueLu: Stuff for running w/o a pre-smoother --- .../src/MueCentral/MueLu_Hierarchy_def.hpp | 8 ++ packages/muelu/test/unit_tests/Hierarchy.cpp | 110 ++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/packages/muelu/src/MueCentral/MueLu_Hierarchy_def.hpp b/packages/muelu/src/MueCentral/MueLu_Hierarchy_def.hpp index d7dbb0c0d833..e3cb0be86e6e 100644 --- a/packages/muelu/src/MueCentral/MueLu_Hierarchy_def.hpp +++ b/packages/muelu/src/MueCentral/MueLu_Hierarchy_def.hpp @@ -985,6 +985,7 @@ namespace MueLu { postSmoo->Apply(X, B, zeroGuess); CompCoarse->stop(); emptySolve = false; + zeroGuess = false; } if (emptySolve == true) { GetOStream(Warnings1) << "No coarse grid solver" << std::endl; @@ -1005,6 +1006,7 @@ namespace MueLu { if (Fine->IsAvailable("PreSmoother")) { RCP preSmoo = Fine->Get< RCP >("PreSmoother"); preSmoo->Apply(X, B, zeroGuess); + zeroGuess = false; } } @@ -1014,6 +1016,12 @@ namespace MueLu { if (!useStackedTimer) ATime = rcp(new TimeMonitor(*this, prefix + "Solve : residual calculation (total)" , Timings0)); RCP ALevelTime = rcp(new TimeMonitor(*this, prefix + "Solve : residual calculation" + levelSuffix, Timings0)); + if (zeroGuess) { + // If there's a pre-smoother, then zeroGuess is false. If there isn't and people still have zeroGuess set, + // then then X still has who knows what, so we need to zero it before we go to the coarse grid. + X.putScalar(zero); + } + Utilities::Residual(*A, X, B,*residual_[startLevel]); residual = residual_[startLevel]; } diff --git a/packages/muelu/test/unit_tests/Hierarchy.cpp b/packages/muelu/test/unit_tests/Hierarchy.cpp index 73e6660e1267..cf44dc468ed6 100644 --- a/packages/muelu/test/unit_tests/Hierarchy.cpp +++ b/packages/muelu/test/unit_tests/Hierarchy.cpp @@ -715,6 +715,8 @@ namespace MueLuTests { # endif } + + TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(Hierarchy, SetupHierarchy3level, Scalar, LocalOrdinal, GlobalOrdinal, Node) { # include @@ -816,6 +818,113 @@ namespace MueLuTests { H.Iterate(*RHS, *X, iterations); } + + TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(Hierarchy, SetupHierarchy3level_NoPreSmooth, Scalar, LocalOrdinal, GlobalOrdinal, Node) + { +# include + MUELU_TESTING_LIMIT_SCOPE(Scalar,GlobalOrdinal,Node); + MUELU_TESTING_SET_OSTREAM; + + typedef typename Teuchos::ScalarTraits::magnitudeType real_type; + typedef typename Xpetra::MultiVector RealValuedMultiVector; + +# if !defined(HAVE_MUELU_AMESOS) || !defined(HAVE_MUELU_IFPACK) + MUELU_TESTING_DO_NOT_TEST(Xpetra::UseEpetra, "Amesos, Ifpack"); +# endif +# if !defined(HAVE_MUELU_AMESOS2) || !defined(HAVE_MUELU_IFPACK2) + MUELU_TESTING_DO_NOT_TEST(Xpetra::UseTpetra, "Amesos2, Ifpack2"); +# endif + + RCP > comm = TestHelpers::Parameters::getDefaultComm(); + GO nx = 299*comm->getSize(); + RCP A = TestHelpers::TestFactory::Build1DPoisson(nx); + + Teuchos::ParameterList galeriList; + galeriList.set("nx", nx); + RCP coordinates = Galeri::Xpetra::Utils::CreateCartesianCoordinates("1D", A->getRowMap(), galeriList); + + // Multigrid Hierarchy + Hierarchy H(A); + H.setVerbLevel(Teuchos::VERB_HIGH); + H.SetMaxCoarseSize(50); + H.GetLevel(0)->Set("Coordinates", coordinates); + + // Multigrid setup phase (using default parameters) + FactoryManager M0; // how to build aggregates and smoother of the first level + M0.SetKokkosRefactor(false); + + FactoryManager M1; // first coarse level (Plain aggregation) + M1.SetKokkosRefactor(false); + M1.SetFactory("A", rcp(new RAPFactory())); + RCP P = rcp(new TentativePFactory()); + M1.SetFactory("P", P); + M1.SetFactory("Ptent", P); //FIXME: can it be done automatically in FactoryManager? + + FactoryManager M2; // last level (SA) + M2.SetKokkosRefactor(false); + M2.SetFactory("A", rcp(new RAPFactory())); + M2.SetFactory("P", rcp(new SaPFactory())); + + // Here we want no pre-smoothing on levels 0 and 1 + RCP noSmooProto; + RCP smooProto = TestHelpers::TestFactory::createSmootherPrototype("Gauss-Seidel", 2); + RCP SmooFact = rcp( new SmootherFactory(noSmooProto,smooProto) ); + M0.SetFactory("Smoother", SmooFact); + M1.SetFactory("Smoother", SmooFact); + + bool r; // cf. bug Teuchos Bug 5214 + r = H.Setup(0, Teuchos::null, rcpFromRef(M0), rcpFromRef(M1)); TEST_EQUALITY(r, false); + r = H.Setup(1, rcpFromRef(M0), rcpFromRef(M1), rcpFromRef(M2)); TEST_EQUALITY(r, false); + r = H.Setup(2, rcpFromRef(M1), rcpFromRef(M2), Teuchos::null ); TEST_EQUALITY(r, true); + + RCP l0 = H.GetLevel(0); + RCP l1 = H.GetLevel(1); + RCP l2 = H.GetLevel(2); + + /*RCP stdout = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); + l0->print(*stdout,Teuchos::VERB_EXTREME); + l1->print(*stdout,Teuchos::VERB_EXTREME); + l2->print(*stdout,Teuchos::VERB_EXTREME);*/ + + TEST_EQUALITY(l0->IsAvailable("PreSmoother", MueLu::NoFactory::get()), false); // no pre-smooth + TEST_EQUALITY(l1->IsAvailable("PreSmoother", MueLu::NoFactory::get()), false); // no pre-smooth + TEST_EQUALITY(l2->IsAvailable("PreSmoother", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l0->IsAvailable("PostSmoother", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l1->IsAvailable("PostSmoother", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l2->IsAvailable("PostSmoother", MueLu::NoFactory::get()), false); // direct solve + TEST_EQUALITY(l1->IsAvailable("P", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l2->IsAvailable("P", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l1->IsAvailable("R", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l2->IsAvailable("R", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l0->IsAvailable("A", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l1->IsAvailable("A", MueLu::NoFactory::get()), true); + TEST_EQUALITY(l2->IsAvailable("A", MueLu::NoFactory::get()), true); + + TEST_EQUALITY(l0->GetKeepFlag("A", MueLu::NoFactory::get()), MueLu::UserData); + TEST_EQUALITY(l0->GetKeepFlag("PostSmoother", MueLu::NoFactory::get()), MueLu::Final); + + TEST_EQUALITY(l1->GetKeepFlag("A", MueLu::NoFactory::get()), MueLu::Final); + TEST_EQUALITY(l1->GetKeepFlag("P", MueLu::NoFactory::get()), MueLu::Final); + TEST_EQUALITY(l1->GetKeepFlag("R", MueLu::NoFactory::get()), MueLu::Final); + TEST_EQUALITY(l1->GetKeepFlag("PostSmoother", MueLu::NoFactory::get()), MueLu::Final); + + TEST_EQUALITY(l2->GetKeepFlag("A", MueLu::NoFactory::get()), MueLu::Final); + TEST_EQUALITY(l2->GetKeepFlag("P", MueLu::NoFactory::get()), MueLu::Final); + TEST_EQUALITY(l2->GetKeepFlag("R", MueLu::NoFactory::get()), MueLu::Final); + TEST_EQUALITY(l2->GetKeepFlag("PreSmoother", MueLu::NoFactory::get()), MueLu::Final); + // TEST_EQUALITY(l2->GetKeepFlag("PostSmoother", MueLu::NoFactory::get()), MueLu::Final); // direct solve + + RCP RHS = MultiVectorFactory::Build(A->getRowMap(), 1); + RCP X = MultiVectorFactory::Build(A->getRowMap(), 1); + RHS->setSeed(846930886); + RHS->randomize(); + + X->putScalar( (Scalar) 0.0); + + int iterations=10; + H.Iterate(*RHS, *X, iterations); + } + TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(Hierarchy, SetupHierarchy3levelFacManagers, Scalar, LocalOrdinal, GlobalOrdinal, Node) { //MUELU_TEST_ONLY_FOR(Xpetra::UseEpetra) @@ -1233,6 +1342,7 @@ namespace MueLuTests { TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, SetupHierarchy1levelv2, Scalar, LO, GO, Node) \ TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, SetupHierarchy2level, Scalar, LO, GO, Node) \ TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, SetupHierarchy3level, Scalar, LO, GO, Node) \ + TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, SetupHierarchy3level_NoPreSmooth, Scalar, LO, GO, Node) \ TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, SetupHierarchy3levelFacManagers, Scalar, LO, GO, Node) \ TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, SetupHierarchyTestBreakCondition, Scalar, LO, GO, Node) \ TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(Hierarchy, Write, Scalar, LO, GO, Node) \ From 501efdcf4655237d9278f094b3aecc7f1dcb6929 Mon Sep 17 00:00:00 2001 From: Paul Wolfenbarger Date: Mon, 21 Oct 2019 12:29:31 -0600 Subject: [PATCH 42/44] PullRequestLinuxDriver.sh: remove ".sandia.gov" from the no_proxy environemt variable Testing shows this works on the ascic machines as well as the cloud nodes for both testing (although it is currently showing "500 error" and for testing-dev. Lets hope that it holds up for a while. --- cmake/std/PullRequestLinuxDriver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/std/PullRequestLinuxDriver.sh b/cmake/std/PullRequestLinuxDriver.sh index 0031797edf88..6de71eb01775 100755 --- a/cmake/std/PullRequestLinuxDriver.sh +++ b/cmake/std/PullRequestLinuxDriver.sh @@ -34,7 +34,7 @@ echo -e "REPO_ROOT : ${REPO_ROOT}" # proxies so set them here. export https_proxy=http://wwwproxy.sandia.gov:80 export http_proxy=http://wwwproxy.sandia.gov:80 -export no_proxy='localhost,localnets,.sandia.gov,127.0.0.1,169.254.0.0/16,forge.sandia.gov' +export no_proxy='localhost,localnets,127.0.0.1,169.254.0.0/16,forge.sandia.gov' # Call the script to handle merging the incoming branch into From 913fab75b69b4e899c5e3a7b8fa29f4550a1e495 Mon Sep 17 00:00:00 2001 From: Chris Siefert Date: Mon, 21 Oct 2019 14:36:37 -0600 Subject: [PATCH 43/44] Ifpack2: Adding Richardson support to Ifpack2::Relaxation --- packages/ifpack2/src/Ifpack2_ConfigDefs.hpp | 3 +- .../ifpack2/src/Ifpack2_Relaxation_decl.hpp | 14 +++- .../ifpack2/src/Ifpack2_Relaxation_def.hpp | 74 ++++++++++++++++++- .../unit_tests/Ifpack2_UnitTestRelaxation.cpp | 33 +++++++++ 4 files changed, 120 insertions(+), 4 deletions(-) diff --git a/packages/ifpack2/src/Ifpack2_ConfigDefs.hpp b/packages/ifpack2/src/Ifpack2_ConfigDefs.hpp index 9dee5e990677..7bcc208d821a 100644 --- a/packages/ifpack2/src/Ifpack2_ConfigDefs.hpp +++ b/packages/ifpack2/src/Ifpack2_ConfigDefs.hpp @@ -82,7 +82,8 @@ namespace Ifpack2 { SGS, //!< Symmetric Gauss-Seidel MTGS, //!< Multicore Gauss-Seidel MTSGS, //!< Multicore Symmetric Gauss-Seidel - MTSPLITJACOBI //!< Multicore split Jacobi; "split" refers to splitting A = D + R + MTSPLITJACOBI, //!< Multicore split Jacobi; "split" refers to splitting A = D + R + RICHARDSON //!< Richardson }; } // namespace Details diff --git a/packages/ifpack2/src/Ifpack2_Relaxation_decl.hpp b/packages/ifpack2/src/Ifpack2_Relaxation_decl.hpp index da3532018d3f..b5a634f2f964 100644 --- a/packages/ifpack2/src/Ifpack2_Relaxation_decl.hpp +++ b/packages/ifpack2/src/Ifpack2_Relaxation_decl.hpp @@ -88,6 +88,7 @@ preconditioner for Belos linear solvers, and for any linear solver that treats preconditioners as instances of Tpetra::Operator. This class implements the following relaxation methods: +- Richardson - Jacobi - Gauss-Seidel - Symmetric Gauss-Seidel @@ -106,7 +107,7 @@ pp. 2864-2887. \section Ifpack_Relaxation_Performance Performance -Jacobi will always use your matrix's native sparse matrix-vector +Richardson and Jacobi will always use your matrix's native sparse matrix-vector multiply kernel. This should give good performance, since we have spent a lot of effort tuning Tpetra's kernels. Depending on the Node type of your Tpetra matrix, it may also exploit threads for additional @@ -176,6 +177,11 @@ dimensions. Suppose that \f$x^{(0)}\f$ is the starting vector and iteration $k+1$ of whatever relaxation method we are using. Here, \f$x^{(k)}_i\f$ is the $i$-th element of vector \f$x^{(k)}\f$. +The Richardson method computes +\f[ +x^{(k+1)}_i = x_^{(k)}_i + alpha ( b_i - \sum_{j} A_{ij} x^{(k)}_j ). +\f] + The Jacobi method computes \f[ x^{(k+1)}_i = A_{ii}^{-1} ( b_i - \sum_{j \neq i} A_{ij} x^{(k)}_j ). @@ -317,6 +323,7 @@ class Relaxation : /// The "relaxation: type" (string) parameter sets the relaxation / /// preconditioner method you want to use. It currently accepts the /// following values (the default is "Jacobi"): + /// - "Richardson" /// - "Jacobi" /// - "Gauss-Seidel" /// - "Symmetric Gauss-Seidel" @@ -626,6 +633,11 @@ class Relaxation : /// that are not in the input list. void setParametersImpl (Teuchos::ParameterList& params); + //! Apply Richardson to X, returning the result in Y. + void ApplyInverseRichardson( + const Tpetra::MultiVector& X, + Tpetra::MultiVector& Y) const; + //! Apply Jacobi to X, returning the result in Y. void ApplyInverseJacobi( const Tpetra::MultiVector& X, diff --git a/packages/ifpack2/src/Ifpack2_Relaxation_def.hpp b/packages/ifpack2/src/Ifpack2_Relaxation_def.hpp index 1e236a3b197e..d9e03c880e0b 100644 --- a/packages/ifpack2/src/Ifpack2_Relaxation_def.hpp +++ b/packages/ifpack2/src/Ifpack2_Relaxation_def.hpp @@ -272,18 +272,20 @@ Relaxation::getValidParameters () const // Set a validator that automatically converts from the valid // string options to their enum values. - Array precTypes (5); + Array precTypes (6); precTypes[0] = "Jacobi"; precTypes[1] = "Gauss-Seidel"; precTypes[2] = "Symmetric Gauss-Seidel"; precTypes[3] = "MT Gauss-Seidel"; precTypes[4] = "MT Symmetric Gauss-Seidel"; - Array precTypeEnums (5); + precTypes[5] = "Richardson"; + Array precTypeEnums (6); precTypeEnums[0] = Details::JACOBI; precTypeEnums[1] = Details::GS; precTypeEnums[2] = Details::SGS; precTypeEnums[3] = Details::MTGS; precTypeEnums[4] = Details::MTSGS; + precTypeEnums[5] = Details::RICHARDSON; const std::string defaultPrecType ("Jacobi"); setStringToIntegralParameter ("relaxation: type", defaultPrecType, "Relaxation method", precTypes (), precTypeEnums (), @@ -590,6 +592,9 @@ apply (const Tpetra::MultiVector::compute () } +template +void +Relaxation:: +ApplyInverseRichardson (const Tpetra::MultiVector& X, + Tpetra::MultiVector& Y) const +{ + using Teuchos::as; + const double numGlobalRows = as (A_->getGlobalNumRows ()); + const double numVectors = as (X.getNumVectors ()); + if (ZeroStartingSolution_) { + // For the first Richardson sweep, if we are allowed to assume that + // the initial guess is zero, then Richardson is just alpha times the RHS + // Compute it as Y(i,j) = DampingFactor_ * X(i,j). + Y.scale(DampingFactor_,X); + + // Count (global) floating-point operations. Ifpack2 represents + // this as a floating-point number rather than an integer, so that + // overflow (for a very large number of calls, or a very large + // problem) is approximate instead of catastrophic. + double flopUpdate = 0.0; + if (DampingFactor_ == STS::one ()) { + // Y(i,j) = X(i,j): one multiply for each entry of Y. + flopUpdate = numGlobalRows * numVectors; + } else { + // Y(i,j) = DampingFactor_ * X(i,j): + // One multiplies per entry of Y. + flopUpdate = numGlobalRows * numVectors; + } + ApplyFlops_ += flopUpdate; + if (NumSweeps_ == 1) { + return; + } + } + // If we were allowed to assume that the starting guess was zero, + // then we have already done the first sweep above. + const int startSweep = ZeroStartingSolution_ ? 1 : 0; + + // Allocate a multivector if the cached one isn't perfect + updateCachedMultiVector(Y.getMap(),as(numVectors)); + + for (int j = startSweep; j < NumSweeps_; ++j) { + // Each iteration: Y = Y + \omega D^{-1} (X - A*Y) + applyMat (Y, *cachedMV_); + cachedMV_->update (STS::one (), X, -STS::one ()); + Y.update(DampingFactor_,*cachedMV_,STS::one()); + } + + // For each column of output, for each pass over the matrix: + // + // - One + and one * for each matrix entry + // - One / and one + for each row of the matrix + // - If the damping factor is not one: one * for each row of the + // matrix. (It's not fair to count this if the damping factor is + // one, since the implementation could skip it. Whether it does + // or not is the implementation's choice.) + + // Floating-point operations due to the damping factor, per matrix + // row, per direction, per columm of output. + const double numGlobalNonzeros = as (A_->getGlobalNumEntries ()); + const double dampingFlops = (DampingFactor_ == STS::one ()) ? 0.0 : 1.0; + ApplyFlops_ += as (NumSweeps_ - startSweep) * numVectors * + (2.0 * numGlobalNonzeros + dampingFlops); +} + + template void Relaxation:: diff --git a/packages/ifpack2/test/unit_tests/Ifpack2_UnitTestRelaxation.cpp b/packages/ifpack2/test/unit_tests/Ifpack2_UnitTestRelaxation.cpp index 559f358c7a37..4d51d923c40e 100644 --- a/packages/ifpack2/test/unit_tests/Ifpack2_UnitTestRelaxation.cpp +++ b/packages/ifpack2/test/unit_tests/Ifpack2_UnitTestRelaxation.cpp @@ -273,6 +273,38 @@ TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(Ifpack2Relaxation, Test4, Scalar, LocalOrdinal TEST_NOTHROW(prec.apply(x, y)); } + // Test apply() to make sure the Richardson methods work +TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(Ifpack2Relaxation, Richardson, Scalar, LocalOrdinal, GlobalOrdinal) +{ + typedef Tpetra::CrsMatrix crs_matrix_type; + typedef Tpetra::RowMatrix row_matrix_type; + typedef Tpetra::Map map_type; + + out << "Ifpack2::Version(): " << Ifpack2::Version () << std::endl; + + GST num_rows_per_proc = 5; + + RCP rowmap = + tif_utest::create_tpetra_map (num_rows_per_proc); + RCP crsmatrix = + tif_utest::create_test_matrix (rowmap); + Ifpack2::Relaxation prec (crsmatrix); + + Teuchos::ParameterList params; + params.set("relaxation: type", "Richardson"); + prec.setParameters(params); + + prec.initialize(); + prec.compute(); + + Tpetra::MultiVector x(rowmap,2), y(rowmap,2); + x.putScalar (Teuchos::ScalarTraits::one ()); + + TEST_EQUALITY(x.getMap()->getNodeNumElements(), 5); + TEST_EQUALITY(y.getMap()->getNodeNumElements(), 5); + TEST_NOTHROW(prec.apply(x, y)); +} + // Check that (symmetric) Gauss-Seidel works if there are some MPI processes with zero rows of the matrix. // Test contributed by Jonathan Hu on 04 Jan 2013. TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(Ifpack2Relaxation, SymGaussSeidelZeroRows, Scalar, LocalOrdinal, GlobalOrdinal) @@ -1058,6 +1090,7 @@ TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(Ifpack2Relaxation, TestUpperTriangularBlockCrs TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, Test2, Scalar, LO, GO ) \ TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, Test3, Scalar, LO, GO ) \ TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, Test4, Scalar, LO, GO ) \ + TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, Richardson, Scalar, LO, GO ) \ TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, SymGaussSeidelZeroRows, Scalar, LO, GO ) \ TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, LocalSymGaussSeidelZeroRows, Scalar, LO, GO ) \ TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT( Ifpack2Relaxation, NotCrsMatrix, Scalar, LO, GO ) \ From 20e0899f090c9115de2ca6db178e675cc12cf527 Mon Sep 17 00:00:00 2001 From: Alan Williams Date: Mon, 21 Oct 2019 15:32:22 -0600 Subject: [PATCH 44/44] stk snapshot as of 10/21/2019 In particular: Add cmake option -DSTK_DISABLE_MPI_NEIGHBOR_COMM:BOOL=ON/OFF to allow for disabling stk's use of the MPI_Neighbor functions. --- .../stk_search/boundingBoxSearch3D.cpp | 6 +- .../stk_balance/StkbalanceUserSupport.cpp | 4 +- .../Kokkos/Kokkos_TeamReductionTest.C | 144 ---------------- .../stk/stk_mesh/stk_mesh/base/BulkData.cpp | 159 +++++++++++++++--- .../stk/stk_mesh/stk_mesh/base/BulkData.hpp | 10 +- .../stk_mesh/baseImpl/MeshModification.cpp | 2 +- .../stk_search/integrationtest/CMakeLists.txt | 16 -- .../UnitTestNaluPerformance.cpp | 14 +- .../integrationtest/UnitTestPerformance.cpp | 24 --- .../integrationtest/UnitTestVerification.cpp | 122 -------------- .../stk_search/stk_search/CoarseSearch.hpp | 30 ---- .../boundingBoxSearch3D.cpp | 6 +- .../stk/stk_search/unit_tests/CMakeLists.txt | 6 - .../MeshUtilsForBoundingVolumes.hpp | 13 +- .../unit_tests/UnitTestCoarseSearch.cpp | 128 -------------- .../UnitTestCoarseSearchBoostImpl.cpp | 131 --------------- .../PeriodicBoundarySearch.hpp | 24 +-- packages/stk/stk_transfer/Jamfile | 4 +- .../stk_transfer/GeometricTransfer.hpp | 6 +- .../ReducedDependencyGeometricTransfer.hpp | 2 +- .../stk_unit_test_utils/BulkDataTester.hpp | 3 +- .../stk_unit_tests/stk_mesh/UnitTestCEO.cpp | 55 ++++++ .../stk_unit_tests/stk_mesh/UnitTestCEOME.cpp | 15 +- .../stk_mesh/UnitTestGhostingWithShared.cpp | 93 ++++++++++ .../UnitTestGeometricTransfer.cpp | 6 +- .../stk_util/cmake/STK_Trilinos_config.h.in | 2 + packages/stk/stk_util/stk_util/CMakeLists.txt | 4 + .../stk_util/parallel/CommNeighbors.hpp | 4 + 28 files changed, 350 insertions(+), 683 deletions(-) delete mode 100644 packages/stk/stk_learning/Kokkos/Kokkos_TeamReductionTest.C delete mode 100644 packages/stk/stk_search/unit_tests/UnitTestCoarseSearchBoostImpl.cpp diff --git a/packages/stk/stk_doc_tests/stk_search/boundingBoxSearch3D.cpp b/packages/stk/stk_doc_tests/stk_search/boundingBoxSearch3D.cpp index ba197844b82c..09d343e4965f 100644 --- a/packages/stk/stk_doc_tests/stk_search/boundingBoxSearch3D.cpp +++ b/packages/stk/stk_doc_tests/stk_search/boundingBoxSearch3D.cpp @@ -41,7 +41,7 @@ namespace typedef stk::search::Box Box; typedef stk::search::IdentProc Id; void assertPairInResults(Id a, Id b, const std::vector > &searchResults); -TEST(StkSearchHowTo, useBoostRtreeSearch) +TEST(StkSearchHowTo, useKdtreeSearch) { MPI_Comm comm = MPI_COMM_WORLD; int myProcId = stk::parallel_machine_rank(comm); @@ -53,7 +53,7 @@ TEST(StkSearchHowTo, useBoostRtreeSearch) secondList.push_back(std::make_pair(unitBox, secondId)); std::vector > searchResults; - stk::search::coarse_search(firstList, secondList, stk::search::BOOST_RTREE, comm, searchResults); + stk::search::coarse_search(firstList, secondList, stk::search::KDTREE, comm, searchResults); int numProc = stk::parallel_machine_size(comm); for(int procId = 0; procId < numProc; procId++) @@ -78,7 +78,7 @@ TEST(StkSearchHowTo, useSphereAndPointBoundingVolumes) secondList.push_back(std::make_pair(point, secondId)); std::vector > searchResults; - stk::search::coarse_search(firstList, secondList, stk::search::BOOST_RTREE, comm, searchResults); + stk::search::coarse_search(firstList, secondList, stk::search::KDTREE, comm, searchResults); int numProc = stk::parallel_machine_size(comm); for(int procId = 0; procId < numProc; procId++) diff --git a/packages/stk/stk_integration_tests/stk_balance/StkbalanceUserSupport.cpp b/packages/stk/stk_integration_tests/stk_balance/StkbalanceUserSupport.cpp index 00ef9855b6a2..c3f8829072ec 100644 --- a/packages/stk/stk_integration_tests/stk_balance/StkbalanceUserSupport.cpp +++ b/packages/stk/stk_integration_tests/stk_balance/StkbalanceUserSupport.cpp @@ -92,7 +92,7 @@ void write_metrics_for_overlapping_BB(int myId, const stk::balance::internal::Bo stk::balance::internal::BoxVectorWithStkId local_range = local_domain; stk::balance::internal::StkSearchResults searchResults; - stk::search::coarse_search(local_domain, local_range, stk::search::BOOST_RTREE, MPI_COMM_WORLD, searchResults); + stk::search::coarse_search(local_domain, local_range, stk::search::KDTREE, MPI_COMM_WORLD, searchResults); std::ostringstream os; double dx = coordMaxOnProc[0] - coordMinOnProc[0]; @@ -350,7 +350,7 @@ void set_contact_weights(stk::mesh::Field& contactCriteria, double weigh stk::balance::internal::StkSearchResults searchResults; try { - stk::search::coarse_search(local_domain, local_range, stk::search::BOOST_RTREE, MPI_COMM_WORLD, searchResults); + stk::search::coarse_search(local_domain, local_range, stk::search::KDTREE, MPI_COMM_WORLD, searchResults); } catch(std::exception& e) { diff --git a/packages/stk/stk_learning/Kokkos/Kokkos_TeamReductionTest.C b/packages/stk/stk_learning/Kokkos/Kokkos_TeamReductionTest.C deleted file mode 100644 index 31ec5a62c64a..000000000000 --- a/packages/stk/stk_learning/Kokkos/Kokkos_TeamReductionTest.C +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include -#include - -#ifdef KOKKOS_ENABLE_CUDA - typedef Kokkos::Cuda Device; - typedef Kokkos::CudaSpace MemSpace; -#else - typedef Kokkos::Serial Device; - typedef Kokkos::HostSpace MemSpace; -#endif - -template -struct MinOp -{ - KOKKOS_FUNCTION - void operator()(volatile T& update, volatile const T& input) const - { - update = update < input ? update : input; - } -}; - -typedef double value_type; -typedef Kokkos::View view_type; - -template -struct ViewAccessFunctor -{ - KOKKOS_FUNCTION - ViewAccessFunctor(const view_type& view, int team_offset) : v(view), offset(team_offset) {} - - KOKKOS_FUNCTION - void operator()(int i, value_type& update) const - { - ReductionOp()(update,v(offset + i)); - } - -private: - const view_type& v; - int offset; -}; - -template -struct ReductionTeamFunctor -{ - struct JoinOp { - public: - typedef JoinOp reducer; - typedef double value_type; - - private: - value_type* value; - - public: - KOKKOS_FUNCTION - JoinOp (value_type& value_) : value (&value_) {} - - KOKKOS_FUNCTION - void join (value_type& dest, const value_type& src) const { - ReductionOp() (dest, src); - } - - KOKKOS_FUNCTION - void join (volatile value_type& dest, const volatile value_type& src) const { - ReductionOp() (dest, src); - } - - KOKKOS_FUNCTION - void init (value_type& val) const { - ReductionOp()(val, *value); - } - - KOKKOS_FUNCTION - value_type& reference() const { - return *value; - } - - KOKKOS_FUNCTION - view_type view () const { - return view_type (value); - } - }; - - KOKKOS_FUNCTION - ReductionTeamFunctor(const view_type v, int len, value_type initVal) : view(v), inner_length(len), initialValue(initVal) { } - - KOKKOS_FUNCTION - void init(value_type &update) const - { - update = initialValue; - } - - KOKKOS_FUNCTION - void join(volatile value_type& update, volatile const value_type& input) const - { - ReductionOp()(update, input); - } - - typedef typename Kokkos::TeamPolicy >::member_type TeamHandleType; - - KOKKOS_FUNCTION - void operator()(const TeamHandleType& team, value_type& update) const - { - const int teamIndex = team.league_rank(); - unsigned numElements = inner_length; - value_type localUpdate = initialValue; - Kokkos::parallel_reduce(Kokkos::TeamThreadRange(team, 0u, numElements), - ViewAccessFunctor >(view, teamIndex*inner_length), - JoinOp(localUpdate)); - Kokkos::single(Kokkos::PerTeam(team), [&](){join(update, localUpdate);}); - } - -private: - view_type view; - int inner_length; - value_type initialValue; -}; - -double get_min_value() -{ - const int num_teams = 5; - const int inner_length = 5; - const int total_length = num_teams * inner_length; - - Kokkos::View data("data", num_teams*inner_length); - - Kokkos::parallel_for(total_length, KOKKOS_LAMBDA(const int& i) { - data(i) = i+1; - }); - - double reduction_result = std::numeric_limits::max(); - ReductionTeamFunctor > teamFunctor(data, inner_length, reduction_result); - - Kokkos::parallel_reduce(Kokkos::TeamPolicy(num_teams, Kokkos::AUTO), teamFunctor, reduction_result); - - //min value should be 1 !! - return reduction_result; -} - -TEST(KokkosReduce, get_min_value) -{ - EXPECT_EQ(1, get_min_value()); -} - diff --git a/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp b/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp index 4a06de6be549..420fae332144 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp +++ b/packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp @@ -1726,6 +1726,27 @@ bool BulkData::in_send_ghost( const Ghosting & ghost , EntityKey key , int proc return ret_val; } +bool BulkData::is_communicated_with_proc(Entity entity, int proc) const +{ + if (m_entitycomm[entity.local_offset()] == nullptr) { + return false; + } + + const EntityCommInfoVector& vec = m_entitycomm[entity.local_offset()]->comm_map; + + EntityCommInfoVector::const_iterator i = vec.begin(); + EntityCommInfoVector::const_iterator end = vec.end(); + + while(i != end) { + if (i->proc == proc) { + return true; + } + ++i; + } + + return false; +} + void fill_sorted_procs(const PairIterEntityComm& ec, std::vector& procs) { procs.clear(); @@ -3130,7 +3151,14 @@ void BulkData::internal_change_entity_owner( const std::vector & arg CommBuffer & buffer = comm.send_buffer( i->second ); Entity entity = i->first; pack_entity_info(*this, buffer , entity ); - pack_field_values(*this, buffer , entity ); + if (!is_communicated_with_proc(entity, i->second) || + std::binary_search(local_change.begin(), local_change.end(), *i, EntityLess(*this))) { + buffer.pack(1); + pack_field_values(*this, buffer , entity ); + } + else { + buffer.pack(0); + } pack_sideset_info(*this, buffer , entity ); if (unique_list_of_send_closure.empty() || entity_key(unique_list_of_send_closure.back()) != entity_key(entity)) { @@ -3145,7 +3173,14 @@ void BulkData::internal_change_entity_owner( const std::vector & arg CommBuffer & buffer = comm.send_buffer( i->second ); Entity entity = i->first; pack_entity_info(*this, buffer , entity ); - pack_field_values(*this, buffer , entity ); + if (!is_communicated_with_proc(entity, i->second) || + std::binary_search(local_change.begin(), local_change.end(), *i, EntityLess(*this))) { + buffer.pack(1); + pack_field_values(*this, buffer , entity ); + } + else { + buffer.pack(0); + } pack_sideset_info(*this, buffer , entity ); } @@ -3201,8 +3236,12 @@ void BulkData::internal_change_entity_owner( const std::vector & arg internal_declare_relation( entity , relations ); - if ( ! unpack_field_values(*this, buf , entity , error_msg ) ) { - ++error_count ; + int shouldUnpackFieldValues = 0; + buf.unpack(shouldUnpackFieldValues); + if ( shouldUnpackFieldValues==1 ) { + if ( ! unpack_field_values(*this, buf , entity , error_msg ) ) { + ++error_count ; + } } unpack_sideset_info( buf, *this, entity); @@ -4455,6 +4494,65 @@ void BulkData::internal_update_parts_for_shared_entity(stk::mesh::Entity entity, } } +void BulkData::filter_upward_ghost_relations(const Entity entity, std::function filter) +{ + EntityRank rank = entity_rank(entity); + EntityRank endRank = static_cast(mesh_meta_data().entity_rank_count()); + + for(EntityRank iRank = static_cast(rank+1); iRank < endRank; iRank++) { + unsigned numRelations = num_connectivity(entity, iRank); + const Entity* relations = begin(entity, iRank); + + for(unsigned i = 0; i < numRelations; i++) { + filter(relations[i]); + } + } +} + +EntityVector BulkData::get_upward_recv_ghost_relations(const Entity entity) +{ + EntityVector ghosts; + filter_upward_ghost_relations(entity, [&](Entity relation) { + if(in_receive_ghost(entity_key(relation))) { + ghosts.push_back(relation); + } + }); + + return ghosts; +} + +EntityVector BulkData::get_upward_send_ghost_relations(const Entity entity) +{ + EntityVector ghosts; + filter_upward_ghost_relations(entity, [&](Entity relation) { + if(in_send_ghost(entity_key(relation))) { + ghosts.push_back(relation); + } + }); + + return ghosts; +} + +void BulkData::add_entity_to_same_ghosting(Entity entity, Entity connectedGhost) { + for(PairIterEntityComm ec(internal_entity_comm_map(entity_key(connectedGhost))); ! ec.empty(); ++ec) { + if (ec->ghost_id > BulkData::AURA) { + entity_comm_map_insert(entity, EntityCommInfo(ec->ghost_id, ec->proc)); + entity_comm_list_insert(entity); + } + } +} + +void BulkData::internal_resolve_formerly_shared_entities(const EntityVector& entitiesNoLongerShared) +{ + for(Entity entity : entitiesNoLongerShared) { + EntityVector ghostRelations = get_upward_send_ghost_relations(entity); + + for(Entity ghost : ghostRelations) { + add_entity_to_same_ghosting(entity, ghost); + } + } +} + //---------------------------------------------------------------------- // Resolve modifications for ghosted entities: // If a ghosted entity is modified or destroyed on the owning @@ -4464,12 +4562,13 @@ void BulkData::internal_update_parts_for_shared_entity(stk::mesh::Entity entity, // Ghosted entities of modified or deleted entities are destroyed. // Ghosted communication lists are cleared to reflect all deletions. -void BulkData::internal_resolve_ghosted_modify_delete() +void BulkData::internal_resolve_ghosted_modify_delete(const stk::mesh::EntityVector& entitiesNoLongerShared) { ThrowRequireMsg(parallel_size() > 1, "Do not call this in serial"); // Resolve modifications for ghosted entities: std::vector remotely_modified_ghosted_entities ; + internal_resolve_formerly_shared_entities(entitiesNoLongerShared); // Communicate entity modification state for ghost entities const bool communicate_shared = false ; @@ -4504,7 +4603,6 @@ void BulkData::internal_resolve_ghosted_modify_delete() } // Remotely modified ghosts are ignored - } else if (remote_proc_is_owner) { // Receiving from 'remote_proc' for ghosting @@ -4512,16 +4610,26 @@ void BulkData::internal_resolve_ghosted_modify_delete() bool isAuraGhost = false; bool isCustomGhost = false; PairIterEntityComm pairIterEntityComm = internal_entity_comm_map(key); - for(unsigned j=0; j AURA) { - isCustomGhost = true; + isCustomGhost = true; } + } } if ( isAuraGhost ) { @@ -4530,21 +4638,23 @@ void BulkData::internal_resolve_ghosted_modify_delete() if(!isAlreadyDestroyed) { - const bool wasDestroyedByOwner = remotely_destroyed; - const bool shouldDestroyGhost = wasDestroyedByOwner || (isAuraGhost && !isCustomGhost && !hasBeenPromotedToSharedOrOwned); - const bool shouldRemoveFromGhosting = remotely_destroyed && !isAuraGhost && hasBeenPromotedToSharedOrOwned; - - if (shouldRemoveFromGhosting) { - for ( size_t j = ghosting_count_minus_shared ; j >=1 ; --j ) { - entity_comm_map_erase( key, *m_ghosting[j] ); - } - } + const bool wasDestroyedByOwner = remotely_destroyed; + const bool shouldDestroyGhost = wasDestroyedByOwner || (isAuraGhost && !isCustomGhost && !hasBeenPromotedToSharedOrOwned); + const bool shouldRemoveFromGhosting = remotely_destroyed && !isAuraGhost && hasBeenPromotedToSharedOrOwned; - if ( shouldDestroyGhost ) - { - const bool was_ghost = true; - internal_destroy_entity_with_notification(entity, was_ghost); - } + if (shouldRemoveFromGhosting) { + for ( size_t j = ghosting_count_minus_shared ; j >=1 ; --j ) { + entity_comm_map_erase( key, *m_ghosting[j] ); + } + } + + if ( shouldDestroyGhost ) + { + const bool was_ghost = true; + internal_destroy_entity_with_notification(entity, was_ghost); + } + + entity_comm_list_insert(entity); } } } // end loop on remote mod @@ -7220,6 +7330,7 @@ void BulkData::remove_entities_from_sharing(const EntityProcVec& entitiesToRemov this->internal_mark_entity(entityAndProc.first, NOT_SHARED); } } + stk::util::sort_and_unique(entitiesNoLongerShared); } namespace diff --git a/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp b/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp index 5a73c686bc5e..9c29d1fbd02a 100644 --- a/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp +++ b/packages/stk/stk_mesh/stk_mesh/base/BulkData.hpp @@ -626,6 +626,7 @@ class BulkData { // Comm-related convenience methods + bool is_communicated_with_proc(Entity entity, int proc) const; void comm_procs( EntityKey key, std::vector & procs ) const; //shared and ghosted entities void comm_procs( const Ghosting & ghost , EntityKey key, std::vector & procs ) const; void comm_shared_procs( EntityKey key, std::vector & procs ) const; @@ -1036,14 +1037,19 @@ class BulkData { void find_and_delete_internal_faces(stk::mesh::EntityRank entityRank, const stk::mesh::Selector *only_consider_second_element_from_this_selector); // Mod Mark - void internal_resolve_shared_modify_delete(stk::mesh::EntityVector & entitiesNoLongerShared) // Mod Mark + void internal_resolve_shared_modify_delete(stk::mesh::EntityVector & entitiesNoLongerShared) { m_meshModification.internal_resolve_shared_modify_delete(entitiesNoLongerShared); } + void filter_upward_ghost_relations(const Entity entity, std::function filter); + EntityVector get_upward_send_ghost_relations(const Entity entity); + EntityVector get_upward_recv_ghost_relations(const Entity entity); + void add_entity_to_same_ghosting(Entity entity, Entity connectedGhost); void update_comm_list_based_on_changes_in_comm_map(); - void internal_resolve_ghosted_modify_delete(); // Mod Mark + void internal_resolve_formerly_shared_entities(const stk::mesh::EntityVector& entitiesNoLongerShared); + void internal_resolve_ghosted_modify_delete(const stk::mesh::EntityVector& entitiesNoLongerShared); void internal_resolve_shared_part_membership_for_element_death(); // Mod Mark void remove_unneeded_induced_parts(stk::mesh::Entity entity, const EntityCommInfoVector& entity_comm_info, diff --git a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp index f4af0dce8dc6..474f34e53f8e 100644 --- a/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp +++ b/packages/stk/stk_mesh/stk_mesh/baseImpl/MeshModification.cpp @@ -80,7 +80,7 @@ bool MeshModification::internal_modification_end(modification_optimization opt) // Resolve modification or deletion of ghost entities // by destroying ghost entities that have been touched. - m_bulkData.internal_resolve_ghosted_modify_delete(); + m_bulkData.internal_resolve_ghosted_modify_delete(entitiesNoLongerShared); m_bulkData.update_comm_list_based_on_changes_in_comm_map(); // Resolve creation of entities: discover sharing and set unique ownership. diff --git a/packages/stk/stk_search/integrationtest/CMakeLists.txt b/packages/stk/stk_search/integrationtest/CMakeLists.txt index 9a417644d221..8a72e270947b 100644 --- a/packages/stk/stk_search/integrationtest/CMakeLists.txt +++ b/packages/stk/stk_search/integrationtest/CMakeLists.txt @@ -46,8 +46,6 @@ TRIBITS_ADD_EXECUTABLE( COMM serial mpi ) -IF(TPL_ENABLE_BoostLib) - TRIBITS_ADD_TEST( search_integration_tests NAME STKSearch_integration_tests @@ -58,17 +56,3 @@ TRIBITS_ADD_TEST( NUM_MPI_PROCS 1 ) -else() - -TRIBITS_ADD_TEST( - search_integration_tests - NAME STKSearch_integration_tests - ARGS "--gtest_filter=*KDTREE" - COMM serial mpi - PASS_REGULAR_EXPRESSION "PASS" - FAIL_REGULAR_EXPRESSION "FAIL" - NUM_MPI_PROCS 1 -) - -ENDIF() - diff --git a/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp b/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp index 2ac1cbde86f3..4f9a07b96cad 100644 --- a/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp +++ b/packages/stk/stk_search/integrationtest/UnitTestNaluPerformance.cpp @@ -103,15 +103,11 @@ struct Options void setSearchMethod() { std::string optionString = "-method"; - mSearchMethod = BOOST_RTREE; - std::string searchString = stk::unit_test_util::get_option(optionString, "boost"); - if ( searchString == "octree") + mSearchMethod = KDTREE; + std::string searchString = stk::unit_test_util::get_option(optionString, "gtk"); + if ( searchString != "gtk" && searchString != "kdtree") { - ThrowRequireMsg(false, "search method octree deprecated"); - } - else if ( searchString == "gtk" ) - { - mSearchMethod = KDTREE; + ThrowRequireMsg(false, "unrecognized search method"); } } @@ -175,7 +171,7 @@ void printOptions(const Options& options) } else { - std::cerr << "BOOST" << std::endl; + ThrowRequireMsg(false,"Unrecognized search method "< &domainBo void testStkSearchUsingFloatAABoxes(MPI_Comm comm, std::vector &domainBoxes, stk::search::SearchMethod searchMethod, SearchResults boxIdPairResults); -TEST(Performance, ofAxisAlignedBoundingBoxesUsingOctTree) -{ - MPI_Comm comm = MPI_COMM_WORLD; - stk::search::SearchMethod searchMethod = stk::search::KDTREE; - testPerformanceOfAxisAlignedBoundingBoxes(searchMethod, comm); -} - -TEST(Performance, ofAxisAlignedBoundingBoxesUsingBoostRtree) -{ - MPI_Comm comm = MPI_COMM_WORLD; - stk::search::SearchMethod searchMethod = stk::search::BOOST_RTREE; - testPerformanceOfAxisAlignedBoundingBoxes(searchMethod, comm); -} - TEST(Performance, ofAxisAlignedBoundingBoxesUsingKdtree) { MPI_Comm comm = MPI_COMM_WORLD; @@ -145,21 +131,11 @@ void testPerformanceOfAxisAlignedBoundingBoxes(stk::search::SearchMethod searchM //////////////////////////////////////////////////////////// -TEST(Performance, stkSearchUsingBoostUsingStkAABoxes) -{ - runStkSearchTestUsingStkAABoxes(stk::search::BOOST_RTREE); -} - TEST(Performance, stkSearchUsingKdtreeUsingStkAABoxes) { runStkSearchTestUsingStkAABoxes(stk::search::KDTREE); } -TEST(Performance, stkSearchUsingBoostUsingFloatAABoxes) -{ - runStkSearchTestUsingFloatAABoxes(stk::search::BOOST_RTREE); -} - TEST(Performance, stkSearchUsingKdtreeUsingFloatAABoxes) { runStkSearchTestUsingFloatAABoxes(stk::search::KDTREE); diff --git a/packages/stk/stk_search/integrationtest/UnitTestVerification.cpp b/packages/stk/stk_search/integrationtest/UnitTestVerification.cpp index 1dc1f8de1aae..b44a393e4efb 100644 --- a/packages/stk/stk_search/integrationtest/UnitTestVerification.cpp +++ b/packages/stk/stk_search/integrationtest/UnitTestVerification.cpp @@ -64,19 +64,6 @@ int numProcessors() return stk::parallel_machine_size(comm); } -TEST(Verification, OverlappingSpheres_BOOST_RTREE) -{ - if (numProcessors() > 1) { - return; - } - - double distanceBetweenSphereCenters = 0.5; - std::vector< std::pair > boxIdPairResults; - runTwoSpheresTest(stk::search::BOOST_RTREE, distanceBetweenSphereCenters, radiusOfOneHalf, boxIdPairResults); - - ASSERT_EQ(1u, boxIdPairResults.size()); -} - TEST(Verification, OverlappingSpheres_KDTREE) { if (numProcessors() > 1) { @@ -90,15 +77,6 @@ TEST(Verification, OverlappingSpheres_KDTREE) ASSERT_EQ(1u, boxIdPairResults.size()); } -TEST(Verification, NonOverlappingSpheres_BOOST_RTREE) -{ - double distanceBetweenSphereCenters = 2.0; - std::vector< std::pair > boxIdPairResults; - runTwoSpheresTest(stk::search::BOOST_RTREE, distanceBetweenSphereCenters, radiusOfOneHalf, boxIdPairResults); - - ASSERT_EQ(0u, boxIdPairResults.size()); -} - TEST(Verification, NonOverlappingSpheres_KDTREE) { double distanceBetweenSphereCenters = 2.0; @@ -108,19 +86,6 @@ TEST(Verification, NonOverlappingSpheres_KDTREE) ASSERT_EQ(0u, boxIdPairResults.size()); } -TEST(Verification, JustEdgeOverlappingSpheres_BOOST_RTREE) -{ - if (numProcessors() > 1) { - return; - } - - double distanceBetweenSphereCenters = 0.999999999; - std::vector< std::pair > boxIdPairResults; - runTwoSpheresTest(stk::search::BOOST_RTREE, distanceBetweenSphereCenters, radiusOfOneHalf, boxIdPairResults); - - ASSERT_EQ(1u, boxIdPairResults.size()); -} - TEST(Verification, JustEdgeOverlappingSpheres_KDTREE) { if (numProcessors() > 1) { @@ -134,15 +99,6 @@ TEST(Verification, JustEdgeOverlappingSpheres_KDTREE) ASSERT_EQ(1u, boxIdPairResults.size()); } -TEST(Verification, NotQuiteEdgeOverlappingSpheres_BOOST_RTREE) -{ - double distanceBetweenSphereCenters = 1.0000000001; - std::vector< std::pair > boxIdPairResults; - runTwoSpheresTest(stk::search::BOOST_RTREE, distanceBetweenSphereCenters, radiusOfOneHalf, boxIdPairResults); - - ASSERT_EQ(0u, boxIdPairResults.size()); -} - TEST(Verification, NotQuiteEdgeOverlappingSpheres_KDTREE) { double distanceBetweenSphereCenters = 1.0000000001; @@ -195,13 +151,6 @@ void runBoxOverlappingEightSurroundingBoxes(stk::search::SearchMethod searchMeth } } -TEST(Verification, SphereOverlappingEightSurroundingSpheres_BOOST_RTREE) -{ - const double radius = 0.708; - const unsigned numExpectedResults = 8; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - TEST(Verification, SphereOverlappingEightSurroundingSpheres_KDTREE) { const double radius = 0.708; @@ -209,27 +158,6 @@ TEST(Verification, SphereOverlappingEightSurroundingSpheres_KDTREE) runBoxOverlappingEightSurroundingBoxes(stk::search::KDTREE, radius, numExpectedResults); } -TEST(Verification, SphereOverlappingNoSurroundingPoints_BOOST_RTREE) -{ - const double radius = 0.99; - const unsigned numExpectedResults = 0; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - -TEST(Verification, SphereOverlappingFourSurroundingPoints_BOOST_RTREE) -{ - const double radius = 1.41; - const unsigned numExpectedResults = 4; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - -TEST(Verification, SphereOverlappingEightSurroundingPoints_BOOST_RTREE) -{ - const double radius = 1.42; - const unsigned numExpectedResults = 8; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - TEST(Verification, SphereOverlappingNoSurroundingPoints_KDTREE) { const double radius = 0.99; @@ -251,13 +179,6 @@ TEST(Verification, SphereOverlappingEightSurroundingPoints_KDTREE) runBoxOverlappingEightSurroundingBoxes(stk::search::KDTREE, radius, numExpectedResults); } -TEST(Verification, SphereOverlappingFourOfEightSurroundingSpheres_BOOST_RTREE) -{ - const double radius = 0.706; - const unsigned numExpectedResults = 4; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - TEST(Verification, SphereOverlappingFourOfEightSurroundingSpheres_KDTREE) { const double radius = 0.706; @@ -265,13 +186,6 @@ TEST(Verification, SphereOverlappingFourOfEightSurroundingSpheres_KDTREE) runBoxOverlappingEightSurroundingBoxes(stk::search::KDTREE, radius, numExpectedResults); } -TEST(Verification, BoxOverlappingNoSurroundingPoints_BOOST_RTREE) -{ - const double radius = 0.99; - const unsigned numExpectedResults = 0; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - TEST(Verification, BoxOverlappingNoSurroundingPoints_KDTREE) { const double radius = 0.99; @@ -279,13 +193,6 @@ TEST(Verification, BoxOverlappingNoSurroundingPoints_KDTREE) runBoxOverlappingEightSurroundingBoxes(stk::search::KDTREE, radius, numExpectedResults); } -TEST(Verification, BoxOverlappingEightSurroundingPoints_BOOST_RTREE) -{ - const double radius = 1.01; - const unsigned numExpectedResults = 8; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - TEST(Verification, BoxOverlappingEightSurroundingPoints_KDTREE) { const double radius = 1.01; @@ -293,20 +200,6 @@ TEST(Verification, BoxOverlappingEightSurroundingPoints_KDTREE) runBoxOverlappingEightSurroundingBoxes(stk::search::KDTREE, radius, numExpectedResults); } -TEST(Verification, PointOverlappingNoSurroundingBoxes_BOOST_RTREE) -{ - const double radius = 0.99; - const unsigned numExpectedResults = 0; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - -TEST(Verification, PointOverlappingEightSurroundingBoxes_BOOST_RTREE) -{ - const double radius = 1.01; - const unsigned numExpectedResults = 8; - runBoxOverlappingEightSurroundingBoxes(stk::search::BOOST_RTREE, radius, numExpectedResults); -} - TEST(Verification, PointOverlappingNoSurroundingBoxes_KDTREE) { const double radius = 0.99; @@ -387,31 +280,16 @@ void runLineOfBoundingBoxes(stk::search::SearchMethod searchMethod, enum Axis ax ASSERT_EQ(numExpectedResults, boxIdPairResults.size()) << "on proc id " << procId; } -TEST(Verification, LineOfSpheres_BOOST_RTREE) -{ - runLineOfBoundingBoxes(stk::search::BOOST_RTREE, xDim); -} - TEST(Verification, LineOfSpheres_KDTREE) { runLineOfBoundingBoxes(stk::search::KDTREE, xDim); } -TEST(Verification, LineOfBoxes_BOOST_RTREE) -{ - runLineOfBoundingBoxes(stk::search::BOOST_RTREE, yDim); -} - TEST(Verification, LineOfBoxes_KDTREE) { runLineOfBoundingBoxes(stk::search::KDTREE, yDim); } -TEST(Verification, LineOfSpheresZDimension_BOOST_RTREE) -{ - runLineOfBoundingBoxes(stk::search::BOOST_RTREE, zDim); -} - TEST(Verification, LineOfSpheresZDimension_KDTREE) { runLineOfBoundingBoxes(stk::search::KDTREE, zDim); diff --git a/packages/stk/stk_search/stk_search/CoarseSearch.hpp b/packages/stk/stk_search/stk_search/CoarseSearch.hpp index bac64051d415..4a27588fec8f 100644 --- a/packages/stk/stk_search/stk_search/CoarseSearch.hpp +++ b/packages/stk/stk_search/stk_search/CoarseSearch.hpp @@ -61,36 +61,6 @@ std::ostream& operator<<(std::ostream &out, SearchMethod method) return out; } -// EXPERIMENTAL -// -// intersections returned will be those resulting from the (local) domain boxes -// intersecting range boxes from the entire distributed set. NEEDS TO BE CALLED -// WITH EXPLICIT TEMPLATE ARGUMENTS. -template -void coarse_search_nonIdentProc( - std::vector > const& domain, - std::vector > const& range, - SearchMethod method, - stk::ParallelMachine comm, - std::vector< std::pair< DomainIdent, RangeIdent> > & intersections - ) -{ - switch( method ) - { - case BOOST_RTREE: -#if defined(STK_HAVE_BOOSTLIB) - coarse_search_boost_rtree_output_locally(domain,range,comm,intersections); -#else - ThrowRequireMsg(false,"ERROR, the BOOST_RTREE option in stk_search requires that Trilinos was configured with TPL_ENABLE_BoostLib:BOOL=ON"); -#endif - break; - default: - std::cerr << "coarse_search(..) interface used does not support std::search::coarse_search_nonIdentProc(..) yet" << method << std::endl; - abort(); - break; - } -} - // THIS MIGHT BE WHAT WE ACTUALLY WANT FOR THE INTERFACE. template void coarse_search( diff --git a/packages/stk/stk_search/testsForDocumentation/boundingBoxSearch3D.cpp b/packages/stk/stk_search/testsForDocumentation/boundingBoxSearch3D.cpp index c8ceb8ac749f..72c59fdc1f0a 100644 --- a/packages/stk/stk_search/testsForDocumentation/boundingBoxSearch3D.cpp +++ b/packages/stk/stk_search/testsForDocumentation/boundingBoxSearch3D.cpp @@ -42,7 +42,7 @@ namespace typedef stk::search::Box Box; typedef stk::search::IdentProc Id; void assertPairInResults(Id a, Id b, const std::vector > &searchResults); -TEST(StkSearchHowTo, useBoostRtreeSearch) +TEST(StkSearchHowTo, useKdtreeSearch) { MPI_Comm comm = MPI_COMM_WORLD; int myProcId = stk::parallel_machine_rank(comm); @@ -54,7 +54,7 @@ TEST(StkSearchHowTo, useBoostRtreeSearch) secondList.push_back(std::make_pair(unitBox, secondId)); std::vector > searchResults; - stk::search::coarse_search(firstList, secondList, stk::search::BOOST_RTREE, comm, searchResults); + stk::search::coarse_search(firstList, secondList, stk::search::KDTREE, comm, searchResults); int numProc = stk::parallel_machine_size(comm); for(int procId = 0; procId < numProc; procId++) @@ -79,7 +79,7 @@ TEST(StkSearchHowTo, useSphereAndPointBoundingVolumes) secondList.push_back(std::make_pair(point, secondId)); std::vector > searchResults; - stk::search::coarse_search(firstList, secondList, stk::search::BOOST_RTREE, comm, searchResults); + stk::search::coarse_search(firstList, secondList, stk::search::KDTREE, comm, searchResults); int numProc = stk::parallel_machine_size(comm); for(int procId = 0; procId < numProc; procId++) diff --git a/packages/stk/stk_search/unit_tests/CMakeLists.txt b/packages/stk/stk_search/unit_tests/CMakeLists.txt index f8bc09c0b78e..a14829084397 100644 --- a/packages/stk/stk_search/unit_tests/CMakeLists.txt +++ b/packages/stk/stk_search/unit_tests/CMakeLists.txt @@ -35,12 +35,6 @@ INCLUDE_DIRECTORIES(${${PARENT_PACKAGE_NAME}_BINARY_DIR}/stk_util/stk_util) FILE(GLOB SOURCES *.cpp) -#removing due to dependence on geometry toolkit which is not available to Trilinos -LIST(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/UnitTestCoarseSearch.cpp") - -IF(NOT TPL_ENABLE_BoostLib) -LIST(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/UnitTestCoarseSearchBoostImpl.cpp") -ENDIF() TRIBITS_ADD_EXECUTABLE( search_unit_tests diff --git a/packages/stk/stk_search/unit_tests/MeshUtilsForBoundingVolumes.hpp b/packages/stk/stk_search/unit_tests/MeshUtilsForBoundingVolumes.hpp index 691f81c585cc..26e7cba44730 100644 --- a/packages/stk/stk_search/unit_tests/MeshUtilsForBoundingVolumes.hpp +++ b/packages/stk/stk_search/unit_tests/MeshUtilsForBoundingVolumes.hpp @@ -424,21 +424,16 @@ inline void do_kdtree_search(std::vector< std::pair >& loc stk::search::coarse_search(local_domain, local_range, stk::search::KDTREE, comm, searchResults); } -enum NewSearchMethod { BOOST_RTREE, KDTREE }; +enum NewSearchMethod { KDTREE }; inline stk::search::SearchMethod mapSearchMethodToStk( NewSearchMethod method ) { - if ( method == BOOST_RTREE ) - { - return stk::search::BOOST_RTREE; - } - if ( method == KDTREE ) { return stk::search::KDTREE; } ThrowRequireMsg(false, __FUNCTION__ << ", Unknown algorithm mysteriously specified"); - return stk::search::BOOST_RTREE; + return stk::search::KDTREE; } template @@ -448,10 +443,6 @@ inline void coarse_search_new(std::vector< std::pair >& lo { do_kdtree_search(local_domain, local_range, comm, searchResults); } - else if ( algorithm == BOOST_RTREE ) - { - stk::search::coarse_search(local_domain, local_range, stk::search::BOOST_RTREE, comm, searchResults); - } else { throw("Invalid search algorithm: not supported.\n"); diff --git a/packages/stk/stk_search/unit_tests/UnitTestCoarseSearch.cpp b/packages/stk/stk_search/unit_tests/UnitTestCoarseSearch.cpp index 22dbdd5f18a0..dade02881671 100644 --- a/packages/stk/stk_search/unit_tests/UnitTestCoarseSearch.cpp +++ b/packages/stk/stk_search/unit_tests/UnitTestCoarseSearch.cpp @@ -131,90 +131,6 @@ void testCoarseSearchForAlgorithm(stk::search::SearchMethod algorithm, MPI_Comm expect_search_results(num_procs, proc_id, searchResults); } - -int IdentForTest(int id, int proc_id) -{ - return id + 1000 * proc_id; -} - -void testCoarseSearchForAlgorithm_IntsForIdents(stk::search::SearchMethod algorithm, MPI_Comm comm) -{ - typedef stk::search::Point Point; - typedef stk::search::Box StkBox; - typedef std::vector< std::pair > BoxVector; - - int num_procs = stk::parallel_machine_size(comm); - int proc_id = stk::parallel_machine_rank(comm); - - BoxVector local_domain, local_range; - // what if identifier is NOT unique - - StkBox box; - int id = 0; - - box = StkBox( Point(proc_id + 0.1, 0.0, 0.0), Point(proc_id + 0.9, 1.0, 1.0)); - id = IdentForTest(proc_id * 4, proc_id); - local_domain.push_back(std::make_pair(box,id)); - - box = StkBox( Point(proc_id + 0.1, 2.0, 0.0), Point(proc_id + 0.9, 3.0, 1.0)); - id = IdentForTest(proc_id * 4+1, proc_id); - local_domain.push_back(std::make_pair(box,id)); - - box = StkBox( Point(proc_id + 0.6, 0.5, 0.0), Point(proc_id + 1.4, 1.5, 1.0)); - id = IdentForTest(proc_id * 4+2, proc_id); - local_range.push_back(std::make_pair(box,id)); - - box = StkBox( Point(proc_id + 0.6, 2.5, 0.0), Point(proc_id + 1.4, 3.5, 1.0)); - id = IdentForTest(proc_id * 4+3, proc_id); - local_range.push_back(std::make_pair(box,id)); - - std::vector > searchResults; - - stk::search::coarse_search_nonIdentProc(local_domain, local_range, algorithm, comm, searchResults); - - if (num_procs == 1) { - ASSERT_EQ( searchResults.size(), 2u); - EXPECT_EQ( searchResults[0].first, IdentForTest(0,0) ); - EXPECT_EQ( searchResults[1].first, IdentForTest(1,0) ); - EXPECT_EQ( searchResults[0].second,IdentForTest(2,0) ); - EXPECT_EQ( searchResults[1].second,IdentForTest(3,0) ); - } - else { - if (proc_id == 0) { - ASSERT_EQ( searchResults.size(), 2u); - EXPECT_EQ( searchResults[0].first, IdentForTest(0,0) ); - EXPECT_EQ( searchResults[1].first, IdentForTest(1,0) ); - EXPECT_EQ( searchResults[0].second, IdentForTest(2,0) ); - EXPECT_EQ( searchResults[1].second, IdentForTest(3,0) ); - } - else if (proc_id == num_procs - 1) { - ASSERT_EQ( searchResults.size(), 4u); - int prev = proc_id -1; - EXPECT_EQ( searchResults[0].first, IdentForTest(proc_id*4,proc_id) ); - EXPECT_EQ( searchResults[1].first, IdentForTest(proc_id*4,proc_id) ); - EXPECT_EQ( searchResults[2].first, IdentForTest(proc_id*4+1,proc_id) ); - EXPECT_EQ( searchResults[3].first, IdentForTest(proc_id*4+1,proc_id) ); - EXPECT_EQ( searchResults[0].second, IdentForTest(prev*4+2,prev) ); - EXPECT_EQ( searchResults[1].second, IdentForTest(proc_id*4+2,proc_id) ); - EXPECT_EQ( searchResults[2].second, IdentForTest(prev*4+3,prev) ); - EXPECT_EQ( searchResults[3].second, IdentForTest(proc_id*4+3,proc_id) ); - - } - else { - ASSERT_EQ( searchResults.size(), 4u); - int prev = proc_id -1; - EXPECT_EQ( searchResults[0].first, IdentForTest(proc_id*4,proc_id) ); - EXPECT_EQ( searchResults[1].first, IdentForTest(proc_id*4,proc_id) ); - EXPECT_EQ( searchResults[2].first, IdentForTest(proc_id*4+1,proc_id) ); - EXPECT_EQ( searchResults[3].first, IdentForTest(proc_id*4+1,proc_id) ); - EXPECT_EQ( searchResults[0].second, IdentForTest(prev*4+2,prev) ); - EXPECT_EQ( searchResults[1].second, IdentForTest(proc_id*4+2,proc_id) ); - EXPECT_EQ( searchResults[2].second, IdentForTest(prev*4+3,prev) ); - EXPECT_EQ( searchResults[3].second, IdentForTest(proc_id*4+3,proc_id) ); - } - } -} - void testCoarseSearchForAlgorithmUsingFloatAABoxes(NewSearchMethod algorithm, MPI_Comm comm) { int num_procs = stk::parallel_machine_size(comm); @@ -249,35 +165,11 @@ void testCoarseSearchForAlgorithmUsingFloatAABoxes(NewSearchMethod algorithm, MP expect_search_results(num_procs, proc_id, searchResults); } -TEST(stk_search, coarse_search_noIdentProc_boost_rtree) -{ - testCoarseSearchForAlgorithm_IntsForIdents(stk::search::BOOST_RTREE, MPI_COMM_WORLD); -} - -// -// rdjamis, Dec 12, 2016: Added this test w/ KDTREE and the unit test failed, -// needs to be addressed. Leaving it off for the time being -// -// TEST(stk_search, coarse_search_noIdentProc_kdtree) -// { -// testCoarseSearchForAlgorithm_IntsForIdents(stk::search::KDTREE, MPI_COMM_WORLD); -// } - -TEST(stk_search, coarse_search_boost_rtree) -{ - testCoarseSearchForAlgorithm(stk::search::BOOST_RTREE, MPI_COMM_WORLD); -} - TEST(stk_search, coarse_search_kdtree) { testCoarseSearchForAlgorithm(stk::search::KDTREE, MPI_COMM_WORLD); } -TEST(stk_search, coarse_search_boost_rtree_using_float_aa_boxes) -{ - testCoarseSearchForAlgorithmUsingFloatAABoxes(BOOST_RTREE, MPI_COMM_WORLD); -} - TEST(stk_search, coarse_search_kdtree_using_float_aa_boxes) { testCoarseSearchForAlgorithmUsingFloatAABoxes(KDTREE, MPI_COMM_WORLD); @@ -339,11 +231,6 @@ void testIdentProcWithSearch(stk::search::SearchMethod searchMethod) } } -TEST(stk_search, coarse_search_boost_ident_proc_switch) -{ - testIdentProcWithSearch(stk::search::BOOST_RTREE); -} - TEST(stk_search, coarse_search_kdtree_ident_proc_switch) { testIdentProcWithSearch(stk::search::KDTREE); @@ -401,11 +288,6 @@ void testCoarseSearchOnePoint(stk::search::SearchMethod searchMethod) } } -TEST(stk_search, coarse_search_one_point_BOOST_RTREE) -{ - testCoarseSearchOnePoint(stk::search::BOOST_RTREE); -} - TEST(stk_search, coarse_search_one_point_KDTREE) { testCoarseSearchOnePoint(stk::search::KDTREE); @@ -460,11 +342,6 @@ void testCoarseSearchForDeterminingSharingAllAllCase(stk::search::SearchMethod s } } -TEST(CoarseSearch, forDeterminingSharingAllAllCase_BOOST_RTREE) -{ - testCoarseSearchForDeterminingSharingAllAllCase(stk::search::BOOST_RTREE); -} - TEST(CoarseSearch, forDeterminingSharingAllAllCase_KDTREE) { testCoarseSearchForDeterminingSharingAllAllCase(stk::search::KDTREE); @@ -568,11 +445,6 @@ void testCoarseSearchForDeterminingSharingLinearAdjacentCase(stk::search::Search } } -TEST(CoarseSearch, forDeterminingSharingLinearAdjacentCase_BOOST_RTREE) -{ - testCoarseSearchForDeterminingSharingLinearAdjacentCase(stk::search::BOOST_RTREE); -} - TEST(CoarseSearch, forDeterminingSharingLinearAdjacentCase_KDTREE) { testCoarseSearchForDeterminingSharingLinearAdjacentCase(stk::search::KDTREE); diff --git a/packages/stk/stk_search/unit_tests/UnitTestCoarseSearchBoostImpl.cpp b/packages/stk/stk_search/unit_tests/UnitTestCoarseSearchBoostImpl.cpp deleted file mode 100644 index d450037b0efb..000000000000 --- a/packages/stk/stk_search/unit_tests/UnitTestCoarseSearchBoostImpl.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2002 - 2008, 2010, 2011 National Technology Engineering -// Solutions of Sandia, LLC (NTESS). Under the terms of Contract -// DE-NA0003525 with NTESS, the U.S. Government retains certain rights -// in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * 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. -// -// * Neither the name of NTESS nor the names of its contributors -// may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "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 THE COPYRIGHT -// OWNER OR 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. -// - -#include -#include - -namespace { - -struct CompareSecond -{ - template - bool operator()( std::pair const& a, std::pair const& b) const - { return a.second < b.second; } -}; - -TEST(stk_search, boost_global_spatial_index) -{ - int parallel_size = stk::parallel_machine_size(MPI_COMM_WORLD); - if (parallel_size == 1) return; - - namespace bg = boost::geometry; - namespace bgi = boost::geometry::index; - - typedef bg::model::point Point; - typedef bg::model::box Box; - typedef std::pair BoxProc; - const unsigned MaxVolumesPerNode = 16; - typedef bgi::rtree< BoxProc, bgi::quadratic > Rtree; - - int size = parallel_size; - int rank = stk::parallel_machine_rank(MPI_COMM_WORLD); - - Point min_corner(rank - 0.2, 0, 0); - Point max_corner(rank + 1.2, 1, 1); - Box box(min_corner, max_corner); - - Rtree tree; - stk::search::create_global_spatial_index(tree, box, MPI_COMM_WORLD); - - EXPECT_EQ(tree.size(), size_t(size)); - - Box global_bounds = tree.bounds(); - EXPECT_EQ(bg::distance(global_bounds.min_corner(), Point(-0.2,0,0)), 0.0); - EXPECT_EQ(bg::distance(global_bounds.max_corner(), Point(size + 0.2, 1, 1)), 0.0); - - std::vector intersections; - bgi::query(tree, bgi::intersects(box), std::back_inserter(intersections)); - - std::sort(intersections.begin(), intersections.end(), CompareSecond()); - - if (rank > 0 && rank < size-1) { - EXPECT_EQ(intersections.size(), 3u); - EXPECT_EQ(intersections[0].second, rank-1); - EXPECT_EQ(intersections[1].second, rank); - EXPECT_EQ(intersections[2].second, rank+1); - } - else if (size > 1) { - EXPECT_EQ(intersections.size(), 2u); - if (rank == 0) { - EXPECT_EQ(intersections[0].second, rank); - EXPECT_EQ(intersections[1].second, rank+1); - } - else { - EXPECT_EQ(intersections[0].second, rank-1); - EXPECT_EQ(intersections[1].second, rank); - } - } -} - -TEST(stk_search, boost_bounding_box) -{ - namespace bg = boost::geometry; - namespace bgi = boost::geometry::index; - - typedef bg::model::point Point; - typedef bg::model::box Box; - typedef std::pair BoxProc; - - Point min_corner(-1,-2,-3); - Point max_corner(1,2,3); - Box box(min_corner, max_corner); - - double coords[6] = {}; - stk::search::impl::fill_array(box, coords); - - EXPECT_EQ(coords[0], -1.0); - EXPECT_EQ(coords[1], -2.0); - EXPECT_EQ(coords[2], -3.0); - EXPECT_EQ(coords[3], 1.0); - EXPECT_EQ(coords[4], 2.0); - EXPECT_EQ(coords[5], 3.0); - - Box temp; - stk::search::impl::set_box(temp, coords); - - EXPECT_EQ(bg::distance(temp.min_corner(), min_corner), 0.0); - EXPECT_EQ(bg::distance(temp.max_corner(), max_corner), 0.0); -} - -} // namespace diff --git a/packages/stk/stk_search_util/stk_search_util/PeriodicBoundarySearch.hpp b/packages/stk/stk_search_util/stk_search_util/PeriodicBoundarySearch.hpp index 4bbcbb7a0dc0..8301058c1e7b 100644 --- a/packages/stk/stk_search_util/stk_search_util/PeriodicBoundarySearch.hpp +++ b/packages/stk/stk_search_util/stk_search_util/PeriodicBoundarySearch.hpp @@ -162,17 +162,17 @@ class PeriodicBoundarySearch // Default is identity transform. } -#if defined(STK_HAVE_BOOST) - TransformHelper(const boost::array & trans_arg) - : m_transform_type(TRANSLATION) - , m_translation(3,0) - { - m_translation[0] = trans_arg[0]; - m_translation[1] = trans_arg[1]; - m_translation[2] = trans_arg[2]; - } -#endif - +//#if defined(STK_HAVE_BOOST) +// TransformHelper(const boost::array & trans_arg) +// : m_transform_type(TRANSLATION) +// , m_translation(3,0) +// { +// m_translation[0] = trans_arg[0]; +// m_translation[1] = trans_arg[1]; +// m_translation[2] = trans_arg[2]; +// } +//#endif +// TransformHelper(double angle, const double axis[3]) : m_transform_type(ROTATIONAL) , m_translation(3,0) @@ -522,7 +522,7 @@ class PeriodicBoundarySearch break; } - stk::search::coarse_search(side_1_vector, side_2_vector, stk::search::BOOST_RTREE, parallel, search_results); + stk::search::coarse_search(side_1_vector, side_2_vector, stk::search::KDTREE, parallel, search_results); m_search_results.insert(m_search_results.end(), search_results.begin(), search_results.end()); } diff --git a/packages/stk/stk_transfer/Jamfile b/packages/stk/stk_transfer/Jamfile index ebf91b4c8479..f4809b63e47b 100644 --- a/packages/stk/stk_transfer/Jamfile +++ b/packages/stk/stk_transfer/Jamfile @@ -8,7 +8,7 @@ #-------------------------------------------------------------------- # -# http://www.boost.org/doc/libs/1_47_0/doc/html/bbv2/overview.html#bbv2.overview.targets +# http://www.b-oost.org/doc/libs/1_47_0/doc/html/bbv2/overview.html#bbv2.overview.targets # #function-name main-target-name # : sources @@ -135,7 +135,7 @@ local xml-files = ; # This is currently a header-only library, so it must not use the lib rule. -# http://www.boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html +# http://www.b-oost.org/b-oost-build2/doc/html/bbv2/faq/header-only-libraries.html # If sources are added to this library change this target to use the lib rule instead. alias stk_transfer : # No sources defined for header-only libraries. diff --git a/packages/stk/stk_transfer/stk_transfer/GeometricTransfer.hpp b/packages/stk/stk_transfer/stk_transfer/GeometricTransfer.hpp index 51c9e83c181f..35e3f5801341 100644 --- a/packages/stk/stk_transfer/stk_transfer/GeometricTransfer.hpp +++ b/packages/stk/stk_transfer/stk_transfer/GeometricTransfer.hpp @@ -99,7 +99,7 @@ public : boost::shared_ptr &meshb, const std::string &name, const double expansion_factor = 1.5, - const stk::search::SearchMethod search_method = stk::search::BOOST_RTREE) + const stk::search::SearchMethod search_method = stk::search::KDTREE) : m_mesha(to_be_deprecated::make_shared_ptr(mesha)), m_meshb(to_be_deprecated::make_shared_ptr(meshb)), m_name (name), @@ -115,7 +115,7 @@ public : const std::string &name, stk::ParallelMachine pm, const double expansion_factor = 1.5, - const stk::search::SearchMethod search_method = stk::search::BOOST_RTREE) + const stk::search::SearchMethod search_method = stk::search::KDTREE) : m_mesha(mesha), m_meshb(meshb), m_name (name), @@ -130,7 +130,7 @@ public : std::shared_ptr &meshb, const std::string &name, const double expansion_factor = 1.5, - const stk::search::SearchMethod search_method = stk::search::BOOST_RTREE) + const stk::search::SearchMethod search_method = stk::search::KDTREE) : m_mesha(mesha), m_meshb(meshb), m_name (name), diff --git a/packages/stk/stk_transfer/stk_transfer/ReducedDependencyGeometricTransfer.hpp b/packages/stk/stk_transfer/stk_transfer/ReducedDependencyGeometricTransfer.hpp index 7f214bb6d6d0..0ce0cf8826bf 100644 --- a/packages/stk/stk_transfer/stk_transfer/ReducedDependencyGeometricTransfer.hpp +++ b/packages/stk/stk_transfer/stk_transfer/ReducedDependencyGeometricTransfer.hpp @@ -102,7 +102,7 @@ public : const std::string &name, stk::ParallelMachine pm, const double expansion_factor = 1.5, - const stk::search::SearchMethod search_method = stk::search::BOOST_RTREE); + const stk::search::SearchMethod search_method = stk::search::KDTREE); virtual ~ReducedDependencyGeometricTransfer(){}; void coarse_search() override; void communication() override; diff --git a/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp b/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp index ee523aeac257..fcd366c714d2 100644 --- a/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp +++ b/packages/stk/stk_unit_test_utils/stk_unit_test_utils/BulkDataTester.hpp @@ -246,7 +246,8 @@ class BulkDataTester : public stk::mesh::BulkData void my_internal_resolve_ghosted_modify_delete() { - this->internal_resolve_ghosted_modify_delete(); + stk::mesh::EntityVector entitiesNoLongerShared; + this->internal_resolve_ghosted_modify_delete(entitiesNoLongerShared); } void my_internal_resolve_parallel_create() diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEO.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEO.cpp index 5e855ad22298..b8d32a918354 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEO.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEO.cpp @@ -36,6 +36,9 @@ #include // for basic_ostream::operator<< #include // for BulkData, etc #include +#include +#include +#include #include // for parallel_machine_rank, etc #include // for string #include @@ -303,4 +306,56 @@ TEST(CEO, change_entity_owner_3Elem3Proc_WithCustomGhosts_WithoutAura) test_change_entity_owner_3Elem3Proc_WithCustomGhosts(stk::mesh::BulkData::NO_AUTO_AURA); } +TEST(CEO,moveElem_fieldDataOfNodes) +{ + stk::ParallelMachine comm{MPI_COMM_WORLD}; + if(stk::parallel_machine_size(comm) == 2) + { + stk::mesh::MetaData meta; + stk::mesh::BulkData bulk(meta, comm); + auto &field1 = meta.declare_field>(stk::topology::NODE_RANK, "field1"); + stk::mesh::put_field_on_entire_mesh(field1); + stk::io::fill_mesh("generated:1x1x2", bulk); + + stk::mesh::EntityVector sharedNodes; + stk::mesh::get_selected_entities(meta.globally_shared_part(), bulk.buckets(stk::topology::NODE_RANK), sharedNodes); + for(stk::mesh::Entity node : sharedNodes) + { + int *data = stk::mesh::field_data(field1, node); + *data = stk::parallel_machine_rank(comm); + } + + stk::mesh::EntityProcVec thingsToChange; + if(stk::parallel_machine_rank(comm) == 1) + { + stk::mesh::EntityVector ownedElems; + stk::mesh::get_selected_entities(meta.locally_owned_part(), bulk.buckets(stk::topology::ELEM_RANK), ownedElems); + + ASSERT_EQ(1u, ownedElems.size()); + stk::mesh::Entity elem{ownedElems[0]}; + thingsToChange.push_back(stk::mesh::EntityProc(elem, 0)); + } + + if(stk::parallel_machine_rank(comm) == 0) + { + for(stk::mesh::Entity node : sharedNodes) + { + int *data = stk::mesh::field_data(field1, node); + EXPECT_EQ(0, *data); + } + } + + bulk.change_entity_owner(thingsToChange); + + if(stk::parallel_machine_rank(comm) == 0) + { + for(stk::mesh::Entity node : sharedNodes) + { + int *data = stk::mesh::field_data(field1, node); + EXPECT_EQ(0, *data); + } + } + } +} + } diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOME.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOME.cpp index 0b3eb18043cf..2c4c9903c386 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOME.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestCEOME.cpp @@ -468,6 +468,9 @@ TEST(CEOME, change_entity_owner_4Elem4ProcEdge) { // Change ownership of changing elem and all entities in it's closure that // we own to proc 0. + // Inspecting the ascii-art in the above mesh setup function reveals that + // P2 doesn't own nodes 5 and 6, so the field-data for those won't be sent + // to P0. Entity changing_elem = mesh.get_entity(elem_key_chg_own); ASSERT_TRUE( mesh.is_valid(changing_elem)); @@ -504,9 +507,11 @@ TEST(CEOME, change_entity_owner_4Elem4ProcEdge) Entity node6 = mesh.get_entity(stk::topology::NODE_RANK,6); stk::mesh::FieldBase* elem_field = meta_data.get_field(stk::topology::NODE_RANK, "elem_field"); double * elem_field_data_node5 = static_cast(stk::mesh::field_data(*elem_field,node5)); - EXPECT_EQ( 5.0, *elem_field_data_node5 ); + const double expectedNode5Data = 5.0; + EXPECT_EQ( expectedNode5Data, *elem_field_data_node5 ); double * elem_field_data_node6 = static_cast(stk::mesh::field_data(*elem_field,node6)); - EXPECT_EQ( 6.0, *elem_field_data_node6 ); + const double expectedNode6Data = 6.0; + EXPECT_EQ( expectedNode6Data, *elem_field_data_node6 ); } //////////////////////////////////////////////////////////////////////////// @@ -522,9 +527,11 @@ TEST(CEOME, change_entity_owner_4Elem4ProcEdge) Entity node6 = mesh.get_entity(stk::topology::NODE_RANK,6); stk::mesh::FieldBase* elem_field = meta_data.get_field(stk::topology::NODE_RANK, "elem_field"); double * elem_field_data_node5 = static_cast(stk::mesh::field_data(*elem_field,node5)); - EXPECT_EQ( 5.0, *elem_field_data_node5 ); + const double expectedNode5Data = 5.0; + EXPECT_EQ( expectedNode5Data, *elem_field_data_node5 ); double * elem_field_data_node6 = static_cast(stk::mesh::field_data(*elem_field,node6)); - EXPECT_EQ( 6.0, *elem_field_data_node6 ); + const double expectedNode6Data = 6.0; + EXPECT_EQ( expectedNode6Data, *elem_field_data_node6 ); } } diff --git a/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp b/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp index 5fe32e7f940f..6b941131bb1f 100644 --- a/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp +++ b/packages/stk/stk_unit_tests/stk_mesh/UnitTestGhostingWithShared.cpp @@ -376,3 +376,96 @@ TEST(UnitTestGhosting, basic1Elem) bulk.modification_end(); } +void create_mesh_with_1_tri_per_proc(stk::mesh::BulkData& bulk) +{ + std::vector nodeIds[] = { {1, 3, 2}, {2, 3, 4} }; + stk::mesh::EntityId elemIds[] = {1, 2}; + + stk::mesh::Part& tri2dPart = bulk.mesh_meta_data().get_topology_root_part(stk::topology::TRI_3_2D); + stk::mesh::PartVector elemParts = {&tri2dPart}; + const int myProc = bulk.parallel_rank(); + const int otherProc = 1 - myProc; + + bulk.modification_begin(); + stk::mesh::declare_element(bulk, elemParts, elemIds[myProc], nodeIds[myProc]); + bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK, 2), otherProc); + bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK, 3), otherProc); + bulk.modification_end(); +} + +void delete_node_2_and_connect_node_5_to_elem_1(stk::mesh::BulkData& bulk) +{ + bulk.modification_begin(); + if (bulk.parallel_rank() == 0) { + stk::mesh::Entity node5 = bulk.declare_node(5); + stk::mesh::Entity node2 = bulk.get_entity(stk::topology::NODE_RANK, 2); + stk::mesh::Entity elem1 = bulk.get_entity(stk::topology::ELEM_RANK, 1); + stk::mesh::Entity elem2 = bulk.get_entity(stk::topology::ELEM_RANK, 2); + + bulk.destroy_relation(elem1, node2, 2); + bulk.destroy_relation(elem2, node2, 0); + bulk.destroy_entity(elem2); + bulk.destroy_entity(node2); + bulk.declare_relation(elem1, node5, 2); + } + bulk.modification_end(); +} + +TEST(UnitTestGhosting, sharedBecomesAuraGhost) +{ + if (stk::parallel_machine_size(MPI_COMM_WORLD) != 2) return; + + const unsigned spatialDim = 2; + stk::mesh::MetaData meta(spatialDim); + stk::mesh::BulkData bulk(meta, MPI_COMM_WORLD, stk::mesh::BulkData::AUTO_AURA); + +/*Create this mesh: + + P0 P1 + 2* *2 + /| |\ + / | | \ + 1* | | *4 + \ | | / + \| |/ + 3* *3 + + nodes 2 and 3 are shared, aura ghosts node 1 to P1 and node 4 to P0 +*/ + + create_mesh_with_1_tri_per_proc(bulk); + + stk::mesh::EntityVector sharedNodes; + stk::mesh::get_selected_entities(meta.globally_shared_part(), + bulk.buckets(stk::topology::NODE_RANK), sharedNodes); + EXPECT_EQ(2u, sharedNodes.size()); + + stk::mesh::Selector ghosts = !(meta.locally_owned_part() | meta.globally_shared_part()); + stk::mesh::EntityVector ghostNodes; + stk::mesh::get_selected_entities(ghosts, bulk.buckets(stk::topology::NODE_RANK), ghostNodes); + EXPECT_EQ(1u, ghostNodes.size()); + +/*Now change the mesh to be this: + + P0 P1 + 5* *2 + /| |\ + / | | \ + 1* | | *4 + \ | | / + \| |/ + 3* *3 + i.e., on P0: disconnect node 2 from elem 1 and elem 2, destroy node 2 + node 3 still shared, aura ghosts nodes 1 and 5 to P1 and nodes 2 and 4 to P0 +*/ + + delete_node_2_and_connect_node_5_to_elem_1(bulk); + + stk::mesh::get_selected_entities(meta.globally_shared_part(), + bulk.buckets(stk::topology::NODE_RANK), sharedNodes); + EXPECT_EQ(1u, sharedNodes.size()); + + stk::mesh::get_selected_entities(ghosts, bulk.buckets(stk::topology::NODE_RANK), ghostNodes); + EXPECT_EQ(2u, ghostNodes.size()); +} + diff --git a/packages/stk/stk_unit_tests/stk_transfer/UnitTestGeometricTransfer.cpp b/packages/stk/stk_unit_tests/stk_transfer/UnitTestGeometricTransfer.cpp index ebe5641b1b4e..b50eff3c4f9e 100644 --- a/packages/stk/stk_unit_tests/stk_transfer/UnitTestGeometricTransfer.cpp +++ b/packages/stk/stk_unit_tests/stk_transfer/UnitTestGeometricTransfer.cpp @@ -670,12 +670,10 @@ TEST_P(ReducedDependencyGeometricTransferTest, ThreeElemToTwoPointLocalPointIds) //Note, these test segfault with the stk::search::SearchMethod::MORTON_LINEARIZED_BVH //I'm not sure who uses that search method or it is supposed to be production ready INSTANTIATE_TEST_CASE_P(GeometricTransferTest, GeometricTransferTest, - ::testing::Values(stk::search::SearchMethod::BOOST_RTREE, - stk::search::SearchMethod::KDTREE),); + ::testing::Values(stk::search::SearchMethod::KDTREE),); INSTANTIATE_TEST_CASE_P(ReducedDependencyGeometricTransferTest, ReducedDependencyGeometricTransferTest, - ::testing::Values(stk::search::SearchMethod::BOOST_RTREE, - stk::search::SearchMethod::KDTREE),); + ::testing::Values(stk::search::SearchMethod::KDTREE),); } } diff --git a/packages/stk/stk_util/cmake/STK_Trilinos_config.h.in b/packages/stk/stk_util/cmake/STK_Trilinos_config.h.in index ae872d4d86c0..bb48e36e7902 100644 --- a/packages/stk/stk_util/cmake/STK_Trilinos_config.h.in +++ b/packages/stk/stk_util/cmake/STK_Trilinos_config.h.in @@ -36,6 +36,8 @@ #cmakedefine STK_SHOW_DEPRECATED_WARNINGS +#cmakedefine STK_DISABLE_MPI_NEIGHBOR_COMM + #cmakedefine STK_HAVE_BOOST #cmakedefine STK_HAVE_BOOSTLIB diff --git a/packages/stk/stk_util/stk_util/CMakeLists.txt b/packages/stk/stk_util/stk_util/CMakeLists.txt index 5ab8f8da2e0c..6c40c3eb2f2e 100644 --- a/packages/stk/stk_util/stk_util/CMakeLists.txt +++ b/packages/stk/stk_util/stk_util/CMakeLists.txt @@ -1,6 +1,10 @@ ADD_SUBDIRECTORY(util) +IF ( ${PACKAGE_NAME}_DISABLE_MPI_NEIGHBOR_COMM ) + SET(STK_DISABLE_MPI_NEIGHBOR_COMM TRUE) +ENDIF() + IF(TPL_ENABLE_MPI) ADD_SUBDIRECTORY(parallel) diff --git a/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp b/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp index 2d8213012493..1a58d158b4d3 100644 --- a/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp +++ b/packages/stk/stk_util/stk_util/parallel/CommNeighbors.hpp @@ -74,6 +74,10 @@ #undef STK_MPI_SUPPORTS_NEIGHBOR_COMM #endif +#ifdef STK_DISABLE_MPI_NEIGHBOR_COMM +#undef STK_MPI_SUPPORTS_NEIGHBOR_COMM +#endif + #endif //------------------------------------------------------------------------