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

Method CopyFieldData

Filters/Geometry/vtkStructuredGridConnectivity.cxx:1264–1296  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1262
1263//------------------------------------------------------------------------------
1264void vtkStructuredGridConnectivity::CopyFieldData(
1265 vtkFieldData* source, vtkIdType sourceIdx, vtkFieldData* target, vtkIdType targetIdx)
1266{
1267 assert("pre: source field data is nullptr!" && (source != nullptr));
1268 assert("pre: target field data is nullptr!" && (target != nullptr));
1269 assert("pre: source number of arrays does not match target!" &&
1270 source->GetNumberOfArrays() == target->GetNumberOfArrays());
1271
1272 int arrayIdx = 0;
1273 for (; arrayIdx < source->GetNumberOfArrays(); ++arrayIdx)
1274 {
1275 // Get source array
1276 vtkDataArray* sourceArray = source->GetArray(arrayIdx);
1277 assert("ERROR: encountered nullptr source array" && (sourceArray != nullptr));
1278
1279 // Get target array
1280 vtkDataArray* targetArray = target->GetArray(arrayIdx);
1281 assert("ERROR: encountered nullptr target array" && (targetArray != nullptr));
1282
1283 // Sanity checks
1284 assert("ERROR: target/source array name mismatch!" &&
1285 (strcmp(sourceArray->GetName(), targetArray->GetName()) == 0));
1286 assert("ERROR: target/source array num components mismatch!" &&
1287 (sourceArray->GetNumberOfComponents() == targetArray->GetNumberOfComponents()));
1288 assert("ERROR: sourceIdx out-of-bounds!" && (sourceIdx >= 0) &&
1289 (sourceIdx < sourceArray->GetNumberOfTuples()));
1290 assert("ERROR: targetIdx out-of-bounds!" && (targetIdx >= 0) &&
1291 (targetIdx < targetArray->GetNumberOfTuples()));
1292
1293 // Copy the tuple
1294 targetArray->SetTuple(targetIdx, sourceIdx, sourceArray);
1295 } // END for all arrays
1296}
1297
1298//------------------------------------------------------------------------------
1299void vtkStructuredGridConnectivity::TransferRegisteredDataToGhostedData(int gridID)

Calls 7

assertFunction · 0.50
GetNumberOfArraysMethod · 0.45
GetArrayMethod · 0.45
GetNameMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
SetTupleMethod · 0.45

Tested by

no test coverage detected