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

Method AdvectIterative

Filters/FlowPaths/vtkStreamSurface.cxx:60–307  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

58
59//----------------------------------------------------------------------------
60int vtkStreamSurface::AdvectIterative(
61 vtkDataObject* field, vtkPolyData* seeds, int integrationDirection, vtkPolyData* output)
62{
63 vtkDataSet* dataset = nullptr;
64
65 // adapt dist if cell unit was selected
66 double distThreshold = this->InitialIntegrationStep;
67
68 if (field->IsA("vtkDataSet"))
69 {
70 dataset = vtkDataSet::SafeDownCast(field);
71
72 if (this->IntegrationStepUnit == CELL_LENGTH_UNIT)
73 {
74 distThreshold *= sqrt(dataset->GetCell(0)->GetLength2());
75 }
76 }
77 else if (field->IsA("vtkUniformGridAMR"))
78 {
79 vtkUniformGridAMR* data = vtkUniformGridAMR::SafeDownCast(field);
80 dataset = data->GetDataSetAsCartesianGrid(0, 0);
81 if (this->IntegrationStepUnit == CELL_LENGTH_UNIT)
82 {
83 distThreshold *= sqrt(dataset->GetCell(0)->GetLength2());
84 }
85 }
86
87 int vecType(0);
88 vtkDataArray* vectors = this->GetInputArrayToProcess(0, dataset, vecType);
89
90 vtkNew<vtkPolyData> currentSeeds;
91 currentSeeds->ShallowCopy(seeds);
92 vtkNew<vtkDoubleArray> seedIntegrationTimeArray;
93 seedIntegrationTimeArray->SetName("IntegrationTime");
94 seedIntegrationTimeArray->SetNumberOfTuples(currentSeeds->GetNumberOfPoints());
95 seedIntegrationTimeArray->Fill(0.0);
96 currentSeeds->GetPointData()->AddArray(seedIntegrationTimeArray);
97
98 for (int currentIteration = 0; currentIteration < this->MaximumNumberOfSteps; currentIteration++)
99 {
100 if (this->CheckAbort())
101 {
102 break;
103 }
104 // advect currentSeeds
105 // the output will be ordered: 0, advect(0), 1, advect(1), 2...
106 // but if a point reaches the boundary, its advected point is just missing
107 this->StreamTracer->SetInputData(field);
108 this->StreamTracer->SetSourceData(currentSeeds);
109 this->StreamTracer->SetIntegratorType(this->GetIntegratorType());
110 this->StreamTracer->SetComputeVorticity(this->ComputeVorticity);
111 this->StreamTracer->SetMaximumPropagation(this->MaximumPropagation);
112 this->StreamTracer->SetIntegrationStepUnit(this->IntegrationStepUnit);
113 this->StreamTracer->SetInitialIntegrationStep(this->InitialIntegrationStep);
114 this->StreamTracer->SetIntegrationDirection(integrationDirection);
115 this->StreamTracer->SetInputArrayToProcess(
116 0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, vectors->GetName());
117 // setting this to zero makes the tracer do 1 step

Callers

nothing calls this directly

Calls 15

IsAMethod · 0.80
CheckAbortMethod · 0.80
SetComputeVorticityMethod · 0.80
SetMaximumPropagationMethod · 0.80
SetPolysMethod · 0.80
GetTuple1Method · 0.80
InsertNextTuple1Method · 0.80
RemoveAllInputsMethod · 0.80
sqrtFunction · 0.50

Tested by

no test coverage detected