Skip to content

Conversation

@RevathiJambunathan
Copy link
Contributor

No description provided.

}

py_MultiFab
.def("copymf",
Copy link
Contributor Author

@RevathiJambunathan RevathiJambunathan Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason, calling this copy did not seem to work
May be there is another copy method that is shadowing this
so I renamed it as copymf and that works!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this different than the copy method exposed here?

Copy link
Contributor Author

@RevathiJambunathan RevathiJambunathan Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using the copy_mfab in the python script and it did not work
So now I am not sure
they look similar, but copy_mfab did not work for me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you use the extension method here, as in this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline
.copy creates another copy and does not do what we want in this PR
where we copy the values from a src to dst multifab and the dst multifab is already allocated and initialized.

@atmyers atmyers enabled auto-merge (squash) May 6, 2025 01:25
@atmyers atmyers merged commit 88f6194 into AMReX-Codes:development May 6, 2025
17 checks passed
RemiLehe added a commit to BLAST-WarpX/warpx that referenced this pull request May 15, 2025
This PR exposes the multifab register so that when we create a local
copy using pyamrex interface in a python script,
1. the multifab gets allocated and initialized
2. this allows the multifab to also be redistributed during load
balancing
3. when finalize is called, the multifab memory is cleared in a clean
way


This PR AMReX-Codes/pyamrex#439) adds wrappers
to ba.convert, ba.surroundingNodes, mf.copy

so now , we could add a new "test_mf" with desired nodality
```
        reg.alloc_init("test_nf",0,warpx.boxArray(0).convert(amrex.IntVect(1,1)),warpx.DistributionMap(0),
                       1,amrex.IntVect(1,1),0.0,True,True)
```


<img width="637" alt="Screenshot 2025-05-14 at 10 58 19 AM"
src="https://github.com/user-attachments/assets/ecc3a5ae-9ce1-4b32-82ad-169167d8dfdb"
/>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Remi Lehe <[email protected]>
atmyers pushed a commit to atmyers/WarpX that referenced this pull request Jul 3, 2025
This PR exposes the multifab register so that when we create a local
copy using pyamrex interface in a python script,
1. the multifab gets allocated and initialized
2. this allows the multifab to also be redistributed during load
balancing
3. when finalize is called, the multifab memory is cleared in a clean
way


This PR AMReX-Codes/pyamrex#439) adds wrappers
to ba.convert, ba.surroundingNodes, mf.copy

so now , we could add a new "test_mf" with desired nodality
```
        reg.alloc_init("test_nf",0,warpx.boxArray(0).convert(amrex.IntVect(1,1)),warpx.DistributionMap(0),
                       1,amrex.IntVect(1,1),0.0,True,True)
```


<img width="637" alt="Screenshot 2025-05-14 at 10 58 19 AM"
src="https://github.com/user-attachments/assets/ecc3a5ae-9ce1-4b32-82ad-169167d8dfdb"
/>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Remi Lehe <[email protected]>
rho-novatron pushed a commit to novatron-fusion/WarpX that referenced this pull request Oct 7, 2025
This PR exposes the multifab register so that when we create a local
copy using pyamrex interface in a python script,
1. the multifab gets allocated and initialized
2. this allows the multifab to also be redistributed during load
balancing
3. when finalize is called, the multifab memory is cleared in a clean
way


This PR AMReX-Codes/pyamrex#439) adds wrappers
to ba.convert, ba.surroundingNodes, mf.copy

so now , we could add a new "test_mf" with desired nodality
```
        reg.alloc_init("test_nf",0,warpx.boxArray(0).convert(amrex.IntVect(1,1)),warpx.DistributionMap(0),
                       1,amrex.IntVect(1,1),0.0,True,True)
```


<img width="637" alt="Screenshot 2025-05-14 at 10 58 19 AM"
src="https://github.com/user-attachments/assets/ecc3a5ae-9ce1-4b32-82ad-169167d8dfdb"
/>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Remi Lehe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants