From: Lukas Korous Date: Fri, 12 Dec 2014 15:05:07 +0000 (+0100) Subject: Squashed changes for build working both on MSVC and other compilers. X-Git-Tag: v8.2.0-rc1~18^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9fc6226c8c7068f1ea353e4d696e5bf6b07af54;p=dealii.git Squashed changes for build working both on MSVC and other compilers. --- diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 4e615cc1dd..f9ce7420f9 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -40,6 +40,37 @@ namespace hp class SparsityPattern; +namespace internal +{ + template + class ActiveCellIterator + { + public: + typedef typename Container::active_cell_iterator type; + }; + + 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 + }; + + 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 + }; +} /** * This namespace is a collection of algorithms working on triangulations, @@ -426,7 +457,11 @@ namespace GridTools * to be checked for this case. */ template class Container, int spacedim> - std::vector::active_cell_iterator> +#ifndef _MSC_VER + std::vector::active_cell_iterator> +#else + std::vector >::type> +#endif find_cells_adjacent_to_vertex (const Container &container, const unsigned int vertex_index); @@ -463,7 +498,11 @@ namespace GridTools * will have to decide what to do in that case. */ template class Container, int spacedim> +#ifndef _MSC_VER typename Container::active_cell_iterator +#else + typename dealii::internal::ActiveCellIterator >::type +#endif find_active_cell_around_point (const Container &container, const Point &p); @@ -514,7 +553,11 @@ namespace GridTools * will have to decide what to do in that case. */ template class Container, int spacedim> - std::pair::active_cell_iterator, Point > +#ifndef _MSC_VER + std::pair::active_cell_iterator, Point > +#else + std::pair >::type, Point > +#endif find_active_cell_around_point (const Mapping &mapping, const Container &container, const Point &p); @@ -540,7 +583,7 @@ namespace GridTools * will have to decide what to do in that case. */ template - std::pair::active_cell_iterator, Point > + std::pair::active_cell_iterator, Point > find_active_cell_around_point (const hp::MappingCollection &mapping, const hp::DoFHandler &container, const Point &p); diff --git a/include/deal.II/numerics/derivative_approximation.h b/include/deal.II/numerics/derivative_approximation.h index 875cbcb101..da68daee45 100644 --- a/include/deal.II/numerics/derivative_approximation.h +++ b/include/deal.II/numerics/derivative_approximation.h @@ -24,7 +24,9 @@ #include #include #include - +#ifdef _MSC_VER +#include +#endif #include DEAL_II_NAMESPACE_OPEN @@ -275,9 +277,9 @@ namespace DerivativeApproximation const DH &dof, const InputVector &solution, #ifndef _MSC_VER - const typename DH::active_cell_iterator &cell, + const typename DH::active_cell_iterator &cell, #else - const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, + const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, #endif Tensor &derivative, const unsigned int component = 0); @@ -290,9 +292,9 @@ namespace DerivativeApproximation approximate_derivative_tensor(const DH &dof, const InputVector &solution, #ifndef _MSC_VER - const typename DH::active_cell_iterator &cell, + const typename DH::active_cell_iterator &cell, #else - const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, + const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, #endif Tensor &derivative, const unsigned int component = 0); diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index c84f8e0a24..b13770f410 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -70,7 +70,7 @@ namespace Functions qp = get_reference_coordinates (cell, p); if (!qp) { - const std::pair > my_pair + const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); AssertThrow (my_pair.first->is_locally_owned(), ExcPointNotAvailableHere()); @@ -121,7 +121,7 @@ namespace Functions qp = get_reference_coordinates (cell, p); if (!qp) { - const std::pair > my_pair + const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); AssertThrow (my_pair.first->is_locally_owned(), ExcPointNotAvailableHere()); @@ -174,7 +174,7 @@ namespace Functions qp = get_reference_coordinates (cell, p); if (!qp) { - const std::pair > my_pair + const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); AssertThrow (my_pair.first->is_locally_owned(), ExcPointNotAvailableHere()); @@ -441,7 +441,7 @@ namespace Functions qp = get_reference_coordinates (cell, points[0]); if (!qp) { - const std::pair > + const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[0]); AssertThrow (my_pair.first->is_locally_owned(), @@ -506,7 +506,7 @@ namespace Functions // the next cell if (left_over == true) { - const std::pair > my_pair + const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[first_outside]); AssertThrow (my_pair.first->is_locally_owned(), ExcPointNotAvailableHere()); diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 72a11fedef..95ee495eee 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -910,7 +910,11 @@ namespace GridTools template class Container, int spacedim> - std::vector::active_cell_iterator> +#ifndef _MSC_VER + std::vector::active_cell_iterator> +#else + std::vector >::type> +#endif find_cells_adjacent_to_vertex(const Container &container, const unsigned int vertex) { @@ -925,9 +929,9 @@ namespace GridTools // use a set instead of a vector // to ensure that cells are inserted only // once - std::set::active_cell_iterator> adjacent_cells; + std::set >::type> adjacent_cells; - typename Container::active_cell_iterator + typename dealii::internal::ActiveCellIterator >::type cell = container.begin_active(), endc = container.end(); @@ -1039,7 +1043,7 @@ next_cell: // return the result as a vector, rather than the set we built above return - std::vector::active_cell_iterator> + std::vector >::type> (adjacent_cells.begin(), adjacent_cells.end()); } @@ -1049,10 +1053,19 @@ next_cell: { template class Container, int spacedim> void find_active_cell_around_point_internal(const Container &container, - std::set::active_cell_iterator> &searched_cells, - std::set::active_cell_iterator> &adjacent_cells) +#ifndef _MSC_VER + std::set::active_cell_iterator> &searched_cells, + std::set::active_cell_iterator> &adjacent_cells) +#else + std::set >::type> &searched_cells, + std::set >::type> &adjacent_cells) +#endif { - typedef typename Container::active_cell_iterator cell_iterator; +#ifndef _MSC_VER + typedef typename Container::active_cell_iterator cell_iterator; +#else + typedef typename dealii::internal::ActiveCellIterator >::type cell_iterator; +#endif // update the searched cells searched_cells.insert(adjacent_cells.begin(), adjacent_cells.end()); @@ -1094,7 +1107,11 @@ next_cell: } template class Container, int spacedim> - typename Container::active_cell_iterator +#ifndef _MSC_VER + typename Container::active_cell_iterator +#else + typename dealii::internal::ActiveCellIterator >::type +#endif find_active_cell_around_point (const Container &container, const Point &p) { @@ -1106,12 +1123,16 @@ next_cell: template class Container, int spacedim> - std::pair::active_cell_iterator, Point > +#ifndef _MSC_VER + std::pair::active_cell_iterator, Point > +#else + std::pair >::type, Point > +#endif find_active_cell_around_point (const Mapping &mapping, const Container &container, const Point &p) { - typedef typename Container::active_cell_iterator active_cell_iterator; + typedef typename dealii::internal::ActiveCellIterator >::type active_cell_iterator; // The best distance is set to the // maximum allowable distance from @@ -1367,7 +1388,7 @@ next_cell: std::map< std::pair, unsigned int > indexmap; unsigned int index = 0; - for (typename Triangulation::active_cell_iterator + for (typename dealii::internal::ActiveCellIterator >::type cell = triangulation.begin_active(); cell != triangulation.end(); ++cell, ++index) indexmap[std::pair(cell->level(),cell->index())] = index; @@ -1389,7 +1410,7 @@ next_cell: // add entries in both directions // for both cells index = 0; - for (typename Triangulation::active_cell_iterator + for (typename dealii::internal::ActiveCellIterator >::type cell = triangulation.begin_active(); cell != triangulation.end(); ++cell, ++index) { @@ -1428,7 +1449,7 @@ next_cell: // check for an easy return if (n_partitions == 1) { - for (typename Triangulation::active_cell_iterator + for (typename dealii::internal::ActiveCellIterator >::type cell = triangulation.begin_active(); cell != triangulation.end(); ++cell) cell->set_subdomain_id (0); @@ -1472,7 +1493,7 @@ next_cell: // check for an easy return if (n_partitions == 1) { - for (typename Triangulation::active_cell_iterator + for (typename dealii::internal::ActiveCellIterator >::type cell = triangulation.begin_active(); cell != triangulation.end(); ++cell) cell->set_subdomain_id (0); @@ -1489,7 +1510,7 @@ next_cell: // finally loop over all cells and set the // subdomain ids unsigned int index = 0; - for (typename Triangulation::active_cell_iterator + for (typename dealii::internal::ActiveCellIterator >::type cell = triangulation.begin_active(); cell != triangulation.end(); ++cell, ++index) cell->set_subdomain_id (partition_indices[index]); @@ -1547,7 +1568,7 @@ next_cell: if (const parallel::distributed::Triangulation *tr = dynamic_cast *> (&triangulation)) - for (typename Triangulation::active_cell_iterator + for (typename dealii::internal::ActiveCellIterator >::type cell = triangulation.begin_active(); cell != triangulation.end(); ++cell) if (cell->is_artificial() diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index 1c2ee8d9ec..6749419546 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -37,16 +37,15 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const Point &); template - std::vector - find_cells_adjacent_to_vertex(const X &, - const unsigned int); + std::vector::type> + find_cells_adjacent_to_vertex(const X &, const unsigned int); + template - X::active_cell_iterator - find_active_cell_around_point (const X &, - const Point &p); + dealii::internal::ActiveCellIterator::type + find_active_cell_around_point (const X &, const Point &p); template - std::pair > + std::pair::type, Point > find_active_cell_around_point (const Mapping &, const X &, const Point &); @@ -81,16 +80,16 @@ for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS const Point &); template - std::vector::active_cell_iterator> + std::vector >::type> find_cells_adjacent_to_vertex(const parallel::distributed::Triangulation &, const unsigned int); template - parallel::distributed::Triangulation::active_cell_iterator + dealii::internal::ActiveCellIterator >::type find_active_cell_around_point (const parallel::distributed::Triangulation &, const Point &p); template - std::pair::active_cell_iterator, Point > + std::pair >::type, Point > find_active_cell_around_point (const Mapping &, const parallel::distributed::Triangulation &, const Point &); @@ -116,12 +115,12 @@ for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS for (deal_II_space_dimension : SPACE_DIMENSIONS) { - parallel::distributed::Triangulation::active_cell_iterator + dealii::internal::ActiveCellIterator >::type find_active_cell_around_point (const parallel::distributed::Triangulation &, const Point &p); - std::pair::active_cell_iterator, Point > + std::pair >::type, Point > find_active_cell_around_point (const Mapping &, const parallel::distributed::Triangulation &, const Point &); diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index 23e568a545..4f3500a800 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -753,17 +753,16 @@ namespace DerivativeApproximation namespace internal { /** - * Compute the derivative approximation on one cell. This computes the full - * derivative tensor. - */ - template class DH, class InputVector, int spacedim> + * Compute the derivative approximation on one cell. This computes the full + * derivative tensor. + */ + template class DH, class InputVector, int spacedim> void approximate_cell (const Mapping &mapping, const DH &dof_handler, const InputVector &solution, const unsigned int component, - const typename DH::active_cell_iterator &cell, + const TriaActiveIterator < dealii::DoFCellAccessor < DH < dim, spacedim >, false > > &cell, typename DerivativeDescription::Derivative &derivative) { QMidpoint midpoint_rule; @@ -792,7 +791,8 @@ namespace DerivativeApproximation // active neighbors of a cell // reserve the maximal number of // active neighbors - std::vector::active_cell_iterator> active_neighbors; + std::vector, false > > > active_neighbors; + active_neighbors.reserve (GeometryInfo::faces_per_cell * GeometryInfo::max_children_per_face); @@ -834,11 +834,11 @@ namespace DerivativeApproximation // now loop over all active // neighbors and collect the // data we need - typename std::vector::active_cell_iterator>::const_iterator + typename std::vector, false > > >::const_iterator neighbor_ptr = active_neighbors.begin(); for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr) { - const typename DH::active_cell_iterator + const TriaActiveIterator < dealii::DoFCellAccessor < DH < dim, spacedim >, false > > neighbor = *neighbor_ptr; // reinit fe values object... @@ -929,11 +929,12 @@ namespace DerivativeApproximation template class DH, class InputVector, int spacedim> void - approximate (SynchronousIterators::active_cell_iterator,Vector::iterator> > const &cell, - const Mapping &mapping, - const DH &dof_handler, - const InputVector &solution, - const unsigned int component) + approximate( + SynchronousIterators, false > >, Vector::iterator> > const &cell, + const Mapping &mapping, + const DH &dof_handler, + const InputVector &solution, + const unsigned int component) { // if the cell is not locally owned, then there is nothing to do if (std_cxx11::get<0>(cell.iterators)->is_locally_owned() == false) @@ -943,8 +944,9 @@ namespace DerivativeApproximation typename DerivativeDescription::Derivative derivative; // call the function doing the actual // work on this cell - approximate_cell + approximate_cell (mapping,dof_handler,solution,component,std_cxx11::get<0>(cell.iterators),derivative); + // evaluate the norm and fill the vector //*derivative_norm_on_this_cell *std_cxx11::get<1>(cell.iterators) = DerivativeDescription::derivative_norm (derivative); @@ -977,7 +979,7 @@ namespace DerivativeApproximation Assert (component < dof_handler.get_fe().n_components(), ExcIndexRange (component, 0, dof_handler.get_fe().n_components())); - typedef std_cxx11::tuple::active_cell_iterator,Vector::iterator> + typedef std_cxx11::tuple, false > >, Vector::iterator> Iterators; SynchronousIterators begin(Iterators(dof_handler.begin_active(), derivative_norm.begin())), @@ -1076,9 +1078,9 @@ namespace DerivativeApproximation const DH &dof, const InputVector &solution, #ifndef _MSC_VER - const typename DH::active_cell_iterator &cell, + const typename DH::active_cell_iterator &cell, #else - const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, + const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, #endif Tensor &derivative, const unsigned int component) @@ -1099,9 +1101,9 @@ namespace DerivativeApproximation approximate_derivative_tensor(const DH &dof, const InputVector &solution, #ifndef _MSC_VER - const typename DH::active_cell_iterator &cell, + const typename DH::active_cell_iterator &cell, #else - const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, + const TriaActiveIterator < dealii::DoFCellAccessor < DH, false > > &cell, #endif Tensor &derivative, const unsigned int component)