-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmile_plugin.cpp
More file actions
98 lines (80 loc) · 3.29 KB
/
Copy pathsmile_plugin.cpp
File metadata and controls
98 lines (80 loc) · 3.29 KB
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
/*
* smile_plugin.cpp
*/
#include "common/common.h"
#include "bridge/util.h"
#include "bridge/util_domain_algebra_dependent.h"
#include "smile_chem_eq.hpp"
#include "smile_chem.hpp"
#include "smile_cloud.hpp"
#include "smile_Kd.hpp"
#include "smile_rescale.hpp"
using namespace std;
using namespace ug::bridge;
namespace ug {
namespace smile {
struct Functionality
{
template <int dim>
static void Dimension(Registry& reg, string grp)
{
string dimSuffix = GetDimensionSuffix<dim>();
string dimTag = GetDimensionTag<dim>();
{
typedef SmartKd<dim> T;
typedef DependentUserData<number, dim> TBase;
string name = string("SmartKd").append(dimSuffix);
reg.add_class_<T, TBase>(name, grp, "SmartKd")
.template add_constructor<void (*) (Cloud *, SmartPtr<CplUserData<number, dim> >, SmartPtr<CplUserData<number, dim> >, SmartPtr<CplUserData<number, dim> >, SmartPtr<CplUserData<number, dim> >, SmartPtr<CplUserData<number, dim> >, SmartPtr<CplUserData<number, dim> >, number)>("cloud#H#c#Ca#DIC#SO4#Al#entry")
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "SmartKd", dimTag);
}
}
template <typename TDomain, typename TAlgebra>
static void DomainAlgebra(Registry& reg, string grp)
{
string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
// SmartChem command (with the rescaling)
{
typedef GridFunction<TDomain, TAlgebra> TFct;
reg.add_function("SmartChem", static_cast<void (*)(SmartPtr<TFct>, SmartPtr<TFct>, const char*, Cloud*, number, number)>(&SmartChem<TFct>), grp, "Computes new equilibrium for solution over the whole domain", "solution#calcite#nuclides#cloud#porosity#rockdensity");
}
// SmartChemEquilibrate command
{
typedef GridFunction<TDomain, TAlgebra> TFct;
reg.add_function("SmartChemEquilibrate", static_cast<void (*)(SmartPtr<TFct>, SmartPtr<TFct>)>(&SmartChemEquilibrate<TFct>), grp, "Computes new equilibrium for solution over the whole domain", "solution#calcite");
}
// SmartRescaler class
{
typedef SmartRescaler<TDomain, TAlgebra> T;
string name = string("SmartRescaler").append (suffix);
reg.add_class_<T> (name, grp)
.add_constructor ()
.add_method ("set_factor", static_cast<void (T::*) (SmartPtr<typename T::factor_type>)> (&T::set_factor), "factor", "UserData for the factor")
.add_method ("multiply", static_cast<void (T::*) (SmartPtr<typename T::gf_type>, const char *)> (&T::multiply), "GridFunc#cmp", "Multiply the components by the factors")
.add_method ("divide", static_cast<void (T::*) (SmartPtr<typename T::gf_type>, const char *)> (&T::divide), "GridFunc#cmp", "Multiply the components by the factors")
.set_construct_as_smart_pointer(true);
reg.add_class_to_group (name, "SmartRescaler", tag);
}
}
static void Common(Registry& reg, string grp)
{
reg.add_class_<Cloud>("SmartCloud", grp, "SmartCloud")
.add_constructor<void (*)(const char*)>("FileName");
}
}; // end Functionality
} // end of namespace smile
extern "C" void
InitUGPlugin_smile(Registry* reg, string grp)
{
grp.append("/smile");
typedef smile::Functionality Functionality;
try {
RegisterDimensionDependent<Functionality>(*reg,grp);
RegisterDomainAlgebraDependent<Functionality>(*reg,grp);
RegisterCommon<Functionality>(*reg,grp);
}
UG_REGISTRY_CATCH_THROW(grp);
}
} // end of namespace ug