-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd3f_util_plugin.cpp
More file actions
114 lines (90 loc) · 3.7 KB
/
Copy pathd3f_util_plugin.cpp
File metadata and controls
114 lines (90 loc) · 3.7 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* SPDX-FileCopyrightText: 2025 Gesellschaft fuer Anlagen- und Reaktorsicherheit gGmbH
* SPDX-License-Identifier: EUPL-1.2
* SPDX-FileContributor: Julian Hilbert
* SPDX-FileContributor: Goethe Universität Frankfurt
* SPDX-FileType: SOURCE
*
* This file is part of d3f++.
* d3f++ is an extension for UG4. Licensing information and citation requirements of UG4 are provided in LICENSES/UG4-LGPL_2.1
*/
#include "bridge/util.h"
#include "bridge/util_domain_dependent.h"
#include "bridge/util_domain_algebra_dependent.h"
#include "common/ug_config.h"
#include "common/error.h"
#include "util/subset_user_data.h"
#include "d3f_util_plugin.h"
using namespace std;
using namespace ug::bridge;
namespace ug{
namespace d3f_util{
template <typename TData, typename TDomain, typename TTraits=user_data_traits<TData> >
void RegisterSubsetUserData(Registry& reg, string grp)
{ static const int dim = TDomain::dim;
string dimSuffix = GetDimensionSuffix<dim>();
string dimTag = GetDimensionTag<dim>();
string type = TTraits::name();
// ScaleAddLinker"Type"
{
typedef SubsetUserData<TData, TDomain> T;
typedef typename T::TUserData TUserData;
typedef DependentUserData<TData, dim> TBase;
string name = string("SubsetUserData").append(type).append(dimSuffix);
reg.add_class_<T, TBase>(name, grp)
.add_constructor()
.template add_constructor<void (*)(const SubsetUserData<TData, TDomain>&)>()
.add_method("insert", static_cast<void (T::*)(SmartPtr<CplUserData<TData, dim>>, size_t)>(&T::insert))
.add_method("set_domain", static_cast<void (T::*)(SmartPtr<TDomain>)>(&T::set_domain))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, string("SubsetUserData").append(type), dimTag);
}
}
/**
* Class exporting the functionality. All functionality that is to
* be used in scripts or visualization must be registered here.
*/
struct FunctionalityUtil
{
/**
* Function called for the registration of Dimension dependent parts.
* All Functions and Classes depending on the Dimension
* are to be placed here when registering. The method is called for all
* available Dimension types, based on the current build options.
*
* @param reg registry
* @param parentGroup group for sorting of functionality
*/
template <typename TDomain>
static void Domain(Registry& reg, string grp)
{
string suffix = GetDomainSuffix<TDomain>();
string tag = GetDomainTag<TDomain>();
static const int dim = TDomain::dim;
RegisterSubsetUserData<number, TDomain>(reg, grp);
RegisterSubsetUserData<MathVector<dim>, TDomain>(reg, grp);
RegisterSubsetUserData<MathMatrix<dim, dim>, TDomain>(reg, grp);
RegisterSubsetUserData<MathTensor<4,dim>, TDomain>(reg, grp);
}
static void Common(Registry& reg, string grp)
{
}
}; // end Functionality
// end group plugin_template
/// \}
} // end namespace RiverNetworks
/**
* This function is called when the plugin is loaded.
*/
void
InitUGPlugin_d3f_Util(Registry* reg, string grp)
{
grp.append("/SpatialDisc/d3f");
typedef d3f_util::FunctionalityUtil FunctionalityUtil;
try{
RegisterCommon<FunctionalityUtil>(*reg,grp);
RegisterDomainDependent<FunctionalityUtil>(*reg,grp);
}
UG_REGISTRY_CATCH_THROW(grp);
}
}// namespace ug