1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
|
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
#include "vtkCutter.h"
#include "vtkDataArray.h"
#include "vtkDummyController.h"
#include "vtkHyperTreeGridPreConfiguredSource.h"
#include "vtkLineSource.h"
#include "vtkLogger.h"
#include "vtkMPIController.h"
#include "vtkMath.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkMultiProcessController.h"
#include "vtkNew.h"
#include "vtkPartitionedDataSet.h"
#include "vtkPlane.h"
#include "vtkPointData.h"
#include "vtkPointDataToCellData.h"
#include "vtkPolyData.h"
#include "vtkProbeLineFilter.h"
#include "vtkRTAnalyticSource.h"
#include <algorithm>
#include <array>
static constexpr std::array<double, 40> ProbingAtCellBoundaries = { 10.3309, 10.3309, 1.68499,
1.68499, -8.10485, -8.10485, 3.09254, 3.09254, 26.3884, 26.3884, 49.8718, 49.8718, 77.2904,
77.2904, 136.737, 136.737, 211.899, 211.899, 255.795, 255.795, 236.429, 236.429, 192.787, 192.787,
150.466, 150.466, 101.16, 101.16, 36.8801, 36.8801, 3.09331, 3.09331, 10.6523, 10.6523, 18.0772,
18.0772, -3.63279, -3.63279, -15.5258, -15.5258 };
static constexpr std::array<double, 22> ProbingAtSegmentCenters = { 10.3309, 10.3309, 1.68499,
-8.10485, 3.09254, 26.3884, 49.8718, 77.2904, 136.737, 211.899, 255.795, 236.429, 192.787,
150.466, 101.16, 36.8801, 3.09331, 10.6523, 18.0772, -3.63279, -15.5258, -15.5258 };
static constexpr std::array<double, 11> ProbingUniformly = { 10.3309, -8.10485, 26.3884, 77.2904,
211.899, 236.429, 150.466, 36.8801, 10.6523, -3.63279, -15.5258 };
static constexpr std::array<double, 40> ProbingAtCellBoundaries_2D = { 0, 0.9999, 0.9999, 2, 2, 3,
3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17,
17, 18, 18, 19.0001, 19.0001, 19.1 };
static const std::array<double, 22> ProbingAtSegmentCenters_2D = { 0, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5,
6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.05, 19.1 };
static constexpr double eps = 1e-6;
// ----------------------------------------------------------------------------
int CheckForErrors(vtkPolyData* pd, const double* expected, vtkIdType size, const char* arrayName,
const char* samplingName, int rank)
{
// Ignore rank != 0 as all results are passed to rank 0
if (rank != 0)
{
return EXIT_SUCCESS;
}
if (pd == nullptr)
{
vtkLog(ERROR, << "Wrong output type");
return EXIT_FAILURE;
}
vtkDataArray* result = pd->GetPointData()->GetArray(arrayName);
if (!result)
{
vtkLog(ERROR, << samplingName << ": missing '" << arrayName << "' data array");
return EXIT_FAILURE;
}
vtkIdType minsize = std::min(size, result->GetNumberOfTuples());
int code = EXIT_SUCCESS;
if (result->GetNumberOfValues() != size)
{
vtkLog(ERROR, << samplingName
<< ": result and expected result does not have the same size (resp. "
<< result->GetNumberOfValues() << " vs " << size << " values).");
code = EXIT_FAILURE;
}
for (vtkIdType pointId = 0; pointId < minsize; ++pointId)
{
if (std::fabs(result->GetTuple1(pointId) - expected[pointId]) > 0.001)
{
vtkLog(ERROR, << samplingName << "'s wrong starting: " << pointId);
code = EXIT_FAILURE;
break;
}
}
if (code == EXIT_FAILURE)
{
std::cerr << "Expected: [ ";
for (vtkIdType i = 0; i < size; ++i)
std::cerr << expected[i] << " ";
std::cerr << "]" << std::endl;
std::cerr << "But got : [ ";
for (vtkIdType i = 0; i < result->GetNumberOfValues(); ++i)
std::cerr << result->GetTuple1(i) << " ";
std::cerr << "]" << std::endl;
}
return code;
}
// ----------------------------------------------------------------------------
int Check2DHTG(vtkMultiProcessController* contr, vtkDataSet* outDataSet)
{
int numPoints = outDataSet->GetNumberOfPoints();
vtkDataArray* da = outDataSet->GetPointData()->GetArray("Depth");
int retVal = EXIT_SUCCESS;
if (contr->GetLocalProcessId() == 0)
{
for (int i = 0; i < numPoints; i++)
{
std::array<double, 3> pt{ 0.0, 0.0, 0.0 };
outDataSet->GetPoint(i, pt.data());
int foundDepth = -1;
bool isDemarcation = false;
if (std::abs(pt[0]) < 1.0 && std::abs(pt[1]) < 1.0)
{
foundDepth = 0.0;
}
else if ((std::abs(pt[0]) - 1.0) < eps && (std::abs(pt[1]) - 1.0) < eps)
{
foundDepth = 0.0;
if (vtkMath::IsNan(da->GetComponent(i, 0)))
{
continue;
}
}
for (int d = 0; d < 4; d++) // iterate over levels
{
double demarcation = 0.5 / std::pow(2, d);
if (std::abs(pt[0]) < demarcation && std::abs(pt[1]) < demarcation)
{
foundDepth = d;
continue;
}
else if ((std::abs(pt[0]) - demarcation) < eps && (std::abs(pt[1]) - demarcation) < eps)
{
isDemarcation = true;
}
else
{
break;
}
}
/*
* Check here if the depth array has the correct value computed above specifically for this
* HTG Slight indetermination due to the INTERSECT_WITH_CELLS mode for points which are
* exactly in between two depth zones. The second part of the check takes care of that.
*/
if (!((foundDepth - da->GetComponent(i, 0) < 1) ||
(isDemarcation && ((foundDepth - da->GetComponent(i, 0) + 1) < 1))))
{
vtkLog(ERROR, << "Probe Line on HTG 2D failed for point " << pt[0] << ", " << pt[1]
<< " with depth " << da->GetComponent(i, 0) << " when it should be "
<< foundDepth);
retVal = EXIT_FAILURE;
break;
}
}
}
return retVal;
}
// ----------------------------------------------------------------------------
int Check3DHTG(vtkMultiProcessController* contr, vtkDataSet* outDataSet)
{
int numPoints = outDataSet->GetNumberOfPoints();
vtkDataArray* da = outDataSet->GetPointData()->GetArray("Depth");
int retVal = EXIT_SUCCESS;
if (contr->GetLocalProcessId() == 0)
{
for (int i = 0; i < numPoints; i++)
{
std::array<double, 3> pt{ 0.0, 0.0, 0.0 };
outDataSet->GetPoint(i, pt.data());
int foundDepth = -1;
bool isDemarcation = false;
if (std::abs(pt[0]) < 1.0 && std::abs(pt[1]) < 1.0 && std::abs(pt[2]))
{
foundDepth = 0;
}
else if ((std::abs(pt[0]) - 1.0) < eps && (std::abs(pt[1]) - 1.0) < eps &&
(std::abs(pt[2]) - 1.0) < eps)
{
foundDepth = 0;
if (vtkMath::IsNan(da->GetComponent(i, 0)))
{
continue;
}
}
for (int d = 0; d < 4; d++) // iterate over levels
{
double demarcation = 0.5 / std::pow(2, d);
if (std::abs(pt[0]) < demarcation && std::abs(pt[1]) < demarcation &&
std::abs(pt[2]) < demarcation)
{
foundDepth = d;
continue;
}
else if ((std::abs(pt[0]) - demarcation) < eps && (std::abs(pt[1]) - demarcation) < eps &&
(std::abs(pt[2]) - demarcation) < eps)
{
isDemarcation = true;
foundDepth = d;
continue;
}
else
{
break;
}
}
/*
* Check here if the depth array has the correct value computed above specifically for this
* HTG Slight indetermination due to the INTERSECT_WITH_CELLS mode for points which are
* exactly in between two depth zones. The second part of the check takes care of that.
*/
if (!((foundDepth - da->GetComponent(i, 0) < 1) ||
(isDemarcation && ((foundDepth - da->GetComponent(i, 0) + 1) < 1))))
{
vtkLog(ERROR, << "Probe Line on HTG 3D failed for " << i << "th point " << pt[0] << ", "
<< pt[1] << ", " << pt[2] << " with depth " << da->GetComponent(i, 0)
<< " when it should be " << foundDepth);
retVal = EXIT_FAILURE;
}
}
}
return retVal;
}
// ----------------------------------------------------------------------------
int Test2DProbing(vtkMultiProcessController* controller)
{
int myrank = controller->GetLocalProcessId();
int retVal = EXIT_SUCCESS;
// ---------------
// Initialize data
vtkNew<vtkRTAnalyticSource> wavelet1;
vtkNew<vtkRTAnalyticSource> wavelet2;
if (myrank == 0)
{
wavelet1->SetWholeExtent(0, 0, -10, 10, -10, -5);
wavelet2->SetWholeExtent(0, 0, -10, 10, -5, 0);
}
else if (myrank == 1)
{
wavelet1->SetWholeExtent(0, 0, -10, 10, 0, 5);
wavelet2->SetWholeExtent(0, 0, -10, 10, 5, 10);
}
wavelet1->Update();
wavelet2->Update();
vtkNew<vtkPartitionedDataSet> pds;
pds->SetNumberOfPartitions(2);
pds->SetPartition(0, wavelet1->GetOutputDataObject(0));
pds->SetPartition(1, wavelet2->GetOutputDataObject(0));
vtkNew<vtkLineSource> line;
line->SetResolution(1);
line->SetPoint1(0.0, 0.4, -10.0);
line->SetPoint2(0.0, 0.4, 9.1);
line->Update();
vtkNew<vtkProbeLineFilter> probeLine;
probeLine->SetInputData(pds);
probeLine->SetSourceConnection(line->GetOutputPort());
probeLine->SetController(controller);
// ------------------------------------------------------------------
// Make the actual testing. Here we mainly test the probing locations
vtkLog(INFO, << "Testing vtkProbeLineFilter with 2D data input (cut wavelet)");
probeLine->AggregateAsPolyDataOn();
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_AT_CELL_BOUNDARIES);
probeLine->Update();
retVal |= CheckForErrors(vtkPolyData::SafeDownCast(probeLine->GetOutputDataObject(0)),
ProbingAtCellBoundaries_2D.data(), ProbingAtCellBoundaries_2D.size(), "arc_length",
"SAMPLE_LINE_AT_CELL_BOUNDARIES", myrank);
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_AT_SEGMENT_CENTERS);
probeLine->Update();
retVal |= CheckForErrors(vtkPolyData::SafeDownCast(probeLine->GetOutputDataObject(0)),
ProbingAtSegmentCenters_2D.data(), ProbingAtSegmentCenters_2D.size(), "arc_length",
"SAMPLE_LINE_AT_SEGMENT_CENTERS", myrank);
return retVal;
}
// ----------------------------------------------------------------------------
int Test3DProbing(vtkMultiProcessController* controller)
{
int myrank = controller->GetLocalProcessId();
int retVal = EXIT_SUCCESS;
// ---------------
// Initialize data
vtkNew<vtkRTAnalyticSource> wavelet1;
vtkNew<vtkRTAnalyticSource> wavelet2;
if (myrank == 0)
{
wavelet1->SetWholeExtent(-10, 10, -10, 10, -10, -5);
wavelet2->SetWholeExtent(-10, 10, -10, 10, -5, 0);
}
else if (myrank == 1)
{
wavelet1->SetWholeExtent(-10, 10, -10, 10, 0, 5);
wavelet2->SetWholeExtent(-10, 10, -10, 10, 5, 10);
}
wavelet1->Update();
wavelet2->Update();
vtkNew<vtkPartitionedDataSet> pds;
pds->SetNumberOfPartitions(2);
pds->SetPartition(0, wavelet1->GetOutputDataObject(0));
pds->SetPartition(1, wavelet2->GetOutputDataObject(0));
vtkNew<vtkPointDataToCellData> point2cell;
point2cell->SetInputData(pds);
vtkNew<vtkLineSource> line;
line->SetPoint1(-10, -10, -10);
line->SetPoint2(10, 10, 10);
line->SetResolution(1);
line->Update();
vtkNew<vtkProbeLineFilter> probeLine;
probeLine->SetInputConnection(point2cell->GetOutputPort());
probeLine->SetSourceConnection(line->GetOutputPort());
probeLine->SetController(controller);
probeLine->SetLineResolution(10);
// ---------------------------------
// Check result for polydata output
vtkLog(INFO, << "Testing vtkProbeLineFilter with polydata output");
probeLine->AggregateAsPolyDataOn();
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_AT_CELL_BOUNDARIES);
probeLine->Update();
retVal |= CheckForErrors(vtkPolyData::SafeDownCast(probeLine->GetOutputDataObject(0)),
ProbingAtCellBoundaries.data(), ProbingAtCellBoundaries.size(), "RTData",
"SAMPLE_LINE_AT_CELL_BOUNDARIES", myrank);
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_AT_SEGMENT_CENTERS);
probeLine->Update();
retVal |= CheckForErrors(vtkPolyData::SafeDownCast(probeLine->GetOutputDataObject(0)),
ProbingAtSegmentCenters.data(), ProbingAtSegmentCenters.size(), "RTData",
"SAMPLE_LINE_AT_SEGMENT_CENTERS", myrank);
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_UNIFORMLY);
probeLine->Update();
retVal |= CheckForErrors(vtkPolyData::SafeDownCast(probeLine->GetOutputDataObject(0)),
ProbingUniformly.data(), ProbingUniformly.size(), "RTData", "SAMPLE_LINE_UNIFORMLY", myrank);
// ---------------------------------
// Check result for multiblock output
vtkLog(INFO, << "Testing vtkProbeLineFilter with multiblock output");
probeLine->AggregateAsPolyDataOff();
vtkMultiBlockDataSet* mbds;
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_AT_CELL_BOUNDARIES);
probeLine->Update();
mbds = vtkMultiBlockDataSet::SafeDownCast(probeLine->GetOutputDataObject(0));
if (mbds == nullptr)
{
vtkLog(ERROR, << "Expecting a multiblock output, found something else");
return EXIT_FAILURE;
}
if (mbds->GetNumberOfBlocks() != 1)
{
vtkLog(ERROR, "Wrong number of blocks in the output");
return EXIT_FAILURE;
}
retVal |=
CheckForErrors(vtkPolyData::SafeDownCast(mbds->GetBlock(0)), ProbingAtCellBoundaries.data(),
ProbingAtCellBoundaries.size(), "RTData", "SAMPLE_LINE_AT_CELL_BOUNDARIES", myrank);
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_AT_SEGMENT_CENTERS);
probeLine->Update();
mbds = vtkMultiBlockDataSet::SafeDownCast(probeLine->GetOutputDataObject(0));
if (mbds == nullptr)
{
vtkLog(ERROR, << "Expecting a multiblock output, found something else");
return EXIT_FAILURE;
}
if (mbds->GetNumberOfBlocks() != 1)
{
vtkLog(ERROR, "Wrong number of blocks in the output");
return EXIT_FAILURE;
}
retVal |=
CheckForErrors(vtkPolyData::SafeDownCast(mbds->GetBlock(0)), ProbingAtSegmentCenters.data(),
ProbingAtSegmentCenters.size(), "RTData", "SAMPLE_LINE_AT_SEGMENT_CENTERS", myrank);
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_UNIFORMLY);
probeLine->Update();
mbds = vtkMultiBlockDataSet::SafeDownCast(probeLine->GetOutputDataObject(0));
if (mbds == nullptr)
{
vtkLog(ERROR, << "Expecting a multiblock output, found something else");
return EXIT_FAILURE;
}
if (mbds->GetNumberOfBlocks() != 1)
{
vtkLog(ERROR, "Wrong number of blocks in the output");
return EXIT_FAILURE;
}
retVal |= CheckForErrors(vtkPolyData::SafeDownCast(mbds->GetBlock(0)), ProbingUniformly.data(),
ProbingUniformly.size(), "RTData", "SAMPLE_LINE_UNIFORMLY", myrank);
return retVal;
}
// ----------------------------------------------------------------------------
int Test3DProbing2(vtkMultiProcessController* controller)
{
int myrank = controller->GetLocalProcessId();
int retVal = EXIT_SUCCESS;
// ---------------
// Initialize data
vtkNew<vtkPartitionedDataSet> pds;
vtkNew<vtkRTAnalyticSource> wavelet1;
if (myrank == 1)
{
wavelet1->SetWholeExtent(-10, 10, -10, 10, 0, 10);
wavelet1->Update();
pds->SetNumberOfPartitions(1);
pds->SetPartition(0, wavelet1->GetOutputDataObject(0));
}
vtkNew<vtkLineSource> line;
line->SetPoint1(0, 0, -10);
line->SetPoint2(0, 0, 10);
line->SetResolution(2);
vtkNew<vtkProbeLineFilter> probeLine;
probeLine->SetInputData(pds);
probeLine->SetSourceConnection(line->GetOutputPort());
probeLine->SetController(controller);
probeLine->SetLineResolution(50);
probeLine->SetSamplingPattern(vtkProbeLineFilter::SAMPLE_LINE_UNIFORMLY);
probeLine->Update();
vtkPolyData* pd = vtkPolyData::SafeDownCast(probeLine->GetOutputDataObject(0));
if (myrank == 0 && !pd->GetPointData()->GetArray("RTData"))
{
vtkLog(ERROR, "RTData array not found");
return EXIT_FAILURE;
}
return retVal;
}
// ----------------------------------------------------------------------------
int Test2DProbingHTG(vtkMultiProcessController* contr)
{
vtkLog(INFO, << "Testing vtkProbeLineFilter with 2D HyperTreeGrid input");
vtkNew<vtkHyperTreeGridPreConfiguredSource> htgSource;
htgSource->SetHTGMode(vtkHyperTreeGridPreConfiguredSource::CUSTOM);
htgSource->SetCustomArchitecture(vtkHyperTreeGridPreConfiguredSource::UNBALANCED);
htgSource->SetCustomDim(2);
htgSource->SetCustomFactor(2);
htgSource->SetCustomDepth(3);
htgSource->SetCustomExtent(0.0, 1.0, 0.0, 1.0, 0.0, 0.0);
htgSource->SetCustomSubdivisions(3, 3, 0);
htgSource->Update();
vtkNew<vtkLineSource> line;
line->SetResolution(1);
line->SetPoint1(0.01, 0.01, 0.00);
line->SetPoint2(0.99, 0.99, 0.00);
line->Update();
vtkNew<vtkProbeLineFilter> probeLine;
probeLine->SetInputConnection(htgSource->GetOutputPort());
probeLine->SetSourceConnection(line->GetOutputPort());
probeLine->SetController(contr);
probeLine->SetLineResolution(10);
probeLine->SetTolerance(eps);
int retVal = EXIT_SUCCESS;
auto Check = [&probeLine, &contr, &retVal](int pattern)
{
probeLine->SetSamplingPattern(pattern);
probeLine->Update();
vtkDataSet* outDataSet = vtkDataSet::SafeDownCast(probeLine->GetOutput());
retVal |= Check2DHTG(contr, outDataSet);
};
Check(vtkProbeLineFilter::SAMPLE_LINE_AT_CELL_BOUNDARIES);
Check(vtkProbeLineFilter::SAMPLE_LINE_AT_SEGMENT_CENTERS);
Check(vtkProbeLineFilter::SAMPLE_LINE_UNIFORMLY);
return retVal;
}
// ----------------------------------------------------------------------------
int Test3DProbingHTG(vtkMultiProcessController* contr)
{
vtkLog(INFO, << "Testing vtkProbeLineFilter with 3D HyperTreeGrid input");
vtkNew<vtkHyperTreeGridPreConfiguredSource> htgSource;
htgSource->SetHTGMode(vtkHyperTreeGridPreConfiguredSource::CUSTOM);
htgSource->SetCustomArchitecture(vtkHyperTreeGridPreConfiguredSource::UNBALANCED);
htgSource->SetCustomDim(3);
htgSource->SetCustomFactor(2);
htgSource->SetCustomDepth(3);
htgSource->SetCustomExtent(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
htgSource->SetCustomSubdivisions(3, 3, 3);
htgSource->Update();
vtkNew<vtkLineSource> line;
line->SetResolution(1);
line->SetPoint1(0.02, 0.01, 0.03);
line->SetPoint2(0.99, 0.98, 0.99);
line->Update();
vtkNew<vtkProbeLineFilter> probeLine;
probeLine->SetInputConnection(htgSource->GetOutputPort());
probeLine->SetSourceConnection(line->GetOutputPort());
probeLine->SetController(contr);
probeLine->SetLineResolution(10);
probeLine->SetTolerance(eps);
int retVal = EXIT_SUCCESS;
auto Check = [&probeLine, &contr, &retVal](int pattern)
{
probeLine->SetSamplingPattern(pattern);
probeLine->Update();
vtkDataSet* outDataSet = vtkDataSet::SafeDownCast(probeLine->GetOutput());
retVal |= Check3DHTG(contr, outDataSet);
};
Check(vtkProbeLineFilter::SAMPLE_LINE_AT_CELL_BOUNDARIES);
Check(vtkProbeLineFilter::SAMPLE_LINE_AT_SEGMENT_CENTERS);
Check(vtkProbeLineFilter::SAMPLE_LINE_UNIFORMLY);
return retVal;
}
// ----------------------------------------------------------------------------
int TestProbeLineFilter(int argc, char* argv[])
{
vtkNew<vtkMPIController> contr;
contr->Initialize(&argc, &argv);
vtkMultiProcessController::SetGlobalController(contr);
int retVal = EXIT_SUCCESS;
retVal |= Test2DProbing(contr);
retVal |= Test3DProbing(contr);
retVal |= Test3DProbing2(contr);
retVal |= Test2DProbingHTG(contr);
retVal |= Test3DProbingHTG(contr);
vtkMultiProcessController::SetGlobalController(nullptr);
contr->Finalize();
return retVal;
}
|