Mantid
Loading...
Searching...
No Matches
Sample.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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 +
7#pragma once
8
9//-----------------------------------------------------------------------------
10// Includes
11//------------------------------------------------------------------------------
12#include "MantidAPI/DllConfig.h"
14
15namespace Mantid {
16namespace Nexus {
17class File;
18}
19//-----------------------------------------------------------------------------
20// Geometry forward declarations
21//------------------------------------------------------------------------------
22namespace Geometry {
23class CrystalStructure;
24class OrientedLattice;
25class SampleEnvironment;
26} // namespace Geometry
27
28namespace API {
29
35class MANTID_API_DLL Sample {
36public:
37 Sample();
38 Sample(const Sample &copy);
40 Sample &operator=(const Sample &rhs);
41
42 void saveNexus(Nexus::File *file, const std::string &group) const;
43 int loadNexus(Nexus::File *file, const std::string &group);
44
46 Sample &operator[](const int index);
48 std::size_t size() const;
50 void addSample(const std::shared_ptr<Sample> &childSample);
51
53 const std::string &getName() const;
55 void setName(const std::string &name);
57 bool hasShape() const;
59 const Geometry::IObject &getShape() const;
61 const Geometry::IObject_sptr getShapePtr() const;
63 void setShape(const Geometry::IObject_sptr &shape);
64
68 const Kernel::Material &getMaterial() const;
70
73 bool hasEnvironment() const;
75 const Geometry::SampleEnvironment &getEnvironment() const;
77 void setEnvironment(std::shared_ptr<Geometry::SampleEnvironment> env);
79
83 const Geometry::OrientedLattice &getOrientedLattice() const;
85 Geometry::OrientedLattice &getOrientedLattice();
88 void setOrientedLattice(std::unique_ptr<Geometry::OrientedLattice> lattice);
89 bool hasOrientedLattice() const;
91
94 const Geometry::CrystalStructure &getCrystalStructure() const;
95 void setCrystalStructure(const Geometry::CrystalStructure &newCrystalStructure);
96 bool hasCrystalStructure() const;
97 void clearCrystalStructure();
99
100 // Required for SANS work until we define a proper
101 // sample object from the raw file information
104
105 void setGeometryFlag(int geom_id);
107 int getGeometryFlag() const;
109 void setThickness(double thick);
111 double getThickness() const;
113 void setHeight(double height);
115 double getHeight() const;
117 void setWidth(double width);
119 double getWidth() const;
121
122 void clearOrientedLattice();
123
124 bool operator==(const Sample &other) const;
125 bool operator!=(const Sample &other) const;
126
127private:
129 std::string m_name;
133 std::shared_ptr<Geometry::SampleEnvironment> m_environment;
135 std::unique_ptr<Geometry::OrientedLattice> m_lattice;
136
138 std::unique_ptr<Geometry::CrystalStructure> m_crystalStructure;
139
141 std::vector<std::shared_ptr<Sample>> m_samples;
142
146 double m_thick;
148 double m_height;
150 double m_width;
151};
152
153} // namespace API
154} // namespace Mantid
std::string name
Definition Run.cpp:60
const std::vector< double > & rhs
double height
Definition GetAllEi.cpp:155
std::map< DeltaEMode::Type, std::string > index
std::string getName(const IMDDimension &self)
This class stores information about the sample used in particular run.
Definition Sample.h:35
double m_width
The sample width from the SPB_STRUCT in the raw file.
Definition Sample.h:150
double m_thick
The sample thickness from the SPB_STRUCT in the raw file.
Definition Sample.h:146
std::string m_name
The sample name.
Definition Sample.h:129
std::unique_ptr< Geometry::OrientedLattice > m_lattice
Pointer to the OrientedLattice of the sample, NULL if not set.
Definition Sample.h:135
std::shared_ptr< Geometry::SampleEnvironment > m_environment
An owned pointer to the SampleEnvironment object.
Definition Sample.h:133
~Sample()
Destructor.
std::unique_ptr< Geometry::CrystalStructure > m_crystalStructure
CrystalStructure of the sample.
Definition Sample.h:138
std::vector< std::shared_ptr< Sample > > m_samples
Vector of child samples.
Definition Sample.h:141
int m_geom_id
The sample geometry flag.
Definition Sample.h:144
double m_height
The sample height from the SPB_STRUCT in the raw file.
Definition Sample.h:148
Geometry::IObject_sptr m_shape
The sample shape object.
Definition Sample.h:131
Three components are required to describe a crystal structure:
IObject : Interface for geometry objects.
Definition IObject.h:43
Class to implement UB matrix.
Defines a single instance of a SampleEnvironment.
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
Definition Material.h:50
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Definition IObject.h:106
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)