BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ObjectiveFunctionAdapter.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Fit/Adapter/ObjectiveFunctionAdapter.h
6 //! @brief Declares class ObjectiveFunctionAdapter.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_FIT_ADAPTER_OBJECTIVEFUNCTIONADAPTER_H
21 #define BORNAGAIN_FIT_ADAPTER_OBJECTIVEFUNCTIONADAPTER_H
22 
23 #include "Fit/Minimizer/Types.h"
24 #include <memory>
25 
26 class RootScalarFunction;
28 
29 namespace mumufit {
30 
31 class IFunctionAdapter;
32 class Parameters;
33 
34 //! Converts user objective function to function ROOT expects.
35 //! Handles time of life of function objects.
36 
38 public:
41 
42  const RootScalarFunction* rootObjectiveFunction(fcn_scalar_t fcn, const Parameters& parameters);
43 
45  const Parameters& parameters);
46 
47  int numberOfCalls() const;
48  int numberOfGradientCalls() const;
49 
50 private:
51  std::unique_ptr<IFunctionAdapter> m_adapter;
52 };
53 
54 } // namespace mumufit
55 
56 #endif // BORNAGAIN_FIT_ADAPTER_OBJECTIVEFUNCTIONADAPTER_H
57 #endif // USER_API
Defines common types for fitting library.
std::function< double(const mumufit::Parameters &)> fcn_scalar_t
Definition: Types.h:39
std::function< std::vector< double >(const mumufit::Parameters &)> fcn_residual_t
Definition: Types.h:40
Minimizer function with access to single data element residuals, required by Fumili2 and GSLMultiMin ...
The chi2 function for use in minimizers.
Converts user objective function to function ROOT expects.
std::unique_ptr< IFunctionAdapter > m_adapter
const RootResidualFunction * rootResidualFunction(fcn_residual_t fcn, const Parameters &parameters)
const RootScalarFunction * rootObjectiveFunction(fcn_scalar_t fcn, const Parameters &parameters)
A collection of fit parameters.
Definition: Parameters.h:26
The multi-library, multi-algorithm fit wrapper library.