Skip to content

Commit

Permalink
Merge 'trilinos/Trilinos:develop' (0d69e98) into 'tcad-charon/Trilino…
Browse files Browse the repository at this point in the history
…s:develop' (54ea166).

* trilinos-develop:
  Changed Tempus_Stepper_decl to get the deprecated code to compile correctly
  MueLu: make Galeri a required test dependency
  Adding new SmooVecRandCoalesceDrop factory to the fancy/long xml interface
  Fix fpe in clang, not sure why this makes it go away, but it does
  Fix unused variable error
  Fix some -Wreturn-std-move errors
  Fixing the requested changes to the Doxygen
  NOX: fix issue with matrix free Jacobian operator  - nox and thyra namespaces were wrapped around headers  - also remove print statements in rol
  Fixing up TEMPUS_DEPRECATED Intel compiler issue
  Add chnages to ModifierXDefault I forgot to commit
  Fixed final unit tests issues in the FE unit test
  Added AppAction and Modifier unit tests to FE stepper
  Removed AFTER_EXPLICIT_EVAL
  Commiting the Forward Euler AppAction changes
  • Loading branch information
Jenkins Pipeline committed Apr 10, 2020
2 parents 54ea166 + 0d69e98 commit 8505e85
Show file tree
Hide file tree
Showing 21 changed files with 1,078 additions and 42 deletions.
8 changes: 2 additions & 6 deletions packages/ifpack2/src/Ifpack2_Details_Chebyshev_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@ setMatrix (const Teuchos::RCP<const row_matrix_type>& A)
}
}


template<class ScalarType, class MV>
void
Chebyshev<ScalarType, MV>::compute ()
Expand Down Expand Up @@ -862,11 +861,8 @@ Chebyshev<ScalarType, MV>::compute ()
////////////////////////////////////////////////////////////////////

// Always favor the user's max eigenvalue estimate, if provided.
if (STS::isnaninf (userLambdaMax_)) {
lambdaMaxForApply_ = computedLambdaMax_;
} else {
lambdaMaxForApply_ = userLambdaMax_;
}
lambdaMaxForApply_ = STS::isnaninf (userLambdaMax_) ? computedLambdaMax_ : userLambdaMax_;

