From 4ce617f11c4435a549b9bce6a4a20d66d9e485a2 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Fri, 25 May 2012 13:08:01 +0000
Subject: [PATCH] OptHOM : export parametric coordinates

---
 contrib/HighOrderMeshOptimizer/OptHomMesh.cpp | 7 ++++---
 contrib/HighOrderMeshOptimizer/ParamCoord.cpp | 9 +++++++--
 contrib/HighOrderMeshOptimizer/ParamCoord.h   | 2 ++
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/contrib/HighOrderMeshOptimizer/OptHomMesh.cpp b/contrib/HighOrderMeshOptimizer/OptHomMesh.cpp
index f8174b5eb3..ebe132ac94 100644
--- a/contrib/HighOrderMeshOptimizer/OptHomMesh.cpp
+++ b/contrib/HighOrderMeshOptimizer/OptHomMesh.cpp
@@ -316,9 +316,10 @@ void Mesh::distSqToStraight(std::vector<double> &dSq)
 
 void Mesh::updateGEntityPositions()
 {
-
-  for (int iV = 0; iV < nVert(); iV++) _vert[iV]->setXYZ(_xyz[iV].x(),_xyz[iV].y(),_xyz[iV].z());
-
+  for (int iV = 0; iV < nVert(); iV++)
+    _vert[iV]->setXYZ(_xyz[iV].x(),_xyz[iV].y(),_xyz[iV].z()); 
+  for (int iFV = 0; iFV < nFV(); iFV++)
+    _pc->exportParamCoord(_freeVert[iFV], _uvw[iFV]);
 }
 
 
diff --git a/contrib/HighOrderMeshOptimizer/ParamCoord.cpp b/contrib/HighOrderMeshOptimizer/ParamCoord.cpp
index ccaba35d92..bfe1fc18fb 100644
--- a/contrib/HighOrderMeshOptimizer/ParamCoord.cpp
+++ b/contrib/HighOrderMeshOptimizer/ParamCoord.cpp
@@ -4,8 +4,6 @@
 #include "MVertex.h"
 #include "ParamCoord.h"
 
-
-
 ParamCoordSurf::ParamCoordSurf(GEntity *ge)
 {
   if ((ge->dim() == 2) && (ge->geomType() != GEntity::DiscreteSurface)) _gf = static_cast<GFace*>(ge);
@@ -172,3 +170,10 @@ void ParamCoordParent::gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const std::v
   }
 
 }
+
+void ParamCoordParent::exportParamCoord(MVertex *v, const SPoint3 &uvw)
+{
+  for (int d = 0; d < v->onWhat()->dim(); ++d) {
+    v->setParameter(d, uvw[d]);
+  }
+}
diff --git a/contrib/HighOrderMeshOptimizer/ParamCoord.h b/contrib/HighOrderMeshOptimizer/ParamCoord.h
index 4f70573e9a..cb3db207db 100644
--- a/contrib/HighOrderMeshOptimizer/ParamCoord.h
+++ b/contrib/HighOrderMeshOptimizer/ParamCoord.h
@@ -8,6 +8,7 @@ class ParamCoord
 
 public:
 
+  virtual void exportParamCoord(MVertex *v, const SPoint3 &uvw) {};
   virtual int nCoord(MVertex* vert) = 0;                                                 // Number of parametric coordinates for vertex
   virtual SPoint3 getUvw(MVertex* vert) = 0;                                             // Get parametric coordinates of vertex
   virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw) = 0;                        // Calculate physical coordinates from parametric coordinates of vertex
@@ -89,6 +90,7 @@ class ParamCoordParent : public ParamCoord
 public:
 
   int nCoord(MVertex* vert) { return vert->onWhat()->dim(); }
+  virtual void exportParamCoord(MVertex *v, const SPoint3 &uvw);
   virtual SPoint3 getUvw(MVertex* vert);
   virtual SPoint3 uvw2Xyz(MVertex* vert, const SPoint3 &uvw);
   virtual void gXyz2gUvw(MVertex* vert, const SPoint3 &uvw, const SPoint3 &gXyz, SPoint3 &gUvw);
-- 
GitLab