Laghos time-integration

This commit is contained in:
camierjs
2018-08-20 19:49:39 -07:00
parent 946d8be360
commit bf1ca5c0d7
8 changed files with 48 additions and 20 deletions
+3 -1
View File
@@ -63,12 +63,14 @@ int Array::ResizeData(const Layout *lt, std::size_t item_size)
const std::size_t new_bytes = lt->Size()*item_size;
if (data.size() < new_bytes )
{
dbg("Alloc");
data = lt->Alloc(new_bytes);
slice = data;
// If memory allocation fails - an exception is thrown.
}
else if (slice.size() != new_bytes)
{
dbg("slice");
slice = data.slice(0, new_bytes);
}
pop();
@@ -78,12 +80,12 @@ int Array::ResizeData(const Layout *lt, std::size_t item_size)
// *****************************************************************************
void *Array::DoPullData(void *buffer, std::size_t item_size)
{
push();
if (!slice.getDevice().hasSeparateMemorySpace())
{
pop();
return slice.ptr();
}
push();
if (buffer)
{
slice.copyTo(buffer);