Skip to content
Snippets Groups Projects
Commit ad86e02b authored by Thomas Toulorge's avatar Thomas Toulorge
Browse files

Added computation of barycenter of primary element (forgotten in commit...

Added computation of barycenter of primary element (forgotten in commit r16411, fixes compilation error)
parent 06fef037
Branches
Tags
No related merge requests found
...@@ -192,10 +192,10 @@ SPoint3 MElement::barycenter_infty () const ...@@ -192,10 +192,10 @@ SPoint3 MElement::barycenter_infty () const
return SPoint3(0.5*(xmin+xmax),0.5*(ymin+ymax),0.5*(zmin+zmax)); 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.); SPoint3 p(0., 0., 0.);
int n = getNumVertices(); int n = primary ? getNumPrimaryVertices() : getNumVertices();
for(int i = 0; i < n; i++) { for(int i = 0; i < n; i++) {
const MVertex *v = getVertex(i); const MVertex *v = getVertex(i);
p[0] += v->x(); p[0] += v->x();
......
...@@ -201,7 +201,7 @@ class MElement ...@@ -201,7 +201,7 @@ class MElement
virtual double getOuterRadius(){ return 0.; } virtual double getOuterRadius(){ return 0.; }
// compute the barycenter // compute the barycenter
virtual SPoint3 barycenter() const; virtual SPoint3 barycenter(bool primary = false) const;
virtual SPoint3 barycenterUVW() const; virtual SPoint3 barycenterUVW() const;
// compute the barycenter in infinity norm // compute the barycenter in infinity norm
virtual SPoint3 barycenter_infty() const; virtual SPoint3 barycenter_infty() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment