Skip to content

Commit

Permalink
[DLG] Added pi_div_2 to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolodares committed Dec 24, 2023
1 parent f6f6999 commit b7faf4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lion/foundation/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ enum Axis{ X, Y, Z };
template<typename T = double>
constexpr T pi_T = T{ 3.1415926535897932385L };

template<typename T = double>
constexpr T pi_div_2_T = T{ 1.570796326794896558L };

template<typename T = double>
constexpr T eps_T = std::numeric_limits<T>::epsilon();

Expand All @@ -20,6 +23,7 @@ constexpr T nan_T = std::numeric_limits<T>::quiet_NaN();

// handy names when using double, our usual case
constexpr auto pi{ pi_T<double> };
constexpr auto pi_div_2{ pi_div_2_T<double> };
constexpr auto eps{ eps_T<double> };
constexpr auto inf{ inf_T<double> };
constexpr auto Inf{ inf };
Expand Down
5 changes: 4 additions & 1 deletion lion/io/Xml_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename mapped_type::value_type>::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<mapped_type>::max_digits10);

ss << mi.second;
}
add_child(mi.first).set_value(ss.str());
Expand Down
1 change: 1 addition & 0 deletions lion/math/ipopt_optimize_nlp_finite_differences.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit b7faf4b

Please sign in to comment.