[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Yves Renard |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Fri, 15 Jun 2018 05:04:47 -0400 (EDT) |
branch: master
commit 020c6086f9ee12c4dcbac9bf919ee4ca4b4d809c
Author: Yves Renard <address@hidden>
Date: Fri Jun 15 11:04:30 2018 +0200
Replace the mean unit normal vector on face nodes by the unit normal vector
on the mean of face nodes : for pyramid element
---
src/getfem/getfem_mesh.h | 4 ++--
src/getfem_mesh.cc | 14 ++++++--------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/getfem/getfem_mesh.h b/src/getfem/getfem_mesh.h
index cf67b83..6ad99e0 100644
--- a/src/getfem/getfem_mesh.h
+++ b/src/getfem/getfem_mesh.h
@@ -359,8 +359,8 @@ namespace getfem {
size_type n=0) const;
- /* Return the mean outward unit normal vector of the given convex
- face computed on the geometrical nodes of the face.
+ /* Return the outward unit normal vector of the given element
+ face computed on the mean of the geometrical nodes of the face.
@param ic the convex number.
@param f the face number.
diff --git a/src/getfem_mesh.cc b/src/getfem_mesh.cc
index 92d07a3..5c6ebd8 100644
--- a/src/getfem_mesh.cc
+++ b/src/getfem_mesh.cc
@@ -365,16 +365,14 @@ namespace getfem {
base_small_vector mesh::mean_normal_of_face_of_convex(size_type ic,
short_type f) const {
bgeot::pgeometric_trans pgt = trans_of_convex(ic);
- bgeot::pgeotrans_precomp pgp
- = bgeot::geotrans_precomp(pgt, pgt->pgeometric_nodes(), 0);
base_matrix G; vectors_to_base_matrix(G,points_of_convex(ic));
- bgeot::geotrans_interpolation_context c(pgp,0, G);
- base_small_vector n(dim());
+ base_small_vector ptmean(dim());
size_type nbpt = pgt->structure()->nb_points_of_face(f);
- for (size_type i = 0; i < nbpt; ++i) {
- c.set_ii(pgt->structure()->ind_points_of_face(f)[i]);
- n += bgeot::compute_normal(c, f);
- }
+ for (size_type i = 0; i < nbpt; ++i)
+
gmm::add(pgt->geometric_nodes()[pgt->structure()->ind_points_of_face(f)[i]],
ptmean);
+ ptmean /= scalar_type(nbpt);
+ bgeot::geotrans_interpolation_context c(pgt,ptmean, G);
+ base_small_vector n = bgeot::compute_normal(c, f);
n /= gmm::vect_norm2(n);
return n;
}