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

Method readController

ThirdParty/xdmf3/vtkxdmf3/core/XdmfArray.cpp:1305–1357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1303}
1304
1305void
1306XdmfArray::readController()
1307{
1308 if(mHeavyDataControllers.size() > 1) {
1309 this->release();
1310 for (unsigned int i = 0; i < mHeavyDataControllers.size(); ++i) {
1311 shared_ptr<XdmfArray> tempArray = XdmfArray::New();
1312 mHeavyDataControllers[i]->read(tempArray.get());
1313 unsigned int dimTotal = 1;
1314 for (unsigned int j = 0; j < mHeavyDataControllers[i]->getDimensions().size(); ++j) {
1315 dimTotal *= mHeavyDataControllers[i]->getDimensions()[j];
1316 }
1317 this->insert(mHeavyDataControllers[i]->getArrayOffset(), tempArray, 0, dimTotal, 1, 1);
1318 }
1319 std::vector<unsigned int> returnDimensions;
1320 std::vector<unsigned int> tempDimensions;
1321 // Find the controller with the most dimensions
1322 int dimControllerIndex = 0;
1323 unsigned int dimSizeMax = 0;
1324 unsigned int dimTotal = 0;
1325 for (unsigned int i = 0; i < mHeavyDataControllers.size(); ++i) {
1326 dimTotal += mHeavyDataControllers[i]->getSize();
1327 if (mHeavyDataControllers[i]->getSize() > dimSizeMax) {
1328 dimSizeMax = mHeavyDataControllers[i]->getSize();
1329 dimControllerIndex = i;
1330 }
1331 }
1332 // Total up the size of the lower dimensions
1333 int controllerDimensionSubtotal = 1;
1334 for (unsigned int i = 0;
1335 i < mHeavyDataControllers[dimControllerIndex]->getDimensions().size() - 1;
1336 ++i) {
1337 returnDimensions.push_back(mHeavyDataControllers[dimControllerIndex]->getDimensions()[i]);
1338 controllerDimensionSubtotal *= mHeavyDataControllers[dimControllerIndex]->getDimensions()[i];
1339 }
1340 // Divide the total contained by the dimensions by the size of the lower dimensions
1341 returnDimensions.push_back(dimTotal/controllerDimensionSubtotal);
1342 mDimensions = returnDimensions;
1343 }
1344 else if (mHeavyDataControllers.size() == 1 && mHeavyDataControllers[0]->getArrayOffset() == 0) {
1345 this->release();
1346 mHeavyDataControllers[0]->read(this);
1347 mDimensions = mHeavyDataControllers[0]->getDimensions();
1348 }
1349 else if (mHeavyDataControllers.size() == 1 && mHeavyDataControllers[0]->getArrayOffset() > 0) {
1350 this->release();
1351 shared_ptr<XdmfArray> tempArray = XdmfArray::New();
1352 mHeavyDataControllers[0]->read(tempArray.get());
1353 this->insert(mHeavyDataControllers[0]->getArrayOffset(), tempArray, 0, mHeavyDataControllers[0]->getSize(), 1, 1);
1354 mDimensions = mHeavyDataControllers[0]->getDimensions();
1355 }
1356 this->setIsChanged(true);
1357}
1358
1359void
1360XdmfArray::readReference()

Callers 2

readMethod · 0.95
XDMF_ERROR_WRAP_STARTFunction · 0.80

Calls 11

releaseMethod · 0.95
insertMethod · 0.95
getArrayOffsetMethod · 0.80
setIsChangedMethod · 0.80
getSizeMethod · 0.65
NewFunction · 0.50
sizeMethod · 0.45
readMethod · 0.45
getMethod · 0.45
getDimensionsMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected