ug4
fvcr_geom.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3  * Author: Christian Wehner
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 /*
34  * Node centered finite volume geometry for Crouzeix-Raviart-Elements
35  */
36 
37 #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__DISC_HELPER__CR_FINITE_VOLUME_GEOMETRY__
38 #define __H__UG__LIB_DISC__SPATIAL_DISC__DISC_HELPER__CR_FINITE_VOLUME_GEOMETRY__
39 
40 // extern libraries
41 #include <cmath>
42 #include <map>
43 #include <vector>
44 
45 // other ug4 modules
46 #include "common/common.h"
47 
48 // library intern includes
58 
59 #include "fv_geom_base.h"
60 #include "fv_util.h"
61 #include "hfvcr_geom.h"
62 
63 namespace ug{
64 
65 /* crfv traits */
66 
67 template <int TWorldDim,int nrfaceco> struct crfv_traits
68 {
69  typedef void scv_type;
70  typedef void face_type;
71  static const size_t maxNumSCVF;
72  static const size_t maxNumSCV;
73  static const size_t maxNSH;
74  static const size_t maxNumCo;
75 };
76 
77 template <> struct crfv_traits<1, 1>
78 {
81  static const size_t maxNumSCVF = 1;
82  static const size_t maxNumSCV = 2;
83  static const size_t maxNSH = maxNumSCV;
84  static const size_t maxNumCo = 2;
85 };
86 
87 template <> struct crfv_traits<1, 2>
88 {
91  static const size_t maxNumSCVF = 1;
92  static const size_t maxNumSCV = 2;
93  static const size_t maxNSH = maxNumSCV;
94  static const size_t maxNumCo = 2;
95 };
96 
97 template <> struct crfv_traits<2, 2>
98 {
101  static const size_t maxNumSCVF = 4;
102  static const size_t maxNumSCV = 4;
103  static const size_t maxNSH = maxNumSCV;
104  static const size_t maxNumCo = 4;
105 };
106 
107 template <> struct crfv_traits<2, 3>
108 {
111  static const size_t maxNumSCVF = 4;
112  static const size_t maxNumSCV = 4;
113  static const size_t maxNSH = maxNumSCV;
114  static const size_t maxNumCo = 4;
115 };
116 
117 template <> struct crfv_traits<3, 3>
118 {
121  static const size_t maxNumSCVF = 10;
122  static const size_t maxNumSCV = 6;
123  static const size_t maxNSH = maxNumSCV;
124  static const size_t maxNumCo = 8;
125 };
126 
127 template <> struct crfv_traits<3, 4>
128 {
131  static const size_t maxNumSCVF = 10;
132  static const size_t maxNumSCV = 6;
133  static const size_t maxNSH = maxNumSCV;
134  static const size_t maxNumCo = 8;
135 };
136 
139 // Dim-dependent Finite Volume Geometry
142 
145 //
146 // basics:
147 // Unknowns are centered in element vertices(1d)/edges(2d)/faces(3d)
148 // scv i corners are given by face i corners + element barycenter
149 // scvf i corners are given by edge i + element barycenter
150 //
151 // important differences to standard linear Lagrange FV class:
152 //
153 // new scv class parameter "Normal" is normal on associated face (this is computed for
154 // Navier-Stokes-Crouzeix-Raviart-staggered grid continuity equation discretization)
155 // midpoint computations and related parameters eliminated (not necessary for scv computation)
156 // parameter nodeID refers to node located in edge/face for the unknown, not to corner node
157 // ip of scv is not corner but associated edge/face midpoint
158 // location of unknowns (edge/face barycenter) is stored in m_vLocUnkCoords, m_vGlobUnkCoords
159 //
164 template <int TDim, int TWorldDim = TDim>
166 {
167  public:
171 
172  public:
174  static const int dim = TDim;
175 
177  static const int worldDim = TWorldDim;
178 
180  static const bool usesHangingNodes = false;
181 
183  static const bool staticLocalData = false;
184 
185  public:
187  static const int order = 1;
188 
190  static const size_t maxNumSCV = htraits::maxNumSCV;
191 
197 
199  static const size_t maxNumSCVF = htraits::maxNumSCVF;
200 
202  static const size_t maxNSH = htraits::maxNSH;
203 
204  static const size_t maxNumCo = traits::maxNumCo;
205 
207  static const size_t nip = 1;
208 
209  // local/global element barycenter
212 
213  public:
215 
224  class SCVF
225  {
226  public:
228  static const size_t numCo = dim;
229 
230  public:
231  SCVF() {}
232 
234  inline size_t from() const {return From;}
235 
237  inline size_t to() const {return To;}
238 
240  inline size_t num_ip() const {return nip;}
241 
243  inline const MathVector<dim>& local_ip() const {return localIP;}
244 
246  inline const MathVector<worldDim>& global_ip() const {return globalIP;}
247 
249  inline const MathVector<worldDim>& normal() const {return Normal;}
250 
252  inline const MathMatrix<worldDim,dim>& JTInv() const {return JtInv;}
253 
255  inline number detJ() const {return detj;}
256 
258  inline size_t num_sh() const {return numSH;}
259 
261  inline number shape(size_t sh) const {return vShape[sh];}
262 
264  inline const number* shape_vector() const {return vShape;}
265 
267  inline const MathVector<dim>& local_grad(size_t sh) const
268  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vLocalGrad[sh];}
269 
271  inline const MathVector<dim>* local_grad_vector() const {return vLocalGrad;}
272 
274  inline const MathVector<worldDim>& global_grad(size_t sh) const
275  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vGlobalGrad[sh];}
276 
278  inline const MathVector<worldDim>* global_grad_vector() const {return vGlobalGrad;}
279 
281  inline size_t num_corners() const {return numCo;}
282 
284  inline const MathVector<dim>& local_corner(size_t co) const
285  {UG_ASSERT(co < num_corners(), "Invalid index."); return vLocPos[co];}
286 
288  inline const MathVector<worldDim>& global_corner(size_t co) const
289  {UG_ASSERT(co < num_corners(), "Invalid index."); return vGloPos[co];}
290 
291  public:
292  inline void operator = (const SCVF &s)
293  {
294  From = s.from();
295  To = s.to();
296  localIP = s.local_ip();
297  globalIP = s.global_ip();
298  Normal = s.normal();
299  JtInv = s.JTInv();
300  detj = s.detJ();
301  numSH = s.num_sh();
302  for (size_t i=0;i<numSH;i++){
303  vLocalGrad[i] = s.global_grad(i);
304  vGlobalGrad[i] = s.global_grad(i);
305  vShape[i] = s.shape(i);
306  }
307  for (size_t i=0;i<numCo;i++){
308  vLocPos[i] = s.local_corner(i);
309  vGloPos[i] = s.global_corner(i);
310  }
311  }
312 
313  private:
314  // let outer class access private members
315  friend class DimCRFVGeometry<dim, worldDim>;
316 
317  // This scvf separates the scv with the ids given in "from" and "to"
318  // The computed normal points in direction from->to
319  size_t From, To;
320 
321  // The normal on the SCVF pointing (from -> to)
322  MathVector<worldDim> Normal; // normal (incl. area)
323 
324  MathVector<dim> vLocPos[numCo]; // local corners of scvf
325  MathVector<worldDim> vGloPos[numCo]; // global corners of scvf
326 
327  // scvf part
328  MathVector<dim> localIP; // local integration point
329  MathVector<worldDim> globalIP; // global integration point
330 
331  // shapes and derivatives
332  size_t numSH;
333  number vShape[maxNSH]; // shapes at ip
334  MathVector<dim> vLocalGrad[maxNSH]; // local grad at ip
335  MathVector<worldDim> vGlobalGrad[maxNSH]; // global grad at ip
336  MathMatrix<worldDim,dim> JtInv; // Jacobian transposed at ip
337  number detj; // Jacobian det at ip
338  };
339 
341  class SCV
342  {
343  public:
345  static const size_t maxNumCo = 5;
346 
347  public:
349 
351  inline number volume() const {return Vol;}
352 
354  inline size_t num_corners() const {return numCorners;}
355 
357  inline const MathVector<dim>& local_corner(size_t co) const
358  {UG_ASSERT(co < num_corners(), "Invalid index."); return vLocPos[co];}
359 
361  inline const MathVector<worldDim>& global_corner(size_t co) const
362  {UG_ASSERT(co < num_corners(), "Invalid index."); return vGloPos[co];}
363 
365  inline size_t node_id() const {return nodeID;}
366 
368  inline size_t num_ip() const {return nip;}
369 
371  inline const MathVector<dim>& local_ip() const {return vLocIP;}
372 
374  inline const MathVector<worldDim>& global_ip() const {return vGlobIP;}
375 
377  inline const MathVector<worldDim>& normal() const {return Normal;}
378 
380  inline const MathMatrix<worldDim,dim>& JTInv() const {return JtInv;}
381 
383  inline number detJ() const {return detj;}
384 
386  inline size_t num_sh() const {return numSH;}
387 
389  inline number shape(size_t sh) const {return vShape[sh];}
390 
392  inline const number* shape_vector() const {return vShape;}
393 
395  inline const MathVector<dim>& local_grad(size_t sh) const
396  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vLocalGrad[sh];}
397 
399  inline const MathVector<dim>* local_grad_vector() const {return vLocalGrad;}
400 
402  inline const MathVector<worldDim>& global_grad(size_t sh) const
403  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vGlobalGrad[sh];}
404 
406  inline const MathVector<worldDim>* global_grad_vector() const {return vGlobalGrad;}
407 
408  private:
409  // let outer class access private members
410  friend class DimCRFVGeometry<dim, worldDim>;
411 
412  // The normal on the associated face pointing outward
413  MathVector<worldDim> Normal; // normal (incl. area)
414 
415  // node id of associated node
416  size_t nodeID;
417 
418  // volume of scv
420 
421  // number of corners of this element
423 
424  // local and global positions of this element
425  MathVector<dim> vLocPos[maxNumCo]; // local position of node
426  MathVector<worldDim> vGloPos[maxNumCo]; // global position of node
429 
430  // shapes and derivatives
431  size_t numSH;
432  number vShape[maxNSH]; // shapes at ip
433  MathVector<dim> vLocalGrad[maxNSH]; // local grad at ip
434  MathVector<worldDim> vGlobalGrad[maxNSH]; // global grad at ip
435  MathMatrix<worldDim,dim> JtInv; // Jacobian transposed at ip
436  number detj; // Jacobian det at ip
437  };
438 
440  class BF
441  {
442  public:
444  static const size_t maxNumCo=4;
445 
446  public:
447  BF() {}
448 
450  inline size_t node_id() const {return nodeID;}
451 
453  inline size_t num_ip() const {return nip;}
454 
456  inline const MathVector<dim>& local_ip() const {return localIP;}
457 
459  inline const MathVector<worldDim>& global_ip() const {return globalIP;}
460 
462  inline const MathVector<worldDim>& normal() const {return Normal;} // includes area
463 
465  inline number volume() const {return Vol;}
466 
468  inline const MathMatrix<worldDim, dim>& JTInv() const {return JtInv;}
469 
471  inline number detJ() const {return detj;}
472 
474  inline size_t num_sh() const {return numSH;}
475 
477  inline number shape(size_t sh) const
478  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vShape[sh];}
479 
481  inline const number* shape_vector() const {return vShape;}
482 
484  inline const MathVector<dim>& local_grad(size_t sh) const
485  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vLocalGrad[sh];}
486 
488  inline const MathVector<dim>* local_grad_vector() const {return vLocalGrad;}
489 
491  inline const MathVector<worldDim>& global_grad(size_t sh) const
492  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vGlobalGrad[sh];}
493 
495  inline const MathVector<worldDim>* global_grad_vector() const {return vGlobalGrad;}
496 
498  inline size_t num_corners() const {return numCo;}
499 
501  inline const MathVector<dim>& local_corner(size_t co) const
502  {UG_ASSERT(co < num_corners(), "Invalid index."); return vLocPos[co];}
503 
505  inline const MathVector<worldDim>& global_corner(size_t co) const
506  {UG_ASSERT(co < num_corners(), "Invalid index."); return vGloPos[co];}
507 
508  private:
510  friend class DimCRFVGeometry<dim, worldDim>;
511 
512  // id of scv this bf belongs to
513  size_t nodeID;
514 
515  size_t numCo;
516 
517  MathVector<dim> vLocPos[maxNumCo]; // local corners of bf
518  MathVector<worldDim> vGloPos[maxNumCo]; // global corners of bf
519 
520  // scvf part
521  MathVector<dim> localIP; // local integration point
522  MathVector<worldDim> globalIP; // global integration point
523  MathVector<worldDim> Normal; // normal (incl. area)
524  number Vol; // volume of bf
525 
526  // shapes and derivatives
527  size_t numSH;
528  number vShape[maxNSH]; // shapes at ip
529  MathVector<dim> vLocalGrad[maxNSH]; // local grad at ip
530  MathVector<worldDim> vGlobalGrad[maxNSH]; // global grad at ip
531  MathMatrix<worldDim,dim> JtInv; // Jacobian transposed at ip
532  number detj; // Jacobian det at ip
533  };
534 
536  {
537  public:
538  static const size_t maxNumConstrainingDofs = 4;
539  inline size_t constraining_dofs_index(size_t i) const{
540  return cDofInd[i];
541  }
542  inline number constraining_dofs_weight(size_t i) const{
543  return cDofWeights[i];
544  }
545  inline size_t index() const{
546  return i;
547  }
548  inline size_t num_constraining_dofs() const{
549  return numConstrainingDofs;
550  }
551  private:
552  // let outer class access private members
553  friend class DimCRFVGeometry<dim, worldDim>;
554 
555  // constraining dofs indices
557  // weights
559  // local index of dof in element
560  size_t i;
561  // nr of constraining dofs
563  };
564 
566  {
567  public:
568  size_t index;
569  size_t associatedSCV[2];
570  size_t scvfIndex;
571  // indicates if the handled side is from or to
572  bool from;
573  };
574 
575  public:
578 
580  void update_local_data();
581 
583  void update(GridObject* elem, const MathVector<worldDim>* vCornerCoords,
584  const ISubsetHandler* ish = NULL);
585 
587  void update_hanging(GridObject* elem, const MathVector<worldDim>* vCornerCoords,
588  const ISubsetHandler* ish = NULL,bool keepSCV=false,bool keepSCVF=false);
589 
591  void update_geometric_data(GridObject* elem, const MathVector<worldDim>* vCornerCoords,
592  const ISubsetHandler* ish = NULL);
593 
596  const MathVector<worldDim>* vCornerCoords,
597  const ISubsetHandler* ish = NULL);
598 
600  inline size_t num_scvf() const {return m_numSCVF;};
601 
603  inline const SCVF& scvf(size_t i) const
604  {UG_ASSERT(i < num_scvf(), "Invalid Index."); return m_vSCVF[i];}
605 
607  inline size_t num_scv() const {return m_numSCV;}
608 
610  inline const SCV& scv(size_t i) const
611  {UG_ASSERT(i < num_scv(), "Invalid Index."); return m_vSCV[i];}
612 
614  inline size_t num_constrained_dofs() const {return m_numConstrainedDofs;}
615 
617  inline const CONSTRAINED_DOF& constrained_dof(size_t i) const
618  {UG_ASSERT(i < m_numConstrainedDofs, "Invalid Index."); return m_vCD[i];}
619 
622 
624  inline size_t num_sh() const {return m_nsh;};
625 
626  public:
628  size_t num_scvf_ips() const {return m_numSCVF;}
629 
632 
635 
637  size_t num_scv_ips() const {return m_numSCV;}
638 
641 
644 
646  const MathVector<dim> local_bary() const {return localBary;}
647 
650 
651  protected:
652  // global and local ips on SCVF
655  // coord of location for unknowns in faces (edge/face barycenter)
658 
659  public:
661  inline void add_boundary_subset(int subsetIndex) {m_mapVectorBF[subsetIndex];}
662 
664  inline void remove_boundary_subset(int subsetIndex) {m_mapVectorBF.erase(subsetIndex);}
665 
667  inline void clear_boundary_subsets() {m_mapVectorBF.clear();}
668 
670  inline size_t num_boundary_subsets() {return m_mapVectorBF.size();}
671 
673  inline size_t num_bf() const
674  {
675  typename std::map<int, std::vector<BF> >::const_iterator it;
676  size_t num = 0;
677  for ( it=m_mapVectorBF.begin() ; it != m_mapVectorBF.end(); it++ )
678  num += (*it).second.size();
679  return num;
680  }
681 
683  inline size_t num_bf(int subsetIndex) const
684  {
685  typename std::map<int, std::vector<BF> >::const_iterator it;
686  it = m_mapVectorBF.find(subsetIndex);
687  if(it == m_mapVectorBF.end()) return 0;
688  else return (*it).second.size();
689  }
690 
692  inline const BF& bf(int subsetIndex, size_t i) const
693  {
694  UG_ASSERT(i < num_bf(subsetIndex), "Invalid index.");
695  typename std::map<int, std::vector<BF> >::const_iterator it;
696  it = m_mapVectorBF.find(subsetIndex);
697  UG_ASSERT(it != m_mapVectorBF.end(), "Bnd Subset Index not requested.")
698  return (*it).second[i];
699  }
700 
702  inline const std::vector<BF>& bf(int subsetIndex) const
703  {
704  typename std::map<int, std::vector<BF> >::const_iterator it;
705  it = m_mapVectorBF.find(subsetIndex);
706  UG_ASSERT(it != m_mapVectorBF.end(), "Bnd Subset Index not requested.")
707  return (*it).second;
708  }
709 
710  protected:
711  std::map<int, std::vector<BF> > m_mapVectorBF;
712 
715 
716  std::vector<HandledEdge> handledEdges;
717 
718  private:
721 
724 
727 
729  size_t m_numSCV;
730 
732  size_t m_numSCVF;
733 
735  size_t m_nsh;
736 
739 
742 
745 
748 
750  size_t m_numDofs;
751 
753 
755 
756  static const size_t deleted = 117;
757 };
758 
761 // Dimension-indipendent Finite Volume Geometry
764 
765 template < typename TElem, int TWorldDim>
767 {
768  public:
770  typedef TElem elem_type;
771 
774 
776  static const int dim = ref_elem_type::dim;
777 
779  static const int worldDim = TWorldDim;
780 
782  static const bool usesHangingNodes = false;
783 
785  static const bool staticLocalData = true;
786 
789 
791  static const size_t nsh = local_shape_fct_set_type::nsh;
792 
794  static const size_t numSCV = nsh;
795 
797  static const size_t numSCVF = ref_elem_type::numEdges;
798 
799  static const size_t maxNumSCVF = ref_elem_type::numEdges;
800 
801  public:
803  static const int order = 1;
804 
810 
812  static const size_t nip = 1;
813 
814  // local/global element barycenter
817 
818  public:
820 
829  class SCVF
830  {
831  public:
833  static const size_t numCo = dim;
834 
835  public:
836  SCVF() {}
837 
839  inline size_t from() const {return From;}
840 
842  inline size_t to() const {return To;}
843 
845  inline size_t num_ip() const {return nip;}
846 
848  inline const MathVector<dim>& local_ip() const {return localIP;}
849 
851  inline const MathVector<worldDim>& global_ip() const {return globalIP;}
852 
854  inline const MathVector<worldDim>& normal() const {return Normal;}
855 
857  inline const MathMatrix<worldDim,dim>& JTInv() const {return JtInv;}
858 
860  inline number detJ() const {return detj;}
861 
863  inline size_t num_sh() const {return nsh;}
864 
866  inline number shape(size_t sh) const {return vShape[sh];}
867 
869  inline const number* shape_vector() const {return vShape;}
870 
872  inline const MathVector<dim>& local_grad(size_t sh) const
873  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vLocalGrad[sh];}
874 
876  inline const MathVector<dim>* local_grad_vector() const {return vLocalGrad;}
877 
879  inline const MathVector<worldDim>& global_grad(size_t sh) const
880  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vGlobalGrad[sh];}
881 
883  inline const MathVector<worldDim>* global_grad_vector() const {return vGlobalGrad;}
884 
886  inline size_t num_corners() const {return numCo;}
887 
889  inline const MathVector<dim>& local_corner(size_t co) const
890  {UG_ASSERT(co < num_corners(), "Invalid index."); return vLocPos[co];}
891 
893  inline const MathVector<worldDim>& global_corner(size_t co) const
894  {UG_ASSERT(co < num_corners(), "Invalid index."); return vGloPos[co];}
895 
896  private:
897  // let outer class access private members
898  friend class CRFVGeometry<TElem, TWorldDim>;
899 
900  // This scvf separates the scv with the ids given in "from" and "to"
901  // The computed normal points in direction from->to
902  size_t From, To;
903 
904  // The normal on the SCVF pointing (from -> to)
905  MathVector<worldDim> Normal; // normal (incl. area)
906 
907  MathVector<dim> vLocPos[numCo]; // local corners of scvf
908  MathVector<worldDim> vGloPos[numCo]; // global corners of scvf
909 
910  // scvf part
911  MathVector<dim> localIP; // local integration point
912  MathVector<worldDim> globalIP; // global integration point
913 
914  // shapes and derivatives
915  number vShape[nsh]; // shapes at ip
916  MathVector<dim> vLocalGrad[nsh]; // local grad at ip
917  MathVector<worldDim> vGlobalGrad[nsh]; // global grad at ip
918  MathMatrix<worldDim,dim> JtInv; // Jacobian transposed at ip
919  number detj; // Jacobian det at ip
920  };
921 
923  class SCV
924  {
925  public:
927  static const size_t maxNumCo = 5;
928 
929  public:
931 
933  inline number volume() const {return Vol;}
934 
936  inline size_t num_corners() const {return numCorners;}
937 
939  inline const MathVector<dim>& local_corner(size_t co) const
940  {UG_ASSERT(co < num_corners(), "Invalid index."); return vLocPos[co];}
941 
943  inline const MathVector<worldDim>& global_corner(size_t co) const
944  {UG_ASSERT(co < num_corners(), "Invalid index."); return vGloPos[co];}
945 
947  inline size_t node_id() const {return nodeID;}
948 
950  inline size_t num_ip() const {return nip;}
951 
953  inline const MathVector<dim>& local_ip() const {return vLocIP;}
954 
956  inline const MathVector<worldDim>& global_ip() const {return vGlobIP;}
957 
959  inline const MathVector<worldDim>& normal() const {return Normal;}
960 
962  inline const MathMatrix<worldDim,dim>& JTInv() const {return JtInv;}
963 
965  inline number detJ() const {return detj;}
966 
968  inline size_t num_sh() const {return nsh;}
969 
971  inline number shape(size_t sh) const {return vShape[sh];}
972 
974  inline const number* shape_vector() const {return vShape;}
975 
977  inline const MathVector<dim>& local_grad(size_t sh) const
978  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vLocalGrad[sh];}
979 
981  inline const MathVector<dim>* local_grad_vector() const {return vLocalGrad;}
982 
984  inline const MathVector<worldDim>& global_grad(size_t sh) const
985  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vGlobalGrad[sh];}
986 
988  inline const MathVector<worldDim>* global_grad_vector() const {return vGlobalGrad;}
989 
990  private:
991  // let outer class access private members
992  friend class CRFVGeometry<TElem, TWorldDim>;
993 
994  // The normal on the associated face pointing outward
995  MathVector<worldDim> Normal; // normal (incl. area)
996 
997  // node id of associated node
998  size_t nodeID;
999 
1000  // volume of scv
1002 
1003  // number of corners of this element
1005 
1006  // local and global positions of this element
1007  MathVector<dim> vLocPos[maxNumCo]; // local position of node
1008  MathVector<worldDim> vGloPos[maxNumCo]; // global position of node
1009 
1010  MathVector<dim> vLocIP; // local position of node
1011  MathVector<worldDim> vGlobIP; // global position of node
1012 
1013  // shapes and derivatives
1014  number vShape[nsh]; // shapes at ip
1015  MathVector<dim> vLocalGrad[nsh]; // local grad at ip
1016  MathVector<worldDim> vGlobalGrad[nsh]; // global grad at ip
1017  MathMatrix<worldDim,dim> JtInv; // Jacobian transposed at ip
1018  number detj; // Jacobian det at ip
1019  };
1020 
1022  class BF
1023  {
1024  public:
1026  static const size_t maxNumCo=4;
1027 
1028  public:
1029  BF() {}
1030 
1032  inline size_t node_id() const {return nodeID;}
1033 
1035  inline size_t num_ip() const {return nip;}
1036 
1038  inline const MathVector<dim>& local_ip() const {return localIP;}
1039 
1041  inline const MathVector<worldDim>& global_ip() const {return globalIP;}
1042 
1044  inline const MathVector<worldDim>& normal() const {return Normal;} // includes area
1045 
1047  inline number volume() const {return Vol;}
1048 
1050  inline const MathMatrix<worldDim, dim>& JTInv() const {return JtInv;}
1051 
1053  inline number detJ() const {return detj;}
1054 
1056  inline size_t num_sh() const {return nsh;}
1057 
1059  inline number shape(size_t sh) const
1060  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vShape[sh];}
1061 
1063  inline const number* shape_vector() const {return vShape;}
1064 
1066  inline const MathVector<dim>& local_grad(size_t sh) const
1067  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vLocalGrad[sh];}
1068 
1070  inline const MathVector<dim>* local_grad_vector() const {return vLocalGrad;}
1071 
1073  inline const MathVector<worldDim>& global_grad(size_t sh) const
1074  {UG_ASSERT(sh < num_sh(), "Invalid index"); return vGlobalGrad[sh];}
1075 
1077  inline const MathVector<worldDim>* global_grad_vector() const {return vGlobalGrad;}
1078 
1080  inline size_t num_corners() const {return numCo;}
1081 
1083  inline const MathVector<dim>& local_corner(size_t co) const
1084  {UG_ASSERT(co < num_corners(), "Invalid index."); return vLocPos[co];}
1085 
1087  inline const MathVector<worldDim>& global_corner(size_t co) const
1088  {UG_ASSERT(co < num_corners(), "Invalid index."); return vGloPos[co];}
1089 
1090  private:
1092  friend class CRFVGeometry<TElem, TWorldDim>;
1093 
1094  // id of scv this bf belongs to
1095  size_t nodeID;
1096 
1097  size_t numCo;
1098 
1099  MathVector<dim> vLocPos[maxNumCo]; // local corners of bf
1100  MathVector<worldDim> vGloPos[maxNumCo]; // global corners of bf
1101 
1102  // scvf part
1103  MathVector<dim> localIP; // local integration point
1104  MathVector<worldDim> globalIP; // global integration point
1105  MathVector<worldDim> Normal; // normal (incl. area)
1106  number Vol; // volume of bf
1107 
1108  // shapes and derivatives
1109  number vShape[nsh]; // shapes at ip
1110  MathVector<dim> vLocalGrad[nsh]; // local grad at ip
1111  MathVector<worldDim> vGlobalGrad[nsh]; // global grad at ip
1112  MathMatrix<worldDim,dim> JtInv; // Jacobian transposed at ip
1113  number detj; // Jacobian det at ip
1114  };
1115 
1116  public:
1118  CRFVGeometry();
1119 
1121  void update_local_data();
1122 
1124  void update(GridObject* elem, const MathVector<worldDim>* vCornerCoords,
1125  const ISubsetHandler* ish = NULL);
1126 
1128  void update_boundary_faces(GridObject* elem,
1129  const MathVector<worldDim>* vCornerCoords,
1130  const ISubsetHandler* ish = NULL);
1131 
1132  const MathVector<worldDim>* corners() const {return m_vCo;}
1133 
1135  inline size_t num_scvf() const {return numSCVF;};
1136 
1138  inline const SCVF& scvf(size_t i) const
1139  {UG_ASSERT(i < num_scvf(), "Invalid Index."); return m_vSCVF[i];}
1140 
1142  inline size_t num_scv() const {return numSCV;}
1143 
1145  inline const SCV& scv(size_t i) const
1146  {UG_ASSERT(i < num_scv(), "Invalid Index."); return m_vSCV[i];}
1147 
1149  inline size_t num_sh() const {return nsh;};
1150 
1151  public:
1153  size_t num_scvf_ips() const {return numSCVF;}
1154 
1157 
1160 
1162  size_t num_scv_ips() const {return numSCV;}
1163 
1166 
1169 
1171  const MathVector<dim> local_bary() const {return localBary;}
1172 
1175 
1176  protected:
1177  // global and local ips on SCVF
1180  // coord of location for unknowns in faces (edge/face barycenter)
1183 
1184  static const size_t numMaxCo = 8;
1185  // corner coordinates
1187 
1188  public:
1190  inline void add_boundary_subset(int subsetIndex) {m_mapVectorBF[subsetIndex];}
1191 
1193  inline void remove_boundary_subset(int subsetIndex) {m_mapVectorBF.erase(subsetIndex);}
1194 
1196  inline void clear_boundary_subsets() {m_mapVectorBF.clear();}
1197 
1199  inline size_t num_boundary_subsets() {return m_mapVectorBF.size();}
1200 
1202  inline size_t num_bf() const
1203  {
1204  typename std::map<int, std::vector<BF> >::const_iterator it;
1205  size_t num = 0;
1206  for ( it=m_mapVectorBF.begin() ; it != m_mapVectorBF.end(); it++ )
1207  num += (*it).second.size();
1208  return num;
1209  }
1210 
1212  inline size_t num_bf(int subsetIndex) const
1213  {
1214  typename std::map<int, std::vector<BF> >::const_iterator it;
1215  it = m_mapVectorBF.find(subsetIndex);
1216  if(it == m_mapVectorBF.end()) return 0;
1217  else return (*it).second.size();
1218  }
1219 
1221  inline const BF& bf(int subsetIndex, size_t i) const
1222  {
1223  UG_ASSERT(i < num_bf(subsetIndex), "Invalid index.");
1224  typename std::map<int, std::vector<BF> >::const_iterator it;
1225  it = m_mapVectorBF.find(subsetIndex);
1226  UG_ASSERT(it != m_mapVectorBF.end(), "Bnd Subset Index not requested.")
1227  return (*it).second[i];
1228  }
1229 
1231  inline const std::vector<BF>& bf(int subsetIndex) const
1232  {
1233  typename std::map<int, std::vector<BF> >::const_iterator it;
1234  it = m_mapVectorBF.find(subsetIndex);
1235  UG_ASSERT(it != m_mapVectorBF.end(), "Bnd Subset Index not requested.")
1236  return (*it).second;
1237  }
1238 
1239  protected:
1240  std::map<int, std::vector<BF> > m_mapVectorBF;
1241 
1242  private:
1244 
1247 
1250 
1252  TElem* m_pElem;
1253 
1256 
1259 
1262 
1264  public:
1266  {
1267  public:
1268  inline size_t constraining_dofs_index(size_t i) const {
1269  return 0;
1270  }
1271  inline size_t constraining_dofs_weight(size_t i) const{
1272  return 0;
1273  }
1274  inline size_t index() const{
1275  return 0;
1276  }
1277  inline size_t num_constraining_dofs() const{
1278  return 0;
1279  }
1280  };
1281  inline size_t num_constrained_dofs() const {return 0;}
1282  inline const CONSTRAINED_DOF& constrained_dof(size_t i) const
1283  {return cd;}
1284  private:
1286 };
1287 
1288 
1289 }
1290 
1291 #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__DISC_HELPER__CR_FINITE_VOLUME_GEOMETRY__ */
parameterString s
boundary face
Definition: fvcr_geom.h:1023
number volume() const
volume of bf
Definition: fvcr_geom.h:1047
size_t nodeID
Definition: fvcr_geom.h:1095
const MathVector< worldDim > & global_corner(size_t co) const
return global corner number i
Definition: fvcr_geom.h:1087
const MathVector< dim > & local_grad(size_t sh) const
value of local gradient of shape function i in integration point
Definition: fvcr_geom.h:1066
size_t num_ip() const
number of integration points on bf
Definition: fvcr_geom.h:1035
MathVector< worldDim > globalIP
Definition: fvcr_geom.h:1104
MathVector< dim > vLocalGrad[nsh]
Definition: fvcr_geom.h:1110
const MathMatrix< worldDim, dim > & JTInv() const
Transposed Inverse of Jacobian in integration point.
Definition: fvcr_geom.h:1050
MathVector< worldDim > Normal
Definition: fvcr_geom.h:1105
MathMatrix< worldDim, dim > JtInv
Definition: fvcr_geom.h:1112
const MathVector< dim > & local_corner(size_t co) const
return local corner number i
Definition: fvcr_geom.h:1083
number shape(size_t sh) const
value of shape function i in integration point
Definition: fvcr_geom.h:1059
MathVector< worldDim > vGlobalGrad[nsh]
Definition: fvcr_geom.h:1111
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:1056
BF()
Definition: fvcr_geom.h:1029
size_t num_corners() const
number of corners, that bound the scvf
Definition: fvcr_geom.h:1080
MathVector< worldDim > vGloPos[maxNumCo]
Definition: fvcr_geom.h:1100
const MathVector< dim > & local_ip() const
local integration point of bf
Definition: fvcr_geom.h:1038
const MathVector< dim > * local_grad_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:1070
const number * shape_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:1063
MathVector< dim > vLocPos[maxNumCo]
Definition: fvcr_geom.h:1099
MathVector< dim > localIP
Definition: fvcr_geom.h:1103
number detJ() const
Determinant of Jacobian in integration point.
Definition: fvcr_geom.h:1053
static const size_t maxNumCo
max number of corners of bf
Definition: fvcr_geom.h:1026
number vShape[nsh]
Definition: fvcr_geom.h:1109
size_t node_id() const
index of SubControlVolume of the bf
Definition: fvcr_geom.h:1032
number detj
Definition: fvcr_geom.h:1113
const MathVector< worldDim > * global_grad_vector() const
vector of global gradients in ip point
Definition: fvcr_geom.h:1077
number Vol
Definition: fvcr_geom.h:1106
const MathVector< worldDim > & normal() const
outer normal on bf. Norm is equal to area
Definition: fvcr_geom.h:1044
const MathVector< worldDim > & global_ip() const
global integration point of bf
Definition: fvcr_geom.h:1041
size_t numCo
Definition: fvcr_geom.h:1097
const MathVector< worldDim > & global_grad(size_t sh) const
value of global gradient of shape function i in integration point
Definition: fvcr_geom.h:1073
public hanging node interface for compatibility reasons
Definition: fvcr_geom.h:1266
size_t constraining_dofs_weight(size_t i) const
Definition: fvcr_geom.h:1271
size_t num_constraining_dofs() const
Definition: fvcr_geom.h:1277
size_t index() const
Definition: fvcr_geom.h:1274
size_t constraining_dofs_index(size_t i) const
Definition: fvcr_geom.h:1268
Sub-Control Volume Face structure.
Definition: fvcr_geom.h:830
const MathVector< worldDim > & normal() const
normal on scvf (points direction "from"->"to"). Norm is equal to area
Definition: fvcr_geom.h:854
const MathVector< dim > & local_ip() const
local integration point of scvf
Definition: fvcr_geom.h:848
const MathVector< worldDim > * global_grad_vector() const
vector of global gradients in ip point
Definition: fvcr_geom.h:883
size_t num_ip() const
number of integration points on scvf
Definition: fvcr_geom.h:845
MathVector< dim > vLocPos[numCo]
Definition: fvcr_geom.h:907
SCVF()
Definition: fvcr_geom.h:836
MathMatrix< worldDim, dim > JtInv
Definition: fvcr_geom.h:918
size_t To
Definition: fvcr_geom.h:902
const MathVector< worldDim > & global_ip() const
global integration point of scvf
Definition: fvcr_geom.h:851
MathVector< worldDim > Normal
Definition: fvcr_geom.h:905
const MathVector< worldDim > & global_corner(size_t co) const
return glbal corner number i
Definition: fvcr_geom.h:893
const MathVector< worldDim > & global_grad(size_t sh) const
value of global gradient of shape function i in integration point
Definition: fvcr_geom.h:879
const MathVector< dim > * local_grad_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:876
const MathVector< dim > & local_corner(size_t co) const
return local corner number i
Definition: fvcr_geom.h:889
number detj
Definition: fvcr_geom.h:919
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:863
size_t to() const
index of SubControlVolume on one side of the scvf
Definition: fvcr_geom.h:842
MathVector< worldDim > globalIP
Definition: fvcr_geom.h:912
number detJ() const
Determinant of Jacobian in integration point.
Definition: fvcr_geom.h:860
MathVector< worldDim > vGlobalGrad[nsh]
Definition: fvcr_geom.h:917
size_t From
Definition: fvcr_geom.h:902
static const size_t numCo
Number of corners of scvf.
Definition: fvcr_geom.h:833
MathVector< dim > localIP
Definition: fvcr_geom.h:911
const MathMatrix< worldDim, dim > & JTInv() const
Transposed Inverse of Jacobian in integration point.
Definition: fvcr_geom.h:857
size_t from() const
index of SubControlVolume on one side of the scvf
Definition: fvcr_geom.h:839
number vShape[nsh]
Definition: fvcr_geom.h:915
MathVector< worldDim > vGloPos[numCo]
Definition: fvcr_geom.h:908
MathVector< dim > vLocalGrad[nsh]
Definition: fvcr_geom.h:916
number shape(size_t sh) const
value of shape function i in integration point
Definition: fvcr_geom.h:866
const number * shape_vector() const
vector of shape functions in ip point
Definition: fvcr_geom.h:869
size_t num_corners() const
number of corners, that bound the scvf
Definition: fvcr_geom.h:886
const MathVector< dim > & local_grad(size_t sh) const
value of local gradient of shape function i in integration point
Definition: fvcr_geom.h:872
sub control volume structure
Definition: fvcr_geom.h:924
MathMatrix< worldDim, dim > JtInv
Definition: fvcr_geom.h:1017
MathVector< worldDim > vGloPos[maxNumCo]
Definition: fvcr_geom.h:1008
const MathVector< dim > & local_corner(size_t co) const
return local corner number i
Definition: fvcr_geom.h:939
size_t num_ip() const
number of integration points
Definition: fvcr_geom.h:950
MathVector< worldDim > Normal
Definition: fvcr_geom.h:995
number Vol
Definition: fvcr_geom.h:1001
const MathVector< dim > & local_ip() const
local integration point of scv
Definition: fvcr_geom.h:953
number detj
Definition: fvcr_geom.h:1018
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:968
MathVector< worldDim > vGlobIP
Definition: fvcr_geom.h:1011
const MathVector< worldDim > & global_grad(size_t sh) const
value of global gradient of shape function i in integration point
Definition: fvcr_geom.h:984
number volume() const
volume of scv
Definition: fvcr_geom.h:933
number detJ() const
Determinant of Jacobian in integration point.
Definition: fvcr_geom.h:965
const MathMatrix< worldDim, dim > & JTInv() const
Transposed Inverse of Jacobian in integration point.
Definition: fvcr_geom.h:962
size_t num_corners() const
number of corners, that bound the scvf
Definition: fvcr_geom.h:936
MathVector< dim > vLocIP
Definition: fvcr_geom.h:1010
SCV()
Definition: fvcr_geom.h:930
const MathVector< dim > * local_grad_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:981
size_t node_id() const
node id that this scv is associated to
Definition: fvcr_geom.h:947
const MathVector< dim > & local_grad(size_t sh) const
value of local gradient of shape function i in integration point
Definition: fvcr_geom.h:977
const MathVector< worldDim > * global_grad_vector() const
vector of global gradients in ip point
Definition: fvcr_geom.h:988
size_t nodeID
Definition: fvcr_geom.h:998
MathVector< dim > vLocalGrad[nsh]
Definition: fvcr_geom.h:1015
const MathVector< worldDim > & normal() const
normal on scvf (points direction "from"->"to"). Norm is equal to area
Definition: fvcr_geom.h:959
const MathVector< worldDim > & global_corner(size_t co) const
return global corner number i
Definition: fvcr_geom.h:943
MathVector< dim > vLocPos[maxNumCo]
Definition: fvcr_geom.h:1007
number shape(size_t sh) const
value of shape function i in integration point
Definition: fvcr_geom.h:971
number vShape[nsh]
Definition: fvcr_geom.h:1014
const MathVector< worldDim > & global_ip() const
global integration point
Definition: fvcr_geom.h:956
static const size_t maxNumCo
Number of corners of scv.
Definition: fvcr_geom.h:927
int numCorners
Definition: fvcr_geom.h:1004
const number * shape_vector() const
vector of shape functions in ip point
Definition: fvcr_geom.h:974
MathVector< worldDim > vGlobalGrad[nsh]
Definition: fvcr_geom.h:1016
Definition: fvcr_geom.h:767
void remove_boundary_subset(int subsetIndex)
removes subset that is interpreted as boundary subset.
Definition: fvcr_geom.h:1193
const MathVector< dim > local_bary() const
returns local barycenter
Definition: fvcr_geom.h:1171
MathVector< dim > localBary
Definition: fvcr_geom.h:815
MathVector< worldDim > m_vGlobSCVF_IP[numSCVF]
Definition: fvcr_geom.h:1178
void clear_boundary_subsets()
reset all boundary subsets
Definition: fvcr_geom.h:1196
const MathVector< worldDim > global_bary() const
returns global barycenter
Definition: fvcr_geom.h:1174
SCV m_vSCV[numSCV]
SubControlVolumes.
Definition: fvcr_geom.h:1249
const MathVector< worldDim > * scvf_global_ips() const
returns all ips of scvf as they appear in scv loop
Definition: fvcr_geom.h:1159
void add_boundary_subset(int subsetIndex)
add subset that is interpreted as boundary subset.
Definition: fvcr_geom.h:1190
const MathVector< dim > * scvf_local_ips() const
returns all ips of scvf as they appear in scv loop
Definition: fvcr_geom.h:1156
static const int order
order
Definition: fvcr_geom.h:803
MathVector< worldDim > globalBary
Definition: fvcr_geom.h:816
size_t num_scv_ips() const
returns number of all scv ips
Definition: fvcr_geom.h:1162
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update data for given element
Definition: fvcr_geom.cpp:1013
static const size_t numSCVF
number of SubControlVolumeFaces
Definition: fvcr_geom.h:797
const BF & bf(int subsetIndex, size_t i) const
returns the boundary face i for subsetIndex
Definition: fvcr_geom.h:1221
CrouzeixRaviartLSFS< ref_elem_type > local_shape_fct_set_type
type of Shape function used
Definition: fvcr_geom.h:788
const local_shape_fct_set_type & m_rTrialSpace
Shape function set.
Definition: fvcr_geom.h:1261
ReferenceMapping< ref_elem_type, worldDim > m_mapping
Reference Mapping.
Definition: fvcr_geom.h:1255
static const int worldDim
dimension of world
Definition: fvcr_geom.h:779
static const size_t numSCV
number of SubControlVolumes
Definition: fvcr_geom.h:794
static const size_t nip
number of integration points
Definition: fvcr_geom.h:812
const ref_elem_type & m_rRefElem
Reference Element.
Definition: fvcr_geom.h:1258
reference_element_traits< TElem >::reference_element_type ref_elem_type
type of reference element
Definition: fvcr_geom.h:773
TElem * m_pElem
pointer to current element
Definition: fvcr_geom.h:1252
SCVF m_vSCVF[numSCVF]
SubControlVolumeFaces.
Definition: fvcr_geom.h:1246
static const int dim
dimension of reference element
Definition: fvcr_geom.h:776
size_t num_bf(int subsetIndex) const
number of boundary faces on subset 'subsetIndex'
Definition: fvcr_geom.h:1212
std::map< int, std::vector< BF > > m_mapVectorBF
Definition: fvcr_geom.h:1240
const MathVector< worldDim > * scv_global_ips() const
returns all ips of scv as they appear in scv loop
Definition: fvcr_geom.h:1168
size_t num_boundary_subsets()
number of registered boundary subsets
Definition: fvcr_geom.h:1199
const std::vector< BF > & bf(int subsetIndex) const
returns reference to vector of boundary faces for subsetIndex
Definition: fvcr_geom.h:1231
MathVector< worldDim > m_vGlobUnkCoords[numSCV]
Definition: fvcr_geom.h:1181
crfv_traits< TWorldDim, TWorldDim+1 >::scv_type scv_type1
Definition: fvcr_geom.h:808
TElem elem_type
type of element
Definition: fvcr_geom.h:770
static const size_t nsh
number of shape functions
Definition: fvcr_geom.h:791
void update_boundary_faces(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update boundary data for given element
Definition: fvcr_geom.cpp:1122
MathVector< worldDim > m_vCo[numMaxCo]
Definition: fvcr_geom.h:1186
MathVector< dim > m_vLocSCVF_IP[numSCVF]
Definition: fvcr_geom.h:1179
static const size_t maxNumSCVF
Definition: fvcr_geom.h:799
size_t num_scvf_ips() const
returns number of all scvf ips
Definition: fvcr_geom.h:1153
CRFVGeometry()
construct object and initialize local values and sizes
Definition: fvcr_geom.cpp:935
void update_local_data()
update local data
Definition: fvcr_geom.cpp:944
static const bool usesHangingNodes
Hanging node flag: this Geometry does not support hanging nodes.
Definition: fvcr_geom.h:782
CONSTRAINED_DOF cd
Definition: fvcr_geom.h:1285
static const size_t numMaxCo
Definition: fvcr_geom.h:1184
size_t num_constrained_dofs() const
Definition: fvcr_geom.h:1281
const MathVector< worldDim > * corners() const
Definition: fvcr_geom.h:1132
crfv_traits< TWorldDim, TWorldDim+1 >::face_type face_type1
Definition: fvcr_geom.h:809
crfv_traits< TWorldDim, TWorldDim >::scv_type scv_type0
traits
Definition: fvcr_geom.h:806
size_t num_scv() const
number of SubControlVolumes
Definition: fvcr_geom.h:1142
static const bool staticLocalData
flag indicating if local data may change
Definition: fvcr_geom.h:785
size_t num_scvf() const
number of SubControlVolumeFaces
Definition: fvcr_geom.h:1135
const CONSTRAINED_DOF & constrained_dof(size_t i) const
Definition: fvcr_geom.h:1282
const MathVector< dim > * scv_local_ips() const
returns all ips of scv as they appear in scv loop
Definition: fvcr_geom.h:1165
size_t num_bf() const
number of all boundary faces
Definition: fvcr_geom.h:1202
const SCV & scv(size_t i) const
const access to SubControlVolume number i
Definition: fvcr_geom.h:1145
MathVector< dim > m_ipCoord[numSCVF]
Definition: fvcr_geom.h:1243
MathVector< dim > m_vLocUnkCoords[numSCV]
Definition: fvcr_geom.h:1182
crfv_traits< TWorldDim, TWorldDim >::face_type face_type0
Definition: fvcr_geom.h:807
const SCVF & scvf(size_t i) const
const access to SubControlVolumeFace number i
Definition: fvcr_geom.h:1138
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:1149
Lagrange Shape Function Set without virtual functions and fixed order.
Definition: crouzeix_raviart.h:92
boundary face
Definition: fvcr_geom.h:441
const MathVector< dim > & local_corner(size_t co) const
return local corner number i
Definition: fvcr_geom.h:501
const MathVector< worldDim > & global_grad(size_t sh) const
value of global gradient of shape function i in integration point
Definition: fvcr_geom.h:491
number detj
Definition: fvcr_geom.h:532
number Vol
Definition: fvcr_geom.h:524
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:474
MathVector< worldDim > globalIP
Definition: fvcr_geom.h:522
MathVector< worldDim > vGloPos[maxNumCo]
Definition: fvcr_geom.h:518
number volume() const
volume of bf
Definition: fvcr_geom.h:465
MathVector< worldDim > vGlobalGrad[maxNSH]
Definition: fvcr_geom.h:530
MathVector< dim > vLocPos[maxNumCo]
Definition: fvcr_geom.h:517
number shape(size_t sh) const
value of shape function i in integration point
Definition: fvcr_geom.h:477
size_t numCo
Definition: fvcr_geom.h:515
const MathVector< dim > & local_grad(size_t sh) const
value of local gradient of shape function i in integration point
Definition: fvcr_geom.h:484
MathVector< worldDim > Normal
Definition: fvcr_geom.h:523
size_t numSH
Definition: fvcr_geom.h:527
const MathVector< worldDim > * global_grad_vector() const
vector of global gradients in ip point
Definition: fvcr_geom.h:495
const MathVector< worldDim > & global_corner(size_t co) const
return global corner number i
Definition: fvcr_geom.h:505
const MathVector< worldDim > & global_ip() const
global integration point of bf
Definition: fvcr_geom.h:459
MathVector< dim > localIP
Definition: fvcr_geom.h:521
size_t nodeID
Definition: fvcr_geom.h:513
const MathVector< dim > * local_grad_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:488
const MathMatrix< worldDim, dim > & JTInv() const
Transposed Inverse of Jacobian in integration point.
Definition: fvcr_geom.h:468
const MathVector< worldDim > & normal() const
outer normal on bf. Norm is equal to area
Definition: fvcr_geom.h:462
const number * shape_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:481
MathMatrix< worldDim, dim > JtInv
Definition: fvcr_geom.h:531
static const size_t maxNumCo
max number of corners of bf
Definition: fvcr_geom.h:444
size_t num_ip() const
number of integration points on bf
Definition: fvcr_geom.h:453
size_t node_id() const
index of SubControlVolume of the bf
Definition: fvcr_geom.h:450
const MathVector< dim > & local_ip() const
local integration point of bf
Definition: fvcr_geom.h:456
BF()
Definition: fvcr_geom.h:447
number detJ() const
Determinant of Jacobian in integration point.
Definition: fvcr_geom.h:471
number vShape[maxNSH]
Definition: fvcr_geom.h:528
size_t num_corners() const
number of corners, that bound the scvf
Definition: fvcr_geom.h:498
MathVector< dim > vLocalGrad[maxNSH]
Definition: fvcr_geom.h:529
Definition: fvcr_geom.h:536
static const size_t maxNumConstrainingDofs
Definition: fvcr_geom.h:538
size_t cDofInd[maxNumConstrainingDofs]
Definition: fvcr_geom.h:556
size_t num_constraining_dofs() const
Definition: fvcr_geom.h:548
number cDofWeights[maxNumConstrainingDofs]
Definition: fvcr_geom.h:558
size_t constraining_dofs_index(size_t i) const
Definition: fvcr_geom.h:539
size_t index() const
Definition: fvcr_geom.h:545
number constraining_dofs_weight(size_t i) const
Definition: fvcr_geom.h:542
size_t numConstrainingDofs
Definition: fvcr_geom.h:562
size_t i
Definition: fvcr_geom.h:560
Definition: fvcr_geom.h:566
size_t scvfIndex
Definition: fvcr_geom.h:570
size_t index
Definition: fvcr_geom.h:568
size_t associatedSCV[2]
Definition: fvcr_geom.h:569
bool from
Definition: fvcr_geom.h:572
Sub-Control Volume Face structure.
Definition: fvcr_geom.h:225
const MathVector< worldDim > & global_ip() const
global integration point of scvf
Definition: fvcr_geom.h:246
const MathVector< dim > * local_grad_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:271
number detj
Definition: fvcr_geom.h:337
number detJ() const
Determinant of Jacobian in integration point.
Definition: fvcr_geom.h:255
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:258
const MathVector< worldDim > & normal() const
normal on scvf (points direction "from"->"to"). Norm is equal to area
Definition: fvcr_geom.h:249
number vShape[maxNSH]
Definition: fvcr_geom.h:333
MathVector< dim > vLocalGrad[maxNSH]
Definition: fvcr_geom.h:334
size_t from() const
index of SubControlVolume on one side of the scvf
Definition: fvcr_geom.h:234
size_t num_corners() const
number of corners, that bound the scvf
Definition: fvcr_geom.h:281
static const size_t numCo
Number of corners of scvf.
Definition: fvcr_geom.h:228
MathVector< worldDim > vGlobalGrad[maxNSH]
Definition: fvcr_geom.h:335
size_t num_ip() const
number of integration points on scvf
Definition: fvcr_geom.h:240
MathVector< worldDim > vGloPos[numCo]
Definition: fvcr_geom.h:325
const MathVector< dim > & local_ip() const
local integration point of scvf
Definition: fvcr_geom.h:243
size_t To
Definition: fvcr_geom.h:319
const MathMatrix< worldDim, dim > & JTInv() const
Transposed Inverse of Jacobian in integration point.
Definition: fvcr_geom.h:252
void operator=(const SCVF &s)
Definition: fvcr_geom.h:292
const MathVector< worldDim > & global_grad(size_t sh) const
value of global gradient of shape function i in integration point
Definition: fvcr_geom.h:274
const MathVector< dim > & local_grad(size_t sh) const
value of local gradient of shape function i in integration point
Definition: fvcr_geom.h:267
MathMatrix< worldDim, dim > JtInv
Definition: fvcr_geom.h:336
const MathVector< worldDim > & global_corner(size_t co) const
return glbal corner number i
Definition: fvcr_geom.h:288
MathVector< dim > localIP
Definition: fvcr_geom.h:328
size_t to() const
index of SubControlVolume on one side of the scvf
Definition: fvcr_geom.h:237
const MathVector< worldDim > * global_grad_vector() const
vector of gloabl gradients in ip point
Definition: fvcr_geom.h:278
MathVector< worldDim > Normal
Definition: fvcr_geom.h:322
MathVector< dim > vLocPos[numCo]
Definition: fvcr_geom.h:324
const MathVector< dim > & local_corner(size_t co) const
return local corner number i
Definition: fvcr_geom.h:284
const number * shape_vector() const
vector of shape functions in ip point
Definition: fvcr_geom.h:264
number shape(size_t sh) const
value of shape function i in integration point
Definition: fvcr_geom.h:261
size_t From
Definition: fvcr_geom.h:319
SCVF()
Definition: fvcr_geom.h:231
size_t numSH
Definition: fvcr_geom.h:332
MathVector< worldDim > globalIP
Definition: fvcr_geom.h:329
sub control volume structure
Definition: fvcr_geom.h:342
number volume() const
volume of scv
Definition: fvcr_geom.h:351
MathVector< dim > vLocIP
Definition: fvcr_geom.h:427
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:386
number Vol
Definition: fvcr_geom.h:419
MathVector< worldDim > vGlobalGrad[maxNSH]
Definition: fvcr_geom.h:434
number detj
Definition: fvcr_geom.h:436
const MathVector< worldDim > & global_corner(size_t co) const
return global corner number i
Definition: fvcr_geom.h:361
MathVector< dim > vLocPos[maxNumCo]
Definition: fvcr_geom.h:425
const MathVector< dim > & local_ip() const
local integration point of scv
Definition: fvcr_geom.h:371
MathVector< worldDim > Normal
Definition: fvcr_geom.h:413
size_t num_corners() const
number of corners, that bound the scvf
Definition: fvcr_geom.h:354
static const size_t maxNumCo
Number of corners of scv.
Definition: fvcr_geom.h:345
int numCorners
Definition: fvcr_geom.h:422
const MathVector< dim > * local_grad_vector() const
vector of local gradients in ip point
Definition: fvcr_geom.h:399
const MathVector< worldDim > & global_grad(size_t sh) const
value of global gradient of shape function i in integration point
Definition: fvcr_geom.h:402
size_t node_id() const
node id that this scv is associated to
Definition: fvcr_geom.h:365
const MathMatrix< worldDim, dim > & JTInv() const
Transposed Inverse of Jacobian in integration point.
Definition: fvcr_geom.h:380
SCV()
Definition: fvcr_geom.h:348
size_t numSH
Definition: fvcr_geom.h:431
size_t nodeID
Definition: fvcr_geom.h:416
const MathVector< dim > & local_corner(size_t co) const
return local corner number i
Definition: fvcr_geom.h:357
const number * shape_vector() const
vector of shape functions in ip point
Definition: fvcr_geom.h:392
MathVector< worldDim > vGloPos[maxNumCo]
Definition: fvcr_geom.h:426
MathVector< dim > vLocalGrad[maxNSH]
Definition: fvcr_geom.h:433
MathMatrix< worldDim, dim > JtInv
Definition: fvcr_geom.h:435
size_t num_ip() const
number of integration points
Definition: fvcr_geom.h:368
const MathVector< worldDim > & normal() const
normal on scvf (points direction "from"->"to"). Norm is equal to area
Definition: fvcr_geom.h:377
MathVector< dim > vGlobIP
Definition: fvcr_geom.h:428
const MathVector< dim > & local_grad(size_t sh) const
value of local gradient of shape function i in integration point
Definition: fvcr_geom.h:395
const MathVector< worldDim > & global_ip() const
global integration point
Definition: fvcr_geom.h:374
number vShape[maxNSH]
Definition: fvcr_geom.h:432
const MathVector< worldDim > * global_grad_vector() const
vector of global gradients in ip point
Definition: fvcr_geom.h:406
number detJ() const
Determinant of Jacobian in integration point.
Definition: fvcr_geom.h:383
number shape(size_t sh) const
value of shape function i in integration point
Definition: fvcr_geom.h:389
Geometry and shape functions for 1st order Vertex-Centered Finite Volume with Crouzeix-Raviart elemen...
Definition: fvcr_geom.h:166
SCVF m_vSCVF[maxNumSCVF]
SubControlVolumeFaces.
Definition: fvcr_geom.h:741
static const size_t nip
number of integration points
Definition: fvcr_geom.h:207
void update_geometric_data(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update data for given element
Definition: fvcr_geom.cpp:754
crfv_traits< TWorldDim, TWorldDim+1 >::face_type face_type1
Definition: fvcr_geom.h:196
SCV m_vSCV[maxNumSCV]
SubControlVolumes.
Definition: fvcr_geom.h:747
static const int order
order
Definition: fvcr_geom.h:187
const MathVector< worldDim > * scv_global_ips() const
returns all ips of scv as they appear in scv loop
Definition: fvcr_geom.h:643
const SCV & scv(size_t i) const
const access to SubControlVolume number i
Definition: fvcr_geom.h:610
MathVector< dim > cornerCoord[maxNumCo]
Definition: fvcr_geom.h:738
const MathVector< dim > local_bary() const
returns local barycenter
Definition: fvcr_geom.h:646
size_t m_numSCVF
current number of scvf
Definition: fvcr_geom.h:732
size_t num_scvf() const
number of SubControlVolumeFaces
Definition: fvcr_geom.h:600
size_t num_scv() const
number of SubControlVolumes
Definition: fvcr_geom.h:607
GridObject * m_pElem
pointer to current element
Definition: fvcr_geom.h:720
std::vector< HandledEdge > handledEdges
Definition: fvcr_geom.h:716
static const size_t maxNumSCV
number of SubControlVolumes
Definition: fvcr_geom.h:190
size_t m_nsh
current number of shape functions
Definition: fvcr_geom.h:735
MathVector< dim > m_vLocUnkCoords[maxNumSCV]
Definition: fvcr_geom.h:657
void remove_boundary_subset(int subsetIndex)
removes subset that is interpreted as boundary subset.
Definition: fvcr_geom.h:664
static const size_t deleted
Definition: fvcr_geom.h:756
const MathVector< worldDim > * scvf_global_ips() const
returns all ips of scvf as they appear in scv loop
Definition: fvcr_geom.h:634
MathVector< dim > localBary
Definition: fvcr_geom.h:210
hcrfv_traits< TDim, TDim > htraits
Definition: fvcr_geom.h:170
static const int dim
dimension of reference element
Definition: fvcr_geom.h:174
MathVector< worldDim > m_vGlobUnkCoords[maxNumSCV]
Definition: fvcr_geom.h:656
const SCVF & scvf(size_t i) const
const access to SubControlVolumeFace number i
Definition: fvcr_geom.h:603
CONSTRAINED_DOF m_vCD[maxNumSCV]
constrained Dofs
Definition: fvcr_geom.h:714
std::map< int, std::vector< BF > > m_mapVectorBF
Definition: fvcr_geom.h:711
crfv_traits< TWorldDim, TWorldDim+1 >::scv_type scv_type1
Definition: fvcr_geom.h:195
static const bool staticLocalData
flag indicating if local data may change
Definition: fvcr_geom.h:183
DimReferenceElement< dim > m_rRefElem
current reference element
Definition: fvcr_geom.h:726
void clear_boundary_subsets()
reset all boundary subsets
Definition: fvcr_geom.h:667
size_t num_constrained_scvf()
number of constrained dof scvfs
Definition: fvcr_geom.h:621
size_t m_numConstrainedDofs
Definition: fvcr_geom.h:752
void add_boundary_subset(int subsetIndex)
add subset that is interpreted as boundary subset.
Definition: fvcr_geom.h:661
size_t num_boundary_subsets()
number of registered boundary subsets
Definition: fvcr_geom.h:670
static const bool usesHangingNodes
Hanging node flag: this Geometry does not support hanging nodes.
Definition: fvcr_geom.h:180
static const int worldDim
dimension of world
Definition: fvcr_geom.h:177
const std::vector< BF > & bf(int subsetIndex) const
returns reference to vector of boundary faces for subsetIndex
Definition: fvcr_geom.h:702
size_t num_sh() const
number of shape functions
Definition: fvcr_geom.h:624
MathVector< dim > m_ipCoord[maxNumSCVF]
Definition: fvcr_geom.h:737
static const size_t maxNSH
max number of shape functions
Definition: fvcr_geom.h:202
void update(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update data for given element
Definition: fvcr_geom.cpp:142
void update_boundary_faces(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL)
update boundary data for given element
Definition: fvcr_geom.cpp:823
crfv_traits< TWorldDim, TWorldDim >::scv_type scv_type0
traits
Definition: fvcr_geom.h:193
void update_local_data()
update local data
Definition: fvcr_geom.cpp:54
ReferenceObjectID m_roid
current reference object id
Definition: fvcr_geom.h:723
const MathVector< worldDim > global_bary() const
returns global barycenter
Definition: fvcr_geom.h:649
size_t m_numConstrainedSCVF
Definition: fvcr_geom.h:754
crfv_traits< TWorldDim, TWorldDim >::face_type face_type0
Definition: fvcr_geom.h:194
crfv_traits< TDim, TDim > traits
used traits
Definition: fvcr_geom.h:169
MathVector< worldDim > m_vGlobSCVF_IP[maxNumSCVF]
Definition: fvcr_geom.h:653
static const size_t maxNumCo
Definition: fvcr_geom.h:204
const MathVector< dim > * scv_local_ips() const
returns all ips of scv as they appear in scv loop
Definition: fvcr_geom.h:640
const MathVector< dim > * scvf_local_ips() const
returns all ips of scvf as they appear in scv loop
Definition: fvcr_geom.h:631
SCVF m_vConstrainedSCVF[maxNumSCVF]
SubControlVolumeFaces for constrained dofs.
Definition: fvcr_geom.h:744
size_t num_bf() const
number of all boundary faces
Definition: fvcr_geom.h:673
size_t m_numDofs
numDofs number of all dofs including constraining and constrained dofs
Definition: fvcr_geom.h:750
size_t m_numSCV
current number of scv
Definition: fvcr_geom.h:729
static const size_t maxNumSCVF
max number of SubControlVolumeFaces
Definition: fvcr_geom.h:199
DimCRFVGeometry()
construct object and initialize local values and sizes
Definition: fvcr_geom.h:577
const CONSTRAINED_DOF & constrained_dof(size_t i) const
const access to constrained dof i
Definition: fvcr_geom.h:617
MathVector< dim > m_vLocSCVF_IP[maxNumSCVF]
Definition: fvcr_geom.h:654
size_t num_scvf_ips() const
returns number of all scvf ips
Definition: fvcr_geom.h:628
const BF & bf(int subsetIndex, size_t i) const
returns the boundary face i for subsetIndex
Definition: fvcr_geom.h:692
size_t num_scv_ips() const
returns number of all scv ips
Definition: fvcr_geom.h:637
size_t num_bf(int subsetIndex) const
number of boundary faces on subset 'subsetIndex'
Definition: fvcr_geom.h:683
size_t num_constrained_dofs() const
number of constrained dofs
Definition: fvcr_geom.h:614
void update_hanging(GridObject *elem, const MathVector< worldDim > *vCornerCoords, const ISubsetHandler *ish=NULL, bool keepSCV=false, bool keepSCVF=false)
update data for given element
Definition: fvcr_geom.cpp:267
MathVector< worldDim > globalBary
Definition: fvcr_geom.h:211
base class for all FVGeometries
Definition: fv_geom_base.h:76
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
Definition: subset_handler_interface.h:223
Definition: reference_element.h:345
Definition: reference_element.h:546
Definition: reference_element.h:445
Definition: reference_element.h:494
Definition: reference_element.h:394
Definition: reference_element.h:303
static const int dim
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
double number
Definition: types.h:124
the ug namespace
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
@ ROID_UNKNOWN
Definition: grid_base_objects.h:75
ReferenceEdge scv_type
Definition: fvcr_geom.h:79
ReferenceVertex face_type
Definition: fvcr_geom.h:80
ReferenceVertex face_type
Definition: fvcr_geom.h:90
ReferenceEdge scv_type
Definition: fvcr_geom.h:89
ReferenceTriangle scv_type
Definition: fvcr_geom.h:99
ReferenceEdge face_type
Definition: fvcr_geom.h:100
ReferenceEdge face_type
Definition: fvcr_geom.h:110
ReferenceTriangle scv_type
Definition: fvcr_geom.h:109
ReferenceTriangle face_type
Definition: fvcr_geom.h:120
ReferenceTetrahedron scv_type
Definition: fvcr_geom.h:119
ReferenceQuadrilateral face_type
Definition: fvcr_geom.h:130
ReferencePyramid scv_type
Definition: fvcr_geom.h:129
Definition: fvcr_geom.h:68
static const size_t maxNumSCV
Definition: fvcr_geom.h:72
void face_type
Definition: fvcr_geom.h:70
static const size_t maxNSH
Definition: fvcr_geom.h:73
static const size_t maxNumCo
Definition: fvcr_geom.h:74
void scv_type
Definition: fvcr_geom.h:69
static const size_t maxNumSCVF
Definition: fvcr_geom.h:71
Definition: hfvcr_geom.h:67
static const size_t maxNumSCVF
Definition: hfvcr_geom.h:70
static const size_t maxNumSCV
Definition: hfvcr_geom.h:71
static const size_t maxNSH
Definition: hfvcr_geom.h:72
traits for reference elements
Definition: reference_element_traits.h:48