16#include <boost/python/class.hpp>
17#include <boost/python/copy_const_reference.hpp>
18#include <boost/python/register_ptr_to_python.hpp>
31 register_ptr_to_python<Sample *>();
32 register_ptr_to_python<std::shared_ptr<Sample>>();
34 class_<Sample, boost::noncopyable>(
"Sample")
35 .def(
"getName", &
Sample::getName, return_value_policy<copy_const_reference>(), arg(
"self"),
36 "Returns the string name of the sample")
38 return_value_policy<reference_existing_object>(),
"Get the oriented lattice for this sample")
40 "Returns True if this sample has an oriented lattice, false "
43 "Clears any attached lattice information")
45 return_value_policy<reference_existing_object>(),
"Get the crystal structure for this sample")
47 "Returns True if this sample has a crystal structure, false "
50 "Assign a crystal structure object to the sample.")
52 "Removes the internally stored crystal structure.")
53 .def(
"size", &
Sample::size, arg(
"self"),
"Return the number of samples contained within this sample")
60 .def(
"getMaterial", &
Sample::getMaterial, arg(
"self"),
"The material the sample is composed of",
61 return_value_policy<reference_existing_object>())
63 .def(
"setThickness", &
Sample::setThickness, (arg(
"self"), arg(
"thick")),
"Set the thickness in mm.")
64 .def(
"setHeight", &
Sample::setHeight, (arg(
"self"), arg(
"height")),
"Set the height in mm.")
65 .def(
"setWidth", &
Sample::setWidth, (arg(
"self"), arg(
"width")),
"Set the width in mm.")
66 .def(
"getShape", &
Sample::getShape, arg(
"self"),
"Returns a shape of a Sample object.",
67 return_value_policy<reference_existing_object>())
68 .def(
"setShape", &
Sample::setShape, arg(
"self"),
"Set shape of Sample object.")
70 "Returns True if the sample has an environment defined")
71 .def(
"hasShape", &
Sample::hasShape, arg(
"self"),
"Returns True if the sample has a shape defined")
72 .def(
"getEnvironment", &
Sample::getEnvironment, return_value_policy<reference_existing_object>(), arg(
"self"),
73 "Returns the sample environment")
77 .def(
"__len__", &
Sample::size, arg(
"self"),
"Gets the number of samples in this collection")
78 .def(
"__getitem__", &Sample::operator[], (arg(
"self"), arg(
"index")), return_internal_reference<>())
79 .def(
"__copy__", &Mantid::PythonInterface::generic__copy__<Sample>)
80 .def(
"__deepcopy__", &Mantid::PythonInterface::generic__deepcopy__<Sample>)
81 .def(
"__eq__", &Sample::operator==, (arg(
"self"), arg(
"other")));
#define GET_POINTER_SPECIALIZATION(TYPE)
This class stores information about the sample used in particular run.
void setShape(const Geometry::IObject_sptr &shape)
Update the shape of the object.
void clearOrientedLattice()
Delete the oriented lattice.
const Kernel::Material & getMaterial() const
Return the material (convenience method)
bool hasEnvironment() const
const std::string & getName() const
Returns the name of the sample.
const Geometry::IObject & getShape() const
Return the sample shape.
void setEnvironment(std::shared_ptr< Geometry::SampleEnvironment > env)
Set the environment used to contain the sample.
int getGeometryFlag() const
Returns the geometry flag.
const Geometry::OrientedLattice & getOrientedLattice() const
Get a reference to the sample's OrientedLattice.
void setCrystalStructure(const Geometry::CrystalStructure &newCrystalStructure)
Resets the internal pointer to the new CrystalStructure (it's copied).
bool hasOrientedLattice() const
void setGeometryFlag(int geom_id)
Sets the geometry flag.
std::size_t size() const
the number of samples
void setWidth(double width)
Sets the width.
double getWidth() const
Returns the width.
bool hasCrystalStructure() const
Returns true if the sample actually holds a CrystalStructure.
void setHeight(double height)
Sets the height.
double getHeight() const
Returns the height.
void clearCrystalStructure()
Destroys the internally stored CrystalStructure-object.
const Geometry::SampleEnvironment & getEnvironment() const
Get a reference to the sample's environment.
void setThickness(double thick)
Sets the thickness.
const Geometry::CrystalStructure & getCrystalStructure() const
double getThickness() const
Returns the thickness.
bool hasShape() const
Check if sample has a valid shape.
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...