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

Function SaveCoords

IO/NetCDF/vtkNetCDFCFWriter.cxx:107–135  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

105
106//------------------------------------------------------------------------------
107void SaveCoords(int ncid, int attributeType, const std::array<int, 3>& coordid,
108 const std::array<std::vector<double>, 3>& coord, const std::array<int, 3>& boundsid,
109 std::array<std::vector<std::array<double, 2>>, 3> bounds)
110{
111 int status;
112 for (int i = 0; i < 3; ++i)
113 {
114 if ((status = nc_put_var_double(ncid, coordid[i], coord[i].data())))
115 {
116 std::ostringstream ostr;
117 ostr << "Error nc_put_var_double " << COORD_NAME[attributeType][i] << ": "
118 << nc_strerror(status);
119 throw std::runtime_error(ostr.str());
120 }
121 }
122 if (attributeType == vtkDataObject::CELL)
123 {
124 for (int i = 0; i < 3; ++i)
125 {
126 if ((status = nc_put_var_double(ncid, boundsid[i], bounds[i][0].data())))
127 {
128 std::ostringstream ostr;
129 ostr << "Error nc_put_var_double " << BOUNDS_NAME[attributeType][i] << ": "
130 << nc_strerror(status);
131 throw std::runtime_error(ostr.str());
132 }
133 }
134 }
135}
136
137//------------------------------------------------------------------------------
138void GetCoords(vtkImageData* id, int attributeType, std::array<std::vector<double>, 3>* coord,

Callers 1

WriteDataMethod · 0.85

Calls 4

nc_put_var_doubleFunction · 0.85
nc_strerrorFunction · 0.85
dataMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected