#include <gmi_mesh.h>
#include <gmi_null.h>
#include <apfMDS.h>
#include <apfMesh2.h>
#include <apfConvert.h>
#include <apf.h>
#include <PCU.h>

int main(int argc, char** argv)
{
  assert(argc==3);
  MPI_Init(&argc,&argv);
  PCU_Comm_Init();
  PCU_Protect();
  gmi_register_mesh();
  gmi_register_null();
  int* conn;
  double* coords;
  int nelem;
  int etype;
  int nverts;

  apf::Mesh2* m = apf::loadMdsMesh(argv[1],argv[2]);
  int dim = m->getDimension();
  extractCoords(m, coords, nverts);
  destruct(m, conn, nelem, etype);
  m->destroyNative();
  apf::destroyMesh(m);

  gmi_model* model = gmi_load(".null");
  m = apf::makeEmptyMdsMesh(model, dim, false);
  apf::GlobalToVert outMap;
  apf::construct(m, conn, nelem, etype, outMap);
  delete [] conn;
  apf::alignMdsRemotes(m);
  apf::deriveMdsModel(m);
  apf::setCoords(m, coords, nverts, outMap);
  delete [] coords;
  outMap.clear();
  m->verify();

  //apf::writeVtkFiles("after", m);

  m->destroyNative();
  apf::destroyMesh(m);
  PCU_Comm_Free();
  MPI_Finalize();
}


#include <gmi_mesh.h>
#include <gmi_null.h>
#include <apfMDS.h>
#include <apfMesh2.h>
#include <apfConvert.h>
#include <apf.h>
#include <PCU.h>

int main(int argc, char** argv)
{
  assert(argc==3);
  MPI_Init(&argc,&argv);
  PCU_Comm_Init();
  PCU_Protect();
  gmi_register_mesh();
  gmi_register_null();
  int* conn;
  int nelem;
  int etype;
  apf::Mesh2* m = apf::loadMdsMesh(argv[1],argv[2]);
  int dim = m->getDimension();
  destruct(m, conn, nelem, etype);
  m->destroyNative();
  apf::destroyMesh(m);
  gmi_model* model = gmi_load(".null");
  m = apf::makeEmptyMdsMesh(model, dim, false);
  apf::GlobalToVert outMap;
  apf::construct(m, conn, nelem, etype, outMap);
  outMap.clear();
  delete [] conn;
  apf::alignMdsRemotes(m);
  apf::deriveMdsModel(m);
  m->verify();
  m->destroyNative();
  apf::destroyMesh(m);
  PCU_Comm_Free();
  MPI_Finalize();
}


--- 
+++ 
@@ -15,22 +15,32 @@
   gmi_register_mesh();
   gmi_register_null();
   int* conn;
+  double* coords;
   int nelem;
   int etype;
+  int nverts;
+
   apf::Mesh2* m = apf::loadMdsMesh(argv[1],argv[2]);
   int dim = m->getDimension();
+  extractCoords(m, coords, nverts);
   destruct(m, conn, nelem, etype);
   m->destroyNative();
   apf::destroyMesh(m);
+
   gmi_model* model = gmi_load(".null");
   m = apf::makeEmptyMdsMesh(model, dim, false);
   apf::GlobalToVert outMap;
   apf::construct(m, conn, nelem, etype, outMap);
-  outMap.clear();
   delete [] conn;
   apf::alignMdsRemotes(m);
   apf::deriveMdsModel(m);
+  apf::setCoords(m, coords, nverts, outMap);
+  delete [] coords;
+  outMap.clear();
   m->verify();
+
+  //apf::writeVtkFiles("after", m);
+
   m->destroyNative();
   apf::destroyMesh(m);
   PCU_Comm_Free();
Add test for setting coordinates
