Mantid
Loading...
Searching...
No Matches
MaterialBuilder.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 +
8#include <boost/python/class.hpp>
9#include <boost/python/copy_const_reference.hpp>
10#include <boost/python/enum.hpp>
11#include <boost/python/implicit.hpp>
12#include <boost/python/make_function.hpp>
13#include <boost/python/register_ptr_to_python.hpp>
14#include <boost/python/return_arg.hpp>
15#include <boost/python/return_value_policy.hpp>
16
18using namespace boost::python;
19
21 register_ptr_to_python<MaterialBuilder *>();
22 register_ptr_to_python<std::shared_ptr<MaterialBuilder>>();
23
24 enum_<MaterialBuilder::NumberDensityUnit>("NumberDensityUnit")
27 .export_values();
28
29 class_<MaterialBuilder, boost::noncopyable>("MaterialBuilder")
30 .def("setName", &MaterialBuilder::setName, return_self<>(), (arg("self"), arg("name")),
31 "Set the string name given to the "
32 "material. Defaults to the chemical "
33 "formula.")
34 .def("setFormula", &MaterialBuilder::setFormula, return_self<>(), (arg("self"), arg("formula")),
35 "Set the chemical formula of the material")
36 .def("setAtomicNumber", &MaterialBuilder::setAtomicNumber, return_self<>(), (arg("self"), arg("atomicNumber")),
37 "Set the atomic number of the material")
38 .def("setMassNumber", &MaterialBuilder::setMassNumber, return_self<>(), (arg("self"), arg("massNumber")),
39 "Set the mass number of the material")
40 .def("setNumberDensity", &MaterialBuilder::setNumberDensity, return_self<>(), (arg("self"), arg("rho")),
41 "Set the number density of the material in atoms (default) or "
42 "formula units per Angstrom^3")
43 .def("setPackingFraction", &MaterialBuilder::setPackingFraction, return_self<>(), (arg("self"), arg("fraction")),
44 "Set the packing fraction of the material (default is 1). This is "
45 "used to infer the effective number density.")
46 .def("setNumberDensityUnit", &MaterialBuilder::setNumberDensityUnit, return_self<>(), (arg("self"), arg("unit")),
47 "Change the number density units from atoms per Angstrom^3 to the "
48 "desired unit")
49 .def("setZParameter", &MaterialBuilder::setZParameter, return_self<>(), (arg("self"), arg("zparam")),
50 "Set the number of formula units in a unit cell")
51 .def("setUnitCellVolume", &MaterialBuilder::setUnitCellVolume, return_self<>(), (arg("self"), arg("cellVolume")),
52 "Set the unit cell volume of the material")
53 .def("setMassDensity", &MaterialBuilder::setMassDensity, return_self<>(), (arg("self"), arg("massDensity")),
54 "Set the mass density of the material in g / cc")
55 .def("setTotalScatterXSection", &MaterialBuilder::setTotalScatterXSection, return_self<>(),
56 (arg("self"), arg("xsec")), "Set the total scattering cross section of the material in barns")
57 .def("setCoherentXSection", &MaterialBuilder::setCoherentXSection, return_self<>(), (arg("self"), arg("xsec")),
58 "Set the coherent cross section of the material in barns")
59 .def("setIncoherentXSection", &MaterialBuilder::setIncoherentXSection, return_self<>(),
60 (arg("self"), arg("xsec")), "Set the incoherent cross section of the material in barns")
61 .def("setAbsorptionXSection", &MaterialBuilder::setAbsorptionXSection, return_self<>(),
62 (arg("self"), arg("xsec")), "Set the absorption cross section of the material in barns")
63 .def("build", &MaterialBuilder::build, return_value_policy<return_by_value>(), (arg("self")),
64 "Build the new mantid.kernel.Material object from the current set "
65 "of options");
66}
void export_MaterialBuilder()
Create a material from a set of user defined options.
MaterialBuilder & setMassDensity(double massDensity)
Set the mass density of the sample in g / cc.
Material build() const
Build the new Material object from the current set of options.
MaterialBuilder & setName(const std::string &name)
Set the string name given to the material.
MaterialBuilder & setMassNumber(int massNumber)
Set the isotope by mass number.
MaterialBuilder & setFormula(const std::string &formula)
Set the chemical formula of the material.
MaterialBuilder & setZParameter(double zparam)
Set the number of formula units in the unit cell.
MaterialBuilder & setPackingFraction(double fraction)
Set the packing fraction of the material (default is 1).
MaterialBuilder & setTotalScatterXSection(double xsec)
Set a value for the total scattering cross section.
MaterialBuilder & setUnitCellVolume(double cellVolume)
Set the volume of unit cell.
MaterialBuilder & setAbsorptionXSection(double xsec)
Set a value for the absorption cross section.
MaterialBuilder & setNumberDensityUnit(NumberDensityUnit unit)
Set the unit for number density.
MaterialBuilder & setCoherentXSection(double xsec)
Set a value for the coherent scattering cross section.
MaterialBuilder & setIncoherentXSection(double xsec)
Set a value for the incoherent scattering cross section.
MaterialBuilder & setNumberDensity(double rho)
Set the number density of the sample in atoms or formula units / Angstrom^3.
MaterialBuilder & setAtomicNumber(int atomicNumber)
Set the type of atom by its atomic number.