SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CircularlySymmetricModelComponent.icpp
Go to the documentation of this file.
1 
23 #include <utility> // for std::forward
24 #include <cmath> // for std::sqrt, std::cos, std::sin
25 #include <tuple> // for std::tie
26 #include <functional> // for std::ref
27 
28 namespace ModelFitting {
29 
30 template <typename Profile>
31 template <typename... ProfileParameters>
34  ProfileParameters&&... proj_parameters)
35  : m_sharp_manager{std::move(sharp_manager)},
36  m_profile(std::forward<ProfileParameters>(proj_parameters)...) {
37 }
38 
39 template <typename Profile>
41 
42 template <typename Profile>
44  return m_profile(std::sqrt(x*x + y*y));
45 }
46 
47 template <typename Profile>
49  double scale, double r_max) {
50  m_sharp_manager->updateRasterizationInfo(scale, r_max, std::ref(m_profile));
51 }
52 
53 template <typename Profile>
56  std::vector<ModelSample> result {};
57  double r1 {0.};
58  for (double r2=0.; m_sharp_manager->insideSharpRegion(r2); r1=r2) {
59  int angle_no {0};
60  std::tie(r2, angle_no) = m_sharp_manager->nextRadiusAndAngleNo(r1);
61  double r_half = (r1 + r2) / 2.;
62  double area = M_PI * (r2*r2 - r1*r1);
63  double integral = m_profile(r_half) * area / angle_no;
64  double angle_step = 2 * M_PI / angle_no;
65  for (double angle=0.; angle_no!=0; --angle_no, angle+=angle_step) {
66  double x = r_half * std::cos(angle);
67  double y = r_half * std::sin(angle);
68  result.emplace_back(x, y, integral);
69  }
70  }
71  return result;
72 }
73 
74 template <typename Profile>
76  return m_sharp_manager->insideSharpRegion(std::sqrt(x*x + y*y));
77 }
78 
79 } // end of namespace ModelFitting
T tie(T...args)
virtual void updateRasterizationInfo(double scale, double r_max)
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
T sin(T...args)
T cos(T...args)
T move(T...args)
CircularlySymmetricModelComponent(std::unique_ptr< SharpRegionManager > sharp_manager, ProfileParameters &&...proj_parameters)
STL class.
STL class.
T ref(T...args)
T sqrt(T...args)