-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Added an SiDB simulation file writer (#176)
* ✨ Added a new unified return type for SiDB simulation * ✨ Added a file writer for SQD simulation runs parsable by SiQAD * 📝 Added and fixed docstrings * 📝 Added RST documentation * 📝 Removed superfluous newlines * 🎨 Incorporated clang-tidy's recommendations * 🎨 Rewrote `any_to_string` to be more performant and extensible * 🐛 Replaced the usage of the custom charge to string function with the one provided by `sidb_charge_state.hpp` * ✅ Added a test case for positive SiDBs * ✅ Added test cases for `any_to_string` * 🎨 ClangFormat changes Signed-off-by: ClangFormat <[email protected]> * 🐛 Added `inline` to `any_to_string` in order to avoid ODR problems * ✅ Fixed the test case * 🎨 ClangFormat changes Signed-off-by: ClangFormat <[email protected]> * 👽 Convert nm to Angstrom * 👽 Round distances and energy values to 6 decimal points * ✅ Added additional tests to cover more lines * 🎨 ClangFormat changes Signed-off-by: ClangFormat <[email protected]> --------- Signed-off-by: ClangFormat <[email protected]> Co-authored-by: ClangFormat <[email protected]>
- Loading branch information
Showing
6 changed files
with
722 additions
and
7 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
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
67 changes: 67 additions & 0 deletions
67
include/fiction/algorithms/simulation/sidb/sidb_simulation_result.hpp
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,67 @@ | ||
// | ||
// Created by marcel on 05.04.23. | ||
// | ||
|
||
#ifndef FICTION_SIDB_SIMULATION_RESULT_HPP | ||
#define FICTION_SIDB_SIMULATION_RESULT_HPP | ||
|
||
#include "fiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp" | ||
#include "fiction/technology/charge_distribution_surface.hpp" | ||
|
||
#include <any> | ||
#include <chrono> | ||
#include <cstdint> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace fiction | ||
{ | ||
|
||
/** | ||
* This struct defines a unified return type for all SiDB simulation algorithms. It contains the name of the algorithm, | ||
* the total simulation runtime, the charge distributions determined by the algorithm, the physical parameters used in | ||
* the simulation, and (optional) algorithm-specific named simulation parameters. | ||
* | ||
* @tparam Lyt Cell-level layout type. | ||
*/ | ||
template <typename Lyt> | ||
struct sidb_simulation_result | ||
{ | ||
/** | ||
* Default constructor. It only exists to allow for the use of `static_assert` statements that restrict the type of | ||
* `Lyt`. | ||
*/ | ||
sidb_simulation_result() noexcept | ||
{ | ||
static_assert(is_cell_level_layout_v<Lyt>, "Lyt is not a cell-level layout"); | ||
static_assert(has_sidb_technology_v<Lyt>, "Lyt is not an SiDB layout"); | ||
} | ||
/** | ||
* Name of the algorithm used to determine the charge distributions. | ||
*/ | ||
std::string algorithm_name{}; | ||
/** | ||
* Total simulation runtime. | ||
*/ | ||
std::chrono::duration<double> simulation_runtime{}; | ||
/** | ||
* Charge distributions determined by the algorithm. | ||
*/ | ||
std::vector<charge_distribution_surface<Lyt>> charge_distributions{}; | ||
/** | ||
* Physical parameters used in the simulation. | ||
*/ | ||
sidb_simulation_parameters physical_parameters{}; | ||
/** | ||
* Additional named simulation parameters. This is used to store algorithm-dependent parameters that are not part of | ||
* the `physical_parameters` struct. | ||
* | ||
* The first element of the pair is the name of the parameter, the second element is the value of the parameter. | ||
*/ | ||
std::vector<std::pair<std::string, std::any>> additional_simulation_parameters{}; | ||
}; | ||
|
||
} // namespace fiction | ||
|
||
#endif // FICTION_SIMULATION_RESULT_HPP |
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
Oops, something went wrong.