Skip to content

Commit

Permalink
🎨 small fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewniok committed Nov 11, 2024
1 parent 86c9b77 commit 50c60b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ inline void write_sidb_layout_svg_impl(pybind11::module& m)
fiction::write_sidb_layout_svg(layout, oss, params); // Write to the stream
return oss.str(); // Return the string content
},
"layout"_a, "ps"_a = fiction::write_sidb_layout_svg_params{});
"layout"_a, "ps"_a = fiction::write_sidb_layout_svg_params{}, DOC(fiction_write_sidb_layout_svg));
}

} // namespace detail
Expand All @@ -55,16 +55,21 @@ void write_sidb_layout_svg(pybind11::module& m)
namespace py = pybind11;
using namespace pybind11::literals;

py::enum_<fiction::color_mode>(m, "color_mode")
.value("LIGHT", fiction::color_mode::LIGHT)
.value("DARK", fiction::color_mode::DARK);
py::enum_<fiction::color_mode>(m, "color_mode", DOC(fiction_color_mode))
.value("LIGHT", fiction::color_mode::LIGHT, DOC(fiction_color_mode_LIGHT))
.value("DARK", fiction::color_mode::DARK, DOC(fiction_color_mode_DARK));

py::class_<fiction::write_sidb_layout_svg_params>(m, "write_sidb_layout_svg_params")
py::class_<fiction::write_sidb_layout_svg_params>(m, "write_sidb_layout_svg_params",
DOC(fiction_write_sidb_layout_svg_params))
.def(py::init<>())
.def_readwrite("lattice_point_size", &fiction::write_sidb_layout_svg_params::lattice_point_size)
.def_readwrite("sidb_size", &fiction::write_sidb_layout_svg_params::sidb_size)
.def_readwrite("sidb_border_width", &fiction::write_sidb_layout_svg_params::sidb_border_width)
.def_readwrite("color_background", &fiction::write_sidb_layout_svg_params::color_background);
.def_readwrite("lattice_point_size", &fiction::write_sidb_layout_svg_params::lattice_point_size,
DOC(fiction_write_sidb_layout_svg_params_lattice_point_size))
.def_readwrite("sidb_size", &fiction::write_sidb_layout_svg_params::sidb_size,
DOC(fiction_write_sidb_layout_svg_params_sidb_size))
.def_readwrite("sidb_border_width", &fiction::write_sidb_layout_svg_params::sidb_border_width,
DOC(fiction_write_sidb_layout_svg_params_sidb_border_width))
.def_readwrite("color_background", &fiction::write_sidb_layout_svg_params::color_background,
DOC(fiction_write_sidb_layout_svg_params_color_background));

detail::write_sidb_layout_svg_impl<py_charge_distribution_surface_100>(m);
detail::write_sidb_layout_svg_impl<py_charge_distribution_surface_100>(m);
Expand Down
14 changes: 7 additions & 7 deletions test/io/write_sidb_layout_svg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace fiction;
* @param svg The input SVG string to be normalized.
* @return A string with all whitespace characters removed.
*/
[[nodiscard]] std::string normalize_svg(const std::string& svg) noexcept
[[nodiscard]] static std::string normalize_svg(const std::string& svg) noexcept
{
std::string result = svg;

Expand All @@ -42,7 +42,7 @@ using namespace fiction;

FICTION_VERSION_INFO_HPP_IN

inline std::string EXPECTED_SVG_LIGHT_CELL_LEVEL = fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
inline const std::string EXPECTED_SVG_LIGHT_CELL_LEVEL = fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by {} ({}) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
Expand Down Expand Up @@ -77,7 +77,7 @@ inline std::string EXPECTED_SVG_LIGHT_CELL_LEVEL = fmt::format(R"(<?xml version=
</svg>)",
FICTION_VERSION, FICTION_REPO);

inline std::string EXPECTED_SVG_LIGHT_CELL_LEVEL_111 =
inline const std::string EXPECTED_SVG_LIGHT_CELL_LEVEL_111 =
fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by fiction v0.6.5 (https://github.com/cda-tum/fiction) -->
<svg
Expand Down Expand Up @@ -113,7 +113,7 @@ inline std::string EXPECTED_SVG_LIGHT_CELL_LEVEL_111 =
</svg>)",
FICTION_VERSION, FICTION_REPO);

const std::string EXPECTED_SVG_DARK_CELL_LEVEL = fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
inline const std::string EXPECTED_SVG_DARK_CELL_LEVEL = fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by {} ({}) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
Expand Down Expand Up @@ -167,7 +167,7 @@ const std::string EXPECTED_SVG_DARK_CELL_LEVEL = fmt::format(R"(<?xml version="1
</svg>)",
FICTION_VERSION, FICTION_REPO);

const std::string EXPECTED_SVG_DARK_CELL_LEVEL_111 =
inline const std::string EXPECTED_SVG_DARK_CELL_LEVEL_111 =
fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by fiction v0.6.5 (https://github.com/cda-tum/fiction) -->
<svg
Expand Down Expand Up @@ -203,7 +203,7 @@ const std::string EXPECTED_SVG_DARK_CELL_LEVEL_111 =
</svg>)",
FICTION_VERSION, FICTION_REPO);

const std::string EXPECTED_SVG_LIGHT_CHARGE_DISTRIBUTION =
inline const std::string EXPECTED_SVG_LIGHT_CHARGE_DISTRIBUTION =
fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by {} ({}) -->
<svg
Expand Down Expand Up @@ -258,7 +258,7 @@ const std::string EXPECTED_SVG_LIGHT_CHARGE_DISTRIBUTION =
</svg>)",
FICTION_VERSION, FICTION_REPO);

const std::string EXPECTED_SVG_DARK_CHARGE_DISTRIBUTION =
inline const std::string EXPECTED_SVG_DARK_CHARGE_DISTRIBUTION =
fmt::format(R"(<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generated by {} ({}) -->
<svg
Expand Down

0 comments on commit 50c60b0

Please sign in to comment.