MCPcopy Create free account
hub / github.com/Kitware/VTK / operator()

Method operator()

Common/DataModel/vtkCellArray.cxx:219–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217{
218 template <class OffsetsT, class ConnectivityT>
219 void operator()(OffsetsT* offsets, ConnectivityT* conn, bool& canConvert) const
220 {
221 using ValueType = GetAPIType<OffsetsT>;
222
223 // offsets are sorted, so just check the last value, but we have to compute
224 // the full range of the connectivity array.
225 auto offsetsRange = GetRange(offsets);
226 if (offsetsRange.size() > 0 && !this->CheckValue(ValueType(*(offsetsRange.end() - 1))))
227 {
228 canConvert = false;
229 return;
230 }
231
232 auto connRange = GetRange(conn);
233 if (connRange.size() > 0)
234 {
235 auto [minIt, maxIt] = std::minmax_element(connRange.begin(), connRange.end());
236 std::array<ValueType, 2> connValueRange = { *minIt, *maxIt };
237 if (!this->CheckValue(ValueType(connValueRange[0])) ||
238 !this->CheckValue(ValueType(connValueRange[1])))
239 {
240 canConvert = false;
241 return;
242 }
243 }
244
245 canConvert = true;
246 }
247
248 template <typename U>
249 bool CheckValue(const U& val) const

Callers

nothing calls this directly

Calls 6

CheckValueMethod · 0.95
GetRangeFunction · 0.50
ValueTypeEnum · 0.50
sizeMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected