Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
simple_grid.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-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__REMESHING__SIMPLE_GRID__
34#define __H__REMESHING__SIMPLE_GRID__
35
36#include <vector>
37#include "lib_grid/lg_base.h"
38
39namespace ug
40{
41
43// SimpleGrid
45{
46 public:
47 void clear();
48 std::vector<vector3> vertices;
49 std::vector<vector3> vertexNormals;
50 std::vector<int> triangles;
51 std::vector<vector3> triangleNormals;
52};
53
55
57// ObtainSimpleGrid
59
80template <class TPosAcc, class TIntAcc, class TNormAcc>
81bool ObtainSimpleGrid(SimpleGrid& sgOut, Grid& grid,
82 Vertex* vrt1, Vertex* vrt2, size_t size,
83 TPosAcc& aaPos, TNormAcc& aaNorm,
84 TIntAcc& aaInt);
85
87// ObtainSimpleGrid
89
103template <class TPosAcc, class TIntAcc, class TNormAcc>
105 Edge* e, size_t size,
106 TPosAcc& aaPos, TNormAcc& aaNorm,
107 TIntAcc& aaInt);
108
111
114void CalculateTriangleNormal(SimpleGrid& sg, int triIndex);
115
119
120
121
124
129
132
134
137
138number ShapeQualityDegree(SimpleGrid& sg, int triIndex);
139
142
144
145
147
152bool SwapEdge(SimpleGrid& sg);
153
155
167
169
180bool CollapseEdge(SimpleGrid& sg);
181
182}// end of namespace
183
184
186// include implementation
187#include "simple_grid_impl.hpp"
188
189#endif
Base-class for edges.
Definition grid_base_objects.h:397
Manages the elements of a grid and their interconnection.
Definition grid.h:132
Definition simple_grid.h:45
std::vector< vector3 > vertices
Definition simple_grid.h:48
std::vector< int > triangles
Definition simple_grid.h:50
std::vector< vector3 > triangleNormals
Definition simple_grid.h:51
std::vector< vector3 > vertexNormals
Definition simple_grid.h:49
void clear()
Definition simple_grid.cpp:42
Base-class for all vertex-types.
Definition grid_base_objects.h:231
Edge * SwapEdge(Grid &grid, Edge *e)
swaps e and thus reconnects its two adjacent triangles.
Definition edge_util.cpp:793
TVertex * SplitEdge(Grid &grid, Edge *e, bool bConservative=false)
inserts new triangles and one new vertex by splitting the specified edge.
Definition edge_util_impl.hpp:89
bool CollapseEdge(Grid &grid, Edge *e, Vertex *newVrt)
Collapses the specified edge performs local grid restructuring.
Definition edge_util.cpp:403
double number
Definition types.h:124
number GeometricApproximationDegree(vector_t &n1, vector_t &n2, vector_t &n3, vector_t &tn)
the returned degree lies between 0 and 1. The closer to 1 the better.
Definition math_util_impl.hpp:932
void CalculateTriangleNormal(vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3)
Calculates a triangle-normal in 3d (output has length 1).
Definition math_vector_functions_common_impl.hpp:528
the ug namespace
void CalculateTriangleNormals(SimpleGrid &sg)
resizes sg.triangleNormals and calculates them
Definition simple_grid.cpp:90
bool ObtainSimpleGrid_CollapseEdge(SimpleGrid &sgOut, Grid &grid, Edge *e, size_t size, TPosAcc &aaPos, TNormAcc &aaNorm, TIntAcc &aaInt)
returns a neighbourhood of the edge e after e has been collapsed.
Definition simple_grid_impl.hpp:168
bool ObtainSimpleGrid(SimpleGrid &sgOut, Grid &grid, Vertex *vrt1, Vertex *vrt2, size_t size, TPosAcc &aaPos, TNormAcc &aaNorm, TIntAcc &aaInt)
returns a neighbourhood of the edge defined by vrt1 and vrt2 in a SimpleGrid.
Definition simple_grid_impl.hpp:45
void PrintSimpleGrid(SimpleGrid &sg)
Definition simple_grid.cpp:50
number ShapeQualityDegree(SimpleGrid &sg, int triIndex)
compares the area of the triangle to the length of its edges.
Definition simple_grid.cpp:125