message: Copy Nodes in trimmer miniapp
diff: #include "mfem.hpp"
  #include <fstream>
  #include <iostream>
  +#include <vector>
  using namespace std;
  using namespace mfem;
  @@ -142,13 +143,21 @@ int main(int argc, char *argv[])
  Mesh trimmed_mesh(mesh.Dimension(), mesh.GetNV(),
  num_elements, num_bdr_elements, mesh.SpaceDimension());
  + // Check for curved or discontinuous mesh
  + const GridFunction * Nodes = mesh.GetNodes();
  + const FiniteElementSpace * fes = Nodes ? Nodes->FESpace() : NULL;
  +
  + Array<int> vdofs;
  + std::vector<Vector> node_loc_vecs(Nodes ? num_elements : 0);
  +
  // Copy vertices
  for (int v=0; v<mesh.GetNV(); v++)
  {
  trimmed_mesh.AddVertex(mesh.GetVertex(v));
  }
  - // Copy elements
  + // Copy elements (and Nodes if applicable)
  + int te = 0;
  for (int e=0; e<mesh.GetNE(); e++)
  {
  Element * el = mesh.GetElement(e);
  @@ -159,6 +168,13 @@ int main(int argc, char *argv[])
  nel->SetAttribute(elem_attr);
  nel->SetVertices(el->GetVertices());
  trimmed_mesh.AddElement(nel);
  +
  + if (Nodes)
  + {
  + fes->GetElementVDofs(e, vdofs);
  + Nodes->GetSubVector(vdofs, node_loc_vecs[te]);
  + }
  + te++;
  }
  }
  @@ -214,6 +230,27 @@ int main(int argc, char *argv[])
  trimmed_mesh.Finalize();
  trimmed_mesh.RemoveUnusedVertices();
  + if (Nodes)
  + {
  + // Copy nodes to trimmed mesh
  + int order = fes->FEColl()->GetOrder();
  + Ordering::Type ordering = fes->GetOrdering();
  + int sdim = mesh.SpaceDimension();
  + bool discont =
  + dynamic_cast<const L2_FECollection*>(fes->FEColl()) != NULL;
  +
  + trimmed_mesh.SetCurvature(order, discont, sdim, ordering);
  +
  + const FiniteElementSpace * trimmed_fes = trimmed_mesh.GetNodalFESpace();
  + GridFunction * trimmed_nodes = trimmed_mesh.GetNodes();
  +
  + for (int e = 0; e < num_elements; e++)
  + {
  + trimmed_fes->GetElementVDofs(e, vdofs);
  + trimmed_nodes->SetSubVector(vdofs, node_loc_vecs[e]);
  + }
  + }
  +
  // Save the final mesh
  ofstream mesh_ofs("trimmer.mesh");
  mesh_ofs.precision(8);
  