Skip to content
Snippets Groups Projects
Commit cbc6dc43 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

comments; mv local fcts to top of file

parent 134e3cb9
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,8 @@ void runComputations(std::vector<std::unique_ptr<IComputation>> computations) ...@@ -114,6 +114,8 @@ void runComputations(std::vector<std::unique_ptr<IComputation>> computations)
} // namespace } // namespace
// ************************************************************************** //
// class Simulation
// ************************************************************************** // // ************************************************************************** //
Simulation::Simulation() Simulation::Simulation()
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
#endif // SWIG #endif // SWIG
private: private:
SpecularSimulation(const SpecularSimulation& other); SpecularSimulation(const SpecularSimulation& other); // used by clone()
//! Initializes the vector of Simulation elements //! Initializes the vector of Simulation elements
void initSimulationElementVector() override; void initSimulationElementVector() override;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit scattering at grazing incidence // BornAgain: simulate and fit scattering at grazing incidence
// //
//! @file Sample/Slice/KzComputation.cpp //! @file Sample/Slice/KzComputation.cpp
//! @brief Implements functions from KzComputation namespace. //! @brief Implements functions in namespace KzComputation.
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -18,12 +18,26 @@ ...@@ -18,12 +18,26 @@
namespace namespace
{ {
complex_t normalizedSLD(const Material& material); complex_t normalizedSLD(const Material& material)
{
if (material.typeID() != MATERIAL_TYPES::MaterialBySLD)
throw std::runtime_error("Error in normalizedSLD: passed material has wrong type");
complex_t sld = std::conj(material.materialData()) / (Units::angstrom * Units::angstrom);
sld *= 4.0 * M_PI;
return sld;
}
// use small imaginary value if passed argument is very small complex_t checkForUnderflow(complex_t val)
complex_t checkForUnderflow(complex_t val); {
return std::norm(val) < 1e-80 ? complex_t(0.0, 1e-40) : val;
}
} // namespace } // namespace
// ************************************************************************** //
// namespace KzComputatin
// ************************************************************************** //
std::vector<complex_t> KzComputation::computeReducedKz(const std::vector<Slice>& slices, std::vector<complex_t> KzComputation::computeReducedKz(const std::vector<Slice>& slices,
kvector_t k) kvector_t k)
{ {
...@@ -77,21 +91,3 @@ std::vector<complex_t> KzComputation::computeKzFromRefIndices(const std::vector< ...@@ -77,21 +91,3 @@ std::vector<complex_t> KzComputation::computeKzFromRefIndices(const std::vector<
} }
return kz; return kz;
} }
namespace
{
complex_t normalizedSLD(const Material& material)
{
if (material.typeID() != MATERIAL_TYPES::MaterialBySLD)
throw std::runtime_error("Error in normalizedSLD: passed material has wrong type");
complex_t sld = std::conj(material.materialData()) / (Units::angstrom * Units::angstrom);
sld *= 4.0 * M_PI;
return sld;
}
complex_t checkForUnderflow(complex_t val)
{
return std::norm(val) < 1e-80 ? complex_t(0.0, 1e-40) : val;
}
} // namespace
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit scattering at grazing incidence // BornAgain: simulate and fit scattering at grazing incidence
// //
//! @file Sample/Slice/KzComputation.h //! @file Sample/Slice/KzComputation.h
//! @brief Declares functions from KzComputation namespace. //! @brief Declares functions in namespace KzComputation.
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment