ug4
fv_output.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-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__DISC_HELPER__FINITE_VOLUME_OUTPUT__
34 #define __H__UG__LIB_DISC__SPATIAL_DISC__DISC_HELPER__FINITE_VOLUME_OUTPUT__
35 
36 // other ug4 modules
37 #include "common/common.h"
38 #include "lib_disc/domain_util.h"
39 
40 // finite volume geometry
41 #include "fv1_geom.h"
42 #include "hfv1_geom.h"
43 
44 namespace ug{
45 
47 // ConstructGridOfSCVF
49 
50 template <typename TElem, template <class, int> class TFVGeom, int TWorldDim>
51 void CreateSCVF(const TElem& elem, TFVGeom<TElem, TWorldDim>& geo, ISubsetHandler& shOut,
53 {
54  // extract dimensions
55  static const int refDim = TFVGeom<TElem, TWorldDim>::dim;
56 
57  // extract grid
58  Grid& grid = *shOut.grid();
59 
60  // tmp vector for vertices
61  std::vector<Vertex*> vVert;
62 
63  // loop all scv of the element
64  for(size_t i = 0; i < geo.num_scvf(); ++i)
65  {
66  const typename TFVGeom<TElem, TWorldDim>::SCVF& scvf = geo.scvf(i);
67 
68  // clear vertices
69  vVert.clear();
70 
71  // loop corners of scv
72  for(size_t co = 0; co < scvf.num_corners(); ++co)
73  {
74  // create a new vertex
75  RegularVertex* vrt = *(grid.create<RegularVertex>());
76  vVert.push_back(vrt);
77 
78  // set the coordinates
79  aaPosOut[vrt] = scvf.global_corner(co);
80  }
81 
82  // edge
83  if(refDim == 2)
84  {
85  if (scvf.num_corners() == 2) {
86  grid.template create<RegularEdge>(EdgeDescriptor(vVert[0], vVert[1]));
87  }
88  else {
89  UG_THROW("SCVF has a number of nodes, that is not drawable.");
90  }
91  }
92  // face
93  else if(refDim == 3)
94  {
95  if (scvf.num_corners() == 4) {
96  grid.template create<Quadrilateral>(QuadrilateralDescriptor(vVert[0], vVert[1],
97  vVert[2], vVert[3]));
98  }
99  else if (scvf.num_corners() == 3) {
100  grid.template create<Triangle>(TriangleDescriptor(vVert[0], vVert[1],
101  vVert[2]));
102  }
103  else{
104  UG_THROW("SCVF has a number of nodes, that is not drawable.");
105  }
106  }
107  }
108 }
109 
110 template <typename TElem, template <class, int> class TFVGeom, int TWorldDim>
112  const SurfaceView& surfView,
115  int si)
116 {
117  // Create Geometry
118  TFVGeom<TElem, TWorldDim> geo;
119 
120  // iterators for primary grid
121  typename SurfaceView::traits<TElem>::const_iterator iter, iterBegin, iterEnd;
122  iterBegin = surfView.begin<TElem>(GridLevel(GridLevel::TOP, GridLevel::SURFACE, false), SurfaceView::SURFACE);
123  iterEnd = surfView.end<TElem>(GridLevel(GridLevel::TOP, GridLevel::SURFACE, false), SurfaceView::SURFACE);
124 
125  // corners of element
126  std::vector<MathVector<TWorldDim> > vCornerCoords;
127 
128  // iterate over primary grid
129  for(iter = iterBegin; iter != iterEnd; ++iter)
130  {
131  // get element
132  TElem* elem = *iter;
133 
134  // get corner coordinates
135  CollectCornerCoordinates(vCornerCoords, *elem, aaPos);
136 
137  // update finite volume geometry
138  geo.update(elem, &vCornerCoords[0], &(*surfView.subset_handler()));
139 
140  // Create dual grid
141  CreateSCVF<TElem, TFVGeom, TWorldDim>(*elem, geo, shOut, aaPosOut);
142  }
143 }
144 
145 
146 template <template <class, int> class TFVGeom, int TWorldDim>
148 
149 template <template <class, int> class TFVGeom>
150 struct ConstructGridOfSCVFWrapper<TFVGeom, 1>
151 {
152  static void apply(ISubsetHandler& shOut, const SurfaceView& surfView,
155  int si, int siDim)
156  {
157  switch(siDim)
158  {
159  case 1: ConstructGridOfSCVF<RegularEdge, TFVGeom, 1>(shOut, surfView, aaPos, aaPosOut, si);
160  break;
161  default: UG_THROW("CreateDualGrid: Dimension " << siDim << " not supported. World dimension is " << 1 <<".");
162  }
163  }
164 };
165 
166 template <template <class, int> class TFVGeom>
167 struct ConstructGridOfSCVFWrapper<TFVGeom, 2>
168 {
169  static void apply(ISubsetHandler& shOut, const SurfaceView& surfView,
172  int si, int siDim)
173  {
174  switch(siDim)
175  {
176  case 1: ConstructGridOfSCVF<RegularEdge, TFVGeom, 2>(shOut, surfView, aaPos, aaPosOut, si);
177  break;
178  case 2: ConstructGridOfSCVF<Triangle, TFVGeom, 2>(shOut, surfView, aaPos, aaPosOut, si);
179  ConstructGridOfSCVF<Quadrilateral, TFVGeom, 2>(shOut, surfView, aaPos, aaPosOut, si);
180  break;
181  default: UG_THROW("CreateDualGrid: Dimension " << siDim << " not supported. World dimension is " << 2);
182  }
183  }
184 };
185 
186 template <template <class, int> class TFVGeom>
187 struct ConstructGridOfSCVFWrapper<TFVGeom, 3>
188 {
189  static void apply(ISubsetHandler& shOut, const SurfaceView& surfView,
192  int si, int siDim)
193  {
194  switch(siDim)
195  {
196  case 1: ConstructGridOfSCVF<RegularEdge, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
197  break;
198  case 2: ConstructGridOfSCVF<Triangle, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
199  ConstructGridOfSCVF<Quadrilateral, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
200  break;
201  case 3: ConstructGridOfSCVF<Tetrahedron, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
202  ConstructGridOfSCVF<Hexahedron, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
203  ConstructGridOfSCVF<Prism, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
204  ConstructGridOfSCVF<Pyramid, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
205  ConstructGridOfSCVF<Octahedron, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
206  break;
207  default: UG_THROW("CreateDualGrid: Dimension " << siDim << " not supported. World dimension is " << 3);
208  }
209  }
210 };
211 
212 template <template <class, int> class TFVGeom, int TWorldDim>
213 void ConstructGridOfSCVF(ISubsetHandler& shOut, const SurfaceView& surfView,
216  int si, int siDim)
217 {
218  ConstructGridOfSCVFWrapper<TFVGeom, TWorldDim>::apply(shOut, surfView, aaPos, aaPosOut, si, siDim);
219 }
220 
221 
223 // ConstructGridOfSCV
225 
226 template <typename TElem, template <class, int> class TFVGeom, int TWorldDim>
227 void CreateSCV(const TElem& elem, TFVGeom<TElem, TWorldDim>& geo, ISubsetHandler& shOut,
229 {
230  // extract dimensions
231  static const int refDim = TFVGeom<TElem, TWorldDim>::dim;
232 
233  // extract grid
234  Grid& grid = *shOut.grid();
235 
236  // tmp vector for vertices
237  std::vector<Vertex*> vVert;
238 
239  // loop all scv of the element
240  for(size_t i = 0; i < geo.num_scv(); ++i)
241  {
242  const typename TFVGeom<TElem, TWorldDim>::SCV& scv = geo.scv(i);
243 
244  // clear vertices
245  vVert.clear();
246 
247  // loop corners of scv
248  for(size_t co = 0; co < scv.num_corners(); ++co)
249  {
250  // create a new vertex
251  RegularVertex* vrt = *(grid.create<RegularVertex>());
252  vVert.push_back(vrt);
253 
254  // set the coordinates
255  aaPosOut[vrt] = scv.global_corner(co);
256 
257  // if co == 0, it is a vertex of the primary grid
258  // We assign all of those vertices to subset 0
259  // The other vertices remain in subset -1
260  if(co == 0) shOut.assign_subset(vrt, 0);
261  else shOut.assign_subset(vrt, -1);
262 
263  }
264 
265  // edge
266  if(refDim == 1)
267  {
268  grid.template create<RegularEdge>(EdgeDescriptor(vVert[0], vVert[1]));
269  }
270  // face
271  else if(refDim == 2)
272  {
273  if (scv.num_corners() == 4) {
274  grid.template create<Quadrilateral>(QuadrilateralDescriptor(vVert[0], vVert[1],
275  vVert[2], vVert[3]));
276  }
277  else {
278  UG_THROW("SCV has a number of nodes, that is not drawable.");
279  }
280  }
281  // volume
282  else if(refDim == 3)
283  {
284  if (scv.num_corners() == 8) {
285  grid.template create<Hexahedron>(HexahedronDescriptor( vVert[0], vVert[1], vVert[2], vVert[3],
286  vVert[4], vVert[5], vVert[6], vVert[7]));
287  }
288  else if (scv.num_corners() == 4) {
289  grid.template create<Tetrahedron>(TetrahedronDescriptor( vVert[0], vVert[1], vVert[2], vVert[3]));
290  }
291  else {
292  UG_THROW("SCV has a number of nodes, that is not drawable.");
293  }
294  }
295  }
296 }
297 
298 template <typename TElem, template <class, int> class TFVGeom, int TWorldDim>
299 void ConstructGridOfSCV(ISubsetHandler& shOut, const SurfaceView& surfView,
302  int si)
303 {
304  // Create Geometry
305  TFVGeom<TElem, TWorldDim> geo;
306 
307  // iterators for primary grid
308  typename SurfaceView::traits<TElem>::const_iterator iter, iterBegin, iterEnd;
309  iterBegin = surfView.begin<TElem>(GridLevel(GridLevel::TOP, GridLevel::SURFACE, false), SurfaceView::SURFACE);
310  iterEnd = surfView.end<TElem>(GridLevel(GridLevel::TOP, GridLevel::SURFACE, false), SurfaceView::SURFACE);
311 
312  // corners of element
313  std::vector<MathVector<TWorldDim> > vCornerCoords;
314 
315  // iterate over primary grid
316  for(iter = iterBegin; iter != iterEnd; ++iter)
317  {
318  // get element
319  TElem* elem = *iter;
320 
321  // get corner coordinates
322  CollectCornerCoordinates(vCornerCoords, *elem, aaPos);
323 
324  // update finite volume geometry
325  geo.update(elem, &vCornerCoords[0], &(*surfView.subset_handler()));
326 
327  // Create dual grid
328  CreateSCV<TElem, TFVGeom, TWorldDim>(*elem, geo, shOut, aaPosOut);
329  }
330 }
331 
332 
333 template <template <class, int> class TFVGeom, int TWorldDim>
335 
336 template <template <class TElem, int TWorldDim> class TFVGeom>
337 struct ConstructGridOfSCVWrapper<TFVGeom, 1>
338 {
339  static void apply(ISubsetHandler& shOut, const SurfaceView& surfView,
342  int si, int siDim)
343  {
344  switch(siDim)
345  {
346  case 1: ConstructGridOfSCV<RegularEdge, TFVGeom, 1>(shOut, surfView, aaPos, aaPosOut, si);
347  break;
348  default: UG_THROW("CreateDualGrid: Dimension " << siDim << " not supported. World dimension is " << 1);
349  }
350  }
351 };
352 
353 template <template <class, int> class TFVGeom>
354 struct ConstructGridOfSCVWrapper<TFVGeom, 2>
355 {
356  static void apply(ISubsetHandler& shOut, const SurfaceView& surfView,
359  int si, int siDim)
360  {
361  switch(siDim)
362  {
363  case 1: ConstructGridOfSCV<RegularEdge, TFVGeom, 2>(shOut, surfView, aaPos, aaPosOut, si);
364  break;
365  case 2: ConstructGridOfSCV<Triangle, TFVGeom, 2>(shOut, surfView, aaPos, aaPosOut, si);
366  ConstructGridOfSCV<Quadrilateral, TFVGeom, 2>(shOut, surfView, aaPos, aaPosOut, si);
367  break;
368  default: UG_THROW("CreateDualGrid: Dimension " << siDim << " not supported. World dimension is " << 2);
369  }
370  }
371 };
372 
373 template <template <class, int> class TFVGeom>
374 struct ConstructGridOfSCVWrapper<TFVGeom, 3>
375 {
376  static void apply(ISubsetHandler& shOut, const SurfaceView& surfView,
379  int si, int siDim)
380  {
381  switch(siDim)
382  {
383  case 1: ConstructGridOfSCV<RegularEdge, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
384  break;
385  case 2: ConstructGridOfSCV<Triangle, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
386  ConstructGridOfSCV<Quadrilateral, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
387  break;
388  case 3: ConstructGridOfSCV<Tetrahedron, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
389  ConstructGridOfSCV<Hexahedron, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
390  ConstructGridOfSCV<Prism, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
391  ConstructGridOfSCV<Pyramid, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
392  ConstructGridOfSCV<Octahedron, TFVGeom, 3>(shOut, surfView, aaPos, aaPosOut, si);
393  break;
394  default: UG_THROW("CreateDualGrid: Dimension " << siDim << " not supported. World dimension is " << 3);
395  }
396  }
397 };
398 
399 template <template <class, int> class TFVGeom, int TWorldDim>
400 void ConstructGridOfSCV(ISubsetHandler& shOut, const SurfaceView& surfView,
403  int si, int siDim)
404 {
405  ConstructGridOfSCVWrapper<TFVGeom, TWorldDim>::apply(shOut, surfView, aaPos, aaPosOut, si, siDim);
406 }
407 
408 
410 // Assignement of Subsets
412 
413 template <typename TElem>
415 {
416  // extract grid
417  Grid& grid = *shOut.grid();
418 
419  // iterators for primary grid
420  typename geometry_traits<TElem>::iterator iter, iterBegin, iterEnd;
421  iterBegin = grid.begin<TElem>();
422  iterEnd = grid.end<TElem>();
423 
424  // iterate over primary grid
425  int si = 0;
426  for(iter = iterBegin; iter != iterEnd; ++iter)
427  {
428  shOut.assign_subset(*iter, si++);
429  }
430 }
431 
432 template <typename TElem>
434 {
435  // extract grid
436  Grid& grid = *shOut.grid();
437 
438  // iterators for primary grid
439  typename geometry_traits<TElem>::iterator iter, iterBegin, iterEnd;
440  iterBegin = grid.begin<TElem>();
441  iterEnd = grid.end<TElem>();
442 
443  // iterate over primary grid
444  int si = 0;
445  for(iter = iterBegin; iter != iterEnd; ++iter)
446  {
447  shOut.assign_subset(*iter, si++);
448  }
449 }
450 
451 
452 template <int TRefDim>
454 {
455  // extract grid
456  Grid& grid = *shOut.grid();
457 
458  std::vector<Volume*> vVols;
459  std::vector<Face*> vFaces;
460  std::vector<Edge*> vEdges;
461 
462  int si = 0;
463  for(VertexIterator iter = shOut.grid()->begin<Vertex>();
464  iter != shOut.grid()->end<Vertex>(); ++iter, ++si)
465  {
466  if(shOut.get_subset_index(*iter) != 0) continue;
467 
468  switch(TRefDim)
469  {
470  case 1: CollectEdges(vEdges, grid, *iter);
471  shOut.assign_subset(vEdges.begin(), vEdges.end(), si);
472  break;
473  case 2: CollectFaces(vFaces, grid, *iter);
474  shOut.assign_subset(vFaces.begin(), vFaces.end(), si);
475  break;
476  case 3: CollectVolumes(vVols, grid, *iter);
477  shOut.assign_subset(vVols.begin(), vVols.end(), si);
478  break;
479  default: UG_THROW("Dimension " << TRefDim << " is not supported.");
480  }
481  }
482 }
483 
484 
485 template <template <class, int> class TFVGeom, typename TAAPosition>
486 void CreateGridOfSubControlVolumes(ISubsetHandler& shOut, TAAPosition& aaPosOut, const ISubsetHandler& sh, const TAAPosition& aaPos, const SurfaceView& surfView, int si = -1)
487 {
488  static const int dim = TAAPosition::ValueType::Size;
489 
490  // Construct dual domain for scv and given subset
491  if(si >= 0)
492  {
493  const int siDim = DimensionOfSubset(sh, si);
494  ConstructGridOfSCV<TFVGeom, dim>(shOut, surfView, aaPos, aaPosOut, si, siDim);
495  }
496  // if no subset selected, construct dual grid for all subsets with dim == worldDim
497  else
498  {
499  for(si = 0; si < sh.num_subsets(); ++si)
500  {
501  const int siDim = DimensionOfSubset(sh, si);
502  if(siDim != dim) continue;
503 
504  ConstructGridOfSCV<TFVGeom, dim>(shOut, surfView, aaPos, aaPosOut, si, siDim);
505  }
506  }
507 
508  // Let each SubControlVolume be one subset
509  switch(dim)
510  {
511  case 1: ColorSubControlVolume<Edge>(shOut); break;
512  case 2: ColorSubControlVolume<Face>(shOut); break;
513  case 3: ColorSubControlVolume<Volume>(shOut); break;
514  default: UG_THROW("WriteDualGridToFile: Dimension "<<dim<<" not supported.");
515  }
516 }
517 
518 template <template <class, int> class TFVGeom, typename TAAPosition, typename TAPosition>
519 void CreateGridOfControlVolumes(ISubsetHandler& shOut, TAAPosition& aaPosOut, TAPosition& aPosOut, const ISubsetHandler& sh, const TAAPosition& aaPos, const SurfaceView& surfView, int si = -1)
520 {
521  static const int dim = TAAPosition::ValueType::Size;
522 
523  // Construct dual domain for scv and given subset
524  if(si >= 0)
525  {
526  const int siDim = DimensionOfSubset(sh, si);
527  ConstructGridOfSCV<TFVGeom, dim>(shOut, surfView, aaPos, aaPosOut, si, siDim);
528  }
529  // if no subset selected, construct dual grid for all subsets with dim == worldDim
530  else
531  {
532  for(si = 0; si < sh.num_subsets(); ++si)
533  {
534  const int siDim = DimensionOfSubset(sh, si);
535  if(siDim != dim) continue;
536 
537  ConstructGridOfSCV<TFVGeom, dim>(shOut, surfView, aaPos, aaPosOut, si, siDim);
538  }
539  }
540 
541  // remove doubles
542  RemoveDoubles<dim>(*shOut.grid(),
543  shOut.grid()->begin<Vertex>(), shOut.grid()->end<Vertex>(),
544  aPosOut, 1e-5);
545 
546  // Let each SubControlVolume be one subset
547  switch(dim)
548  {
549  case 1: ColorControlVolume<1>(shOut); break;
550  case 2: ColorControlVolume<2>(shOut); break;
551  case 3: ColorControlVolume<3>(shOut); break;
552  default: UG_THROW("WriteDualGridToFile: Dimension "<<dim<<" not supported.");
553  }
554 }
555 
556 template <template <class, int> class TFVGeom, typename TAAPosition>
557 void CreateGridOfSubControlVolumeFaces(ISubsetHandler& shOut, TAAPosition& aaPosOut, const ISubsetHandler& sh, const TAAPosition& aaPos, const SurfaceView& surfView, int si = -1)
558 {
559  static const int dim = TAAPosition::ValueType::Size;
560 
561  // Construct dual domain for scv and given subset
562  if(si >= 0)
563  {
564  const int siDim = DimensionOfSubset(sh, si);
565 
566  ConstructGridOfSCVF<TFVGeom, dim>(shOut, surfView, aaPos, aaPosOut, si, siDim);
567  }
568  // if no subset selected, construct dual grid for all subsets with dim == worldDim
569  else
570  {
571  for(si = 0; si < sh.num_subsets(); ++si)
572  {
573  const int siDim = DimensionOfSubset(sh, si);
574  if(siDim != dim) continue;
575 
576  ConstructGridOfSCVF<TFVGeom, dim>(shOut, surfView, aaPos, aaPosOut, si, siDim);
577  }
578  }
579 
580  // Let each SubControlVolume be one subset
581  switch(dim)
582  {
583  case 1: ColorSubControlVolumeFaces<Vertex>(shOut); break;
584  case 2: ColorSubControlVolumeFaces<Edge>(shOut); break;
585  case 3: ColorSubControlVolumeFaces<Face>(shOut); break;
586  default: UG_THROW("WriteDualGridToFile: Dimension " << dim << " not supported.");
587  }
588 }
589 
598 template <template <class, int> class TFVGeom, typename TDomain>
599 void CreateSubControlVolumeFaceDomain(TDomain& domOut, const TDomain& domIn, const SurfaceView& surfView, int si = -1)
600 {
601  if(&domOut == &domIn)
602  UG_THROW("CreateSubControlVolumeFaceDomain: Domains must be different.");
603 
604  CreateGridOfSubControlVolumeFaces<TFVGeom, typename TDomain::position_accessor_type>
605  ( *domOut.subset_handler(),
606  domOut.position_accessor(),
607  *domIn.subset_handler(),
608  domIn.position_accessor(),
609  surfView, si);
610 }
611 
620 template <template <class, int> class TFVGeom, typename TDomain>
621 void CreateSubControlVolumeDomain(TDomain& domOut, const TDomain& domIn, const SurfaceView& surfView, int si = -1)
622 {
623  if(&domOut == &domIn)
624  UG_THROW("CreateSubControlVolumeDomain: Domains must be different.");
625 
626  CreateGridOfSubControlVolumes<TFVGeom, typename TDomain::position_accessor_type>
627  ( *domOut.subset_handler(),
628  domOut.position_accessor(),
629  *domIn.subset_handler(),
630  domIn.position_accessor(),
631  surfView, si);
632 }
633 
642 template <template <class, int> class TFVGeom, typename TDomain>
643 void CreateControlVolumeDomain(TDomain& domOut, const TDomain& domIn, const SurfaceView& surfView, int si = -1)
644 {
645  if(&domOut == &domIn)
646  UG_THROW("CreateControlVolumeDomain: Domains must be different.");
647 
648  CreateGridOfControlVolumes<TFVGeom, typename TDomain::position_accessor_type, typename TDomain::position_attachment_type>
649  ( *domOut.subset_handler(),
650  domOut.position_accessor(),
651  domOut.position_attachment(),
652  *domIn.subset_handler(),
653  domIn.position_accessor(),
654  surfView, si);
655 }
656 
657 } // end namespace ug
658 
659 
660 #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__DISC_HELPER__FINITE_VOLUME_OUTPUT__ */
A generic specialization of IAttachment.
Definition: attachment_pipe.h:263
Can be used to store information about an edge and to construct an edge.
Definition: grid_base_objects.h:464
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void clear()
clears the grids geometry and attachments
Definition: grid.cpp:220
geometry_traits< TGeomObj >::iterator begin()
Definition: grid_impl.hpp:164
geometry_traits< TGeomObj >::iterator create(GridObject *pParent=NULL)
create a custom element.
Definition: grid_impl.hpp:69
geometry_traits< TGeomObj >::iterator end()
Definition: grid_impl.hpp:175
Definition: grid_level.h:42
@ TOP
Definition: grid_level.h:45
@ SURFACE
Definition: grid_level.h:48
only used to initialize a hexahedron. for all other tasks you should use VolumeDescriptor.
Definition: grid_objects_3d.h:203
Definition: subset_handler_interface.h:223
void assign_subset(TIterator iterBegin, TIterator iterEnd, int subsetIndex)
Definition: subset_handler_interface_impl.hpp:170
Grid * grid() const
returns a pointer to the grid on which the subset-handler works.
Definition: subset_handler_interface.cpp:304
int get_subset_index(GridObject *elem) const
Definition: subset_handler_interface.cpp:560
int num_subsets() const
returns the number of subset-infos (return value is int, since SubsetIndices are of type int)
Definition: subset_handler_interface.h:317
a mathematical Vector with N entries.
Definition: math_vector.h:97
only used to initialize a quadrilateral. for all other tasks you should use FaceDescriptor.
Definition: grid_objects_2d.h:220
A basic vertex-type.
Definition: grid_objects_0d.h:62
Const iterator to traverse the surface of a multi-grid hierarchy.
Definition: surface_view.h:237
Represents the surface view of a multi-grid hierarchy.
Definition: surface_view.h:61
traits< TElem >::iterator end(int si, const GridLevel &gl, SurfaceState validStates)
Definition: surface_view_impl.hpp:372
@ SURFACE
Definition: surface_view.h:100
SmartPtr< MGSubsetHandler > subset_handler()
returns underlying subset handler
Definition: surface_view_impl.hpp:426
traits< TElem >::iterator begin(int si, const GridLevel &gl, SurfaceState validStates)
Definition: surface_view_impl.hpp:364
only used to initialize a tetrahedron. for all other tasks you should use VolumeDescripor.
Definition: grid_objects_3d.h:68
only used to initialize a triangle. for all other tasks you should use FaceDescriptor.
Definition: grid_objects_2d.h:78
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Definition: grid_base_object_traits.h:68
void CollectCornerCoordinates(std::vector< typename TAAPos::ValueType > &vCornerCoordsOut, const TElem &elem, const TAAPos &aaPos, bool clearContainer=true)
returns the corner coordinates of a geometric object
Definition: domain_util_impl.h:75
void CollectVolumes(std::vector< Volume * > &vVolumesOut, Grid &grid, Vertex *vrt, bool clearContainer)
Collects all volumes that exist in the given grid which contain the given vertex.
Definition: grid_util.cpp:592
void CollectEdges(std::vector< Edge * > &vEdgesOut, Grid &grid, Vertex *vrt, bool clearContainer)
Collects all edges which exist in the given grid and which are part of the given vertex.
Definition: grid_util.cpp:295
void CollectFaces(std::vector< Face * > &vFacesOut, Grid &grid, Vertex *vrt, bool clearContainer)
Collects all faces that exist in the given grid which contain the given vertex.
Definition: grid_util.cpp:458
static const int dim
#define UG_THROW(msg)
Definition: error.h:57
the ug namespace
void ColorSubControlVolume(ISubsetHandler &shOut)
Definition: fv_output.h:433
void CreateSubControlVolumeFaceDomain(TDomain &domOut, const TDomain &domIn, const SurfaceView &surfView, int si=-1)
Definition: fv_output.h:599
void CreateGridOfSubControlVolumeFaces(ISubsetHandler &shOut, TAAPosition &aaPosOut, const ISubsetHandler &sh, const TAAPosition &aaPos, const SurfaceView &surfView, int si=-1)
Definition: fv_output.h:557
ElementStorage< Vertex >::SectionContainer::iterator VertexIterator
This Iterator will be used as base-class for iterators of specialized geometric objects.
Definition: grid_base_object_traits.h:73
void ConstructGridOfSCVF(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< TWorldDim > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< TWorldDim > > > &aaPosOut, int si)
Definition: fv_output.h:111
void CreateSubControlVolumeDomain(TDomain &domOut, const TDomain &domIn, const SurfaceView &surfView, int si=-1)
Definition: fv_output.h:621
void ColorSubControlVolumeFaces(ISubsetHandler &shOut)
Definition: fv_output.h:414
void ConstructGridOfSCV(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< TWorldDim > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< TWorldDim > > > &aaPosOut, int si)
Definition: fv_output.h:299
void CreateGridOfControlVolumes(ISubsetHandler &shOut, TAAPosition &aaPosOut, TAPosition &aPosOut, const ISubsetHandler &sh, const TAAPosition &aaPos, const SurfaceView &surfView, int si=-1)
Definition: fv_output.h:519
int DimensionOfSubset(const ISubsetHandler &sh, int si)
returns the current dimension of the subset
Definition: subset_dim_util.cpp:89
void CreateControlVolumeDomain(TDomain &domOut, const TDomain &domIn, const SurfaceView &surfView, int si=-1)
Definition: fv_output.h:643
void CreateSCV(const TElem &elem, TFVGeom< TElem, TWorldDim > &geo, ISubsetHandler &shOut, Grid::VertexAttachmentAccessor< Attachment< MathVector< TWorldDim > > > &aaPosOut)
Definition: fv_output.h:227
void CreateGridOfSubControlVolumes(ISubsetHandler &shOut, TAAPosition &aaPosOut, const ISubsetHandler &sh, const TAAPosition &aaPos, const SurfaceView &surfView, int si=-1)
Definition: fv_output.h:486
void CreateSCVF(const TElem &elem, TFVGeom< TElem, TWorldDim > &geo, ISubsetHandler &shOut, Grid::VertexAttachmentAccessor< Attachment< MathVector< TWorldDim > > > &aaPosOut)
Definition: fv_output.h:51
void ColorControlVolume(ISubsetHandler &shOut)
Definition: fv_output.h:453
static void apply(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< 1 > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< 1 > > > &aaPosOut, int si, int siDim)
Definition: fv_output.h:152
static void apply(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< 2 > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< 2 > > > &aaPosOut, int si, int siDim)
Definition: fv_output.h:169
static void apply(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< 3 > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< 3 > > > &aaPosOut, int si, int siDim)
Definition: fv_output.h:189
Definition: fv_output.h:147
static void apply(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< 1 > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< 1 > > > &aaPosOut, int si, int siDim)
Definition: fv_output.h:339
static void apply(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< 2 > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< 2 > > > &aaPosOut, int si, int siDim)
Definition: fv_output.h:356
static void apply(ISubsetHandler &shOut, const SurfaceView &surfView, const Grid::VertexAttachmentAccessor< Attachment< MathVector< 3 > > > &aaPos, Grid::VertexAttachmentAccessor< Attachment< MathVector< 3 > > > &aaPosOut, int si, int siDim)
Definition: fv_output.h:376
Definition: fv_output.h:334