[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] [getfem-commits] branch master updated: Minor changes
From: |
Konstantinos Poulios |
Subject: |
[Getfem-commits] [getfem-commits] branch master updated: Minor changes |
Date: |
Tue, 05 Apr 2022 16:09:03 -0400 |
This is an automated email from the git hooks/post-receive script.
logari81 pushed a commit to branch master
in repository getfem.
The following commit(s) were added to refs/heads/master by this push:
new 7b9740ef Minor changes
7b9740ef is described below
commit 7b9740efee89a87ac219048291ad634e7c0b3f74
Author: Konstantinos Poulios <logari81@gmail.com>
AuthorDate: Tue Apr 5 22:08:53 2022 +0200
Minor changes
---
src/bgeot_geotrans_inv.cc | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/src/bgeot_geotrans_inv.cc b/src/bgeot_geotrans_inv.cc
index 2de17449..04b0e007 100644
--- a/src/bgeot_geotrans_inv.cc
+++ b/src/bgeot_geotrans_inv.cc
@@ -27,15 +27,6 @@
namespace bgeot
{
-
- bool point_in_convex(const geometric_trans &geoTrans,
- const base_node &x,
- scalar_type res,
- scalar_type IN_EPS) {
- // Test un peu sev�re peut-�tre en ce qui concerne res.
- return (geoTrans.convex_ref()->is_in(x) < IN_EPS) && (res < IN_EPS);
- }
-
void project_into_convex(base_node &x, const pgeometric_trans pgt) {
for (auto &coord : x) {
@@ -96,7 +87,8 @@ namespace bgeot
y = pgt->transform(n_ref, G);
add(gmm::scaled(n, -1.0), y);
- return point_in_convex(*pgt, n_ref, gmm::vect_norm2(y), IN_EPS);
+ return (pgt->convex_ref()->is_in(n_ref) < IN_EPS) &&
+ (gmm::vect_norm2(y) < IN_EPS);
}
void geotrans_inv_convex::update_B() {
@@ -192,7 +184,7 @@ namespace bgeot
bool project_into_element) {
converged = true;
base_node x0_ref(P), diff(N);
-
+
{ // find initial guess
x0_ref = pgt->geometric_nodes()[0];
scalar_type res = gmm::vect_dist2(mat_col(G, 0), xreal);
@@ -221,15 +213,15 @@ namespace bgeot
}
add(pgt->transform(x, G), gmm::scaled(xreal, -1.0), diff);
- auto res = gmm::vect_norm2(diff);
- auto res0 = std::numeric_limits<scalar_type>::max();
- double factor = 1.0;
+ scalar_type res = gmm::vect_norm2(diff);
+ scalar_type res0 = std::numeric_limits<scalar_type>::max();
+ scalar_type factor = 1.0;
base_node x0_real(N);
while (res > IN_EPS/100.) {
if ((gmm::abs(res - res0) < IN_EPS/100.) || (factor < IN_EPS)) {
converged = false;
- return point_in_convex(*pgt, x, res, IN_EPS);
+ return (pgt->convex_ref()->is_in(x) < IN_EPS) && (res < IN_EPS);
}
if (res > res0) {
add(gmm::scaled(x0_ref, factor), x);
@@ -244,13 +236,13 @@ namespace bgeot
pgt->poly_vector_grad(x, pc);
update_B();
mult(transposed(B), diff, x0_ref);
- add(gmm::scaled(x0_ref, -1.0 * factor), x);
+ add(gmm::scaled(x0_ref, -factor), x);
if (project_into_element) project_into_convex(x, pgt);
x0_real = pgt->transform(x, G);
add(x0_real, gmm::scaled(xreal, -1.0), diff);
res = gmm::vect_norm2(diff);
}
- return point_in_convex(*pgt, x, res, IN_EPS);
+ return (pgt->convex_ref()->is_in(x) < IN_EPS) && (res < IN_EPS);
}
} /* end of namespace bgeot. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] [getfem-commits] branch master updated: Minor changes,
Konstantinos Poulios <=