OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
PyDistribution.cpp
Go to the documentation of this file.
1//
2// Python API for Distribution
3//
4// Copyright (c) 2023, Chris Rogers, STFC Rutherford Appleton Laboratory, Didcot, UK
5//
6// This file is part of OPAL.
7//
8// OPAL is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12//
13// You should have received a copy of the GNU General Public License
14// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
15//
16
21
22namespace PyOpal {
23 template <>
24 std::vector<PyOpalObjectNS::AttributeDef>
26 {"TYPE", "type", "", PyOpalObjectNS::PREDEFINED_STRING},
27 {"FNAME", "filename", "", PyOpalObjectNS::STRING},
28 {"INPUTMOUNITS", "momentum_units", "", PyOpalObjectNS::PREDEFINED_STRING},
29 };
30
31 namespace PyDistributionNS {
32
38
39 BOOST_PYTHON_MODULE(distribution) {
43 auto distributionClass = distributionObject.make_class("Distribution");
44 distributionObject.addExecute(distributionClass);
45 distributionClass.def("register", &registerDistribution);
46 }
47
48 } // namespace PyDistributionNS
49} // namespace PyOpal
void Initialise()
Definition Globals.cpp:50
void registerDistribution(PyOpalObjectNS::PyOpalObject< Distribution > &dist)
BOOST_PYTHON_MODULE(distribution)
The base class for all OPAL objects.
Definition Object.h:48
virtual void update()
Update this object.
Definition Object.cpp:263
static OpalData * getInstance()
Definition OpalData.cpp:196
void define(Object *newObject)
Define a new object.
Definition OpalData.cpp:489
static std::vector< AttributeDef > attributes
std::shared_ptr< C > getOpalShared()
boost::python::class_< PyC > make_class(const char *className)
void addExecute(PYCLASS &pyclass)