Line data Source code
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_FE__
34 : #define __H__UG__LIB_DISC__SPATIAL_DISC__ELEM_DISC__NEUMANN_BOUNDARY___NEUMANN_BOUNDARY_FE__
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>
45 : class NeumannBoundaryFE
46 : : public NeumannBoundaryBase<TDomain>
47 : {
48 : private:
49 : /// Base class type
50 : typedef NeumannBoundaryBase<TDomain> base_type;
51 :
52 : /// Base class type
53 : typedef NeumannBoundaryFE<TDomain> this_type;
54 :
55 : public:
56 : /// World dimension
57 : static const int dim = base_type::dim;
58 :
59 : public:
60 : /// default constructor
61 : NeumannBoundaryFE(const char* function);
62 :
63 : /// add a boundary value
64 : /// \{
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);
68 : /// \}
69 :
70 : protected:
71 : using typename base_type::Data;
72 :
73 : /// Unconditional scalar user data
74 : struct NumberData : public base_type::Data
75 : {
76 0 : NumberData(SmartPtr<CplUserData<number, dim> > data,
77 : std::string BndSubsets, std::string InnerSubsets,
78 : NeumannBoundaryFE* this_)
79 0 : : base_type::Data(BndSubsets, InnerSubsets), This(this_)
80 : {
81 0 : import.set_data(data);
82 0 : }
83 :
84 : template<typename TElem, typename TFEGeom>
85 : void extract_bip(const TFEGeom& geo);
86 :
87 : template <typename TElem, typename TFEGeom>
88 : void lin_def(const LocalVector& u,
89 : std::vector<std::vector<number> > vvvLinDef[],
90 : const size_t nip);
91 :
92 : DataImport<number, dim> import;
93 : std::vector<MathVector<dim> > vLocIP;
94 : std::vector<MathVector<dim> > vGloIP;
95 : NeumannBoundaryFE* This;
96 : };
97 : friend struct NumberData;
98 :
99 : /// Conditional scalar user data
100 0 : struct BNDNumberData : public base_type::Data
101 : {
102 0 : BNDNumberData(SmartPtr<CplUserData<number, dim, bool> > functor_,
103 : std::string BndSubsets, std::string InnerSubsets)
104 0 : : base_type::Data(BndSubsets, InnerSubsets), functor(functor_) {}
105 :
106 : SmartPtr<CplUserData<number, dim, bool> > functor;
107 : };
108 :
109 : /// Unconditional vector user data
110 0 : struct VectorData : public base_type::Data
111 : {
112 0 : VectorData(SmartPtr<CplUserData<MathVector<dim>, dim> > functor_,
113 : std::string BndSubsets, std::string InnerSubsets)
114 0 : : base_type::Data(BndSubsets, InnerSubsets), functor(functor_) {}
115 :
116 : SmartPtr<CplUserData<MathVector<dim>, dim> > functor;
117 : };
118 :
119 : std::vector<NumberData> m_vNumberData;
120 : std::vector<BNDNumberData> m_vBNDNumberData;
121 : std::vector<VectorData> m_vVectorData;
122 :
123 : void update_subset_groups();
124 :
125 : public:
126 : /// type of trial space for each function used
127 : virtual void prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid);
128 :
129 : protected:
130 : /// current order of disc scheme
131 : int m_order;
132 : int m_quadOrder;
133 :
134 : /// current shape function set
135 : LFEID m_lfeID;
136 :
137 : /// current inner subset
138 : int m_si;
139 :
140 : protected:
141 : /// assembling functions for fv1
142 : /// \{
143 : template<typename TElem, typename TFEGeom>
144 : void prep_elem_loop(const ReferenceObjectID roid, const int si);
145 : template<typename TElem, typename TFEGeom>
146 : void prep_elem(const LocalVector& u, GridObject* elem, const ReferenceObjectID roid, const MathVector<dim> vCornerCoords[]);
147 : template<typename TElem, typename TFEGeom>
148 : void finish_elem_loop();
149 : template<typename TElem, typename TFEGeom>
150 : void add_rhs_elem(LocalVector& d, GridObject* elem, const MathVector<dim> vCornerCoords[]);
151 : /// \}
152 :
153 : static const int _C_ = 0;
154 :
155 : protected:
156 : void register_all_funcs(int order);
157 : template<typename TElem, typename TFEGeom> void register_func();
158 : };
159 :
160 : } // end namespac ug
161 :
162 : #endif /*__H__UG__LIB_DISC__SPATIAL_DISC__ELEM_DISC__NEUMANN_BOUNDARY___NEUMANN_BOUNDARY_FE1__*/
|