43 namespace NekMeshUtils
46 void TriangleInterface::Mesh(
bool Quiet,
bool Quality)
52 for (
int i = 0; i < m_boundingloops.size(); i++)
54 numSeg += m_boundingloops[i].size();
56 numPoints = numSeg + m_stienerpoints.size();
59 ss <<
"3 points required for triangulation, " << numPoints <<
" provided";
63 in.numberofpoints = numPoints;
64 in.numberofpointattributes = 0;
65 in.pointlist =
new REAL[in.numberofpoints * 2];
66 in.pointmarkerlist =
new int [in.numberofpoints];
70 for (
int i = 0; i < m_boundingloops.size(); i++)
72 for (
int j = 0; j < m_boundingloops[i].size(); j++, pointc++)
74 nodemap[pointc] = m_boundingloops[i][j];
77 m_boundingloops[i][j]->GetCADSurfInfo(sid);
78 in.pointlist[pointc * 2 + 0] = uv[0] * m_str;
79 in.pointlist[pointc * 2 + 1] = uv[1];
83 for (
int i = 0; i < m_stienerpoints.size(); i++, pointc++)
85 nodemap[pointc] = m_stienerpoints[i];
88 in.pointlist[pointc * 2 + 0] = uv[0] * m_str;
89 in.pointlist[pointc * 2 + 1] = uv[1];
92 in.numberofsegments = numSeg;
93 in.segmentlist =
new int[in.numberofsegments * 2];
95 for (
int i = 0; i < m_boundingloops.size(); i++, pointc++)
98 for (
int j = 0; j < m_boundingloops[i].size() - 1; j++, pointc++)
100 in.segmentlist[pointc * 2 + 0] = pointc;
101 in.segmentlist[pointc * 2 + 1] = pointc + 1;
103 in.segmentlist[pointc * 2 + 0] = pointc;
104 in.segmentlist[pointc * 2 + 1] = first;
107 in.numberofregions = 0;
108 in.numberofholes = m_centers.size() - 1;
109 in.holelist =
new REAL[in.numberofholes * 2];
111 for (
int i = 1; i < m_centers.size(); i++)
113 in.holelist[(i - 1) * 2 + 0] = m_centers[i][0] * m_str;
114 in.holelist[(i - 1) * 2 + 1] = m_centers[i][1];
117 if (Quiet && Quality)
119 triangulate(
"pzenqQYY", &in, &out, NULL);
121 else if (Quiet && !Quality)
123 triangulate(
"pzenYYQ", &in, &out, NULL);
125 else if (!Quiet && Quality)
127 triangulate(
"pzenqYY", &in, &out, NULL);
129 else if (!Quiet && !Quality)
131 triangulate(
"pzenYY", &in, &out, NULL);
135 if (out.numberofpoints - out.numberofedges + out.numberoftriangles !=
136 2 - m_centers.size())
138 cout << endl <<
"epc wrong" << endl;
139 cout << out.numberofpoints - out.numberofedges + out.numberoftriangles
140 <<
" " << m_centers.size() <<
" " << sid << endl;
144 void TriangleInterface::SetUp()
146 in.pointlist = (
REAL *)NULL;
147 in.pointattributelist = (
REAL *)NULL;
148 in.pointmarkerlist = (
int *)NULL;
149 in.numberofpoints = 0;
150 in.numberofpointattributes = 0;
152 in.trianglelist = (
int *)NULL;
153 in.triangleattributelist = (
REAL *)NULL;
154 in.trianglearealist = (
REAL *)NULL;
155 in.neighborlist = (
int *)NULL;
156 in.numberoftriangles = 0;
157 in.numberofcorners = 0;
158 in.numberoftriangleattributes = 0;
160 in.segmentlist = (
int *)NULL;
161 in.segmentmarkerlist = (
int *)NULL;
162 in.numberofsegments = 0;
164 in.holelist = (
REAL *)NULL;
165 in.numberofholes = 0;
167 in.regionlist = (
REAL *)NULL;
168 in.numberofregions = 0;
170 in.edgelist = (
int *)NULL;
171 in.edgemarkerlist = (
int *)NULL;
172 in.normlist = (
REAL *)NULL;
173 in.numberofedges = 0;
175 out.pointlist = (
REAL *)NULL;
176 out.pointattributelist = (
REAL *)NULL;
177 out.pointmarkerlist = (
int *)NULL;
178 out.numberofpoints = 0;
179 out.numberofpointattributes = 0;
181 out.trianglelist = (
int *)NULL;
182 out.triangleattributelist = (
REAL *)NULL;
183 out.trianglearealist = (
REAL *)NULL;
184 out.neighborlist = (
int *)NULL;
185 out.numberoftriangles = 0;
186 out.numberofcorners = 0;
187 out.numberoftriangleattributes = 0;
189 out.segmentlist = (
int *)NULL;
190 out.segmentmarkerlist = (
int *)NULL;
191 out.numberofsegments = 0;
193 out.holelist = (
REAL *)NULL;
194 out.numberofholes = 0;
196 out.regionlist = (
REAL *)NULL;
197 out.numberofregions = 0;
199 out.edgelist = (
int *)NULL;
200 out.edgemarkerlist = (
int *)NULL;
201 out.normlist = (
REAL *)NULL;
202 out.numberofedges = 0;
205 void TriangleInterface::Extract(
206 std::vector<std::vector<NodeSharedPtr> > &Connec)
209 for (
int i = 0; i < out.numberoftriangles; i++)
212 n1 = nodemap.find(out.trianglelist[i * 3 + 0]);
213 n2 = nodemap.find(out.trianglelist[i * 3 + 1]);
214 n3 = nodemap.find(out.trianglelist[i * 3 + 2]);
216 ASSERTL0(n1 != nodemap.end() && n2 != nodemap.end() &&
220 vector<NodeSharedPtr> tri(3);
224 Connec.push_back(tri);
#define ASSERTL0(condition, msg)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator