ug4
dof_distribution_info.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-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 #ifndef __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION_INFO__
34 #define __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION_INFO__
35 
36 #include "common/common.h"
37 #include "lib_grid/lg_base.h"
41 
42 #include <vector>
43 
44 namespace ug{
45 
47 {
48  public:
50  enum{NOT_DEF_ON_SUBSET = (size_t) - 1};
52  enum{NOT_YET_ASSIGNED = (size_t) - 2};
55 
56  public:
59 
61  void init();
62 
63 
65  size_t max_dofs(const int dim) const {return m_vMaxDoFsInDim[dim];}
66 
68  size_t max_dofs(const GridBaseObjectId gbo) const {return m_vMaxDoFsInDim[gbo];}
69 
71  size_t max_dofs(const ReferenceObjectID roid) const {return m_vMaxDoFsOnROID[roid];}
72 
74  size_t max_dofs(const int dim, const int si) const {return m_vvMaxDoFsInDimPerSubset[dim][si];}
75 
77  size_t max_dofs(const GridBaseObjectId gbo, const int si) const {return m_vvMaxDoFsInDimPerSubset[gbo][si];}
78 
80  size_t num_dofs(const ReferenceObjectID roid, const int si) const {return m_vvNumDoFsOnROIDPerSubset[roid][si];}
81 
82 
84  size_t max_fct_dofs(const size_t fct, int dim) const {return m_vFctInfo[fct].vMaxDoFsInDim[dim];}
85 
87  size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo) const {return m_vFctInfo[fct].vMaxDoFsInDim[gbo];}
88 
90  size_t max_fct_dofs(const size_t fct, const ReferenceObjectID roid) const {return m_vFctInfo[fct].vMaxDoFsOnROID[roid];}
91 
93  size_t max_fct_dofs(const size_t fct, const int dim, const int si) const {return m_vFctInfo[fct].vvMaxDoFsInDimPerSubset[dim][si];}
94 
96  size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo, const int si) const {return m_vFctInfo[fct].vvMaxDoFsInDimPerSubset[gbo][si];}
97 
99  size_t num_fct_dofs(const size_t fct, const ReferenceObjectID roid, const int si) const {return m_vFctInfo[fct].vvNumDoFsOnROIDPerSubset[roid][si];}
100 
101 
103  size_t offset(const ReferenceObjectID roid, const int si, const size_t fct) const {return m_vFctInfo[fct].vvOffsets[roid][si];}
104 
105 
107  void print_local_dof_statistic(int verboseLev) const;
108 
111 
112  protected:
114  void create_offsets();
115 
116  protected:
119 
122 
125 
128 
129 
130  struct FctInfo{
133 
136 
139 
142 
144  std::vector<size_t> vvOffsets[NUM_REFERENCE_OBJECTS];
145  };
146 
148  std::vector<FctInfo> m_vFctInfo;
149 };
150 
151 
153  public:
156  : m_spDDI(spDDI)
157  {}
158 
161 
164 
167 
169  ConstSmartPtr<ISubsetHandler> subset_handler() const {return m_spDDI->subset_handler();}
170 
173 
174 
176  size_t num_fct() const {return m_spDDI->num_fct();}
177 
179  size_t num_fct(int si) const {return m_spDDI->num_fct(si);}
180 
182  std::string name(size_t fct) const {return m_spDDI->name(fct);}
183 
185  std::vector<std::string> names() const {return m_spDDI->names();}
186 
188  size_t fct_id_by_name(const char* name) const{return m_spDDI->fct_id_by_name(name);}
189 
190 
192  int num_subsets() const {return m_spDDI->num_subsets();}
193 
195  int dim(size_t fct) const {return m_spDDI->dim(fct);}
196 
198  int dim_subset(int si) const {return m_spDDI->dim_subset(si);}
199 
201  std::string subset_name(int si) const {return m_spDDI->subset_name(si);}
202 
204  int subset_id_by_name(const char* name) const {return m_spDDI->subset_id_by_name(name);}
205 
207  SubsetGroup subset_grp_by_name(const char* names) const;
208 
210  SubsetGroup all_subsets_grp_except_for(const char* names) const;
211 
213  FunctionGroup fct_grp_by_name(const char* names) const;
214 
215 
217  bool is_def_in_subset(size_t fct, int si) const {return m_spDDI->is_def_in_subset(fct,si);}
218 
220  bool is_def_everywhere(size_t fct) const {return m_spDDI->is_def_everywhere(fct);}
221 
222 
225  const LFEID& local_finite_element_id(size_t fct) const {return m_spDDI->local_finite_element_id(fct);}
226  const LFEID& lfeid(size_t fct) const {return m_spDDI->lfeid(fct);}
228 
229 
231  size_t max_dofs(const int dim) const {return m_spDDI->max_dofs(dim);}
232 
234  size_t max_dofs(const GridBaseObjectId gbo) const {return m_spDDI->max_dofs(gbo);}
235 
237  size_t max_dofs(const ReferenceObjectID roid) const {return m_spDDI->max_dofs(roid);}
238 
240  size_t max_dofs(const int dim, const int si) const {return m_spDDI->max_dofs(dim, si);}
241 
243  size_t max_dofs(const GridBaseObjectId gbo, const int si) const {return m_spDDI->max_dofs(gbo, si);}
244 
246  size_t num_dofs(const ReferenceObjectID roid, const int si) const {return m_spDDI->num_dofs(roid, si);}
247 
248 
250  size_t max_fct_dofs(const size_t fct, int dim) const {return m_spDDI->max_fct_dofs(fct, dim);}
251 
253  size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo) const {return m_spDDI->max_fct_dofs(fct, gbo);}
254 
256  size_t max_fct_dofs(const size_t fct, const ReferenceObjectID roid) const {return m_spDDI->max_fct_dofs(fct, roid);}
257 
259  size_t max_fct_dofs(const size_t fct, const int dim, const int si) const {return m_spDDI->max_fct_dofs(fct, dim, si);}
260 
262  size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo, const int si) const {return m_spDDI->max_fct_dofs(fct, gbo, si);}
263 
265  size_t num_fct_dofs(const size_t fct, const ReferenceObjectID roid, const int si) const {return m_spDDI->num_fct_dofs(fct, roid, si);}
266 
267 
269  size_t offset(const ReferenceObjectID roid, const int si, const size_t fct) const {return m_spDDI->offset(roid,si,fct);}
270 
271 
274 
276  void print_local_dof_statistic(int verboseLev) const {m_spDDI->print_local_dof_statistic(verboseLev);}
277 
278  protected:
281 };
282 
283 
284 } // end namespace ug
285 
286 #endif /* __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION_INFO__ */
Definition: smart_pointer.h:296
@ NOT_SPECIFIED
Definition: local_dof_set.h:198
Definition: dof_distribution_info.h:47
std::vector< size_t > m_vvNumDoFsOnROIDPerSubset[NUM_REFERENCE_OBJECTS]
number of DoFs on a reference element type on a subset
Definition: dof_distribution_info.h:127
size_t max_fct_dofs(const size_t fct, int dim) const
returns the maximal number of dofs on a dimension for a function component
Definition: dof_distribution_info.h:84
size_t max_fct_dofs(const size_t fct, const ReferenceObjectID roid) const
returns the number of dofs on a reference object for a function component
Definition: dof_distribution_info.h:90
size_t max_dofs(const ReferenceObjectID roid) const
returns the maximum number of dofs on reference object type
Definition: dof_distribution_info.h:71
void print_local_dof_statistic() const
prints statistic on local dof distribution
Definition: dof_distribution_info.h:110
std::vector< size_t > m_vvMaxDoFsInDimPerSubset[NUM_GEOMETRIC_BASE_OBJECTS]
maximum number of DoFs on geometric objects in a dimension per subset
Definition: dof_distribution_info.h:124
size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo, const int si) const
returns the maximum number of dofs on a grid base object on a subset for a function component
Definition: dof_distribution_info.h:96
size_t m_vMaxDoFsInDim[NUM_GEOMETRIC_BASE_OBJECTS]
maximum number of DoFs on geometric objects in a dimension
Definition: dof_distribution_info.h:118
void create_offsets()
creates offset arrays
Definition: dof_distribution_info.cpp:57
size_t max_dofs(const int dim, const int si) const
returns the maximum number of dofs in a dimension on a subset
Definition: dof_distribution_info.h:74
size_t offset(const ReferenceObjectID roid, const int si, const size_t fct) const
returns the offset for reference element, subset and function
Definition: dof_distribution_info.h:103
void init()
initializes the DoFs
Definition: dof_distribution_info.cpp:49
size_t max_fct_dofs(const size_t fct, const int dim, const int si) const
returns the maximum number of dofs in a dimension on a subset for a function component
Definition: dof_distribution_info.h:93
DoFDistributionInfo(ConstSmartPtr< ISubsetHandler > spSH)
constructor
Definition: dof_distribution_info.cpp:45
size_t num_fct_dofs(const size_t fct, const ReferenceObjectID roid, const int si) const
returns the number of dofs on a Reference Object on a subset for a function component
Definition: dof_distribution_info.h:99
size_t num_dofs(const ReferenceObjectID roid, const int si) const
returns the number of dofs on a Reference Object on a subset
Definition: dof_distribution_info.h:80
size_t max_dofs(const int dim) const
returns the maximum number of dofs on grid objects in a dimension
Definition: dof_distribution_info.h:65
@ NOT_SPECIFIED
Definition: dof_distribution_info.h:54
@ NOT_YET_ASSIGNED
Definition: dof_distribution_info.h:52
std::vector< FctInfo > m_vFctInfo
infos for a function component
Definition: dof_distribution_info.h:148
size_t max_dofs(const GridBaseObjectId gbo, const int si) const
returns the maximum number of dofs on a grid base object on a subset
Definition: dof_distribution_info.h:77
size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo) const
returns the maximal number of dofs on a base object type for a function component
Definition: dof_distribution_info.h:87
size_t max_dofs(const GridBaseObjectId gbo) const
returns the maximum number of dofs on a grid base object type
Definition: dof_distribution_info.h:68
@ NOT_DEF_ON_SUBSET
Definition: dof_distribution_info.h:50
size_t m_vMaxDoFsOnROID[NUM_REFERENCE_OBJECTS]
maximum number of DoFs on a reference type
Definition: dof_distribution_info.h:121
Definition: dof_distribution_info.h:152
SubsetGroup all_subsets_grp_except_for(const char *names) const
returns subset group of all the subsets except for (by name)
Definition: dof_distribution_info.cpp:288
void print_local_dof_statistic() const
prints statistic on local dof distribution
Definition: dof_distribution_info.h:273
size_t max_fct_dofs(const size_t fct, const int dim, const int si) const
returns the maximum number of dofs in a dimension on a subset for a function component
Definition: dof_distribution_info.h:259
ConstSmartPtr< DoFDistributionInfo > m_spDDI
Function Pattern.
Definition: dof_distribution_info.h:280
size_t max_dofs(const int dim, const int si) const
returns the maximum number of dofs in a dimension on a subset
Definition: dof_distribution_info.h:240
size_t num_fct(int si) const
number of discrete functions on subset si
Definition: dof_distribution_info.h:179
int num_subsets() const
returns number of subsets
Definition: dof_distribution_info.h:192
bool is_def_everywhere(size_t fct) const
returns true if the discrete function nr_fct is defined everywhere
Definition: dof_distribution_info.h:220
int subset_id_by_name(const char *name) const
returns the subset id
Definition: dof_distribution_info.h:204
bool is_def_in_subset(size_t fct, int si) const
returns if a function is defined on a subset
Definition: dof_distribution_info.h:217
size_t max_dofs(const GridBaseObjectId gbo) const
returns the maximum number of dofs on a grid base object type
Definition: dof_distribution_info.h:234
size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo) const
returns the maximal number of dofs on a base object type for a function component
Definition: dof_distribution_info.h:253
size_t max_fct_dofs(const size_t fct, int dim) const
returns the maximal number of dofs on a dimension for a function component
Definition: dof_distribution_info.h:250
ConstSmartPtr< DoFDistributionInfo > dof_distribution_info() const
returns underlying info
Definition: dof_distribution_info.h:166
size_t num_fct_dofs(const size_t fct, const ReferenceObjectID roid, const int si) const
returns the number of dofs on a Reference Object on a subset for a function component
Definition: dof_distribution_info.h:265
std::string name(size_t fct) const
returns the name of the discrete function nr_fct
Definition: dof_distribution_info.h:182
int dim(size_t fct) const
returns the dimension in which solution lives
Definition: dof_distribution_info.h:195
size_t fct_id_by_name(const char *name) const
returns fct id by name
Definition: dof_distribution_info.h:188
std::vector< std::string > names() const
returns the names of the discrete functions
Definition: dof_distribution_info.h:185
size_t max_fct_dofs(const size_t fct, const ReferenceObjectID roid) const
returns the number of dofs on a reference object for a function component
Definition: dof_distribution_info.h:256
DoFDistributionInfoProvider(ConstSmartPtr< DoFDistributionInfo > spDDI)
constructor
Definition: dof_distribution_info.h:155
const LFEID & lfeid(size_t fct) const
Definition: dof_distribution_info.h:226
FunctionGroup fct_grp_by_name(const char *names) const
returns a function group to a string of functions
Definition: dof_distribution_info.cpp:278
size_t max_dofs(const int dim) const
returns the maximum number of dofs on grid objects in a dimension
Definition: dof_distribution_info.h:231
const LFEID & local_finite_element_id(size_t fct) const
Definition: dof_distribution_info.h:225
DoFDistributionInfoProvider()
constructor
Definition: dof_distribution_info.h:160
size_t max_fct_dofs(const size_t fct, const GridBaseObjectId gbo, const int si) const
returns the maximum number of dofs on a grid base object on a subset for a function component
Definition: dof_distribution_info.h:262
std::string subset_name(int si) const
returns subset name
Definition: dof_distribution_info.h:201
size_t max_dofs(const ReferenceObjectID roid) const
returns the maximum number of dofs on reference object type
Definition: dof_distribution_info.h:237
size_t num_dofs(const ReferenceObjectID roid, const int si) const
returns the number of dofs on a Reference Object on a subset
Definition: dof_distribution_info.h:246
size_t offset(const ReferenceObjectID roid, const int si, const size_t fct) const
returns the offset for reference element, subset and function
Definition: dof_distribution_info.h:269
int dim_subset(int si) const
returns dimension of subset
Definition: dof_distribution_info.h:198
void set_dof_distribution_info(ConstSmartPtr< DoFDistributionInfo > spDDI)
sets the dd info
Definition: dof_distribution_info.h:163
ConstSmartPtr< FunctionPattern > function_pattern() const
returns the function pattern
Definition: dof_distribution_info.h:172
size_t max_dofs(const GridBaseObjectId gbo, const int si) const
returns the maximum number of dofs on a grid base object on a subset
Definition: dof_distribution_info.h:243
void print_local_dof_statistic(int verboseLev) const
prints informations
Definition: dof_distribution_info.h:276
ConstSmartPtr< ISubsetHandler > subset_handler() const
returns the subset handler
Definition: dof_distribution_info.h:169
size_t num_fct() const
number of discrete functions on subset si
Definition: dof_distribution_info.h:176
SubsetGroup subset_grp_by_name(const char *names) const
returns subset group by name
Definition: dof_distribution_info.cpp:283
Definition: function_group.h:52
Describes the setup of discrete functions on a SubsetHandler.
Definition: function_pattern.h:60
int dim(size_t fct) const
returns the dimension in which solution lives
Definition: function_pattern.h:197
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
Group of subsets.
Definition: subset_group.h:51
the ug namespace
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ NUM_REFERENCE_OBJECTS
Definition: grid_base_objects.h:85
GridBaseObjectId
enumeration of the GridBaseObjects that make up a grid.
Definition: grid_base_objects.h:59
@ NUM_GEOMETRIC_BASE_OBJECTS
Definition: grid_base_objects.h:64
Definition: dof_distribution_info.h:130
std::vector< size_t > vvOffsets[NUM_REFERENCE_OBJECTS]
offset map
Definition: dof_distribution_info.h:144
std::vector< size_t > vvMaxDoFsInDimPerSubset[NUM_GEOMETRIC_BASE_OBJECTS]
maximum number of DoFs on geometric objects in a dimension per subset
Definition: dof_distribution_info.h:138
size_t vMaxDoFsOnROID[NUM_REFERENCE_OBJECTS]
number Dofs for local DoF set and subelement of element
Definition: dof_distribution_info.h:135
size_t vMaxDoFsInDim[NUM_GEOMETRIC_BASE_OBJECTS]
number Dofs for local DoF set and subelement of element
Definition: dof_distribution_info.h:132
std::vector< size_t > vvNumDoFsOnROIDPerSubset[NUM_REFERENCE_OBJECTS]
number of DoFs on a reference element type on a subset
Definition: dof_distribution_info.h:141