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

Function GetSampleIntArray

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

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

Source from the content-addressed store, hash-verified

30
31//------------------------------------------------------------------------------
32vtkIntArray* GetSampleIntArray(const int numTuples, const int numComp)
33{
34 assert("pre: numTuples > 0" && (numTuples > 0));
35 assert("pre: numComp > 0" && (numComp > 0));
36
37 vtkIntArray* array = vtkIntArray::New();
38 array->SetNumberOfComponents(numComp);
39 array->SetNumberOfTuples(numTuples);
40
41 std::ostringstream oss;
42 oss << "SampleIntArray-" << numComp;
43 array->SetName(oss.str().c_str());
44
45 int* ptr = array->GetPointer(0);
46 int idx = 0;
47 for (int i = 0; i < numTuples; ++i)
48 {
49 for (int j = 0; j < numComp; ++j)
50 {
51 ptr[i * numComp + j] = idx;
52 ++idx;
53 } // END for all components
54 } // END for all tuples
55
56 return (array);
57}
58
59//------------------------------------------------------------------------------
60vtkDoubleArray* GetSampleDoubleArray(const int numTuples, const int numComp)

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