From 7e999dfea7d14e467c597b6379dc4f3f3c6846a1 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 15 Feb 2018 01:50:01 +0100 Subject: [PATCH] Fix some warnings and errors reported by MSVC --- include/deal.II/base/parameter_acceptor.h | 2 +- include/deal.II/grid/grid_tools.h | 42 +++++++++---------- include/deal.II/multigrid/multigrid.h | 2 + .../deal.II/numerics/vector_tools.templates.h | 6 +++ source/distributed/tria_base.cc | 7 ++++ source/fe/fe_values.cc | 10 ++--- source/grid/manifold.cc | 4 +- 7 files changed, 44 insertions(+), 29 deletions(-) diff --git a/include/deal.II/base/parameter_acceptor.h b/include/deal.II/base/parameter_acceptor.h index 4e6c22ebf0..83e6c8845f 100644 --- a/include/deal.II/base/parameter_acceptor.h +++ b/include/deal.II/base/parameter_acceptor.h @@ -474,7 +474,7 @@ public: void add_parameter(const std::string &entry, ParameterType ¶meter, const std::string &documentation = std::string(), - ParameterHandler &prm = ParameterAcceptor::prm, + ParameterHandler &prm_ = prm, const Patterns::PatternBase &pattern = *Patterns::Tools::Convert::to_pattern()); diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 0cd6071e57..b38606a198 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -72,30 +72,28 @@ namespace internal class ActiveCellIterator { public: +#ifndef _MSC_VER typedef typename MeshType::active_cell_iterator type; +#else + typedef TriaActiveIterator > type; +#endif }; +#ifdef _MSC_VER template class ActiveCellIterator > { public: -#ifndef _MSC_VER - typedef typename dealii::DoFHandler::active_cell_iterator type; -#else - typedef TriaActiveIterator < dealii::DoFCellAccessor < dealii::DoFHandler, false > > type; -#endif + typedef TriaActiveIterator < dealii::DoFCellAccessor < dealii::DoFHandler, false> > type; }; template class ActiveCellIterator > { public: -#ifndef _MSC_VER - typedef typename dealii::hp::DoFHandler::active_cell_iterator type; -#else - typedef TriaActiveIterator < dealii::DoFCellAccessor < dealii::hp::DoFHandler, false > > type; -#endif + typedef TriaActiveIterator < dealii::DoFCellAccessor < dealii::hp::DoFHandler, false> > type; }; +#endif } /** @@ -2905,26 +2903,28 @@ namespace GridTools // cases. const double step_size = object->diameter()/64.0; - std::array, GeometryInfo::vertices_per_cell> vertices; - for (unsigned int vertex_n = 0; vertex_n < GeometryInfo::vertices_per_cell; + constexpr unsigned int n_vertices_per_cell = GeometryInfo::vertices_per_cell; + + std::array, n_vertices_per_cell> vertices; + for (unsigned int vertex_n = 0; vertex_n < n_vertices_per_cell; ++vertex_n) vertices[vertex_n] = object->vertex(vertex_n); auto get_point_from_weights = - [&](const Tensor<1, GeometryInfo::vertices_per_cell> &weights) + [&](const Tensor<1, n_vertices_per_cell> &weights) -> Point { return object->get_manifold().get_new_point (make_array_view(vertices.begin(), vertices.end()), make_array_view(&weights[0], - &weights[GeometryInfo::vertices_per_cell - 1] + 1)); + &weights[n_vertices_per_cell - 1] + 1)); }; // pick the initial weights as (normalized) inverse distances from // the trial point: - Tensor<1, GeometryInfo::vertices_per_cell> guess_weights; + Tensor<1, n_vertices_per_cell> guess_weights; double guess_weights_sum = 0.0; - for (unsigned int vertex_n = 0; vertex_n < GeometryInfo::vertices_per_cell; + for (unsigned int vertex_n = 0; vertex_n < n_vertices_per_cell; ++vertex_n) { const double distance = vertices[vertex_n].distance(trial_point); @@ -2952,10 +2952,10 @@ namespace GridTools // for (unsigned int outer_n = 0; outer_n < 40; ++outer_n) { - const unsigned int dependent_direction = GeometryInfo::vertices_per_cell - 1; - Tensor<1, GeometryInfo::vertices_per_cell> current_gradient; + const unsigned int dependent_direction = n_vertices_per_cell - 1; + Tensor<1, n_vertices_per_cell> current_gradient; for (unsigned int row_n = 0; - row_n < GeometryInfo::vertices_per_cell; + row_n < n_vertices_per_cell; ++row_n) { if (row_n != dependent_direction) @@ -3021,7 +3021,7 @@ namespace GridTools // between zero and one. If the update takes us outside of this // region then rescale the update to stay within the region and // try again - Tensor<1, GeometryInfo::vertices_per_cell> tentative_weights = + Tensor<1, n_vertices_per_cell> tentative_weights = guess_weights + gradient_weight*current_gradient; double new_gradient_weight = gradient_weight; @@ -3030,7 +3030,7 @@ namespace GridTools if (internal::weights_are_ok(tentative_weights)) break; - for (unsigned int i = 0; i < GeometryInfo::vertices_per_cell; ++i) + for (unsigned int i = 0; i < n_vertices_per_cell; ++i) { if (tentative_weights[i] < 0.0) { diff --git a/include/deal.II/multigrid/multigrid.h b/include/deal.II/multigrid/multigrid.h index db3b1d7fed..58be672f13 100644 --- a/include/deal.II/multigrid/multigrid.h +++ b/include/deal.II/multigrid/multigrid.h @@ -93,7 +93,9 @@ public: * The DoFHandler is actually not needed. */ template +#ifndef _MSC_VER DEAL_II_DEPRECATED +#endif Multigrid(const DoFHandler &mg_dof_handler, const MGMatrixBase &matrix, const MGCoarseGridBase &coarse, diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 6ac4f7d380..6d38fa3dcb 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -1579,8 +1579,14 @@ namespace VectorTools const Quadrature &q_boundary, const bool project_to_boundary_first) { +#ifdef _MSC_VER + Assert(false, + ExcMessage("Please specify the mapping explicitly " + "when building with MSVC!")); +#else project(StaticMappingQ1::mapping, dof, constraints, quadrature, function, vec, enforce_zero_boundary, q_boundary, project_to_boundary_first); +#endif } diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index c9e3d92011..68e59a763d 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -297,6 +297,13 @@ namespace parallel Assert (false, ExcNotImplemented()); } + template + void + Triangulation::fill_level_ghost_owners() + { + Assert(false, ExcNotImplemented()); + } + #endif template diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 130916c333..84bba371ee 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -119,7 +119,7 @@ namespace FEValuesViews // variables from FEValuesBase, but they aren't initialized yet // at the time we get here, so re-create it all const std::vector shape_function_to_row_table - = internal::make_shape_function_to_row_table (fe); + = dealii::internal::make_shape_function_to_row_table (fe); for (unsigned int i=0; i shape_function_to_row_table - = internal::make_shape_function_to_row_table (fe); + = dealii::internal::make_shape_function_to_row_table (fe); for (unsigned int d=0; d shape_function_to_row_table - = internal::make_shape_function_to_row_table (fe); + = dealii::internal::make_shape_function_to_row_table (fe); for (unsigned int d = 0; d < dealii::SymmetricTensor<2,dim>::n_independent_components; ++d) { @@ -377,7 +377,7 @@ namespace FEValuesViews // variables from FEValuesBase, but they aren't initialized yet // at the time we get here, so re-create it all const std::vector shape_function_to_row_table - = internal::make_shape_function_to_row_table (fe); + = dealii::internal::make_shape_function_to_row_table (fe); for (unsigned int d = 0; d < dim*dim; ++d) { @@ -2609,7 +2609,7 @@ namespace internal // the rows in the tables storing the data by shape function and // nonzero component this->shape_function_to_row_table - = internal::make_shape_function_to_row_table (fe); + = dealii::internal::make_shape_function_to_row_table (fe); // count the total number of non-zero components accumulated // over all shape functions diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index c355dd79de..9a74d866a3 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -934,8 +934,8 @@ get_intermediate_point (const Point &p1, const Point &p2, const double w) const { - const std::array, 2> points({{p1, p2}}); - const std::array weights({{1.-w, w}}); + const std::array, 2> points {{p1, p2}}; + const std::array weights {{1.-w, w}}; return get_new_point(make_array_view(points.begin(), points.end()), make_array_view(weights.begin(), weights.end())); } -- 2.39.5