message: Allow refinement of 1D (segment) meshes
  Also allow a refinement factor of 1, which will just return a straight-sided version of the same mesh
diff: @@ -3152,12 +3152,12 @@ Mesh::Mesh(Mesh *mesh_array[], int num_pieces)
  Mesh::Mesh(Mesh *orig_mesh, int ref_factor, int ref_type)
  {
  Dim = orig_mesh->Dimension();
  - MFEM_VERIFY(ref_factor > 1, "the refinement factor must be > 1");
  + MFEM_VERIFY(ref_factor >= 1, "the refinement factor must be >= 1");
  MFEM_VERIFY(ref_type == BasisType::ClosedUniform ||
  ref_type == BasisType::GaussLobatto, "invalid refinement type");
  - MFEM_VERIFY(Dim == 2 || Dim == 3,
  - "only implemented for Hexahedron and Quadrilateral elements in "
  - "2D/3D");
  + MFEM_VERIFY(Dim == 1 || Dim == 2 || Dim == 3,
  + "only implemented for Segment, Quadrilateral and Hexahedron "
  + "elements in 1D/2D/3D");
  MFEM_VERIFY(orig_mesh->GetNumGeometries(Dim) <= 1,
  "meshes with mixed elements are not supported");
  @@ -3166,7 +3166,7 @@ Mesh::Mesh(Mesh *orig_mesh, int ref_factor, int ref_type)
  H1_FECollection rfec(ref_factor, Dim, ref_type);
  FiniteElementSpace rfes(orig_mesh, &rfec);
  - int r_bndr_factor = ref_factor * (Dim == 2 ? 1 : ref_factor);
  + int r_bndr_factor = pow(ref_factor, Dim - 1);
  int r_elem_factor = ref_factor * r_bndr_factor;
  int r_num_vert = rfes.GetNDofs();
  @@ -3223,6 +3223,21 @@ Mesh::Mesh(Mesh *orig_mesh, int ref_factor, int ref_type)
  rfes.GetBdrElementDofs(el, rdofs);
  MFEM_ASSERT(rdofs.Size() == RG.RefPts.Size(), "");
  + if (Dim == 1)
  + {
  + // Dim == 1 is a special case because the boundary elements are
  + // zero-dimensional points, and therefore don't have a DofMap
  + for (int j = 0; j < RG.RefGeoms.Size()/nvert; j++)
  + {
  + Element *elem = NewElement(geom);
  + elem->SetAttribute(attrib);
  + int *v = elem->GetVertices();
  + v[0] = rdofs[RG.RefGeoms[nvert*j]];
  + AddBdrElement(elem);
  + }
  + }
  + else
  + {
  const int *c2h_map = rfec.GetDofMap(geom);
  for (int j = 0; j < RG.RefGeoms.Size()/nvert; j++)
  {
  @@ -3237,6 +3252,7 @@ Mesh::Mesh(Mesh *orig_mesh, int ref_factor, int ref_type)
  AddBdrElement(elem);
  }
  }
  + }
  FinalizeTopology();
  sequence = orig_mesh->GetSequence() + 1;
  