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

Function GetSampleFloatArray

Parallel/Core/Testing/Cxx/TestFieldDataSerialization.cxx:88–113  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

86
87//------------------------------------------------------------------------------
88vtkFloatArray* GetSampleFloatArray(const int numTuples, const int numComp)
89{
90 assert("pre: numTuples > 0" && (numTuples > 0));
91 assert("pre: numComp > 0" && (numComp > 0));
92
93 vtkFloatArray* array = vtkFloatArray::New();
94 array->SetNumberOfComponents(numComp);
95 array->SetNumberOfTuples(numTuples);
96
97 std::ostringstream oss;
98 oss << "SampleFloatArray-" << numComp;
99 array->SetName(oss.str().c_str());
100
101 float* ptr = array->GetPointer(0);
102 float val = 0.5;
103 for (int i = 0; i < numTuples; ++i)
104 {
105 for (int j = 0; j < numComp; ++j)
106 {
107 ptr[i * numComp + j] = val;
108 ++val;
109 } // END for all components
110 } // END for all tuples
111
112 return (array);
113}
114
115//------------------------------------------------------------------------------
116vtkPointData* GetSamplePointData(const int numTuples)

Callers 1

GetSamplePointDataFunction · 0.85

Calls 8

assertFunction · 0.50
NewFunction · 0.50
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
SetNameMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45
GetPointerMethod · 0.45

Tested by

no test coverage detected