From 533f3863861d273b2b8b86bff2997c71e6a84ef3 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 5 Aug 2015 17:12:04 -0500 Subject: [PATCH] Windows porting: Minor refactoring to make MSVC happy Those are minor code changes necessary to compile the library with MSVC. --- include/deal.II/base/numbers.h | 4 +++- include/deal.II/base/quadrature_lib.h | 2 +- include/deal.II/numerics/error_estimator.h | 16 ++++++++-------- source/base/quadrature_lib.cc | 8 ++++---- source/numerics/error_estimator.cc | 16 ++++++++-------- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 70ce3cdb58..fe06328e91 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -19,6 +19,8 @@ #include #include + +#include #include DEAL_II_NAMESPACE_OPEN @@ -318,7 +320,7 @@ namespace numbers typename NumberTraits::real_type NumberTraits::abs (const number &x) { - return std::fabs(x); + return std::abs(x); } diff --git a/include/deal.II/base/quadrature_lib.h b/include/deal.II/base/quadrature_lib.h index 82df8966f1..db25354b60 100644 --- a/include/deal.II/base/quadrature_lib.h +++ b/include/deal.II/base/quadrature_lib.h @@ -571,7 +571,7 @@ public: enum EndPoint { left,right }; /// Generate a formula with n quadrature points QGaussRadauChebyshev(const unsigned int n, - QGaussRadauChebyshev::EndPoint ep=QGaussRadauChebyshev::left); + EndPoint ep=QGaussRadauChebyshev::left); private: const EndPoint ep; diff --git a/include/deal.II/numerics/error_estimator.h b/include/deal.II/numerics/error_estimator.h index ef55c85b2b..d79b29e80b 100644 --- a/include/deal.II/numerics/error_estimator.h +++ b/include/deal.II/numerics/error_estimator.h @@ -337,7 +337,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** * Calls the @p estimate function, see above, with @@ -354,7 +354,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** * Same function as above, but accepts more than one solution vector and @@ -381,7 +381,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** * Calls the @p estimate function, see above, with @@ -398,7 +398,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** @@ -417,7 +417,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** @@ -435,7 +435,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** @@ -454,7 +454,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** @@ -472,7 +472,7 @@ public: const unsigned int n_threads = numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id, const types::material_id material_id = numbers::invalid_material_id, - const KellyErrorEstimator::Strategy strategy = cell_diameter_over_24); + const Strategy strategy = cell_diameter_over_24); /** * Exception diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index a25dafe365..3eead3a7ea 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -1201,7 +1201,7 @@ QGaussChebyshev::QGaussChebyshev (const unsigned int n) template <> std::vector QGaussRadauChebyshev<1>::get_quadrature_points(const unsigned int n, - QGaussRadauChebyshev::EndPoint ep) + EndPoint ep) { std::vector points(n); @@ -1225,7 +1225,7 @@ QGaussRadauChebyshev<1>::get_quadrature_points(const unsigned int n, template <> std::vector QGaussRadauChebyshev<1>::get_quadrature_weights(const unsigned int n, - QGaussRadauChebyshev::EndPoint ep) + EndPoint ep) { std::vector weights(n); @@ -1267,7 +1267,7 @@ QGaussRadauChebyshev<1>::QGaussRadauChebyshev(const unsigned int n, template <> QGaussRadauChebyshev<2>::QGaussRadauChebyshev (const unsigned int n, - QGaussRadauChebyshev::EndPoint ep) + EndPoint ep) : Quadrature<2> (QGaussRadauChebyshev<1>(n, static_cast::EndPoint>(ep)), QGaussRadauChebyshev<1>(n, static_cast::EndPoint>(ep))), @@ -1277,7 +1277,7 @@ QGaussRadauChebyshev<2>::QGaussRadauChebyshev (const unsigned int n, template QGaussRadauChebyshev::QGaussRadauChebyshev (const unsigned int n, - QGaussRadauChebyshev::EndPoint ep) + EndPoint ep) : Quadrature (QGaussRadauChebyshev(n,static_cast::EndPoint>(ep)), QGaussRadauChebyshev<1>(n,static_cast::EndPoint>(ep))), diff --git a/source/numerics/error_estimator.cc b/source/numerics/error_estimator.cc index cad9799838..ae49a61dce 100644 --- a/source/numerics/error_estimator.cc +++ b/source/numerics/error_estimator.cc @@ -954,7 +954,7 @@ estimate (const Mapping &mapping, const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { // just pass on to the other function const std::vector solutions (1, &solution); @@ -978,7 +978,7 @@ estimate (const DH &dof_handler, const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { estimate(StaticMappingQ1::mapping, dof_handler, quadrature, neumann_bc, solution, error, component_mask, coefficients, n_threads, @@ -1001,7 +1001,7 @@ estimate (const Mapping &mapping, const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { // just pass on to the other function const std::vector solutions (1, &solution); @@ -1025,7 +1025,7 @@ estimate (const DH &dof_handler, const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { estimate(StaticMappingQ1::mapping, dof_handler, quadrature, neumann_bc, solution, error, component_mask, coefficients, n_threads, @@ -1050,7 +1050,7 @@ estimate (const Mapping &mapping, const unsigned int , const types::subdomain_id subdomain_id_, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { #ifdef DEAL_II_WITH_P4EST if (dynamic_cast*> @@ -1214,7 +1214,7 @@ estimate (const Mapping &mapping, const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { // forward to the function with the QCollection estimate (mapping, dof_handler, @@ -1237,7 +1237,7 @@ void KellyErrorEstimator::estimate (const DH const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { estimate(StaticMappingQ1::mapping, dof_handler, quadrature, neumann_bc, solutions, errors, component_mask, coefficients, n_threads, @@ -1258,7 +1258,7 @@ void KellyErrorEstimator::estimate (const DH const unsigned int n_threads, const types::subdomain_id subdomain_id, const types::material_id material_id, - const typename KellyErrorEstimator::Strategy strategy) + const Strategy strategy) { estimate(StaticMappingQ1::mapping, dof_handler, quadrature, neumann_bc, solutions, errors, component_mask, coefficients, n_threads, -- 2.39.5