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

Method CreateVTKAttributeArray

IO/AMR/vtkAMReXGridReaderInternal.h:272–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270
271template <typename T>
272void vtkAMReXGridReaderInternal::CreateVTKAttributeArray(vtkAOSDataArrayTemplate<T>* dataArray,
273 const RealDescriptor* ord, const RealDescriptor* ird,
274 const std::vector<std::vector<char>>& buffers, std::size_t numberOfPoints,
275 const std::string& attribute)
276{
277 int nComps = static_cast<int>(this->Header->parsedVariableNames[attribute].size());
278 if (nComps == 0) // check if the variable is in an extra fab
279 {
280 nComps = static_cast<int>(this->Header->extraMultiFabParsedVarNames[attribute].size());
281 }
282 if (nComps == 0)
283 {
284 return;
285 }
286 dataArray->SetName(attribute.c_str());
287 dataArray->SetNumberOfComponents(nComps);
288 dataArray->SetNumberOfTuples(numberOfPoints);
289 T* arrayPtr = new T[numberOfPoints];
290 for (int j = 0; j < nComps; ++j)
291 {
292 this->Convert(arrayPtr, buffers[j].data(), numberOfPoints, *ord, *ird);
293
294 // Copy to data array component
295 for (std::size_t i = 0; i < numberOfPoints; ++i)
296 {
297 dataArray->SetTypedComponent(i, j, arrayPtr[i]);
298 }
299 }
300 delete[] arrayPtr;
301}
302
303// ----------------------------------------------------------------------------
304// Class vtkAMReXGridReaderInternal ( end )

Callers 2

GetBlockAttributeMethod · 0.95

Calls 8

ConvertMethod · 0.95
sizeMethod · 0.45
SetNameMethod · 0.45
c_strMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
dataMethod · 0.45
SetTypedComponentMethod · 0.45

Tested by

no test coverage detected