MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkComputeDifference

Function vtkComputeDifference

IO/LSDyna/vtkLSDynaReader.cxx:3718–3744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3716{
3717template <class T, int NumberOfComponents>
3718vtkSmartPointer<T> vtkComputeDifference(T* aArray, T* bArray)
3719{
3720 if (aArray == nullptr || bArray == nullptr)
3721 {
3722 return nullptr;
3723 }
3724
3725 const vtkIdType numTuples = aArray->GetNumberOfTuples();
3726 const int numComps = aArray->GetNumberOfComponents();
3727 if (bArray->GetNumberOfTuples() != numTuples || bArray->GetNumberOfComponents() != numComps ||
3728 numComps != NumberOfComponents)
3729 {
3730 return nullptr;
3731 }
3732
3733 vtkVector<typename T::ValueType, NumberOfComponents> tupleA, tupleB;
3734 vtkSmartPointer<T> result = vtkSmartPointer<T>::New();
3735 result->SetNumberOfComponents(NumberOfComponents);
3736 result->SetNumberOfTuples(numTuples);
3737 for (vtkIdType cc = 0, max = numTuples; cc < max; ++cc)
3738 {
3739 aArray->GetTypedTuple(cc, tupleA.GetData());
3740 bArray->GetTypedTuple(cc, tupleB.GetData());
3741 result->SetTypedTuple(cc, (tupleA - tupleB).GetData());
3742 }
3743 return result;
3744}
3745}
3746
3747//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 8

NewFunction · 0.50
GetNumberOfTuplesMethod · 0.45
GetNumberOfComponentsMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetTypedTupleMethod · 0.45
GetDataMethod · 0.45
SetTypedTupleMethod · 0.45

Tested by

no test coverage detected