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

Method FinalizeOutputs

Filters/ParallelFlowPaths/vtkPLagrangianParticleTracker.cxx:988–1038  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

986
987//------------------------------------------------------------------------------
988bool vtkPLagrangianParticleTracker::FinalizeOutputs(
989 vtkPolyData* particlePathsOutput, vtkDataObject* interactionOutput)
990{
991 if (this->Controller && this->Controller->GetNumberOfProcesses() > 1)
992 {
993 // Cleanly delete remaining out of domain particles
994 for (auto iter : this->OutOfDomainParticleMap)
995 {
996 this->Superclass::DeleteParticle(iter.second);
997 }
998 this->OutOfDomainParticleMap.clear();
999
1000 if (this->GenerateParticlePathsOutput)
1001 {
1002 // Construct array with all non outofdomains ids and terminations
1003 vtkNew<vtkLongLongArray> idTermination;
1004 vtkNew<vtkLongLongArray> allIdTermination;
1005 idTermination->Allocate(particlePathsOutput->GetNumberOfCells());
1006 idTermination->SetNumberOfComponents(2);
1007 vtkIntArray* terminations =
1008 vtkIntArray::SafeDownCast(particlePathsOutput->GetCellData()->GetArray("Termination"));
1009 vtkLongLongArray* ids =
1010 vtkLongLongArray::SafeDownCast(particlePathsOutput->GetCellData()->GetArray("Id"));
1011 for (int i = 0; i < particlePathsOutput->GetNumberOfCells(); i++)
1012 {
1013 if (terminations->GetValue(i) != vtkLagrangianParticle::PARTICLE_TERMINATION_OUT_OF_DOMAIN)
1014 {
1015 idTermination->InsertNextTuple2(ids->GetValue(i), terminations->GetValue(i));
1016 }
1017 }
1018 idTermination->Squeeze();
1019
1020 // AllGather it
1021 this->Controller->AllGatherV(idTermination, allIdTermination);
1022
1023 // Modify current terminations
1024 for (vtkIdType i = 0; i < allIdTermination->GetNumberOfTuples(); i++)
1025 {
1026 vtkIdType id = allIdTermination->GetTuple2(i)[0];
1027 for (vtkIdType j = 0; j < particlePathsOutput->GetNumberOfCells(); j++)
1028 {
1029 if (ids->GetValue(j) == id)
1030 {
1031 terminations->SetTuple1(j, allIdTermination->GetTuple2(i)[1]);
1032 }
1033 }
1034 }
1035 }
1036 }
1037 return this->Superclass::FinalizeOutputs(particlePathsOutput, interactionOutput);
1038}
1039
1040//------------------------------------------------------------------------------
1041bool vtkPLagrangianParticleTracker::UpdateSurfaceCacheIfNeeded(vtkDataObject*& surfaces)

Callers

nothing calls this directly

Calls 14

GetNumberOfProcessesMethod · 0.80
InsertNextTuple2Method · 0.80
AllGatherVMethod · 0.80
GetTuple2Method · 0.80
SetTuple1Method · 0.80
clearMethod · 0.45
AllocateMethod · 0.45
GetNumberOfCellsMethod · 0.45
SetNumberOfComponentsMethod · 0.45
GetArrayMethod · 0.45
GetCellDataMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected