47 if (this->
mesh().processor_id() == 0)
50 std::ofstream out_stream (fname.c_str());
54 if (!out_stream.good())
55 libmesh_file_error(fname.c_str());
61 out_stream << the_mesh.
n_elem() <<
" "
68 out_stream << n+1 <<
" \t"
71 << the_mesh.
point(n)(0) <<
" \t"
72 << the_mesh.
point(n)(1) <<
" \t"
77 for (
const auto & elem : the_mesh.active_element_ptr_range())
80 libmesh_error_msg_if(elem->type() !=
TRI3,
81 "ERROR: .fro format only valid for triangles!\n"
82 <<
" writing of " << fname <<
" aborted.");
84 out_stream << ++e <<
" \t";
86 for (
const Node & node : elem->node_ref_range())
87 out_stream << node.id()+1 <<
" \t";
99 const std::set<boundary_id_type> & bc_ids =
108 for (
const auto &
id : bc_ids)
110 std::deque<dof_id_type> node_list;
112 std::map<dof_id_type, dof_id_type>
113 forward_edges, backward_edges;
116 for (
const auto & t : bc_triples)
117 if (std::get<2>(t) == id)
134 std::unique_ptr<const Elem> side =
135 the_mesh.
elem_ref(std::get<0>(t)).build_side_ptr(std::get<1>(t));
139 n1 = side->node_id(1);
142 forward_edges.emplace(n0, n1);
145 backward_edges.emplace(n1, n0);
149 if (node_list.empty())
151 node_list.push_front(n0);
152 node_list.push_back (n1);
160 const std::size_t n_edges = forward_edges.size();
162 while (node_list.size() != (n_edges+1))
165 front_node = node_list.front(),
166 back_node = node_list.back();
169 if (
const auto pos = backward_edges.find(front_node);
170 pos != backward_edges.end())
172 node_list.push_front(pos->second);
173 backward_edges.erase(pos);
177 if (
const auto pos = forward_edges.find(back_node);
178 pos != forward_edges.end())
180 node_list.push_back(pos->second);
181 forward_edges.erase(pos);
185 out_stream << ++bc_id <<
" " << node_list.size() <<
'\n';
187 for (
const auto & node_id : node_list)
188 out_stream << node_id + 1 <<
" \t0\n";