Mantid
Loading...
Searching...
No Matches
General.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9
10namespace Mantid::Geometry {
11
13 : Quadratic()
17{}
18
24{
25 return new General(*this);
26}
27
28std::unique_ptr<General> General::clone() const
33{
34 return std::unique_ptr<General>(doClone());
35}
36
37int General::setSurface(const std::string &Pstr)
49{
50 std::string Line = Pstr;
51 std::string item;
52 if (!Mantid::Kernel::Strings::section(Line, item) || item.length() != 2 ||
53 (tolower(item[0]) != 'g' && tolower(item[0] != 's')) || tolower(item[1]) != 'q')
54 return -1;
55
56 double num[10];
57 int index;
58 for (index = 0; index < 10 && Mantid::Kernel::Strings::section(Line, num[index]); index++)
59 ;
60 if (index != 10)
61 return -2;
62
63 if (tolower(item[0]) == 'g') {
64 for (int i = 0; i < 10; i++)
65 Quadratic::BaseEqn[i] = num[i];
66 } else {
67 Quadratic::BaseEqn[0] = num[0];
68 Quadratic::BaseEqn[1] = num[1];
69 Quadratic::BaseEqn[2] = num[2];
70 Quadratic::BaseEqn[3] = 0.0;
71 ;
72 Quadratic::BaseEqn[4] = 0.0;
73 ;
74 Quadratic::BaseEqn[5] = 0.0;
75 ;
76 Quadratic::BaseEqn[6] = 2 * (num[3] - num[7] * num[0]);
77 Quadratic::BaseEqn[7] = 2 * (num[4] - num[8] * num[1]);
78 Quadratic::BaseEqn[8] = 2 * (num[5] - num[9] * num[2]);
79 Quadratic::BaseEqn[9] = num[0] * num[7] * num[7] + num[1] * num[8] * num[8] + num[2] * num[9] * num[9] -
80 2.0 * (num[3] * num[7] + num[4] * num[8] + num[5] * num[9]) + num[6];
81 }
82 return 0;
83}
84
90{}
91
92void General::getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) {
108 UNUSED_ARG(xmax);
109 UNUSED_ARG(ymax);
110 UNUSED_ARG(zmax);
111 UNUSED_ARG(xmin);
112 UNUSED_ARG(ymin);
113 UNUSED_ARG(zmin);
114}
115
116} // namespace Mantid::Geometry
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
Holds a general quadratic surface.
Definition: General.h:28
int setSurface(const std::string &) override
Processes a standard MCNPX general string (GQ/SQ types) Despite type, moves both to the general equat...
Definition: General.cpp:37
void setBaseEqn() override
Set baseEqn (nothing to do) as it is already a baseEqn driven system.
Definition: General.cpp:85
void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override
bounding box for the surface
Definition: General.cpp:92
std::unique_ptr< General > clone() const
Makes a clone (implicit virtual copy constructor)
Definition: General.cpp:28
General()
Standard Constructor.
Definition: General.cpp:12
General * doClone() const override
Makes a clone (implicit virtual copy constructor)
Definition: General.cpp:19
Impliments a line.
Definition: Line.h:43
Holds a basic quadratic surface.
Definition: Quadratic.h:29
std::vector< double > BaseEqn
Base equation (as a 10 point vector)
Definition: Quadratic.h:35
int section(std::string &A, T &out)
Convert and cut a string.
Definition: Strings.cpp:573