Skip to content

Commit

Permalink
Fix bug in 6D AthenaArray copy ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
felker committed Jul 14, 2023
1 parent aa17217 commit beb2879
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/athena_arrays.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ __attribute__((nothrow)) AthenaArray<T>::AthenaArray(const AthenaArray<T>& src)
nx5_ = src.nx5_;
nx6_ = src.nx6_;
if (src.pdata_) {
std::size_t size = (src.nx1_)*(src.nx2_)*(src.nx3_)*(src.nx4_)*(src.nx5_);
std::size_t size = (src.nx1_)*(src.nx2_)*(src.nx3_)*(src.nx4_)*(src.nx5_)*(src.nx6_);
pdata_ = new T[size]; // allocate memory for array data
for (std::size_t i=0; i<size; ++i) {
pdata_[i] = src.pdata_[i]; // copy data (not just addresses!) into new memory
Expand Down

0 comments on commit beb2879

Please sign in to comment.