Plugins
measure_tools.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2017: 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_measure_tools
34 #define __H__UG_measure_tools
35 
36 #include "../mesh.h"
38 
39 #define TOOLTIP_MEASURE_GRID_LENGTH "Measures the length of all edges of a grid"
40 #define TOOLTIP_MEASURE_GRID_AREA "Measures the area of all faces of a grid"
41 #define TOOLTIP_MEASURE_GRID_VOLUME "Measures the volume of all volume elements of a grid"
42 
43 #define TOOLTIP_MEASURE_SUBSET_LENGTH "Measures the length of all edges of the given subset"
44 #define TOOLTIP_MEASURE_SUBSET_AREA "Measures the area of all faces of the given subset"
45 #define TOOLTIP_MEASURE_SUBSET_VOLUME "Measures the volume of all volume elements of the given subset"
46 
47 #define TOOLTIP_MEASURE_SELECTION_LENGTH "Measures the length of all edges of the current selection"
48 #define TOOLTIP_MEASURE_SELECTION_AREA "Measures the area of all faces of the current selection"
49 #define TOOLTIP_MEASURE_SELECTION_VOLUME "Measures the volume of all volume elements of the current selection"
50 
51 #define TOOLTIP_PROJECTED_DISTANCE "Measures the distance of the projection of two selected vertices into the plane with the specified normal."
52 
53 namespace ug{
54 namespace promesh{
55 
59 {
60  return CalculateVolume(obj->grid().begin<Edge>(),
61  obj->grid().end<Edge>(),
62  obj->position_accessor());
63 }
64 
66 {
67  return CalculateVolume(obj->grid().begin<Face>(),
68  obj->grid().end<Face>(),
69  obj->position_accessor());
70 }
71 
73 {
74  return CalculateVolume(obj->grid().begin<Volume>(),
75  obj->grid().end<Volume>(),
76  obj->position_accessor());
77 }
78 
79 
80 
81 inline number MeasureSubsetLength(Mesh* obj, int subsetInd)
82 {
83  return CalculateVolume(obj->subset_handler().begin<Edge>(subsetInd),
84  obj->subset_handler().end<Edge>(subsetInd),
85  obj->position_accessor());
86 }
87 
88 inline number MeasureSubsetArea(Mesh* obj, int subsetInd)
89 {
90  return CalculateVolume(obj->subset_handler().begin<Face>(subsetInd),
91  obj->subset_handler().end<Face>(subsetInd),
92  obj->position_accessor());
93 }
94 
95 inline number MeasureSubsetVolume(Mesh* obj, int subsetInd)
96 {
97  return CalculateVolume(obj->subset_handler().begin<Volume>(subsetInd),
98  obj->subset_handler().end<Volume>(subsetInd),
99  obj->position_accessor());
100 }
101 
102 
103 
105 {
106  return CalculateVolume(obj->selector().begin<Edge>(),
107  obj->selector().end<Edge>(),
108  obj->position_accessor());
109 }
110 
112 {
113  return CalculateVolume(obj->selector().begin<Face>(),
114  obj->selector().end<Face>(),
115  obj->position_accessor());
116 }
117 
119 {
120  return CalculateVolume(obj->selector().begin<Volume>(),
121  obj->selector().end<Volume>(),
122  obj->position_accessor());
123 }
124 
125 number ProjectedDistance(Mesh* obj, const vector3& projectionNormal);
126 
128 }// end of namespace promesh
129 }// end of namespace ug
130 
131 #endif //__H__measure_tools
geometry_traits< TGeomObj >::iterator begin()
geometry_traits< TGeomObj >::iterator end()
geometry_traits< TElem >::iterator end(int subsetIndex)
geometry_traits< TElem >::iterator begin(int subsetIndex)
geometry_traits< TElem >::iterator end()
geometry_traits< TElem >::iterator begin()
Definition: mesh.h:73
position_accessor_t & position_accessor()
returns accessor to vertex positions
Definition: mesh.h:113
Grid & grid()
Definition: mesh.h:99
SubsetHandler & subset_handler()
Definition: mesh.h:100
Selector & selector()
Definition: mesh.h:102
number CalculateVolume(Volume *elem, TAAPos aaPos)
number MeasureSelectionVolume(Mesh *obj)
Definition: measure_tools.h:118
number ProjectedDistance(Mesh *obj, const vector3 &projectionNormal)
Definition: measure_tools.cpp:39
number MeasureSelectionLength(Mesh *obj)
Definition: measure_tools.h:104
number MeasureGridArea(Mesh *obj)
Definition: measure_tools.h:65
number MeasureSelectionArea(Mesh *obj)
Definition: measure_tools.h:111
number MeasureSubsetVolume(Mesh *obj, int subsetInd)
Definition: measure_tools.h:95
number MeasureSubsetLength(Mesh *obj, int subsetInd)
Definition: measure_tools.h:81
number MeasureGridLength(Mesh *obj)
Definition: measure_tools.h:58
number MeasureGridVolume(Mesh *obj)
Definition: measure_tools.h:72
number MeasureSubsetArea(Mesh *obj, int subsetInd)
Definition: measure_tools.h:88
double number