UCL / TDMS

Time Domain Maxwell Solver
https://github-pages.ucl.ac.uk/TDMS
GNU General Public License v3.0
12 stars 4 forks source link

Detach the `EHVec` class from `Matrix` #303

Closed willGraham01 closed 1 year ago

willGraham01 commented 1 year ago

Description

The EHVec class is currently a public Matrix<fftw_complex>. It is desirable to convert Matrix<> to used strided vector storage and remove any MATLAB dependencies.

The former doesn't work for EHVec since the fftw_complex type is a double[2], which throws an error when used in templated std::vector<T> functions. Additionally, EHVec is used in such a way that fftw needs a continuous buffer to perform the forward/backward transform, which a strided vector does not guarantee.

As such, it is necessary to provide EHVec with it's own (MATLAB-free) class. This enables Matrix and its other derivatives to be freed of MATLAB influence.

Testing

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 70% and no project coverage change.

Comparison is base (fdbfc93) 26% compared to head (4154d3d) 26%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #303 +/- ## =================================== Coverage 26% 26% =================================== Files 69 71 +2 Lines 3674 3688 +14 =================================== + Hits 952 957 +5 - Misses 2722 2731 +9 ``` | [Impacted Files](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL) | Coverage Δ | | |---|---|---| | [tdms/include/arrays.h](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2FycmF5cy5o) | `29% <ø> (-3%)` | :arrow_down: | | [tdms/include/arrays/eh\_vec.h](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2FycmF5cy9laF92ZWMuaA==) | `0% <0%> (ø)` | | | [tdms/include/field.h](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2ZpZWxkLmg=) | `0% <ø> (ø)` | | | [...ms/include/simulation\_manager/simulation\_manager.h](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL3NpbXVsYXRpb25fbWFuYWdlci9zaW11bGF0aW9uX21hbmFnZXIuaA==) | `0% <ø> (ø)` | | | [tdms/src/arrays.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvYXJyYXlzLmNwcA==) | `91% <ø> (-<1%)` | :arrow_down: | | [tdms/src/arrays/eh\_vec.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/303?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvYXJyYXlzL2VoX3ZlYy5jcHA=) | `88% <88%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

willGraham01 commented 1 year ago

Totally fine with this... but I'm a bit sad that I can't have a Matrix<std::complex>.

What was the error?

Matrix<std::complex> doesn't complain - it's Matrix<fftw_complex> which does. This is because fftw_complex is a typedef of double[2], and then some obscure error that I think boils down to the fact that an fftw_complex is a double* so can't be used in the template.