Loading [MathJax]/extensions/tex2jax.js
Plugins
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
em_material.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013-2015: G-CSC, Goethe University Frankfurt
3 * Author: Dmitry Logashenko
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
36#ifndef __H__UG__PLUGINS__ELECTROMAGNETISM__EM_DATA__
37#define __H__UG__PLUGINS__ELECTROMAGNETISM__EM_DATA__
38
39#include <vector>
40#include <map>
41
42#include "common/common.h"
44
47
49
50namespace ug{
51namespace Electromagnetism{
52
54
61template <typename TDomain>
63{
64private:
67
69 typedef TDomain domain_type;
70
72 typedef typename domain_type::subset_handler_type subset_handler_type;
73
75 static const int dim = domain_type::dim;
76
77public:
80 (
82 );
83
85 void add
86 (
87 const char * subsets,
88 number mu,
89 number sigma
90 );
91
93 void add
94 (
95 const char * subsets,
96 number mu
97 )
98 {
99 add (subsets, mu, (number) 0);
100 }
101
103 void close ();
104
107 {
108 return m_spDomain->subset_handler ();
109 }
110
112 const char * subset_names () const
113 {
114 if (! m_bClosed)
115 UG_THROW ("EMaterial: The object has not been closed.");
116 return m_sSsNames.c_str ();
117 }
118
120 bool finalized () const {return m_bClosed;}
121
124
126 bool get_mu_sigma
127 (
128 int si,
129 number& mu,
130 number& sigma
131 ) const;
132
140 const std::vector<int> & min_conductor_ssi () const
141 {
142 return m_minCondSsI;
143 }
144
151 (
152 int si
153 ) const
154 {
155 return m_minCondSsI [si];
156 }
157
166 const std::vector<int> & base_conductors () const
167 {
168 return m_baseConductors;
169 }
170
180 const std::vector<int> & base_conductor_index () const
181 {
182 return m_baseCondInd;
183 }
184
191 (
192 int si
193 ) const
194 {
195 return m_baseCondInd [si];
196 }
197
198private:
199
201 void connectivity
202 (
203 std::vector<int> & minCondInd
204 );
205
207 void analyze_topology ();
208
209private:
212
215 {
216 std::string ssNames;
218
221
224 (
226 const char * names, // the names
227 number the_mu, // magnetic permeability
228 number the_sigma // electric conductivity
229 )
230 : ssNames (names), ssGrp (pSH),
231 mu (the_mu), sigma (the_sigma)
232 {};
233 };
234
236 std::vector<TSubdomData> m_vSdD;
237
239 typedef std::map<int, TSubdomData *> t_data_map;
240
243
246
248 std::string m_sSsNames;
249
257 std::vector<int> m_minCondSsI;
258
267 std::vector<int> m_baseConductors;
268
276 std::vector<int> m_baseCondInd;
277};
278
280
284template <typename TDomain, typename TAlgebra>
286 : public IDomainConstraint<TDomain, TAlgebra>
287{
288public:
289
292 (
293 SubsetGroup & dirichlet_ssgrp
294 ) const = 0;
295};
296
297} // end namespace Electromagnetism
298} // end namespace ug
299
300#include "em_material_impl.h"
301
302#endif // __H__UG__PLUGINS__ELECTROMAGNETISM__EM_DATA__
303
304/* End of File */
Common interface to get the Dirichlet boundary conditions.
Definition em_material.h:287
virtual void get_dirichlet_subsets(SubsetGroup &dirichlet_ssgrp) const =0
should extend the given subset group with the Dirichlet subsets
Class for subdomain-dependent data for the E-based formulated problems.
Definition em_material.h:63
std::vector< int > m_minCondSsI
Definition em_material.h:257
ConstSmartPtr< domain_type > m_spDomain
domain
Definition em_material.h:211
void add(const char *subsets, number mu, number sigma)
adds a generic subset data item
Definition em_material_impl.h:90
TDomain domain_type
domain type
Definition em_material.h:69
std::vector< TSubdomData > m_vSdD
Subdomain data items.
Definition em_material.h:236
std::vector< int > m_baseConductors
Definition em_material.h:267
const std::vector< int > & base_conductor_index() const
Definition em_material.h:180
void connectivity(std::vector< int > &minCondInd)
computes the connectivity of the conductions
Definition em_material_impl.h:196
static const int dim
world dimension
Definition em_material.h:75
bool finalized() const
returns true iff closed
Definition em_material.h:120
int min_conductor_ssi(int si) const
Definition em_material.h:151
t_data_map m_mUserDataBC
Map assigning subdomain indices to the subdomain data items.
Definition em_material.h:242
bool get_mu_sigma(int si, number &mu, number &sigma) const
reads the data for a subdomain from the data item
Definition em_material_impl.h:65
void add(const char *subsets, number mu)
adds a insulator
Definition em_material.h:94
EMaterial< TDomain > this_type
own type
Definition em_material.h:66
bool m_bClosed
Flag that indicates that the description of the domain has been completed.
Definition em_material.h:245
ConstSmartPtr< domain_type > domain() const
returns pointer to the domain
Definition em_material.h:123
void analyze_topology()
analyzes the conductor topology of the domain
Definition em_material_impl.h:240
std::string m_sSsNames
String of all the subset names mentioned in the data items.
Definition em_material.h:248
const std::vector< int > & base_conductors() const
Definition em_material.h:166
const std::vector< int > & min_conductor_ssi() const
Definition em_material.h:140
const char * subset_names() const
returns the string of the subset names
Definition em_material.h:112
domain_type::subset_handler_type subset_handler_type
subset handler type
Definition em_material.h:72
int base_conductor_index(int si) const
Definition em_material.h:191
void close()
finalizes the object
Definition em_material_impl.h:109
ConstSmartPtr< subset_handler_type > subset_handler() const
constant access to the subset handler
Definition em_material.h:106
std::vector< int > m_baseCondInd
Definition em_material.h:276
std::map< int, TSubdomData * > t_data_map
Data map type.
Definition em_material.h:239
#define UG_THROW(msg)
double number
data item type
Definition em_material.h:215
number sigma
electric conductivity
Definition em_material.h:220
number mu
magnetic permeability
Definition em_material.h:219
SubsetGroup ssGrp
subset group
Definition em_material.h:217
TSubdomData(ConstSmartPtr< subset_handler_type > pSH, const char *names, number the_mu, number the_sigma)
Constructor:
Definition em_material.h:224
std::string ssNames
subset names
Definition em_material.h:216