Skip to content

Commit

Permalink
fix FArrayBox I/O for gpu. resize is not safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Mar 2, 2019
1 parent b25ac20 commit 749721f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Src/Base/AMReX_FArrayBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ FABio::read_header (std::istream& is,
//
// Set the FArrayBox to the appropriate size.
//
f.resize(bx,nvar);
if (f.box() != bx || f.nComp() != nvar) {
f.resize(bx,nvar);
}
is.ignore(BL_IGNORE_MAX, '\n');
switch (typ_in)
{
Expand All @@ -527,7 +529,9 @@ FABio::read_header (std::istream& is,
//
// Set the FArrayBox to the appropriate size.
//
f.resize(bx,nvar);
if (f.box() != bx || f.nComp() != nvar) {
f.resize(bx,nvar);
}
is.ignore(BL_IGNORE_MAX, '\n');
fio = new FABio_binary(rd);
}
Expand Down Expand Up @@ -575,7 +579,9 @@ FABio::read_header (std::istream& is,
//
// Set the FArrayBox to the appropriate size.
//
f.resize(bx,nvar);
if (f.box() != bx || f.nComp() != nvar) {
f.resize(bx,nvar);
}
is.ignore(BL_IGNORE_MAX, '\n');
switch (typ_in)
{
Expand Down Expand Up @@ -604,7 +610,9 @@ FABio::read_header (std::istream& is,
//
// Set the FArrayBox to the appropriate size.
//
f.resize(bx,nvar);
if (f.box() != bx || f.nComp() != nvar) {
f.resize(bx,nvar);
}
is.ignore(BL_IGNORE_MAX, '\n');
fio = new FABio_binary(rd);
}
Expand Down

0 comments on commit 749721f

Please sign in to comment.