Skip to content

Commit

Permalink
#688: move instance_or_reference_wrapper to nonlinearsolvers::impl
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Sep 26, 2024
1 parent 825d617 commit 0a19d8c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ExplicitStepperWithMassMatrixImpl

private:
StepScheme name_;
::pressio::utils::InstanceOrReferenceWrapper<SystemType> systemObj_;
::pressio::nonlinearsolvers::impl::InstanceOrReferenceWrapper<SystemType> systemObj_;
RightHandSideType rhsInstance_;

// xInstances is a container of instances of states
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ExplicitStepperNoMassMatrixImpl{

private:
StepScheme name_;
::pressio::utils::InstanceOrReferenceWrapper<SystemType> systemObj_;
::pressio::nonlinearsolvers::impl::InstanceOrReferenceWrapper<SystemType> systemObj_;
std::vector<RightHandSideType> rhsInstances_;
StateType auxiliaryState_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class ResidualJacobianWithMassMatrixStandardPolicy
}

private:
::pressio::utils::InstanceOrReferenceWrapper<SystemType> systemObj_;
::pressio::nonlinearsolvers::impl::InstanceOrReferenceWrapper<SystemType> systemObj_;
mutable int32_t stepTracker_ = -1;
mutable StateType scratchState_;
mutable MassMatrixType massMatrix_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class ResidualJacobianStandardPolicy
}

private:
::pressio::utils::InstanceOrReferenceWrapper<SystemType> systemObj_;
::pressio::nonlinearsolvers::impl::InstanceOrReferenceWrapper<SystemType> systemObj_;
mutable int32_t stepTracker_ = -1;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class StepperArbitrary
IndVarType dt_ = {};
typename StepCount::value_type stepNumber_ = {};

::pressio::utils::InstanceOrReferenceWrapper<SystemType> systemObj_;
::pressio::nonlinearsolvers::impl::InstanceOrReferenceWrapper<SystemType> systemObj_;
stencil_states_t stencilStates_;
// state object to ensure the strong guarantee for handling excpetions
StateType recoveryState_;
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/ode/impl/ode_implicit_stepper_standard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ImplicitStepperStandardImpl
// for cn : y_n
ImplicitStencilStatesDynamicContainer<StateType> stencil_states_;

::pressio::utils::InstanceOrReferenceWrapper<ResidualJacobianPolicyType> rj_policy_;
::pressio::nonlinearsolvers::impl::InstanceOrReferenceWrapper<ResidualJacobianPolicyType> rj_policy_;

// stencilRightHandSide contains:
// for bdf1,2: nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// ************************************************************************
//
// utils_instance_or_reference_wrapper.hpp
// instance_or_reference_wrapper.hpp
// Pressio
// Copyright 2019
// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
Expand Down Expand Up @@ -46,12 +46,10 @@
//@HEADER
*/

#ifndef UTILS_UTILS_INSTANCE_OR_REFERENCE_WRAPPER_HPP_
#define UTILS_UTILS_INSTANCE_OR_REFERENCE_WRAPPER_HPP_
#ifndef SOLVERS_NONLINEAR_INSTANCE_OR_REFERENCE_WRAPPER_HPP_
#define SOLVERS_NONLINEAR_INSTANCE_OR_REFERENCE_WRAPPER_HPP_

#include <iostream>

namespace pressio{ namespace utils{
namespace pressio{ namespace nonlinearsolvers{ namespace impl{

template <class T>
class InstanceOrReferenceWrapper;
Expand Down Expand Up @@ -126,5 +124,5 @@ class InstanceOrReferenceWrapper<T const &>
T const& get() const { return refObj_.get(); }
};

}} // end of namespace pressio::utils
#endif // UTILS_UTILS_INSTANCE_OR_REFERENCE_WRAPPER_HPP_
}}} // end of namespace pressio::nonlinearsolvers
#endif // SOLVERS_NONLINEAR_INSTANCE_OR_REFERENCE_WRAPPER_HPP_
13 changes: 7 additions & 6 deletions include/pressio/solvers_nonlinear/impl/registries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define SOLVERS_REGISTRIES_HPP_

#include "levmar_damping.hpp"
#include "instance_or_reference_wrapper.hpp"

namespace pressio{
namespace nonlinearsolvers{
Expand Down Expand Up @@ -33,7 +34,7 @@ class RegistryNewton
state_t d2_;
r_t d3_;
j_t d4_;
utils::InstanceOrReferenceWrapper<InnSolverType> d5_;
InstanceOrReferenceWrapper<InnSolverType> d5_;
SystemType const * d6_;

public:
Expand Down Expand Up @@ -85,7 +86,7 @@ class RegistryGaussNewtonNormalEqs
j_t d4_;
gradient_t d5_;
hessian_t d6_;
utils::InstanceOrReferenceWrapper<InnSolverType> d7_;
InstanceOrReferenceWrapper<InnSolverType> d7_;
SystemType const * d8_;

public:
Expand Down Expand Up @@ -146,8 +147,8 @@ class RegistryWeightedGaussNewtonNormalEqs
j_t d6_;
gradient_t d7_;
hessian_t d8_;
utils::InstanceOrReferenceWrapper<InnSolverType> d9_;
utils::InstanceOrReferenceWrapper<WeightingOpType> d10_;
InstanceOrReferenceWrapper<InnSolverType> d9_;
InstanceOrReferenceWrapper<WeightingOpType> d10_;
SystemType const * d11_;

public:
Expand Down Expand Up @@ -211,7 +212,7 @@ class RegistryGaussNewtonQr
j_t d4_;
gradient_t d5_;
QTr_t d6_;
utils::InstanceOrReferenceWrapper<QRSolverType> d7_;
InstanceOrReferenceWrapper<QRSolverType> d7_;
SystemType const * d8_;

public:
Expand Down Expand Up @@ -273,7 +274,7 @@ class RegistryLevMarNormalEqs
hessian_t d6_;
hessian_t d7_;
lm_damp_t d8_;
utils::InstanceOrReferenceWrapper<InnSolverType> d9_;
InstanceOrReferenceWrapper<InnSolverType> d9_;
SystemType const * d10_;

public:
Expand Down
1 change: 0 additions & 1 deletion include/pressio/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include "./mpl.hpp"
#include <iomanip>

#include "./utils/utils_instance_or_reference_wrapper.hpp"
#include "./utils/logger/utils_logger.hpp"

#endif

0 comments on commit 0a19d8c

Please sign in to comment.