47 if (this->
mesh().processor_id() == 0)
50 std::ofstream out_stream (fname.c_str());
51 libmesh_assert (out_stream.good());
54 if (!out_stream.good())
55 libmesh_file_error(fname.c_str());
61 out_stream << the_mesh.
n_elem() <<
" " 67 for (
unsigned int n=0; n<the_mesh.
n_nodes(); n++)
68 out_stream << n+1 <<
" \t" 70 << std::setprecision(12)
71 << the_mesh.
point(n)(0) <<
" \t" 72 << the_mesh.
point(n)(1) <<
" \t" 80 if (elem->type() !=
TRI3)
81 libmesh_error_msg(
"ERROR: .fro format only valid for triangles!\n" \
82 <<
" writing of " << fname <<
" aborted.");
84 out_stream << ++e <<
" \t";
86 for (
unsigned int n=0; n<elem->n_nodes(); n++)
87 out_stream << elem->node_id(n)+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 =
138 n0 =
side->node_id(0),
139 n1 =
side->node_id(1);
142 forward_edges.insert (std::make_pair(n0, n1));
145 backward_edges.insert (std::make_pair(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();
170 auto pos = backward_edges.find(front_node);
172 if (pos != backward_edges.end())
174 node_list.push_front(pos->second);
176 backward_edges.erase(pos);
182 auto pos = forward_edges.find(back_node);
184 if (pos != forward_edges.end())
186 node_list.push_back(pos->second);
188 forward_edges.erase(pos);
193 out_stream << ++
bc_id <<
" " << node_list.size() <<
'\n';
195 for (
const auto & node_id : node_list)
196 out_stream << node_id + 1 <<
" \t0\n";
const MeshBase & mesh() const
const bool _is_parallel_format
virtual SimpleRange< element_iterator > active_element_ptr_range()=0
const BoundaryInfo & get_boundary_info() const
std::size_t n_boundary_ids() const
void build_side_list(std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i, bool proxy=true)=0
virtual void write(const std::string &) override
const std::set< boundary_id_type > & get_boundary_ids() const
Temporarily serializes a DistributedMesh for output.
virtual const Elem & elem_ref(const dof_id_type i) const
virtual const Point & point(const dof_id_type i) const =0
virtual dof_id_type n_elem() const =0
virtual dof_id_type n_nodes() const =0