[go: up one dir, main page]

File: IBody.h

package info (click to toggle)
libformfactor 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,288 kB
  • sloc: cpp: 17,289; python: 382; makefile: 15
file content (57 lines) | stat: -rw-r--r-- 1,915 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//  ************************************************************************************************
//
//  libformfactor: efficient and accurate computation of scattering form factors
//
//! @file      ff/IBody.h
//! @brief     Defines abstract base class IBody.
//!
//! @homepage  https://jugit.fz-juelich.de/mlz/libformfactor
//! @license   GNU General Public License v3 or higher (see LICENSE)
//! @copyright Forschungszentrum Jülich GmbH 2022
//! @author    Joachim Wuttke, Scientific Computing Group at MLZ (see CITATION)
//
//  ************************************************************************************************

#ifndef FORMFACTOR_FF_IBODY_H
#define FORMFACTOR_FF_IBODY_H

#include <heinz/Complex.h>
#include <heinz/Vectors3D.h>
#include <vector>

namespace ff {

class Topology;

//! This interface class is the base for all body shape classes

class IBody {
public:
    IBody(const R3& location) : m_location(location) {}
    virtual ~IBody() = default;

    //! Since data members are const, there is no good reason to copy.
    IBody(const IBody&) = delete;

    void move(const R3& location) { m_location += location; }

    virtual double volume() const = 0;
    virtual double radius() const = 0;                   //!< radius of enclosing sphere
    R3 location() const { return m_location; }           //!< position of center of mass
    virtual const std::vector<R3>& vertices() const = 0; //!< in absolute coordinates
    virtual double z_bottom() const = 0; //!< vertical distance between bottom and center
    virtual R3 center_of_mass() const = 0;

    complex_t formfactor(const C3& q) const;
    virtual complex_t formfactor_at_center(const C3& q) const = 0;

    //! Returns whether a point p is located inside of the body.
    // virtual bool is_inside(const R3& p, int nsamples = 2) const;

private:
    R3 m_location;
};

} // namespace ff

#endif // FORMFACTOR_FF_IBODY_H