Skip to content
Snippets Groups Projects
Commit 86a40d4d authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Change connectivity output

Reference item lists build automatically are not printed anymore
parent 6e1438e3
No related branches found
No related tags found
1 merge request!140Change referenced item list policy
......@@ -274,7 +274,7 @@ Connectivity<Dimension>::_buildIsBoundaryNode() const
template <ItemType item_type, size_t Dimension>
inline void
_printReference(std::ostream& os, const Connectivity<Dimension>& connectivity)
_printReference(std::ostream& os, const Connectivity<Dimension>& connectivity, std::set<std::string>& already_printed)
{
auto count_all_items = [](const auto& item_is_owned) -> size_t {
using ItemId = typename std::decay_t<decltype(item_is_owned)>::index_type;
......@@ -295,10 +295,20 @@ _printReference(std::ostream& os, const Connectivity<Dimension>& connectivity)
os << "- number of " << itemName(item_type) << "s: " << rang::fgB::yellow
<< count_all_items(connectivity.template isOwned<item_type>()) << rang::style::reset << '\n';
os << " " << rang::fgB::yellow << connectivity.template numberOfRefItemList<item_type>() << rang::style::reset
<< " references\n";
if (connectivity.template numberOfRefItemList<item_type>() > 0) {
// This is done to avoid printing deduced references on subitems
std::vector<size_t> to_print_list;
for (size_t i_ref_item = 0; i_ref_item < connectivity.template numberOfRefItemList<item_type>(); ++i_ref_item) {
auto ref_item_list = connectivity.template refItemList<item_type>(i_ref_item);
if (already_printed.find(ref_item_list.refId().tagName()) == already_printed.end()) {
to_print_list.push_back(i_ref_item);
already_printed.insert(ref_item_list.refId().tagName());
}
}
os << " " << rang::fgB::yellow << to_print_list.size() << rang::style::reset << " references\n";
if (to_print_list.size() > 0) {
for (size_t i_ref_item : to_print_list) {
auto ref_item_list = connectivity.template refItemList<item_type>(i_ref_item);
os << " - " << rang::fgB::green << ref_item_list.refId().tagName() << rang::style::reset << " ("
<< rang::fgB::green << ref_item_list.refId().tagNumber() << rang::style::reset << ") number "
......@@ -312,15 +322,17 @@ template <size_t Dimension>
std::ostream&
Connectivity<Dimension>::_write(std::ostream& os) const
{
std::set<std::string> already_printed;
os << "connectivity of dimension " << Dimension << '\n';
_printReference<ItemType::cell>(os, *this);
_printReference<ItemType::cell>(os, *this, already_printed);
if constexpr (Dimension > 1) {
_printReference<ItemType::face>(os, *this);
_printReference<ItemType::face>(os, *this, already_printed);
}
if constexpr (Dimension > 2) {
_printReference<ItemType::edge>(os, *this);
_printReference<ItemType::edge>(os, *this, already_printed);
}
_printReference<ItemType::node>(os, *this);
_printReference<ItemType::node>(os, *this, already_printed);
return os;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment