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

Method CheckInputs

Filters/Generic/vtkGenericStreamTracer.cxx:587–666  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

585
586//------------------------------------------------------------------------------
587int vtkGenericStreamTracer::CheckInputs(
588 vtkGenericInterpolatedVelocityField*& func, vtkInformationVector** inputVector)
589{
590 // Set the function set to be integrated
591 if (!this->InterpolatorPrototype)
592 {
593 func = vtkGenericInterpolatedVelocityField::New();
594 }
595 else
596 {
597 func = this->InterpolatorPrototype->NewInstance();
598 func->CopyParameters(this->InterpolatorPrototype);
599 }
600 func->SelectVectors(this->InputVectorsSelection);
601
602 // Add all the inputs ( except source, of course ) which
603 // have the appropriate vectors and compute the maximum
604 // cell size.
605 int numInputs = 0;
606 int numInputConnections = this->GetNumberOfInputConnections(0);
607 for (int i = 0; i < numInputConnections; i++)
608 {
609 vtkInformation* info = inputVector[0]->GetInformationObject(i);
610 vtkGenericDataSet* inp = nullptr;
611
612 if (info != nullptr)
613 {
614 inp = vtkGenericDataSet::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
615 }
616 if (inp != nullptr)
617 {
618 int attrib;
619 int attributeFound;
620 if (this->InputVectorsSelection != nullptr)
621 {
622 attrib = inp->GetAttributes()->FindAttribute(this->InputVectorsSelection);
623
624 attributeFound = attrib >= 0;
625 if (attributeFound)
626 {
627 attributeFound = (inp->GetAttributes()->GetAttribute(attrib)->GetType() ==
628 vtkDataSetAttributes::VECTORS) &&
629 (inp->GetAttributes()->GetAttribute(attrib)->GetCentering() == vtkPointCentered);
630 }
631 }
632 else
633 {
634 // Find the first attribute, point centered and with vector type.
635 attrib = 0;
636 attributeFound = 0;
637 int c = inp->GetAttributes()->GetNumberOfAttributes();
638 while (attrib < c && !attributeFound)
639 {
640 attributeFound = (inp->GetAttributes()->GetAttribute(attrib)->GetType() ==
641 vtkDataSetAttributes::VECTORS) &&
642 (inp->GetAttributes()->GetAttribute(attrib)->GetCentering() == vtkPointCentered);
643 ++attrib;
644 }

Callers 1

RequestDataMethod · 0.95

Calls 15

SelectVectorsMethod · 0.80
GetInformationObjectMethod · 0.80
GetCenteringMethod · 0.80
NewFunction · 0.50
NewInstanceMethod · 0.45
CopyParametersMethod · 0.45
GetMethod · 0.45
FindAttributeMethod · 0.45
GetAttributesMethod · 0.45
GetTypeMethod · 0.45
GetAttributeMethod · 0.45

Tested by

no test coverage detected