NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.17k stars 598 forks source link

Add `flux` member function for class `dft_near2far` in C++ and `DftNear2Far` in Python #2670

Open oskooi opened 9 months ago

oskooi commented 9 months ago

Fixes #2665.

Requires a (working) SWIG wrapper and a unit test.

codecov-commenter commented 9 months ago

Codecov Report

Merging #2670 (1cf5550) into master (e908ef8) will decrease coverage by 0.01%. The diff coverage is 50.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #2670      +/-   ##
==========================================
- Coverage   73.81%   73.81%   -0.01%     
==========================================
  Files          18       18              
  Lines        5294     5296       +2     
==========================================
+ Hits         3908     3909       +1     
- Misses       1386     1387       +1     
Files Coverage Δ
python/simulation.py 77.04% <50.00%> (-0.03%) :arrow_down:
oskooi commented 9 months ago

Turns out this feature is more challenging to implement than I originally thought because add_near2far does not center its DFT fields on the Yee-grid voxels unlike add_flux (see #2538 (comment) for more details). This is why the Poynting flux calculation in add_flux is trivial.