getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] [getfem-commits] branch devel-logari81-internal-variabl


From: Konstantinos Poulios
Subject: [Getfem-commits] [getfem-commits] branch devel-logari81-internal-variables updated: Fix bug in rhs computation of models with internal variables
Date: Wed, 29 Jan 2020 16:11:03 -0500

This is an automated email from the git hooks/post-receive script.

logari81 pushed a commit to branch devel-logari81-internal-variables
in repository getfem.

The following commit(s) were added to 
refs/heads/devel-logari81-internal-variables by this push:
     new fc11f8e  Fix bug in rhs computation of models with internal variables
fc11f8e is described below

commit fc11f8e761fbc507f131379aa0910357a141d270
Author: Konstantinos Poulios <address@hidden>
AuthorDate: Wed Jan 29 22:10:56 2020 +0100

    Fix bug in rhs computation of models with internal variables
---
 src/getfem_models.cc | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 64132fd..d509046 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -2599,7 +2599,7 @@ namespace getfem {
 
     if (gmm::vect_size(full_rrhs)) { // i.e. if has_internal_variables()
       gmm::sub_interval IP(0,gmm::vect_size(rrhs));
-      gmm::copy(rrhs, gmm::sub_vector(full_rrhs, IP));
+      gmm::copy(rrhs, gmm::sub_vector(full_rrhs, IP)); // TICTIC
     }
 
     // Generic expressions
@@ -2647,7 +2647,6 @@ namespace getfem {
         accumulated_distro<model_real_plain_vector> res1_distro(res1);
 
         if (version & BUILD_RHS) { // both BUILD_RHS & BUILD_MATRIX
-          gmm::resize(res0, with_internal ? full_size : primary_size);
           accumulated_distro<model_real_plain_vector> res0_distro(res0);
           GETFEM_OMP_PARALLEL( // running the assembly in parallel
             ga_workspace workspace(*this);
@@ -2685,7 +2684,6 @@ namespace getfem {
         }
       } // end of tangent_matrix_distro, intern_mat_distro, res1_distro scope
       else if (version & BUILD_RHS) {
-        gmm::resize(res0, with_internal ? full_size : primary_size);
         accumulated_distro<model_real_plain_vector> res0_distro(res0);
         GETFEM_OMP_PARALLEL( // running the assembly in parallel
           ga_workspace workspace(*this);
@@ -2695,8 +2693,15 @@ namespace getfem {
         ) // end GETFEM_OMP_PARALLEL
       } // end of res0_distro scope
 
-      if (version & BUILD_RHS)
-        gmm::add(gmm::scaled(res0, scalar_type(-1)), rrhs);
+      if (version & BUILD_RHS) {
+        gmm::scale(res0, scalar_type(-1)); // from residual to rhs
+        if (with_internal) {
+          gmm::sub_interval IP(0,gmm::vect_size(rrhs));
+          gmm::add(gmm::sub_vector(res0, IP), rrhs); // TOCTOC
+          gmm::add(res0, full_rrhs);
+        } else
+          gmm::add(res0, rrhs);
+      }
 
       if (version & BUILD_MATRIX && with_internal) {
         gmm::scale(res1, scalar_type(-1)); // from residual to rhs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]