AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Conditional.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 IF_H_INCLUDED
25#define IF_H_INCLUDED
26
27#include "Tool.hpp"
28#include "SetScalar.hpp"
29
30namespace Aqua {
31namespace CalcServer {
32
41{
42 public:
50 Conditional(const std::string name,
51 const std::string condition,
52 bool once = false);
53
56
59 void setup();
60
68 virtual Tool* next_tool();
69
74 inline int scope_modifier() const { return 1; }
75
76 protected:
79 void _solve();
80
81 private:
83 Tool* _ending_tool;
84
85 protected:
87 bool _result;
88};
89
96{
97 public:
105 While(const std::string name,
106 const std::string condition,
107 bool once = false);
108
110 ~While();
111};
112
118{
119 public:
127 If(const std::string name, const std::string condition, bool once = false);
128
130 ~If();
131
143 Tool* next_tool();
144
145 protected:
148 void _solve();
149};
150
158{
159 public:
164 End(const std::string name, bool once = false);
165
167 ~End();
168
171 void setup();
172
176 inline int scope_modifier() const { return -1; }
177};
178
179}
180} // namespace
181
182#endif // IF_H_INCLUDED
Set a scalar variable. (See Aqua::CalcServer::SetScalar for details)
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.hpp:41
~Conditional()
Destructor.
Definition Conditional.cpp:43
int scope_modifier() const
Definition Conditional.hpp:74
virtual Tool * next_tool()
Definition Conditional.cpp:85
bool _result
Condition result.
Definition Conditional.hpp:87
void _solve()
Evaluate the expression and check whether it is true or false.
Definition Conditional.cpp:98
Conditional(const std::string name, const std::string condition, bool once=false)
Constructor.
Definition Conditional.cpp:34
void setup()
Initialize the tool.
Definition Conditional.cpp:46
~End()
Destructor.
Definition Conditional.cpp:152
End(const std::string name, bool once=false)
Constructor.
Definition Conditional.cpp:147
int scope_modifier() const
Definition Conditional.hpp:176
void setup()
Initialize the tool.
Definition Conditional.cpp:155
If(const std::string name, const std::string condition, bool once=false)
Constructor.
Definition Conditional.cpp:112
~If()
Destructor.
Definition Conditional.cpp:117
Tool * next_tool()
Definition Conditional.cpp:120
void _solve()
Evaluate the expression and check whether it is true or false.
Definition Conditional.cpp:138
void name(const std::string tool_name)
Definition Tool.hpp:66
Base class for tools that has to evaluate a scalar expression.
Definition SetScalar.hpp:74
Tools base class.
Definition Tool.hpp:176
While(const std::string name, const std::string condition, bool once=false)
Constructor.
Definition Conditional.cpp:105
~While()
Destructor.
Definition Conditional.cpp:110
Calculation server name space.
Definition Assert.cpp:32
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50