/
heunsolverplugin.cpp
156 lines (109 loc) · 4.96 KB
/
heunsolverplugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://gnu.org/licenses>.
*******************************************************************************/
//==============================================================================
// Heun solver plugin
//==============================================================================
#include "heunsolver.h"
#include "heunsolverplugin.h"
//==============================================================================
namespace OpenCOR {
namespace HeunSolver {
//==============================================================================
PLUGININFO_FUNC HeunSolverPluginInfo()
{
Descriptions descriptions;
descriptions.insert("en", QString::fromUtf8(R"(a plugin that implements the <a href="https://en.wikipedia.org/wiki/Heun's_method">Heun's method</a> to solve <a href="https://en.wikipedia.org/wiki/Ordinary_differential_equation">ODEs</a>.)"));
descriptions.insert("fr", QString::fromUtf8(R"(une extension qui implémente la <a href="https://en.wikipedia.org/wiki/Heun's_method">méthode de Heun</a> pour résoudre des <a href="https://en.wikipedia.org/wiki/Ordinary_differential_equation">EDOs</a>.)"));
return new PluginInfo(PluginInfo::Category::Solver, true, false,
QStringList(),
descriptions);
}
//==============================================================================
// I18n interface
//==============================================================================
void HeunSolverPlugin::retranslateUi()
{
// We don't handle this interface...
// Note: even though we don't handle this interface, we still want to
// support it since some other aspects of our plugin are
// multilingual...
}
//==============================================================================
// Solver interface
//==============================================================================
Solver::Solver * HeunSolverPlugin::solverInstance() const
{
// Create and return an instance of the solver
return new HeunSolver();
}
//==============================================================================
QString HeunSolverPlugin::id(const QString &pKisaoId) const
{
// Return the id for the given KiSAO id
static const QString Kisao0000301 = "KISAO:0000301";
static const QString Kisao0000483 = "KISAO:0000483";
if (pKisaoId == Kisao0000301) {
return solverName();
}
if (pKisaoId == Kisao0000483) {
return StepId;
}
return {};
}
//==============================================================================
QString HeunSolverPlugin::kisaoId(const QString &pId) const
{
// Return the KiSAO id for the given id
if (pId == solverName()) {
return "KISAO:0000301";
}
if (pId == StepId) {
return "KISAO:0000483";
}
return {};
}
//==============================================================================
Solver::Type HeunSolverPlugin::solverType() const
{
// Return the type of the solver
return Solver::Type::Ode;
}
//==============================================================================
QString HeunSolverPlugin::solverName() const
{
// Return the name of the solver
return "Heun";
}
//==============================================================================
Solver::Properties HeunSolverPlugin::solverProperties() const
{
// Return the properties supported by the solver
Descriptions stepDescriptions;
stepDescriptions.insert("en", QString::fromUtf8("Step"));
stepDescriptions.insert("fr", QString::fromUtf8("Pas"));
return Solver::Properties() << Solver::Property(Solver::Property::Type::DoubleGt0, StepId, stepDescriptions, QStringList(), StepDefaultValue, true);
}
//==============================================================================
QMap<QString, bool> HeunSolverPlugin::solverPropertiesVisibility(const QMap<QString, QString> &pSolverPropertiesValues) const
{
Q_UNUSED(pSolverPropertiesValues)
// We don't handle this interface...
return {};
}
//==============================================================================
} // namespace HeunSolver
} // namespace OpenCOR
//==============================================================================
// End of file
//==============================================================================