// mfh 11 Feb 2013: For now, we imitate Ifpack by ignoring the
// user's min eigenvalue estimate, and using the given eigenvalue
// ratio to estimate the min eigenvalue. We could instead do this:
Expand Down
4 changes: 2 additions & 2 deletions packages/muelu/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ SET(LIB_OPTIONAL_DEP_PACKAGES Amesos Amesos2 AvatarT Belos Epetra EpetraExt Teko
Ifpack Ifpack2 Intrepid2 ML Tpetra
Zoltan Zoltan2 Stratimikos Thyra ThyraTpetraAdapters
Isorropia KokkosCore KokkosContainers KokkosKernels)
SET(TEST_REQUIRED_DEP_PACKAGES )
SET(TEST_OPTIONAL_DEP_PACKAGES AztecOO Galeri Pamgen)
SET(TEST_REQUIRED_DEP_PACKAGES Galeri)
SET(TEST_OPTIONAL_DEP_PACKAGES AztecOO Pamgen)
SET(LIB_REQUIRED_DEP_TPLS BLAS LAPACK)
SET(LIB_OPTIONAL_DEP_TPLS Boost MATLAB AmgX CGAL ViennaCL MKL Avatar CUSPARSE MAGMASparse mlpack)
SET(TEST_REQUIRED_DEP_TPLS)
Expand Down
2 changes: 2 additions & 0 deletions packages/muelu/src/Interface/MueLu_FactoryFactory_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#include "MueLu_BrickAggregationFactory.hpp"
#include "MueLu_CloneRepartitionInterface.hpp"
#include "MueLu_CoalesceDropFactory.hpp"
#include "MueLu_SmooVecCoalesceDropFactory.hpp"
#include "MueLu_CoarseMapFactory.hpp"
#include "MueLu_CoarseningVisualizationFactory.hpp"
#include "MueLu_ConstraintFactory.hpp"
Expand Down Expand Up @@ -238,6 +239,7 @@ namespace MueLu {
if (factoryName == "CoarseMapFactory") return Build2<CoarseMapFactory> (paramList, factoryMapIn, factoryManagersIn);
if (factoryName == "CoarseningVisualizationFactory") return Build2<CoarseningVisualizationFactory> (paramList, factoryMapIn, factoryManagersIn);
if (factoryName == "CoalesceDropFactory") return Build2<CoalesceDropFactory> (paramList, factoryMapIn, factoryManagersIn);
if (factoryName == "SmooVecCoalesceDropFactory") return Build2<SmooVecCoalesceDropFactory> (paramList, factoryMapIn, factoryManagersIn);
if (factoryName == "ConstraintFactory") return Build2<ConstraintFactory> (paramList, factoryMapIn, factoryManagersIn);
if (factoryName == "CoupledAggregationFactory") return BuildCoupledAggregationFactory (paramList, factoryMapIn, factoryManagersIn);
if (factoryName == "CoordinatesTransferFactory") return Build2<CoordinatesTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ namespace NOX {
outArgs.setModelEvalDescription(this->description());

if (outArgs.supports( ::Thyra::ModelEvaluatorBase::OUT_ARG_W_op))
return outArgs;
return std::move(outArgs);

outArgs.setSupports( ::Thyra::ModelEvaluatorBase::OUT_ARG_W_op,true);
return outArgs;
return std::move(outArgs);
}

void evalModelImpl(const ::Thyra::ModelEvaluatorBase::InArgs<ScalarT> &inArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ namespace NOX {
}

namespace NOX {

namespace Thyra {

/*! \brief Concrete implementation of a Thyra::LinearOpBase object that approximates a Jacobian operator based on the Jacobian-Free Newton-Krylov method (see Knoll and Keyes Journal of Computational Physics 193 (2004) 357-397 for details).
Expand Down Expand Up @@ -208,9 +207,9 @@ class MatrixFreeJacobianOperator : public ::Thyra::LinearOpBase<Scalar>,

};

#include "NOX_Thyra_MatrixFreeJacobianOperator_impl.hpp"

} // namespace Thyra
} // namespace NOX

#include "NOX_Thyra_MatrixFreeJacobianOperator_impl.hpp"

#endif /* NOX_EPETRA_MATRIXFREE_JACOBIAN_OPERATOR_HPP */
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardParameterEntryValidators.hpp"
#include "Thyra_ModelEvaluatorBase.hpp"
#include "Thyra_VectorStdOps.hpp"

namespace NOX {
namespace Thyra {

template<typename Scalar>
MatrixFreeJacobianOperator<Scalar>::
Expand Down Expand Up @@ -326,3 +330,6 @@ Scalar MatrixFreeJacobianOperator<Scalar>::getDelta() const
{
return delta_;
}

} // namespace Thyra
} // namespace NOX
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class ThyraProductME_Objective : public Objective<Real> {
if(!computeValue)
return value_;

Real norm = rol_x.norm();
std::cout << "Value norm: " << norm << std::endl;
// Real norm = rol_x.norm();
// std::cout << "Value norm: " << norm << std::endl;

const ThyraVector<Real> & thyra_p = dynamic_cast<const ThyraVector<Real>&>(rol_x);
Teuchos::RCP< Thyra::VectorBase<Real> > g = Thyra::createMember<Real>(thyra_model.get_g_space(g_index));
Expand Down Expand Up @@ -119,8 +119,8 @@ class ThyraProductME_Objective : public Objective<Real> {
*/
void gradient( Vector<Real> &rol_g, const Vector<Real> &rol_x, Real &tol ) {

Real norm = rol_x.norm();
std::cout << "In Gradient, Value norm: " << norm << std::endl;
// Real norm = rol_x.norm();
// std::cout << "In Gradient, Value norm: " << norm << std::endl;

const ThyraVector<Real> & thyra_p = dynamic_cast<const ThyraVector<Real>&>(rol_x);
Teuchos::RCP<const Thyra::ProductVectorBase<Real> > thyra_prodvec_p = Teuchos::rcp_dynamic_cast<const Thyra::ProductVectorBase<Real>>(thyra_p.getVector());
Expand Down
73 changes: 73 additions & 0 deletions packages/tempus/src/Tempus_StepperForwardEulerAppAction.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// @HEADER
// ****************************************************************************
// Tempus: Copyright (2017) Sandia Corporation
//
// Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
// ****************************************************************************
// @HEADER

#ifndef Tempus_StepperForwardEulerAppAction_hpp
#define Tempus_StepperForwardEulerAppAction_hpp

#include "Tempus_config.hpp"
#include "Tempus_SolutionHistory.hpp"
#include "Tempus_StepperForwardEuler.hpp"


namespace Tempus {

// Forward Declaration for recursive includes (this AppAction <--> Stepper)
template<class Scalar> class StepperForwardEuler;

/** \brief Application Action for StepperForwardEuler.
*
* This class provides a means to apply various actions with the ForwardEuler time step.
* The data available to this class is solution variables (through
* SolutionHistory), and stepper data (through the Stepper). It allows
* the application to just observe this data (i.e., use but not change the
* data) to change any of it (USER BEWARE!).
*
* Below is the ForwardEuler algorithm and includes the locations where the
* application can take actions (in italicized).
*
* \f{algorithm}{
* \renewcommand{\thealgorithm}{}
* \caption{Forward Euler with the locations of the application actions indicated.}
* \begin{algorithmic}[1]
* \State Start with $x_n$, $\Delta t_n$
* \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)}
* \State Form $f(x_{n},t_{n})$
* \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_EXPLICIT\_EVAL)}
* \State Form $x_n \leftarrow x_{n} + \Delta t_n f(x_{n},t_n)$
* \State {\it appAction.execute(solutionHistory, stepper, END\_STEP)}
* \end{algorithmic}
* \f}
*/
template<class Scalar>
class StepperForwardEulerAppAction
{
public:

/// Indicates the location of application action (see algorithm).
enum ACTION_LOCATION {
BEGIN_STEP, ///< At the beginning of the step.
BEFORE_EXPLICIT_EVAL, ///< Before the explicit evaluation.
END_STEP ///< At the end of the step.
};

/// Constructor
StepperForwardEulerAppAction(){}

/// Destructor
virtual ~StepperForwardEulerAppAction(){}

/// Execute application action for ForwardEuler Stepper.
virtual void execute(
Teuchos::RCP<SolutionHistory<Scalar> > sh,
Teuchos::RCP<StepperForwardEuler<Scalar> > stepper,
const typename StepperForwardEulerAppAction<Scalar>::ACTION_LOCATION actLoc) = 0;
};

} // namespace Tempus

#endif // Tempus_StepperForwardEulerAppAction_hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// @HEADER
// ****************************************************************************
// Tempus: Copyright (2017) Sandia Corporation
//
// Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
// ****************************************************************************
// @HEADER

#ifndef Tempus_StepperForwardEulerAppActionComposite_hpp
#define Tempus_StepperForwardEulerAppActionComposite_hpp

#include "Tempus_StepperForwardEulerAppAction.hpp"
#include "Tempus_TimeStepControl.hpp"
#include <vector>

namespace Tempus {

/** \brief This composite AppAction loops over added AppActions.
*
* Inidividual AppActions are executed in the order in which they
* were added.
*/
template<class Scalar>
class StepperForwardEulerAppActionComposite
: virtual public Tempus::StepperForwardEulerAppAction<Scalar>
{
public:

/// Default constructor
StepperForwardEulerAppActionComposite();

/// Destructor
virtual ~StepperForwardEulerAppActionComposite();

/// Execute application action for ForwardEuler Stepper.
virtual void execute(
Teuchos::RCP<SolutionHistory<Scalar> > sh,
Teuchos::RCP<StepperForwardEuler<Scalar> > stepper,
const typename StepperForwardEulerAppAction<Scalar>::ACTION_LOCATION actLoc)
{
for(auto& a : appActions_)
a->execute(sh, stepper, actLoc);
}

// Add AppAction to the AppAction vector.
void addForwardEulerAppAction(Teuchos::RCP<StepperForwardEulerAppAction<Scalar> > appAction);
{
appActions_.push_back(appAction);
}

// Clear the AppAction vector.
void clearForwardEulerAppActions();
{ appActions_.clear();}

// Return the size of the AppAction vector.
std::size_t getSize() const { return appActions_.size(); }

private:

std::vector<Teuchos::RCP<StepperForwardEulerAppAction<Scalar > > > appActions_;

};

} // namespace Tempus
#endif // Tempus_StepperForwardEulerAppActionComposite_hpp
78 changes: 78 additions & 0 deletions packages/tempus/src/Tempus_StepperForwardEulerModifierBase.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// @HEADER
// ****************************************************************************
// Tempus: Copyright (2017) Sandia Corporation
//
// Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
// ****************************************************************************
// @HEADER

#ifndef Tempus_StepperForwardEulerModifierBase_hpp
#define Tempus_StepperForwardEulerModifierBase_hpp

#include "Tempus_config.hpp"
#include "Tempus_SolutionHistory.hpp"
#include "Tempus_StepperForwardEulerAppAction.hpp"

namespace Tempus {

/** \brief Base modifier for StepperBackwardEuler.
*
* 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!!).
*
* \f{algorithm}{
* \renewcommand{\thealgorithm}{}
* \caption{Forward Euler with the locations of the application actions indicated.}
* \begin{algorithmic}[1]
* \State Start with $x_n$, $\Delta t_n$
* \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)}
* \State Form $f(x_{n},t_{n})$
* \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_EXPLICIT\_EVAL)}
* \State Form $x_n \leftarrow x_{n} + \Delta t_n f(x_{n},t_n)$
* \State {\it appAction.execute(solutionHistory, stepper, END\_STEP)}
* \end{algorithmic}
* \f}
*/

template<class Scalar>
class StepperForwardEulerModifierBase
: virtual public Tempus::StepperForwardEulerAppAction<Scalar>
{
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".
*/
void execute(
Teuchos::RCP<SolutionHistory<Scalar> > sh,
Teuchos::RCP<StepperForwardEuler<Scalar> > stepper,
const typename StepperForwardEulerAppAction<Scalar>::ACTION_LOCATION actLoc)
{ this->modify(sh, stepper, actLoc); }

public:

/// Modify ForwardEuler Stepper.
virtual void modify(
Teuchos::RCP<SolutionHistory<Scalar> > /* sh */,
Teuchos::RCP<StepperForwardEuler<Scalar> > /* stepper */,
const typename StepperForwardEulerAppAction<Scalar>::ACTION_LOCATION actLoc) = 0;

};

} // namespace Tempus

#endif // Tempus_StepperForwardEulerModifierBase_hpp
Loading

0 comments on commit 8505e85

Please sign in to comment.