AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
Conditional.h
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
24#ifndef IF_H_INCLUDED
25#define IF_H_INCLUDED
26
27#include <CalcServer/Tool.h>
28
29namespace Aqua {
30namespace CalcServer {
31
40{
41 public:
49 Conditional(const std::string name,
50 const std::string condition,
51 bool once = false);
52
55
58 void setup();
59
67 virtual Tool* next_tool();
68
73 const int scope_modifier() { return 1; }
74
75 protected:
80 cl_event _execute(const std::vector<cl_event> events);
81
82 private:
84 std::string _condition;
86 Tool* _ending_tool;
87
88 protected:
90 bool _result;
91};
92
99{
100 public:
108 While(const std::string name,
109 const std::string condition,
110 bool once = false);
111
113 ~While();
114
117 void setup();
118};
119
125{
126 public:
134 If(const std::string name, const std::string condition, bool once = false);
135
137 ~If();
138
141 void setup();
142
154 Tool* next_tool();
155
156 protected:
161 cl_event _execute(const std::vector<cl_event> events);
162};
163
171{
172 public:
177 End(const std::string name, bool once = false);
178
180 ~End();
181
184 void setup();
185
189 const int scope_modifier() { return -1; }
190};
191
192}
193} // namespace
194
195#endif // IF_H_INCLUDED
Tools virtual environment to allow the user to define/manipulate the tools used to carry out the simu...
Base class for conditional tools like While or If.
Definition: Conditional.h:40
~Conditional()
Destructor.
Definition: Conditional.cpp:44
cl_event _execute(const std::vector< cl_event > events)
Definition: Conditional.cpp:95
virtual Tool * next_tool()
Definition: Conditional.cpp:87
const int scope_modifier()
Definition: Conditional.h:73
bool _result
Condition result.
Definition: Conditional.h:90
void setup()
Initialize the tool.
Definition: Conditional.cpp:47
Close the scope open by a previous conditional tool, like While or If.
Definition: Conditional.h:171
~End()
Destructor.
Definition: Conditional.cpp:184
const int scope_modifier()
Definition: Conditional.h:189
void setup()
Initialize the tool.
Definition: Conditional.cpp:187
Execute all the tools in its scope if the condition is fulfilled.
Definition: Conditional.h:125
void setup()
Initialize the tool.
Definition: Conditional.cpp:142
cl_event _execute(const std::vector< cl_event > events)
Definition: Conditional.cpp:169
~If()
Destructor.
Definition: Conditional.cpp:139
Tool * next_tool()
Definition: Conditional.cpp:151
Tools base class. The way that AQUAgpusph compute each problem is set through a set of tools that are...
Definition: Tool.h:46
const std::string name()
Definition: Tool.h:66
Execute all the tools in its scope until the condition becomes unfulfilled.
Definition: Conditional.h:99
void setup()
Initialize the tool.
Definition: Conditional.cpp:126
~While()
Destructor.
Definition: Conditional.cpp:123
Main AQUAgpusph namespace.
Definition: ArgumentsManager.cpp:45