-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd3f_plugin.cpp
More file actions
630 lines (563 loc) · 28.7 KB
/
Copy pathd3f_plugin.cpp
File metadata and controls
630 lines (563 loc) · 28.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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
/*
* SPDX-FileCopyrightText: (c) Contributors of the d3f++ Community
* SPDX-FileCopyrightText: (c) 2012-2015: G-CSC, Goethe University Frankfurt
* SPDX-FileContributor: Andreas Vogel
* SPDX-License-Identifier: EUPL-1.2
*
* 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
*
*/
/**
* File for registration of d3f routines.
*/
#include "bridge/util.h"
#include "bridge/util_domain_dependent.h"
#include "bridge/util_domain_algebra_dependent.h"
#include "density_driven_flow/density_driven_flow_base.h"
#include "density_driven_flow/fv1/density_driven_flow_fv1.h"
#include "density_driven_flow/fv/density_driven_flow_fv.h"
#include "thermohaline_flow/thermohaline_flow.h"
#include "preconditioner/df_transform.h"
#include "preconditioner/df_transforming.h"
#include "d3f_debug_linker.h"
#include "common_user_data.h"
#include "bear_scheidegger.h"
#include "polygons.h"
#include "boxunions.h"
#include "value_by_id.h"
#include "rasterid.h"
#include "d3f_sss.h"
#include "val_surf_proj.h"
#include "extravol.h"
#include "inout_bnd.h"
#include "d3f_util_plugin.h"
#include "d3f_plugin_fract.h"
#include "d3f_plugin_ls.h"
#include "d3f_plugin_rivers.h"
#include "d3f_limex.h"
#include "util/subset_user_data.h"
using namespace std;
using namespace ug::bridge;
namespace ug{
namespace d3f{
/**
* Class exporting the functionality of the plugin. All functionality that is to
* be used in scripts or visualization must be registered here.
*/
struct Functionality
{
/**
* Function called for the registration of Domain dependent parts
* of the plugin. All Functions and Classes depending on the Domain
* are to be placed here when registering. The method is called for all
* available Domain 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)
{
static const int dim = TDomain::dim;
string suffix = GetDomainSuffix<TDomain>();
string tag = GetDomainTag<TDomain>();
// Density Driven Flow Base
{
typedef DensityDrivenFlowBase<TDomain> T;
typedef IElemDisc<TDomain> TBase;
string name = string("DensityDrivenFlowBase").append(suffix);
reg.add_class_<T, TBase >(name, grp)
.add_method("set_boussinesq_transport", &T::set_boussinesq_transport, "", "Boussinesq Transport")
.add_method("set_boussinesq_flow", &T::set_boussinesq_flow,"", "Boussinesq Flow")
.add_method("set_porosity", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >)>(&T::set_porosity), "", "Porosity")
.add_method("set_porosity", static_cast<void (T::*)(number)>(&T::set_porosity), "", "Porosity")
#ifdef UG_FOR_LUA
.add_method("set_porosity", static_cast<void (T::*)(const char*)>(&T::set_porosity), "", "Porosity")
.add_method("set_porosity", static_cast<void (T::*)(LuaFunctionHandle)>(&T::set_porosity), "", "Porosity")
#endif
.add_method("set_gravity", static_cast<void (T::*)(SmartPtr<CplUserData<MathVector<dim>, dim> >)>(&T::set_gravity), "", "Gravity")
.add_method("set_gravity", static_cast<void (T::*)(const std::vector<number>&)>(&T::set_gravity), "", "Gravity")
#ifdef UG_FOR_LUA
.add_method("set_gravity", static_cast<void (T::*)(const char*)>(&T::set_gravity), "", "Gravity")
#endif
.add_method("set_molecular_diffusion", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim, dim>, dim> >)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
.add_method("set_molecular_diffusion", static_cast<void (T::*)(number)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
#ifdef UG_FOR_LUA
.add_method("set_molecular_diffusion", static_cast<void (T::*)(const char*)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
.add_method("set_molecular_diffusion", static_cast<void (T::*)(LuaFunctionHandle)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
#endif
.add_method("set_permeability", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim, dim>, dim> >)>(&T::set_permeability), "", "Permeability")
.add_method("set_permeability", static_cast<void (T::*)(number)>(&T::set_permeability), "", "Permeability")
#ifdef UG_FOR_LUA
.add_method("set_permeability", static_cast<void (T::*)(const char*)>(&T::set_permeability), "", "Permeability")
.add_method("set_permeability", static_cast<void (T::*)(LuaFunctionHandle)>(&T::set_permeability), "", "Permeability")
#endif
.add_method("set_viscosity", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >)>(&T::set_viscosity), "", "Viscosity")
.add_method("set_viscosity", static_cast<void (T::*)(number)>(&T::set_viscosity), "", "Viscosity")
#ifdef UG_FOR_LUA
.add_method("set_viscosity", static_cast<void (T::*)(const char*)>(&T::set_viscosity), "", "Viscosity")
#endif
.add_method("set_density", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >)>(&T::set_density), "", "Density")
.add_method("set_density", static_cast<void (T::*)(number)>(&T::set_density), "", "Density")
#ifdef UG_FOR_LUA
.add_method("set_density", static_cast<void (T::*)(const char*)>(&T::set_density), "", "Density")
#endif
.add_method("set_dispersion", &T::set_dispersion, "", "Dispersion")
.add_method("darcy_velocity", &T::darcy_velocity)
.add_method("brine", &T::brine)
.add_method("pressure", &T::pressure)
.add_method("brine_grad", &T::brine_grad)
.add_method("pressure_grad", &T::pressure_grad)
.add_method("brine_tensor", &T::brine_tensor)
.add_method("pressure_tensor", &T::pressure_tensor);
reg.add_class_to_group(name, "DensityDrivenFlowBase", tag);
}
// Density Driven Flow FV1
{
typedef DensityDrivenFlowFV1<TDomain> T;
typedef DensityDrivenFlowBase<TDomain> TBase;
string name = string("DensityDrivenFlowFV1").append(suffix);
reg.add_class_<T, TBase >(name, grp)
.template add_constructor<void (*)(const char*,const char*)>("Function(s)#Subset(s)")
.template add_constructor<void (*)(const std::vector<std::string>&,const std::vector<std::string>&)>("Function(s)#Subset(s)")
.add_method("set_scheidegger_dispersion", static_cast<void (T::*)(number, number)>(&T::set_scheidegger_dispersion), "", "alphaLong#alphaTrans")
.add_method("set_scheidegger_dispersion", static_cast<void (T::*)(number, number, number)>(&T::set_scheidegger_dispersion), "", "alphaLong#alphaTrans#damp")
.add_method("set_consistent_gravity", &T::set_consistent_gravity, "", "Consistent Gravity")
#ifdef DF_LIMEX_PATCH
.add_method("set_partial_velocity", &T::set_partial_velocity, "", "mask")
#endif
.add_method("set_singular_sources_and_sinks", &T::set_sss_manager, "", "Singular Sources and Sinks")
.add_method("singular_sources_and_sinks", &T::sss_manager, "", "Returns the singular sources and sinks manager")
.add_method("set_river_singular_sources_and_sinks", &T::set_river_sss_manager, "", "River Singular Sources and Sinks")
.add_method("set_relative_permeability", &T::set_relative_permeability, "", "Relative Permeability (Richards)")
.add_method("set_volume_stabilization", &T::set_volume_stabilization, "", "Volume Stabilization")
.add_method("set_upwind", &T::set_upwind, "", "Upwind (no, part, full)")
.add_method("set_condensed_FV", &T::set_condensed_FV, "", "[De-]Activates the condensed FV scvf ip's")
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "DensityDrivenFlowFV1", tag);
}
// Density Driven Flow FV
{
typedef DensityDrivenFlowFV<TDomain> T;
typedef DensityDrivenFlowBase<TDomain> TBase;
string name = string("DensityDrivenFlowFV").append(suffix);
reg.add_class_<T, TBase >(name, grp)
.template add_constructor<void (*)(const char*,const char*)>("Function(s)#Subset(s)")
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "DensityDrivenFlowFV", tag);
}
// Thermohaline Flow
{
typedef ThermohalineFlow<TDomain> T;
typedef IElemDisc<TDomain> TBase;
string name = string("ThermohalineFlow").append(suffix);
reg.add_class_<T, TBase >(name, grp)
.template add_constructor<void (*)(const char*,const char*)>("Function(s)#Subset(s)")
.template add_constructor<void (*)(const std::vector<std::string>&,const std::vector<std::string>&)>("Function(s)#Subset(s)")
.add_method("set_scheidegger_dispersion", static_cast<void (T::*)(number, number)>(&T::set_scheidegger_dispersion), "", "alphaLong#alphaTrans")
.add_method("set_consistent_gravity", &T::set_consistent_gravity, "", "ConsistentGravity")
.add_method("set_boussinesq_transport", &T::set_boussinesq_transport, "", "BoussinesqTransport")
.add_method("set_boussinesq_flow", &T::set_boussinesq_flow,"", "BoussinesqFlow")
.add_method("set_boussinesq_density", &T::set_boussinesq_density,"", "BoussinesqDensity")
.add_method("set_upwind", &T::set_upwind, "", "Upwind (no, part, full)")
.add_method("set_upwind_energy", &T::set_upwind_energy, "", "Upwind (no, part, full)")
.add_method("set_porosity", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >)>(&T::set_porosity), "", "Porosity")
.add_method("set_porosity", static_cast<void (T::*)(number)>(&T::set_porosity), "", "Porosity")
#ifdef UG_FOR_LUA
.add_method("set_porosity", static_cast<void (T::*)(const char*)>(&T::set_porosity), "", "Porosity")
#endif
.add_method("set_gravity", static_cast<void (T::*)(SmartPtr<CplUserData<MathVector<dim>, dim> >)>(&T::set_gravity), "", "Gravity")
.add_method("set_gravity", static_cast<void (T::*)(number)>(&T::set_gravity), "", "g_x")
.add_method("set_gravity", static_cast<void (T::*)(number,number)>(&T::set_gravity), "", "g_x, g_y")
.add_method("set_gravity", static_cast<void (T::*)(number,number,number)>(&T::set_gravity), "", "g_x, g_y, g_z")
#ifdef UG_FOR_LUA
.add_method("set_gravity", static_cast<void (T::*)(const char*)>(&T::set_gravity), "", "Gravity")
#endif
.add_method("set_molecular_diffusion", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim, dim>, dim> >)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
.add_method("set_molecular_diffusion", static_cast<void (T::*)(number)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
#ifdef UG_FOR_LUA
.add_method("set_molecular_diffusion", static_cast<void (T::*)(const char*)>(&T::set_molecular_diffusion), "", "MolecularDiffusion")
#endif
.add_method("set_thermal_conductivity", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim, dim>, dim> >)>(&T::set_thermal_conductivity), "", "ThermalConductivity")
.add_method("set_thermal_conductivity", static_cast<void (T::*)(number)>(&T::set_thermal_conductivity), "", "ThermalConductivity")
#ifdef UG_FOR_LUA
.add_method("set_thermal_conductivity", static_cast<void (T::*)(const char*)>(&T::set_thermal_conductivity), "", "ThermalConductivity")
#endif
.add_method("set_permeability", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim, dim>, dim> >)>(&T::set_permeability), "", "Permeability")
.add_method("set_permeability", static_cast<void (T::*)(number)>(&T::set_permeability), "", "Permeability")
#ifdef UG_FOR_LUA
.add_method("set_permeability", static_cast<void (T::*)(const char*)>(&T::set_permeability), "", "Permeability")
.add_method("set_permeability", static_cast<void (T::*)(LuaFunctionHandle)>(&T::set_permeability), "", "Permeability")
#endif
.add_method("set_viscosity", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >)>(&T::set_viscosity), "", "Viscosity")
.add_method("set_viscosity", static_cast<void (T::*)(number)>(&T::set_viscosity), "", "Viscosity")
#ifdef UG_FOR_LUA
.add_method("set_viscosity", static_cast<void (T::*)(const char*)>(&T::set_viscosity), "", "Viscosity")
#endif
.add_method("set_density", &T::set_density, "", "Density")
.add_method("set_heat_capacity_fluid", &T::set_heat_capacity_fluid)
.add_method("set_heat_capacity_solid", &T::set_heat_capacity_solid)
.add_method("set_mass_density_solid", &T::set_mass_density_solid)
.add_method("darcy_velocity", &T::darcy_velocity)
.add_method("pressure_grad", &T::pressure_grad)
.add_method("temperature", &T::temperature)
.add_method("brine", &T::brine)
.add_method("brine_grad", &T::brine_grad)
.add_method("set_singular_sources_and_sinks", &T::set_sss_manager, "", "Singular Sources and Sinks")
.add_method("singular_sources_and_sinks", &T::sss_manager, "", "Returns the singular sources and sinks manager")
.add_method("set_volume_stabilization", &T::set_volume_stabilization, "", "Volume Stabilization")
#ifdef DF_LIMEX_PATCH
.add_method("set_partial_velocity", &T::set_partial_velocity, "", "mask")
#endif
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "ThermohalineFlow", tag);
}
// Volume stabilization for the "out" boundary conditions
{
typedef FlowVolStabData<TDomain> T;
string name = string("FlowVolStabData").append(suffix);
reg.add_class_<T>(name, grp)
.template add_constructor<void (*)(SmartPtr<TDomain>)>("Domain")
.add_method("activate_flux", &T::activate_flux, "Alloc the attachment for the flux")
.add_method("activate_flags", &T::activate_flags, "Alloc the attachment for the flags")
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "FlowVolStabData", tag);
}
}
/**
* 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 <int dim>
static void Dimension(Registry& reg, string grp)
{
string dimSuffix = GetDimensionSuffix<dim>();
string dimTag = GetDimensionTag<dim>();
// BearScheidegger linker
{
typedef BearScheidegger<dim> T;
typedef DependentUserData<MathMatrix<dim, dim>, dim> TBase;
string name = string("BearScheidegger").append(dimSuffix);
reg.add_class_<T, TBase>(name, grp)
.template add_constructor<void (*) (SmartPtr<CplUserData<MathVector<dim>, dim> >, number, number)>()
#ifdef DF_LIMEX_PATCH
.add_method("set_damp", &T::set_damp)
#endif
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "BearScheidegger", dimTag);
}
// PecletNumber linker
{
typedef DFPecletNumber<dim> T;
typedef DependentUserData<number, dim> TBase;
string name = string("DFPecletNumber").append(dimSuffix);
reg.add_class_<T, TBase>(name, grp)
.add_method("set_velocity", &T::set_velocity)
.add_method("set_dispersion", static_cast<void (T::*)(number)>(&T::set_dispersion))
.add_method("set_dispersion", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim,dim>,dim> >)>(&T::set_dispersion))
.add_method("set_length_scale", &T::set_length_scale)
.add_constructor()
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "DFPecletNumber", dimTag);
}
// Anisotropy linker
{
typedef DFAnisotropy<dim> T;
typedef DependentUserData<number, dim> TBase;
string name = string("DFAnisotropy").append(dimSuffix);
reg.add_class_<T, TBase>(name, grp)
.add_method("set_dispersion", static_cast<void (T::*)(number)>(&T::set_dispersion))
.add_method("set_dispersion", static_cast<void (T::*)(SmartPtr<CplUserData<MathMatrix<dim,dim>,dim> >)>(&T::set_dispersion))
.add_constructor()
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "DFAnisotropy", dimTag);
}
// ElementExtensions (StdUserData)
{
typedef ElementExtensions<dim> T;
//typedef typename T::base_type TBase;
typedef UserData<MathVector<dim>, dim> TBase;
//typedef CplUserData<MathVector<dim>, dim> TBase;
string name = string("ElementExtensions").append(dimSuffix);
reg.add_class_<T, TBase>(name, grp)
.add_constructor()
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "ElementExtensions", dimTag);
}
// XInflow
{
typedef XInflow<dim> T;
typedef CplUserData<number, dim> TBase;
string name = string("XInflow").append(dimSuffix);
reg.add_class_<T, TBase>(name, grp)
.template add_constructor<void (*)(number,number,number)>()
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "XInflow", dimTag);
}
// point and line sinks for the density-driven flow
{
typedef DDSingularSourcesAndSinks<dim> T;
typedef typename T::point_sss_type TPointSSS;
typedef typename T::line_sss_type TLineSSS;
string point_name = string("d3fDDPointSourcesSink").append(dimSuffix);
reg.add_class_<TPointSSS>(point_name, grp)
.template add_constructor<void (*) (const std::vector<number>&)> ()
.add_method ("set", static_cast<void (TPointSSS::*) (number, number)> (&TPointSSS::set))
.add_method ("set", static_cast<void (TPointSSS::*) (LuaFunctionHandle)> (&TPointSSS::set))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(point_name, "d3fDDPointSourcesSink", dimTag);
string line_name = string("d3fDDLineSourcesSink").append(dimSuffix);
reg.add_class_<TLineSSS>(line_name, grp)
.template add_constructor<void (*) (const std::vector<number>&, const std::vector<number>&)> ()
.add_method ("set", static_cast<void (TLineSSS::*) (number, number)> (&TLineSSS::set))
.add_method ("set", static_cast<void (TLineSSS::*) (LuaFunctionHandle)> (&TLineSSS::set))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(line_name, "d3fDDLineSourcesSink", dimTag);
string name = string("d3fDDSingularSourcesAndSinks").append(dimSuffix);
reg.add_class_<T>(name, grp)
.add_constructor()
.add_method ("add_point", static_cast<void (T::*) (SmartPtr<TPointSSS>)> (&T::add_point))
.add_method ("add_line", static_cast<void (T::*) (SmartPtr<TLineSSS>)> (&T::add_line))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "d3fDDSingularSourcesAndSinks", dimTag);
}
// point and line sinks for the thermohaline flow
{
typedef THSingularSourcesAndSinks<dim> T;
typedef typename T::point_sss_type TPointSSS;
typedef typename T::line_sss_type TLineSSS;
string point_name = string("d3fTHPointSourcesSink").append(dimSuffix);
reg.add_class_<TPointSSS>(point_name, grp)
.template add_constructor<void (*) (const std::vector<number>&)> ()
.add_method ("set", static_cast<void (TPointSSS::*) (number, number, number)> (&TPointSSS::set))
.add_method ("set", static_cast<void (TPointSSS::*) (LuaFunctionHandle)> (&TPointSSS::set))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(point_name, "d3fTHPointSourcesSink", dimTag);
string line_name = string("d3fTHLineSourcesSink").append(dimSuffix);
reg.add_class_<TLineSSS>(line_name, grp)
.template add_constructor<void (*) (MathVector<dim>&, MathVector<dim>&)> ()
.add_method ("set", static_cast<void (TLineSSS::*) (number, number, number)> (&TLineSSS::set))
.add_method ("set", static_cast<void (TLineSSS::*) (LuaFunctionHandle)> (&TLineSSS::set))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(line_name, "d3fTHLineSourcesSink", dimTag);
string name = string("d3fTHSingularSourcesAndSinks").append(dimSuffix);
reg.add_class_<T>(name, grp)
.add_constructor()
.add_method ("add_point", static_cast<void (T::*) (SmartPtr<TPointSSS>)> (&T::add_point))
.add_method ("add_line", static_cast<void (T::*) (SmartPtr<TLineSSS>)> (&T::add_line))
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "d3fTHSingularSourcesAndSinks", dimTag);
}
}
/**
* Function called for the registration of Algebra dependent parts
* of the plugin. All Functions and Classes depending on Algebra
* are to be placed here when registering. The method is called for all
* available Algebra types, based on the current build options.
*
* @param reg registry
* @param parentGroup group for sorting of functionality
*/
template <typename TAlgebra>
static void Algebra(Registry& reg, string grp)
{
// useful defines
string suffix = GetAlgebraSuffix<TAlgebra>();
string tag = GetAlgebraTag<TAlgebra>();
// Transforming iteration
{
typedef df::DFLeftTransform<TAlgebra> TTransform;
typedef LeftTransformIterator<TAlgebra, TTransform> T;
typedef ILinearIterator<typename TAlgebra::vector_type> TBase;
string name = string("LeftTransformIterator").append(suffix);
reg.add_class_<T,TBase>(name, grp, "LeftTransform Preconditioner")
.add_constructor()
.add_method("set_preconditioner", &T::set_preconditioner)
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "LeftTransformIterator", tag);
}
}
/**
* Function called for the registration of Domain and Algebra dependent parts
* of the plugin. All Functions and Classes depending on both Domain and Algebra
* are to be placed here when registering. The method is called for all
* available Domain and Algebra types, based on the current build options.
*
* @param reg registry
* @param parentGroup group for sorting of functionality
*/
template <typename TDomain, typename TAlgebra>
static void DomainAlgebra(Registry& reg, string grp)
{
static const int dim = TDomain::dim;
string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
// Outflow BC
{
typedef OutFlowBC<TDomain,TAlgebra> T;
typedef IDomainConstraint<TDomain, TAlgebra> TBase;
string name = string("OutFlowBC").append(suffix);
reg.add_class_<T, TBase>(name, grp)
.add_method("set_volume_stabilization", static_cast<void (T::*)(SmartPtr<FlowVolStabData<TDomain> >)>(&T::set_volume_stabilization), "set the volume stab. object", "VolumeStabilizationData")
.add_method("add", static_cast<void (T::*)(string,string)>(&T::add), "add a boundary surface", "subsetNames#functionNames")
.add_method("scale", static_cast<void (T::*)(string,number)>(&T::scale), "scale the contribution for functions", "functionNames#factor")
.add_constructor()
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "OutFlowBC", tag);
}
// InOutflow BC
{
typedef InOutFlowBC<TDomain,TAlgebra> T;
typedef IDomainConstraint<TDomain, TAlgebra> TBase;
string name = string("InOutFlowBC").append(suffix);
reg.add_class_<T, TBase>(name, grp)
.add_method("set_volume_stabilization", static_cast<void (T::*)(SmartPtr<FlowVolStabData<TDomain> >)>(&T::set_volume_stabilization), "set the volume stab. object", "VolumeStabilizationData")
.add_method("add", static_cast<void (T::*)(string,string,number)>(&T::add), "add a boundary surface with a const. Dirichlet BC", "subsetNames#functionNames#ConstNumber")
.add_method("add", static_cast<void (T::*)(string,string,SmartPtr<UserData<number, dim> >)>(&T::add), "add a boundary surface with a var. Dirichlet BC", "subsetNames#functionNames#UserData")
#ifdef UG_FOR_LUA
.add_method("add", static_cast<void (T::*)(string,string,const char*)>(&T::add), "add a boundary surface with a var. Dirichlet BC", "subsetNames#functionNames#UserData")
.add_method("add", static_cast<void (T::*)(string,string,LuaFunctionHandle)>(&T::add), "add a boundary surface with a var. Dirichlet BC", "subsetNames#functionNames#UserData")
#endif
.add_method("scale", static_cast<void (T::*)(string,number)>(&T::scale), "scale the contribution for functions", "functionNames#factor")
.add_constructor()
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "InOutFlowBC", tag);
}
// ValSurfProjData: A user data object of values on a given z-plane
{
typedef GridFunction<TDomain, TAlgebra> TLSFct;
typedef ValSurfProjData<TLSFct> T;
typedef UserData<number, dim> TBase;
string name = string("ValSurfProjData").append(suffix);
reg.add_class_<T,TBase>(name, grp)
.template add_constructor<void (*) (SmartPtr<TLSFct>, const char *, number, const char *)> ("LSF#cmp#zCoord#subsets")
.add_method("set_default_value", static_cast<void (T::*) (number)> (&T::set_default_value), "Sets the value for the points with no covering", "defaultValue")
.add_method("reinit", static_cast<void (T::*) ()> (&T::reinit), "", "Initialize for computations")
.set_construct_as_smart_pointer(true);
reg.add_class_to_group(name, "ValSurfProjData", tag);
}
}
/**
* Function called for general general classes independen on further parameters
*/
static void Common(Registry& reg, string grp)
{
// Specification of position-dependent data by polygons and unions of boxes
{
// UserDataInfo
reg.add_class_<PolygonalRegions>("PolygonalRegions", grp, "Polynomial regions")
.add_constructor()
.add_method
(
"append_point",
static_cast<void (PolygonalRegions::*) (number, number, int)> (&PolygonalRegions::append_point),
"add a point to the polygon 'id'",
"x#y#id"
)
.add_method
(
"load_points_from",
static_cast<void (PolygonalRegions::*) (const char *)> (&PolygonalRegions::load_points_from),
"load data from a file",
"FileName"
)
.add_method
(
"get_id_by_pnt_dv",
static_cast<int (PolygonalRegions::*) (number, number, int) const> (&PolygonalRegions::get_id_by_pnt_dv),
"returns the subregion id or the default value",
"x#y#DefaultVal"
)
;
}
{
reg.add_class_<UnionsOfBoxes>("UnionsOfBoxes", grp, "Box regions")
.add_constructor()
.add_method
(
"set_grid_sizes",
static_cast<void (UnionsOfBoxes::*) (size_t, number, number)> (&UnionsOfBoxes::set_grid_sizes),
"set cell sizes and the agglomeration direction",
"x#y#id"
)
.add_method
(
"append_point",
static_cast<void (UnionsOfBoxes::*) (number, number, int)> (&UnionsOfBoxes::append_point),
"add a point to the polygon 'id'",
"x#y#id"
)
.add_method
(
"load_points_from",
static_cast<void (UnionsOfBoxes::*) (const char *)> (&UnionsOfBoxes::load_points_from),
"load data from a file",
"FileName"
)
.add_method
(
"get_id_by_pnt_dv",
static_cast<int (UnionsOfBoxes::*) (number, number, int) const> (&UnionsOfBoxes::get_id_by_pnt_dv),
"returns the subregion id or the default value",
"x#y#DefaultVal"
)
;
}
// "Box-union" subregions
{
typedef ValueById<UnionsOfBoxes> T;
reg.add_class_<T>("UnionOfBoxesNumber", grp)
.add_method("load_points_from", static_cast<void (T::*)(const char*)>(&T::load_points_from), "loads point coordinates from a file", "file name")
.add_method("load_values_from", static_cast<void (T::*)(const char*)>(&T::load_values_from), "loads values from a file", "file name")
.add_method("set_grid_sizes", static_cast<void (T::*)(size_t,number,number)>(&T::set_grid_sizes), "sets the box sizes and the agglomeration direction", "dir#dx#dy")
.add_method("set_interval", static_cast<void (T::*)(number)>(&T::set_interval), "sets the time interval for a column", "interval")
.add_method("interpolate", static_cast<number (T::*)(number,number,number) const>(&T::interpolate), "get data for a given point", "x#y#t")
.add_method("num_columns", static_cast<size_t (T::*)() const>(&T::num_columns), "number of the columns", "")
.add_method("max_identifier", static_cast<size_t (T::*)() const>(&T::max_identifier), "max. indentifier", "")
.add_constructor<void(*)(number)> ("DefaultValue");
}
// Raster-Id association
{
typedef ValueById<RasterID> T;
reg.add_class_<T>("RasterIDNumber", grp)
.add_method("load_id_raster_from", static_cast<void (T::*)(const char*)>(&T::load_id_raster_from), "loads point coordinates from a file", "file name")
.add_method("load_values_from", static_cast<void (T::*)(const char*)>(&T::load_values_from), "loads values from a file", "file name")
.add_method("set_interval", static_cast<void (T::*)(number)>(&T::set_interval), "sets the time interval for a column", "interval")
.add_method("interpolate", static_cast<number (T::*)(number,number,number) const>(&T::interpolate), "get data for a given point", "x#y#t")
.add_method("num_columns", static_cast<size_t (T::*)() const>(&T::num_columns), "number of the columns", "")
.add_method("max_identifier", static_cast<size_t (T::*)() const>(&T::max_identifier), "max. indentifier", "")
.add_constructor<void(*)(number)> ("DefaultValue");
}
}
}; // end Functionality
} // end namespace d3f
/**
* This function is called when the plugin is loaded.
*/
extern "C" void
InitUGPlugin_d3f(Registry* reg, string GRP)
{
string grp(GRP);
grp.append("/SpatialDisc/d3f");
typedef d3f::Functionality Functionality;
try{
RegisterDimensionDependent<Functionality>(*reg,grp);
RegisterDomainDependent<Functionality>(*reg,grp);
RegisterDomainAlgebraDependent<Functionality>(*reg,grp);
RegisterAlgebraDependent<Functionality>(*reg,grp);
RegisterCommon<Functionality>(*reg,grp);
InitUGPlugin_d3f_fract(reg, GRP);
InitUGPlugin_d3f_ls(reg, GRP);
InitUGPlugin_d3f_rivers(reg, GRP);
InitUGPlugin_d3f_Util(reg, GRP);
}
UG_REGISTRY_CATCH_THROW(grp);
}
}// namespace ug