From b7faf4b806e951704d17a19017f75e32231a6e6d Mon Sep 17 00:00:00 2001 From: diegolodares Date: Sun, 24 Dec 2023 03:13:06 +0100 Subject: [PATCH] [DLG] Added pi_div_2 to constants --- lion/foundation/constants.h | 4 ++++ lion/io/Xml_element.h | 5 ++++- lion/math/ipopt_optimize_nlp_finite_differences.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lion/foundation/constants.h b/lion/foundation/constants.h index aed17b8..2c4c4b5 100644 --- a/lion/foundation/constants.h +++ b/lion/foundation/constants.h @@ -8,6 +8,9 @@ enum Axis{ X, Y, Z }; template constexpr T pi_T = T{ 3.1415926535897932385L }; +template +constexpr T pi_div_2_T = T{ 1.570796326794896558L }; + template constexpr T eps_T = std::numeric_limits::epsilon(); @@ -20,6 +23,7 @@ constexpr T nan_T = std::numeric_limits::quiet_NaN(); // handy names when using double, our usual case constexpr auto pi{ pi_T }; +constexpr auto pi_div_2{ pi_div_2_T }; constexpr auto eps{ eps_T }; constexpr auto inf{ inf_T }; constexpr auto Inf{ inf }; diff --git a/lion/io/Xml_element.h b/lion/io/Xml_element.h index 6275731..c318f66 100644 --- a/lion/io/Xml_element.h +++ b/lion/io/Xml_element.h @@ -399,15 +399,18 @@ void Xml_element::add_children_and_values_from_map(const MapType &m) for (const auto &mi : m) { std::ostringstream ss; - ss << std::setprecision(17); if constexpr (map_of_vectors) { + ss << std::setprecision(std::numeric_limits::max_digits10); + ss << mi.second.front(); for (auto mis = std::next(mi.second.cbegin()); mis != mi.second.cend(); ++mis) { ss << ", " << *mis; } } else { + ss << std::setprecision(std::numeric_limits::max_digits10); + ss << mi.second; } add_child(mi.first).set_value(ss.str()); diff --git a/lion/math/ipopt_optimize_nlp_finite_differences.h b/lion/math/ipopt_optimize_nlp_finite_differences.h index 81b1dea..295ee42 100644 --- a/lion/math/ipopt_optimize_nlp_finite_differences.h +++ b/lion/math/ipopt_optimize_nlp_finite_differences.h @@ -156,6 +156,7 @@ struct Ipopt_optimize_NLP_finite_differences // configure ipopt's options + app->Options()->SetStringValue("sb", "yes"); app->Options()->SetStringValue("linear_solver", opts.linear_solver); if (opts.linear_solver == "ma97") { app->Options()->SetStringValue("ma97_order", "metis");