Example #1
0
void UCDIO::write_interior_elems(std::ostream & out_stream,
                                 const MeshBase & mesh)
{
  // 1-based element number for UCD
  unsigned int e=1;

  // Write element information
  for (const auto & elem : mesh.element_ptr_range())
    {
      libmesh_assert (out_stream.good());

      // Look up the corresponding UCD element type in the static map.
      const ElemType etype = elem->type();
      std::map<ElemType, std::string>::iterator it = _writing_element_map.find(etype);
      if (it == _writing_element_map.end())
        libmesh_error_msg("Error: Unsupported ElemType " << etype << " for UCDIO.");

      // Write the element's subdomain ID as the UCD "material_id".
      out_stream << e++ << " " << elem->subdomain_id() << " " << it->second << "\t";
      elem->write_connectivity(out_stream, UCD);
    }
}