From ad86e02b264f1b0dc28c2ff03dd348ac863462d3 Mon Sep 17 00:00:00 2001
From: Thomas Toulorge <thomas.toulorge@mines-paristech.fr>
Date: Fri, 9 Aug 2013 13:56:36 +0000
Subject: [PATCH] Added computation of barycenter of primary element (forgotten
 in commit r16411, fixes compilation error)

---
 Geo/MElement.cpp | 4 ++--
 Geo/MElement.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index 759f3bb382..1faf020b00 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -192,10 +192,10 @@ SPoint3 MElement::barycenter_infty () const
   return SPoint3(0.5*(xmin+xmax),0.5*(ymin+ymax),0.5*(zmin+zmax));
 }
 
-SPoint3 MElement::barycenter() const
+SPoint3 MElement::barycenter(bool primary) const
 {
   SPoint3 p(0., 0., 0.);
-  int n = getNumVertices();
+  int n = primary ? getNumPrimaryVertices() : getNumVertices();
   for(int i = 0; i < n; i++) {
     const MVertex *v = getVertex(i);
     p[0] += v->x();
diff --git a/Geo/MElement.h b/Geo/MElement.h
index 328c3adf61..9b7bfb9f9d 100644
--- a/Geo/MElement.h
+++ b/Geo/MElement.h
@@ -201,7 +201,7 @@ class MElement
   virtual double getOuterRadius(){ return 0.; }
 
   // compute the barycenter
-  virtual SPoint3 barycenter() const;
+  virtual SPoint3 barycenter(bool primary = false) const;
   virtual SPoint3 barycenterUVW() const;
   // compute the barycenter in infinity norm
   virtual SPoint3 barycenter_infty() const;
-- 
GitLab