Line data Source code
1 : /*
2 : * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3 : * Author: Andreas Vogel
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 : // extern headers
34 : #include <iostream>
35 : #include <sstream>
36 : #include <string>
37 :
38 : // include bridge
39 : #include "bridge/bridge.h"
40 : #include "bridge/util.h"
41 : #include "bridge/util_domain_algebra_dependent.h"
42 :
43 : // lib_disc includes
44 : #include "lib_disc/domain.h"
45 : #include "lib_disc/function_spaces/grid_function.h"
46 : #include "lib_disc/function_spaces/approximation_space.h"
47 :
48 : #include "lib_disc/spatial_disc/domain_disc.h"
49 : #include "lib_disc/spatial_disc/elem_disc/elem_disc_interface.h"
50 : #include "lib_disc/spatial_disc/constraints/constraint_interface.h"
51 : #include "lib_disc/spatial_disc/constraints/dirichlet_boundary/lagrange_dirichlet_boundary.h"
52 : #include "lib_disc/spatial_disc/constraints/continuity_constraints/p1_continuity_constraints.h"
53 :
54 : using namespace std;
55 :
56 : namespace ug{
57 : namespace bridge{
58 : namespace Constraints{
59 :
60 : /**
61 : * \defgroup constraints_bridge Constraints Bridge
62 : * \ingroup disc_bridge
63 : * \{
64 : */
65 :
66 : /**
67 : * Class exporting the functionality. All functionality that is to
68 : * be used in scripts or visualization must be registered here.
69 : */
70 : struct Functionality
71 : {
72 :
73 : /**
74 : * Function called for the registration of Domain and Algebra dependent parts.
75 : * All Functions and Classes depending on both Domain and Algebra
76 : * are to be placed here when registering. The method is called for all
77 : * available Domain and Algebra types, based on the current build options.
78 : *
79 : * @param reg registry
80 : * @param parentGroup group for sorting of functionality
81 : */
82 : template <typename TDomain, typename TAlgebra>
83 9 : static void DomainAlgebra(Registry& reg, string grp)
84 : {
85 : string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
86 : string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
87 :
88 : // typedef
89 : static const int dim = TDomain::dim;
90 :
91 : // IDomainConstraint
92 : {
93 : typedef IConstraint<TAlgebra> TBase;
94 : typedef IDomainConstraint<TDomain, TAlgebra> T;
95 9 : string name = string("IDomainConstraint").append(suffix);
96 27 : reg.add_class_<T, TBase>(name, grp)
97 18 : .add_method("set_error_estimator", &T::set_error_estimator, "", "error estimator data object");
98 27 : reg.add_class_to_group(name, "IDomainConstraint", tag);
99 : }
100 :
101 : // OneSideP1Constraints
102 : {
103 : typedef OneSideP1Constraints<TDomain, TAlgebra> T;
104 : typedef IDomainConstraint<TDomain, TAlgebra> baseT;
105 9 : string name = string("OneSideP1Constraints").append(suffix);
106 27 : reg.add_class_<T, baseT>(name, grp)
107 9 : .add_constructor()
108 9 : .set_construct_as_smart_pointer(true);
109 27 : reg.add_class_to_group(name, "OneSideP1Constraints", tag);
110 : }
111 :
112 : // SymP1Constraints
113 : {
114 : typedef SymP1Constraints<TDomain, TAlgebra> T;
115 : typedef IDomainConstraint<TDomain, TAlgebra> baseT;
116 9 : string name = string("SymP1Constraints").append(suffix);
117 27 : reg.add_class_<T, baseT>(name, grp)
118 9 : .add_constructor()
119 9 : .set_construct_as_smart_pointer(true);
120 27 : reg.add_class_to_group(name, "SymP1Constraints", tag);
121 : }
122 :
123 : // DirichletBoundary
124 : {
125 : typedef DirichletBoundary<TDomain, TAlgebra> T;
126 : typedef IDomainConstraint<TDomain, TAlgebra> TBase;
127 9 : string name = string("DirichletBoundary").append(suffix);
128 27 : reg.add_class_<T, TBase>(name, grp)
129 18 : .template add_constructor<void (*)()>()
130 18 : .template add_constructor<void (*)(bool)>()
131 : #ifdef LAGRANGE_DIRICHLET_ADJ_TRANSFER_FIX
132 : .template add_constructor<void (*)(bool,bool)>()
133 : #endif
134 18 : .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim, bool> >, const char*, const char*)>(&T::add),
135 : "", "Value#Function#Subsets")
136 18 : .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim, bool> >, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
137 : "", "Value#Function#Subsets")
138 18 : .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim> >, const char*, const char*)>(&T::add),
139 : "", "Value#Function#Subsets")
140 18 : .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim> >, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
141 : "", "Value#Function#Subsets")
142 18 : .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<MathVector<dim>, dim> >, const char*, const char*)>(&T::add),
143 : "", "Vector#Functions#Subsets")
144 18 : .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<MathVector<dim>, dim> >, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
145 : "", "Vector#Functions#Subsets")
146 18 : .add_method("add",static_cast<void (T::*)(number, const char*, const char*)>(&T::add),
147 : "", "ConstantValue#Function#Subsets")
148 18 : .add_method("add",static_cast<void (T::*)(number, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
149 : "", "ConstantValue#Function#Subsets")
150 18 : .add_method("add",static_cast<void (T::*)(const char*, const char*)>(&T::add),
151 : "", "Function#Subsets")
152 18 : .add_method("add",static_cast<void (T::*)(const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
153 : "", "Function#Subsets")
154 18 : .add_method("invert_subset_selection",static_cast<void (T::*)()>(&T::invert_subset_selection),
155 : "", "")
156 18 : .add_method("set_approximation_space",static_cast<void (T::*)(SmartPtr<ApproximationSpace<TDomain> >)>(&T::set_approximation_space),
157 : "", "ApproximationSpace")
158 : #ifdef UG_FOR_LUA
159 18 : .add_method("add",static_cast<void (T::*)(const char*, const char*, const char*)>(&T::add),
160 : "", "LuaCallback#Function#Subsets")
161 18 : .add_method("add",static_cast<void (T::*)(const char*, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
162 : "", "LuaCallback#Function#Subsets")
163 18 : .add_method("add",static_cast<void (T::*)(LuaFunctionHandle, const char*, const char*)>(&T::add),
164 : "", "LuaCallback#Function#Subsets")
165 18 : .add_method("add",static_cast<void (T::*)(LuaFunctionHandle, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add),
166 : "", "LuaCallback#Function#Subsets")
167 : #endif
168 18 : .add_method("clear", &T::clear)
169 9 : .set_construct_as_smart_pointer(true);
170 27 : reg.add_class_to_group(name, "DirichletBoundary", tag);
171 : }
172 9 : }
173 :
174 : };
175 :
176 : // end group constraints_bridge
177 : /// \}
178 :
179 : }// namespace Constraints
180 :
181 : /// \addtogroup constraints_bridge
182 1 : void RegisterBridge_Constraints(Registry& reg, string grp)
183 : {
184 1 : grp.append("/Discretization/SpatialDisc");
185 : typedef Constraints::Functionality Functionality;
186 :
187 : try{
188 1 : RegisterDomainAlgebraDependent<Functionality>(reg,grp);
189 : }
190 0 : UG_REGISTRY_CATCH_THROW(grp);
191 1 : }
192 :
193 : }// end of namespace bridge
194 : }// end of namespace ug
|