https://mooseframework.inl.gov
Loading...
Searching...
No Matches
OptimizationInfo.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "GeneralReporter.h"
13#include "OptimizeSolve.h"
14
15class Optimize;
16
18{
19public:
21
23
24 virtual void initialize() override {}
25 virtual void execute() override;
26 virtual void finalize() override {}
27
28private:
31
32 std::vector<double> & _functionValue;
33 std::vector<double> & _gnorm;
34 std::vector<double> & _cnorm;
35 std::vector<double> & _xdiff;
36 std::vector<int> & _currentIterate;
37 std::vector<int> & _objectiveIterate;
38 std::vector<int> & _gradientIterate;
39 std::vector<int> & _hessianIterate;
40 std::vector<int> & _functionSolves;
41
42 // Helper to perform optional declaration based on "_items" from MeshInfo.h
43 template <typename T>
44 T & declareHelper(const std::string & item_name, const ReporterMode mode);
45};
46
47template <typename T>
48T &
49OptimizationInfo::declareHelper(const std::string & item_name, const ReporterMode mode)
50{
51 if (!_items.isValid() || _items.isValueSet(item_name))
52 {
53 return declareValueByName<T>(item_name, mode);
54 }
55
56 return declareUnusedValue<T>();
57}
const double T
const InputParameters & parameters() const
bool isValueSet(const std::string &value) const
virtual bool isValid() const override
std::vector< double > & _xdiff
Optimize * _optimization_executioner
std::vector< int > & _gradientIterate
const MultiMooseEnum & _items
virtual void execute() override
std::vector< int > & _currentIterate
std::vector< int > & _functionSolves
std::vector< double > & _functionValue
std::vector< int > & _objectiveIterate
std::vector< double > & _gnorm
static InputParameters validParams()
std::vector< double > & _cnorm
T & declareHelper(const std::string &item_name, const ReporterMode mode)
virtual void finalize() override
virtual void initialize() override
std::vector< int > & _hessianIterate