-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infrastructure for removing
MATLAB
(#281)
* Skeleton for new method * FrequencyVectors use std::vectors instead of our custom object as members. [DOESN'T COMPILE YET] - FrequencyVectors is now just a struct that uses std::vector datatypes - SimualationManager is broken, along with most parts of the codebase that use FrequencyVectors - Pending update to allow code to COMPILE * Allow TDMS to actually be compiled again. [TESTS STILL FAIL, READER METHOD NOT READY YET] - Move .mat data generation scripts for unit tests into benchmarking folder - Adjust paths to unit test data accordingly - InputMatrices stores the filename so that we can minimise disruption as we transition away from MATLAB * IT WORKS * Create the abstract H5Dimensions class to ease reading objects. - Update HDF5Base::shape_of to return instances of this class - Add unit tests for class - Update HDF5Reader method to avoid recycled code * Remove MATLAB pointers to InterfaceComponents in initialisation. - simulation_manager can now instantate these members using HDF5Reader rather than still relying on the old InputMatrices object * Add docstrings to files touched * Produce unit test binaries on CI rather than track in repo * - Detaches MATLAB from Cuboid class. - Turns Cuboid class into a struct because MATLAB is now gone. - Adds failure-case checks to HDF5Reader::read() functions. Squashed commit of the following: commit ce8d15e311e9dbb93bd7d7fbcd6c9cffe69657e3 Author: willGraham01 <[email protected]> Date: Fri May 5 15:19:51 2023 +0100 Rename shapes.h to cuboid.h because that's all it contains commit fe83f568c3da7491d450693574975df90a3f15e1 Author: willGraham01 <[email protected]> Date: Fri May 5 15:13:48 2023 +0100 Fix faulty logic thrown up by test commit b37a89f031519c6a356b50f91a12ad8867b78333 Author: willGraham01 <[email protected]> Date: Fri May 5 15:01:58 2023 +0100 Allow tdms to actually compile commit d7c982b9165e3ae4ccf3f42e0fb8c5cdde55b644 Author: willGraham01 <[email protected]> Date: Fri May 5 14:31:43 2023 +0100 Write unit test and read method for Cuboid. Add failure test for FrequencyVectors - Add new .m script to produce an input file with bad object data - Update unit_test_utils with this new filepath - Write HDF5Reader(Cuboid *cube) method and unit test - Add failure-test check for FrequencyVectors using bad data file commit cf61970d2052ab02ae23822f0edd28e89044734f Author: willGraham01 <[email protected]> Date: Fri May 5 14:12:11 2023 +0100 Change Cuboid to be a struct because a class is overkill * Use one master script for setting up .mat files for unit tests. - setup_unit_tests.m now calls all the other data-generating scripts in the folder to save updating the ci.yaml each time.
- Loading branch information
1 parent
135c048
commit eac765d
Showing
32 changed files
with
501 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,11 @@ jobs: | |
- name: Set up MATLAB | ||
uses: matlab-actions/[email protected] | ||
|
||
- name: Produce MATLAB unit test data | ||
uses: matlab-actions/run-command@v1 | ||
with: | ||
command: cd('tdms/tests/unit/matlab_benchmark_scripts/'), setup_unit_tests | ||
|
||
# ------------------------------------------------------------------------------- | ||
# Ubuntu | ||
- name: Install dependencies for Ubuntu | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include "mat_io.h" | ||
|
||
/** | ||
* @brief Defines a cuboid by specifying the first and last Yee cells in each | ||
axial direction that form part of the cube. | ||
* | ||
* @details For example, { 0, 5, 2, 7, 1, 10 } corresponds to the cuboid that | ||
contains all Yee cells indexed (i,j,k) where; | ||
* 0 <= i <= 5, | ||
* 2 <= j <= 7, | ||
* 1 <= k <= 10. | ||
* | ||
* TODO: Check inclusivity of the inequalities above. | ||
*/ | ||
struct Cuboid { | ||
int array[6] = {0, 0, 0, 0, 0, 0}; | ||
|
||
int operator[](int index) const { return array[index]; } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include <algorithm> | ||
#include <vector> | ||
|
||
#include <H5Cpp.h> | ||
|
||
class H5Dimension : public std::vector<hsize_t> { | ||
public: | ||
H5Dimension() = default; | ||
H5Dimension(const H5::DataSpace &data_space); | ||
|
||
/** | ||
* @brief Whether these dimensions describe an array that is castable to a 1D | ||
* array. | ||
* @details In the event that these dimensions only have one entry, or at | ||
* most one of the entries is greater than 1, the shape described can be cast | ||
* to a 1D-array of length max_dim(). | ||
* | ||
* @return true These dimensions describe (an object castable to) a 1D-array | ||
* @return false Otherwise | ||
*/ | ||
bool is_1D() const; | ||
|
||
/** | ||
* @brief Returns the dimension of the greatest extent. | ||
* @details For instances where is_1D() returns true, this conincides with the | ||
* number of elements in the array, and the length of a 1D array necessary to | ||
* hold all the elements. | ||
* | ||
* @return hsize_t | ||
*/ | ||
hsize_t max_dim() const { return *std::max_element(begin(), end()); }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "hdf5_io/hdf5_dimension.h" | ||
|
||
#include <algorithm> | ||
|
||
using namespace std; | ||
|
||
H5Dimension::H5Dimension(const H5::DataSpace &data_space) { | ||
// Fetch rank to declare the vector size | ||
int rank = data_space.getSimpleExtentNdims(); | ||
// Resize to the correct rank then populate entries with the data | ||
resize(rank); | ||
data_space.getSimpleExtentDims(data(), nullptr); | ||
} | ||
|
||
bool H5Dimension::is_1D() const { | ||
int n_non_trivial_dimensions = 0; | ||
if (size() != 1) { | ||
for (hsize_t dim : *this) { | ||
if (dim > 1) { n_non_trivial_dimensions++; } | ||
} | ||
} | ||
return n_non_trivial_dimensions <= 1; | ||
} |
Oops, something went wrong.