Line data Source code
1 : /*
2 : * Copyright (c) 2011-2015: G-CSC, Goethe University Frankfurt
3 : * Authors: Andreas Vogel, Sebastian Reiter
4 : *
5 : * This file is part of UG4.
6 : *
7 : * UG4 is free software: you can redistribute it and/or modify it under the
8 : * terms of the GNU Lesser General Public License version 3 (as published by the
9 : * Free Software Foundation) with the following additional attribution
10 : * requirements (according to LGPL/GPL v3 §7):
11 : *
12 : * (1) The following notice must be displayed in the Appropriate Legal Notices
13 : * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 : *
15 : * (2) The following notice must be displayed at a prominent place in the
16 : * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 : *
18 : * (3) The following bibliography is recommended for citation and must be
19 : * preserved in all covered files:
20 : * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 : * parallel geometric multigrid solver on hierarchically distributed grids.
22 : * Computing and visualization in science 16, 4 (2013), 151-164"
23 : * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 : * flexible software system for simulating pde based models on high performance
25 : * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 : *
27 : * This program is distributed in the hope that it will be useful,
28 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 : * GNU Lesser General Public License for more details.
31 : */
32 :
33 : #include <iostream>
34 : #include <sstream>
35 : #include <vector>
36 : #include <string>
37 : #include <algorithm>
38 :
39 : // include bridge
40 : #include "bridge/bridge.h"
41 : #include "bridge/util.h"
42 : #include "bridge/util_domain_dependent.h"
43 :
44 : #include "common/profiler/profiler.h"
45 :
46 : #include "lib_disc/domain.h"
47 : #include "lib_disc/domain_util.h"
48 :
49 : #include "lib_disc/parallelization/domain_distribution.h"
50 :
51 : #include "lib_grid/refinement/global_multi_grid_refiner.h"
52 : #include "lib_grid/algorithms/geom_obj_util/misc_util.h"
53 : #include "lib_grid/algorithms/grid_statistics.h"
54 :
55 : #include "lib_grid/algorithms/subset_util.h"
56 :
57 : #ifdef UG_PARALLEL
58 : #include "lib_disc/parallelization/domain_load_balancer.h"
59 : #include "lib_grid/parallelization/deprecated/load_balancing.h"
60 : #include "lib_grid/parallelization/parallelization_util.h"
61 : #include "lib_grid/parallelization/util/partition_weighting_callbacks.h"
62 : #endif
63 :
64 :
65 : using namespace std;
66 :
67 : namespace ug{
68 :
69 : /**
70 : * \defgroup domain_bridge Domain Bridge
71 : * \ingroup bridge
72 : * \{
73 : */
74 :
75 : // This method is only a temporary test method and will be replaced by
76 : // a more sophisticated approach
77 : template <typename TDomain>
78 0 : static void MinimizeMemoryFootprint(TDomain& dom)
79 : {
80 0 : dom.grid()->set_options(GRIDOPT_VERTEXCENTRIC_INTERCONNECTION
81 : | GRIDOPT_AUTOGENERATE_SIDES);
82 0 : }
83 :
84 : template <typename TDomain>
85 0 : static void LoadAndRefineDomain(TDomain& domain, const char* filename,
86 : int numRefs)
87 : {
88 : PROFILE_FUNC_GROUP("grid");
89 : try{
90 0 : LoadDomain(domain, filename);
91 : }
92 0 : UG_CATCH_THROW("LoadAndRefineDomain: Could not load domain at file: "<<filename);
93 :
94 0 : GlobalMultiGridRefiner ref(*domain.grid());
95 0 : for(int i = 0; i < numRefs; ++i)
96 0 : ref.refine();
97 0 : }
98 :
99 : template <typename TDomain>
100 0 : static bool SavePartitionMap(PartitionMap& pmap, TDomain& domain,
101 : const char* filename)
102 : {
103 : PROFILE_FUNC_GROUP("grid");
104 0 : if(domain.grid().get() != pmap.get_partition_handler()->grid())
105 : {
106 : UG_LOG("WARNING in SavePartitionMap: The given partition map was not"
107 : " created for the given domain. Aborting...\n");
108 0 : return false;
109 : }
110 :
111 0 : return SavePartitionMapToFile(pmap, filename, domain.position_attachment());
112 : }
113 :
114 :
115 : template <typename TDomain>
116 0 : static bool TestDomainInterfaces(TDomain* dom, bool verbose)
117 : {
118 : #ifdef UG_PARALLEL
119 : return TestGridLayoutMap(*dom->grid(),
120 : dom->distributed_grid_manager()->grid_layout_map(), verbose);
121 : #endif
122 0 : return true;
123 : }
124 :
125 : template <typename TDomain>
126 0 : static bool TestDomainInterfaces(TDomain* dom)
127 : {
128 : #ifdef UG_PARALLEL
129 : return TestGridLayoutMap(*dom->grid(),
130 : dom->distributed_grid_manager()->grid_layout_map(), true);
131 : #endif
132 0 : return true;
133 : }
134 :
135 :
136 :
137 : template <typename TDomain>
138 0 : static void ScaleDomain(TDomain& dom, number sx, number sy, number sz)
139 : {
140 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
141 0 : typename TDomain::grid_type& g = *dom.grid();
142 : vector3 s(sx, sy, sz);
143 :
144 : const int numCoords = TDomain::position_type::Size;
145 : UG_ASSERT(numCoords <= 3, "too many coordinates.");
146 :
147 : for(VertexIterator iter = g.vertices_begin();
148 0 : iter != g.vertices_end(); ++iter)
149 : {
150 0 : for(int i = 0; i < numCoords; ++i)
151 0 : aaPos[*iter][i] *= s[i];
152 : }
153 0 : }
154 :
155 : /**
156 : *
157 : * @param dom the domain
158 : * @param dx amount of wiggle in x-direction
159 : * @param dy amount of wiggle in y-direction
160 : * @param dz amount of wiggle in z-direction
161 : * iterates through all vertices and adds a random number between -d[] and d[]
162 : * to the position. note that this is absolute, so one has to be careful that
163 : * elements are not intersecting after this.
164 : * this function is used in some AMG tests to get 'unstructured' grids
165 : * of different sizes
166 : */
167 : template <typename TDomain>
168 0 : static void RandomizeDomain(TDomain& dom, number dx, number dy, number dz)
169 : {
170 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
171 0 : typename TDomain::grid_type& g = *dom.grid();
172 : vector3 d(dx, dy, dz);
173 :
174 : const int numCoords = TDomain::position_type::Size;
175 : UG_ASSERT(numCoords <= 3, "too many coordinates.");
176 :
177 : for(VertexIterator iter = g.vertices_begin();
178 0 : iter != g.vertices_end(); ++iter)
179 : {
180 0 : for(int i = 0; i < numCoords; ++i)
181 0 : aaPos[*iter][i] += urand(-d[i], d[i]);
182 : }
183 0 : }
184 :
185 :
186 : template <typename TDomain>
187 0 : static void TranslateDomain(TDomain& dom, number tx, number ty, number tz)
188 : {
189 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
190 0 : typename TDomain::grid_type& g = *dom.grid();
191 : vector3 t(tx, ty, tz);
192 :
193 : const int numCoords = TDomain::position_type::Size;
194 : UG_ASSERT(numCoords <= 3, "too many coordinates.");
195 :
196 : for(VertexIterator iter = g.vertices_begin();
197 0 : iter != g.vertices_end(); ++iter)
198 : {
199 0 : for(int i = 0; i < numCoords; ++i)
200 0 : aaPos[*iter][i] += t[i];
201 : }
202 0 : }
203 :
204 : /**
205 : * Moves all vertices in an eps-environment of a sphere to the sphere.
206 : *
207 : * @param dom domain
208 : * @param center center of sphere
209 : * @param radius radius of sphere
210 : * @param eps size of eps-environment
211 : */
212 : template <typename TDomain>
213 0 : static void ProjectVerticesToSphere(TDomain& dom, std::vector<number> center,
214 : number radius, number eps)
215 : {
216 : static const int dim = TDomain::dim;
217 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
218 0 : typename TDomain::grid_type& g = *dom.grid();
219 :
220 0 : if((int)center.size() != dim)
221 0 : UG_THROW("Expect center to be of dimension "<<dim);
222 :
223 : MathVector<dim> Center;
224 0 : for(int d = 0; d < dim; d++) Center[d] = center[d];
225 :
226 : for(VertexIterator iter = g.vertices_begin();
227 0 : iter != g.vertices_end(); ++iter)
228 : {
229 : MathVector<dim>& pos = aaPos[*iter];
230 :
231 : // move only vertices in eps-environment of sphere
232 0 : if( VecDistance(pos, Center) < radius - eps ||
233 0 : VecDistance(pos, Center) > radius + eps) continue;
234 :
235 : // get closest point on sphere
236 : MathVector<dim> dir;
237 : VecSubtract(dir, pos, Center);
238 : number s, s1Out, s2Out;
239 0 : if(RaySphereIntersection(s1Out,s2Out, Center, dir, Center, radius) < 1)
240 0 : UG_THROW("No intersection found for pos "<<pos);
241 0 : if(s1Out > s2Out) s = s1Out; else s = s2Out;
242 0 : if(s <= 0) UG_THROW("Invalid scale "<<s);
243 :
244 : // set new pos
245 : VecScaleAdd(pos, 1.0, Center, s, dir);
246 : }
247 0 : }
248 :
249 : /**
250 : * Calculates the area sum of faces in given domain and subset handler sh.
251 : * Please note that the sum is returned for faces in subset with index si and
252 : * on grid level lvl in the domain dom.
253 : *
254 : * \param dom domain
255 : * \param sh subset handler
256 : * \param si subset index
257 : * \param lvl grid level
258 : *
259 : * \return \c number area sum
260 : */
261 : template <typename TDomain>
262 0 : static number FaceArea(TDomain& dom, ISubsetHandler& sh, int si, size_t lvl)
263 : {
264 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
265 : UG_ASSERT(TDomain::position_type::Size <= 3, "too many coordinates.");
266 :
267 0 : return FaceArea(sh, si, lvl, aaPos);
268 : }
269 :
270 : /**
271 : * Calculates the area sum of faces in given domain with implicit given
272 : * subset handler. Please note the sum is returned for faces in subset with
273 : * index si and on grid level lvl in the domain dom.
274 : *
275 : * \param dom domain
276 : * \param si subset index
277 : * \param lvl grid level
278 : *
279 : * \return \c number area sum
280 : */
281 : template <typename TDomain>
282 0 : static number FaceArea(TDomain& dom, int si, size_t lvl)
283 : {
284 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
285 : UG_ASSERT(TDomain::position_type::Size <= 3, "too many coordinates.");
286 :
287 0 : return FaceArea(*dom.subset_handler(), si, lvl, aaPos);
288 : }
289 :
290 : /**
291 : * Calculates the area sum of faces in a given domain with implicit given
292 : * subset handler. Please note the sum is returned for faces in subset with
293 : * index si on grid level 0 in the domain dom.
294 : *
295 : * \param dom domain
296 : * \param si subset index
297 : *
298 : * \return \c number area sum
299 : */
300 : template <typename TDomain>
301 0 : static number FaceArea(TDomain& dom, int si)
302 : {
303 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
304 : UG_ASSERT(TDomain::position_type::Size <= 3, "too many coordinates.");
305 :
306 0 : return FaceArea(*dom.subset_handler(), si, 0, aaPos);
307 : }
308 :
309 : /**
310 : * Calculates the area sum of faces in a given domain. Please note the sum
311 : * is returned for all faces selected by the selector sel in the domain dom.
312 : *
313 : * \param dom domain
314 : * \param sel selector
315 : *
316 : * \return \c number area sum
317 : *
318 : */
319 : template <typename TDomain>
320 0 : static number FaceArea(TDomain& dom, ISelector& sel)
321 : {
322 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
323 : UG_ASSERT(TDomain::position_type::Size <= 3, "too many coordinates.");
324 :
325 0 : return FaceArea(sel, aaPos);
326 : }
327 :
328 :
329 : template <class TDomain, class TElem>
330 0 : static TElem* GetElementByCoordinate(TDomain& dom, number x, number y, number z)
331 : {
332 : vector3 tv(x, y, z);
333 : typename TDomain::position_type v;
334 : VecCopy(v, tv, 0);
335 :
336 0 : typename TDomain::grid_type& g = *dom.grid();
337 0 : return FindClosestByCoordinate<TElem>(v, g.template begin<TElem>(), g.template end<TElem>(), dom.position_accessor());
338 : }
339 :
340 :
341 : template <typename TDomain>
342 0 : static number GetMaxEdgeLength(TDomain& dom)
343 : {
344 : typename TDomain::position_accessor_type& aaPos = dom.position_accessor();
345 0 : typename TDomain::grid_type& g = *dom.grid();
346 :
347 0 : number maxLenSq = 0;
348 : for(EdgeIterator eiter = g.template begin<Edge>();
349 0 : eiter != g.template end<Edge>(); ++eiter)
350 : {
351 0 : maxLenSq = max(maxLenSq, EdgeLengthSq(*eiter, aaPos));
352 : }
353 :
354 : #ifdef UG_PARALLEL
355 : pcl::ProcessCommunicator com;
356 : number gMaxLenSq = com.allreduce(maxLenSq, PCL_RO_MAX);
357 : return sqrt(gMaxLenSq);
358 : #else
359 0 : return sqrt(maxLenSq);
360 : #endif
361 : }
362 :
363 :
364 : template <typename TDomain>
365 0 : static void PrintElementEdgeRatios(TDomain& dom)
366 : {
367 : int elemType = dom.domain_info().element_type();
368 :
369 0 : MultiGrid& mg = *dom.grid();
370 :
371 : UG_LOG("Element Edge Ratios:\n");
372 0 : for(size_t lvl = 0; lvl < mg.num_levels(); ++lvl){
373 : UG_LOG(" level " << lvl << ":\t");
374 0 : switch(elemType){
375 : case FACE:
376 0 : PrintElementEdgeRatios(mg, mg.begin<Face>(lvl),
377 : mg.end<Face>(lvl), dom.position_accessor());
378 0 : break;
379 :
380 : case VOLUME:
381 0 : PrintElementEdgeRatios(mg, mg.begin<Volume>(lvl),
382 : mg.end<Volume>(lvl), dom.position_accessor());
383 0 : break;
384 : default:
385 : UG_LOG("---\n");
386 : break;
387 : }
388 : }
389 0 : }
390 :
391 : // end group domain_bridge
392 : /// \}
393 :
394 : namespace bridge{
395 : namespace Domain{
396 :
397 : /// \addtogroup domain_bridge
398 : /// \{
399 :
400 : /**
401 : * Class exporting the functionality. All functionality that is to
402 : * be used in scripts or visualization must be registered here.
403 : */
404 : struct Functionality
405 : {
406 :
407 : /**
408 : * Function called for the registration of Domain dependent parts.
409 : * All Functions and Classes depending on the Domain
410 : * are to be placed here when registering. The method is called for all
411 : * available Domain types, based on the current build options.
412 : *
413 : * @param reg registry
414 : * @param parentGroup group for sorting of functionality
415 : */
416 : template <typename TDomain>
417 3 : static void Domain(Registry& reg, string grp)
418 : {
419 : string suffix = GetDomainSuffix<TDomain>();
420 : string tag = GetDomainTag<TDomain>();
421 :
422 : // Domain
423 : {
424 : typedef typename TDomain::position_attachment_type apos_t;
425 : typedef IDomain<> TBase;
426 3 : string name = string("Domain").append(suffix);
427 9 : reg.add_class_<TDomain, TBase>(name, grp)
428 3 : .add_constructor()
429 9 : .add_method("empty", &TDomain::empty)
430 : #ifndef UG_FOR_VRL
431 : // This does not work with current automated code generation for VRL.
432 : // Remove ifndef once this has been fixed.
433 9 : .add_method("position_attachment",
434 : static_cast<const apos_t& (TDomain::*)()const>(
435 : &TDomain::position_attachment))
436 : #endif
437 3 : .set_construct_as_smart_pointer(true);
438 :
439 9 : reg.add_class_to_group(name, "Domain", tag);
440 : }
441 :
442 :
443 : // MaxElementDiameter
444 9 : reg.add_function("MaxElementDiameter", static_cast<number (*)(TDomain&, int)>(
445 : &MaxElementDiameter<TDomain>), grp);
446 : // MinElementDiameter
447 9 : reg.add_function("MinElementDiameter", static_cast<number (*)(TDomain&, int)>(
448 : &MinElementDiameter<TDomain>), grp);
449 :
450 : // LoadDomain
451 9 : reg.add_function("LoadDomain", static_cast<void (*)(TDomain&, const char*)>(
452 : &LoadDomain<TDomain>), grp,
453 : "", "Domain # Filename | load-dialog | endings=[\"ugx\"]; description=\"*.ugx-Files\" # Number Refinements",
454 : "Loads a domain", "No help");
455 9 : reg.add_function("LoadDomain", static_cast<void (*)(TDomain&, const char*, int)>(
456 : &LoadDomain<TDomain>), grp,
457 : "", "Domain # Filename # procID | load-dialog | endings=[\"ugx\"]; description=\"*.ugx-Files\" # Number Refinements",
458 : "Loads a domain", "No help");
459 :
460 : // LoadAndRefineDomain
461 9 : reg.add_function("LoadAndRefineDomain", &LoadAndRefineDomain<TDomain>, grp,
462 : "", "Domain # Filename # NumRefines | load-dialog | endings=[\"ugx\"]; description=\"*.ugx-Files\" # Number Refinements",
463 : "Loads a domain and performs global refinement", "No help");
464 : // SaveDomain
465 9 : reg.add_function("SaveDomain", &SaveDomain<TDomain>, grp,
466 : "", "Domain # Filename|save-dialog| endings=[\"ugx\"]",
467 : "Saves a domain", "No help");
468 :
469 : // SavePartitionMap
470 9 : reg.add_function("SavePartitionMap", &SavePartitionMap<TDomain>, grp,
471 : "Success", "PartitionMap # Domain # Filename|save-dialog",
472 : "Saves a partition map", "No help");
473 :
474 : // Domain Distribution
475 : // note that an overload of this method exists, registered in disc_bridges/domain_disc_bridge
476 9 : reg.add_function("DistributeDomain",
477 : static_cast<bool (*)(TDomain&, PartitionMap&, bool)>(&DistributeDomain<TDomain>),
478 : grp);
479 :
480 : // PartitionDomain
481 9 : reg.add_function("PartitionDomain_MetisKWay",
482 : static_cast<bool (*)(TDomain&, PartitionMap&, int, size_t, int, int)>(&PartitionDomain_MetisKWay<TDomain>), grp);
483 9 : reg.add_function("PartitionDomain_MetisKWay",
484 : static_cast<bool (*)(TDomain&, PartitionMap&, int, size_t, SmartPtr<PartitionWeighting>)>(&PartitionDomain_MetisKWay<TDomain>), grp);
485 :
486 9 : reg.add_function("PartitionDomain_LevelBased",
487 : &PartitionDomain_LevelBased<TDomain>, grp, "", "domain#partitionMap#numPartitions#level");
488 :
489 9 : reg.add_function("PartitionDistributedDomain_LevelBased",
490 : &PartitionDistributedDomain_LevelBased<TDomain>, grp, "", "domain#partitionMap#numPartitions#level");
491 :
492 : // transform the domain
493 9 : reg.add_function("ScaleDomain", &ScaleDomain<TDomain>, grp, "", "dom#sx#sy#sz");
494 9 : reg.add_function("RandomizeDomain", &RandomizeDomain<TDomain>, grp, "", "dom#dx#dy#dz");
495 9 : reg.add_function("TranslateDomain", &TranslateDomain<TDomain>, grp, "", "dom#tx#ty#tz");
496 9 : reg.add_function("ProjectVerticesToSphere", &ProjectVerticesToSphere<TDomain>, grp, "", "dom#center#radius#eps");
497 :
498 : // calculate area covered by faces
499 9 : reg.add_function("FaceArea", static_cast<number (*)(TDomain&, ISubsetHandler&, int, size_t)>(&FaceArea<TDomain>), grp, "Area sum", "Domain#Subset handler#Subset index#Grid level");
500 9 : reg.add_function("FaceArea", static_cast<number (*)(TDomain&, int, size_t)>(&FaceArea<TDomain>), grp, "Area sum", "Domaim#Subset index#Grid level");
501 9 : reg.add_function("FaceArea", static_cast<number (*)(TDomain&, int)>(&FaceArea<TDomain>), grp, "Area sum", "Domain#Subset index");
502 9 : reg.add_function("FaceArea", static_cast<number (*)(TDomain&, ISelector&)>(&FaceArea<TDomain>), grp, "Area sum", "Domain#Selector");
503 :
504 : // element access
505 9 : reg.add_function("GetVertexByCoordinate", &GetElementByCoordinate<TDomain, Vertex>, grp);
506 9 : reg.add_function("GetEdgeByCoordinate", &GetElementByCoordinate<TDomain, Edge>, grp);
507 9 : reg.add_function("GetFaceByCoordinate", &GetElementByCoordinate<TDomain, Face>, grp);
508 9 : reg.add_function("GetVolumeByCoordinate", &GetElementByCoordinate<TDomain, Volume>, grp);
509 :
510 : // geometry information
511 9 : reg.add_function("GetMaxEdgeLength", &GetMaxEdgeLength<TDomain>, grp);
512 9 : reg.add_function("PrintElementEdgeRatios", static_cast<void (*)(TDomain&)>(&PrintElementEdgeRatios<TDomain>), grp);
513 : // debugging
514 9 : reg.add_function("TestDomainInterfaces", static_cast<bool (*)(TDomain*)>(&TestDomainInterfaces<TDomain>), grp);
515 9 : reg.add_function("TestDomainInterfaces", static_cast<bool (*)(TDomain*, bool)>(&TestDomainInterfaces<TDomain>), grp);
516 :
517 9 : reg.add_function("MinimizeMemoryFootprint", &MinimizeMemoryFootprint<TDomain>, grp);
518 3 : }
519 :
520 : /**
521 : * Function called for the registration of Domain and Algebra independent parts.
522 : * All Functions and Classes not depending on Domain and Algebra
523 : * are to be placed here when registering.
524 : *
525 : * @param reg registry
526 : * @param parentGroup group for sorting of functionality
527 : */
528 1 : static void Common(Registry& reg, string grp)
529 : {
530 : // DomainInfo
531 : {
532 3 : reg.add_class_<DomainInfo>("DomainInfo", grp)
533 1 : .add_constructor()
534 2 : .add_method("element_type", &DomainInfo::element_type)
535 2 : .add_method("num_levels", &DomainInfo::num_levels)
536 2 : .add_method("num_elements", &DomainInfo::num_elements)
537 2 : .add_method("num_surface_elements", &DomainInfo::num_surface_elements)
538 2 : .add_method("num_elements_on_level", &DomainInfo::num_elements_on_level)
539 2 : .add_method("num_local_elements_on_level", &DomainInfo::num_local_elements_on_level)
540 2 : .add_method("num_local_ghosts_on_level", &DomainInfo::num_local_ghosts_on_level)
541 2 : .add_method("num_subsets", &DomainInfo::num_subsets)
542 2 : .add_method("subset_dim", &DomainInfo::subset_dim)
543 2 : .add_method("to_string", &DomainInfo::to_string)
544 1 : .set_construct_as_smart_pointer(true);
545 : }
546 :
547 : // IDomain
548 : {
549 : typedef IDomain<> T;
550 3 : reg.add_class_<T>("IDomain", grp)
551 2 : .add_method("domain_info", &T::domain_info, "DomainInfo")
552 2 : .add_method("get_dim", static_cast<int (T::*)() const>(&T::get_dim))
553 2 : .add_method("grid", static_cast<SmartPtr<MultiGrid> (T::*)()>(&T::grid), "grid")
554 2 : .add_method("subset_handler", static_cast<SmartPtr<MGSubsetHandler> (T::*)()>(&T::subset_handler))
555 2 : .add_method("create_additional_subset_handler", &T::create_additional_subset_handler, "bool")
556 2 : .add_method("additional_subset_handler_names", &T::additional_subset_handler_names, "vector<string>")
557 2 : .add_method("additional_subset_handler",
558 : static_cast<SmartPtr<MGSubsetHandler> (T::*)(string)>(&T::additional_subset_handler),
559 : "SubsetHandler")
560 2 : .add_method("set_refinement_projector", &T::set_refinement_projector,
561 : "", "projector")
562 2 : .add_method("refinement_projector", &T::refinement_projector,
563 : "projector", "")
564 2 : .add_method("geometry3d", &T::geometry3d, "geometry3d", "")
565 1 : .set_construct_as_smart_pointer(true);
566 : }
567 :
568 1 : }
569 : }; // end Functionality
570 :
571 :
572 : /// methods that are only available for 2d and 3d are registered here
573 : struct Functionality2d3d
574 : {
575 : template <typename TDomain>
576 2 : static void Domain(Registry& reg, string grp)
577 : {
578 6 : reg.add_function("PartitionDomain_RegularGrid",
579 : &PartitionDomain_RegularGrid<TDomain>, grp);
580 2 : }
581 : }; // end Functionality2d3d
582 :
583 : // end group domain_bridge
584 : /// \}
585 :
586 : }// end Domain
587 :
588 : /// \addtogroup domain_bridge
589 1 : void RegisterBridge_Domain(Registry& reg, string grp)
590 : {
591 1 : grp.append("/Domain");
592 :
593 : typedef Domain::Functionality Functionality;
594 : typedef boost::mpl::list<
595 : #ifdef UG_DIM_2
596 : Domain2d
597 : #endif
598 : #if defined UG_DIM_2 && defined UG_DIM_3
599 : ,
600 : #endif
601 : #ifdef UG_DIM_3
602 : Domain3d
603 : #endif
604 : > CompileDomain2d3dList;
605 :
606 : try{
607 2 : RegisterCommon<Functionality>(reg,grp);
608 2 : RegisterDomainDependent<Functionality>(reg,grp);
609 1 : RegisterDomainDependent<Domain::Functionality2d3d, CompileDomain2d3dList>(reg,grp);
610 : }
611 0 : UG_REGISTRY_CATCH_THROW(grp);
612 1 : }
613 :
614 : }// end of namespace
615 : }// end of namespace
|