Skip to content
Discussion options

You must be logged in to vote

Right, it is not safe to use BoxArray and DistributionMapping saved like that. The technical detail is that the DistributionMapping passed to the Fortran function is a local variable in C++. It's gone after the call. There are three ways if you want to save BoxArray and DistributionMapping.

  1. Do "deep" copy. It's deep in the sense that it will increment a reference counter in C++, not deep-copying all the data.
    call amrex_boxarray_clone(this%ba(level), ba)
    call amrex_disromap_clone(this%dm(level), dm)
  1. Create a shallow copy from a Fortran multifab. If the mulitfab is gone later, the shallow copy will be invalid.
    this%ba(level) = mf%ba
    this%dm(level) = mf%dm
  1. As you have…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pbrady
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants