43 namespace NekMeshUtils
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 dt.in.numberofpoints = numPoints;
64 dt.in.numberofpointattributes = 0;
65 dt.in.pointlist =
new double[dt.in.numberofpoints * 2];
66 dt.in.pointmarkerlist =
new int [dt.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 dt.in.pointlist[pointc * 2 + 0] = uv[0] * m_str;
79 dt.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 dt.in.pointlist[pointc * 2 + 0] = uv[0] * m_str;
89 dt.in.pointlist[pointc * 2 + 1] = uv[1];
92 dt.in.numberofsegments = numSeg;
93 dt.in.segmentlist =
new int[dt.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 dt.in.segmentlist[pointc * 2 + 0] = pointc;
101 dt.in.segmentlist[pointc * 2 + 1] = pointc + 1;
103 dt.in.segmentlist[pointc * 2 + 0] = pointc;
104 dt.in.segmentlist[pointc * 2 + 1] = first;
107 dt.in.numberofregions = 0;
108 dt.in.numberofholes = m_centers.size() - 1;
109 dt.in.holelist =
new double[dt.in.numberofholes * 2];
111 for (
int i = 1; i < m_centers.size(); i++)
113 dt.in.holelist[(i - 1) * 2 + 0] = m_centers[i][0] * m_str;
114 dt.in.holelist[(i - 1) * 2 + 1] = m_centers[i][1];
126 char *cstr =
new char[cmd.length() + 1];
127 strcpy(cstr, cmd.c_str());
129 dt.triangulate(cstr);
132 void TriangleInterface::SetUp()
134 dt.in.pointlist = (
double *)NULL;
135 dt.in.pointattributelist = (
double *)NULL;
136 dt.in.pointmarkerlist = (
int *)NULL;
137 dt.in.numberofpoints = 0;
138 dt.in.numberofpointattributes = 0;
140 dt.in.trianglelist = (
int *)NULL;
141 dt.in.triangleattributelist = (
double *)NULL;
142 dt.in.trianglearealist = (
double *)NULL;
143 dt.in.neighborlist = (
int *)NULL;
144 dt.in.numberoftriangles = 0;
145 dt.in.numberofcorners = 0;
146 dt.in.numberoftriangleattributes = 0;
148 dt.in.segmentlist = (
int *)NULL;
149 dt.in.segmentmarkerlist = (
int *)NULL;
150 dt.in.numberofsegments = 0;
152 dt.in.holelist = (
double *)NULL;
153 dt.in.numberofholes = 0;
155 dt.in.regionlist = (
double *)NULL;
156 dt.in.numberofregions = 0;
158 dt.in.edgelist = (
int *)NULL;
159 dt.in.edgemarkerlist = (
int *)NULL;
160 dt.in.normlist = (
double *)NULL;
161 dt.in.numberofedges = 0;
163 dt.out.pointlist = (
double *)NULL;
164 dt.out.pointattributelist = (
double *)NULL;
165 dt.out.pointmarkerlist = (
int *)NULL;
166 dt.out.numberofpoints = 0;
167 dt.out.numberofpointattributes = 0;
169 dt.out.trianglelist = (
int *)NULL;
170 dt.out.triangleattributelist = (
double *)NULL;
171 dt.out.trianglearealist = (
double *)NULL;
172 dt.out.neighborlist = (
int *)NULL;
173 dt.out.numberoftriangles = 0;
174 dt.out.numberofcorners = 0;
175 dt.out.numberoftriangleattributes = 0;
177 dt.out.segmentlist = (
int *)NULL;
178 dt.out.segmentmarkerlist = (
int *)NULL;
179 dt.out.numberofsegments = 0;
181 dt.out.holelist = (
double *)NULL;
182 dt.out.numberofholes = 0;
184 dt.out.regionlist = (
double *)NULL;
185 dt.out.numberofregions = 0;
187 dt.out.edgelist = (
int *)NULL;
188 dt.out.edgemarkerlist = (
int *)NULL;
189 dt.out.normlist = (
double *)NULL;
190 dt.out.numberofedges = 0;
193 void TriangleInterface::Extract(
194 std::vector<std::vector<NodeSharedPtr> > &Connec)
197 for (
int i = 0; i < dt.out.numberoftriangles; i++)
200 n1 = nodemap.find(dt.out.trianglelist[i * 3 + 0]);
201 n2 = nodemap.find(dt.out.trianglelist[i * 3 + 1]);
202 n3 = nodemap.find(dt.out.trianglelist[i * 3 + 2]);
204 ASSERTL0(n1 != nodemap.end() && n2 != nodemap.end() &&
208 vector<NodeSharedPtr> tri(3);
212 Connec.push_back(tri);
#define ASSERTL0(condition, msg)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator