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 f6bfdffd Fix some compilation warning f6bfdffd is described below commit f6bfdffdcde67b724b80480c813267b841a61821 Author: Konstantinos Poulios <logar...@gmail.com> AuthorDate: Mon Jan 16 00:44:10 2023 +0100 Fix some compilation warning --- interface/src/gf_asm.cc | 7 ++-- src/getfem_assembling_tensors.cc | 4 +-- src/getfem_generic_assembly_semantic.cc | 62 +++++++++++++++++---------------- src/getfem_generic_assembly_tree.cc | 15 +++++--- src/gmm/gmm_MUMPS_interface.h | 4 +++ tests/cyl_slicer.cc | 4 +++ tests/test_mesh.cc | 34 +++++++++--------- 7 files changed, 75 insertions(+), 55 deletions(-) diff --git a/interface/src/gf_asm.cc b/interface/src/gf_asm.cc index 1824fe01..7a4da996 100644 --- a/interface/src/gf_asm.cc +++ b/interface/src/gf_asm.cc @@ -1368,8 +1368,11 @@ void gf_asm(getfemint::mexargs_in& m_in, getfemint::mexargs_out& m_out) { mf_coeff = to_meshfem_object(argin); vec_coeff = in.pop().to_darray(); in.last_popped().check_trailing_dimension(int(mf_coeff->nb_dof())); - } else - vec_coeff = darray(new double(argin.to_scalar()), 1); + } else { + auto coeff = std::make_shared_array<double>(1); + *coeff = argin.to_scalar(); + vec_coeff = darray(coeff.get(), 1); + } int option = in.remaining() ? in.pop().to_integer() : 1; double alpha = in.remaining() ? in.pop().to_scalar() : 1; darray vec_W; diff --git a/src/getfem_assembling_tensors.cc b/src/getfem_assembling_tensors.cc index d8a15d3a..6327ad9f 100644 --- a/src/getfem_assembling_tensors.cc +++ b/src/getfem_assembling_tensors.cc @@ -27,8 +27,8 @@ namespace getfem { size_type vdim_specif_list::nb_mf() const { - return std::count_if(begin(),end(), - std::mem_fun_ref(&vdim_specif::is_mf_ref)); + return std::count_if(begin(), end(), + std::mem_fn(&vdim_specif::is_mf_ref)); } size_type vdim_specif_list::nbelt() const { size_type sz = 1; diff --git a/src/getfem_generic_assembly_semantic.cc b/src/getfem_generic_assembly_semantic.cc index b6619f1a..ec3571a2 100644 --- a/src/getfem_generic_assembly_semantic.cc +++ b/src/getfem_generic_assembly_semantic.cc @@ -262,46 +262,39 @@ namespace getfem { 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: - if (pexpr->node_type == GA_NODE_VAL_TEST) { - pnode->name = pexpr->name; - } else { - GMM_ASSERT1(false, - "Sorry, directional derivative do not work for the " - "moment with interpolate transformations. Future work."); - } + GMM_ASSERT1(pexpr->node_type == GA_NODE_VAL_TEST, + "Sorry, directional derivative does not work for the " + "moment with interpolate transformations. Future work."); + pnode->name = pexpr->name; + break; case GA_NODE_ELEMENTARY_VAL_TEST: case GA_NODE_ELEMENTARY_GRAD_TEST: case GA_NODE_ELEMENTARY_HESS_TEST: case GA_NODE_ELEMENTARY_DIVERG_TEST: - if (pexpr->node_type == GA_NODE_VAL_TEST) { - pnode->name = pexpr->name; - } else { - GMM_ASSERT1(false, - "Sorry, directional derivative do not work for the " - "moment with elementary transformations. Future work."); - } + GMM_ASSERT1(pexpr->node_type == GA_NODE_VAL_TEST, + "Sorry, directional derivative does not work for the " + "moment with elementary transformations. Future work."); + pnode->name = pexpr->name; + break; case GA_NODE_SECONDARY_DOMAIN_VAL_TEST: case GA_NODE_SECONDARY_DOMAIN_GRAD_TEST: case GA_NODE_SECONDARY_DOMAIN_HESS_TEST: case GA_NODE_SECONDARY_DOMAIN_DIVERG_TEST: - if (pexpr->node_type == GA_NODE_VAL_TEST) { - pnode->name = pexpr->name; - } else { - GMM_ASSERT1(false, - "Sorry, directional derivative do not work for the " - "moment with secondary domains. Future work."); - } + GMM_ASSERT1(pexpr->node_type == GA_NODE_VAL_TEST, + "Sorry, directional derivative does not work for the " + "moment with secondary domains. Future work."); + pnode->name = pexpr->name; + break; case GA_NODE_XFEM_PLUS_VAL_TEST: case GA_NODE_XFEM_PLUS_GRAD_TEST: case GA_NODE_XFEM_PLUS_HESS_TEST: case GA_NODE_XFEM_PLUS_DIVERG_TEST: case GA_NODE_XFEM_MINUS_VAL_TEST: case GA_NODE_XFEM_MINUS_GRAD_TEST: case GA_NODE_XFEM_MINUS_HESS_TEST: case GA_NODE_XFEM_MINUS_DIVERG_TEST: - if (pexpr->node_type == GA_NODE_VAL_TEST) { - pnode->name = pexpr->name; - } else { - GMM_ASSERT1(false, - "Sorry, directional derivative do not work for the " - "moment with Xfem_plus and Xfem_minus operations. " - "Future work."); - } - default: break; + GMM_ASSERT1(pexpr->node_type == GA_NODE_VAL_TEST, + "Sorry, directional derivative does not work for the " + "moment with Xfem_plus and Xfem_minus operations. " + "Future work."); + pnode->name = pexpr->name; + break; + default: + break; } } } @@ -3739,6 +3732,7 @@ namespace getfem { case 0: GMM_ASSERT1(false, "Cannot derive function " << child0->name << ". No derivative provided or not derivable function."); + break; case 1: child0->name = F.derivative1(); break; @@ -3805,6 +3799,7 @@ namespace getfem { case 0: GMM_ASSERT1(false, "Cannot derive function " << child0->name << ". No derivative provided"); + break; case 1: child0->name = F.derivative1(); break; @@ -3838,6 +3833,7 @@ namespace getfem { case 0: GMM_ASSERT1(false, "Cannot derive function " << child0->name << ". No derivative provided"); + break; case 1: child0->name = F.derivative2(); break; @@ -4047,6 +4043,7 @@ namespace getfem { break; case GA_NODE_HESS: case GA_NODE_HESS_TEST: GMM_ASSERT1(false, "Sorry, cannot derive an Hessian once more"); + break; case GA_NODE_DIVERG: case GA_NODE_DIVERG_TEST: // Hess_u : Id(meshdim) if (pnode->node_type == GA_NODE_DIVERG) pnode->node_type = GA_NODE_HESS; @@ -4188,11 +4185,13 @@ namespace getfem { case GA_NODE_NORMAL: case GA_NODE_INTERPOLATE_NORMAL: GMM_ASSERT1(false, "Sorry, Gradient of Normal vector not implemented"); + break; case GA_NODE_ELT_K: case GA_NODE_ELT_B: case GA_NODE_INTERPOLATE_ELT_K: case GA_NODE_INTERPOLATE_ELT_B: GMM_ASSERT1(false, "Sorry, Gradient of element_K or element_B " "not implemented"); + break; case GA_NODE_INTERPOLATE_DERIVATIVE: GMM_ASSERT1(false, "Sorry, gradient of the derivative of a " @@ -4743,6 +4742,7 @@ namespace getfem { case 0: GMM_ASSERT1(false, "Cannot derive function " << child0->name << ". No derivative provided or not derivable function."); + break; case 1: child0->name = F.derivative1(); break; @@ -4815,6 +4815,7 @@ namespace getfem { case 0: GMM_ASSERT1(false, "Cannot derive function " << child0->name << ". No derivative provided"); + break; case 1: child0->name = F.derivative1(); break; @@ -4854,6 +4855,7 @@ namespace getfem { case 0: GMM_ASSERT1(false, "Cannot derive function " << child0->name << ". No derivative provided"); + break; case 1: child0->name = F.derivative2(); break; diff --git a/src/getfem_generic_assembly_tree.cc b/src/getfem_generic_assembly_tree.cc index 52b17c9e..f5236e99 100644 --- a/src/getfem_generic_assembly_tree.cc +++ b/src/getfem_generic_assembly_tree.cc @@ -2123,10 +2123,17 @@ namespace getfem { if (tree.root) ga_expand_macro(tree, tree.root, macro_dict); switch (t) { - case GA_RPAR: ga_throw_error(nexpr, pos-1, "Unbalanced parenthesis."); - case GA_RBRACKET: ga_throw_error(nexpr, pos-1, "Unbalanced braket."); - case GA_END: break; - default: ga_throw_error(nexpr, pos-1, "Unexpected token."); + case GA_RPAR: + ga_throw_error(nexpr, pos-1, "Unbalanced parenthesis."); + break; + case GA_RBRACKET: + ga_throw_error(nexpr, pos-1, "Unbalanced bracket."); + break; + case GA_END: + break; + default: + ga_throw_error(nexpr, pos-1, "Unexpected token."); + break; } } diff --git a/src/gmm/gmm_MUMPS_interface.h b/src/gmm/gmm_MUMPS_interface.h index 3325690e..968f18d2 100644 --- a/src/gmm/gmm_MUMPS_interface.h +++ b/src/gmm/gmm_MUMPS_interface.h @@ -146,17 +146,21 @@ namespace gmm { case -2: GMM_ASSERT1(false, "Solve with MUMPS failed: NZ = " << id.INFO(2) << " is out of range"); + break; case -6 : case -10 : GMM_WARNING1("Solve with MUMPS failed: matrix is singular"); return false; case -9: GMM_ASSERT1(false, "Solve with MUMPS failed: error " << id.INFO(1) << ", increase ICNTL(14)"); + break; case -13 : GMM_ASSERT1(false, "Solve with MUMPS failed: not enough memory"); + break; default : GMM_ASSERT1(false, "Solve with MUMPS failed with error " << id.INFO(1)); + break; } } return true; diff --git a/tests/cyl_slicer.cc b/tests/cyl_slicer.cc index 9e09b89d..31f128ff 100644 --- a/tests/cyl_slicer.cc +++ b/tests/cyl_slicer.cc @@ -47,8 +47,12 @@ bgeot::scalar_type func(const bgeot::base_node& x) { return x[0]; } +#ifdef GMM_USES_MPI int main(int argc, char *argv[]) { GETFEM_MPI_INIT(argc, argv); +#else +int main(int, char **) { +#endif try { getfem::mesh mymesh; diff --git a/tests/test_mesh.cc b/tests/test_mesh.cc index f0df9b46..cde62f5f 100644 --- a/tests/test_mesh.cc +++ b/tests/test_mesh.cc @@ -327,23 +327,23 @@ void test_convex_ref() { -struct basic_mesh_point_comparator2 - : public std::binary_function<base_node, base_node, int> { - double eps; - std::vector<double> v; - - int operator()(const base_node &x, const base_node &y) const { - double a = gmm::vect_sp(x, v), b = gmm::vect_sp(y, v); - if (a < b - eps) return -1; else if (a > b + eps) return +1; else return 0; - } - - basic_mesh_point_comparator2(unsigned dim_ = 3, double e = double(10000) - *gmm::default_tol(double())) - : eps(e), v(dim_) { - gmm::fill_random(v); - gmm::scale(v, 1.0/gmm::vect_norm2(v)); - } -}; +//struct basic_mesh_point_comparator2 +// : public std::binary_function<base_node, base_node, int> { +// double eps; +// std::vector<double> v; +// +// int operator()(const base_node &x, const base_node &y) const { +// double a = gmm::vect_sp(x, v), b = gmm::vect_sp(y, v); +// if (a < b - eps) return -1; else if (a > b + eps) return +1; else return 0; +// } +// +// basic_mesh_point_comparator2(unsigned dim_ = 3, double e = double(10000) +// *gmm::default_tol(double())) +// : eps(e), v(dim_) { +// gmm::fill_random(v); +// gmm::scale(v, 1.0/gmm::vect_norm2(v)); +// } +//}; void test_mesh_building(int dim, int Nsubdiv) {