getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] [getfem-commits] branch master updated: Bug fix on zero


From: Yves Renard
Subject: [Getfem-commits] [getfem-commits] branch master updated: Bug fix on zero contributions elements in the tree
Date: Thu, 30 Jan 2020 11:33:47 -0500

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

renard pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
     new c26d132  Bug fix on zero contributions elements in the tree
c26d132 is described below

commit c26d1322cfec590076af8b560c871332d5b4e69f
Author: Yves Renard <address@hidden>
AuthorDate: Thu Jan 30 17:33:33 2020 +0100

    Bug fix on zero contributions elements in the tree
---
 src/getfem/getfem_generic_assembly_tree.h |  6 ++++--
 src/getfem_generic_assembly_semantic.cc   |  7 +++++--
 src/getfem_generic_assembly_workspace.cc  | 16 +++++++++-------
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/getfem/getfem_generic_assembly_tree.h 
b/src/getfem/getfem_generic_assembly_tree.h
index 14c64d9..971be9e 100644
--- a/src/getfem/getfem_generic_assembly_tree.h
+++ b/src/getfem/getfem_generic_assembly_tree.h
@@ -372,8 +372,10 @@ namespace getfem {
       return true;
     }
 
-    inline bool is_constant()
-    { return (node_type == GA_NODE_CONSTANT || node_type == GA_NODE_ZERO); }
+    inline bool is_constant() {
+      return (node_type == GA_NODE_CONSTANT ||
+              (node_type == GA_NODE_ZERO && test_function_type == 0));
+    }
     
     inline void init_scalar_tensor(scalar_type v)
     { t.init_scalar_tensor(v); test_function_type = 0; }
diff --git a/src/getfem_generic_assembly_semantic.cc 
b/src/getfem_generic_assembly_semantic.cc
index a37e5f3..c225ed3 100644
--- a/src/getfem_generic_assembly_semantic.cc
+++ b/src/getfem_generic_assembly_semantic.cc
@@ -2661,11 +2661,13 @@ namespace getfem {
                             size_type ref_elt_dim,
                             bool eval_fixed_size,
                             bool ignore_X, int option) {
-    // cout << "Begin semantic analysis" << endl;
     GMM_ASSERT1(predef_operators_nonlinear_elasticity_initialized &&
                 predef_operators_plasticity_initialized &&
                 predef_operators_contact_initialized, "Internal error");
     if (!(tree.root)) return;
+    // cout << "Begin semantic analysis with ";
+    // ga_print_node(tree.root, cout); cout << endl;
+    
     if (option == 1) { workspace.test1.clear(); workspace.test2.clear(); }
     ga_node_analysis(tree, workspace, tree.root, m, ref_elt_dim,
                      eval_fixed_size, ignore_X, option);
@@ -2682,7 +2684,8 @@ namespace getfem {
         tree.clear();
     }
     ga_valid_operand(tree.root);
-    // cout << "end of semantic analysis" << endl;
+    // cout << "End of semantic analysis";
+    // if (tree.root) ga_print_node(tree.root, cout); cout << endl;
   }
 
 
diff --git a/src/getfem_generic_assembly_workspace.cc 
b/src/getfem_generic_assembly_workspace.cc
index 756f1fe..ddc7743 100644
--- a/src/getfem_generic_assembly_workspace.cc
+++ b/src/getfem_generic_assembly_workspace.cc
@@ -402,6 +402,10 @@ namespace getfem {
                               bool function_expr, operation_type op_type,
                               const std::string varname_interpolation) {
     if (tree.root) {
+      // cout << "add tree with tests functions of " <<  tree.root->name_test1
+      //     << " and " << tree.root->name_test2 << endl;
+      //     ga_print_node(tree.root, cout); cout << endl;
+
       // Eliminate the term if it corresponds to disabled variables
       if ((tree.root->test_function_type >= 1 &&
            is_disabled_variable(tree.root->name_test1)) ||
@@ -410,9 +414,7 @@ namespace getfem {
         // cout<<"disabling term ";  ga_print_node(tree.root, cout); 
cout<<endl;
         return;
       }
-      // cout << "add tree with tests functions of " <<  tree.root->name_test1
-      //      << " and " << tree.root->name_test2 << endl;
-      //      ga_print_node(tree.root, cout); cout << endl;
+
       bool remain = true;
       size_type order = 0, ind_tree = 0;
 
@@ -482,14 +484,14 @@ namespace getfem {
           if (!(is_constant(var.varname))) {
             ga_tree dtree = (remain ? tree : *(trees[ind_tree].ptree));
             // cout << "Derivation with respect to " << var.varname << " : "
-            //     << var.transname << " of " << ga_tree_to_string(dtree) << 
endl;
-            GA_TIC;
+            //   << var.transname << " of " << ga_tree_to_string(dtree) << 
endl;
+            // GA_TIC;
             ga_derivative(dtree, *this, m, var.varname, var.transname, 
1+order);
             // cout << "Result : " << ga_tree_to_string(dtree) << endl;
-            GA_TOCTIC("Derivative time");
+            // GA_TOCTIC("Derivative time");
             ga_semantic_analysis(dtree, *this, m,
                                  ref_elt_dim_of_mesh(m), false, function_expr);
-            GA_TOCTIC("Analysis after Derivative time");
+            // GA_TOCTIC("Analysis after Derivative time");
             // cout << "after analysis "  << ga_tree_to_string(dtree) << endl;
             add_tree(dtree, m, mim, rg, expr, add_derivative_order,
                      function_expr, op_type, varname_interpolation);



reply via email to

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