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 `XYZVector` from MATLAB #315

Closed willGraham01 closed 1 year ago

willGraham01 commented 1 year ago

Detaches XYZVector class from MATLAB

The XYZVector class was previously a collection of three double * pointers, which were cast to mxGetPr or similar.

This PR allows HDF5Reader.read() to read an XYZVector, rather than us needing to rely on the MATLAB API.

It also detaches the following classes from MATLAB, which depended on XYZVector:

material_collections.h

This file reworks the old MaterialCollection, CCollectionBase, CCollection, CMaterial, DCollectionBase, DCollection, DMaterial classes. There are now just 4 structs to hold the data that these classes previously contained, CMaterial, CCollection, DMaterial and DCollection. The two "D" objects are actually identical save for the group in the input file that they read from, so are just typedefs of a slightly more general DBase class so that we avoid repeating definitions for the HDF5Reader.read() method.

Speaking of which, HDF5Reader.read() can now read in these 4 new classes.

Testing

Existing tests have been preserved, where possible. Since the majority of the new classes in material_collections.h are now simply structs that reply on std::vector functionality, their unit tests are no longer present.

In their place are unit tests for the new overloads of the HDF5Reader.read() method, for reading each of the new classes and reworked XYZVector class in.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 54% and project coverage change: -1 :warning:

Comparison is base (b6de664) 27% compared to head (a0ba713) 26%.

:exclamation: Current head a0ba713 differs from pull request most recent head 56cae1e. Consider uploading reports for the commit 56cae1e to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #315 +/- ## =================================== - Coverage 27% 26% -1% =================================== Files 77 78 +1 Lines 3687 3671 -16 =================================== - Hits 978 947 -31 - Misses 2709 2724 +15 ``` | [Impacted Files](https://app.codecov.io/gh/UCL/TDMS/pull/315?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/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2FycmF5cy5o) | `33% <ø> (-13%)` | :arrow_down: | | [tdms/include/arrays/xyz\_vector.h](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2FycmF5cy94eXpfdmVjdG9yLmg=) | `0% <0%> (ø)` | | | [tdms/include/hdf5\_io/hdf5\_base.h](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2hkZjVfaW8vaGRmNV9iYXNlLmg=) | `0% <ø> (ø)` | | | [tdms/include/hdf5\_io/hdf5\_reader.h](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2hkZjVfaW8vaGRmNV9yZWFkZXIuaA==) | `0% <0%> (ø)` | | | [...s/include/simulation\_manager/objects\_from\_infile.h](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL3NpbXVsYXRpb25fbWFuYWdlci9vYmplY3RzX2Zyb21faW5maWxlLmg=) | `0% <ø> (ø)` | | | [tdms/src/arrays.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvYXJyYXlzLmNwcA==) | `94% <ø> (+3%)` | :arrow_up: | | [tdms/src/simulation\_manager/loop\_variables.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvc2ltdWxhdGlvbl9tYW5hZ2VyL2xvb3BfdmFyaWFibGVzLmNwcA==) | `0% <0%> (ø)` | | | [...dms/src/simulation\_manager/objects\_from\_infile.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvc2ltdWxhdGlvbl9tYW5hZ2VyL29iamVjdHNfZnJvbV9pbmZpbGUuY3Bw) | `0% <0%> (ø)` | | | [tdms/src/simulation\_parameters.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvc2ltdWxhdGlvbl9wYXJhbWV0ZXJzLmNwcA==) | `1% <0%> (-<1%)` | :arrow_down: | | [tdms/src/arrays/xyz\_vector.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvYXJyYXlzL3h5el92ZWN0b3IuY3Bw) | `71% <71%> (ø)` | | | ... and [2 more](https://app.codecov.io/gh/UCL/TDMS/pull/315?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL) | | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/UCL/TDMS/pull/315/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL)

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