Line data Source code
1 : /*
2 : * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3 : * Author: Martin Scherer
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 "registry/registry.h"
34 : #include "bridge/bridge.h"
35 : #include "bridge/util.h"
36 : #include "bridge/util_domain_dependent.h"
37 : #include "lib_grid/tools/periodic_boundary_manager.h"
38 :
39 : using namespace std;
40 :
41 : namespace ug {
42 : namespace bridge {
43 : namespace periodicBoundary {
44 :
45 : /**
46 : * \defgroup periodic_bridge Periodic Bounadry Bridge
47 : * \ingroup domain_bridge
48 : * \{
49 : */
50 :
51 0 : void print_all_identifications(Grid& g) {
52 0 : if(!g.has_periodic_boundaries())
53 : return;
54 0 : PeriodicBoundaryManager& pi = *g.periodic_boundary_manager();
55 0 : pi.print_identification<Face>();
56 0 : pi.print_identification<Edge>();
57 0 : pi.print_identification<Vertex>();
58 : }
59 :
60 : /**
61 : * Class exporting the functionality. All functionality that is to
62 : * be used in scripts or visualization must be registered here.
63 : */
64 : struct Functionality {
65 :
66 1 : static void Common(Registry& reg, string grp) {
67 3 : reg.add_class_<PeriodicBoundaryManager>("PeriodicBoundaryManager", grp)
68 1 : .add_constructor();
69 3 : reg.add_function("PrintIdentification", &print_all_identifications, grp);
70 1 : }
71 :
72 : /**
73 : * Function called for the registration of Domain dependent parts.
74 : * All Functions and Classes depending on the Domain
75 : * are to be placed here when registering. The method is called for all
76 : * available Domain types, based on the current build options.
77 : *
78 : * @param reg registry
79 : * @param parentGroup group for sorting of functionality
80 : */
81 : template<typename TDomain>
82 3 : static void Domain(Registry& reg, string grp) {
83 9 : reg.add_function("IdentifySubsets",
84 : static_cast<void(*)(TDomain&, int, int)>(&IdentifySubsets<TDomain>), grp)
85 9 : .add_function("IdentifySubsets",
86 : static_cast<void(*)(TDomain&, const char*, const char*)>(&IdentifySubsets<TDomain>), grp);
87 3 : }
88 : }; // end Functionality
89 :
90 : // end group periodic_bridge
91 : /// \}
92 :
93 : } // end periodicBoundary
94 :
95 : /// \addtogroup periodic_bridge
96 1 : void RegisterBridge_PeriodicBoundary(Registry& reg, string grp) {
97 1 : grp.append("/Periodic");
98 :
99 : try {
100 2 : RegisterCommon<periodicBoundary::Functionality>(reg, grp);
101 1 : RegisterDomainDependent<periodicBoundary::Functionality>(reg, grp);
102 0 : } UG_REGISTRY_CATCH_THROW(grp);
103 1 : }
104 :
105 : } // end of namespace bridge
106 : } // end of namespace ug
|