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 : #include "fe_geom.h"
34 :
35 : namespace ug{
36 :
37 : ////////////////////////////////////////////////////////////////////////////////
38 : // FEGeometry
39 : ////////////////////////////////////////////////////////////////////////////////
40 :
41 : template < typename TElem, int TWorldDim,
42 : typename TTrialSpace, typename TQuadratureRule>
43 0 : FEGeometry<TElem,TWorldDim,TTrialSpace,TQuadratureRule>::
44 : FEGeometry()
45 0 : : m_rQuadRule(Provider<quad_rule_type>::get()),
46 0 : m_rTrialSpace(Provider<trial_space_type>::get())
47 : {
48 : // evaluate local shapes and gradients
49 0 : for(size_t ip = 0; ip < nip; ++ip)
50 0 : for(size_t sh = 0; sh < nsh; ++sh)
51 : {
52 0 : m_vvShape[ip][sh] = m_rTrialSpace.shape(sh, m_rQuadRule.point(ip));
53 0 : m_rTrialSpace.grad(m_vvGradLocal[ip][sh], sh, m_rQuadRule.point(ip));
54 : }
55 0 : }
56 :
57 : template < typename TElem, int TWorldDim,
58 : typename TTrialSpace, typename TQuadratureRule>
59 : void
60 0 : FEGeometry<TElem,TWorldDim,TTrialSpace,TQuadratureRule>::
61 : update_local(ReferenceObjectID roid, const LFEID& lfeID, size_t orderQuad)
62 : {
63 0 : if(roid != geometry_traits<TElem>::REFERENCE_OBJECT_ID)
64 0 : UG_THROW("FEGeometry::update: Geometry only for "
65 : <<geometry_traits<TElem>::REFERENCE_OBJECT_ID<<", but "
66 : <<roid<<" requested.");
67 :
68 0 : if(orderQuad > m_rQuadRule.order())
69 0 : UG_THROW("FEGeometry::update: Geometry only for order "
70 : << m_rQuadRule.order()<<", but order "<<
71 : orderQuad<<" requested.");
72 0 : }
73 :
74 : template < typename TElem, int TWorldDim,
75 : typename TTrialSpace, typename TQuadratureRule>
76 : void
77 0 : FEGeometry<TElem,TWorldDim,TTrialSpace,TQuadratureRule>::
78 : update(GridObject* elem, const MathVector<worldDim>* vCorner,
79 : const LFEID& lfeID, size_t orderQuad)
80 : {
81 : // check
82 : UG_ASSERT(orderQuad <= m_rQuadRule.order(), "Wrong order requested.");
83 :
84 : UG_ASSERT(dynamic_cast<TElem*>(elem) != NULL, "Wrong element type.");
85 : TElem* pElem = static_cast<TElem*>(elem);
86 :
87 : // check if element changed
88 0 : if(pElem == m_pElem) return;
89 0 : else m_pElem = pElem;
90 :
91 : // update the mapping for the new corners
92 0 : m_mapping.update(vCorner);
93 :
94 : // compute global integration points
95 0 : m_mapping.local_to_global(&m_vIPGlobal[0], local_ips(), nip);
96 :
97 : // evaluate global data
98 0 : m_mapping.jacobian_transposed_inverse(&m_vJTInv[0], &m_vDetJ[0],
99 : local_ips(), nip);
100 :
101 : // compute global gradients
102 0 : for(size_t ip = 0; ip < nip; ++ip)
103 0 : for(size_t sh = 0; sh < nsh; ++sh)
104 : MatVecMult(m_vvGradGlobal[ip][sh],
105 : m_vJTInv[ip], m_vvGradLocal[ip][sh]);
106 : }
107 :
108 : } // end namespace ug
|