AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Report.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 REPORTS_REPORT_H_INCLUDED
25#define REPORTS_REPORT_H_INCLUDED
26
28
29#include <vector>
32
33namespace Aqua {
34namespace CalcServer {
36namespace Reports {
37
50{
51 public:
60 Report(const std::string tool_name,
61 const std::string fields,
62 unsigned int ipf = 1,
63 float fps = 0.f);
64
67 virtual ~Report();
68
71 virtual void setup();
72
82 const std::string data(bool with_title = true, bool with_names = true, bool synced = false);
83
93 inline cl_event getUserEvent() const { return _user_event; }
94
102 inline void setUserEventStatus(cl_int status) const {
103 cl_int err_code;
104 // We need to store the user event so it is not getting overwritten
105 // between clSetUserEventStatus() and clReleaseEvent()
106 const cl_event user_event = getUserEvent();
107 err_code = clSetUserEventStatus(user_event, status);
108 CHECK_OCL_OR_THROW(err_code,
109 std::string("Failure setting as complete the tool \"") +
110 name() + "\".");
111 err_code = clReleaseEvent(user_event);
112 CHECK_OCL_OR_THROW(err_code,
113 std::string("Failure releasing the user event in tool \"") +
114 name() + "\".");
115 }
116
117 protected:
120 void processFields(const std::string fields);
121
125 std::vector<InputOutput::Variable*> variables() { return _vars; }
126
133 bool mustUpdate();
134
146 cl_event setCallback(const std::vector<cl_event> events,
147 void(CL_CALLBACK* cb)(cl_event, cl_int, void*));
148
149 private:
151 std::string _fields;
153 unsigned int _ipf;
155 float _fps;
157 unsigned int _iter;
159 float _t;
161 std::string _data;
163 std::vector<unsigned int> _vars_per_line;
165 std::vector<InputOutput::Variable*> _vars;
168 cl_event _user_event;
169};
170
171}
172}
173} // namespace
174
175#endif // REPORTS_REPORT_H_INCLUDED
#define CHECK_OCL_OR_THROW(err_code, msg)
Definition CalcServer.hpp:44
Tools virtual environment to allow the user to define/manipulate the tools used to carry out the simu...
Virtual variables environment to allow the user define/manipulate the variables used in the simulatio...
const std::string name() const
Get the name.
Definition Tool.hpp:71
virtual ~Report()
Destructor.
Definition Report.cpp:49
std::vector< InputOutput::Variable * > variables()
Get the variables list.
Definition Report.hpp:125
Report(const std::string tool_name, const std::string fields, unsigned int ipf=1, float fps=0.f)
Constructor.
Definition Report.cpp:34
void setUserEventStatus(cl_int status) const
Set the user event status.
Definition Report.hpp:102
cl_event setCallback(const std::vector< cl_event > events, void(CL_CALLBACK *cb)(cl_event, cl_int, void *))
Register a callback to be executed whenever it is possible.
Definition Report.cpp:164
cl_event getUserEvent() const
Get the user event generated by this tool to mark when is finished.
Definition Report.hpp:93
virtual void setup()
Initialize the tool.
Definition Report.cpp:56
void processFields(const std::string fields)
Compute the fields by lines.
Definition Report.cpp:94
const std::string data(bool with_title=true, bool with_names=true, bool synced=false)
Return the text string of the data to be printed.
Definition Report.cpp:63
bool mustUpdate()
Check if an output must be performed.
Definition Report.cpp:134
Tools base class.
Definition Tool.hpp:176
__kernel void fields(__global const unsigned int *iset, __global const uint *isplit, __global const usize *mybuffer, __global const unsigned int *ilevel, __global const float *split_weight, __global float *m0, __global float *m, __global vec *r, __global vec *u, __global vec *dudt, __global float *rho, __global float *drhodt, __constant float *dr_level0, usize N, LINKLIST_LOCAL_PARAMS)
Collect the children, and the seed itself, in order to compute the field values of the buffer partner...
Definition Coalesce.cl:426
Runtime outputs name space.
Definition Dump.cpp:34
Calculation server name space.
Definition Assert.cpp:32
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50
Set of definitions and macros related with the implementation.