From 6fdf845a941ce00819a9c0b0da0e49372175b54b Mon Sep 17 00:00:00 2001 From: David Wells Date: Tue, 3 Jan 2017 12:05:37 -0500 Subject: [PATCH] Reduce the scope of some variables. This was caught by cppcheck. --- include/deal.II/lac/full_matrix.templates.h | 11 +-- include/deal.II/lac/solver_cg.h | 7 +- include/deal.II/lac/solver_minres.h | 12 +-- include/deal.II/lac/solver_qmrs.h | 14 +-- .../deal.II/matrix_free/dof_info.templates.h | 2 +- include/deal.II/matrix_free/matrix_free.h | 4 +- source/base/data_out_base.cc | 4 +- source/base/function_lib.cc | 3 +- source/base/function_lib_cutoff.cc | 3 +- source/base/quadrature_lib.cc | 24 +++-- source/distributed/p4est_wrappers.cc | 3 +- source/fe/fe_q_hierarchical.cc | 98 +++++++------------ source/grid/grid_in.cc | 2 +- source/grid/grid_out.cc | 3 +- source/grid/grid_tools.cc | 3 +- source/lac/trilinos_sparse_matrix.cc | 10 +- source/lac/trilinos_sparsity_pattern.cc | 15 ++- source/opencascade/utilities.cc | 3 +- 18 files changed, 91 insertions(+), 130 deletions(-) diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index e2311beab7..d941e38acb 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -915,13 +915,12 @@ FullMatrix::matrix_norm_square (const Vector &v) const number2 sum = 0.; const size_type n_rows = m(); const number *val_ptr = &this->values[0]; - const number2 *v_ptr; for (size_type row=0; row::matrix_scalar_product (const Vector &u, const size_type n_rows = m(); const size_type n_cols = n(); const number *val_ptr = &this->values[0]; - const number2 *v_ptr; for (size_type row=0; row::cholesky (const FullMatrix &A) /* reinit *this to 0 */ this->reinit(A.m(), A.n()); - double SLik2 = 0.0, SLikLjk = 0.0; for (size_type i=0; i< this->n_cols(); i++) { - SLik2 = 0.0; + double SLik2 = 0.0; for (size_type j = 0; j < i; j++) { - SLikLjk = 0.0; + double SLikLjk = 0.0; for (size_type k =0; k::solve (const MatrixType &A, | additional_data.compute_condition_number | additional_data.compute_all_condition_numbers | additional_data.compute_eigenvalues; - double eigen_beta_alpha = 0; // vectors used for eigenvalue // computations @@ -464,6 +463,8 @@ SolverCG::solve (const MatrixType &A, try { + double eigen_beta_alpha = 0; + // define some aliases for simpler access VectorType &g = *Vr; VectorType &d = *Vz; @@ -475,7 +476,7 @@ SolverCG::solve (const MatrixType &A, d.reinit(x, true); h.reinit(x, true); - double gh,alpha,beta; + double gh,beta; // compute residual. if vector is // zero, then short-circuit the @@ -515,7 +516,7 @@ SolverCG::solve (const MatrixType &A, it++; A.vmult(h,d); - alpha = d*h; + double alpha = d*h; Assert(alpha != 0., ExcDivideByZero()); alpha = gh/alpha; diff --git a/include/deal.II/lac/solver_minres.h b/include/deal.II/lac/solver_minres.h index e790f8efee..49d1a31139 100644 --- a/include/deal.II/lac/solver_minres.h +++ b/include/deal.II/lac/solver_minres.h @@ -236,12 +236,10 @@ SolverMinRes::solve (const MatrixType &A, double r_l2 = 0; double r0 = 0; - double tau = 0; + double tau = 0; double c = 0; - double gamma = 0; - double s = 0; - double d_ = 0; - double d = 0; + double s = 0; + double d_ = 0; // The iteration step. unsigned int j = 1; @@ -283,7 +281,7 @@ SolverMinRes::solve (const MatrixType &A, A.vmult(*u[2],v); u[2]->add (-std::sqrt(delta[1]/delta[0]), *u[0]); - gamma = *u[2] * v; + const double gamma = *u[2] * v; u[2]->add (-gamma / std::sqrt(delta[1]), *u[1]); *m[0] = v; @@ -309,7 +307,7 @@ SolverMinRes::solve (const MatrixType &A, e[1] = -c * std::sqrt(delta[2]); } - d = std::sqrt (d_*d_ + delta[2]); + const double d = std::sqrt (d_*d_ + delta[2]); if (j>1) tau *= s / c; diff --git a/include/deal.II/lac/solver_qmrs.h b/include/deal.II/lac/solver_qmrs.h index 412d2372bb..ab11191a2c 100644 --- a/include/deal.II/lac/solver_qmrs.h +++ b/include/deal.II/lac/solver_qmrs.h @@ -346,7 +346,7 @@ SolverQMRS::iterate(const MatrixType &A, int it=0; - double tau, rho, theta=0, sigma, alpha, psi, theta_old, rho_old, beta; + double tau, rho, theta=0; double res; d.reinit(x); @@ -375,19 +375,19 @@ SolverQMRS::iterate(const MatrixType &A, // Step 1 A.vmult(t,q); // Step 2 - sigma = q*t; + const double sigma = q*t; //TODO:[?] Find a really good breakdown criterion. The absolute one detects breakdown instead of convergence if (std::fabs(sigma/rho) < additional_data.breakdown) return IterationResult(SolverControl::iterate, std::fabs(sigma/rho)); // Step 3 - alpha = rho/sigma; + const double alpha = rho/sigma; v.add(-alpha,t); // Step 4 - theta_old = theta; + const double theta_old = theta; theta = v*v/tau; - psi = 1./(1.+theta); + const double psi = 1./(1.+theta); tau *= theta*psi; d.sadd(psi*theta_old, psi*alpha, p); @@ -411,11 +411,11 @@ SolverQMRS::iterate(const MatrixType &A, if (std::fabs(rho) < additional_data.breakdown) return IterationResult(SolverControl::iterate, std::fabs(rho)); // Step 7 - rho_old = rho; + const double rho_old = rho; precondition.vmult(q,v); rho = q*v; - beta = rho/rho_old; + const double beta = rho/rho_old; p.sadd(beta,v); precondition.vmult(q,p); } diff --git a/include/deal.II/matrix_free/dof_info.templates.h b/include/deal.II/matrix_free/dof_info.templates.h index fcff576996..6d7f74de14 100644 --- a/include/deal.II/matrix_free/dof_info.templates.h +++ b/include/deal.II/matrix_free/dof_info.templates.h @@ -338,7 +338,6 @@ no_constraint: const unsigned int n_owned = (vector_partitioner->local_range().second- vector_partitioner->local_range().first); const std::size_t n_ghosts = ghost_dofs.size(); - unsigned int n_unique_ghosts= 0; #ifdef DEBUG for (std::vector::iterator dof = dof_indices.begin(); dof!=dof_indices.end(); ++dof) @@ -349,6 +348,7 @@ no_constraint: IndexSet ghost_indices (vector_partitioner->size()); if (n_ghosts > 0) { + unsigned int n_unique_ghosts = 0; // since we need to go back to the local_to_global indices and // replace the temporary numbering of ghosts by the real number in // the index set, we need to store these values diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index b9515d756a..89ff4fe744 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2382,7 +2382,7 @@ MatrixFree::cell_loop std::vector*> worker(n_workers); std::vector*> blocked_worker(n_blocked_workers); unsigned int worker_index = 0, slice_index = 0; - unsigned int spawn_index = 0, spawn_index_new = 0; + unsigned int spawn_index = 0; int spawn_index_child = -2; internal::MPIComCompress *worker_compr = new(root->allocate_child()) internal::MPIComCompress(dst); @@ -2390,7 +2390,7 @@ MatrixFree::cell_loop for (unsigned int part=0; partallocate_child()) internal::color::PartitionWork(func,slice_index,task_info,false); diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index dcf22b3723..8feddae285 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -7002,13 +7002,13 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & // all vector data, then handle the // scalar data sets that have been // left over - unsigned int i, pt_data_vector_dim; + unsigned int i; std::string vector_name; for (i=0; icenter.distance(points[k]); const double r = this->radius; - double e = 0.; double val = 0.; if (dradius) { - e = -r*r/(r*r-d*d); + const double e = -r*r/(r*r-d*d); if (e>-50) val = numbers::E * exp(e); } diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 19d292f61e..43328dd170 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -133,17 +133,17 @@ QGauss<1>::QGauss (const unsigned int n) long double z = std::cos(numbers::PI * (i-.25)/(n+.5)); long double pp; - long double p1, p2, p3; + long double p1; // Newton iteration do { // compute L_n (z) p1 = 1.; - p2 = 0.; + long double p2 = 0.; for (unsigned int j=0; j0) r = (r + x[k-1])/2; @@ -297,7 +297,6 @@ long double QGaussLobatto<1>::JacobiP(const long double x, // the Jacobi polynomial is evaluated // using a recursion formula. std::vector p(n+1); - int v, a1, a2, a3, a4; // initial values P_0(x), P_1(x): p[0] = 1.0L; @@ -307,11 +306,11 @@ long double QGaussLobatto<1>::JacobiP(const long double x, for (unsigned int i=1; i<=(n-1); ++i) { - v = 2*i + alpha + beta; - a1 = 2*(i+1)*(i + alpha + beta + 1)*v; - a2 = (v + 1)*(alpha*alpha - beta*beta); - a3 = v*(v + 1)*(v + 2); - a4 = 2*(i+alpha)*(i+beta)*(v + 2); + const int v = 2*i + alpha + beta; + const int a1 = 2*(i+1)*(i + alpha + beta + 1)*v; + const int a2 = (v + 1)*(alpha*alpha - beta*beta); + const int a3 = v*(v + 1)*(v + 2); + const int a4 = 2*(i+alpha)*(i+beta)*(v + 2); p[i+1] = static_cast( (a2 + a3*x)*p[i] - a4*p[i-1])/a1; } // for @@ -816,14 +815,13 @@ QGaussOneOverR<2>::QGaussOneOverR(const unsigned int n, double eps = 1e-8; unsigned int q_id = 0; // Current quad point index. - double area = 0; Tensor<1,2> dist; for (unsigned int box=0; box<4; ++box) { dist = (singularity-GeometryInfo<2>::unit_cell_vertex(box)); dist = Point<2>(std::abs(dist[0]), std::abs(dist[1])); - area = dist[0]*dist[1]; + double area = dist[0]*dist[1]; if (area > eps) for (unsigned int q=0; q::quadrant &quad) { int i, l = quad.level; - int child_id; dealii::types::global_dof_index dealii_index = triangulation->get_p4est_tree_to_coarse_cell_permutation()[treeidx]; for (i = 0; i < l; i++) { typename dealii::Triangulation::cell_iterator cell (triangulation, i, dealii_index); - child_id = dealii::internal::p4est::functions::quadrant_ancestor_id (&quad, i + 1); + const int child_id = dealii::internal::p4est::functions::quadrant_ancestor_id (&quad, i + 1); Assert (cell->has_children (), ExcMessage ("p4est quadrant does not correspond to a cell!")); dealii_index = cell->child_index(child_id); } diff --git a/source/fe/fe_q_hierarchical.cc b/source/fe/fe_q_hierarchical.cc index 59e0bd630b..a8e8f7b4bc 100644 --- a/source/fe/fe_q_hierarchical.cc +++ b/source/fe/fe_q_hierarchical.cc @@ -993,15 +993,13 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, } int factorial_i = 1; - int factorial_ij; - int factorial_j; for (int i = 2; i < (int) this->dofs_per_face; ++i) { interpolation_matrix (i, i) = std::pow (0.5, i); factorial_i *= i; - factorial_j = factorial_i; - factorial_ij = 1; + int factorial_j = factorial_i; + int factorial_ij = 1; for (int j = i + 1; j < (int) this->dofs_per_face; ++j) { @@ -1037,15 +1035,13 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (1, 1) = 1.0; int factorial_i = 1; - int factorial_ij; - int factorial_j; for (int i = 2; i < (int) this->dofs_per_face; ++i) { interpolation_matrix (i, i) = std::pow (0.5, i); factorial_i *= i; - factorial_j = factorial_i; - factorial_ij = 1; + int factorial_j = factorial_i; + int factorial_ij = 1; for (int j = i + 1; j < (int) this->dofs_per_face; ++j) { @@ -1093,11 +1089,6 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (3, vertex) = 0.25; int factorial_i = 1; - int factorial_ij; - int factorial_j; - int factorial_k; - int factorial_kl; - int factorial_l; for (int i = 2; i <= (int) this->degree; ++i) { @@ -1118,14 +1109,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, j = j + 2; } - factorial_k = 1; + int factorial_k = 1; for (int j = 2; j <= (int) this->degree; ++j) { interpolation_matrix (i + (j + 2) * source_fe.degree - j, i + (j + 2) * this->degree - j) = std::pow (0.5, i + j); factorial_k *= j; - factorial_kl = 1; - factorial_l = factorial_k; + int factorial_kl = 1; + int factorial_l = factorial_k; for (int k = j + 1; k < (int) this->degree; ++k) { @@ -1141,8 +1132,8 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, } factorial_i *= i; - factorial_j = factorial_i; - factorial_ij = 1; + int factorial_j = factorial_i; + int factorial_ij = 1; for (int j = i + 1; j <= (int) this->degree; ++j) { @@ -1160,8 +1151,8 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, { interpolation_matrix (i + (k + 2) * source_fe.degree - k, j + (k + 2) * this->degree - k) = tmp * std::pow (0.5, k); factorial_k *= k; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int l = k + 1; l <= (int) this->degree; ++l) { @@ -1201,8 +1192,8 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, { interpolation_matrix (i + (k + 2) * source_fe.degree - k, j + (k + 2) * this->degree - k) = tmp * std::pow (0.5, k); factorial_k *= k; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int l = k + 1; l <= (int) this->degree; ++l) { @@ -1265,11 +1256,6 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (2, vertex) = 0.25; int factorial_i = 1; - int factorial_ij; - int factorial_j; - int factorial_k; - int factorial_kl; - int factorial_l; for (int i = 2; i <= (int) this->degree; ++i) { @@ -1291,8 +1277,8 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (i + source_fe.degree + 1, i + this->degree + 1) = tmp; interpolation_matrix (i + 2 * source_fe.degree, i + 2 * this->degree) = tmp; factorial_i *= i; - factorial_j = factorial_i; - factorial_ij = 1; + int factorial_j = factorial_i; + int factorial_ij = 1; for (int j = i + 1; j <= (int) this->degree; ++j) { @@ -1300,14 +1286,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, factorial_j *= j; tmp = std::pow (0.5, j) * factorial_j / (factorial_i * factorial_ij); interpolation_matrix (i + 2 * source_fe.degree, j + 2 * this->degree) = tmp; - factorial_k = 1; + int factorial_k = 1; for (int k = 2; k <= (int) this->degree; ++k) { interpolation_matrix (i + (k + 2) * source_fe.degree - k, j + (k + 2) * this->degree - k) = tmp * std::pow (0.5, k); factorial_k *= k; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int l = k + 1; l <= (int) this->degree; ++l) { @@ -1349,14 +1335,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, } } - factorial_k = 1; + int factorial_k = 1; for (int j = 2; j <= (int) this->degree; ++j) { interpolation_matrix (i + (j + 2) * source_fe.degree - j, i + (j + 2) * this->degree - j) = std::pow (0.5, i + j); factorial_k *= j; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int k = j + 1; k <= (int) this->degree; ++k) { @@ -1403,11 +1389,6 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (1, vertex) = 0.25; int factorial_i = 1; - int factorial_ij; - int factorial_j; - int factorial_k; - int factorial_kl; - int factorial_l; for (int i = 2; i <= (int) this->degree; ++i) { @@ -1428,14 +1409,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, j = j + 2; } - factorial_k = 1; + int factorial_k = 1; for (int j = 2; j <= (int) this->degree; ++j) { interpolation_matrix (i + (j + 2) * source_fe.degree - j, i + (j + 2) * this->degree - j) = std::pow (0.5, i + j); factorial_k *= j; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_kl = 1; + int factorial_l = factorial_k; for (int k = j + 1; k <= (int) this->degree; ++k) { @@ -1446,8 +1427,8 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, } factorial_i *= i; - factorial_j = factorial_i; - factorial_ij = 1; + int factorial_j = factorial_i; + int factorial_ij = 1; for (int j = i + 1; j <= (int) this->degree; ++j) { @@ -1474,14 +1455,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (i + 2 * source_fe.degree, j + 3 * this->degree - 1) = tmp; tmp *= 2.0; interpolation_matrix (i + 3 * source_fe.degree - 1, j + 3 * this->degree - 1) = tmp; - factorial_k = 1; + int factorial_k = 1; for (int k = 2; k <= (int) this->degree; ++k) { interpolation_matrix (i + (k + 2) * source_fe.degree - k, j + (k + 2) * this->degree - k) = tmp * std::pow (0.5, k); factorial_k *= k; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int l = k + 1; l <= (int) this->degree; ++l) { @@ -1532,11 +1513,6 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, interpolation_matrix (3, 3) = 1.0; int factorial_i = 1; - int factorial_ij; - int factorial_j; - int factorial_k; - int factorial_kl; - int factorial_l; for (int i = 2; i <= (int) this->degree; ++i) { @@ -1557,14 +1533,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, tmp *= -1.0; interpolation_matrix (i + source_fe.degree + 1, i + this->degree + 1) = tmp; interpolation_matrix (i + 3 * source_fe.degree - 1, i + 3 * this->degree - 1) = tmp; - factorial_k = 1; + int factorial_k = 1; for (int j = 2; j <= (int) this->degree; ++j) { interpolation_matrix (i + (j + 2) * source_fe.degree - j, i + (j + 2) * this->degree - j) = std::pow (0.5, i + j); factorial_k *= j; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int k = j + 1; k <= (int) this->degree; ++k) { @@ -1575,8 +1551,8 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, } factorial_i *= i; - factorial_j = factorial_i; - factorial_ij = 1; + int factorial_j = factorial_i; + int factorial_ij = 1; for (int j = i + 1; j <= (int) this->degree; ++j) { @@ -1590,14 +1566,14 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe, tmp *= 2.0; interpolation_matrix (i + source_fe.degree + 1, j + this->degree + 1) = tmp; interpolation_matrix (i + 3 * source_fe.degree - 1, j + 3 * this->degree - 1) = tmp; - factorial_k = 1; + int factorial_k = 1; for (int k = 2; k <= (int) this->degree; ++k) { interpolation_matrix (i + (k + 2) * source_fe.degree - k, j + (k + 2) * this->degree - k) = tmp * std::pow (0.5, k); factorial_k *= k; - factorial_l = factorial_k; - factorial_kl = 1; + int factorial_l = factorial_k; + int factorial_kl = 1; for (int l = k + 1; l <= (int) this->degree; ++l) { diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 29801b640f..822dd56522 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -3095,7 +3095,6 @@ namespace // Surface can be created from ELSET, or directly from cells // If elsets_list contains a key with specific name - refers to that ELSET, otherwise refers to cell std::istringstream iss (line); - char comma; int el_idx; int face_number; char temp; @@ -3122,6 +3121,7 @@ namespace else { // Surface refers directly to elements + char comma; iss >> el_idx >> comma >> temp >> face_number; quad_node_list = get_global_node_numbers (el_idx, face_number); quad_node_list.insert (quad_node_list.begin(), b_indicator); diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 3ded8aefbd..744971d091 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -2104,14 +2104,13 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const // draw the legend if (svg_flags.draw_legend) out << '\n' << " " << '\n'; - unsigned int line_offset = 0; - additional_width = 0; if (!svg_flags.margin) additional_width = static_cast(.5 + (height/100.) * 2.5); // explanation of the cell labeling if (svg_flags.draw_legend && (svg_flags.label_level_number || svg_flags.label_cell_index || svg_flags.label_material_id || svg_flags.label_subdomain_id || svg_flags.label_level_subdomain_id )) { + unsigned int line_offset = 0; out << " (.5 + (height/100.) * margin_in_percent) << "\" width=\"" << static_cast(.5 + (height/100.) * (40. - margin_in_percent)) << "\" height=\"" << static_cast(.5 + height * .165) << "\"/>" << '\n'; diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 86be8b5e31..010f9f1561 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -3019,11 +3019,10 @@ next_cell: typename std::vector::const_iterator uniform_cell; for (uniform_cell=uniform_cells.begin(); uniform_cell!=uniform_cells.end(); ++uniform_cell) { - bool repeat_vertex; for (unsigned int v=0; v::vertices_per_cell; ++v) { Point position=(*uniform_cell)->vertex (v); - repeat_vertex=false; + bool repeat_vertex=false; for (unsigned int m=0; m local_range = rhs.local_range(); - int ierr; // Try to copy all the rows of the matrix one by one. In case of error // (i.e., the column indices are different), we need to abort and blow // away the matrix. @@ -410,8 +409,8 @@ namespace TrilinosWrappers int n_entries, rhs_n_entries; TrilinosScalar *value_ptr, *rhs_value_ptr; int *index_ptr, *rhs_index_ptr; - ierr = rhs.matrix->ExtractMyRowView (row_local, rhs_n_entries, - rhs_value_ptr, rhs_index_ptr); + int ierr = rhs.matrix->ExtractMyRowView (row_local, rhs_n_entries, + rhs_value_ptr, rhs_index_ptr); (void)ierr; Assert (ierr == 0, ExcTrilinosError(ierr)); @@ -1774,7 +1773,6 @@ namespace TrilinosWrappers local_range = rhs.local_range(); const bool same_col_map = matrix->ColMap().SameAs(rhs.matrix->ColMap()); - int ierr; for (size_type row=local_range.first; row < local_range.second; ++row) { const int row_local = @@ -1787,8 +1785,8 @@ namespace TrilinosWrappers int n_entries, rhs_n_entries; TrilinosScalar *value_ptr, *rhs_value_ptr; int *index_ptr, *rhs_index_ptr; - ierr = rhs.matrix->ExtractMyRowView (row_local, rhs_n_entries, - rhs_value_ptr, rhs_index_ptr); + int ierr = rhs.matrix->ExtractMyRowView (row_local, rhs_n_entries, + rhs_value_ptr, rhs_index_ptr); (void)ierr; Assert (ierr == 0, ExcTrilinosError(ierr)); diff --git a/source/lac/trilinos_sparsity_pattern.cc b/source/lac/trilinos_sparsity_pattern.cc index 9ed611f7a8..7aae438f44 100644 --- a/source/lac/trilinos_sparsity_pattern.cc +++ b/source/lac/trilinos_sparsity_pattern.cc @@ -126,19 +126,18 @@ namespace TrilinosWrappers // otherwise first flush Trilinos caches sparsity_pattern->compress (); - // get a representation of the present row - int ncols; - colnum_cache.reset (new std::vector (sparsity_pattern->row_length(this->a_row))); if (colnum_cache->size() > 0) { - int ierr; - ierr = sparsity_pattern->graph->ExtractGlobalRowCopy((TrilinosWrappers::types::int_type)this->a_row, - colnum_cache->size(), - ncols, - (TrilinosWrappers::types::int_type *)&(*colnum_cache)[0]); + // get a representation of the present row + int ncols; + const int ierr = sparsity_pattern->graph->ExtractGlobalRowCopy + ((TrilinosWrappers::types::int_type)this->a_row, + colnum_cache->size(), + ncols, + (TrilinosWrappers::types::int_type *)&(*colnum_cache)[0]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); AssertThrow (static_cast::size_type>(ncols) == colnum_cache->size(), ExcInternalError()); diff --git a/source/opencascade/utilities.cc b/source/opencascade/utilities.cc index 7034790113..7565d2a21d 100644 --- a/source/opencascade/utilities.cc +++ b/source/opencascade/utilities.cc @@ -409,11 +409,10 @@ namespace OpenCASCADE Assert(Inters.IsDone(), ExcMessage("Could not project point.")); double minDistance = 1e7; - double distance; Point<3> result; for (int i=0; i