Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
grid_util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-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__LIB_GRID__GRID_UTIL__
34#define __H__LIB_GRID__GRID_UTIL__
35
36#include <vector>
37#include "grid_base_objects.h"
38
39namespace ug
40{
41
42class Grid;
43
44
46// CompareVertices
48
55UG_API
56bool CompareVertices(const EdgeVertices* ev1,
57 const EdgeVertices* ev2);
58
60
70UG_API
71bool CompareVertices(const FaceVertices* fv1,
72 const FaceVertices* fv2);
73
75
85UG_API
86bool CompareVertices(const VolumeVertices* vv1,
87 const VolumeVertices* vv2);
88
89
100UG_API
101bool VertexGroupsMatch(const IVertexGroup* elem, const IVertexGroup& desc);
102
104UG_API
105bool VertexGroupsMatch(const Vertex* elem, const IVertexGroup& desc);
106
107
109// CompareVertexContainer
111
129template <class TVrtContainer1, class TVrtContainer2>
130UG_API
131bool CompareVertexContainer(const TVrtContainer1& con1,
132 const TVrtContainer2& con2);
133
134
139
141// CollectVertices
143UG_API
144inline void CollectAssociated(std::vector<Vertex*>& vVertexOut, Grid& grid,
145 GridObject* obj, bool clearContainer = true);
146UG_API
147inline void CollectVertices(std::vector<Vertex*>& vVertexOut, Grid& grid,
148 GridObject* obj, bool clearContainer = true);
149
151
155UG_API
156void CollectVertices(std::vector<Vertex*>& vVertexOut, Grid& grid,
157 Vertex* v, bool clearContainer = true);
158
159UG_API
160inline void CollectAssociated(std::vector<Vertex*>& vVertexOut,
161 Grid& grid, Vertex* v, bool clearContainer = true);
165
169UG_API
170void CollectVertices(std::vector<Vertex*>& vVertexOut, Grid& grid,
171 Edge* e, bool clearContainer = true);
172
173UG_API
174inline void CollectAssociated(std::vector<Vertex*>& vVertexOut,
175 Grid& grid, Edge* e, bool clearContainer = true);
179
183UG_API
184void CollectVertices(std::vector<Vertex*>& vVertexOut, Grid& grid,
185 Face* f, bool clearContainer = true);
186
187UG_API
188inline void CollectAssociated(std::vector<Vertex*>& vVertexOut,
189 Grid& grid, Face* f, bool clearContainer = true);
193
197UG_API
198void CollectVertices(std::vector<Vertex*>& vVertexOut, Grid& grid,
199 Volume* v, bool clearContainer = true);
200
201inline void CollectAssociated(std::vector<Vertex*>& vVertexOut,
202 Grid& grid, Volume* v, bool clearContainer = true);
206// GetVertex
208
210
216inline Vertex* GetVertex(Vertex* v, size_t i);
217
219
224inline Vertex* GetVertex(Edge* e, size_t i);
225
227
232inline Vertex* GetVertex(Face* f, size_t i);
233
235
240inline Vertex* GetVertex(Volume* v, size_t i);
241
243// NumVertices
245
247
253inline size_t NumVertices(Vertex* elem);
254inline size_t NumVertices(Edge* elem);
255inline size_t NumVertices(Face* elem);
256inline size_t NumVertices(Volume* elem);
261// CollectEdgesSorted
263
264inline void CollectEdgesSorted(std::vector<Edge*>& vEdgesOut, Grid& grid,
265 GridObject* obj, bool clearContainer = true);
266
267UG_API
268void CollectEdgesSorted(std::vector<Edge*>& vEdgesOut, Grid& grid,
269 Vertex* v, bool clearContainer = true);
270
272
275UG_API
276void CollectEdgesSorted(std::vector<Edge*>& vEdgesOut, Grid& grid,
277 Edge* e, bool clearContainer = true);
278
280
283UG_API
284void CollectEdgesSorted(std::vector<Edge*>& vEdgesOut, Grid& grid,
285 Face* f, bool clearContainer = true);
286
288
291UG_API
292void CollectEdgesSorted(std::vector<Edge*>& vEdgesOut, Grid& grid,
293 Volume* v, bool clearContainer = true);
294
296// CollectEdges
298
299inline void CollectAssociated(std::vector<Edge*>& vEdgesOut, Grid& grid,
300 GridObject* obj, bool clearContainer = true);
301
303
305UG_API
306void CollectEdges(std::vector<Edge*>& vEdgesOut, Grid& grid,
307 Vertex* vrt, bool clearContainer = true);
308
309inline void CollectAssociated(std::vector<Edge*>& vEdgesOut,
310 Grid& grid, Vertex* vrt, bool clearContainer = true);
314
318UG_API
319void CollectEdges(std::vector<Edge*>& vEdgesOut, Grid& grid,
320 Edge* e, bool clearContainer = true);
321
322inline void CollectAssociated(std::vector<Edge*>& vEdgesOut,
323 Grid& grid, Edge* e, bool clearContainer = true);
327
335UG_API
336void CollectEdges(std::vector<Edge*>& vEdgesOut, Grid& grid,
337 Face* f, bool clearContainer = true);
338
339inline void CollectAssociated(std::vector<Edge*>& vEdgesOut,
340 Grid& grid, Face* f, bool clearContainer = true);
344
352UG_API
353void CollectEdges(std::vector<Edge*>& vEdgesOut, Grid& grid,
354 Volume* v, bool clearContainer = true);
355
356inline void CollectAssociated(std::vector<Edge*>& vEdgesOut,
357 Grid& grid, Volume* v, bool clearContainer = true);
361// EdgeContains
363
366inline bool EdgeContains(EdgeVertices* e, Vertex* vrt);
367
370inline bool EdgeContains(EdgeVertices* e, Vertex* vrt1, Vertex* vrt2);
371
373// CollectFacesSorted
375
376inline void CollectFacesSorted(std::vector<Face*>& vFacesOut, Grid& grid,
377 GridObject* obj, bool clearContainer = true);
378
379
380UG_API
381void CollectFacesSorted(std::vector<Face*>& vFacesOut, Grid& grid,
382 Vertex* v, bool clearContainer = true);
383
385UG_API
386void CollectFacesSorted(std::vector<Face*>& vFacesOut, Grid& grid,
387 Edge* e, bool clearContainer = true);
388
390UG_API
391void CollectFacesSorted(std::vector<Face*>& vFacesOut, Grid& grid,
392 Face* f, bool clearContainer = true);
393
395
398UG_API
399void CollectFacesSorted(std::vector<Face*>& vFacesOut, Grid& grid,
400 Volume* v, bool clearContainer = true);
401
403// CollectFaces
405
406inline void CollectAssociated(std::vector<Face*>& vFacesOut, Grid& grid,
407 GridObject* obj, bool clearContainer = true);
408
409UG_API
410void CollectFaces(std::vector<Face*>& vFacesOut, Grid& grid,
411 Vertex* vrt, bool clearContainer = true);
412
413inline void CollectAssociated(std::vector<Face*>& vFacesOut,
414 Grid& grid, Vertex* vrt, bool clearContainer = true);
415
417
424UG_API
425void CollectFaces(std::vector<Face*>& vFacesOut, Grid& grid,
426 Edge* e, bool clearContainer = true);
427
428inline void CollectAssociated(std::vector<Face*>& vFacesOut,
429 Grid& grid, Edge* e, bool clearContainer = true);
433UG_API
434void CollectFaces(std::vector<Face*>& vFacesOut, Grid& grid,
435 Face* v, bool clearContainer = true);
436
438inline void CollectAssociated(std::vector<Face*>& vFacesOut,
439 Grid& grid, Face* vol, bool clearContainer = true);
440
442
450UG_API
451void CollectFaces(std::vector<Face*>& vFacesOut, Grid& grid,
452 Volume* v, bool clearContainer = true);
453
454inline void CollectAssociated(std::vector<Face*>& vFacesOut,
455 Grid& grid, Volume* v, bool clearContainer = true);
456
460// FaceMatches
462//bool FaceMatches(Face* f, FaceDescriptor& fd);
463
465// FaceContains
468bool FaceContains(FaceVertices* f, Vertex* v);
469
471// FaceContains
474UG_API
475bool FaceContains(Face* f, EdgeVertices* ev);
476
478// CollectVolumes
480
481// CollectVolumes
482inline void CollectAssociated(std::vector<Volume*>& vVolumesOut, Grid& grid,
483 GridObject* obj, bool clearContainer = true);
484
486UG_API
487void CollectVolumes(std::vector<Volume*>& vVolumesOut, Grid& grid, Vertex* vrt, bool clearContainer = true);
488
489inline void CollectAssociated(std::vector<Volume*>& vVolumesOut,
490 Grid& grid, Vertex* vrt, bool clearContainer = true);
491
493
500UG_API
501void CollectVolumes(std::vector<Volume*>& vVolumesOut, Grid& grid, Edge* e, bool clearContainer = true);
502
503inline void CollectAssociated(std::vector<Volume*>& vVolumesOut,
504 Grid& grid, Edge* e, bool clearContainer = true);
508
515void CollectVolumes(std::vector<Volume*>& vVolumesOut, Grid& grid, Face* f, bool clearContainer = true, bool ignoreAssociatedVolumes = false);
516inline void CollectAssociated(std::vector<Volume*>& vVolumesOut,
517 Grid& grid, Face* f, bool clearContainer = true,
518 bool ignoreAssociatedVolumes = false);
519
520UG_API
521void CollectVolumes(std::vector<Volume*>& vVolumesOut, Grid& grid, FaceDescriptor& fd, bool clearContainer = true);
522inline void CollectAssociated(std::vector<Volume*>& vVolumesOut,
523 Grid& grid, FaceDescriptor& fd, bool clearContainer = true);
525
527UG_API
528void CollectVolumes(std::vector<Volume*>& vVolumesOut, Grid& grid, Volume* v, bool clearContainer = true);
529
531inline void CollectAssociated(std::vector<Volume*>& vVolumesOut,
532 Grid& grid, Volume* vol, bool clearContainer = true);
533
534
536// VolumeContains
539bool VolumeContains(VolumeVertices* v, Vertex* vrt);
540
543UG_API
544bool VolumeContains(Volume* v, EdgeVertices* ev);
545
548UG_API
549bool VolumeContains(Volume* v, FaceVertices* f);
550
551// end of group lib_grid_algorithms_neighborhood_util
553}// end of namespace libGrid
554
555// include template implementation
556#include "grid_util_impl.hpp"
557
558#endif
bool EdgeContains(EdgeVertices *e, Vertex *vrt)
Definition grid_util_impl.hpp:45
bool CompareVertices(const FaceVertices *fv1, const FaceVertices *fv2)
Checks whether fv1 and fv2 contain the same vertices.
Definition grid_util.cpp:44
bool FaceContains(Face *f, EdgeVertices *ev)
returns true if the given face contains the two given vertices
Definition grid_util.cpp:561
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 CollectEdgesSorted(vector< Edge * > &vEdgesOut, Grid &grid, Vertex *v, bool clearContainer)
Collects all edges of a vertex, thus, none.
Definition grid_util.cpp:205
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 CollectFacesSorted(vector< Face * > &vFacesOut, Grid &grid, Vertex *v, bool clearContainer)
Collects all Faces of a Vertex, thus, none.
Definition grid_util.cpp:401
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
void CollectVertices(std::vector< Vertex * > &vVertexOut, Grid &grid, Vertex *v, bool clearContainer)
Collects all vertices.
Definition grid_util.cpp:141
UG_API void CollectAssociated(std::vector< Vertex * > &vVertexOut, Grid &grid, GridObject *obj, bool clearContainer=true)
Definition grid_util_impl.hpp:169
UG_API bool CompareVertexContainer(const TVrtContainer1 &con1, const TVrtContainer2 &con2)
compares vertices in a container
Definition grid_util_impl.hpp:62
Vertex * GetVertex(Vertex *v, size_t i)
returns the i'th vertex of a vertex
Definition grid_util_impl.hpp:99
bool VolumeContains(VolumeVertices *v, Vertex *vrt)
returns true if the given volume contains the given vertex
Definition grid_util.cpp:748
size_t NumVertices(Vertex *elem)
Returns the number of vertices of the given geometric object.
Definition grid_util_impl.hpp:123
#define UG_API
Definition ug_config.h:65
the ug namespace
bool VertexGroupsMatch(const IVertexGroup *elem, const IVertexGroup &desc)
Checks whether two vertex groups contain the same vertices.
Definition grid_util.cpp:101