BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Prism Class Reference
Collaboration diagram for Prism:

Public Member Functions

 Prism ()=delete
 
 Prism (const Prism &)=delete
 
 Prism (bool symmetry_Ci, double height, const std::vector< kvector_t > &vertices)
 
double area () const
 
const std::vector< kvector_t > & vertices ()
 
complex_t evaluate_for_q (const cvector_t &q) const
 

Private Attributes

std::unique_ptr< PolyhedralFacem_base
 
double m_height
 
std::vector< kvector_tm_vertices
 

Detailed Description

Definition at line 22 of file Prism.h.

Constructor & Destructor Documentation

◆ Prism() [1/3]

Prism::Prism ( )
delete

◆ Prism() [2/3]

Prism::Prism ( const Prism )
delete

◆ Prism() [3/3]

Prism::Prism ( bool  symmetry_Ci,
double  height,
const std::vector< kvector_t > &  vertices 
)

The mathematics implemented here is described in full detail in a paper by Joachim Wuttke, entitled "Form factor (Fourier shape transform) of polygon and polyhedron.".

Definition at line 23 of file Prism.cpp.

24 {
25  m_height = height;
26  m_vertices.clear();
27  for (const kvector_t& vertex : vertices) {
28  m_vertices.push_back(vertex);
29  m_vertices.push_back(vertex + kvector_t{0, 0, m_height});
30  }
31 
32  try {
33  m_base = std::unique_ptr<PolyhedralFace>(new PolyhedralFace(vertices, symmetry_Ci));
34  } catch (std::invalid_argument& e) {
35  throw std::invalid_argument(std::string("Invalid parameterization of Prism: ") + e.what());
36  } catch (std::logic_error& e) {
37  throw std::logic_error(std::string("Bug in Prism: ") + e.what()
38  + " [please report to the maintainers]");
39  } catch (std::exception& e) {
40  throw std::runtime_error(std::string("Unexpected exception in Prism: ") + e.what()
41  + " [please report to the maintainers]");
42  }
43 }
A polygon, for form factor computation.
std::unique_ptr< PolyhedralFace > m_base
Definition: Prism.h:33
double m_height
Definition: Prism.h:34
std::vector< kvector_t > m_vertices
Definition: Prism.h:35
const std::vector< kvector_t > & vertices()
Definition: Prism.cpp:50

References anonymous_namespace{BoxCompositionBuilder.cpp}::height, m_base, m_height, m_vertices, and vertices().

Here is the call graph for this function:

Member Function Documentation

◆ area()

double Prism::area ( ) const

Definition at line 45 of file Prism.cpp.

46 {
47  return m_base->area();
48 }

References m_base.

◆ vertices()

const std::vector< kvector_t > & Prism::vertices ( )

Definition at line 50 of file Prism.cpp.

51 {
52  return m_vertices;
53 }

References m_vertices.

Referenced by Prism().

◆ evaluate_for_q()

complex_t Prism::evaluate_for_q ( const cvector_t q) const

needed for topZ, bottomZ computation

Definition at line 55 of file Prism.cpp.

56 {
57  try {
58 #ifdef POLYHEDRAL_DIAGNOSTIC
59  diagnosis.maxOrder = 0;
60  diagnosis.nExpandedFaces = 0;
61 #endif
62  cvector_t qxy(q.x(), q.y(), 0.);
63  return m_height * exp_I(m_height / 2 * q.z()) * MathFunctions::sinc(m_height / 2 * q.z())
64  * m_base->ff_2D(qxy);
65  } catch (std::logic_error& e) {
66  throw std::logic_error(std::string("Bug in Prism: ") + e.what()
67  + " [please report to the maintainers]");
68  } catch (std::runtime_error& e) {
69  throw std::runtime_error(std::string("Numeric computation failed in Prism: ") + e.what()
70  + " [please report to the maintainers]");
71  } catch (std::exception& e) {
72  throw std::runtime_error(std::string("Unexpected exception in Prism: ") + e.what()
73  + " [please report to the maintainers]");
74  }
75 }
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Definition: Complex.h:30
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:68
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:66
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:64
double sinc(double x)
sinc function:

References exp_I(), m_base, m_height, MathFunctions::sinc(), BasicVector3D< T >::x(), BasicVector3D< T >::y(), and BasicVector3D< T >::z().

Here is the call graph for this function:

Member Data Documentation

◆ m_base

std::unique_ptr<PolyhedralFace> Prism::m_base
private

Definition at line 33 of file Prism.h.

Referenced by area(), evaluate_for_q(), and Prism().

◆ m_height

double Prism::m_height
private

Definition at line 34 of file Prism.h.

Referenced by evaluate_for_q(), and Prism().

◆ m_vertices

std::vector<kvector_t> Prism::m_vertices
private

Definition at line 35 of file Prism.h.

Referenced by Prism(), and vertices().


The documentation for this class was generated from the following files: