Flow123d  release_2.2.0-914-gf1a3a4f
mixed_mesh_intersections.hh
Go to the documentation of this file.
1 /*!
2  *
3 * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file inspect_elements.hh
15  * @brief Main class MixedMeshIntersections for governing intersection algorithm on meshes of combined dimensions.
16  * @author Pavel Exner
17  *
18  * TODO: in 2d-2d and 1d-2d check that the intersection candidate has been already computed
19  * during algorithm, not when moving to storage..
20  * TODO: fix component numbering - component number is increasing weirdly...we get more components than expected
21  * then it does not work in 2d-2d
22  *
23  */
24 #ifndef INSPECT_ELEMENTS_H_
25 #define INSPECT_ELEMENTS_H_
26 
29 
30 class Mesh; // forward declare
31 
32 
35 template<unsigned int N, unsigned int M> class IntersectionLocal;
36 
37 /// Selection of intersections of different dimensions.
39 {
40  none = 0,
41  d12 = 0x0001,
42  d13 = 0x0002,
43  d23 = 0x0004,
44  d22 = 0x0008,
45  d12_1 = 0x0010, // different algorithms for 12
46  d12_2 = 0x0020,
47  d12_3 = 0x0040,
48  all = 0xFFFF
49 };
50 
51 /** @brief Main class for computation of intersection of meshes of combined dimensions.
52  *
53  * Controls different algorithms for computation of intersection.
54  * Computes intersection in the order:
55  * - 1D-3D
56  * - 2D-3D
57  * - 2D-2D (uses results from 2D-3D)
58  * After computation, it transforms the internal intersection objects into proper output structure
59  * for further usage.
60  * The objects of different intersection types are stored in different vectors:
61  * @p intersection_storageXY_ ..
62  *
63  * When we are on an element, we use @p element_intersections_ to get to all its intersections.
64  *
65  */
67 {
68 public:
69  /// Stores 1D-3D intersections.
71  /// Stores 2D-3D intersections.
73  /// Stores 2D-2D intersections.
75  /// Stores 1D-2D intersections.
77 
78  /**
79  * For every element, stores list of intersections with this element.
80  *
81  * intersection_map_[element index][i].first = other element index
82  * intersection_map_[element index][i].second = index pointer to the intersection object
83  */
84  typedef std::pair<unsigned int, IntersectionLocalBase *> ILpair;
86 
89 
90  /// Calls @p InspectElementsAlgorithm<dim>, computes intersections,
91  /// move them to storage, create the map and throw away the rest.
93 
94  // TODO: move following functions into common intersection test code.
95  // Functions for tests.
96  unsigned int number_of_components(unsigned int dim);
97 
98  /// Computes the size of the intersection in @p dim dimenstions.
99  double measure_13();
100  double measure_23();
101  double measure_22();
102 
103  /// Generates a mesh file of the given name, including the intersection.
104  void print_mesh_to_file_13(std::string name);
105  void print_mesh_to_file_23(std::string name);
106 
107 private:
108  /// Mesh pointer.
110 
115 
116  template<uint dim_A, uint dim_B>
118 
119  template<uint dim_A, uint dim_B>
121 
122  /// Auxiliary function that calls InspectElementsAlgorithm<dim>.
123  template<unsigned int dim> void compute_intersections(InspectElementsAlgorithm<dim> &iea,
129 };
130 
131 
132 
133 
134 #endif // INSPECT_ELEMENTS_H_
IntersectionType
Selection of intersections of different dimensions.
void compute_intersections_12_ngh_plane(std::vector< IntersectionLocal< 1, 2 > > &storage)
void compute_intersections_22(std::vector< IntersectionLocal< 2, 2 >> &storage)
void print_mesh_to_file_13(std::string name)
Generates a mesh file of the given name, including the intersection.
Common base for intersection object.
void compute_intersections_12(std::vector< IntersectionLocal< 1, 2 >> &storage)
Definition: mesh.h:99
Class represents intersection of two elements.
InspectElementsAlgorithm< 1 > algorithm13_
std::vector< std::vector< ILpair > > element_intersections_
Implements algorithm for finding 2D-2D intersections.
void print_mesh_to_file_23(std::string name)
void compute_intersections_12_2(std::vector< IntersectionLocal< 1, 2 >> &storage)
InspectElementsAlgorithm< 2 > algorithm23_
std::pair< unsigned int, IntersectionLocalBase * > ILpair
std::vector< IntersectionLocal< 1, 3 > > intersection_storage13_
Stores 1D-3D intersections.
void append_to_index(std::vector< IntersectionLocal< dim_A, dim_B >> &storage)
double measure_13()
Computes the size of the intersection in dim dimenstions.
void compute_intersections(IntersectionType d=IntersectionType::all)
void store_intersection(std::vector< IntersectionLocal< dim_A, dim_B >> &storage, IntersectionAux< dim_A, dim_B > &isec_aux)
unsigned int number_of_components(unsigned int dim)
InspectElementsAlgorithm22 algorithm22_
InspectElementsAlgorithm12 algorithm12_
Internal auxiliary class representing intersection object of simplex<dimA> and simplex<dimB>.
std::vector< IntersectionLocal< 2, 2 > > intersection_storage22_
Stores 2D-2D intersections.
std::vector< IntersectionLocal< 1, 2 > > intersection_storage12_
Stores 1D-2D intersections.
Implements algorithm for finding 1D-2D intersections.
std::vector< IntersectionLocal< 2, 3 > > intersection_storage23_
Stores 2D-3D intersections.
Main class for computation of intersection of meshes of combined dimensions.