Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
delaunay_info.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015: G-CSC, Goethe University Frankfurt
3 * Author: Sebastian Reiter
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_delaunay_info
34#define __H__UG_delaunay_info
35
36#include <queue>
37#include <vector>
38#include <sstream>
39#include "common/ug_config.h"
40#include "lib_grid/lg_base.h"
42
43namespace ug{
44
47template <class TAAPos>
49{
50 typedef TAAPos AAPos;
51 typedef typename TAAPos::ValueType vector_t;
52
53 public:
63
64 DelaunayInfo(Grid& g, TAAPos& aaPos,
65 Grid::edge_traits::callback cbConstrainedEdge);
66
68
69 Grid& grid() {return m_grid;}
70 AAPos& position_accessor() {return m_aaPos;}
71
72
76 template <class TIter>
77 void init_marks(TIter trisBegin, TIter trisEnd, bool pushFlipCandidates);
78
80 // MARKS
81 void set_mark(Vertex* v, Mark m) {m_aaMark[v] = m;}
82 Mark mark(Vertex* v) const {return static_cast<Mark>(m_aaMark[v]);}
83
84 void set_mark(Edge* e, Mark m) {m_aaMark[e] = m;}
85 Mark mark(Edge* e) const {return static_cast<Mark>(m_aaMark[e]);}
86
87 void set_mark(Face* f, Mark m);
88 Mark mark(Face* f) const {return static_cast<Mark>(m_aaMark[f]);}
89
90 template <class TIter>
91 void set_mark(TIter begin, TIter end, Mark m)
92 {
93 while(begin != end) {set_mark(*begin, m); ++begin;}
94 }
95
97 template <class TElem>
98 bool is_inner(TElem* e);
99
101 template <class TElem>
102 bool is_segment(TElem* e);
103
105 bool is_dart_segment(Edge* e);
106
108 bool is_new_dart_segment(Edge* e);
109
111 bool is_dart_shell_segment(Edge* e);
112
114
116 bool is_classifiable(Face* f);
117
119 // CANDIDATES
123 bool is_candidate(Edge* e) {return m_aaCandidateEDGE[e];}
124 void push_candidate(Edge* e);
125 Edge* pop_candidate();
126 bool candidates_left() {return !m_qEdgeCandidates.empty();}
130
134 void start_candidate_recording();
135
137 void stop_candidate_recording();
138
139
141 // FACE-CLASSIFICATION
147 bool classified_faces_left();
148 Face* pop_classified_face();
149 bool face_classification_enabled() {return m_aaFaceInfo.valid();}
150 void enable_face_classification(number minAngle);
151
152 number min_angle() const {return m_minAngle;}
153 number max_dot() const {return m_maxDot;}
157 // GRID-OBERSERVER CALLBACKS
158 virtual void vertex_created(Grid* grid, Vertex* vrt,
159 GridObject* pParent,
160 bool replacesParent);
161
162 virtual void edge_created(Grid* grid, Edge* e,
163 GridObject* pParent,
164 bool replacesParent);
165
166 virtual void face_created(Grid* grid, Face* f,
167 GridObject* pParent,
168 bool replacesParent);
169
170
171 virtual void edge_to_be_erased(Grid* grid, Edge* e, Edge* replacedBy);
172
173 virtual void face_to_be_erased(Grid* grid, Face* f, Face* replacedBy);
174
175 private:
176 struct FaceInfo{
177 FaceInfo() : f(NULL), priority(0), classified(false) {}
181 };
182
184 bool operator()(const FaceInfo* fi1, const FaceInfo* fi2) const
185 {
186 return fi1->priority < fi2->priority;
187 }
188 };
189
191
192 typedef std::priority_queue<FaceInfo*, std::vector<FaceInfo*>,
195
196
197 bool is_classified(Face* f);
198 bool classify_face(Face* f);
199
200 private:
203
206
210
214
215 // candidate edges
218 std::queue<Edge*> m_qEdgeCandidates;
219
220 // helper vector used during start/stop_candidate_recording
222 std::vector<Edge*> m_recordedCandidates;
223};
224
225}// end of namespace
226
227
229// include implementation
230#include "delaunay_info_impl.h"
231
232
233#endif //__H__UG_delaunay_info
A generic specialization of IAttachment.
Definition attachment_pipe.h:263
Definition delaunay_info.h:49
std::queue< Edge * > m_qEdgeCandidates
Definition delaunay_info.h:218
AAPos m_aaPos
Definition delaunay_info.h:202
Grid::edge_traits::callback m_cbConstrainedEdge
Definition delaunay_info.h:213
TAAPos::ValueType vector_t
Definition delaunay_info.h:51
bool candidates_left()
Definition delaunay_info.h:126
Grid::AttachmentAccessor< Edge, ABool > m_aaCandidateEDGE
Definition delaunay_info.h:217
AFaceInfo m_aFaceInfo
Definition delaunay_info.h:207
ABool m_aCandidate
Definition delaunay_info.h:216
void set_mark(TIter begin, TIter end, Mark m)
Definition delaunay_info.h:91
number min_angle() const
Definition delaunay_info.h:152
Attachment< FaceInfo * > AFaceInfo
Definition delaunay_info.h:190
Mark
Definition delaunay_info.h:54
@ NEW_INNER
Definition delaunay_info.h:57
@ SEGMENT
Definition delaunay_info.h:58
@ INNER
Definition delaunay_info.h:56
@ NEW_SEGMENT
Definition delaunay_info.h:59
@ DART
Definition delaunay_info.h:60
@ NONE
Definition delaunay_info.h:55
TAAPos AAPos
Definition delaunay_info.h:50
FacePriorityQueue m_faceQueue
Definition delaunay_info.h:209
number m_maxDot
Definition delaunay_info.h:212
Grid & m_grid
Definition delaunay_info.h:201
Mark mark(Vertex *v) const
Definition delaunay_info.h:82
void set_mark(Edge *e, Mark m)
Definition delaunay_info.h:84
MultiElementAttachmentAccessor< AByte > m_aaMark
Definition delaunay_info.h:205
void set_mark(Face *f, Mark m)
Mark mark(Edge *e) const
Definition delaunay_info.h:85
std::vector< Edge * > m_recordedCandidates
Definition delaunay_info.h:222
void set_mark(Vertex *v, Mark m)
Definition delaunay_info.h:81
AAPos & position_accessor()
Definition delaunay_info.h:70
AByte m_aMark
Definition delaunay_info.h:204
Grid::AttachmentAccessor< Face, AFaceInfo > m_aaFaceInfo
Definition delaunay_info.h:208
bool m_candidateRecordingEnabled
Definition delaunay_info.h:221
bool face_classification_enabled()
Definition delaunay_info.h:149
Grid & grid()
Definition delaunay_info.h:69
number m_minAngle
Definition delaunay_info.h:211
std::priority_queue< FaceInfo *, std::vector< FaceInfo * >, CompareFaceInfo > FacePriorityQueue
Definition delaunay_info.h:194
bool is_candidate(Edge *e)
Definition delaunay_info.h:123
Mark mark(Face *f) const
Definition delaunay_info.h:88
number max_dot() const
Definition delaunay_info.h:153
Base-class for edges.
Definition grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition grid_base_objects.h:510
the generic attachment-accessor for access to grids attachment pipes.
Definition grid.h:182
Manages the elements of a grid and their interconnection.
Definition grid.h:132
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition grid_base_objects.h:157
Definition grid_observer.h:80
Accesses attachements in different element types at the same time.
Definition attachment_util.h:56
Base-class for all vertex-types.
Definition grid_base_objects.h:231
#define UG_API
Definition ug_config.h:65
double number
Definition types.h:124
the ug namespace
Definition delaunay_info.h:183
bool operator()(const FaceInfo *fi1, const FaceInfo *fi2) const
Definition delaunay_info.h:184
Definition delaunay_info.h:176
bool classified
Definition delaunay_info.h:180
Face * f
Definition delaunay_info.h:178
FaceInfo()
Definition delaunay_info.h:177
number priority
Definition delaunay_info.h:179
boost::function< bool(base_object *)> callback
callback type for the elements base type.
Definition grid.h:150