6 #include "GmshConfig.h"
28 {
GMSH_FULLRC,
"Filename",
nullptr,
"Angles_Surface"},
41 return "Plugin(BoundaryAngles) computes the (interior) angles between the "
42 "line elements on the boundary of all surfaces. The angles, computed "
43 "modulo 2*Pi, are stored in a new post-processing view, one for each "
44 "surface. The plugin currently only works for planar surfaces."
46 "- Visible (1=True, 0 = False, Default = 1): Visibility of the Views "
48 "- Save (1=True, 0 = False, Default = 0): Save the Views on disk ?"
49 "- Remove (1=True, 0 = False, Default = 0): Remove the View from the "
50 "memory after execution?"
51 "- Filename (Default = 'Angles_Surface'): Root name for the Views (in "
52 "case of save / Visibility)"
53 "- Dir (Default = ''): Output directory (possibly nested)";
78 const std::pair<MEdge, MElement *> &e2)
const
81 return le(e1.first, e2.first);
96 std::set<std::pair<MEdge, MElement *>,
Less_EdgeEle> boundaryEdges;
100 std::pair<MEdge, MElement *> ed(e->
getEdge(j), e);
101 auto it = boundaryEdges.find(ed);
102 if(it == boundaryEdges.end()) { boundaryEdges.insert(ed); }
104 boundaryEdges.erase(it);
108 if(boundaryEdges.empty())
continue;
112 std::vector<MEdge>
edges;
114 for(
auto it = boundaryEdges.begin(); it != boundaryEdges.end(); ++it) {
115 edges.push_back(it->first);
116 if(it == boundaryEdges.begin()) normal = it->second->getFace(0).normal();
118 std::vector<std::vector<MVertex *> > nodes;
120 if(nodes.size() != 1) {
Msg::Warning(
"Non connected boundary!"); }
127 auto it2 = boundaryEdges.begin();
129 for(
int j = 0; j < static_cast<int>(nodes[0].size()) - 1; j++) {
131 if(nodes[0][j]->getNum() == it2->first.getVertex(0)->getNum()) {
133 if(nodes[0][j + 1]->getNum() !=
134 it2->first.getVertex(1)->getNum()) {
135 std::reverse(nodes[0].begin(), nodes[0].end());
142 nodes[0].push_back(nodes[0][1]);
144 for(std::size_t i = 0; i < nodes[0].size() - 2; i++) {
145 SPoint3 p1 = nodes[0][i]->point();
146 SPoint3 p2 = nodes[0][i + 1]->point();
147 SPoint3 p3 = nodes[0][i + 2]->point();
151 data->
SP.push_back(p2.
x());
152 data->
SP.push_back(p2.
y());
153 data->
SP.push_back(p2.
z());
155 if(a > 0) a = -(2 * M_PI - a);
156 data->
SP.push_back(a);
162 std::string currentDir =
173 if(opt_dir[opt_dir.length() - 1] != slash) opt_dir.push_back(slash);
174 std::string outputdir = currentDir + opt_dir;
179 sprintf(viewname,
"%s_%d", rootname.c_str(), gf->
tag());
180 sprintf(filename,
"%s%s_%d.pos", outputdir.c_str(), rootname.c_str(),
182 data->
Time.push_back(0.);
187 if(saveOnDisk) view->
write(filename, 0,
false);
188 if(removeView)
delete view;