Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#688: Move utils_instance_or_reference_wrapper.hpp to solvers_nonlinear #689

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions include/pressio/solvers_nonlinear/impl/diagnostics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#ifndef SOLVERS_NONLINEAR_IMPL_DIAGNOSTICS_HPP_
#define SOLVERS_NONLINEAR_IMPL_DIAGNOSTICS_HPP_

#include <iostream>

namespace pressio{
namespace nonlinearsolvers{
namespace impl{
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::impl
#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
2 changes: 0 additions & 2 deletions include/pressio/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
#define PRESSIO_UTILS_HPP_

#include "./mpl.hpp"
#include <iomanip>

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

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//#include "pressio/ode_steppers_implicit.hpp"
#include "pressio/ode_advancers.hpp"

#include <iostream>

struct MyFakeSolver
{
template<typename system_t, typename state_t>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_gaussnewton.hpp"
#include "./problems/problem3.hpp"

#include <iomanip>

template <typename problem_t, typename state_t, typename solver>
void testC1(std::string & sentinel,
problem_t & problem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_gaussnewton.hpp"
#include "./problems/problem5.hpp"

#include <iomanip>

int main()
{
namespace plog = pressio::log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_gaussnewton.hpp"
#include "./problems/problem9.hpp"

#include <iomanip>

int main()
{
namespace plog = pressio::log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_gaussnewton.hpp"
#include "./problems/problem3.hpp"

#include <iomanip>

template <typename state_t, typename solver>
void testC1(std::string & sentinel,
state_t & x,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_gaussnewton.hpp"
#include "./problems/problem8.hpp"

#include <iomanip>

template <typename state_t, typename solver>
void testC1(std::string & sentinel,
state_t & x,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_levmarq.hpp"
#include "./problems/problem9.hpp"

#include <iomanip>

template <typename problem_t, typename solver_t>
void testC1(std::string & sentinel,
problem_t & problem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "pressio/solvers_nonlinear_gaussnewton.hpp"
#include "./problems/problem3.hpp"

#include <iomanip>

template<class scalar_t>
struct IdentityWeigher{

Expand Down