Newer
Older
#ifndef MANTID_API_SAMPLE_H_
#define MANTID_API_SAMPLE_H_
Gigg, Martyn Anthony
committed
//-----------------------------------------------------------------------------
Gigg, Martyn Anthony
committed
//------------------------------------------------------------------------------
Gigg, Martyn Anthony
committed
#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/Objects/Object.h"
#include "MantidKernel/V3D.h"
Janik Zikovsky
committed
namespace Mantid {
//-----------------------------------------------------------------------------
// Geometry forward declarations
//------------------------------------------------------------------------------
namespace Geometry {
class OrientedLattice;
class CrystalStructure;
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
namespace API {
//-----------------------------------------------------------------------------
// API forward declarations
//------------------------------------------------------------------------------
class SampleEnvironment;
/**
This class stores information about the sample used in particular
run. It is a type of ObjComponent meaning it has a shape, a position
and a material.
Copyright © 2007-2012 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_API_DLL Sample {
public:
Sample();
Sample(const Sample ©);
~Sample();
Sample &operator=(const Sample &rhs);
void saveNexus(::NeXus::File *file, const std::string &group) const;
int loadNexus(::NeXus::File *file, const std::string &group);
/// index operator for accessing multiple samples
Sample &operator[](const int index);
/// the number of samples
std::size_t size() const;
/// Adds a sample to the list
void addSample(boost::shared_ptr<Sample> childSample);
/// Returns the name of the sample
const std::string &getName() const;
/// Set the name of the sample
void setName(const std::string &name);
/// Return the sample shape
const Geometry::Object &getShape() const;
/// Update the shape of the object
void setShape(const Geometry::Object &shape);
/** @name Material properties.*/
//@{
/// Return the material (convenience method)
const Kernel::Material &getMaterial() const;
//@}
/** @name Access the environment information */
//@{
/// Get a reference to the sample's environment
const SampleEnvironment &getEnvironment() const;
/// Set the environment used to contain the sample
void setEnvironment(SampleEnvironment *env);
//@}
/** @name Access the sample's lattice structure and orientation */
//@{
/// Get a reference to the sample's OrientedLattice
const Geometry::OrientedLattice &getOrientedLattice() const;
/// Get a reference to the sample's OrientedLattice
Geometry::OrientedLattice &getOrientedLattice();
/** Set the pointer to OrientedLattice defining the sample's lattice and
orientation.
No copying is done in the class, but the class deletes pointer on
destruction so the application, providing the pointer should not do it*/
void setOrientedLattice(Geometry::OrientedLattice *latt);
bool hasOrientedLattice() const;
//@}
/** @name Access the sample's crystal structure */
//@{
const Geometry::CrystalStructure &getCrystalStructure() const;
void setCrystalStructure(const Geometry::CrystalStructure &newCrystalStructure);
bool hasCrystalStructure() const;
void clearCrystalStructure();
//@}
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Required for SANS work until we define a proper
// sample object from the raw file information
/**@name Legacy functions */
//@{
/// Sets the geometry flag
void setGeometryFlag(int geom_id);
/// Returns the geometry flag
int getGeometryFlag() const;
/// Sets the thickness
void setThickness(double thick);
/// Returns the thickness
double getThickness() const;
/// Sets the height
void setHeight(double height);
/// Returns the height
double getHeight() const;
/// Sets the width
void setWidth(double width);
/// Returns the width
double getWidth() const;
//@}
/// Delete the oriented lattice
void clearOrientedLattice();
private:
/// The sample name
std::string m_name;
/// The sample shape object
Geometry::Object m_shape;
/// An owned pointer to the SampleEnvironment object
boost::shared_ptr<SampleEnvironment> m_environment;
/// Pointer to the OrientedLattice of the sample, NULL if not set.
Geometry::OrientedLattice *m_lattice;
/// CrystalStructure of the sample
std::unique_ptr<Geometry::CrystalStructure> m_crystalStructure;
/// Vector of child samples
std::vector<boost::shared_ptr<Sample>> m_samples;
/// The sample geometry flag
int m_geom_id;
/// The sample thickness from the SPB_STRUCT in the raw file
double m_thick;
/// The sample height from the SPB_STRUCT in the raw file
double m_height;
/// The sample width from the SPB_STRUCT in the raw file
double m_width;
};
} // namespace API
#endif /*MANTID_API_SAMPLE_H_*/