AMReX-Codes / amrex

AMReX: Software Framework for Block Structured AMR
https://amrex-codes.github.io/amrex
Other
530 stars 343 forks source link

Templating FillPatchUtil functions #722

Open bsrunnels opened 4 years ago

bsrunnels commented 4 years ago

Many of the utility functions used for regridding in AMReX_FillPatchUtil.cpp (InterpFromCoarseLevel, InterpFromCoarseLevel, etc) are implemented for MultiFabs. We fairly extensively use FabArrays of BaseFab<T> for a variety of T types (vectors, material models, etc., all of which have the appropriate arithmetic operators.)

However, without the Fill Patch routines, all of our custom FabArrays currently have to be torn down and rebuilt from scratch after every regridding step. Would it be possible to extend the current FillPatchUtil utilities so that they are templated for any FabArray<BaseFab<T>>instead of just MultiFabs?

(Or is there another way to do this that I'm not thinking of?)

WeiqunZhang commented 4 years ago

Yes, I think it's doable. I will give it a try next week.

bsrunnels commented 4 years ago

I'm looking into implementing this now. I believe templating these functions would require moving the definitions into the header file and inlining them. Are there any issues with doing that?

WeiqunZhang commented 4 years ago

I have actually started this. I need to do more testing before merging.

bsrunnels commented 4 years ago

Oh, ok great. What branch are you working on? I can start toying with integrating now - can also help with testing if that would be useful.

WeiqunZhang commented 4 years ago

I am currently trying to figure out why in some places template deduction fails.

WeiqunZhang commented 4 years ago

I have a meeting this morning. I will try to push it this afternoon for you to test.

WeiqunZhang commented 4 years ago

Could you try weiqun/dev branch?

bsrunnels commented 4 years ago

Working on it now. Will let you know. Thanks!