MCPcopy Create free account
hub / github.com/chrxh/alien / getDataTO

Method getDataTO

source/EngineImpl/AccessDataTOCache.cpp:13–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11}
12
13DataTO _AccessDataTOCache::getDataTO(ArraySizes const& arraySizes)
14{
15 if (_dataTO) {
16 auto existingArraySizes = getArraySizes(*_dataTO);
17 if (fits(existingArraySizes, arraySizes)) {
18 *_dataTO->numCells = 0;
19 *_dataTO->numParticles = 0;
20 *_dataTO->numAuxiliaryData = 0;
21 return *_dataTO;
22 } else {
23 _dataTO->destroy();
24 }
25 }
26 try {
27 DataTO result;
28 result.init(arraySizes);
29 _dataTO = result;
30 return result;
31 } catch (std::bad_alloc const&) {
32 throw std::runtime_error("There is not sufficient CPU memory available.");
33 }
34}
35
36bool _AccessDataTOCache::fits(ArraySizes const& left, ArraySizes const& right) const
37{

Callers 1

provideTOMethod · 0.80

Calls 1

initMethod · 0.45

Tested by

no test coverage detected