From: Wolfgang Bangerth Date: Thu, 1 Oct 2015 21:45:07 +0000 (-0500) Subject: Change compute_mapping_support_points to return its data. X-Git-Tag: v8.4.0-rc2~349^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b3ffac659201d4ffedf64ed5ca584a86170fa76;p=dealii.git Change compute_mapping_support_points to return its data. The previous version returned the list of points via its last argument, but this is no longer necessary in times of C++11. --- diff --git a/include/deal.II/fe/mapping_q1_eulerian.h b/include/deal.II/fe/mapping_q1_eulerian.h index fc17a1734a..af7dc1771b 100644 --- a/include/deal.II/fe/mapping_q1_eulerian.h +++ b/include/deal.II/fe/mapping_q1_eulerian.h @@ -151,11 +151,12 @@ protected: /** * Compute the support points of the mapping. For the current class, these are * the vertices, as obtained by calling Mapping::get_vertices(). + * See the documentation of MappingQGeneric::compute_mapping_support_points() + * for more information. */ virtual - void - compute_mapping_support_points(const typename Triangulation::cell_iterator &cell, - std::vector > &a) const; + std::vector > + compute_mapping_support_points(const typename Triangulation::cell_iterator &cell) const; /** * Reference to the vector of shifts. diff --git a/include/deal.II/fe/mapping_q_eulerian.h b/include/deal.II/fe/mapping_q_eulerian.h index f4bd91316b..7be9b15f48 100644 --- a/include/deal.II/fe/mapping_q_eulerian.h +++ b/include/deal.II/fe/mapping_q_eulerian.h @@ -211,13 +211,13 @@ private: mutable Threads::Mutex fe_values_mutex; /** - * Compute the positions of the support points in the current configuration + * Compute the positions of the support points in the current configuration. + * See the documentation of MappingQGeneric::compute_mapping_support_points() + * for more information. */ virtual - void - compute_mapping_support_points(const typename Triangulation::cell_iterator &cell, - std::vector > &a) const; - + std::vector > + compute_mapping_support_points(const typename Triangulation::cell_iterator &cell) const; }; /*@}*/ diff --git a/include/deal.II/fe/mapping_q_generic.h b/include/deal.II/fe/mapping_q_generic.h index a4049bdc56..a96dbcb9f7 100644 --- a/include/deal.II/fe/mapping_q_generic.h +++ b/include/deal.II/fe/mapping_q_generic.h @@ -509,9 +509,12 @@ protected: Table<2,double> support_point_weights_on_hex; /** - * An interface that derived classes have to implement and that - * computes the locations of support points for the mapping. For - * example, for MappingQ1 these are the vertices. However, other + * Return the locations of support points for the mapping. For + * example, for $Q_1$ mappings these are the vertices, and for higher + * order polynomial mappings they are the vertices plus interior + * points on edges, faces, and the cell interior that are placed + * in consultation with the Manifold description of the domain and + * its boundary. However, other * classes may override this function differently. In particular, * the MappingQ1Eulerian class does exactly this by not computing * the support points from the geometry of the current cell but @@ -537,9 +540,8 @@ protected: * the locations of interior points. */ virtual - void - compute_mapping_support_points (const typename Triangulation::cell_iterator &cell, - std::vector > &a) const; + std::vector > + compute_mapping_support_points (const typename Triangulation::cell_iterator &cell) const; /** * Transforms the point @p p on the real cell to the corresponding point on diff --git a/source/fe/mapping_q1_eulerian.cc b/source/fe/mapping_q1_eulerian.cc index 4393d813cb..08dedcf024 100644 --- a/source/fe/mapping_q1_eulerian.cc +++ b/source/fe/mapping_q1_eulerian.cc @@ -89,17 +89,18 @@ get_vertices template -void +std::vector > MappingQ1Eulerian:: -compute_mapping_support_points(const typename Triangulation::cell_iterator &cell, - std::vector > &a) const +compute_mapping_support_points(const typename Triangulation::cell_iterator &cell) const { const std_cxx11::array, GeometryInfo::vertices_per_cell> vertices = this->get_vertices(cell); - a.resize(GeometryInfo::vertices_per_cell); + std::vector > a(GeometryInfo::vertices_per_cell); for (unsigned int i=0; i::vertices_per_cell; ++i) a[i] = vertices[i]; + + return a; } diff --git a/source/fe/mapping_q_eulerian.cc b/source/fe/mapping_q_eulerian.cc index 51b8654498..56d4cbad0d 100644 --- a/source/fe/mapping_q_eulerian.cc +++ b/source/fe/mapping_q_eulerian.cc @@ -133,8 +133,7 @@ get_vertices (const typename Triangulation::cell_iterator &cell) const { // get the vertices as the first 2^dim mapping support points - std::vector > a; - compute_mapping_support_points(cell, a); + const std::vector > a = compute_mapping_support_points(cell); std_cxx11::array, GeometryInfo::vertices_per_cell> vertex_locations; std::copy (a.begin(), @@ -147,10 +146,9 @@ get_vertices template -void +std::vector > MappingQEulerian:: -compute_mapping_support_points (const typename Triangulation::cell_iterator &cell, - std::vector > &a) const +compute_mapping_support_points (const typename Triangulation::cell_iterator &cell) const { // first, basic assertion with respect to vector size, @@ -197,13 +195,15 @@ compute_mapping_support_points (const typename Triangulation::cell // and finally compute the positions of the support points in the deformed // configuration. - a.resize(n_support_pts); + std::vector > a(n_support_pts); for (unsigned int q=0; q::cell_it FiniteElementData (get_dpo_vector(polynomial_degree), 1, polynomial_degree))); - std::vector > support_points (tensor_pols.n()); - this->compute_mapping_support_points(cell, support_points); + const std::vector > support_points + = this->compute_mapping_support_points(cell); Point mapped_point; for (unsigned int i=0; i mdata (get_data(update_flags, point_quadrature)); - this->compute_mapping_support_points (cell, mdata->mapping_support_points); + mdata->mapping_support_points = this->compute_mapping_support_points (cell); // dispatch to the various specializations for spacedim=dim, // spacedim=dim+1, etc @@ -1464,7 +1464,7 @@ transform_real_to_unit_cell_internal std_cxx11::unique_ptr mdata (get_data(update_flags, point_quadrature)); - this->compute_mapping_support_points (cell, mdata->mapping_support_points); + mdata->mapping_support_points = this->compute_mapping_support_points (cell); // dispatch to the various specializations for spacedim=dim, // spacedim=dim+1, etc @@ -1490,7 +1490,7 @@ transform_real_to_unit_cell_internal std_cxx11::unique_ptr mdata (get_data(update_flags, point_quadrature)); - this->compute_mapping_support_points (cell, mdata->mapping_support_points); + mdata->mapping_support_points = this->compute_mapping_support_points (cell); // dispatch to the various specializations for spacedim=dim, // spacedim=dim+1, etc @@ -1516,7 +1516,7 @@ transform_real_to_unit_cell_internal std_cxx11::unique_ptr mdata (get_data(update_flags, point_quadrature)); - this->compute_mapping_support_points (cell, mdata->mapping_support_points); + mdata->mapping_support_points = this->compute_mapping_support_points (cell); // dispatch to the various specializations for spacedim=dim, // spacedim=dim+1, etc @@ -1542,7 +1542,7 @@ transform_real_to_unit_cell_internal std_cxx11::unique_ptr mdata (get_data(update_flags, point_quadrature)); - this->compute_mapping_support_points (cell, mdata->mapping_support_points); + mdata->mapping_support_points = this->compute_mapping_support_points (cell); // dispatch to the various specializations for spacedim=dim, // spacedim=dim+1, etc @@ -1938,8 +1938,8 @@ transform_real_to_unit_cell (const typename Triangulation::cell_it // Find the initial value for the Newton iteration by a normal // projection to the least square plane determined by the vertices // of the cell - std::vector > a; - this->compute_mapping_support_points (cell,a); + const std::vector > a + = this->compute_mapping_support_points (cell); Assert(a.size() == GeometryInfo::vertices_per_cell, ExcInternalError()); initial_p_unit = internal::MappingQ1::transform_real_to_unit_cell_initial_guess(a,p); @@ -1955,8 +1955,8 @@ transform_real_to_unit_cell (const typename Triangulation::cell_it // we do this by first getting all support points, then // throwing away all but the vertices, and finally calling // the same function as above - std::vector > a; - this->compute_mapping_support_points (cell,a); + std::vector > a + = this->compute_mapping_support_points (cell); a.resize(GeometryInfo::vertices_per_cell); initial_p_unit = internal::MappingQ1::transform_real_to_unit_cell_initial_guess(a,p); } @@ -2588,7 +2588,7 @@ fill_fe_values (const typename Triangulation::cell_iterator &cell, || (cell != data.cell_of_current_support_points)) { - this->compute_mapping_support_points(cell, data.mapping_support_points); + data.mapping_support_points = this->compute_mapping_support_points(cell); data.cell_of_current_support_points = cell; } @@ -2976,7 +2976,7 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & || (cell != data.cell_of_current_support_points)) { - this->compute_mapping_support_points(cell, data.mapping_support_points); + data.mapping_support_points = this->compute_mapping_support_points(cell); data.cell_of_current_support_points = cell; } @@ -3021,7 +3021,7 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato || (cell != data.cell_of_current_support_points)) { - this->compute_mapping_support_points(cell, data.mapping_support_points); + data.mapping_support_points = this->compute_mapping_support_points(cell); data.cell_of_current_support_points = cell; } @@ -3862,13 +3862,12 @@ add_quad_support_points(const typename Triangulation::cell_iterato template -void +std::vector > MappingQGeneric:: -compute_mapping_support_points(const typename Triangulation::cell_iterator &cell, - std::vector > &a) const +compute_mapping_support_points(const typename Triangulation::cell_iterator &cell) const { // get the vertices first - a.resize(GeometryInfo::vertices_per_cell); + std::vector > a(GeometryInfo::vertices_per_cell); for (unsigned int i=0; i::vertices_per_cell; ++i) a[i] = cell->vertex(i); @@ -3906,6 +3905,8 @@ compute_mapping_support_points(const typename Triangulation::cell_ Assert(false, ExcNotImplemented()); break; } + + return a; }