Plugins
subset_tools.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-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_PROMESH__subset_tools__
34 #define __H__UG_PROMESH__subset_tools__
35 
36 #include <vector>
37 #include <queue>
38 #include "../mesh.h"
41 
42 #define TOOLTIP_SET_SUBSET_NAME ""
43 #define TOOLTIP_ASSIGN_SUBSET "Assigns the selected elements to a subset."
44 #define TOOLTIP_ASSIGN_NEW_SUBSET "Assigns selected elements to a new subset."
45 #define TOOLTIP_UNASSIGN_SUBSETS "Unassigns selected elements from any subset."
46 #define TOOLTIP_ASSIGN_SUBSET_COLORS "assigns subset colors by a procedural scheme."
47 #define TOOLTIP_SEPARATE_FACES_BY_EDGE_SUBSETS "Assigns faces that are surrounded by a set of edge-subsets to a common subset."
48 #define TOOLTIP_SEPARATE_FACES_BY_SELECTED_EDGES "Assigns faces that are surrounded by a set of selected edges to a common subset."
49 #define TOOLTIP_SEPARATE_VOLUMES_BY_FACE_SUBSETS "Assigns volumes that are surrounded by a set of face-subsets to a common subset."
50 #define TOOLTIP_SEPARATE_VOLUMES_BY_SELECTED_FACES "Assigns volumes that are surrounded by a set of selected faces to a common subset."
51 #define TOOLTIP_SEPARATE_IRREGULAR_MANIFOLD_SUBSETS "After this algorithm all face-subsets are regular manifolds."
52 #define TOOLTIP_MOVE_SUBSET "Moves a subset to another index."
53 #define TOOLTIP_SWAP_SUBSETS "Swaps two subsets"
54 #define TOOLTIP_JOIN_SUBSETS "Joins two subsets"
55 #define TOOLTIP_ERASE_SUBSET "Erases a subset, but not its associated geometry."
56 #define TOOLTIP_ERASE_EMPTY_SUBSETS "Erases Subsets, which do not contain any elements at all."
57 #define TOOLTIP_ADJUST_SUBSETS_FOR_UG3 "Assigns face and edge indices so that the geometry can be used with ug3."
58 #define TOOLTIP_ADJUST_SUBSETS_FOR_UG4 "Adjusts subsets for simulation with ug4."
59 #define TOOLTIP_SEPARATE_FACE_SUBSETS_BY_NORMAL "Collects faces of each subset that have a similar normal and assigns them to new subsets."
60 #define TOOLTIP_SEPARATE_FACE_SUBSET_BY_NORMAL "Collects faces of a given subset that have a similar normal and assigns them to new subsets."
61 #define TOOLTIP_ASSIGN_SUBSETS_BY_QUALITY "Assigns the selected to a subset depending on their quality."
62 #define TOOLTIP_SEPARATE_DEGENERATED_BOUNDARY_FACE_SUBSETS "Separates degenerated boundary face subsets at sharp creases."
63 #define TOOLTIP_COPY_SUBSET_INDICES_TO_SIDES "Copies subset indices of selected elements to sides of those elements."
64 #define TOOLTIP_ASSIGN_SUBSETS_BY_ELEMENT_TYPE "Assigns elemets to subsets based on their concrete type."
65 #define TOOLTIP_ASSIGN_SUBSETS_BY_ASPECT_RATIO "Assigns subsets according to an aspect ratio histogram"
66 #define TOOLTIP_ASSIGN_SUBSETS_FROM_RASTER "Assigns the subset index for each element from the raster-cell in which the center of the element lies."
67 
68 namespace ug{
69 namespace promesh{
70 
73 
74 void AssignSubset(Mesh* obj, int newIndex);
75 
76 void AssignSubset(
77  Mesh* obj,
78  int newIndex,
79  bool vertices,
80  bool edges,
81  bool faces,
82  bool volumes);
83 
84 void AssignNewSubset(
85  Mesh* obj,
86  const char* name,
87  bool vertices,
88  bool edges,
89  bool faces,
90  bool volumes);
91 
92 void UnassignSubsets(
93  Mesh* obj,
94  bool vertices,
95  bool edges,
96  bool faces,
97  bool volumes);
98 
99 void SetSubsetName(Mesh* obj, int si, const char* name);
100 
101 void AssignSubsetColors(Mesh* obj);
102 
103 void SeparateFacesByEdgeSubsets(Mesh* obj);
104 
105 void SeparateFacesBySelectedEdges(Mesh* obj);
106 
107 void SeparateVolumesByFaceSubsets(Mesh* obj);
108 
109 void SeparateVolumesBySelectedFaces(Mesh* obj);
110 
111 void SeparateIrregularManifoldSubsets(Mesh* obj);
112 
113 void MoveSubset(Mesh* obj, int oldIndex, int newIndex);
114 
115 void SwapSubsets(Mesh* obj, int oldIndex, int newIndex);
116 
117 void JoinSubsets(Mesh* obj, int target, int si1, int si2, bool eraseUnused);
118 
119 void EraseSubset(Mesh* obj, int si, bool eraseGeometry);
120 
121 void EraseEmptySubsets(Mesh* obj);
122 
123 void AdjustSubsetsForUG3(Mesh* obj, bool keepIntfSubs);
124 
125 void AdjustSubsetsForUG4(Mesh* obj, bool preserveExistingSubsets);
126 
127 void SeparateFaceSubsetsByNormal(Mesh* obj);
128 
129 void SeparateFaceSubsetByNormal(Mesh* obj, int si);
130 
131 void AssignSubsetsByQuality(Mesh* obj, int numSections);
132 
133 void SeparateDegeneratedBoundaryFaceSubsets(Mesh* obj, number angle);
134 
135 void AssignSubsetsByElementType(Mesh* obj);
136 
138  Mesh* obj,
139  bool selectionOnly,
140  bool toUnassignedOnly);
141 
142 template <class elem_t>
144  Mesh* msh,
145  int numHistoSecs,
146  bool eraseOldSubsets);
147 
149  Mesh* obj,
150  const char* rasterFileName,
151  int rasterDimension,
152  bool vertices,
153  bool edges,
154  bool faces,
155  bool volumes);
157 
158 }}// end of namespace
159 
160 #endif
void SeparateFaceSubsetsByNormal(Mesh *obj)
Definition: subset_tools.cpp:222
void MoveSubset(Mesh *obj, int oldIndex, int newIndex)
Definition: subset_tools.cpp:159
void JoinSubsets(Mesh *obj, int target, int si1, int si2, bool eraseUnused)
Definition: subset_tools.cpp:177
void AssignSubsetColors(Mesh *obj)
Definition: subset_tools.cpp:115
void AssignSubsetsByAspectRatio(Mesh *msh, int numHistoSecs, bool eraseOldSubsets)
Definition: subset_tools.cpp:438
void SeparateVolumesBySelectedFaces(Mesh *obj)
Definition: subset_tools.cpp:142
void SeparateFaceSubsetByNormal(Mesh *obj, int si)
Definition: subset_tools.cpp:227
void AssignSubsetsFromRaster(Mesh *obj, const char *rasterFileName, int rasterDimension, bool vertices, bool edges, bool faces, bool volumes)
Definition: subset_tools.cpp:553
void AdjustSubsetsForUG4(Mesh *obj, bool preserveExistingSubsets)
Definition: subset_tools.cpp:217
void SetSubsetName(Mesh *obj, int si, const char *name)
Definition: subset_tools.cpp:109
void AssignSubset(Mesh *obj, int newIndex)
Definition: subset_tools.cpp:42
void SeparateVolumesByFaceSubsets(Mesh *obj)
Definition: subset_tools.cpp:135
void EraseEmptySubsets(Mesh *obj)
Definition: subset_tools.cpp:200
void SeparateDegeneratedBoundaryFaceSubsets(Mesh *obj, number angle)
Definition: subset_tools.cpp:270
void AssignSubsetsByQuality(Mesh *obj, int numSections)
Definition: subset_tools.cpp:234
void SeparateIrregularManifoldSubsets(Mesh *obj)
Definition: subset_tools.cpp:150
void SeparateFacesBySelectedEdges(Mesh *obj)
Definition: subset_tools.cpp:127
void SwapSubsets(Mesh *obj, int oldIndex, int newIndex)
Definition: subset_tools.cpp:167
void CopySubsetIndicesToSides(Mesh *obj, bool selectionOnly, bool toUnassignedOnly)
Definition: subset_tools.cpp:420
void SeparateFacesByEdgeSubsets(Mesh *obj)
Definition: subset_tools.cpp:120
void AssignSubsetsByElementType(Mesh *obj)
Definition: subset_tools.cpp:407
void UnassignSubsets(Mesh *obj, bool vertices, bool edges, bool faces, bool volumes)
Definition: subset_tools.cpp:99
void EraseSubset(Mesh *obj, int si, bool eraseGeometry)
Definition: subset_tools.cpp:183
void AssignNewSubset(Mesh *obj, const char *name, bool vertices, bool edges, bool faces, bool volumes)
Definition: subset_tools.cpp:72
void AdjustSubsetsForUG3(Mesh *obj, bool keepIntfSubs)
Definition: subset_tools.cpp:212
double number
std::pair< counting_iterator< size_t >, counting_iterator< size_t > > vertices(ug::BidirectionalMatrix< T > const &M)
size_t target(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &m)