160 IT *outputConnectivityArray,
161 IT *outputOffsetArray,
164 const CT *inputPoints,
165 const IT *inputConnectivityArray,
166 const size_t &nInputPoints,
167 const size_t &nInputCells,
168 const DT *inputPointSizes,
170 const size_t &sizeAxis)
const {
174 this->
printMsg({{
"Mode",
"Quadratic Quads"},
175 {
"#Nodes", std::to_string(nInputPoints)},
176 {
"#Edges", std::to_string(nInputCells)}});
179 const size_t edgePointOffset = nInputPoints * 3;
194#ifdef TTK_ENABLE_OPENMP
195#pragma omp parallel for num_threads(threadNumber_)
197 for(
size_t i = 0; i < nInputPoints; i++) {
198 const CT *coord = &inputPoints[i * 3];
200 size_t const q = i * 9;
202 outputPoints[q] = coord[0];
203 outputPoints[q + 1] = coord[1];
204 outputPoints[q + 2] = coord[2];
207 outputPoints[q + 3] = coord[0];
208 outputPoints[q + 4] = coord[1];
209 outputPoints[q + 5] = coord[2];
212 outputPoints[q + 6] = coord[0];
213 outputPoints[q + 7] = coord[1];
214 outputPoints[q + 8] = coord[2];
216 const CT &size = ((CT)inputPointSizes[i]) * sizeScale;
219 outputPoints[q + 3 + sizeAxis] += size / 2;
220 outputPoints[q + 6 + sizeAxis] -= size / 2;
228 auto getMidPoint = [&](
const size_t &m,
const size_t &i,
const size_t &j) {
229 size_t const mp = m * 3;
230 size_t const ip = i * 3;
231 size_t const jp = j * 3;
232 for(
size_t k = 0; k < 3; k++)
234 = (outputPoints[ip + k] + outputPoints[jp + k]) / 2;
240 = [&](
const size_t &m,
const size_t &p0,
const size_t &p1) {
241 auto bezierPoint = [](CT &n,
const CT &q0,
const CT &q2) {
242 n = 0.5 * (0.5 * q0 + 0.5 * n) + 0.5 * (0.5 * n + 0.5 * q2);
245 size_t const mi = m * 3;
246 size_t const p0i = p0 * 3;
247 size_t const p1i = p1 * 3;
249 for(
size_t i = 0; i < 3; i++)
251 = (outputPoints[p0i + i] + outputPoints[p1i + i]) / 2;
252 outputPoints[mi + sizeAxis] = outputPoints[p0i + sizeAxis];
254 for(
size_t i = 0; i < 3; i++)
255 bezierPoint(outputPoints[mi + i], outputPoints[p0i + i],
256 outputPoints[p1i + i]);
260#ifdef TTK_ENABLE_OPENMP
261#pragma omp parallel for num_threads(threadNumber_)
263 for(
size_t i = 0; i < nInputCells; i++) {
265 size_t const aInputIndex = (size_t)inputConnectivityArray[temp++];
266 size_t const bInputIndex = (size_t)inputConnectivityArray[temp];
269 size_t const a = aInputIndex * 3;
270 size_t const a0 = a + 1;
271 size_t const a1 = a + 2;
272 size_t const b = bInputIndex * 3;
273 size_t const b0 = b + 1;
274 size_t const b1 = b + 2;
277 size_t const offset = edgePointOffset + i * 7;
278 size_t const m0 = offset;
279 size_t const m1 = offset + 1;
280 size_t const a0m0 = offset + 2;
281 size_t const m0b0 = offset + 3;
282 size_t const b1m1 = offset + 4;
283 size_t const m1a1 = offset + 5;
284 size_t const c = offset + 6;
286 getMidPoint(m0, a0, b0);
287 getMidPoint(m1, a1, b1);
289 getMidPoint(c, m0, m1);
291 getMidPoint2(a0m0, a0, m0);
292 getMidPoint2(m0b0, b0, m0);
294 getMidPoint2(b1m1, b1, m1);
295 getMidPoint2(m1a1, a1, m1);
300 "Computing mesh vertices", 1, t.
getElapsedTime(), this->threadNumber_);
310 IT edgePointOffset_ = (IT)edgePointOffset;
312#ifdef TTK_ENABLE_OPENMP
313#pragma omp parallel for num_threads(threadNumber_)
315 for(
size_t i = 0; i < nInputCells; i++) {
317 IT aInputIndex = inputConnectivityArray[temp++];
318 IT bInputIndex = inputConnectivityArray[temp];
321 IT a = aInputIndex * 3;
324 IT b = bInputIndex * 3;
329 IT offset = edgePointOffset_ + i_ * 7;
332 IT a0m0 = offset + 2;
333 IT m0b0 = offset + 3;
334 IT b1m1 = offset + 4;
335 IT m1a1 = offset + 5;
342 outputConnectivityArray[q++] = a0;
343 outputConnectivityArray[q++] = m0;
344 outputConnectivityArray[q++] = m1;
345 outputConnectivityArray[q++] = a1;
347 outputConnectivityArray[q++] = a0m0;
348 outputConnectivityArray[q++] = c;
349 outputConnectivityArray[q++] = m1a1;
350 outputConnectivityArray[q++] = a;
353 outputConnectivityArray[q++] = m0;
354 outputConnectivityArray[q++] = b0;
355 outputConnectivityArray[q++] = b1;
356 outputConnectivityArray[q++] = m1;
358 outputConnectivityArray[q++] = m0b0;
359 outputConnectivityArray[q++] = b;
360 outputConnectivityArray[q++] = b1m1;
361 outputConnectivityArray[q++] = c;
364 for(
size_t i = 0; i <= 2 * nInputCells; i++) {
365 outputOffsetArray[i] = i * 8;
369 "Computing mesh cells", 1, t.
getElapsedTime(), this->threadNumber_);
382 IT *outputConnectivityArray,
383 IT *outputOffsetArray,
386 const CT *inputPoints,
387 const IT *inputConnectivityArray,
388 const size_t nInputPoints,
389 const size_t nInputCells,
390 const size_t nSubdivisions,
391 const DT *inputPointSizes,
393 const size_t sizeAxis)
const {
396 this->
printMsg({{
"Mode",
"Linear Polygon"},
397 {
"#Nodes", std::to_string(nInputPoints)},
398 {
"#Edges", std::to_string(nInputCells)},
399 {
"#Subdivisions", std::to_string(nSubdivisions)}});
402 size_t const subdivisionOffset = nInputPoints * 2;
403 size_t const nSubdivisionPoints = nSubdivisions * 2;
404 size_t const outputPointsSubdivisonOffset = nSubdivisionPoints * 3;
420#ifdef TTK_ENABLE_OPENMP
421#pragma omp parallel for num_threads(threadNumber_)
423 for(
size_t i = 0; i < nInputPoints; i++) {
424 const CT *coords = &inputPoints[i * 3];
426 size_t const q = i * 6;
427 outputPoints[q] = coords[0];
428 outputPoints[q + 1] = coords[1];
429 outputPoints[q + 2] = coords[2];
431 outputPoints[q + 3] = coords[0];
432 outputPoints[q + 4] = coords[1];
433 outputPoints[q + 5] = coords[2];
435 const CT &size = ((CT)inputPointSizes[i]) * sizeScale;
437 outputPoints[q + sizeAxis] += size / 2;
438 outputPoints[q + 3 + sizeAxis] -= size / 2;
444 size_t const q = subdivisionOffset * 3;
445 float const nSubdivisionsP1 = nSubdivisions + 1;
447 auto computeBezierPoint = [&](
const size_t &no0,
const size_t &no1,
448 const size_t &subdOffset,
449 const float lambda) {
450 float const lambdaI = 1 - lambda;
452 float const lambda_2 = lambda * lambda;
453 float const lambda_3 = lambda * lambda_2;
455 float const lambdaI_2 = lambdaI * lambdaI;
456 float const lambdaI_3 = lambdaI * lambdaI_2;
460 for(
size_t i = 0; i < 3; i++) {
461 m0[i] = (outputPoints[no0 + i] + outputPoints[no1 + i]) / 2;
464 m0[sizeAxis] = outputPoints[no0 + sizeAxis];
465 m1[sizeAxis] = outputPoints[no1 + sizeAxis];
467 for(
size_t i = 0; i < 3; i++)
468 outputPoints[subdOffset + i]
469 = lambdaI_3 * outputPoints[no0 + i] + 3 * lambdaI_2 * lambda * m0[i]
470 + 3 * lambdaI * lambda_2 * m1[i] + lambda_3 * outputPoints[no1 + i];
473#ifdef TTK_ENABLE_OPENMP
474#pragma omp parallel for num_threads(threadNumber_)
476 for(
size_t i = 0; i < nInputCells; i++) {
478 IT n0 = inputConnectivityArray[temp++];
479 IT n1 = inputConnectivityArray[temp];
484 size_t q2 = q + i * outputPointsSubdivisonOffset;
485 for(
size_t j = 1; j <= nSubdivisions; j++) {
486 computeBezierPoint(no0, no1, q2, j / nSubdivisionsP1);
487 computeBezierPoint(no0 + 3, no1 + 3, q2 + 3, j / nSubdivisionsP1);
494 "Computing mesh vertices", 1, t.
getElapsedTime(), this->threadNumber_);
504 size_t const cellSize = this->computeOutputCellSize(nSubdivisions);
506#ifdef TTK_ENABLE_OPENMP
507#pragma omp parallel for num_threads(threadNumber_)
509 for(
size_t i = 0; i < nInputCells; i++) {
511 IT in0 = inputConnectivityArray[q++] * 2;
512 IT in1 = inputConnectivityArray[q] * 2;
519 size_t q2 = cellSize * i;
521 outputConnectivityArray[q2++] = c0;
522 outputConnectivityArray[q2++] = c1;
524 IT temp = subdivisionOffset + i * nSubdivisionPoints;
526 for(
size_t j = 0; j < nSubdivisions; j++)
527 outputConnectivityArray[q2++] = temp + j * 2 + 1;
529 outputConnectivityArray[q2++] = c2;
530 outputConnectivityArray[q2++] = c3;
532 for(
int j = nSubdivisions - 1; j >= 0; j--)
533 outputConnectivityArray[q2++] = temp + j * 2;
536 for(
size_t i = 0; i <= nInputCells; i++)
537 outputOffsetArray[i] = i * cellSize;
540 "Computing mesh cells", 1, t.
getElapsedTime(), this->threadNumber_);
553 const size_t &nInputPoints,
554 const size_t &nInputCells,
555 const IT *inputConnectivityArray,
556 const DT *inputPointData,
557 const bool &useQuadraticCells,
558 const size_t &nSubdivisions)
const {
560 if(useQuadraticCells) {
561#ifdef TTK_ENABLE_OPENMP
562#pragma omp parallel for num_threads(threadNumber_)
564 for(
size_t i = 0; i < nInputPoints; i++) {
565 size_t const q = i * 3;
567 outputPointData[q] = inputPointData[i];
568 outputPointData[q + 1] = inputPointData[i];
569 outputPointData[q + 2] = inputPointData[i];
572 size_t const edgePointOffset = nInputPoints * 3;
575#ifdef TTK_ENABLE_OPENMP
576#pragma omp parallel for num_threads(threadNumber_)
578 for(
size_t i = 0; i < nInputCells; i++) {
580 size_t const aInputIndex = (size_t)inputConnectivityArray[temp++];
581 size_t const bInputIndex = (size_t)inputConnectivityArray[temp];
583 size_t const a = aInputIndex * 3;
584 size_t const b = bInputIndex * 3;
586 size_t const offset = edgePointOffset + i * 7;
587 size_t const m0 = offset;
588 size_t const m1 = offset + 1;
589 size_t const a0m0 = offset + 2;
590 size_t const m0b0 = offset + 3;
591 size_t const b1m1 = offset + 4;
592 size_t const m1a1 = offset + 5;
593 size_t const c = offset + 6;
595 outputPointData[c] = (DT)((outputPointData[a] + outputPointData[b]) / 2);
596 outputPointData[m0] = outputPointData[c];
597 outputPointData[m1] = outputPointData[c];
599 outputPointData[a0m0]
600 = (DT)((outputPointData[a] + outputPointData[c]) / 2);
601 outputPointData[m1a1] = outputPointData[a0m0];
603 outputPointData[m0b0]
604 = (DT)((outputPointData[c] + outputPointData[b]) / 2);
605 outputPointData[b1m1] = outputPointData[m0b0];
610#ifdef TTK_ENABLE_OPENMP
611#pragma omp parallel for num_threads(threadNumber_)
613 for(
size_t i = 0; i < nInputPoints; i++) {
614 size_t const offset = i * 2;
615 auto &v = inputPointData[i];
616 outputPointData[offset] = v;
617 outputPointData[offset + 1] = v;
621 size_t const subdivisionOffset = nInputPoints * 2;
622 size_t const nSubdivisionPoints = nSubdivisions * 2;
624#ifdef TTK_ENABLE_OPENMP
625#pragma omp parallel for num_threads(threadNumber_)
627 for(
size_t i = 0; i < nInputCells; i++) {
628 size_t const q = i * 2;
629 IT c0 = inputConnectivityArray[q];
630 DT c0V = inputPointData[c0];
632 size_t const temp = subdivisionOffset + i * nSubdivisionPoints;
633 for(
size_t j = 0; j < nSubdivisions; j++) {
634 size_t const q2 = temp + j * 2;
635 outputPointData[q2] = c0V;
636 outputPointData[q2 + 1] = c0V;
int execute(CT *outputPoints, IT *outputConnectivityArray, IT *outputOffsetArray, const CT *inputPoints, const IT *inputConnectivityArray, const size_t &nInputPoints, const size_t &nInputCells, const DT *inputPointSizes, const CT &sizeScale, const size_t &sizeAxis) const
int execute2(CT *outputPoints, IT *outputConnectivityArray, IT *outputOffsetArray, const CT *inputPoints, const IT *inputConnectivityArray, const size_t nInputPoints, const size_t nInputCells, const size_t nSubdivisions, const DT *inputPointSizes, const CT sizeScale, const size_t sizeAxis) const