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

Method FillDataTypes

IO/ParallelXML/vtkXMLPUniformGridAMRWriter.cxx:65–111  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

63
64//------------------------------------------------------------------------------
65void vtkXMLPUniformGridAMRWriter::FillDataTypes(vtkCompositeDataSet* cdInput)
66{
67 this->Superclass::FillDataTypes(cdInput);
68
69 if (!this->Controller)
70 {
71 return;
72 }
73
74 int myid = this->Controller->GetLocalProcessId();
75 int numProcs = this->Controller->GetNumberOfProcesses();
76 unsigned int numLeafNodes = this->GetNumberOfDataTypes();
77 int* myDataTypes = this->GetDataTypesPointer();
78 if (numProcs == 1 || numLeafNodes == 0)
79 {
80 return;
81 }
82
83 if (myid == 0)
84 {
85 // Collect information about data-types from all satellites and the
86 // "combine" the information. Only the root-node needs to have the
87 // combined information, since only the root-node writes the XML.
88 int* gathered_data_types = new int[numLeafNodes * numProcs];
89 for (unsigned int cc = 0; cc < numProcs * numLeafNodes; cc++)
90 {
91 gathered_data_types[cc] = -1;
92 }
93 this->Controller->Gather(myDataTypes, gathered_data_types, numLeafNodes, 0);
94
95 for (int procNo = 1; procNo < numProcs; procNo++)
96 {
97 for (unsigned int pieceNo = 0; pieceNo < numLeafNodes; pieceNo++)
98 {
99 if (myDataTypes[pieceNo] == -1 && gathered_data_types[procNo * numLeafNodes + pieceNo] >= 0)
100 {
101 myDataTypes[pieceNo] = gathered_data_types[procNo * numLeafNodes + pieceNo];
102 }
103 }
104 }
105 delete[] gathered_data_types;
106 }
107 else
108 {
109 this->Controller->Gather(myDataTypes, nullptr, numLeafNodes, 0);
110 }
111}
112VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 5

GetNumberOfProcessesMethod · 0.80
GetNumberOfDataTypesMethod · 0.80
GetDataTypesPointerMethod · 0.80
GetLocalProcessIdMethod · 0.45
GatherMethod · 0.45

Tested by

no test coverage detected