-
Notifications
You must be signed in to change notification settings - Fork 52
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
File IO improvements #319
File IO improvements #319
Conversation
- Modified the Parameters_Method_* and Method_* source files - Modified Logging, State, Configparser and Configwriter source files - Modified the default input file and the input files of the unit tests - Modified the INPUT documentation
- Added IO test - Improved OVF writer - Added IO files of unit tests to gitignore - Added gitkeep in IO folder of unit tests
4067c02
to
54cf96f
Compare
- Improved IO test - Added Require_Single() method in Filter_File_Handle
Many changes must be made so I am making a comprehensive task list (will be extended): High Priority:
Medium Priority:
Low Priority:
|
- added SPIRIT in name of corresponding VF_FileFormat - extended OVF to OVF_bin8, OVF_bin4 and OVF_text - added Save_to_SPIRIT() for every SPIRIT fileformat - changed parameters to Datawriter.cpp functions for images to vectorfield and geometry - added comments to IO test - improved code formating and indentation
485474f
to
b7866c7
Compare
- rectangular mesh - 8byte binary - text - Split the data writing in different functions
- renamed Write_Spin_Configurations_Chain() to Write_Chain_Spin_Configuration() - added Write_SPIRIT_Version() - implemented IO_Chain_Append() - added comment argument in IO_Chain_Write/Append() - comment is initialized as dash "-" - OVF "valuedim" is now called by RequiredSingle() in Read_From_OVF() - renamed functions IO_Write_System_*() to IO_Chain_Write_*() - renamed function IO*System*() to IO*Image*() - extended API IO test - extended Python API IO test - modified python wrapping - modified corresponding documentation
f16d8d0
to
3763cb5
Compare
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.
Too many things are being done at once, we need to merge this soon and break up the remaining tasks into smaller PRs, or I will not be able to properly review all the changes.
core/src/io/Datawriter.cpp
Outdated
// Data | ||
output_to_file += fmt::format( "# Begin: data {}\n", datatype ); | ||
|
||
switch ( format ) { |
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.
Switch statements on the format give a warning such as 4 enumeration values not handled in switch: 'OVF_BIN8', 'OVF_BIN4', 'OVF_TEXT'... [-Wswitch]
. When only 3 cases are treated it may be better to just use if
/else
.
core/src/engine/Method_GNEB.cpp
Outdated
{ | ||
// File name | ||
std::string chainFile = preChainFile + suffix + ".txt"; | ||
|
||
// Chain | ||
IO::Save_SpinChain_Configuration(this->chain, iteration, chainFile); | ||
}; | ||
std::string output_comment( "Iteration: " + iteration ); |
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.
Rather write std::string output_comment = fmt::format("Iteration: {}", iteration));
, see the warning this produces: warning: adding 'const int' to a string does not append to the string [-Wstring-plus-int]
@@ -0,0 +1,9 @@ | |||
// This is provided for homogeneous exception handling between core and C++ UIs |
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.
I removed this file with e26d546, it should be removed on this branch, too, as no exception should ever pass the API layer.
long int n_iterations, long int n_iterations_log, long int max_walltime_sec, | ||
std::shared_ptr<Pinning> pinning, scalar force_convergence); | ||
Parameters_Method(std::string output_folder, std::string output_file_tag, | ||
std::array<bool,3> output, long int n_iterations, long int n_iterations_log, |
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.
You said that bundlling some of the parameters toghether, which are passed into several constructors may be a good idea. I guess the config of the output would be a good place to start - something along the lines of:
struct Output_Config
{
std::string folder;
bool any;
bool initial;
bool final;
}
This would shorten the constructors of the parameters and make them clearer.
Note: indentation in the Parameters files is messed up, please normalize it to spaces.
core/src/engine/Method_GNEB.cpp
Outdated
} | ||
std::string fileTag; | ||
|
||
if (this->systems[0]->llg_parameters->output_file_tag == "<time>") |
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.
As the tag has been abstracted as a parameter across all Method
s, it would make sense to get this from a function.
However, it's important to use the child class Parameters
member, (i.e. gneb_parameters
in the GNEB case)!
At least the latter should be fixed in this PR.
@@ -54,10 +58,11 @@ namespace IO | |||
if (readability_toggle) header = separator + line + separator; | |||
else header = line; | |||
if (!readability_toggle) std::replace( header.begin(), header.end(), '|', ' '); | |||
String_to_File(header, fileName); |
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.
All the formatting changes (indentation, where you break lines etc... and now this kind of change... You do too much of this at once! This PR is very hard to keep track of, as you pile a lot of these aesthetic changes on top of the refactoring. Please try to keep this to a minimum and rather create another PR later, where you only do clean-up.
- Implemented OVF binary 4 - OVF binary writing independently of scalar length
- Corrected comments in Datawriter for OVF - Added all the OVF formats in the unit test
d52ea41
to
4b4e9d3
Compare
- Some switch statements converted to ifs - Changed buffer to array when reading and writing OVF - Changed output_comment declaration in Method_GNEB.cpp
4b4e9d3
to
88989c6
Compare
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.
I would say this PR is ready to be merged.
A few issues can be closed with this and the remaining should be tackled with further PRs.
addressees #31 #193 and #312