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 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkArrayListTemplate.h
Copyright (c) Kitware, Inc.
All rights reserved.
See LICENSE file for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkArrayListTemplate
* @brief thread-safe and efficient data attribute processing
*
*
* vtkArrayListTemplate supplements the vtkDataSetAttributes class to provide
* threaded processing of data arrays. It is also more efficient for certain
* interpolation operations. The expectation is that it will be replaced one
* day once vtkPointData, vtkCellData, vtkDataSetAttributes, and vtkFieldData
* properly support multithreading and/or are redesigned. Note that this
* implementation does not support incremental operations (like InsertNext()).
*
* Generally the way this helper class is used is to first invoke
* vtkDataSetAttributes::CopyInterpolate() or InterpolateAllocate() which
* performs the initial magic of constructing input and output arrays. Then
* the input attributes, and output attributes, are passed to initialize the
* internal structures via the AddArrays() method. Essentially these internal
* structures are templated pairs of arrays of the same type, which can be
* efficiently accessed and assigned. The operations on these array pairs
* (e.g., interpolation) occur using a typeless, virtual dispatch base class.
*
* @warning
* vtkDataSetAttributes is not in general thread safe due to the use of its
* vtkFieldData::BasicIterator RequiredArrays data member. This class augments
* vtkDataSetAttributes for thread safety.
*
* @sa
* vtkFieldData vtkDataSetAttributes vtkPointData vtkCellData
*/
#ifndef vtkArrayListTemplate_h
#define vtkArrayListTemplate_h
#include "vtkAbstractArray.h"
#include "vtkDataSetAttributes.h"
#include "vtkSmartPointer.h"
#include "vtkStdString.h"
#include <algorithm>
#include <vector>
// Create a generic class supporting virtual dispatch to type-specific
// subclasses.
VTK_ABI_NAMESPACE_BEGIN
struct BaseArrayPair
{
vtkIdType Num;
int NumComp;
vtkSmartPointer<vtkAbstractArray> OutputArray;
BaseArrayPair(vtkIdType num, int numComp, vtkAbstractArray* outArray)
: Num(num)
, NumComp(numComp)
, OutputArray(outArray)
{
}
virtual ~BaseArrayPair() = default;
virtual void Copy(vtkIdType inId, vtkIdType outId) = 0;
virtual void Interpolate(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId) = 0;
virtual void InterpolateOutput(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId) = 0;
virtual void Average(int numPts, const vtkIdType* ids, vtkIdType outId) = 0;
virtual void WeightedAverage(
int numPts, const vtkIdType* ids, const double* weights, vtkIdType outId) = 0;
virtual void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) = 0;
virtual void AssignNullValue(vtkIdType outId) = 0;
#ifdef VTK_USE_64BIT_IDS
virtual void Copy(unsigned int inId, unsigned int outId) = 0;
virtual void Interpolate(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId) = 0;
virtual void InterpolateOutput(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId) = 0;
virtual void Average(int numPts, const unsigned int* ids, unsigned int outId) = 0;
virtual void WeightedAverage(
int numPts, const unsigned int* ids, const double* weights, unsigned int outId) = 0;
virtual void InterpolateEdge(unsigned int v0, unsigned int v1, double t, unsigned int outId) = 0;
virtual void AssignNullValue(unsigned int outId) = 0;
#endif
virtual void Copy(unsigned short inId, unsigned short outId) = 0;
virtual void Interpolate(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId) = 0;
virtual void InterpolateOutput(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId) = 0;
virtual void Average(int numPts, const unsigned short* ids, unsigned short outId) = 0;
virtual void WeightedAverage(
int numPts, const unsigned short* ids, const double* weights, unsigned short outId) = 0;
virtual void InterpolateEdge(
unsigned short v0, unsigned short v1, double t, unsigned short outId) = 0;
virtual void AssignNullValue(unsigned short outId) = 0;
virtual void Realloc(vtkIdType sze) = 0;
};
// Type specific interpolation on a matched pair of data arrays
template <typename T>
struct ArrayPair : public BaseArrayPair
{
T* Input;
T* Output;
T NullValue;
ArrayPair(T* in, T* out, vtkIdType num, int numComp, vtkAbstractArray* outArray, T null)
: BaseArrayPair(num, numComp, outArray)
, Input(in)
, Output(out)
, NullValue(null)
{
}
~ArrayPair() override = default; // calm down some finicky compilers
protected:
template <typename IdTypeT>
void Copy(IdTypeT inId, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
this->Output[outId * this->NumComp + j] =
static_cast<T>(this->Input[inId * this->NumComp + j]);
}
}
template <typename IdTypeT>
void Interpolate(int numWeights, const IdTypeT* ids, const double* weights, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numWeights; ++i)
{
v += weights[i] * static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
}
this->Output[outId * this->NumComp + j] = static_cast<T>(v);
}
}
template <typename IdTypeT>
void InterpolateOutput(int numWeights, const IdTypeT* ids, const double* weights, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numWeights; ++i)
{
v += weights[i] * static_cast<double>(this->Output[ids[i] * this->NumComp + j]);
}
this->Output[outId * this->NumComp + j] = static_cast<T>(v);
}
}
template <typename IdTypeT>
void Average(int numPts, const IdTypeT* ids, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numPts; ++i)
{
v += static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
}
v /= static_cast<double>(numPts);
this->Output[outId * this->NumComp + j] = static_cast<T>(v);
}
}
template <typename IdTypeT>
void WeightedAverage(int numPts, const IdTypeT* ids, const double* weights, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numPts; ++i)
{
v += (weights[i] * static_cast<double>(this->Input[ids[i] * this->NumComp + j]));
}
this->Output[outId * this->NumComp + j] = static_cast<T>(v);
}
}
template <typename IdTypeT>
void InterpolateEdge(IdTypeT v0, IdTypeT v1, double t, IdTypeT outId)
{
double v;
for (int j = 0; j < this->NumComp; ++j)
{
v = this->Input[v0 * this->NumComp + j] +
t * (this->Input[v1 * this->NumComp + j] - this->Input[v0 * this->NumComp + j]);
this->Output[outId * this->NumComp + j] = static_cast<T>(v);
}
}
template <typename IdTypeT>
void AssignNullValue(IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
this->Output[outId * this->NumComp + j] = this->NullValue;
}
}
public:
void Copy(vtkIdType inId, vtkIdType outId) override { this->Copy<vtkIdType>(inId, outId); }
void Interpolate(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId) override
{
this->Interpolate<vtkIdType>(numWeights, ids, weights, outId);
}
void InterpolateOutput(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId) override
{
this->InterpolateOutput<vtkIdType>(numWeights, ids, weights, outId);
}
void Average(int numPts, const vtkIdType* ids, vtkIdType outId) override
{
this->Average<vtkIdType>(numPts, ids, outId);
}
void WeightedAverage(
int numPts, const vtkIdType* ids, const double* weights, vtkIdType outId) override
{
this->WeightedAverage<vtkIdType>(numPts, ids, weights, outId);
}
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
{
this->InterpolateEdge<vtkIdType>(v0, v1, t, outId);
}
void AssignNullValue(vtkIdType outId) override { this->AssignNullValue<vtkIdType>(outId); }
#ifdef VTK_USE_64BIT_IDS
void Copy(unsigned int inId, unsigned int outId) override
{
this->Copy<unsigned int>(inId, outId);
}
void Interpolate(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId) override
{
this->Interpolate<unsigned int>(numWeights, ids, weights, outId);
}
void InterpolateOutput(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId) override
{
this->InterpolateOutput<unsigned int>(numWeights, ids, weights, outId);
}
void Average(int numPts, const unsigned int* ids, unsigned int outId) override
{
this->Average<unsigned int>(numPts, ids, outId);
}
void WeightedAverage(
int numPts, const unsigned int* ids, const double* weights, unsigned int outId) override
{
this->WeightedAverage<unsigned int>(numPts, ids, weights, outId);
}
void InterpolateEdge(unsigned int v0, unsigned int v1, double t, unsigned int outId) override
{
this->InterpolateEdge<unsigned int>(v0, v1, t, outId);
}
void AssignNullValue(unsigned int outId) override { this->AssignNullValue<unsigned int>(outId); }
#endif
void Copy(unsigned short inId, unsigned short outId) override
{
this->Copy<unsigned short>(inId, outId);
}
void Interpolate(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId) override
{
this->Interpolate<unsigned short>(numWeights, ids, weights, outId);
}
void InterpolateOutput(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId) override
{
this->InterpolateOutput<unsigned short>(numWeights, ids, weights, outId);
}
void Average(int numPts, const unsigned short* ids, unsigned short outId) override
{
this->Average<unsigned short>(numPts, ids, outId);
}
void WeightedAverage(
int numPts, const unsigned short* ids, const double* weights, unsigned short outId) override
{
this->WeightedAverage<unsigned short>(numPts, ids, weights, outId);
}
void InterpolateEdge(
unsigned short v0, unsigned short v1, double t, unsigned short outId) override
{
this->InterpolateEdge<unsigned short>(v0, v1, t, outId);
}
void AssignNullValue(unsigned short outId) override
{
this->AssignNullValue<unsigned short>(outId);
}
void Realloc(vtkIdType sze) override
{
this->OutputArray->Resize(sze);
this->OutputArray->SetNumberOfTuples(sze);
this->Output = static_cast<T*>(this->OutputArray->GetVoidPointer(0));
}
};
// Type specific interpolation on a pair of data arrays with different types, where the
// output type is expected to be a real type (i.e., float or double).
template <typename TInput, typename TOutput>
struct RealArrayPair : public BaseArrayPair
{
TInput* Input;
TOutput* Output;
TOutput NullValue;
RealArrayPair(
TInput* in, TOutput* out, vtkIdType num, int numComp, vtkAbstractArray* outArray, TOutput null)
: BaseArrayPair(num, numComp, outArray)
, Input(in)
, Output(out)
, NullValue(null)
{
}
~RealArrayPair() override = default; // calm down some finicky compilers
protected:
template <typename IdTypeT>
void Copy(IdTypeT inId, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
this->Output[outId * this->NumComp + j] =
static_cast<TOutput>(this->Input[inId * this->NumComp + j]);
}
}
template <typename IdTypeT>
void Interpolate(int numWeights, const IdTypeT* ids, const double* weights, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numWeights; ++i)
{
v += weights[i] * static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
}
this->Output[outId * this->NumComp + j] = static_cast<TOutput>(v);
}
}
template <typename IdTypeT>
void InterpolateOutput(int numWeights, const IdTypeT* ids, const double* weights, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numWeights; ++i)
{
v += weights[i] * static_cast<double>(this->Output[ids[i] * this->NumComp + j]);
}
this->Output[outId * this->NumComp + j] = static_cast<TOutput>(v);
}
}
template <typename IdTypeT>
void Average(int numPts, const IdTypeT* ids, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numPts; ++i)
{
v += static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
}
v /= static_cast<double>(numPts);
this->Output[outId * this->NumComp + j] = static_cast<TOutput>(v);
}
}
template <typename IdTypeT>
void WeightedAverage(int numPts, const IdTypeT* ids, const double* weights, IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
double v = 0.0;
for (int i = 0; i < numPts; ++i)
{
v += (weights[i] * static_cast<double>(this->Input[ids[i] * this->NumComp + j]));
}
this->Output[outId * this->NumComp + j] = static_cast<TOutput>(v);
}
}
template <typename IdTypeT>
void InterpolateEdge(IdTypeT v0, IdTypeT v1, double t, IdTypeT outId)
{
double v;
for (int j = 0; j < this->NumComp; ++j)
{
v = this->Input[v0 * this->NumComp + j] +
t * (this->Input[v1 * this->NumComp + j] - this->Input[v0 * this->NumComp + j]);
this->Output[outId * this->NumComp + j] = static_cast<TOutput>(v);
}
}
template <typename IdTypeT>
void AssignNullValue(IdTypeT outId)
{
for (int j = 0; j < this->NumComp; ++j)
{
this->Output[outId * this->NumComp + j] = this->NullValue;
}
}
public:
void Copy(vtkIdType inId, vtkIdType outId) override { this->Copy<vtkIdType>(inId, outId); }
void Interpolate(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId) override
{
this->Interpolate<vtkIdType>(numWeights, ids, weights, outId);
}
void InterpolateOutput(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId) override
{
this->InterpolateOutput<vtkIdType>(numWeights, ids, weights, outId);
}
void Average(int numPts, const vtkIdType* ids, vtkIdType outId) override
{
this->Average<vtkIdType>(numPts, ids, outId);
}
void WeightedAverage(
int numPts, const vtkIdType* ids, const double* weights, vtkIdType outId) override
{
this->WeightedAverage<vtkIdType>(numPts, ids, weights, outId);
}
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
{
this->InterpolateEdge<vtkIdType>(v0, v1, t, outId);
}
void AssignNullValue(vtkIdType outId) override { this->AssignNullValue<vtkIdType>(outId); }
#ifdef VTK_USE_64BIT_IDS
void Copy(unsigned int inId, unsigned int outId) override
{
this->Copy<unsigned int>(inId, outId);
}
void Interpolate(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId) override
{
this->Interpolate<unsigned int>(numWeights, ids, weights, outId);
}
void InterpolateOutput(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId) override
{
this->InterpolateOutput<unsigned int>(numWeights, ids, weights, outId);
}
void Average(int numPts, const unsigned int* ids, unsigned int outId) override
{
this->Average<unsigned int>(numPts, ids, outId);
}
void WeightedAverage(
int numPts, const unsigned int* ids, const double* weights, unsigned int outId) override
{
this->WeightedAverage<unsigned int>(numPts, ids, weights, outId);
}
void InterpolateEdge(unsigned int v0, unsigned int v1, double t, unsigned int outId) override
{
this->InterpolateEdge<unsigned int>(v0, v1, t, outId);
}
void AssignNullValue(unsigned int outId) override { this->AssignNullValue<unsigned int>(outId); }
#endif
void Copy(unsigned short inId, unsigned short outId) override
{
this->Copy<unsigned short>(inId, outId);
}
void Interpolate(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId) override
{
this->Interpolate<unsigned short>(numWeights, ids, weights, outId);
}
void InterpolateOutput(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId) override
{
this->InterpolateOutput<unsigned short>(numWeights, ids, weights, outId);
}
void Average(int numPts, const unsigned short* ids, unsigned short outId) override
{
this->Average<unsigned short>(numPts, ids, outId);
}
void WeightedAverage(
int numPts, const unsigned short* ids, const double* weights, unsigned short outId) override
{
this->WeightedAverage<unsigned short>(numPts, ids, weights, outId);
}
void InterpolateEdge(
unsigned short v0, unsigned short v1, double t, unsigned short outId) override
{
this->InterpolateEdge<unsigned short>(v0, v1, t, outId);
}
void AssignNullValue(unsigned short outId) override
{
this->AssignNullValue<unsigned short>(outId);
}
void Realloc(vtkIdType sze) override
{
this->OutputArray->Resize(sze);
this->OutputArray->SetNumberOfTuples(sze);
this->Output = static_cast<TOutput*>(this->OutputArray->GetVoidPointer(0));
}
};
// Forward declarations. This makes working with vtkTemplateMacro easier.
struct ArrayList;
template <typename T>
void CreateArrayPair(
ArrayList* list, T* inData, T* outData, vtkIdType numTuples, int numComp, T nullValue);
// A list of the arrays to interpolate, and a method to invoke interpolation on the list
struct ArrayList
{
// The list of arrays, and the arrays not to process
std::vector<BaseArrayPair*> Arrays;
std::vector<vtkAbstractArray*> ExcludedArrays;
// Add the arrays to interpolate here (from attribute data). Note that this method is
// not thread-safe due to its use of vtkDataSetAttributes.
void AddArrays(vtkIdType numOutPts, vtkDataSetAttributes* inPD, vtkDataSetAttributes* outPD,
double nullValue = 0.0, vtkTypeBool promote = true);
// Add an array that interpolates from its own attribute values
void AddSelfInterpolatingArrays(
vtkIdType numOutPts, vtkDataSetAttributes* attr, double nullValue = 0.0);
// Add a pair of arrays (manual insertion). Returns the output array created,
// if any. No array may be created if \c inArray was previously marked as
// excluded using ExcludeArray().
vtkAbstractArray* AddArrayPair(vtkIdType numTuples, vtkAbstractArray* inArray,
vtkStdString& outArrayName, double nullValue, vtkTypeBool promote);
// Any array excluded here is not added by AddArrays() or AddArrayPair, hence not
// processed. Also check whether an array is excluded.
void ExcludeArray(vtkAbstractArray* da);
vtkTypeBool IsExcluded(vtkAbstractArray* da);
// Only you can prevent memory leaks!
~ArrayList()
{
for (auto& array : this->Arrays)
{
delete array;
}
}
protected:
template <typename TIdType>
void Copy(TIdType inId, TIdType outId)
{
for (auto& array : this->Arrays)
{
array->Copy(inId, outId);
}
}
template <typename TIdType>
void Interpolate(int numWeights, const TIdType* ids, const double* weights, TIdType outId)
{
for (auto& array : this->Arrays)
{
array->Interpolate(numWeights, ids, weights, outId);
}
}
template <typename TIdType>
void InterpolateOutput(int numWeights, const TIdType* ids, const double* weights, TIdType outId)
{
for (auto& array : this->Arrays)
{
array->InterpolateOutput(numWeights, ids, weights, outId);
}
}
template <typename TIdType>
void Average(int numPts, const TIdType* ids, TIdType outId)
{
for (auto& array : this->Arrays)
{
array->Average(numPts, ids, outId);
}
}
template <typename TIdType>
void WeightedAverage(int numPts, const TIdType* ids, const double* weights, TIdType outId)
{
for (auto& array : this->Arrays)
{
array->WeightedAverage(numPts, ids, weights, outId);
}
}
template <typename TIdType>
void InterpolateEdge(TIdType v0, TIdType v1, double t, TIdType outId)
{
for (auto& array : this->Arrays)
{
array->InterpolateEdge(v0, v1, t, outId);
}
}
template <typename TIdType>
void AssignNullValue(TIdType outId)
{
for (auto& array : this->Arrays)
{
array->AssignNullValue(outId);
}
}
public:
/**
* Loop over the array pairs and copy data from one to another. This (and the following methods)
* can be used within threads.
*/
void Copy(vtkIdType inId, vtkIdType outId) { this->Copy<vtkIdType>(inId, outId); }
/**
* Loop over the arrays and have them interpolate themselves
*/
void Interpolate(int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId)
{
this->Interpolate<vtkIdType>(numWeights, ids, weights, outId);
}
/**
* Loop over the arrays and have them interpolate themselves based on the output arrays
*/
void InterpolateOutput(
int numWeights, const vtkIdType* ids, const double* weights, vtkIdType outId)
{
this->InterpolateOutput<vtkIdType>(numWeights, ids, weights, outId);
}
/**
* Loop over the arrays and have them averaged.
*/
void Average(int numPts, const vtkIdType* ids, vtkIdType outId)
{
this->Average<vtkIdType>(numPts, ids, outId);
}
/**
* Loop over the arrays and weighted average the attributes. The weights should sum to 1.0.
*/
void WeightedAverage(int numPts, const vtkIdType* ids, const double* weights, vtkIdType outId)
{
this->WeightedAverage<vtkIdType>(numPts, ids, weights, outId);
}
/**
* Loop over the arrays perform edge interpolation.
*/
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId)
{
this->InterpolateEdge<vtkIdType>(v0, v1, t, outId);
}
/**
* Loop over the arrays and assign the null value.
*/
void AssignNullValue(vtkIdType outId) { this->AssignNullValue<vtkIdType>(outId); }
#ifdef VTK_USE_64BIT_IDS
/**
* Loop over the array pairs and copy data from one to another. This (and the following methods)
* can be used within threads.
*/
void Copy(unsigned int inId, unsigned int outId) { this->Copy<unsigned int>(inId, outId); }
/**
* Loop over the arrays and have them interpolate themselves
*/
void Interpolate(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId)
{
this->Interpolate<unsigned int>(numWeights, ids, weights, outId);
}
/**
* Loop over the arrays and have them interpolate themselves based on the output arrays
*/
void InterpolateOutput(
int numWeights, const unsigned int* ids, const double* weights, unsigned int outId)
{
this->InterpolateOutput<unsigned int>(numWeights, ids, weights, outId);
}
/**
* Loop over the arrays and have them averaged.
*/
void Average(int numPts, const unsigned int* ids, unsigned int outId)
{
this->Average<unsigned int>(numPts, ids, outId);
}
/**
* Loop over the arrays and weighted average the attributes. The weights should sum to 1.0.
*/
void WeightedAverage(
int numPts, const unsigned int* ids, const double* weights, unsigned int outId)
{
this->WeightedAverage<unsigned int>(numPts, ids, weights, outId);
}
/**
* Loop over the arrays perform edge interpolation.
*/
void InterpolateEdge(unsigned int v0, unsigned int v1, double t, unsigned int outId)
{
this->InterpolateEdge<unsigned int>(v0, v1, t, outId);
}
/**
* Loop over the arrays and assign the null value.
*/
void AssignNullValue(unsigned int outId) { this->AssignNullValue<unsigned int>(outId); }
#endif
/**
* Loop over the array pairs and copy data from one to another. This (and the following methods)
* can be used within threads.
*/
void Copy(unsigned short inId, unsigned short outId) { this->Copy<unsigned short>(inId, outId); }
/**
* Loop over the arrays and have them interpolate themselves
*/
void Interpolate(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId)
{
this->Interpolate<unsigned short>(numWeights, ids, weights, outId);
}
/**
* Loop over the arrays and have them interpolate themselves based on the output arrays
*/
void InterpolateOutput(
int numWeights, const unsigned short* ids, const double* weights, unsigned short outId)
{
this->InterpolateOutput<unsigned short>(numWeights, ids, weights, outId);
}
/**
* Loop over the arrays and have them averaged.
*/
void Average(int numPts, const unsigned short* ids, unsigned short outId)
{
this->Average<unsigned short>(numPts, ids, outId);
}
/**
* Loop over the arrays and weighted average the attributes. The weights should sum to 1.0.
*/
void WeightedAverage(
int numPts, const unsigned short* ids, const double* weights, unsigned short outId)
{
this->WeightedAverage<unsigned short>(numPts, ids, weights, outId);
}
/**
* Loop over the arrays perform edge interpolation.
*/
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId)
{
this->InterpolateEdge<unsigned short>(v0, v1, t, outId);
}
/**
* Loop over the arrays and assign the null value.
*/
void AssignNullValue(unsigned short outId) { this->AssignNullValue<unsigned short>(outId); }
/**
* Extend (realloc) the arrays.
*/
void Realloc(vtkIdType sze)
{
for (auto& array : this->Arrays)
{
array->Realloc(sze);
}
}
/**
* Return the number of arrays.
*/
vtkIdType GetNumberOfArrays() { return static_cast<vtkIdType>(this->Arrays.size()); }
};
VTK_ABI_NAMESPACE_END
#include "vtkArrayListTemplate.txx"
#endif
// VTK-HeaderTest-Exclude: vtkArrayListTemplate.h
|