Newer
Older
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
#ifndef MANTID_GEOMETRY_STRUCTUREFACTORCALCULATOR_H_
#define MANTID_GEOMETRY_STRUCTUREFACTORCALCULATOR_H_
#include "MantidGeometry/DllConfig.h"
#include "MantidGeometry/Crystal/CrystalStructure.h"
namespace Mantid {
namespace Geometry {
/** StructureFactorCalculator
This is a base class for concrete structure factor calculators. It is used
to logically separate this calculation from CrystalStructure so that different
methods of calculation can be used. For actual implementations please consult
the available sub-classes.
@author Michael Wedel, ESS
@date 05/09/2015
Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTID_GEOMETRY_DLL StructureFactorCalculator {
public:
virtual ~StructureFactorCalculator() = default;
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
void setCrystalStructure(const CrystalStructure &crystalStructure);
/// In implementations this method should return the structure factor for the
/// specified HKL.
virtual StructureFactor getF(const Kernel::V3D &hkl) const = 0;
virtual double getFSquared(const Kernel::V3D &hkl) const;
virtual std::vector<StructureFactor>
getFs(const std::vector<Kernel::V3D> &hkls) const;
virtual std::vector<double>
getFsSquared(const std::vector<Kernel::V3D> &hkls) const;
protected:
virtual void
crystalStructureSetHook(const CrystalStructure &crystalStructure);
};
typedef boost::shared_ptr<StructureFactorCalculator>
StructureFactorCalculator_sptr;
namespace StructureFactorCalculatorFactory {
/// Small templated factory function that creates the desired calculator
/// and initializes it by setting the crystal structure.
template <typename T>
StructureFactorCalculator_sptr
create(const CrystalStructure &crystalStructure) {
boost::shared_ptr<T> calculator = boost::make_shared<T>();
calculator->setCrystalStructure(crystalStructure);
return calculator;
}
}
} // namespace Geometry
} // namespace Mantid
#endif /* MANTID_GEOMETRY_STRUCTUREFACTORCALCULATOR_H_ */