[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: |
Sun, 3 Feb 2019 11:33:04 -0500 (EST) |
branch: master
commit 69583e8b50814b7675287d312f79974c6c64f0e7
Author: Yves Renard <address@hidden>
Date: Sun Feb 3 17:32:55 2019 +0100
warning fixes
---
src/getfem/getfem_accumulated_distro.h | 7 +++-
src/getfem/getfem_im_list.h | 2 +-
src/getfem_contact_and_friction_common.cc | 66 +++++++++++--------------------
src/getfem_generic_assembly_tree.cc | 65 +++++++++++++++++++++++++++---
src/getfem_mesh_im_level_set.cc | 1 +
5 files changed, 90 insertions(+), 51 deletions(-)
diff --git a/src/getfem/getfem_accumulated_distro.h
b/src/getfem/getfem_accumulated_distro.h
index f8881cc..f323809 100644
--- a/src/getfem/getfem_accumulated_distro.h
+++ b/src/getfem/getfem_accumulated_distro.h
@@ -186,8 +186,11 @@ namespace detail {
~accumulated_distro(){
if (distributed.num_threads() == 1) return;
- GMM_ASSERT1(!me_is_multithreaded_now(),
- "Accumulation distribution should not run in parallel");
+ if (me_is_multithreaded_now()) {
+ // GMM_ASSERT1 not convenient here
+ cerr << "Accumulation distribution should not run in parallel";
+ exit(1);
+ }
using namespace std;
auto to_add = vector<T*>{};
diff --git a/src/getfem/getfem_im_list.h b/src/getfem/getfem_im_list.h
index 7baa8ab..c4b14a2 100644
--- a/src/getfem/getfem_im_list.h
+++ b/src/getfem/getfem_im_list.h
@@ -2,7 +2,7 @@
/*===========================================================================
- Copyright (C) 2002-2018 Yves Renard
+ Copyright (C) 2002-2019 Yves Renard
This file is a part of GetFEM++
diff --git a/src/getfem_contact_and_friction_common.cc
b/src/getfem_contact_and_friction_common.cc
index e4d05a6..fe47f84 100644
--- a/src/getfem_contact_and_friction_common.cc
+++ b/src/getfem_contact_and_friction_common.cc
@@ -244,13 +244,10 @@ namespace getfem {
obstacles_gw.push_back(ga_workspace());
pt.resize(N); ptx.resize(1); pty.resize(1); ptz.resize(1); ptw.resize(1);
obstacles_gw.back().add_fixed_size_constant("X", pt);
- switch(N) {
- default:
- case 4: obstacles_gw.back().add_fixed_size_constant("w", ptw);
- case 3: obstacles_gw.back().add_fixed_size_constant("z", ptz);
- case 2: obstacles_gw.back().add_fixed_size_constant("y", pty);
- case 1: obstacles_gw.back().add_fixed_size_constant("x", ptx);
- }
+ if (N >= 4) obstacles_gw.back().add_fixed_size_constant("w", ptw);
+ if (N >= 3) obstacles_gw.back().add_fixed_size_constant("z", ptw);
+ if (N >= 2) obstacles_gw.back().add_fixed_size_constant("y", ptw);
+ if (N >= 1) obstacles_gw.back().add_fixed_size_constant("x", ptw);
obstacles_f.push_back(ga_function(obstacles_gw.back(), obs));
obstacles_f.back().compile();
return ind;
@@ -894,36 +891,27 @@ namespace getfem {
// the release distance)
size_type irigid_obstacle(-1);
gmm::copy(x, pt);
- switch(N) {
- default:
- case 4: ptw[0] = pt[3];
- case 3: ptz[0] = pt[2];
- case 2: pty[0] = pt[1];
- case 1: ptx[0] = pt[0];
- }
+ if (N >= 4) ptw[0] = pt[3];
+ if (N >= 3) ptz[0] = pt[2];
+ if (N >= 2) pty[0] = pt[1];
+ if (N >= 1) ptx[0] = pt[0];
for (size_type i = 0; i < obstacles.size(); ++i) {
d1 = (obstacles_f[i].eval())[0];
if (gmm::abs(d1) < release_distance && d1 < d0) {
for (size_type j=0; j < bpinfo.normals.size(); ++j) {
gmm::add(gmm::scaled(bpinfo.normals[j], EPS), pt);
- switch(N) {
- default:
- case 4: ptw[0] = pt[3];
- case 3: ptz[0] = pt[2];
- case 2: pty[0] = pt[1];
- case 1: ptx[0] = pt[0];
- }
+ if (N >= 4) ptw[0] = pt[3];
+ if (N >= 3) ptz[0] = pt[2];
+ if (N >= 2) pty[0] = pt[1];
+ if (N >= 1) ptx[0] = pt[0];
d2 = (obstacles_f[i].eval())[0];
if (d2 < d1) { d0 = d1; irigid_obstacle = i; break; }
gmm::copy(x, pt);
- switch(N) {
- default:
- case 4: ptw[0] = pt[3];
- case 3: ptz[0] = pt[2];
- case 2: pty[0] = pt[1];
- case 1: ptx[0] = pt[0];
- }
+ if (N >= 4) ptw[0] = pt[3];
+ if (N >= 3) ptz[0] = pt[2];
+ if (N >= 2) pty[0] = pt[1];
+ if (N >= 1) ptx[0] = pt[0];
}
}
}
@@ -931,13 +919,10 @@ namespace getfem {
if (irigid_obstacle != size_type(-1)) {
gmm::copy(x, pt);
- switch(N) {
- default:
- case 4: ptw[0] = pt[3];
- case 3: ptz[0] = pt[2];
- case 2: pty[0] = pt[1];
- case 1: ptx[0] = pt[0];
- }
+ if (N >= 4) ptw[0] = pt[3];
+ if (N >= 3) ptz[0] = pt[2];
+ if (N >= 2) pty[0] = pt[1];
+ if (N >= 1) ptx[0] = pt[0];
gmm::copy(x, y);
size_type nit = 0, nb_fail = 0;
scalar_type alpha(0), beta(0);
@@ -974,13 +959,10 @@ namespace getfem {
} else {
gmm::add(gmm::scaled(ny, -d1/gmm::vect_norm2_sqr(ny)), y, pt);
}
- switch(N) {
- default:
- case 4: ptw[0] = pt[3];
- case 3: ptz[0] = pt[2];
- case 2: pty[0] = pt[1];
- case 1: ptx[0] = pt[0];
- }
+ if (N >= 4) ptw[0] = pt[3];
+ if (N >= 3) ptz[0] = pt[2];
+ if (N >= 2) pty[0] = pt[1];
+ if (N >= 1) ptx[0] = pt[0];
d2 = (obstacles_f[irigid_obstacle].eval())[0];
// if (nit > 10)
// cout << "nit = " << nit << " lambda = " << lambda
diff --git a/src/getfem_generic_assembly_tree.cc
b/src/getfem_generic_assembly_tree.cc
index 9364f7d..c553596 100644
--- a/src/getfem_generic_assembly_tree.cc
+++ b/src/getfem_generic_assembly_tree.cc
@@ -90,14 +90,14 @@ namespace getfem {
// Treating the different cases (Operation, name or number)
GA_TOKEN_TYPE type = ga_char_type[unsigned(expr[pos])];
++pos; ++token_length;
- switch (type) {
- case GA_DOT:
+ if (type == GA_DOT) {
if (pos >= expr.size()) return type;
if (expr[pos] == '*') { ++pos; ++token_length; return GA_DOTMULT; }
if (expr[pos] == '/') { ++pos; ++token_length; return GA_DOTDIV; }
- if (ga_char_type[unsigned(expr[pos])] != GA_SCALAR)
- return type;
+ if (ga_char_type[unsigned(expr[pos])] != GA_SCALAR) return type;
fdot = true; type = GA_SCALAR;
+ }
+ switch (type) {
case GA_SCALAR:
while (pos < expr.size()) {
GA_TOKEN_TYPE ctype = ga_char_type[unsigned(expr[pos])];
@@ -494,6 +494,8 @@ namespace getfem {
case GA_NODE_OPERATOR:
if (pnode1->der1 != pnode2->der1 || pnode1->der2 != pnode2->der2)
return false;
+ if (pnode1->name.compare(pnode2->name)) return false;
+ break;
case GA_NODE_PREDEF_FUNC: case GA_NODE_SPEC_FUNC:
if (pnode1->name.compare(pnode2->name)) return false;
break;
@@ -552,7 +554,33 @@ namespace getfem {
case GA_NODE_INTERPOLATE_DERIVATIVE:
if (pnode1->interpolate_name_der.compare(pnode2->interpolate_name_der))
return false;
- // The test continues with what follows
+ if (pnode1->interpolate_name.compare(pnode2->interpolate_name) ||
+ pnode1->elementary_name.compare(pnode2->elementary_name))
+ return false;
+ {
+ const mesh_fem *mf1 = workspace.associated_mf(pnode1->name);
+ const mesh_fem *mf2 = workspace.associated_mf(pnode2->name);
+ switch (version) {
+ case 0:
+ if (pnode1->name.compare(pnode2->name) ||
+ pnode1->test_function_type != pnode2->test_function_type)
+ return false;
+ break;
+ case 1:
+ if (mf1 != mf2 ||
+ workspace.qdim(pnode1->name) != workspace.qdim(pnode2->name) ||
+ pnode1->test_function_type != pnode2->test_function_type)
+ return false;
+ break;
+ case 2:
+ if (mf1 != mf2 ||
+ workspace.qdim(pnode1->name) != workspace.qdim(pnode2->name) ||
+ pnode1->test_function_type == pnode2->test_function_type)
+ return false;
+ break;
+ }
+ }
+ break;
case GA_NODE_INTERPOLATE_VAL_TEST: case GA_NODE_INTERPOLATE_GRAD_TEST:
case GA_NODE_INTERPOLATE_HESS_TEST: case GA_NODE_INTERPOLATE_DIVERG_TEST:
case GA_NODE_ELEMENTARY_VAL_TEST: case GA_NODE_ELEMENTARY_GRAD_TEST:
@@ -568,7 +596,30 @@ namespace getfem {
if (pnode1->interpolate_name.compare(pnode2->interpolate_name) ||
pnode1->elementary_name.compare(pnode2->elementary_name))
return false;
- // The test continues with what follows
+ {
+ const mesh_fem *mf1 = workspace.associated_mf(pnode1->name);
+ const mesh_fem *mf2 = workspace.associated_mf(pnode2->name);
+ switch (version) {
+ case 0:
+ if (pnode1->name.compare(pnode2->name) ||
+ pnode1->test_function_type != pnode2->test_function_type)
+ return false;
+ break;
+ case 1:
+ if (mf1 != mf2 ||
+ workspace.qdim(pnode1->name) != workspace.qdim(pnode2->name) ||
+ pnode1->test_function_type != pnode2->test_function_type)
+ return false;
+ break;
+ case 2:
+ if (mf1 != mf2 ||
+ workspace.qdim(pnode1->name) != workspace.qdim(pnode2->name) ||
+ pnode1->test_function_type == pnode2->test_function_type)
+ return false;
+ break;
+ }
+ }
+ break;
case GA_NODE_VAL_TEST: case GA_NODE_GRAD_TEST:
case GA_NODE_HESS_TEST: case GA_NODE_DIVERG_TEST:
{
@@ -1507,6 +1558,8 @@ namespace getfem {
case GA_MINUS: // unary -
tree.add_op(GA_UNARY_MINUS, token_pos, expr);
+ state = 1; break;
+
case GA_PLUS: // unary +
state = 1; break;
diff --git a/src/getfem_mesh_im_level_set.cc b/src/getfem_mesh_im_level_set.cc
index dd9dd13..ef47b6c 100644
--- a/src/getfem_mesh_im_level_set.cc
+++ b/src/getfem_mesh_im_level_set.cc
@@ -617,6 +617,7 @@ namespace getfem {
}
}
+ break;
case 3:
{
for (short_type k1 = 1; k1 < n; ++k1) {