void PM_io_parser<PMDEC>::read()
{
  if ( !check_sep("Plane_map_2") )
  {
    std::cerr<<"PM_io_parser::read: no embedded_PM header."<<std::endl;
    return;
  }
  if ( !(check_sep("vertices") && (in >> vn)) )
  {
    std::cerr<<"PM_io_parser::read: wrong node line."<<std::endl;
    return;
  }

  if ( !(check_sep("halfedges") && (in >> en) && (en%2==0)) )
  {
    std::cerr<<"PM_io_parser::read: wrong edge line."<<std::endl;
    return;
  }
  if ( !(check_sep("faces") && (in >> fn)) )
  {
    std::cerr<<"PM_io_parser::read: wrong face line."<<std::endl;
    return;
  }

  Vertex_of.resize(vn);
  Halfedge_of.resize(en);
  Face_of.resize(fn);

  for(i=0; i<vn; i++)  Vertex_of[i] =   this->new_vertex();
  for(i=0; i<en; i++)
    if (i%2==0) Halfedge_of[i] = this->new_halfedge_pair_without_vertices();
    else Halfedge_of[i] = twin(Halfedge_of[i-1]);
  for(i=0; i<fn; i++)  Face_of[i] =     this->new_face();

  for(i=0; i<vn; i++) {
    if (!read_vertex(Vertex_of[i]))
    {
      std::cerr<<"PM_io_parser::read: error in node line"<<std::endl;
      return;
    }
  }
  for(i=0; i<en; i++) {
    if (!read_hedge(Halfedge_of[i]))
    {
      std::cerr<<"PM_io_parser::read: error in halfedge line"<<std::endl;
      return;
    }
  }
  for(i=0; i<fn; i++) {
    if (!read_face(Face_of[i]))
    {
      std::cerr<<"PM_io_parser::read: error in face line"<<std::endl;
      return;
    }
  }
}
void PM_io_parser<PMDEC>::read()
{
  if ( !check_sep("Plane_map_2") )
  {
    std::cerr<<"PM_io_parser::read: no embedded_PM header."<<std::endl;
    return;
  }
  if ( !(check_sep("vertices") && (in >> vn)) )
  {
    std::cerr<<"PM_io_parser::read: wrong node line."<<std::endl;
    return;
  }

  if ( !(check_sep("halfedges") && (in >> en) && (en%2==0)) )
  {
    std::cerr<<"PM_io_parser::read: wrong edge line."<<std::endl;
    return;
  }
  if ( !(check_sep("faces") && (in >> fn)) )
  {
    std::cerr<<"PM_io_parser::read: wrong face line."<<std::endl;
    return;
  }

  Vertex_of.resize(vn);
  Halfedge_of.resize(en);
  Face_of.resize(fn);

  for(i=0; i<vn; i++)  Vertex_of[i] =   this->new_vertex();
  for(i=0; i<en; i++)
    if (i%2==0) Halfedge_of[i] = this->new_halfedge_pair_without_vertices();
    else Halfedge_of[i] = twin(Halfedge_of[i-1]);
  for(i=0; i<fn; i++)  Face_of[i] =     this->new_face();

  for(i=0; i<vn; i++) {
    if (!read_vertex(Vertex_of[i]))
    {
      std::cerr<<"PM_io_parser::read: error in node line"<<std::endl;
      return;
    }
  }
  for(i=0; i<en; i++) {
    if (!read_hedge(Halfedge_of[i]))
    {
      std::cerr<<"PM_io_parser::read: error in halfedge line"<<std::endl;
      return;
    }
  }
  for(i=0; i<fn; i++) {
    if (!read_face(Face_of[i]))
    {
      std::cerr<<"PM_io_parser::read: error in face line"<<std::endl;
      return;
    }
  }
}