From f98c434f6230f50fe2a79997bfe905662b6ac189 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 5 Feb 2014 16:57:35 +0000 Subject: [PATCH] Hopefully make MS VC++'s life a bit easier. Also leave a note in the documentation in a couple of places. git-svn-id: https://svn.dealii.org/trunk@32412 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/numerics/data_out.h | 9 ++- .../include/deal.II/numerics/data_out_faces.h | 31 ++++++++-- .../deal.II/numerics/data_out_rotation.h | 27 +++++++-- deal.II/source/numerics/data_out_faces.cc | 57 ++++++++++--------- deal.II/source/numerics/data_out_rotation.cc | 54 +++++++++--------- deal.II/source/numerics/error_estimator.cc | 10 ++-- 6 files changed, 118 insertions(+), 70 deletions(-) diff --git a/deal.II/include/deal.II/numerics/data_out.h b/deal.II/include/deal.II/numerics/data_out.h index 961fed7c20..64bb199e4c 100644 --- a/deal.II/include/deal.II/numerics/data_out.h +++ b/deal.II/include/deal.II/numerics/data_out.h @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999 - 2013 by the deal.II authors +// Copyright (C) 1999 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -137,6 +137,13 @@ namespace internal * this pair of functions and they return a non-active cell, then an exception * will be thrown. * + * @precondition This class only makes sense if the first template + * argument, dim equals the dimension of the + * DoFHandler type given as the second template argument, i.e., if + * dim == DH::dimension. This redundancy is a historical + * relic from the time where the library had only a single DoFHandler + * class and this class consequently only a single template argument. + * * @ingroup output * @author Wolfgang Bangerth, 1999 */ diff --git a/deal.II/include/deal.II/numerics/data_out_faces.h b/deal.II/include/deal.II/numerics/data_out_faces.h index ada6d1aa91..1a6f9427e2 100644 --- a/deal.II/include/deal.II/numerics/data_out_faces.h +++ b/deal.II/include/deal.II/numerics/data_out_faces.h @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000 - 2013 by the deal.II authors +// Copyright (C) 2000 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -108,6 +108,13 @@ namespace internal * applications certainly exist, for which the author is not * imaginative enough. * + * @precondition This class only makes sense if the first template + * argument, dim equals the dimension of the + * DoFHandler type given as the second template argument, i.e., if + * dim == DH::dimension. This redundancy is a historical + * relic from the time where the library had only a single DoFHandler + * class and this class consequently only a single template argument. + * * @todo Reimplement this whole class using actual FEFaceValues and MeshWorker. * * @ingroup output @@ -118,13 +125,25 @@ class DataOutFaces : public DataOut_DoFData { public: + /** + * An abbreviation for the dimension of the DoFHandler object we work + * with. Faces are then dimension-1 dimensional objects. + */ + static const unsigned int dimension = DH::dimension; + + /** + * An abbreviation for the spatial dimension within which the triangulation + * and DoFHandler are embedded in. + */ + static const unsigned int space_dimension = DH::space_dimension; + /** * Typedef to the iterator type * of the dof handler class under * consideration. */ - typedef typename DataOut_DoFData::cell_iterator cell_iterator; + typedef typename DataOut_DoFData::cell_iterator cell_iterator; /** * Constructor determining @@ -193,7 +212,7 @@ public: * replaced by a hp::MappingCollection in * case of a hp::DoFHandler. */ - virtual void build_patches (const Mapping &mapping, + virtual void build_patches (const Mapping &mapping, const unsigned int n_subdivisions = 0); /** @@ -291,8 +310,8 @@ private: * context. */ void build_one_patch (const FaceDescriptor *cell_and_face, - internal::DataOutFaces::ParallelData &data, - DataOutBase::Patch &patch); + internal::DataOutFaces::ParallelData &data, + DataOutBase::Patch &patch); }; diff --git a/deal.II/include/deal.II/numerics/data_out_rotation.h b/deal.II/include/deal.II/numerics/data_out_rotation.h index f8e8d8aa91..1f6ea01a94 100644 --- a/deal.II/include/deal.II/numerics/data_out_rotation.h +++ b/deal.II/include/deal.II/numerics/data_out_rotation.h @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000 - 2013 by the deal.II authors +// Copyright (C) 2000 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -114,6 +114,13 @@ namespace internal * It is in the responsibility of the user to make sure that the * radial variable attains only non-negative values. * + * @precondition This class only makes sense if the first template + * argument, dim equals the dimension of the + * DoFHandler type given as the second template argument, i.e., if + * dim == DH::dimension. This redundancy is a historical + * relic from the time where the library had only a single DoFHandler + * class and this class consequently only a single template argument. + * * @ingroup output * @author Wolfgang Bangerth, 2000 */ @@ -121,12 +128,24 @@ template > class DataOutRotation : public DataOut_DoFData { public: + /** + * An abbreviation for the dimension of the DoFHandler object we work + * with. Faces are then dimension-1 dimensional objects. + */ + static const unsigned int dimension = DH::dimension; + + /** + * An abbreviation for the spatial dimension within which the triangulation + * and DoFHandler are embedded in. + */ + static const unsigned int space_dimension = DH::space_dimension; + /** * Typedef to the iterator type * of the dof handler class under * consideration. */ - typedef typename DataOut_DoFData::cell_iterator cell_iterator; + typedef typename DataOut_DoFData::cell_iterator cell_iterator; /** * This is the central function @@ -212,8 +231,8 @@ private: */ void build_one_patch (const cell_iterator *cell, - internal::DataOutRotation::ParallelData &data, - std::vector > &patches); + internal::DataOutRotation::ParallelData &data, + std::vector > &patches); }; diff --git a/deal.II/source/numerics/data_out_faces.cc b/deal.II/source/numerics/data_out_faces.cc index 9f26567228..a14c34428f 100644 --- a/deal.II/source/numerics/data_out_faces.cc +++ b/deal.II/source/numerics/data_out_faces.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000 - 2013 by the deal.II authors +// Copyright (C) 2000 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -77,7 +77,10 @@ template DataOutFaces::DataOutFaces(const bool so) : surface_only(so) -{} +{ + Assert (dim == DH::dimension, + ExcNotImplemented()); +} @@ -85,8 +88,8 @@ template void DataOutFaces:: build_one_patch (const FaceDescriptor *cell_and_face, - internal::DataOutFaces::ParallelData &data, - DataOutBase::Patch &patch) + internal::DataOutFaces::ParallelData &data, + DataOutBase::Patch &patch) { Assert (cell_and_face->first->is_locally_owned(), ExcNotImplemented()); @@ -95,10 +98,10 @@ build_one_patch (const FaceDescriptor *cell_and_face, // on cells, not faces, so transform the face vertex to a cell vertex, that // to a unit cell vertex and then, finally, that to the mapped vertex. In // most cases this complicated procedure will be the identity. - for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) + for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) patch.vertices[vertex] = data.mapping_collection[0].transform_unit_to_real_cell (cell_and_face->first, - GeometryInfo::unit_cell_vertex + GeometryInfo::unit_cell_vertex (GeometryInfo::face_to_cell_vertices (cell_and_face->second, vertex, @@ -110,25 +113,25 @@ build_one_patch (const FaceDescriptor *cell_and_face, { data.reinit_all_fe_values(this->dof_data, cell_and_face->first, cell_and_face->second); - const FEValuesBase &fe_patch_values + const FEValuesBase &fe_patch_values = data.get_present_fe_values (0); const unsigned int n_q_points = fe_patch_values.n_quadrature_points; // store the intermediate points - Assert(patch.space_dim==DH::dimension, ExcInternalError()); - const std::vector > &q_points=fe_patch_values.get_quadrature_points(); + Assert(patch.space_dim==dimension, ExcInternalError()); + const std::vector > &q_points=fe_patch_values.get_quadrature_points(); // resize the patch.data member in order to have enough memory for the // quadrature points as well - patch.data.reinit(data.n_datasets+DH::dimension, + patch.data.reinit(data.n_datasets+dimension, patch.data.size(1)); // set the flag indicating that for this cell the points are explicitly // given patch.points_are_available=true; // copy points to patch.data - for (unsigned int i=0; idof_data.size(); ++dataset) { - const FEValuesBase &fe_patch_values + const FEValuesBase &fe_patch_values = data.get_present_fe_values (dataset); const unsigned int n_components = fe_patch_values.get_fe().n_components(); @@ -246,7 +249,7 @@ build_one_patch (const FaceDescriptor *cell_and_face, Assert (cell_and_face->first->active(), ExcCellNotActiveForCellData()); const unsigned int cell_number = std::distance (this->triangulation->begin_active(), - typename Triangulation::active_cell_iterator(cell_and_face->first)); + typename Triangulation::active_cell_iterator(cell_and_face->first)); const double value = this->cell_data[dataset]->get_cell_data_value (cell_number); @@ -262,17 +265,17 @@ build_one_patch (const FaceDescriptor *cell_and_face, template void DataOutFaces::build_patches (const unsigned int n_subdivisions_) { - build_patches (StaticMappingQ1::mapping, n_subdivisions_); + build_patches (StaticMappingQ1::mapping, n_subdivisions_); } template -void DataOutFaces::build_patches (const Mapping &mapping, +void DataOutFaces::build_patches (const Mapping &mapping, const unsigned int n_subdivisions_) { // Check consistency of redundant template parameter - Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); + Assert (dim==dimension, ExcDimensionMismatch(dim, dimension)); const unsigned int n_subdivisions = (n_subdivisions_ != 0) ? n_subdivisions_ @@ -281,7 +284,7 @@ void DataOutFaces::build_patches (const Mapping &mapping, Assert (n_subdivisions >= 1, ExcInvalidNumberOfSubdivisions(n_subdivisions)); - typedef DataOut_DoFData BaseClass; + typedef DataOut_DoFData BaseClass; Assert (this->triangulation != 0, typename BaseClass::ExcNoTriangulationSelected()); @@ -316,17 +319,17 @@ void DataOutFaces::build_patches (const Mapping &mapping, update_flags |= this->dof_data[i]->postprocessor->get_needed_update_flags(); update_flags |= update_quadrature_points; - internal::DataOutFaces::ParallelData + internal::DataOutFaces::ParallelData thread_data (n_datasets, n_subdivisions, n_postprocessor_outputs, mapping, this->get_finite_elements(), update_flags); - DataOutBase::Patch sample_patch; + DataOutBase::Patch sample_patch; sample_patch.n_subdivisions = n_subdivisions; sample_patch.data.reinit (n_datasets, - Utilities::fixed_power(n_subdivisions+1)); + Utilities::fixed_power(n_subdivisions+1)); // now build the patches in parallel WorkStream::run (&all_faces[0], @@ -334,7 +337,7 @@ void DataOutFaces::build_patches (const Mapping &mapping, std_cxx1x::bind(&DataOutFaces::build_one_patch, this, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3), std_cxx1x::bind(&internal::DataOutFaces:: - append_patch_to_list, + append_patch_to_list, std_cxx1x::_1, std_cxx1x::ref(this->patches)), thread_data, sample_patch); @@ -348,9 +351,9 @@ DataOutFaces::first_face () { // simply find first active cell // with a face on the boundary - typename Triangulation::active_cell_iterator cell = this->triangulation->begin_active(); + typename Triangulation::active_cell_iterator cell = this->triangulation->begin_active(); for (; cell != this->triangulation->end(); ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) + for (unsigned int f=0; f::faces_per_cell; ++f) if (!surface_only || cell->face(f)->at_boundary()) return FaceDescriptor(cell, f); @@ -370,7 +373,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) FaceDescriptor face = old_face; // first check whether the present cell has more faces on the boundary - for (unsigned int f=face.second+1; f::faces_per_cell; ++f) + for (unsigned int f=face.second+1; f::faces_per_cell; ++f) if (!surface_only || face.first->face(f)->at_boundary()) // yup, that is so, so return it { @@ -382,7 +385,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) // convert the iterator to an active_iterator and advance this to the next // active cell - typename Triangulation::active_cell_iterator active_cell = face.first; + typename Triangulation::active_cell_iterator active_cell = face.first; // increase face pointer by one ++active_cell; @@ -391,7 +394,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) while (active_cell != this->triangulation->end()) { // check all the faces of this active cell - for (unsigned int f=0; f::faces_per_cell; ++f) + for (unsigned int f=0; f::faces_per_cell; ++f) if (!surface_only || active_cell->face(f)->at_boundary()) { face.first = active_cell; diff --git a/deal.II/source/numerics/data_out_rotation.cc b/deal.II/source/numerics/data_out_rotation.cc index 82464c5557..e53a3f3513 100644 --- a/deal.II/source/numerics/data_out_rotation.cc +++ b/deal.II/source/numerics/data_out_rotation.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000 - 2013 by the deal.II authors +// Copyright (C) 2000 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -95,8 +95,8 @@ template void DataOutRotation:: build_one_patch (const cell_iterator *cell, - internal::DataOutRotation::ParallelData &data, - std::vector > &patches) + internal::DataOutRotation::ParallelData &data, + std::vector > &patches) { if (dim == 3) { @@ -118,12 +118,12 @@ build_one_patch (const cell_iterator *cell, // which we will put points in the whole domain (not the rotationally // reduced one in which the computation took place. for simplicity add the // initial direction at the end again - std::vector > angle_directions (n_patches_per_circle+1); + std::vector > angle_directions (n_patches_per_circle+1); for (unsigned int i=0; i<=n_patches_per_circle; ++i) { - angle_directions[i][DH::dimension-1] = std::cos(2*numbers::PI * + angle_directions[i][dimension-1] = std::cos(2*numbers::PI * i/n_patches_per_circle); - angle_directions[i][DH::dimension] = std::sin(2*numbers::PI * + angle_directions[i][dimension] = std::sin(2*numbers::PI * i/n_patches_per_circle); } @@ -132,7 +132,7 @@ build_one_patch (const cell_iterator *cell, // first compute the vertices of the patch. note that they will have to // be computed from the vertices of the cell, which has one dimension // less, however. - switch (DH::dimension) + switch (dimension) { case 1: { @@ -152,10 +152,10 @@ build_one_patch (const cell_iterator *cell, case 2: { for (unsigned int vertex=0; - vertex::vertices_per_cell; + vertex::vertices_per_cell; ++vertex) { - const Point v = (*cell)->vertex(vertex); + const Point v = (*cell)->vertex(vertex); // make sure that the radial variable does attain negative // values @@ -165,9 +165,9 @@ build_one_patch (const cell_iterator *cell, patches[angle].vertices[vertex] = v(0) * angle_directions[angle]; patches[angle].vertices[vertex][0] = v(1); - patches[angle].vertices[vertex+GeometryInfo::vertices_per_cell] + patches[angle].vertices[vertex+GeometryInfo::vertices_per_cell] = v(0) * angle_directions[angle+1]; - patches[angle].vertices[vertex+GeometryInfo::vertices_per_cell][0] + patches[angle].vertices[vertex+GeometryInfo::vertices_per_cell][0] = v(1); }; @@ -187,7 +187,7 @@ build_one_patch (const cell_iterator *cell, // first fill dof_data for (unsigned int dataset=0; datasetdof_data.size(); ++dataset) { - const FEValuesBase &fe_patch_values + const FEValuesBase &fe_patch_values = data.get_present_fe_values(dataset); const unsigned int n_components = fe_patch_values.get_fe().n_components(); @@ -217,7 +217,7 @@ build_one_patch (const cell_iterator *cell, if (update_flags & update_quadrature_points) data.patch_evaluation_points = fe_patch_values.get_quadrature_points(); - std::vector > dummy_normals; + std::vector > dummy_normals; postprocessor-> compute_derived_quantities_scalar(data.patch_values, data.patch_gradients, @@ -245,7 +245,7 @@ build_one_patch (const cell_iterator *cell, if (update_flags & update_quadrature_points) data.patch_evaluation_points = fe_patch_values.get_quadrature_points(); - std::vector > dummy_normals; + std::vector > dummy_normals; postprocessor-> compute_derived_quantities_vector(data.patch_values_system, data.patch_gradients_system, @@ -259,7 +259,7 @@ build_one_patch (const cell_iterator *cell, componentdof_data[dataset]->n_output_variables; ++component) { - switch (DH::dimension) + switch (dimension) { case 1: for (unsigned int x=0; xdof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); - switch (DH::dimension) + switch (dimension) { case 1: for (unsigned int x=0; xtriangulation->begin_active(), - typename Triangulation::active_cell_iterator(*cell)); + typename Triangulation::active_cell_iterator(*cell)); const double value = this->cell_data[dataset]->get_cell_data_value (cell_number); - switch (DH::dimension) + switch (dimension) { case 1: for (unsigned int x=0; x::build_patches (const unsigned int n_patches_per_ci { // Check consistency of redundant // template parameter - Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); - typedef DataOut_DoFData BaseClass; + Assert (dim==dimension, ExcDimensionMismatch(dim, dimension)); + typedef DataOut_DoFData BaseClass; Assert (this->triangulation != 0, typename BaseClass::ExcNoTriangulationSelected()); @@ -455,19 +455,19 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci else n_postprocessor_outputs[dataset] = 0; - const MappingQ1 mapping; - internal::DataOutRotation::ParallelData + const MappingQ1 mapping; + internal::DataOutRotation::ParallelData thread_data (n_datasets, n_subdivisions, n_patches_per_circle, n_postprocessor_outputs, mapping, this->get_finite_elements(), update_flags); - std::vector > + std::vector > new_patches (n_patches_per_circle); for (unsigned int i=0; i(n_subdivisions+1)); + Utilities::fixed_power(n_subdivisions+1)); } // now build the patches in parallel @@ -476,7 +476,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci std_cxx1x::bind(&DataOutRotation::build_one_patch, this, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3), std_cxx1x::bind(&internal::DataOutRotation - ::append_patch_to_list, + ::append_patch_to_list, std_cxx1x::_1, std_cxx1x::ref(this->patches)), thread_data, new_patches); @@ -499,7 +499,7 @@ DataOutRotation::next_cell (const cell_iterator &cell) // convert the iterator to an // active_iterator and advance // this to the next active cell - typename Triangulation::active_cell_iterator active_cell = cell; + typename Triangulation::active_cell_iterator active_cell = cell; ++active_cell; return active_cell; } diff --git a/deal.II/source/numerics/error_estimator.cc b/deal.II/source/numerics/error_estimator.cc index 83e89a9afa..19fbf0c542 100644 --- a/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/source/numerics/error_estimator.cc @@ -1,7 +1,7 @@ // --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998 - 2013 by the deal.II authors +// Copyright (C) 1998 - 2014 by the deal.II authors // // This file is part of the deal.II library. // @@ -186,8 +186,8 @@ namespace internal */ template ParallelData (const FE &fe, - const dealii::hp::QCollection &face_quadratures, - const dealii::hp::MappingCollection &mapping, + const dealii::hp::QCollection &face_quadratures, + const dealii::hp::MappingCollection &mapping, const bool need_quadrature_points, const unsigned int n_solution_vectors, const types::subdomain_id subdomain_id, @@ -209,8 +209,8 @@ namespace internal template ParallelData:: ParallelData (const FE &fe, - const dealii::hp::QCollection &face_quadratures, - const dealii::hp::MappingCollection &mapping, + const dealii::hp::QCollection &face_quadratures, + const dealii::hp::MappingCollection &mapping, const bool need_quadrature_points, const unsigned int n_solution_vectors, const types::subdomain_id subdomain_id, -- 2.39.5