Commit 99b1e6ce authored by COULAUD Olivier's avatar COULAUD Olivier
Browse files

add comments and remove some outputs

parent f40ec4cd
......@@ -82,6 +82,66 @@ namespace scalfmm
} // namespace details
namespace out
{
template<typename T, std::size_t N>
///
/// \brief operator << for array std::array<T,N>
/// print array [a_1, ..., a_N]
/// \param os ostream
/// \param array to print
///
inline auto operator<<(std::ostream& os, const std::array<T, N>& array) -> std::ostream&
{
os << "[";
for(auto it = array.begin(); it != array.end() - 1; it++)
{
os << *it << ", ";
}
os << array.back() << "]";
return os;
}
///
/// \brief print a vector and its size
///
/// The output is
/// title (size) values
///
/// The values are separated by a white space
///
/// \param[in] title
/// \param[in] v a vector (need size method)
///
template<typename Vector_type>
void print(const std::string&& title, Vector_type& v)
{
std::cout << title << " (" << v.size() << ") ";
for(auto& i: v)
std::cout << i << ' ';
std::cout << '\n';
};
template<typename Iterator_type>
///
/// \brief print print a vector and its size starting at first and endig at end
///
/// The output is
/// title (size) values
///
/// The values are separated by a white space
///
/// \param title string to print
/// \param first begin iterator
/// \param last end iterator
///
void print(const std::string&& title, Iterator_type first, Iterator_type last)
{
std::cout << title << " (" << std::distance(first, last) << ") ";
for(Iterator_type it = first; it != last; ++it)
std::cout << *it << ' ';
std::cout << '\n';
};
} // namespace out
} // namespace scalfmm
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment