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#include "MantidKernel/V3D.h"
15
16namespace Mantid {
17//-----------------------------------------------------------------------------
18// Geometry forward declarations
19//------------------------------------------------------------------------------
20namespace Geometry {
21class CrystalStructure;
22class OrientedLattice;
23class SampleEnvironment;
24} // namespace Geometry
25
26namespace API {
27
33class MANTID_API_DLL Sample {
34public:
35 Sample();
36 Sample(const Sample &copy);
38 Sample &operator=(const Sample &rhs);
39
40 void saveNexus(::NeXus::File *file, const std::string &group) const;
41 int loadNexus(::NeXus::File *file, const std::string &group);
42
44 Sample &operator[](const int index);
46 std::size_t size() const;
48 void addSample(const std::shared_ptr<Sample> &childSample);
49
51 const std::string &getName() const;
53 void setName(const std::string &name);
55 bool hasShape() const;
57 const Geometry::IObject &getShape() const;
59 const Geometry::IObject_sptr getShapePtr() const;
61 void setShape(const Geometry::IObject_sptr &shape);
62
66 const Kernel::Material &getMaterial() const;
68
71 bool hasEnvironment() const;
73 const Geometry::SampleEnvironment &getEnvironment() const;
75 void setEnvironment(std::shared_ptr<Geometry::SampleEnvironment> env);
77
81 const Geometry::OrientedLattice &getOrientedLattice() const;
83 Geometry::OrientedLattice &getOrientedLattice();
86 void setOrientedLattice(std::unique_ptr<Geometry::OrientedLattice> lattice);
87 bool hasOrientedLattice() const;
89
92 const Geometry::CrystalStructure &getCrystalStructure() const;
93 void setCrystalStructure(const Geometry::CrystalStructure &newCrystalStructure);
94 bool hasCrystalStructure() const;
95 void clearCrystalStructure();
97
98 // Required for SANS work until we define a proper
99 // sample object from the raw file information
102
103 void setGeometryFlag(int geom_id);
105 int getGeometryFlag() const;
107 void setThickness(double thick);
109 double getThickness() const;
111 void setHeight(double height);
113 double getHeight() const;
115 void setWidth(double width);
117 double getWidth() const;
119
120 void clearOrientedLattice();
121
122 bool operator==(const Sample &other) const;
123 bool operator!=(const Sample &other) const;
124
125private:
127 std::string m_name;
131 std::shared_ptr<Geometry::SampleEnvironment> m_environment;
133 std::unique_ptr<Geometry::OrientedLattice> m_lattice;
134
136 std::unique_ptr<Geometry::CrystalStructure> m_crystalStructure;
137
139 std::vector<std::shared_ptr<Sample>> m_samples;
140
144 double m_thick;
146 double m_height;
148 double m_width;
149};
150
151} // namespace API
152} // namespace Mantid
const std::vector< double > & rhs
double height
Definition: GetAllEi.cpp:155
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
std::string getName(const IMDDimension &self)
This class stores information about the sample used in particular run.
Definition: Sample.h:33
double m_width
The sample width from the SPB_STRUCT in the raw file.
Definition: Sample.h:148
double m_thick
The sample thickness from the SPB_STRUCT in the raw file.
Definition: Sample.h:144
std::string m_name
The sample name.
Definition: Sample.h:127
std::unique_ptr< Geometry::OrientedLattice > m_lattice
Pointer to the OrientedLattice of the sample, NULL if not set.
Definition: Sample.h:133
std::shared_ptr< Geometry::SampleEnvironment > m_environment
An owned pointer to the SampleEnvironment object.
Definition: Sample.h:131
~Sample()
Destructor.
std::unique_ptr< Geometry::CrystalStructure > m_crystalStructure
CrystalStructure of the sample.
Definition: Sample.h:136
std::vector< std::shared_ptr< Sample > > m_samples
Vector of child samples.
Definition: Sample.h:139
int m_geom_id
The sample geometry flag.
Definition: Sample.h:142
double m_height
The sample height from the SPB_STRUCT in the raw file.
Definition: Sample.h:146
Geometry::IObject_sptr m_shape
The sample shape object.
Definition: Sample.h:129
Three components are required to describe a crystal structure:
IObject : Interface for geometry objects.
Definition: IObject.h:41
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:92
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)