ug4
neumann_boundary_fv.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__SPATIAL_DISC__ELEM_DISC__NEUMANN_BOUNDARY___NEUMANN_BOUNDARY_FV__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__ELEM_DISC__NEUMANN_BOUNDARY___NEUMANN_BOUNDARY_FV__
35 
36 // other ug4 modules
37 #include "common/common.h"
38 
39 // library intern headers
40 #include "../neumann_boundary_base.h"
41 
42 namespace ug{
43 
44 template<typename TDomain>
46  : public NeumannBoundaryBase<TDomain>
47 {
48  private:
51 
54 
55  public:
57  static const int dim = base_type::dim;
58 
59  public:
61  NeumannBoundaryFV(const char* function);
62 
65  void add(SmartPtr<CplUserData<number, dim> > data, const char* BndSubsets, const char* InnerSubsets);
66  void add(SmartPtr<CplUserData<number, dim, bool> > user, const char* BndSubsets, const char* InnerSubsets);
67  void add(SmartPtr<CplUserData<MathVector<dim>, dim> > user, const char* BndSubsets, const char* InnerSubsets);
69 
70  protected:
71  using typename base_type::Data;
72 
74  struct NumberData : public base_type::Data
75  {
77  std::string BndSubsets, std::string InnerSubsets,
78  NeumannBoundaryFV* this_)
79  : base_type::Data(BndSubsets, InnerSubsets), This(this_)
80  {
81  import.set_data(data);
82  }
83 
84  template<typename TElem, typename TFVGeom>
85  void extract_bip(const TFVGeom& geo);
86 
87  template <typename TElem, typename TFVGeom>
88  void lin_def(const LocalVector& u,
89  std::vector<std::vector<number> > vvvLinDef[],
90  const size_t nip);
91 
92  template <int refDim>
93  std::vector<MathVector<refDim> >* local_ips();
94 
96  std::vector<MathVector<3> > vLocIP_dim3;
97  std::vector<MathVector<2> > vLocIP_dim2; // might have Neumann bnd for lower-dim elements!
98  std::vector<MathVector<1> > vLocIP_dim1;
99  std::vector<MathVector<dim> > vGloIP;
101  };
102  friend struct NumberData;
103 
105  struct BNDNumberData : public base_type::Data
106  {
108  std::string BndSubsets, std::string InnerSubsets)
109  : base_type::Data(BndSubsets, InnerSubsets), functor(functor_) {}
110 
112  };
113 
115  struct VectorData : public base_type::Data
116  {
118  std::string BndSubsets, std::string InnerSubsets)
119  : base_type::Data(BndSubsets, InnerSubsets), functor(functor_) {}
120 
122  };
123 
124  std::vector<NumberData> m_vNumberData;
125  std::vector<BNDNumberData> m_vBNDNumberData;
126  std::vector<VectorData> m_vVectorData;
127 
128  void update_subset_groups();
129 
130  public:
132  virtual void prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid);
133 
134  protected:
136  int m_order;
137 
140 
142  int m_si;
143 
144  protected:
147  template<typename TElem, typename TFVGeom>
148  void prep_elem_loop(const ReferenceObjectID roid, const int si);
149  template<typename TElem, typename TFVGeom>
150  void prep_elem(const LocalVector& u, GridObject* elem, const ReferenceObjectID roid, const MathVector<dim> vCornerCoords[]);
151  template<typename TElem, typename TFVGeom>
152  void finish_elem_loop();
153  template<typename TElem, typename TFVGeom>
154  void add_rhs_elem(LocalVector& d, GridObject* elem, const MathVector<dim> vCornerCoords[]);
156 
157  static const int _C_ = 0;
158 
159  protected:
160  void register_all_funcs(int order);
161  template<typename TElem, typename TFVGeom> void register_func();
162 };
163 
164 } // end namespac ug
165 
166 #endif /*__H__UG__LIB_DISC__SPATIAL_DISC__ELEM_DISC__NEUMANN_BOUNDARY___NEUMANN_BOUNDARY_FV1__*/
Definition: smart_pointer.h:108
Type based UserData.
Definition: user_data.h:501
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
Definition: elem_disc_interface.h:760
Identifier for Local Finite Elements.
Definition: local_finite_element_id.h:98
Definition: local_algebra.h:198
Definition: neumann_boundary_base.h:47
static const int dim
World dimension.
Definition: neumann_boundary_base.h:57
Definition: neumann_boundary_fv.h:47
void register_func()
Definition: neumann_boundary_fv.cpp:463
std::vector< NumberData > m_vNumberData
Definition: neumann_boundary_fv.h:124
void finish_elem_loop()
Definition: neumann_boundary_fv.cpp:266
void prep_elem(const LocalVector &u, GridObject *elem, const ReferenceObjectID roid, const MathVector< dim > vCornerCoords[])
Definition: neumann_boundary_fv.cpp:179
std::vector< BNDNumberData > m_vBNDNumberData
Definition: neumann_boundary_fv.h:125
void add_rhs_elem(LocalVector &d, GridObject *elem, const MathVector< dim > vCornerCoords[])
Definition: neumann_boundary_fv.cpp:197
NeumannBoundaryBase< TDomain > base_type
Base class type.
Definition: neumann_boundary_fv.h:50
void prep_elem_loop(const ReferenceObjectID roid, const int si)
Definition: neumann_boundary_fv.cpp:119
LFEID m_lfeID
current shape function set
Definition: neumann_boundary_fv.h:139
virtual void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegularGrid)
type of trial space for each function used
Definition: neumann_boundary_fv.cpp:53
NeumannBoundaryFV< TDomain > this_type
Base class type.
Definition: neumann_boundary_fv.h:53
static const int dim
World dimension.
Definition: neumann_boundary_fv.h:57
void update_subset_groups()
Definition: neumann_boundary_fv.cpp:101
void register_all_funcs(int order)
int m_si
current inner subset
Definition: neumann_boundary_fv.h:142
static const int _C_
Definition: neumann_boundary_fv.h:157
NeumannBoundaryFV(const char *function)
default constructor
Definition: neumann_boundary_fv.cpp:44
std::vector< VectorData > m_vVectorData
Definition: neumann_boundary_fv.h:126
int m_order
current order of disc scheme
Definition: neumann_boundary_fv.h:136
void add(SmartPtr< CplUserData< number, dim > > data, const char *BndSubsets, const char *InnerSubsets)
Definition: neumann_boundary_fv.cpp:78
the ug namespace
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
base class for user data
Definition: neumann_boundary_base.h:87
Conditional scalar user data.
Definition: neumann_boundary_fv.h:106
BNDNumberData(SmartPtr< CplUserData< number, dim, bool > > functor_, std::string BndSubsets, std::string InnerSubsets)
Definition: neumann_boundary_fv.h:107
SmartPtr< CplUserData< number, dim, bool > > functor
Definition: neumann_boundary_fv.h:111
Unconditional scalar user data.
Definition: neumann_boundary_fv.h:75
NumberData(SmartPtr< CplUserData< number, dim > > data, std::string BndSubsets, std::string InnerSubsets, NeumannBoundaryFV *this_)
Definition: neumann_boundary_fv.h:76
std::vector< MathVector< 3 > > vLocIP_dim3
Definition: neumann_boundary_fv.h:96
std::vector< MathVector< refDim > > * local_ips()
Definition: neumann_boundary_fv.cpp:361
void lin_def(const LocalVector &u, std::vector< std::vector< number > > vvvLinDef[], const size_t nip)
Definition: neumann_boundary_fv.cpp:309
void extract_bip(const TFVGeom &geo)
Definition: neumann_boundary_fv.cpp:332
NeumannBoundaryFV * This
Definition: neumann_boundary_fv.h:100
std::vector< MathVector< 1 > > vLocIP_dim1
Definition: neumann_boundary_fv.h:98
std::vector< MathVector< dim > > vGloIP
Definition: neumann_boundary_fv.h:99
std::vector< MathVector< 2 > > vLocIP_dim2
Definition: neumann_boundary_fv.h:97
Unconditional vector user data.
Definition: neumann_boundary_fv.h:116
VectorData(SmartPtr< CplUserData< MathVector< dim >, dim > > functor_, std::string BndSubsets, std::string InnerSubsets)
Definition: neumann_boundary_fv.h:117
SmartPtr< CplUserData< MathVector< dim >, dim > > functor
Definition: neumann_boundary_fv.h:121