diff --git a/cmake/std/atdm/CMakeLists.txt b/cmake/std/atdm/CMakeLists.txt index fb13f84118bb..836684aec829 100644 --- a/cmake/std/atdm/CMakeLists.txt +++ b/cmake/std/atdm/CMakeLists.txt @@ -5,4 +5,5 @@ TRIBITS_ADD_TEST_DIRECTORIES(van1-tx2) TRIBITS_ADD_TEST_DIRECTORIES(ats1) TRIBITS_ADD_TEST_DIRECTORIES(ats2) TRIBITS_ADD_TEST_DIRECTORIES(cts1) +TRIBITS_ADD_TEST_DIRECTORIES(cts1empire) TRIBITS_PACKAGE_POSTPROCESS() diff --git a/cmake/std/atdm/cts1empire/CMakeLists.txt b/cmake/std/atdm/cts1empire/CMakeLists.txt new file mode 100644 index 000000000000..50539c5ad7a9 --- /dev/null +++ b/cmake/std/atdm/cts1empire/CMakeLists.txt @@ -0,0 +1,11 @@ +TRIBITS_ADD_ADVANCED_TEST( cts1empire_custom_builds_unit_tests + OVERALL_WORKING_DIRECTORY TEST_NAME + OVERALL_NUM_MPI_PROCS 1 + TEST_0 CMND env + ARGS SHUNIT_COLOR=none ${CMAKE_CURRENT_SOURCE_DIR}/custom_builds_unit_tests.sh + PASS_REGULAR_EXPRESSION_ALL + "ERROR: A supported compiler was not selected for 'cts1empire' env - anything-intell" + "Ran 1 test" + "[^]OK[$]" + ALWAYS_FAIL_ON_NONZERO_RETURN + ) diff --git a/cmake/std/atdm/cts1empire/custom_builds.sh b/cmake/std/atdm/cts1empire/custom_builds.sh index 78de4dc8f1d4..a6a851fa5249 100644 --- a/cmake/std/atdm/cts1empire/custom_builds.sh +++ b/cmake/std/atdm/cts1empire/custom_builds.sh @@ -7,17 +7,18 @@ # Custom compiler selection logic -if [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18.0.2-openmpi-4.0.1"* ]] \ - || [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18.0.2_openmpi-4.0.1"* ]] \ - || [[ $ATDM_CONFIG_BUILD_NAME == *"intel-18.0.2"* ]] \ - || [[ $ATDM_CONFIG_BUILD_NAME == *"intel" ]] \ - || [[ $ATDM_CONFIG_BUILD_NAME == *"default" ]] \ +if atdm_match_any_buildname_keyword \ + intel-18.0.2-openmpi-4.0.1 \ + intel-18.0.2_openmpi-4.0.1 \ + intel-18.0.2 \ + intel \ + default \ ; then export ATDM_CONFIG_COMPILER=INTEL-18.0.2_OPENMPI-4.0.1 else echo echo "***" - echo "*** ERROR: A supported compiler was not selected for 'cts1empire' env" + echo "*** ERROR: A supported compiler was not selected for 'cts1empire' env - $ATDM_CONFIG_BUILD_NAME" echo "***" echo "*** Supported compilers include:" echo "***" diff --git a/cmake/std/atdm/cts1empire/custom_builds_unit_tests.sh b/cmake/std/atdm/cts1empire/custom_builds_unit_tests.sh new file mode 100755 index 000000000000..70912a119902 --- /dev/null +++ b/cmake/std/atdm/cts1empire/custom_builds_unit_tests.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +if [[ "$(uname)" == "Darwin" ]]; then + ATDM_CONFIG_SCRIPT_DIR=".." + source "${ATDM_CONFIG_SCRIPT_DIR}/utils/define_atdm_match_keyword.sh" + SHUNIT2_DIR="${ATDM_CONFIG_SCRIPT_DIR}/../../../commonTools/test/shunit2" +else + CURRENT_SCRIPTS_DIR=`echo $BASH_SOURCE | sed "s/\(.*\)\/.*\.sh/\1/g"` + ATDM_CONFIG_SCRIPT_DIR=`readlink -f ${CURRENT_SCRIPTS_DIR}/..` + SHUNIT2_DIR=`readlink -f ${ATDM_CONFIG_SCRIPT_DIR}/../../../commonTools/test/shunit2` +fi + +# +# Test compiler parsing +# + +testAll() { + + ATDM_CONFIG_SYSTEM_DIR=${ATDM_CONFIG_SCRIPT_DIR}/cts1empire + + ATDM_CONFIG_BUILD_NAME=before-intel-18.0.2-openmpi-4.0.1_after + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} INTEL-18.0.2_OPENMPI-4.0.1 ${ATDM_CONFIG_COMPILER} + + ATDM_CONFIG_BUILD_NAME=before-intel-18.0.2_openmpi-4.0.1-after + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} INTEL-18.0.2_OPENMPI-4.0.1 ${ATDM_CONFIG_COMPILER} + + ATDM_CONFIG_BUILD_NAME=before_intel-18.0.2-after + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} INTEL-18.0.2_OPENMPI-4.0.1 ${ATDM_CONFIG_COMPILER} + + ATDM_CONFIG_BUILD_NAME=default + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} INTEL-18.0.2_OPENMPI-4.0.1 ${ATDM_CONFIG_COMPILER} + + ATDM_CONFIG_BUILD_NAME=before-intel-after + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} INTEL-18.0.2_OPENMPI-4.0.1 ${ATDM_CONFIG_COMPILER} + + ATDM_CONFIG_BUILD_NAME=BEFORE-INTEL-AFTER + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} INTEL-18.0.2_OPENMPI-4.0.1 ${ATDM_CONFIG_COMPILER} + + ATDM_CONFIG_BUILD_NAME=anything-intell + . ${ATDM_CONFIG_SCRIPT_DIR}/utils/set_build_options.sh + ${_ASSERT_EQUALS_} DEFAULT ${ATDM_CONFIG_COMPILER} + +} + + +# +# Run the unit tests +# +. ${SHUNIT2_DIR}/shunit2 diff --git a/packages/galeri/src-xpetra/Galeri_Elasticity2DProblem.hpp b/packages/galeri/src-xpetra/Galeri_Elasticity2DProblem.hpp index 538f98ee810e..5a5dbe8aebad 100644 --- a/packages/galeri/src-xpetra/Galeri_Elasticity2DProblem.hpp +++ b/packages/galeri/src-xpetra/Galeri_Elasticity2DProblem.hpp @@ -176,6 +176,7 @@ namespace Galeri { R(0,0) = R(1,3) = R(2,1) = R(2,2) = 1; this->A_ = MatrixTraits::Build(this->Map_, 8*numNodesPerElem); + this->A_->setObjectLabel(this->getObjectLabel()); SC one = TST::one(), zero = TST::zero(); SerialDenseMatrix prevKE(numDofPerElem, numDofPerElem), prevElementNodes(numNodesPerElem, Teuchos::as(nDim_)); // cache diff --git a/packages/galeri/src-xpetra/Galeri_Elasticity3DProblem.hpp b/packages/galeri/src-xpetra/Galeri_Elasticity3DProblem.hpp index d033e45d5f60..d4baf327e66f 100644 --- a/packages/galeri/src-xpetra/Galeri_Elasticity3DProblem.hpp +++ b/packages/galeri/src-xpetra/Galeri_Elasticity3DProblem.hpp @@ -187,6 +187,7 @@ namespace Galeri { R(0,0) = R(1,4) = R(2,8) = R(3,1) = R(3,3) = R(4,5) = R(4,7) = R(5,2) = R(5,6) = 1; this->A_ = MatrixTraits::Build(this->Map_, numNodesPerElem * 8 * numDofPerElem); + this->A_->setObjectLabel(this->getObjectLabel()); SC one = Teuchos::ScalarTraits::one(), zero = Teuchos::ScalarTraits::zero(); SerialDenseMatrix prevKE(numDofPerElem, numDofPerElem), prevElementNodes(numNodesPerElem, nDim_); // cache diff --git a/packages/tempus/src/Tempus_StepperBackwardEulerAppAction.hpp b/packages/tempus/src/Tempus_StepperBackwardEulerAppAction.hpp index 59e3e807d053..11d6f8fce0be 100644 --- a/packages/tempus/src/Tempus_StepperBackwardEulerAppAction.hpp +++ b/packages/tempus/src/Tempus_StepperBackwardEulerAppAction.hpp @@ -11,7 +11,6 @@ #include "Tempus_config.hpp" #include "Tempus_SolutionHistory.hpp" -#include "Tempus_StepperBackwardEuler.hpp" namespace Tempus { diff --git a/packages/tempus/src/Tempus_StepperBackwardEulerModifierDefault.hpp b/packages/tempus/src/Tempus_StepperBackwardEulerModifierDefault.hpp index 8a923ba13090..2d596fdc2e14 100644 --- a/packages/tempus/src/Tempus_StepperBackwardEulerModifierDefault.hpp +++ b/packages/tempus/src/Tempus_StepperBackwardEulerModifierDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperBackwardEulerModifierDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperBackwardEulerModifierBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperBackwardEuler.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default modifier provides no-op functionality for the modifier. * See StepperBackwardEulerModifierBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperBackwardEulerModifierDefault diff --git a/packages/tempus/src/Tempus_StepperBackwardEulerModifierXDefault.hpp b/packages/tempus/src/Tempus_StepperBackwardEulerModifierXDefault.hpp index 00584a4e40bc..55a8cbf7d3b5 100644 --- a/packages/tempus/src/Tempus_StepperBackwardEulerModifierXDefault.hpp +++ b/packages/tempus/src/Tempus_StepperBackwardEulerModifierXDefault.hpp @@ -10,7 +10,6 @@ #define Tempus_StepperBackwardEulerModifierX_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperBackwardEulerModifierXBase.hpp" @@ -20,6 +19,9 @@ namespace Tempus { * * The default provides no-op functionality for ModifierX. * See StepperBackwardEulerModifierXBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperBackwardEulerModifierXDefault diff --git a/packages/tempus/src/Tempus_StepperBackwardEulerObserverDefault.hpp b/packages/tempus/src/Tempus_StepperBackwardEulerObserverDefault.hpp index 93bc7fc484f3..97cc75f9f8d6 100644 --- a/packages/tempus/src/Tempus_StepperBackwardEulerObserverDefault.hpp +++ b/packages/tempus/src/Tempus_StepperBackwardEulerObserverDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperBackwardEulerObserverDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperBackwardEulerObserverBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperBackwardEuler.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default observer provides no-op functionality for the observer. * See StepperBackwardEulerObserverBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperBackwardEulerObserverDefault diff --git a/packages/tempus/src/Tempus_StepperForwardEulerAppAction.hpp b/packages/tempus/src/Tempus_StepperForwardEulerAppAction.hpp index 4d7d2b2e57db..6ff7fa2ef8ea 100644 --- a/packages/tempus/src/Tempus_StepperForwardEulerAppAction.hpp +++ b/packages/tempus/src/Tempus_StepperForwardEulerAppAction.hpp @@ -11,7 +11,6 @@ #include "Tempus_config.hpp" #include "Tempus_SolutionHistory.hpp" -#include "Tempus_StepperForwardEuler.hpp" namespace Tempus { diff --git a/packages/tempus/src/Tempus_StepperForwardEulerModifierDefault.hpp b/packages/tempus/src/Tempus_StepperForwardEulerModifierDefault.hpp index 0d63ec0b017f..6ef8f226b21d 100644 --- a/packages/tempus/src/Tempus_StepperForwardEulerModifierDefault.hpp +++ b/packages/tempus/src/Tempus_StepperForwardEulerModifierDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperForwardEulerModifierDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperForwardEulerModifierBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperForwardEuler.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default modifier provides no-op functionality for the modifier. * See StepperForwardEulerModifierBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperForwardEulerModifierDefault diff --git a/packages/tempus/src/Tempus_StepperForwardEulerModifierXDefault.hpp b/packages/tempus/src/Tempus_StepperForwardEulerModifierXDefault.hpp index 20d14ddd42d5..0474652a6c78 100644 --- a/packages/tempus/src/Tempus_StepperForwardEulerModifierXDefault.hpp +++ b/packages/tempus/src/Tempus_StepperForwardEulerModifierXDefault.hpp @@ -10,7 +10,6 @@ #define Tempus_StepperForwardEulerModifierX_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperForwardEulerModifierXBase.hpp" @@ -20,6 +19,9 @@ namespace Tempus { * * The default provides no-op functionality for ModifierX. * See StepperForwardEulerModifierXBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperForwardEulerModifierXDefault diff --git a/packages/tempus/src/Tempus_StepperForwardEulerObserverDefault.hpp b/packages/tempus/src/Tempus_StepperForwardEulerObserverDefault.hpp index 952ab253837e..3a3fa7aae61f 100644 --- a/packages/tempus/src/Tempus_StepperForwardEulerObserverDefault.hpp +++ b/packages/tempus/src/Tempus_StepperForwardEulerObserverDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperForwardEulerObserverDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperForwardEulerObserverBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperForwardEuler.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default observer provides no-op functionality for the observer. * See StepperForwardEulerObserverBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperForwardEulerObserverDefault diff --git a/packages/tempus/src/Tempus_StepperOperatorSplitAppAction.hpp b/packages/tempus/src/Tempus_StepperOperatorSplitAppAction.hpp index 3f8b8be0ca3a..302c64b884ec 100644 --- a/packages/tempus/src/Tempus_StepperOperatorSplitAppAction.hpp +++ b/packages/tempus/src/Tempus_StepperOperatorSplitAppAction.hpp @@ -11,7 +11,7 @@ #include "Tempus_config.hpp" #include "Tempus_SolutionHistory.hpp" -#include "Tempus_StepperOperatorSplit.hpp" + namespace Tempus { @@ -22,15 +22,15 @@ template class StepperOperatorSplit; * * This is a means for application developers to perform tasks * during the time steps, e.g., - * - Compute specific quantities - * - Output information + * - Compute specific quantities + * - Output information * - "Massage" the working solution state * - ... * * Design Considerations * - StepperOperatorSplitAppAction is not stateless! Developers may touch the * solution state! Developers need to be careful not to break the - * restart (checkpoint) capability. + * restart (checkpoint) capability. */ template class StepperOperatorSplitAppAction @@ -38,10 +38,10 @@ class StepperOperatorSplitAppAction public: enum ACTION_LOCATION { - BEGIN_STEP, ///< At the beginning of the step. - BEFORE_STEPPER, ///< Before a stepper evaluation. - AFTER_STEPPER, ///< After a stepper evaluation. - END_STEP ///< At the end of the step. + BEGIN_STEP, ///< At the beginning of the step. + BEFORE_STEPPER, ///< Before a stepper evaluation. + AFTER_STEPPER, ///< After a stepper evaluation. + END_STEP ///< At the end of the step. }; /// Constructor @@ -50,7 +50,7 @@ class StepperOperatorSplitAppAction /// Destructor virtual ~StepperOperatorSplitAppAction(){} - /// Execute application action for OperatorSplit Stepper. + /// Execute application action for OperatorSplit Stepper. virtual void execute( Teuchos::RCP > sh, Teuchos::RCP > stepper, diff --git a/packages/tempus/src/Tempus_StepperOperatorSplitModifierBase.hpp b/packages/tempus/src/Tempus_StepperOperatorSplitModifierBase.hpp index 5f62f66ed2f8..eebe45631d6d 100644 --- a/packages/tempus/src/Tempus_StepperOperatorSplitModifierBase.hpp +++ b/packages/tempus/src/Tempus_StepperOperatorSplitModifierBase.hpp @@ -15,33 +15,33 @@ namespace Tempus { - /** \brief Base modifier for OperatorSplit. - * - * This class provides a means to modify values (e.g., solution variables - * through SolutionHistory, and stepper member data through the Stepper), - * and can be very powerful and easy to make changes to the stepper and - * the solution. - * - * Users deriving from this class can access a lot of data, and it is - * expected that those users know what changes are allowable without - * affecting the Stepper correctness, performance, accuracy and stability. - * Thus the user should be careful when accessing data through classes - * derived from the default modifier (i.e., USER BEWARE!!). - * + /** \brief Base modifier for OperatorSplit. + * + * This class provides a means to modify values (e.g., solution variables + * through SolutionHistory, and stepper member data through the Stepper), + * and can be very powerful and easy to make changes to the stepper and + * the solution. + * + * Users deriving from this class can access a lot of data, and it is + * expected that those users know what changes are allowable without + * affecting the Stepper correctness, performance, accuracy and stability. + * Thus the user should be careful when accessing data through classes + * derived from the default modifier (i.e., USER BEWARE!!). + * */ template class StepperOperatorSplitModifierBase : virtual public Tempus::StepperOperatorSplitAppAction { private: - /* \brief Adaptor execute function - * - * This is an adaptor function to bridge between the AppAction - * interface and the Modifier interface. It is meant to be private - * and non-virtual as deriving from this class should only need to - * implement the modify function. - * - * For the Modifier interface, this adaptor is a "simple pass through". + /* \brief Adaptor execute function + * + * This is an adaptor function to bridge between the AppAction + * interface and the Modifier interface. It is meant to be private + * and non-virtual as deriving from this class should only need to + * implement the modify function. + * + * For the Modifier interface, this adaptor is a "simple pass through". */ void execute( Teuchos::RCP > sh, @@ -49,7 +49,7 @@ class StepperOperatorSplitModifierBase const typename StepperOperatorSplitAppAction::ACTION_LOCATION actLoc) { this->modify(sh, stepper, actLoc); } public: - /// Modify OperatorSplit Stepper. + /// Modify OperatorSplit Stepper. virtual void modify( Teuchos::RCP > /* sh */, Teuchos::RCP > /* stepper */, diff --git a/packages/tempus/src/Tempus_StepperOperatorSplitModifierDefault.hpp b/packages/tempus/src/Tempus_StepperOperatorSplitModifierDefault.hpp index a7b88aa620e8..8d77ab12acae 100644 --- a/packages/tempus/src/Tempus_StepperOperatorSplitModifierDefault.hpp +++ b/packages/tempus/src/Tempus_StepperOperatorSplitModifierDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperOperatorSplitModifierDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperOperatorSplitModifierBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperOperatorSplit.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default modifier provides no-op functionality for the modifier. * See StepperOperatorSplitModifierBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperOperatorSplitModifierDefault diff --git a/packages/tempus/src/Tempus_StepperOperatorSplitModifierXDefault.hpp b/packages/tempus/src/Tempus_StepperOperatorSplitModifierXDefault.hpp new file mode 100644 index 000000000000..f692279b7da7 --- /dev/null +++ b/packages/tempus/src/Tempus_StepperOperatorSplitModifierXDefault.hpp @@ -0,0 +1,67 @@ +// @HEADER +// **************************************************************************** +// Tempus: Copyright (2017) Sandia Corporation +// +// Distributed under BSD 3-clause license (See accompanying file Copyright.txt) +// **************************************************************************** +// @HEADER + +#ifndef Tempus_StepperOperatorSplitModifierXDefault_hpp +#define Tempus_StepperOperatorSplitModifierXDefault_hpp + +#include "Tempus_config.hpp" +#include "Tempus_StepperOperatorSplitModifierXBase.hpp" + +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperOperatorSplit.hpp" + + +namespace Tempus { + +/** \brief Default ModifierX for StepperOperatorSplit. + * + * The default ModifierX provides no-op functionality for ModifierX. + * See StepperOperatorSplitModifierXBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. + */ +template +class StepperOperatorSplitModifierXDefault + : virtual public Tempus::StepperOperatorSplitModifierXBase +{ +public: + + /// Constructor + StepperOperatorSplitModifierXDefault(){} + + /// Destructor + virtual ~StepperOperatorSplitModifierXDefault(){} + + /// Modify OperatorSplit Stepper. + virtual void modify( + Teuchos::RCP > /* x */, + const Scalar /* time */, const Scalar /* dt */, + const typename StepperOperatorSplitModifierXBase::MODIFIER_TYPE modType) + { + switch(modType) { + case StepperOperatorSplitModifierXBase::X_BEGIN_STEP: + case StepperOperatorSplitModifierXBase::X_BEFORE_STEPPER: + case StepperOperatorSplitModifierXBase::X_AFTER_STEPPER: + case StepperOperatorSplitModifierXBase::XDOT_END_STEP: + { + // No-op. + break; + } + default: + TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, + "Error - unknown action location.\n"); + } + } + +}; + +} // namespace Tempus + +#endif // Tempus_StepperOperatorSplitModifierXDefault_hpp diff --git a/packages/tempus/src/Tempus_StepperOperatorSplitObserverDefault.hpp b/packages/tempus/src/Tempus_StepperOperatorSplitObserverDefault.hpp index d25367b348d5..7361f3846cfe 100644 --- a/packages/tempus/src/Tempus_StepperOperatorSplitObserverDefault.hpp +++ b/packages/tempus/src/Tempus_StepperOperatorSplitObserverDefault.hpp @@ -10,15 +10,22 @@ #define Tempus_StepperOperatorSplitObserverDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperOperatorSplitObserverBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperOperatorSplit.hpp" + + namespace Tempus { /** \brief Default observer for StepperOperatorSplit. * * The default observer provides no-op functionality for the observer. * See StepperOperatorSplitObserverBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperOperatorSplitObserverDefault diff --git a/packages/tempus/src/Tempus_StepperOperatorSplit_impl.hpp b/packages/tempus/src/Tempus_StepperOperatorSplit_impl.hpp index 90e250d02870..aa5b1c0714ad 100644 --- a/packages/tempus/src/Tempus_StepperOperatorSplit_impl.hpp +++ b/packages/tempus/src/Tempus_StepperOperatorSplit_impl.hpp @@ -345,9 +345,9 @@ void StepperOperatorSplit::takeStep( typename std::vector > >::iterator subStepperIter = subStepperList_.begin(); for (; subStepperIter < subStepperList_.end() and pass; subStepperIter++) { - int index = subStepperIter - subStepperList_.begin(); #ifndef TEMPUS_HIDE_DEPRECATED_CODE + int index = subStepperIter - subStepperList_.begin(); stepperOSObserver_->observeBeforeStepper(index, solutionHistory, *this); #endif stepperOSAppAction_->execute(solutionHistory, thisStepper, diff --git a/packages/tempus/src/Tempus_StepperRKAppAction.hpp b/packages/tempus/src/Tempus_StepperRKAppAction.hpp index 7b4a4b954d81..ea7482a1abe7 100644 --- a/packages/tempus/src/Tempus_StepperRKAppAction.hpp +++ b/packages/tempus/src/Tempus_StepperRKAppAction.hpp @@ -11,7 +11,6 @@ #include "Tempus_config.hpp" #include "Tempus_SolutionHistory.hpp" -#include "Tempus_StepperRKBase.hpp" namespace Tempus { @@ -28,7 +27,7 @@ template class StepperRKBase; * data (i.e., use but not change the data) to change any of it * (USER BEWARE!). * - * The locations of the RK AppActions (ACITON_LOCATION) in takeStep + * The locations of the RK AppActions (ACTION_LOCATION) in takeStep * are documented in each of the RK Algorithm sections: * StepperExplicitRK, StepperDIRK and StepperIMEX_RK. */ diff --git a/packages/tempus/src/Tempus_StepperRKModifierDefault.hpp b/packages/tempus/src/Tempus_StepperRKModifierDefault.hpp index 963236762cef..929b41fe4230 100644 --- a/packages/tempus/src/Tempus_StepperRKModifierDefault.hpp +++ b/packages/tempus/src/Tempus_StepperRKModifierDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperRKModifierDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperRKModifierBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperRKBase.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default modifier provides no-op functionality for the modifier. * See StepperRKModifierBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperRKModifierDefault diff --git a/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp b/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp index 3307bf26aed0..a06fef3578a5 100644 --- a/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp +++ b/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp @@ -10,7 +10,6 @@ #define Tempus_StepperRKModifierX_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperRKModifierXBase.hpp" @@ -20,6 +19,9 @@ namespace Tempus { * * The default provides no-op functionality for ModifierX. * See StepperRKModifierXBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperRKModifierXDefault diff --git a/packages/tempus/src/Tempus_StepperRKObserverDefault.hpp b/packages/tempus/src/Tempus_StepperRKObserverDefault.hpp index 81533461428c..f6aac518e0f3 100644 --- a/packages/tempus/src/Tempus_StepperRKObserverDefault.hpp +++ b/packages/tempus/src/Tempus_StepperRKObserverDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperRKObserverDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperRKObserverBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperRKBase.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default observer provides no-op functionality for the observer. * See StepperRKObserverBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperRKObserverDefault @@ -36,8 +42,8 @@ class StepperRKObserverDefault /// Observe RK Stepper at end of takeStep. virtual void observe( Teuchos::RCP > /* sh */, - Teuchos::RCP > /* stepper */, - const typename StepperRKAppAction::ACTION_LOCATION actLoc) const + Teuchos::RCP > /* stepper */, + const typename StepperRKAppAction::ACTION_LOCATION actLoc) { switch(actLoc) { case StepperRKAppAction::BEGIN_STEP: diff --git a/packages/tempus/src/Tempus_StepperSubcyclingAppAction.hpp b/packages/tempus/src/Tempus_StepperSubcyclingAppAction.hpp index 30a8b4b8afad..49791bb121a0 100644 --- a/packages/tempus/src/Tempus_StepperSubcyclingAppAction.hpp +++ b/packages/tempus/src/Tempus_StepperSubcyclingAppAction.hpp @@ -11,7 +11,6 @@ #include "Tempus_config.hpp" #include "Tempus_SolutionHistory.hpp" -#include "Tempus_StepperSubcycling.hpp" namespace Tempus { diff --git a/packages/tempus/src/Tempus_StepperSubcyclingModifierDefault.hpp b/packages/tempus/src/Tempus_StepperSubcyclingModifierDefault.hpp index 9d3087adf8fd..53eaef8d4280 100644 --- a/packages/tempus/src/Tempus_StepperSubcyclingModifierDefault.hpp +++ b/packages/tempus/src/Tempus_StepperSubcyclingModifierDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperSubcyclingModifierDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperSubcyclingModifierBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperSubcycling.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default modifier provides no-op functionality for the modifier. * See StepperSubcyclingModifierBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperSubcyclingModifierDefault diff --git a/packages/tempus/src/Tempus_StepperSubcyclingModifierXDefault.hpp b/packages/tempus/src/Tempus_StepperSubcyclingModifierXDefault.hpp index bc14ef51360e..387cb903e5d9 100644 --- a/packages/tempus/src/Tempus_StepperSubcyclingModifierXDefault.hpp +++ b/packages/tempus/src/Tempus_StepperSubcyclingModifierXDefault.hpp @@ -10,7 +10,6 @@ #define Tempus_StepperSubcyclingModifierX_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperSubcyclingModifierXBase.hpp" @@ -20,6 +19,9 @@ namespace Tempus { * * The default provides no-op functionality for ModifierX. * See StepperSubcyclingModifierXBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperSubcyclingModifierXDefault diff --git a/packages/tempus/src/Tempus_StepperSubcyclingObserverDefault.hpp b/packages/tempus/src/Tempus_StepperSubcyclingObserverDefault.hpp index 341de790f33a..75aac078bab3 100644 --- a/packages/tempus/src/Tempus_StepperSubcyclingObserverDefault.hpp +++ b/packages/tempus/src/Tempus_StepperSubcyclingObserverDefault.hpp @@ -10,9 +10,12 @@ #define Tempus_StepperSubcyclingObserverDefault_hpp #include "Tempus_config.hpp" -#include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperSubcyclingObserverBase.hpp" +// Applications can uncomment this include in their implementation, +// if they need access to the stepper methods. +//#include "Tempus_StepperSubcycling.hpp" + namespace Tempus { @@ -20,6 +23,9 @@ namespace Tempus { * * The default observer provides no-op functionality for the observer. * See StepperSubcyclingObserverBase for details on the algorithm. + * + * Applications can copy this implementation, rename, implement their + * action, and set on the stepper to get app-specific functionality. */ template class StepperSubcyclingObserverDefault diff --git a/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp b/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp index e72a7bd43f51..a4894a59bf27 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp @@ -16,9 +16,11 @@ #include "Tempus_StepperFactory.hpp" #include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperBackwardEulerModifierBase.hpp" -#include "Tempus_StepperBackwardEulerObserverBase.hpp" #include "Tempus_StepperBackwardEulerModifierXBase.hpp" +#include "Tempus_StepperBackwardEulerObserverBase.hpp" #include "Tempus_StepperBackwardEulerModifierDefault.hpp" +#include "Tempus_StepperBackwardEulerModifierXDefault.hpp" +#include "Tempus_StepperBackwardEulerObserverDefault.hpp" #include "Tempus_UnitTest_Utils.hpp" #include "../TestModels/SinCosModel.hpp" @@ -55,7 +57,10 @@ TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction) // Default values for construction. - auto solver = rcp(new Thyra::NOXNonlinearSolver()); + auto modifier = rcp(new Tempus::StepperBackwardEulerModifierDefault()); + auto modifierX = rcp(new Tempus::StepperBackwardEulerModifierXDefault()); + auto observer = rcp(new Tempus::StepperBackwardEulerObserverDefault()); + auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); auto predictorStepper = rcp(new Tempus::StepperForwardEuler()); @@ -73,8 +78,9 @@ TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction) auto obs = rcp(new Tempus::StepperBackwardEulerObserver()); stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif - auto modifier = rcp(new Tempus::StepperBackwardEulerModifierDefault()); - stepper->setAppAction(modifier); + stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setPredictor(predictorStepper); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp index efd6b6d4629c..cd9d9591fea4 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp @@ -50,8 +50,10 @@ TEUCHOS_UNIT_TEST(DIRK_General, Default_Construction) // Default values for construction. - auto modifier = rcp(new Tempus::StepperRKModifierDefault()); - auto solver = rcp(new Thyra::NOXNonlinearSolver()); + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifierX = rcp(new Tempus::StepperRKModifierXDefault()); + auto observer = rcp(new Tempus::StepperRKObserverDefault()); + auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); bool useFSAL = stepper->getUseFSALDefault(); @@ -87,6 +89,8 @@ TEUCHOS_UNIT_TEST(DIRK_General, Default_Construction) stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp index 5b295ede2c36..59e6bdeedab8 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp @@ -34,8 +34,9 @@ TEUCHOS_UNIT_TEST(ERK_General, Default_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto modifier = rcp(new Tempus::StepperRKModifierDefault()); - + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifierX = rcp(new Tempus::StepperRKModifierXDefault()); + auto observer = rcp(new Tempus::StepperRKObserverDefault()); bool useFSAL = stepper->getUseFSALDefault(); std::string ICConsistency = stepper->getICConsistencyDefault(); bool ICConsistencyCheck = stepper->getICConsistencyCheckDefault(); @@ -68,6 +69,8 @@ TEUCHOS_UNIT_TEST(ERK_General, Default_Construction) stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistencyCheck(ICConsistencyCheck); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp index 1c49596a1bc0..0800613adea4 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp @@ -18,9 +18,11 @@ #include "Tempus_StepperRKButcherTableau.hpp" #include "Tempus_StepperForwardEulerModifierBase.hpp" -#include "Tempus_StepperForwardEulerObserverBase.hpp" #include "Tempus_StepperForwardEulerModifierXBase.hpp" +#include "Tempus_StepperForwardEulerObserverBase.hpp" #include "Tempus_StepperForwardEulerModifierDefault.hpp" +#include "Tempus_StepperForwardEulerModifierXDefault.hpp" +#include "Tempus_StepperForwardEulerObserverDefault.hpp" #include "../TestModels/SinCosModel.hpp" #include "../TestModels/VanDerPolModel.hpp" @@ -52,7 +54,10 @@ TEUCHOS_UNIT_TEST(ForwardEuler, Default_Construction) auto model = rcp(new Tempus_Test::SinCosModel()); // Default construction. - auto stepper = rcp(new Tempus::StepperForwardEuler()); + auto modifier = rcp(new Tempus::StepperForwardEulerModifierDefault()); + auto modifierX = rcp(new Tempus::StepperForwardEulerModifierXDefault()); + auto observer = rcp(new Tempus::StepperForwardEulerObserverDefault()); + auto stepper = rcp(new Tempus::StepperForwardEuler()); stepper->setModel(model); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); @@ -66,8 +71,9 @@ TEUCHOS_UNIT_TEST(ForwardEuler, Default_Construction) auto obs = rcp(new Tempus::StepperForwardEulerObserver()); stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif - auto modifier = rcp(new Tempus::StepperForwardEulerModifierDefault()); - stepper->setAppAction(modifier); + stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistencyCheck(ICConsistencyCheck); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp index 7405b3b60c7c..0b0fb70fa681 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp @@ -55,7 +55,9 @@ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifierX = rcp(new Tempus::StepperRKModifierXDefault()); + auto observer = rcp(new Tempus::StepperRKObserverDefault()); auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); @@ -77,6 +79,8 @@ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp index 0dedde7bbf5a..cf7d173510bf 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp @@ -62,7 +62,9 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifierX = rcp(new Tempus::StepperRKModifierXDefault()); + auto observer = rcp(new Tempus::StepperRKObserverDefault()); auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); @@ -84,6 +86,8 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp b/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp index 096ecf3a95f3..50f8847cbdc4 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp @@ -18,9 +18,11 @@ #include "Tempus_StepperRKButcherTableau.hpp" #include "Tempus_StepperOperatorSplitModifierBase.hpp" -#include "Tempus_StepperOperatorSplitObserverBase.hpp" #include "Tempus_StepperOperatorSplitModifierXBase.hpp" +#include "Tempus_StepperOperatorSplitObserverBase.hpp" #include "Tempus_StepperOperatorSplitModifierDefault.hpp" +#include "Tempus_StepperOperatorSplitModifierXDefault.hpp" +#include "Tempus_StepperOperatorSplitObserverDefault.hpp" #include "Tempus_StepperOperatorSplitObserver.hpp" #include "../TestModels/VanDerPol_IMEX_ExplicitModel.hpp" @@ -64,19 +66,24 @@ TEUCHOS_UNIT_TEST(OperatorSplit, Default_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. -#ifndef TEMPUS_DEPRECATED_CODE +#ifndef TEMPUS_HIDE_DEPRECATED_CODE auto obs = rcp(new Tempus::StepperOperatorSplitObserver()); #endif - - auto modifier = rcp(new Tempus::StepperOperatorSplitModifierDefault()); - stepper->setAppAction(modifier); + auto modifier = rcp(new Tempus::StepperOperatorSplitModifierDefault()); + auto modifierX = rcp(new Tempus::StepperOperatorSplitModifierXDefault()); + auto observer = rcp(new Tempus::StepperOperatorSplitObserverDefault()); bool useFSAL = stepper->getUseFSALDefault(); std::string ICConsistency = stepper->getICConsistencyDefault(); bool ICConsistencyCheck = stepper->getICConsistencyCheckDefault(); int order = 1; // Test the set functions. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); +#endif + stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistencyCheck(ICConsistencyCheck); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); @@ -135,24 +142,24 @@ TEUCHOS_UNIT_TEST(OperatorSplit, StepperFactory_Construction) } -// ************************************************************ -// ************************************************************ +// ************************************************************ +// ************************************************************ class StepperOperatorSplitModifierTest : virtual public Tempus::StepperOperatorSplitModifierBase { public: - /// Constructor + /// Constructor StepperOperatorSplitModifierTest() : testBEGIN_STEP(false), testEND_STEP(false), testCurrentValue(-0.99), testWorkingValue(-0.99), testDt(-1.5), testType("") {} - /// Destructor + /// Destructor virtual ~StepperOperatorSplitModifierTest(){} - /// Modify OperatorSplit Stepper at action location. + /// Modify OperatorSplit Stepper at action location. virtual void modify( Teuchos::RCP > sh, Teuchos::RCP > stepper, @@ -207,7 +214,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Modifier) { auto explicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ExplicitModel()); auto implicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ImplicitModel()); - // Default construction. + // Default construction. auto stepper = rcp(new Tempus::StepperOperatorSplit()); auto sf = Teuchos::rcp(new Tempus::StepperFactory()); auto subStepper1 = @@ -220,7 +227,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Modifier) stepper->addStepper(subStepper2); stepper->initialize(); - // Setup initial condition SolutionState -------------------- + // Setup initial condition SolutionState -------------------- Thyra::ModelEvaluatorBase::InArgs inArgsIC = stepper->getModel()->getNominalValues(); auto icX = rcp_const_cast > (inArgsIC.get_x()); @@ -232,26 +239,26 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Modifier) icState->setOrder (stepper->getOrder()); icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing. - // Create a SolutionHistory. + // Create a SolutionHistory. auto solutionHistory = rcp(new Tempus::SolutionHistory()); solutionHistory->setName("Forward States"); solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC); solutionHistory->setStorageLimit(2); solutionHistory->addState(icState); - // Take one time step. + // Take one time step. stepper->setInitialConditions(solutionHistory); solutionHistory->initWorkingState(); solutionHistory->getWorkingState()->setTimeStep(-15.0); stepper->takeStep(solutionHistory); - // Testing that each ACTION_LOCATION has been called. + // Testing that each ACTION_LOCATION has been called. TEST_COMPARE(modifier->testBEGIN_STEP, ==, true); TEST_COMPARE(modifier->testBEFORE_STEPPER, ==, true); TEST_COMPARE(modifier->testAFTER_STEPPER, ==, true); TEST_COMPARE(modifier->testEND_STEP, ==, true); - // Testing that values can be set through the Modifier. + // Testing that values can be set through the Modifier. auto x = solutionHistory->getCurrentState()->getX(); TEST_FLOATING_EQUALITY(modifier->testCurrentValue, get_ele(*(x), 0), 1.0e-15); x = solutionHistory->getWorkingState()->getX(); @@ -262,14 +269,14 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Modifier) TEST_COMPARE(modifier->testType, ==, "OperatorSplit - Modifier"); } -// ************************************************************ -// ************************************************************ +// ************************************************************ +// ************************************************************ class StepperOperatorSplitObserverTest : virtual public Tempus::StepperOperatorSplitObserverBase { public: - /// Constructor + /// Constructor StepperOperatorSplitObserverTest() : testBEGIN_STEP(false), testBEFORE_STEPPER(false), testAFTER_STEPPER(false), testEND_STEP(false), @@ -277,10 +284,10 @@ class StepperOperatorSplitObserverTest testDt(-1.5), testType("Operator Split") {} - /// Destructor + /// Destructor virtual ~StepperOperatorSplitObserverTest(){} - /// Observe OperatorSplit Stepper at action location. + /// Observe OperatorSplit Stepper at action location. virtual void observe( Teuchos::RCP > sh, Teuchos::RCP > stepper, @@ -333,7 +340,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Observer) { auto explicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ExplicitModel()); auto implicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ImplicitModel()); - // Default construction. + // Default construction. auto stepper = rcp(new Tempus::StepperOperatorSplit()); auto sf = Teuchos::rcp(new Tempus::StepperFactory()); auto subStepper1 = @@ -346,7 +353,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Observer) stepper->addStepper(subStepper2); stepper->initialize(); - // Setup initial condition SolutionState -------------------- + // Setup initial condition SolutionState -------------------- Thyra::ModelEvaluatorBase::InArgs inArgsIC = stepper->getModel()->getNominalValues(); auto icX = rcp_const_cast > (inArgsIC.get_x()); @@ -356,28 +363,28 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Observer) icState->setIndex (1); icState->setTimeStep(-1.5); icState->setOrder (stepper->getOrder()); - icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing. + icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing. - // Create a SolutionHistory. + // Create a SolutionHistory. auto solutionHistory = rcp(new Tempus::SolutionHistory()); solutionHistory->setName("Forward States"); solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC); solutionHistory->setStorageLimit(2); solutionHistory->addState(icState); - // Take one time step. + // Take one time step. stepper->setInitialConditions(solutionHistory); solutionHistory->initWorkingState(); solutionHistory->getWorkingState()->setTimeStep(-1.5); stepper->takeStep(solutionHistory); - // Testing that each ACTION_LOCATION has been called. + // Testing that each ACTION_LOCATION has been called. TEST_COMPARE(observer->testBEGIN_STEP, ==, true); TEST_COMPARE(observer->testBEFORE_STEPPER, ==, true); TEST_COMPARE(observer->testAFTER_STEPPER, ==, true); TEST_COMPARE(observer->testEND_STEP, ==, true); - // Testing that values can be observed through the observer. + // Testing that values can be observed through the observer. auto x = solutionHistory->getCurrentState()->getX(); TEST_FLOATING_EQUALITY(observer->testCurrentValue, get_ele(*(x), 0), 1.0e-15); x = solutionHistory->getWorkingState()->getX(); @@ -387,14 +394,14 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_Observer) TEST_COMPARE(observer->testType, ==, "Operator Split"); } -// ************************************************************ -// ************************************************************ +// ************************************************************ +// ************************************************************ class StepperOperatorSplitModifierXTest : virtual public Tempus::StepperOperatorSplitModifierXBase { public: - /// Constructor + /// Constructor StepperOperatorSplitModifierXTest() : testX_BEGIN_STEP(false), testX_BEFORE_STEPPER(false), testX_AFTER_STEPPER(false), testXDOT_END_STEP(false), @@ -402,10 +409,10 @@ class StepperOperatorSplitModifierXTest testDt(-1.5), testTime(-1.5) {} - /// Destructor + /// Destructor virtual ~StepperOperatorSplitModifierXTest(){} - /// Modify OperatorSplit Stepper at action location. + /// Modify OperatorSplit Stepper at action location. virtual void modify( Teuchos::RCP > x, const double time, const double dt, @@ -456,7 +463,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_ModifierX) { auto explicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ExplicitModel()); auto implicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ImplicitModel()); - // Default construction. + // Default construction. auto stepper = rcp(new Tempus::StepperOperatorSplit()); auto sf = Teuchos::rcp(new Tempus::StepperFactory()); auto subStepper1 = @@ -469,7 +476,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_ModifierX) stepper->addStepper(subStepper2); stepper->initialize(); - // Setup initial condition SolutionState -------------------- + // Setup initial condition SolutionState -------------------- Thyra::ModelEvaluatorBase::InArgs inArgsIC = stepper->getModel()->getNominalValues(); auto icX = rcp_const_cast > (inArgsIC.get_x()); @@ -479,31 +486,31 @@ TEUCHOS_UNIT_TEST(OperatorSplit, AppAction_ModifierX) icState->setIndex (1); icState->setTimeStep(-1.5); icState->setOrder (stepper->getOrder()); - icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing. + icState->setSolutionStatus(Tempus::Status::PASSED); // ICs are passing. - // Create a SolutionHistory. + // Create a SolutionHistory. auto solutionHistory = rcp(new Tempus::SolutionHistory()); solutionHistory->setName("Forward States"); solutionHistory->setStorageType(Tempus::STORAGE_TYPE_STATIC); solutionHistory->setStorageLimit(2); solutionHistory->addState(icState); - // Take one time step. + // Take one time step. stepper->setInitialConditions(solutionHistory); solutionHistory->initWorkingState(); solutionHistory->getWorkingState()->setTimeStep(-1.5); stepper->takeStep(solutionHistory); - // Testing that each ACTION_LOCATION has been called. + // Testing that each ACTION_LOCATION has been called. TEST_COMPARE(modifierX->testX_BEGIN_STEP, ==, true); TEST_COMPARE(modifierX->testX_BEFORE_STEPPER, ==, true); TEST_COMPARE(modifierX->testX_AFTER_STEPPER, ==, true); TEST_COMPARE(modifierX->testXDOT_END_STEP, ==, true); - // Testing that values can be set through the Modifier. + // Testing that values can be set through the Modifier. auto x = solutionHistory->getCurrentState()->getX(); TEST_FLOATING_EQUALITY(modifierX->testX, get_ele(*(x), 0), 1.0e-15); - // Temporary memory for xDot is not guarranteed to exist outside the Stepper. + // Temporary memory for xDot is not guarranteed to exist outside the Stepper. auto xDot = stepper->getStepperXDot(solutionHistory->getWorkingState()); TEST_FLOATING_EQUALITY(modifierX->testXDot, get_ele(*(xDot), 0),1.0e-15); auto Dt = solutionHistory->getWorkingState()->getTimeStep(); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp b/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp index 62fd734b2e50..29f6eecf48d2 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp @@ -14,11 +14,12 @@ #include "Thyra_VectorStdOps.hpp" #include "Tempus_StepperFactory.hpp" -//#include "Tempus_UnitTest_Utils.hpp" #include "Tempus_StepperSubcyclingModifierBase.hpp" -#include "Tempus_StepperSubcyclingObserverBase.hpp" #include "Tempus_StepperSubcyclingModifierXBase.hpp" +#include "Tempus_StepperSubcyclingObserverBase.hpp" #include "Tempus_StepperSubcyclingModifierDefault.hpp" +#include "Tempus_StepperSubcyclingModifierXDefault.hpp" +#include "Tempus_StepperSubcyclingObserverDefault.hpp" #include "../TestModels/SinCosModel.hpp" #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp" @@ -59,6 +60,8 @@ TEUCHOS_UNIT_TEST(Subcycling, Default_Construction) auto obs = rcp(new Tempus::StepperSubcyclingObserver()); #endif auto modifier = rcp(new Tempus::StepperSubcyclingModifierDefault()); + auto modifierX = rcp(new Tempus::StepperSubcyclingModifierXDefault()); + auto observer = rcp(new Tempus::StepperSubcyclingObserverDefault()); auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); @@ -72,6 +75,8 @@ TEUCHOS_UNIT_TEST(Subcycling, Default_Construction) stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistencyCheck(ICConsistencyCheck); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp b/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp index 80a5e301ba2c..89e7d3afad96 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp @@ -12,9 +12,11 @@ #include "Tempus_StepperFactory.hpp" #include "Tempus_SolutionHistory.hpp" #include "Tempus_StepperRKModifierBase.hpp" -#include "Tempus_StepperRKObserverBase.hpp" #include "Tempus_StepperRKModifierXBase.hpp" +#include "Tempus_StepperRKObserverBase.hpp" #include "Tempus_StepperRKModifierDefault.hpp" +#include "Tempus_StepperRKModifierXDefault.hpp" +#include "Tempus_StepperRKObserverDefault.hpp" #include "../TestModels/SinCosModel.hpp" #include "../TestModels/VanDerPolModel.hpp" @@ -70,8 +72,9 @@ void testExplicitRKAccessorsFullConstruction( TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto modifier = rcp(new Tempus::StepperRKModifierDefault()); - + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifierX = rcp(new Tempus::StepperRKModifierXDefault()); + auto observer = rcp(new Tempus::StepperRKObserverDefault()); bool useFSAL = stepper->getUseFSALDefault(); std::string ICConsistency = stepper->getICConsistencyDefault(); bool ICConsistencyCheck = stepper->getICConsistencyCheckDefault(); @@ -83,6 +86,8 @@ void testExplicitRKAccessorsFullConstruction( stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistencyCheck(ICConsistencyCheck); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); @@ -215,8 +220,10 @@ void testDIRKAccessorsFullConstruction( TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto modifier = rcp(new Tempus::StepperRKModifierDefault()); - auto solver = rcp(new Thyra::NOXNonlinearSolver()); + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); + auto modifierX = rcp(new Tempus::StepperRKModifierXDefault()); + auto observer = rcp(new Tempus::StepperRKObserverDefault()); + auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); bool useFSAL = stepper->getUseFSALDefault(); @@ -231,6 +238,8 @@ void testDIRKAccessorsFullConstruction( stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); #endif stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(modifierX); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setAppAction(observer); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());