1 |
|
2 |
/******************************************************* |
3 |
* |
4 |
* Copyright (c) 2003-2010 by University of Queensland |
5 |
* Earth Systems Science Computational Center (ESSCC) |
6 |
* http://www.uq.edu.au/esscc |
7 |
* |
8 |
* Primary Business: Queensland, Australia |
9 |
* Licensed under the Open Software License version 3.0 |
10 |
* http://www.opensource.org/licenses/osl-3.0.php |
11 |
* |
12 |
*******************************************************/ |
13 |
|
14 |
|
15 |
#include <escript/Data.h> |
16 |
|
17 |
#include <weipa/EscriptDataset.h> |
18 |
#include <weipa/VisItControl.h> |
19 |
|
20 |
#include <boost/python.hpp> |
21 |
#include <boost/python/module.hpp> |
22 |
#include <boost/python/def.hpp> |
23 |
#include <boost/python/object.hpp> |
24 |
#include <boost/version.hpp> |
25 |
|
26 |
using namespace boost::python; |
27 |
|
28 |
/*! \page weipa Weipa |
29 |
* Weipa is the python module that contains the interfaces |
30 |
* to the C++ side of the escript data exporter. |
31 |
* |
32 |
* |
33 |
* |
34 |
* \section class_desc Class Description: |
35 |
* None |
36 |
* |
37 |
* \section class_limits Class Limitations: |
38 |
* None |
39 |
* |
40 |
* \section class_conds Class Conditions of Use: |
41 |
* None |
42 |
* |
43 |
* \section class_throws Throws: |
44 |
* None |
45 |
* |
46 |
*/ |
47 |
|
48 |
BOOST_PYTHON_MODULE(weipacpp) |
49 |
{ |
50 |
#if BOOST_VERSION >= 103500 |
51 |
// params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures |
52 |
docstring_options docopt(true,true,false); |
53 |
#endif |
54 |
|
55 |
class_<weipa::EscriptDataset>("EscriptDataset","Represents an escript dataset including a domain and data variables for one timestep. It is used for exporting", init<>()) |
56 |
.def("setDomain", &weipa::EscriptDataset::setDomain) |
57 |
.def("addData", &weipa::EscriptDataset::addData, (arg("data"), arg("name"), arg("units")="")) |
58 |
.def("setCycleAndTime", &weipa::EscriptDataset::setCycleAndTime, args("cycle","time")) |
59 |
.def("setMeshLabels", &weipa::EscriptDataset::setMeshLabels, (arg("x"),arg("y"),arg("z")="")) |
60 |
.def("setMeshUnits", &weipa::EscriptDataset::setMeshUnits, (arg("x"),arg("y"),arg("z")="")) |
61 |
.def("setMetadataSchemaString", &weipa::EscriptDataset::setMetadataSchemaString, (arg("schema")="", arg("metadata")="")) |
62 |
.def("saveSilo", &weipa::EscriptDataset::saveSilo, (arg("filename"), arg("useMultimesh")=true)) |
63 |
.def("saveVTK", &weipa::EscriptDataset::saveVTK, args("filename")); |
64 |
|
65 |
// VisIt Control |
66 |
def("visitInitialize", weipa::VisItControl::initialize, (arg("simFile"), arg("comment")="")); |
67 |
def("visitPublishData", weipa::VisItControl::publishData, args("dataset")); |
68 |
} |
69 |
|