AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Python.hpp
Go to the documentation of this file.
1/*
2 * This file is part of AQUAgpusph, a free CFD program based on SPH.
3 * Copyright (C) 2012 Jose Luis Cercos Pita <jl.cercos@upm.es>
4 *
5 * AQUAgpusph is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * AQUAgpusph is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with AQUAgpusph. If not, see <http://www.gnu.org/licenses/>.
17 */
18
23
24#ifndef PYTHON_H_INCLUDED
25#define PYTHON_H_INCLUDED
26
27#include <Python.h>
28#include "CalcServer.hpp"
29#include "Tool.hpp"
30
31namespace Aqua {
32namespace CalcServer {
33
44{
45 public:
51 Python(const std::string tool_name,
52 const std::string script,
53 bool once = false);
54
56 ~Python();
57
60 void setup();
61
62 protected:
67 cl_event _execute(const std::vector<cl_event> events);
68
75 void initPython();
76
79 void load();
80
81 private:
83 std::string _script;
84
86 PyObject* _module;
88 PyObject* _func;
89};
90
91}
92} // namespace
93
94#endif // PYTHON_H_INCLUDED
The calculation main entry point. (See Aqua::CalcServer::CalcServer for details)
Tools virtual environment to allow the user to define/manipulate the tools used to carry out the simu...
Python(const std::string tool_name, const std::string script, bool once=false)
Constructor.
Definition Python.cpp:262
cl_event _execute(const std::vector< cl_event > events)
Definition Python.cpp:301
void initPython()
Initialize the Python interpreter.
Definition Python.cpp:334
void load()
Load the script and extract the callable function.
Definition Python.cpp:365
void setup()
Initialize the tool.
Definition Python.cpp:289
~Python()
Destructor.
Definition Python.cpp:278
Tools base class.
Definition Tool.hpp:176
Calculation server name space.
Definition Assert.cpp:32
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50