-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PRHS into a readable class #206
Conversation
extern int matricestosave_all[NOUTMATRICES_WRITE_ALL]; | ||
// indices of the matrices to save when saving a compressed output | ||
extern int matricestosave[NOUTMATRICES_WRITE]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is likely going to clash with my refactoring/reworking. (You weren't to know because I didn't tell you or push to my draft PR).
I went for std::vector<std::string>
(which could be defined as const and live in a namespace). My reasoning: a vector knows its own size_t
and one can do much nicer-looking loops like:
for (auto matrixname : matrixnames) {
file.read(matrixname);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Come to think of it, the matrices in our input and output files define our file type. So perhaps a tdms::File
is a HDF5 of this format.
Co-authored-by: Sam Cunliffe <samcunliffe@users.noreply.github.com>
Looks all good! |
Moving towards #63 |
The argument
prhs
toexecute_simulation
is rather unintuitive, being a hangover from whenmexfunction
was used. With regards to moving towards #70, and making the codebase a bit more readable, this object is broken out into a new classInputMatrices
. This class steals some of the functionality ofopenandorder
, and is designed to make the "unpacking" part ofiterator.cpp
more readable.In theory, we can also do away with the intermediate variables that are defined in
iterator.cpp
and work directly withprhs
now (although that is not recommended for readability purposes).input_counter++
are no longer needed when unpacking the input matrices - they can be accessed by passing in their names.InputMatrices
class, rather than at the start ofexecute_simulation
. This avoids potentially redundant setup/memory allocation.omega
,Nt
, etc stored inSimulationParameters
are now set by calling theunpack_from_input_matrices
method, rather than being done directly insideexecute_simulation
, reducing the code bloat.fprintf
s ->spdlog::info
in line with Use the new logging #87.