From a50c001e412f05929096bf6f3032fc67c73c2246 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 20 Nov 2020 23:08:56 -0700 Subject: [PATCH] Remove template argument `DoFHandlerType` for classes ... ... SolutionTransfer, FEFieldFunction, DataOut, DataOut_DoFData, DataOutFaces, DataOutRotation. --- .../changes/incompatibilities/20201121Fehling | 30 +++ examples/step-34/step-34.cc | 19 +- examples/step-38/step-38.cc | 9 +- examples/step-60/step-60.cc | 2 +- .../deal.II/distributed/solution_transfer.h | 33 +-- include/deal.II/numerics/data_out.h | 45 ++-- include/deal.II/numerics/data_out_dof_data.h | 169 ++++++------ .../numerics/data_out_dof_data.templates.h | 209 +++++++-------- include/deal.II/numerics/data_out_faces.h | 36 +-- include/deal.II/numerics/data_out_rotation.h | 30 +-- include/deal.II/numerics/fe_field_function.h | 39 ++- .../numerics/fe_field_function.templates.h | 135 +++++----- include/deal.II/numerics/solution_transfer.h | 38 ++- source/distributed/solution_transfer.cc | 147 +++++------ source/distributed/solution_transfer.inst.in | 46 ++-- source/grid/grid_out.cc | 2 +- source/numerics/data_out.cc | 240 ++++++++---------- source/numerics/data_out.inst.in | 9 +- source/numerics/data_out_dof_data.inst.in | 94 +++---- .../numerics/data_out_dof_data_codim.inst.in | 44 ++-- source/numerics/data_out_faces.cc | 147 +++++------ source/numerics/data_out_faces.inst.in | 3 +- source/numerics/data_out_rotation.cc | 116 ++++----- source/numerics/data_out_rotation.inst.in | 3 +- source/numerics/fe_field_function.inst.in | 7 +- source/numerics/solution_transfer.cc | 92 ++++--- source/numerics/solution_transfer.inst.in | 11 +- 27 files changed, 804 insertions(+), 951 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20201121Fehling diff --git a/doc/news/changes/incompatibilities/20201121Fehling b/doc/news/changes/incompatibilities/20201121Fehling new file mode 100644 index 0000000000..13ea01436a --- /dev/null +++ b/doc/news/changes/incompatibilities/20201121Fehling @@ -0,0 +1,30 @@ +Deprecated: The template arguments of the following classes have been +changed to avoid the legacy argument `DoFHandlerType`: + +Please change your code accordingly. +
+If for some reason, you need a code that is compatible with deal.II +9.3 and the subsequent release, a Legacy namespace has been introduced +with aliases of these classes with their original interface. You can +make the following substitutions to your code for each of the affected +classes: + +To perform this substitution automatically, you may use a *search and +replace* script like the following made for the *bash* shell: +@code{.sh} +classes=(SolutionTransfer parallel::distributed::SolutionTransfer Functions::FEFieldFunction DataOut DataOut_DoFData DataOutFaces DataOutRotation) +for c in \${classes[@]}; do + find /path/to/your/code -type f -exec sed -i -E "/(\w\${c}|\${c}[^<]|Particles::\${c}|distributed::\${c}|^\s*(\/\/|\*))/! s/\${c}/Legacy::\${c}/g" {} \; +done +@endcode +(Marc Fehling, 2020/11/21) diff --git a/examples/step-34/step-34.cc b/examples/step-34/step-34.cc index 2c535c53e3..db6d4c55e2 100644 --- a/examples/step-34/step-34.cc +++ b/examples/step-34/step-34.cc @@ -999,19 +999,16 @@ namespace Step34 template void BEMProblem::output_results(const unsigned int cycle) { - DataOut> dataout; + DataOut dataout; dataout.attach_dof_handler(dof_handler); - dataout.add_data_vector( - phi, "phi", DataOut>::type_dof_data); - dataout.add_data_vector( - alpha, - "alpha", - DataOut>::type_dof_data); - dataout.build_patches( - mapping, - mapping.get_degree(), - DataOut>::curved_inner_cells); + dataout.add_data_vector(phi, "phi", DataOut::type_dof_data); + dataout.add_data_vector(alpha, + "alpha", + DataOut::type_dof_data); + dataout.build_patches(mapping, + mapping.get_degree(), + DataOut::curved_inner_cells); const std::string filename = std::to_string(dim) + "d_boundary_solution_" + std::to_string(cycle) + ".vtk"; diff --git a/examples/step-38/step-38.cc b/examples/step-38/step-38.cc index f86e1c392c..d00baa161c 100644 --- a/examples/step-38/step-38.cc +++ b/examples/step-38/step-38.cc @@ -462,12 +462,11 @@ namespace Step38 template void LaplaceBeltramiProblem::output_results() const { - DataOut> data_out; + DataOut data_out; data_out.attach_dof_handler(dof_handler); - data_out.add_data_vector( - solution, - "solution", - DataOut>::type_dof_data); + data_out.add_data_vector(solution, + "solution", + DataOut::type_dof_data); data_out.build_patches(mapping, mapping.get_degree()); const std::string filename = diff --git a/examples/step-60/step-60.cc b/examples/step-60/step-60.cc index acfe56d454..162f876f5c 100644 --- a/examples/step-60/step-60.cc +++ b/examples/step-60/step-60.cc @@ -1008,7 +1008,7 @@ namespace Step60 // embedded_mapping to the DataOut::build_patches function. The mapping will // take care of outputting the result on the actual deformed configuration. - DataOut> embedded_out; + DataOut embedded_out; std::ofstream embedded_out_file("embedded.vtu"); diff --git a/include/deal.II/distributed/solution_transfer.h b/include/deal.II/distributed/solution_transfer.h index 02706b2b2a..3137c93fa6 100644 --- a/include/deal.II/distributed/solution_transfer.h +++ b/include/deal.II/distributed/solution_transfer.h @@ -218,17 +218,9 @@ namespace parallel * * @ingroup distributed */ - template > + template class SolutionTransfer { -#ifndef DEAL_II_MSVC - static_assert(dim == DoFHandlerType::dimension, - "The dimension explicitly provided as a template " - "argument, and the dimension of the DoFHandlerType " - "template argument must match."); -#endif public: /** * Constructor. @@ -238,7 +230,7 @@ namespace parallel * points to the Triangulation before the refinement in question * happens. */ - SolutionTransfer(const DoFHandlerType &dof); + SolutionTransfer(const DoFHandler &dof); /** * Destructor. @@ -320,8 +312,8 @@ namespace parallel /** * Pointer to the degree of freedom handler to work with. */ - SmartPointer> + SmartPointer, + SolutionTransfer> dof_handler; /** @@ -343,10 +335,8 @@ namespace parallel */ std::vector pack_callback( - const typename Triangulation:: - cell_iterator &cell, - const typename Triangulation:: - CellStatus status); + const typename Triangulation::cell_iterator &cell, + const typename Triangulation::CellStatus status); /** * A callback function used to unpack the data on the current mesh that @@ -355,10 +345,8 @@ namespace parallel */ void unpack_callback( - const typename Triangulation:: - cell_iterator &cell, - const typename Triangulation:: - CellStatus status, + const typename Triangulation::cell_iterator &cell, + const typename Triangulation::CellStatus status, const boost::iterator_range::const_iterator> & data_range, std::vector &all_out); @@ -388,8 +376,9 @@ namespace Legacy template > - using SolutionTransfer DEAL_II_DEPRECATED = dealii::parallel:: - distributed::SolutionTransfer; + using SolutionTransfer DEAL_II_DEPRECATED = + dealii::parallel::distributed:: + SolutionTransfer; } // namespace distributed } // namespace parallel } // namespace Legacy diff --git a/include/deal.II/numerics/data_out.h b/include/deal.II/numerics/data_out.h index 1541b24a92..cdd7a14717 100644 --- a/include/deal.II/numerics/data_out.h +++ b/include/deal.II/numerics/data_out.h @@ -143,26 +143,16 @@ namespace internal * * @ingroup output */ -template > -class DataOut : public DataOut_DoFData +template +class DataOut : public DataOut_DoFData { public: - static_assert(dim == DoFHandlerType::dimension, - "The dimension given explicitly as a template argument to " - "this class must match the dimension of the DoFHandler " - "template argument"); - static constexpr unsigned int spacedim = DoFHandlerType::space_dimension; - /** * Typedef to the iterator type of the dof handler class under * consideration. */ using cell_iterator = - typename DataOut_DoFData::cell_iterator; + typename DataOut_DoFData::cell_iterator; /** * The type of the function object returning the first cell as used in @@ -317,20 +307,17 @@ public: * deformation of each vertex. */ virtual void - build_patches(const Mapping &mapping, - const unsigned int n_subdivisions = 0, - const CurvedCellRegion curved_region = curved_boundary); + build_patches(const Mapping &mapping, + const unsigned int n_subdivisions = 0, + const CurvedCellRegion curved_region = curved_boundary); /** * Same as above, but for hp::MappingCollection. */ virtual void - build_patches( - const hp::MappingCollection &mapping, - const unsigned int n_subdivisions = 0, - const CurvedCellRegion curved_region = curved_boundary); + build_patches(const hp::MappingCollection &mapping, + const unsigned int n_subdivisions = 0, + const CurvedCellRegion curved_region = curved_boundary); /** * A function that allows selecting for which cells output should be @@ -508,12 +495,11 @@ private: * reasons. */ void - build_one_patch(const std::pair *cell_and_index, - internal::DataOutImplementation::ParallelData< - DoFHandlerType::dimension, - DoFHandlerType::space_dimension> &scratch_data, - const unsigned int n_subdivisions, - const CurvedCellRegion curved_cell_region); + build_one_patch( + const std::pair *cell_and_index, + internal::DataOutImplementation::ParallelData &scratch_data, + const unsigned int n_subdivisions, + const CurvedCellRegion curved_cell_region); }; namespace Legacy @@ -523,7 +509,8 @@ namespace Legacy * instead. */ template > - using DataOut DEAL_II_DEPRECATED = dealii::DataOut; + using DataOut DEAL_II_DEPRECATED = + dealii::DataOut; } // namespace Legacy diff --git a/include/deal.II/numerics/data_out_dof_data.h b/include/deal.II/numerics/data_out_dof_data.h index e0e192bd16..264294e24d 100644 --- a/include/deal.II/numerics/data_out_dof_data.h +++ b/include/deal.II/numerics/data_out_dof_data.h @@ -591,19 +591,18 @@ namespace internal * * @ingroup output */ -template -class DataOut_DoFData : public DataOutInterface + int spacedim = dim, + int patch_spacedim = patch_dim> +class DataOut_DoFData : public DataOutInterface { public: /** * Typedef to the iterator type of the dof handler class under * consideration. */ - using cell_iterator = - typename Triangulation::cell_iterator; + using cell_iterator = typename Triangulation::cell_iterator; public: /** @@ -651,7 +650,7 @@ public: * object, then that contains all information needed to generate the output. */ void - attach_dof_handler(const DoFHandlerType &); + attach_dof_handler(const DoFHandler &); /** * Designate a triangulation to be used to extract geometry data and the @@ -663,8 +662,7 @@ public: * at all, in which case it provides the geometry. */ void - attach_triangulation(const Triangulation &); + attach_triangulation(const Triangulation &); /** * Add a data vector together with its name. @@ -788,9 +786,9 @@ public: template void add_data_vector( - const DoFHandlerType & dof_handler, - const VectorType & data, - const std::vector &names, + const DoFHandler &dof_handler, + const VectorType & data, + const std::vector & names, const std::vector &data_component_interpretation = std::vector< DataComponentInterpretation::DataComponentInterpretation>()); @@ -803,9 +801,9 @@ public: template void add_data_vector( - const DoFHandlerType &dof_handler, - const VectorType & data, - const std::string & name, + const DoFHandler &dof_handler, + const VectorType & data, + const std::string & name, const std::vector &data_component_interpretation = std::vector< DataComponentInterpretation::DataComponentInterpretation>()); @@ -838,9 +836,8 @@ public: */ template void - add_data_vector(const VectorType &data, - const DataPostprocessor - &data_postprocessor); + add_data_vector(const VectorType & data, + const DataPostprocessor &data_postprocessor); /** * Same function as above, but with a DoFHandler object that does not need @@ -850,10 +847,9 @@ public: */ template void - add_data_vector(const DoFHandlerType &dof_handler, - const VectorType & data, - const DataPostprocessor - &data_postprocessor); + add_data_vector(const DoFHandler & dof_handler, + const VectorType & data, + const DataPostprocessor &data_postprocessor); /** * Add a multilevel data vector. @@ -875,7 +871,7 @@ public: template void add_mg_data_vector( - const DoFHandlerType & dof_handler, + const DoFHandler &dof_handler, const MGLevelObject &data, const std::vector & names, const std::vector @@ -887,7 +883,7 @@ public: */ template void - add_mg_data_vector(const DoFHandlerType & dof_handler, + add_mg_data_vector(const DoFHandler &dof_handler, const MGLevelObject &data, const std::string & name); @@ -936,11 +932,23 @@ public: * This function will fail if either this or the other object did not yet * set up any patches. */ - template + template void merge_patches( - const DataOut_DoFData &source, - const Point &shift = Point()); + const DataOut_DoFData &source, + const Point &shift = Point()); + + /** + * @deprecated Use merge_patches() without the DoFHandlerType2 template + * instead. + */ + template + DEAL_II_DEPRECATED void + merge_patches(const DataOut_DoFData &source, + const Point &shift = Point()); /** * Release the pointers to the data vectors and the DoF handler. You have to @@ -962,34 +970,30 @@ protected: /** * Abbreviate the somewhat lengthy name for the Patch class. */ - using Patch = dealii::DataOutBase::Patch; + using Patch = dealii::DataOutBase::Patch; /** * Pointer to the triangulation object. */ - SmartPointer> - triangulation; + SmartPointer> triangulation; /** * Pointer to the optional handler object. */ - SmartPointer dofs; + SmartPointer> dofs; /** * List of data elements with vectors of values for each degree of freedom. */ - std::vector>> + std::vector>> dof_data; /** * List of data elements with vectors of values for each cell. */ - std::vector>> + std::vector>> cell_data; /** @@ -1017,9 +1021,7 @@ protected: * Extracts the finite elements stored in the dof_data object, including a * dummy object of FE_DGQ(0) in case only the triangulation is used. */ - std::vector< - std::shared_ptr>> + std::vector>> get_fes() const; /** @@ -1035,7 +1037,7 @@ protected: // Make all template siblings friends. Needed for the merge_patches() // function. - template + template friend class DataOut_DoFData; /** @@ -1050,10 +1052,10 @@ private: template void add_data_vector_internal( - const DoFHandlerType * dof_handler, - const VectorType & data, - const std::vector &names, - const DataVectorType type, + const DoFHandler *dof_handler, + const VectorType & data, + const std::vector & names, + const DataVectorType type, const std::vector & data_component_interpretation, const bool deduce_output_names); @@ -1062,10 +1064,10 @@ private: // -------------------- template and inline functions ------------------------ -template +template template void -DataOut_DoFData::add_data_vector( +DataOut_DoFData::add_data_vector( const VectorType & vec, const std::string & name, const DataVectorType type, @@ -1081,10 +1083,10 @@ DataOut_DoFData::add_data_vector( -template +template template void -DataOut_DoFData::add_data_vector( +DataOut_DoFData::add_data_vector( const VectorType & vec, const std::vector &names, const DataVectorType type, @@ -1099,13 +1101,13 @@ DataOut_DoFData::add_data_vector( -template +template template void -DataOut_DoFData::add_data_vector( - const DoFHandlerType &dof_handler, - const VectorType & data, - const std::string & name, +DataOut_DoFData::add_data_vector( + const DoFHandler &dof_handler, + const VectorType & data, + const std::string & name, const std::vector &data_component_interpretation) { @@ -1120,13 +1122,13 @@ DataOut_DoFData::add_data_vector( -template +template template void -DataOut_DoFData::add_data_vector( - const DoFHandlerType & dof_handler, - const VectorType & data, - const std::vector &names, +DataOut_DoFData::add_data_vector( + const DoFHandler &dof_handler, + const VectorType & data, + const std::vector & names, const std::vector &data_component_interpretation) { @@ -1140,12 +1142,12 @@ DataOut_DoFData::add_data_vector( -template +template template void -DataOut_DoFData::add_data_vector( - const VectorType & vec, - const DataPostprocessor &data_postprocessor) +DataOut_DoFData::add_data_vector( + const VectorType & vec, + const DataPostprocessor &data_postprocessor) { Assert(dofs != nullptr, Exceptions::DataOutImplementation::ExcNoDoFHandlerSelected()); @@ -1154,12 +1156,12 @@ DataOut_DoFData::add_data_vector( -template -template +template +template void -DataOut_DoFData::merge_patches( - const DataOut_DoFData &source, - const Point & shift) +DataOut_DoFData::merge_patches( + const DataOut_DoFData &source, + const Point & shift) { const std::vector &source_patches = source.get_patches(); Assert((patches.size() != 0) && (source_patches.size() != 0), @@ -1192,9 +1194,9 @@ DataOut_DoFData::merge_patches( Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(), Exceptions::DataOutImplementation::ExcIncompatiblePatchLists()); Assert((patches[0].data.n_rows() + - (patches[0].points_are_available ? 0 : patch_space_dim)) == + (patches[0].points_are_available ? 0 : patch_spacedim)) == (source_patches[0].data.n_rows() + - (source_patches[0].points_are_available ? 0 : patch_space_dim)), + (source_patches[0].points_are_available ? 0 : patch_spacedim)), Exceptions::DataOutImplementation::ExcIncompatiblePatchLists()); // check equality of the vector data @@ -1227,7 +1229,7 @@ DataOut_DoFData::merge_patches( patches.insert(patches.end(), source_patches.begin(), source_patches.end()); // perform shift, if so desired - if (shift != Point()) + if (shift != Point()) for (unsigned int i = old_n_patches; i < patches.size(); ++i) for (const unsigned int v : GeometryInfo::vertex_indices()) patches[i].vertices[v] += shift; @@ -1243,6 +1245,24 @@ DataOut_DoFData::merge_patches( patches[i].neighbors[n] += old_n_patches; } + + +template +template +void +DataOut_DoFData::merge_patches( + const DataOut_DoFData &source, + const Point & shift) +{ + this->merge_patches(source, shift); +} + + + namespace Legacy { /** @@ -1253,7 +1273,10 @@ namespace Legacy int patch_dim, int patch_space_dim = patch_dim> using DataOut_DoFData DEAL_II_DEPRECATED = - dealii::DataOut_DoFData; + dealii::DataOut_DoFData; } // namespace Legacy diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index cae34457c3..ba4077e2e0 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -702,9 +702,7 @@ namespace internal &data_component_interpretation) : dof_handler( dofs, - typeid( - dealii::DataOut_DoFData, dim, spacedim>) - .name()) + typeid(dealii::DataOut_DoFData).name()) , names(names_in) , data_component_interpretation(data_component_interpretation) , postprocessor(nullptr, typeid(*this).name()) @@ -737,9 +735,7 @@ namespace internal const DataPostprocessor *data_postprocessor) : dof_handler( dofs, - typeid( - dealii::DataOut_DoFData, dim, spacedim>) - .name()) + typeid(dealii::DataOut_DoFData).name()) , names(data_postprocessor->get_names()) , data_component_interpretation( data_postprocessor->get_data_component_interpretation()) @@ -1490,29 +1486,29 @@ namespace internal -template -DataOut_DoFData::DataOut_DoFData() +template +DataOut_DoFData::DataOut_DoFData() : triangulation(nullptr, typeid(*this).name()) , dofs(nullptr, typeid(*this).name()) {} -template -DataOut_DoFData::~DataOut_DoFData() +template +DataOut_DoFData::~DataOut_DoFData() { // virtual functions called in constructors and destructors never use the // override in a derived class for clarity be explicit on which function is // called - DataOut_DoFData::clear(); + DataOut_DoFData::clear(); } -template +template void -DataOut_DoFData::attach_dof_handler( - const DoFHandlerType &d) +DataOut_DoFData::attach_dof_handler( + const DoFHandler &d) { Assert(dof_data.size() == 0, Exceptions::DataOutImplementation::ExcOldDataStillPresent()); @@ -1520,20 +1516,18 @@ DataOut_DoFData::attach_dof_handler( Exceptions::DataOutImplementation::ExcOldDataStillPresent()); triangulation = - SmartPointer>( - &d.get_triangulation(), typeid(*this).name()); - dofs = SmartPointer(&d, typeid(*this).name()); + SmartPointer>(&d.get_triangulation(), + typeid(*this).name()); + dofs = + SmartPointer>(&d, typeid(*this).name()); } -template +template void -DataOut_DoFData:: - attach_triangulation( - const Triangulation &tria) +DataOut_DoFData::attach_triangulation( + const Triangulation &tria) { Assert(dof_data.size() == 0, Exceptions::DataOutImplementation::ExcOldDataStillPresent()); @@ -1541,20 +1535,19 @@ DataOut_DoFData:: Exceptions::DataOutImplementation::ExcOldDataStillPresent()); triangulation = - SmartPointer>( - &tria, typeid(*this).name()); + SmartPointer>(&tria, + typeid(*this).name()); } -template +template template void -DataOut_DoFData::add_data_vector( - const DoFHandlerType & dof_handler, - const VectorType & vec, - const DataPostprocessor &data_postprocessor) +DataOut_DoFData::add_data_vector( + const DoFHandler & dof_handler, + const VectorType & vec, + const DataPostprocessor &data_postprocessor) { // this is a specialized version of the other function where we have a // postprocessor. if we do, we know that we have type_dof_data, which makes @@ -1568,10 +1561,8 @@ DataOut_DoFData::add_data_vector( } else { - triangulation = - SmartPointer>( - &dof_handler.get_triangulation(), typeid(*this).name()); + triangulation = SmartPointer>( + &dof_handler.get_triangulation(), typeid(*this).name()); } Assert(vec.size() == dof_handler.n_dofs(), @@ -1582,24 +1573,22 @@ DataOut_DoFData::add_data_vector( auto new_entry = std::make_unique< - internal::DataOutImplementation::DataEntry>( + internal::DataOutImplementation::DataEntry>( &dof_handler, &vec, &data_postprocessor); dof_data.emplace_back(std::move(new_entry)); } -template +template template void -DataOut_DoFData:: +DataOut_DoFData:: add_data_vector_internal( - const DoFHandlerType * dof_handler, - const VectorType & data_vector, - const std::vector &names, - const DataVectorType type, + const DoFHandler *dof_handler, + const VectorType & data_vector, + const std::vector & names, + const DataVectorType type, const std::vector & data_component_interpretation_, const bool deduce_output_names) @@ -1608,10 +1597,8 @@ DataOut_DoFData:: if (triangulation == nullptr) { Assert(dof_handler != nullptr, ExcInternalError()); - triangulation = - SmartPointer>( - &dof_handler->get_triangulation(), typeid(*this).name()); + triangulation = SmartPointer>( + &dof_handler->get_triangulation(), typeid(*this).name()); } if (dof_handler != nullptr) @@ -1706,9 +1693,7 @@ DataOut_DoFData:: // finally, add the data vector: auto new_entry = std::make_unique< - internal::DataOutImplementation::DataEntry>( + internal::DataOutImplementation::DataEntry>( dof_handler, &data_vector, deduced_names, data_component_interpretation); if (actual_type == type_dof_data) @@ -1719,11 +1704,11 @@ DataOut_DoFData:: -template +template template void -DataOut_DoFData::add_mg_data_vector( - const DoFHandlerType & dof_handler, +DataOut_DoFData::add_mg_data_vector( + const DoFHandler &dof_handler, const MGLevelObject &data, const std::string & name) { @@ -1734,21 +1719,19 @@ DataOut_DoFData::add_mg_data_vector( -template +template template void -DataOut_DoFData::add_mg_data_vector( - const DoFHandlerType & dof_handler, +DataOut_DoFData::add_mg_data_vector( + const DoFHandler &dof_handler, const MGLevelObject &data, const std::vector & names, const std::vector &data_component_interpretation_) { if (triangulation == nullptr) - triangulation = - SmartPointer>( - &dof_handler.get_triangulation(), typeid(*this).name()); + triangulation = SmartPointer>( + &dof_handler.get_triangulation(), typeid(*this).name()); Assert(&dof_handler.get_triangulation() == triangulation, ExcMessage("The triangulation attached to the DoFHandler does not " @@ -1780,23 +1763,17 @@ DataOut_DoFData::add_mg_data_vector( ExcMessage( "Invalid number of entries in data_component_interpretation.")); - auto new_entry = - std::make_unique>(&dof_handler, - &data, - deduced_names, - data_component_interpretation); + auto new_entry = std::make_unique< + internal::DataOutImplementation::MGDataEntry>( + &dof_handler, &data, deduced_names, data_component_interpretation); dof_data.emplace_back(std::move(new_entry)); } -template +template void -DataOut_DoFData:: - clear_data_vectors() +DataOut_DoFData::clear_data_vectors() { dof_data.erase(dof_data.begin(), dof_data.end()); cell_data.erase(cell_data.begin(), cell_data.end()); @@ -1808,9 +1785,9 @@ DataOut_DoFData:: -template +template void -DataOut_DoFData:: +DataOut_DoFData:: clear_input_data_references() { for (unsigned int i = 0; i < dof_data.size(); ++i) @@ -1825,9 +1802,9 @@ DataOut_DoFData:: -template +template void -DataOut_DoFData::clear() +DataOut_DoFData::clear() { dof_data.erase(dof_data.begin(), dof_data.end()); cell_data.erase(cell_data.begin(), cell_data.end()); @@ -1842,9 +1819,9 @@ DataOut_DoFData::clear() -template +template std::vector -DataOut_DoFData::get_dataset_names() +DataOut_DoFData::get_dataset_names() const { std::vector names; @@ -1902,7 +1879,7 @@ DataOut_DoFData::get_dataset_names() { // It's a vector. First output all real parts, then all // imaginary parts: - const unsigned int size = patch_space_dim; + const unsigned int size = patch_spacedim; for (unsigned int vec_comp = 0; vec_comp < size; ++vec_comp) names.push_back(input_data->names[i + vec_comp] + "_re"); for (unsigned int vec_comp = 0; vec_comp < size; ++vec_comp) @@ -1918,7 +1895,7 @@ DataOut_DoFData::get_dataset_names() { // It's a tensor. First output all real parts, then all // imaginary parts: - const unsigned int size = patch_space_dim * patch_space_dim; + const unsigned int size = patch_spacedim * patch_spacedim; for (unsigned int tensor_comp = 0; tensor_comp < size; ++tensor_comp) names.push_back(input_data->names[i + tensor_comp] + @@ -1961,13 +1938,13 @@ DataOut_DoFData::get_dataset_names() -template +template std::vector< std::tuple> -DataOut_DoFData:: +DataOut_DoFData:: get_nonscalar_data_ranges() const { std::vector< @@ -2006,10 +1983,10 @@ DataOut_DoFData:: // ensure that there is a continuous number of next space_dim // components that all deal with vectors Assert( - i + patch_space_dim <= input_data->n_output_variables, + i + patch_spacedim <= input_data->n_output_variables, Exceptions::DataOutImplementation::ExcInvalidVectorDeclaration( i, input_data->names[i])); - for (unsigned int dd = 1; dd < patch_space_dim; ++dd) + for (unsigned int dd = 1; dd < patch_spacedim; ++dd) Assert( input_data->data_component_interpretation[i + dd] == DataComponentInterpretation::component_is_part_of_vector, @@ -2020,7 +1997,7 @@ DataOut_DoFData:: // name to these components. if not, leave the name empty and // let the output format writer decide what to do here std::string name = input_data->names[i]; - for (unsigned int dd = 1; dd < patch_space_dim; ++dd) + for (unsigned int dd = 1; dd < patch_spacedim; ++dd) if (name != input_data->names[i + dd]) { name = ""; @@ -2040,33 +2017,33 @@ DataOut_DoFData:: { ranges.emplace_back(std::forward_as_tuple( output_component, - output_component + patch_space_dim - 1, + output_component + patch_spacedim - 1, name, DataComponentInterpretation::component_is_part_of_vector)); // increase the 'component' counter by the appropriate amount, // same for 'i', since we have already dealt with all these // components - output_component += patch_space_dim; - i += patch_space_dim; + output_component += patch_spacedim; + i += patch_spacedim; } else { ranges.emplace_back(std::forward_as_tuple( output_component, - output_component + patch_space_dim - 1, + output_component + patch_spacedim - 1, name + "_re", DataComponentInterpretation::component_is_part_of_vector)); - output_component += patch_space_dim; + output_component += patch_spacedim; ranges.emplace_back(std::forward_as_tuple( output_component, - output_component + patch_space_dim - 1, + output_component + patch_spacedim - 1, name + "_im", DataComponentInterpretation::component_is_part_of_vector)); - output_component += patch_space_dim; + output_component += patch_spacedim; - i += patch_space_dim; + i += patch_spacedim; } @@ -2075,7 +2052,7 @@ DataOut_DoFData:: case DataComponentInterpretation::component_is_part_of_tensor: { - const unsigned int size = patch_space_dim * patch_space_dim; + const unsigned int size = patch_spacedim * patch_spacedim; // ensure that there is a continuous number of next // space_dim*space_dim components that all deal with tensors Assert( @@ -2157,24 +2134,20 @@ DataOut_DoFData:: -template -const std::vector> & -DataOut_DoFData::get_patches() const +template +const std::vector> & +DataOut_DoFData::get_patches() const { return patches; } -template -std::vector< - std::shared_ptr>> -DataOut_DoFData::get_fes() const +template +std::vector>> +DataOut_DoFData::get_fes() const { - const unsigned int dhdim = DoFHandlerType::dimension; - const unsigned int dhspacedim = DoFHandlerType::space_dimension; - std::vector>> + std::vector>> finite_elements(this->dof_data.size()); for (unsigned int i = 0; i < this->dof_data.size(); ++i) { @@ -2196,7 +2169,7 @@ DataOut_DoFData::get_fes() const } if (duplicate == false) finite_elements[i] = - std::make_shared>( + std::make_shared>( this->dof_data[i]->dof_handler->get_fe_collection()); } if (this->dof_data.empty()) @@ -2213,20 +2186,20 @@ DataOut_DoFData::get_fes() const { if (reference_cell.is_hyper_cube()) finite_elements.emplace_back( - std::make_shared>( - FE_DGQ(0))); + std::make_shared>( + FE_DGQ(0))); else if (reference_cell.is_simplex()) finite_elements.emplace_back( - std::make_shared>( - FE_SimplexDGP(1))); + std::make_shared>( + FE_SimplexDGP(1))); else if (reference_cell == dealii::ReferenceCells::Wedge) finite_elements.emplace_back( - std::make_shared>( - FE_WedgeDGP(1))); + std::make_shared>( + FE_WedgeDGP(1))); else if (reference_cell == dealii::ReferenceCells::Pyramid) finite_elements.emplace_back( - std::make_shared>( - FE_PyramidDGP(1))); + std::make_shared>( + FE_PyramidDGP(1))); else Assert(false, ExcNotImplemented()); } @@ -2236,12 +2209,12 @@ DataOut_DoFData::get_fes() const -template +template std::size_t -DataOut_DoFData:: - memory_consumption() const +DataOut_DoFData::memory_consumption() + const { - return (DataOutInterface::memory_consumption() + + return (DataOutInterface::memory_consumption() + MemoryConsumption::memory_consumption(dofs) + MemoryConsumption::memory_consumption(patches)); } diff --git a/include/deal.II/numerics/data_out_faces.h b/include/deal.II/numerics/data_out_faces.h index 2e0cbff450..2b941aadd8 100644 --- a/include/deal.II/numerics/data_out_faces.h +++ b/include/deal.II/numerics/data_out_faces.h @@ -112,31 +112,16 @@ namespace internal * * @ingroup output */ -template > -class DataOutFaces : public DataOut_DoFData +template +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 = DoFHandlerType::dimension; - - /** - * An abbreviation for the spatial dimension within which the triangulation - * and DoFHandler are embedded in. - */ - static const unsigned int space_dimension = DoFHandlerType::space_dimension; - /** * Alias to the iterator type of the dof handler class under * consideration. */ - using cell_iterator = typename DataOut_DoFData::cell_iterator; + using cell_iterator = + typename DataOut_DoFData::cell_iterator; /** * Constructor determining whether a surface mesh (default) or the whole @@ -182,8 +167,8 @@ public: * hp::MappingCollection in case of a DoFHandler with hp-capabilities. */ virtual void - build_patches(const Mapping &mapping, - const unsigned int n_subdivisions = 0); + build_patches(const Mapping &mapping, + const unsigned int n_subdivisions = 0); /** * Declare a way to describe a face which we would like to generate output @@ -244,10 +229,9 @@ private: */ void build_one_patch( - const FaceDescriptor *cell_and_face, - internal::DataOutFacesImplementation::ParallelData - & data, - DataOutBase::Patch &patch); + const FaceDescriptor * cell_and_face, + internal::DataOutFacesImplementation::ParallelData &data, + DataOutBase::Patch & patch); }; namespace Legacy @@ -258,7 +242,7 @@ namespace Legacy */ template > using DataOutFaces DEAL_II_DEPRECATED = - dealii::DataOutFaces; + dealii::DataOutFaces; } // namespace Legacy diff --git a/include/deal.II/numerics/data_out_rotation.h b/include/deal.II/numerics/data_out_rotation.h index f267987375..ed8e907d6d 100644 --- a/include/deal.II/numerics/data_out_rotation.h +++ b/include/deal.II/numerics/data_out_rotation.h @@ -118,29 +118,16 @@ namespace internal * * @ingroup output */ -template > -class DataOutRotation - : public DataOut_DoFData +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 = DoFHandlerType::dimension; - - /** - * An abbreviation for the spatial dimension within which the triangulation - * and DoFHandler are embedded in. - */ - static const unsigned int space_dimension = DoFHandlerType::space_dimension; - /** * Typedef to the iterator type of the dof handler class under * consideration. */ using cell_iterator = - typename DataOut_DoFData::cell_iterator; + typename DataOut_DoFData::cell_iterator; /** * This is the central function of this class since it builds the list of @@ -207,12 +194,9 @@ private: */ void build_one_patch( - const cell_iterator *cell, - internal::DataOutRotationImplementation::ParallelData - &data, - std::vector> - &my_patches); + const cell_iterator * cell, + internal::DataOutRotationImplementation::ParallelData &data, + std::vector> &my_patches); }; namespace Legacy @@ -223,7 +207,7 @@ namespace Legacy */ template > using DataOutRotation DEAL_II_DEPRECATED = - dealii::DataOutRotation; + dealii::DataOutRotation; } // namespace Legacy diff --git a/include/deal.II/numerics/fe_field_function.h b/include/deal.II/numerics/fe_field_function.h index c70fddbdcf..6f69942186 100644 --- a/include/deal.II/numerics/fe_field_function.h +++ b/include/deal.II/numerics/fe_field_function.h @@ -142,7 +142,7 @@ namespace Functions * for example, evaluating the solution at the origin (here using a parallel * TrilinosWrappers vector to hold the solution): * @code - * Functions::FEFieldFunction,TrilinosWrappers::MPI::Vector> + * Functions::FEFieldFunction * solution_function (dof_handler, solution); * Point origin = Point(); * @@ -163,9 +163,7 @@ namespace Functions * * @ingroup functions */ - template , - typename VectorType = Vector> + template , int spacedim = dim> class FEFieldFunction : public Function { public: @@ -178,9 +176,9 @@ namespace Functions * lay. Otherwise the standard Q1 mapping is used. */ FEFieldFunction( - const DoFHandlerType &dh, - const VectorType & data_vector, - const Mapping & mapping = StaticMappingQ1::mapping); + const DoFHandler &dh, + const VectorType & data_vector, + const Mapping & mapping = StaticMappingQ1::mapping); /** * Set the current cell. If you know in advance where your points lie, you @@ -189,7 +187,7 @@ namespace Functions */ void set_active_cell( - const typename DoFHandlerType::active_cell_iterator &newcell); + const typename DoFHandler::active_cell_iterator &newcell); /** * Get one vector value at the given point. It is inefficient to use @@ -438,23 +436,24 @@ namespace Functions */ unsigned int compute_point_locations( - const std::vector> & points, - std::vector &cells, - std::vector>> & qpoints, - std::vector> & maps) const; + const std::vector> &points, + std::vector::active_cell_iterator> + & cells, + std::vector>> & qpoints, + std::vector> &maps) const; private: /** * Typedef holding the local cell_hint. */ using cell_hint_t = Threads::ThreadLocalStorage< - typename DoFHandlerType::active_cell_iterator>; + typename DoFHandler::active_cell_iterator>; /** * Pointer to the dof handler. */ - SmartPointer> + SmartPointer, + FEFieldFunction> dh; /** @@ -470,7 +469,7 @@ namespace Functions /** * The Cache object */ - GridTools::Cache cache; + GridTools::Cache cache; /** * The latest cell hint. @@ -484,8 +483,8 @@ namespace Functions */ std_cxx17::optional> get_reference_coordinates( - const typename DoFHandlerType::active_cell_iterator &cell, - const Point & point) const; + const typename DoFHandler::active_cell_iterator &cell, + const Point &point) const; }; } // namespace Functions @@ -500,8 +499,8 @@ namespace Legacy template , typename VectorType = Vector> - using FEFieldFunction DEAL_II_DEPRECATED = - dealii::Functions::FEFieldFunction; + using FEFieldFunction DEAL_II_DEPRECATED = dealii::Functions:: + FEFieldFunction; } // namespace Functions } // namespace Legacy diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 8c3da383f7..1a0bacda7c 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -43,11 +43,11 @@ DEAL_II_NAMESPACE_OPEN namespace Functions { - template - FEFieldFunction::FEFieldFunction( - const DoFHandlerType &mydh, - const VectorType & myv, - const Mapping & mymapping) + template + FEFieldFunction::FEFieldFunction( + const DoFHandler &mydh, + const VectorType & myv, + const Mapping & mymapping) : Function( mydh.get_fe(0).n_components()) , dh(&mydh, "FEFieldFunction") @@ -59,34 +59,36 @@ namespace Functions - template + template void - FEFieldFunction::set_active_cell( - const typename DoFHandlerType::active_cell_iterator &newcell) + FEFieldFunction::set_active_cell( + const typename DoFHandler::active_cell_iterator &newcell) { cell_hint.get() = newcell; } - template + template void - FEFieldFunction::vector_value( + FEFieldFunction::vector_value( const Point & p, Vector &values) const { Assert(values.size() == this->n_components, ExcDimensionMismatch(values.size(), this->n_components)); - typename DoFHandlerType::active_cell_iterator cell = cell_hint.get(); + typename DoFHandler::active_cell_iterator cell = + cell_hint.get(); if (cell == dh->end()) cell = dh->begin_active(); std_cxx17::optional> qp = get_reference_coordinates(cell, p); if (!qp) { - const std::pair::type, - Point> + const std::pair< + typename dealii::internal:: + ActiveCellIterator>::type, + Point> my_pair = GridTools::find_active_cell_around_point(mapping, *dh, p); AssertThrow(my_pair.first.state() == IteratorState::valid && !my_pair.first->is_artificial(), @@ -114,9 +116,9 @@ namespace Functions - template + template typename VectorType::value_type - FEFieldFunction::value( + FEFieldFunction::value( const Point & p, const unsigned int comp) const { @@ -127,9 +129,9 @@ namespace Functions - template + template void - FEFieldFunction::vector_gradient( + FEFieldFunction::vector_gradient( const Point & p, std::vector> &gradients) const @@ -137,16 +139,18 @@ namespace Functions using number = typename VectorType::value_type; Assert(gradients.size() == this->n_components, ExcDimensionMismatch(gradients.size(), this->n_components)); - typename DoFHandlerType::active_cell_iterator cell = cell_hint.get(); + typename DoFHandler::active_cell_iterator cell = + cell_hint.get(); if (cell == dh->end()) cell = dh->begin_active(); std_cxx17::optional> qp = get_reference_coordinates(cell, p); if (!qp) { - const std::pair::type, - Point> + const std::pair< + typename dealii::internal:: + ActiveCellIterator>::type, + Point> my_pair = GridTools::find_active_cell_around_point(mapping, *dh, p); AssertThrow(my_pair.first.state() == IteratorState::valid && !my_pair.first->is_artificial(), @@ -189,9 +193,9 @@ namespace Functions - template + template Tensor<1, dim, typename VectorType::value_type> - FEFieldFunction::gradient( + FEFieldFunction::gradient( const Point & p, const unsigned int comp) const { @@ -203,24 +207,26 @@ namespace Functions - template + template void - FEFieldFunction::vector_laplacian( + FEFieldFunction::vector_laplacian( const Point & p, Vector &values) const { Assert(values.size() == this->n_components, ExcDimensionMismatch(values.size(), this->n_components)); - typename DoFHandlerType::active_cell_iterator cell = cell_hint.get(); + typename DoFHandler::active_cell_iterator cell = + cell_hint.get(); if (cell == dh->end()) cell = dh->begin_active(); std_cxx17::optional> qp = get_reference_coordinates(cell, p); if (!qp) { - const std::pair::type, - Point> + const std::pair< + typename dealii::internal:: + ActiveCellIterator>::type, + Point> my_pair = GridTools::find_active_cell_around_point(mapping, *dh, p); AssertThrow(my_pair.first.state() == IteratorState::valid && !my_pair.first->is_artificial(), @@ -248,9 +254,9 @@ namespace Functions - template + template typename VectorType::value_type - FEFieldFunction::laplacian( + FEFieldFunction::laplacian( const Point & p, const unsigned int comp) const { @@ -263,18 +269,18 @@ namespace Functions // Now the list versions // ============================== - template + template void - FEFieldFunction::vector_value_list( + FEFieldFunction::vector_value_list( const std::vector> & points, std::vector> &values) const { Assert(points.size() == values.size(), ExcDimensionMismatch(points.size(), values.size())); - std::vector cells; - std::vector>> qpoints; - std::vector> maps; + std::vector::active_cell_iterator> cells; + std::vector>> qpoints; + std::vector> maps; const unsigned int n_cells = compute_point_locations(points, cells, qpoints, maps); @@ -316,9 +322,9 @@ namespace Functions - template + template void - FEFieldFunction::value_list( + FEFieldFunction::value_list( const std::vector> & points, std::vector &values, const unsigned int component) const @@ -342,9 +348,9 @@ namespace Functions - template + template void - FEFieldFunction::vector_gradient_list( + FEFieldFunction::vector_gradient_list( const std::vector> &points, std::vector>> &values) const @@ -352,9 +358,9 @@ namespace Functions Assert(points.size() == values.size(), ExcDimensionMismatch(points.size(), values.size())); - std::vector cells; - std::vector>> qpoints; - std::vector> maps; + std::vector::active_cell_iterator> cells; + std::vector>> qpoints; + std::vector> maps; const unsigned int n_cells = compute_point_locations(points, cells, qpoints, maps); @@ -405,9 +411,9 @@ namespace Functions - template + template void - FEFieldFunction::gradient_list( + FEFieldFunction::gradient_list( const std::vector> & points, std::vector> &values, const unsigned int component) const @@ -432,18 +438,18 @@ namespace Functions - template + template void - FEFieldFunction::vector_laplacian_list( + FEFieldFunction::vector_laplacian_list( const std::vector> & points, std::vector> &values) const { Assert(points.size() == values.size(), ExcDimensionMismatch(points.size(), values.size())); - std::vector cells; - std::vector>> qpoints; - std::vector> maps; + std::vector::active_cell_iterator> cells; + std::vector>> qpoints; + std::vector> maps; const unsigned int n_cells = compute_point_locations(points, cells, qpoints, maps); @@ -487,9 +493,9 @@ namespace Functions - template + template void - FEFieldFunction::laplacian_list( + FEFieldFunction::laplacian_list( const std::vector> & points, std::vector &values, const unsigned int component) const @@ -513,13 +519,14 @@ namespace Functions - template + template unsigned int - FEFieldFunction::compute_point_locations( - const std::vector> & points, - std::vector &cells, - std::vector>> & qpoints, - std::vector> & maps) const + FEFieldFunction::compute_point_locations( + const std::vector> &points, + std::vector::active_cell_iterator> + & cells, + std::vector>> & qpoints, + std::vector> &maps) const { // Calling the GridTools routine and preparing output auto cell_qpoint_map = @@ -530,7 +537,7 @@ namespace Functions cells.resize(tria_cells.size()); unsigned int i = 0; for (const auto &c : tria_cells) - cells[i++] = typename DoFHandlerType::cell_iterator(*c, dh); + cells[i++] = typename DoFHandler::cell_iterator(*c, dh); qpoints = std::get<1>(cell_qpoint_map); maps = std::get<2>(cell_qpoint_map); @@ -541,11 +548,11 @@ namespace Functions } - template + template std_cxx17::optional> - FEFieldFunction::get_reference_coordinates( - const typename DoFHandlerType::active_cell_iterator &cell, - const Point & point) const + FEFieldFunction::get_reference_coordinates( + const typename DoFHandler::active_cell_iterator &cell, + const Point & point) const { try { diff --git a/include/deal.II/numerics/solution_transfer.h b/include/deal.II/numerics/solution_transfer.h index 9efc94d621..cc4929f3d1 100644 --- a/include/deal.II/numerics/solution_transfer.h +++ b/include/deal.II/numerics/solution_transfer.h @@ -49,7 +49,7 @@ DEAL_II_NAMESPACE_OPEN *
  • If the grid will only be refined (i.e. no cells are coarsened) then * use @p SolutionTransfer as follows: * @code - * SolutionTransfer soltrans(*dof_handler); + * SolutionTransfer > soltrans(*dof_handler); * * // flag some cells for refinement, e.g. * GridRefinement::refine_and_coarsen_fixed_fraction(*tria, @@ -151,10 +151,10 @@ DEAL_II_NAMESPACE_OPEN * soltrans.refine_interpolate(old_solution, solution); * @endcode * - * Multiple calls to the function interpolate (const Vector &in, - * Vector &out) are NOT allowed. Interpolating several + * Multiple calls to the function interpolate (const VectorType &in, + * VectorType &out) are NOT allowed. Interpolating several * functions can be performed in one step by using void interpolate (const - * vector >&all_in, vector >&all_out) + * vector &all_in, vector &all_out) * const, and using the respective @p * prepare_for_coarsening_and_refinement function taking several vectors as * input before actually refining and coarsening the triangulation (see @@ -164,7 +164,7 @@ DEAL_II_NAMESPACE_OPEN * For deleting all stored data in @p SolutionTransfer and reinitializing it * use the clear() function. * - * The template argument @p number denotes the data type of the vectors you + * The template argument @p VectorType denotes the type of data container you * want to transfer. * * @@ -221,17 +221,17 @@ DEAL_II_NAMESPACE_OPEN * will not be coarsened need to be stored according to the solution transfer * with pure refinement (cf there). All this is performed by * prepare_for_coarsening_and_refinement(all_in) where the - * vector > all_in includes all discrete + * vector all_in includes all discrete * functions to be interpolated onto the new grid. * * As we need two different kinds of pointers (vector * - * for the Dof indices and vector > * for the + * for the Dof indices and vector * for the * interpolated DoF values) we use the @p Pointerstruct that includes both of * these pointers and the pointer for each cell points to these @p * Pointerstructs. On each cell only one of the two different pointers is used * at one time hence we could use a void * pointer as * vector * at one time and as - * vector > * at the other but using this @p + * vector * at the other but using this @p * Pointerstruct in between makes the use of these pointers more safe and * gives better possibility to expand their usage. * @@ -239,10 +239,10 @@ DEAL_II_NAMESPACE_OPEN * according to the solution transfer while pure refinement. Additionally, on * each cell that is coarsened (hence previously was a father cell), the * values of the discrete functions in @p all_out are set to the stored local - * interpolated values that are accessible due to the 'vector > + * interpolated values that are accessible due to the 'vector * *' pointer in @p Pointerstruct that is pointed to by the pointer of that * cell. It is clear that interpolate(all_in, all_out) only can be - * called with the vector > all_in that previously was + * called with the vector all_in that previously was * the parameter of the prepare_for_coarsening_and_refinement(all_in) * function. Hence interpolate(all_in, all_out) can (in contrast to * refine_interpolate(in, out)) only be called once. @@ -332,22 +332,14 @@ DEAL_II_NAMESPACE_OPEN * * @ingroup numerics */ -template , - typename DoFHandlerType = DoFHandler> +template , int spacedim = dim> class SolutionTransfer { -# ifndef DEAL_II_MSVC - static_assert(dim == DoFHandlerType::dimension, - "The dimension explicitly provided as a template " - "argument, and the dimension of the DoFHandlerType " - "template argument must match."); -# endif public: /** * Constructor, takes the current DoFHandler as argument. */ - SolutionTransfer(const DoFHandlerType &dof); + SolutionTransfer(const DoFHandler &dof); /** * Destructor @@ -476,8 +468,8 @@ private: /** * Pointer to the degree of freedom handler to work with. */ - SmartPointer> + SmartPointer, + SolutionTransfer> dof_handler; /** @@ -584,7 +576,7 @@ namespace Legacy typename VectorType = Vector, typename DoFHandlerType = DoFHandler> using SolutionTransfer DEAL_II_DEPRECATED = - dealii::SolutionTransfer; + dealii::SolutionTransfer; } // namespace Legacy diff --git a/source/distributed/solution_transfer.cc b/source/distributed/solution_transfer.cc index d91669a8a2..99dcf55b42 100644 --- a/source/distributed/solution_transfer.cc +++ b/source/distributed/solution_transfer.cc @@ -114,16 +114,15 @@ namespace parallel { namespace distributed { - template - SolutionTransfer::SolutionTransfer( - const DoFHandlerType &dof) + template + SolutionTransfer::SolutionTransfer( + const DoFHandler &dof) : dof_handler(&dof, typeid(*this).name()) , handle(numbers::invalid_unsigned_int) { Assert( - (dynamic_cast *>( + (dynamic_cast< + const parallel::DistributedTriangulationBase *>( &dof_handler->get_triangulation()) != nullptr), ExcMessage( "parallel::distributed::SolutionTransfer requires a parallel::distributed::Triangulation object.")); @@ -131,9 +130,9 @@ namespace parallel - template + template void - SolutionTransfer:: + SolutionTransfer:: prepare_for_coarsening_and_refinement( const std::vector &all_in) { @@ -147,32 +146,31 @@ namespace parallel - template + template void - SolutionTransfer::register_data_attach() + SolutionTransfer::register_data_attach() { // TODO: casting away constness is bad - auto *tria = (dynamic_cast *>( - const_cast - *>(&dof_handler->get_triangulation()))); + parallel::DistributedTriangulationBase *tria = + (dynamic_cast *>( + const_cast *>( + &dof_handler->get_triangulation()))); Assert(tria != nullptr, ExcInternalError()); handle = tria->register_data_attach( [this]( - const typename Triangulation:: - cell_iterator &cell_, - const typename Triangulation:: - CellStatus status) { return this->pack_callback(cell_, status); }, + const typename Triangulation::cell_iterator &cell_, + const typename Triangulation::CellStatus status) { + return this->pack_callback(cell_, status); + }, /*returns_variable_size_data=*/dof_handler->has_hp_capabilities()); } - template + template void - SolutionTransfer:: + SolutionTransfer:: prepare_for_coarsening_and_refinement(const VectorType &in) { std::vector all_in(1, &in); @@ -181,10 +179,10 @@ namespace parallel - template + template void - SolutionTransfer:: - prepare_for_serialization(const VectorType &in) + SolutionTransfer::prepare_for_serialization( + const VectorType &in) { std::vector all_in(1, &in); prepare_for_serialization(all_in); @@ -192,20 +190,19 @@ namespace parallel - template + template void - SolutionTransfer:: - prepare_for_serialization(const std::vector &all_in) + SolutionTransfer::prepare_for_serialization( + const std::vector &all_in) { prepare_for_coarsening_and_refinement(all_in); } - template + template void - SolutionTransfer::deserialize( - VectorType &in) + SolutionTransfer::deserialize(VectorType &in) { std::vector all_in(1, &in); deserialize(all_in); @@ -213,9 +210,9 @@ namespace parallel - template + template void - SolutionTransfer::deserialize( + SolutionTransfer::deserialize( std::vector &all_in) { register_data_attach(); @@ -227,9 +224,9 @@ namespace parallel } - template + template void - SolutionTransfer::interpolate( + SolutionTransfer::interpolate( std::vector &all_out) { Assert(input_vectors.size() == all_out.size(), @@ -239,20 +236,17 @@ namespace parallel ExcDimensionMismatch(all_out[i]->size(), dof_handler->n_dofs())); // TODO: casting away constness is bad - auto *tria = (dynamic_cast *>( - const_cast - *>(&dof_handler->get_triangulation()))); + parallel::DistributedTriangulationBase *tria = + (dynamic_cast *>( + const_cast *>( + &dof_handler->get_triangulation()))); Assert(tria != nullptr, ExcInternalError()); tria->notify_ready_to_unpack( handle, [this, &all_out]( - const typename Triangulation:: - cell_iterator &cell_, - const typename Triangulation:: - CellStatus status, + const typename Triangulation::cell_iterator &cell_, + const typename Triangulation::CellStatus status, const boost::iterator_range::const_iterator> &data_range) { this->unpack_callback(cell_, status, data_range, all_out); @@ -268,10 +262,9 @@ namespace parallel - template + template void - SolutionTransfer::interpolate( - VectorType &out) + SolutionTransfer::interpolate(VectorType &out) { std::vector all_out(1, &out); interpolate(all_out); @@ -279,16 +272,14 @@ namespace parallel - template + template std::vector - SolutionTransfer::pack_callback( - const typename Triangulation:: - cell_iterator &cell_, - const typename Triangulation::CellStatus - status) + SolutionTransfer::pack_callback( + const typename Triangulation::cell_iterator &cell_, + const typename Triangulation::CellStatus status) { - typename DoFHandlerType::cell_iterator cell(*cell_, dof_handler); + typename DoFHandler::cell_iterator cell(*cell_, + dof_handler); // create buffer for each individual object std::vector<::dealii::Vector> dof_values( @@ -299,20 +290,17 @@ namespace parallel { switch (status) { - case parallel::distributed::Triangulation< - dim, - DoFHandlerType::space_dimension>::CELL_PERSIST: - case parallel::distributed::Triangulation< - dim, - DoFHandlerType::space_dimension>::CELL_REFINE: + case parallel::distributed::Triangulation::CELL_PERSIST: + case parallel::distributed::Triangulation::CELL_REFINE: { fe_index = cell->future_fe_index(); break; } - case parallel::distributed::Triangulation< - dim, - DoFHandlerType::space_dimension>::CELL_COARSEN: + case parallel::distributed::Triangulation::CELL_COARSEN: { // In case of coarsening, we need to find a suitable FE index // for the parent cell. We choose the 'least dominant fe' @@ -325,9 +313,7 @@ namespace parallel # endif fe_index = dealii::internal::hp::DoFHandlerImplementation:: - dominated_future_fe_on_children< - dim, - DoFHandlerType::space_dimension>(cell); + dominated_future_fe_on_children(cell); break; } @@ -357,39 +343,34 @@ namespace parallel - template + template void - SolutionTransfer::unpack_callback( - const typename Triangulation:: - cell_iterator &cell_, - const typename Triangulation::CellStatus - status, + SolutionTransfer::unpack_callback( + const typename Triangulation::cell_iterator &cell_, + const typename Triangulation::CellStatus status, const boost::iterator_range::const_iterator> & data_range, std::vector &all_out) { - typename DoFHandlerType::cell_iterator cell(*cell_, dof_handler); + typename DoFHandler::cell_iterator cell(*cell_, + dof_handler); unsigned int fe_index = 0; if (dof_handler->has_hp_capabilities()) { switch (status) { - case parallel::distributed::Triangulation< - dim, - DoFHandlerType::space_dimension>::CELL_PERSIST: - case parallel::distributed::Triangulation< - dim, - DoFHandlerType::space_dimension>::CELL_COARSEN: + case parallel::distributed::Triangulation::CELL_PERSIST: + case parallel::distributed::Triangulation::CELL_COARSEN: { fe_index = cell->active_fe_index(); break; } - case parallel::distributed::Triangulation< - dim, - DoFHandlerType::space_dimension>::CELL_REFINE: + case parallel::distributed::Triangulation::CELL_REFINE: { // After refinement, this particular cell is no longer active, // and its children have inherited its FE index. However, to diff --git a/source/distributed/solution_transfer.inst.in b/source/distributed/solution_transfer.inst.in index 21e16ab73b..fb373fa793 100644 --- a/source/distributed/solution_transfer.inst.in +++ b/source/distributed/solution_transfer.inst.in @@ -15,56 +15,50 @@ -for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS; - deal_II_space_dimension : SPACE_DIMENSIONS) +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { namespace parallel \{ namespace distributed \{ #if deal_II_dimension <= deal_II_space_dimension - template class SolutionTransfer< - deal_II_dimension, - ::dealii::Vector, - DoFHandler>; + template class SolutionTransfer, + deal_II_space_dimension>; template class SolutionTransfer< deal_II_dimension, ::dealii::LinearAlgebra::distributed::Vector, - DoFHandler>; + deal_II_space_dimension>; template class SolutionTransfer< deal_II_dimension, ::dealii::LinearAlgebra::distributed::Vector, - DoFHandler>; + deal_II_space_dimension>; template class SolutionTransfer< deal_II_dimension, ::dealii::LinearAlgebra::distributed::BlockVector, - DoFHandler>; + deal_II_space_dimension>; template class SolutionTransfer< deal_II_dimension, ::dealii::LinearAlgebra::distributed::BlockVector, - DoFHandler>; + deal_II_space_dimension>; # ifdef DEAL_II_WITH_PETSC - template class SolutionTransfer< - deal_II_dimension, - PETScWrappers::MPI::Vector, - DoFHandler>; - template class SolutionTransfer< - deal_II_dimension, - PETScWrappers::MPI::BlockVector, - DoFHandler>; + template class SolutionTransfer; + template class SolutionTransfer; # endif # ifdef DEAL_II_WITH_TRILINOS - template class SolutionTransfer< - deal_II_dimension, - TrilinosWrappers::MPI::Vector, - DoFHandler>; - template class SolutionTransfer< - deal_II_dimension, - TrilinosWrappers::MPI::BlockVector, - DoFHandler>; + template class SolutionTransfer; + template class SolutionTransfer; # endif #endif diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 2f7cd9009f..6e1ccd82ae 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -3740,7 +3740,7 @@ GridOut::write_mesh_per_processor_as_vtu( (filename_without_extension + ".pvtu"); std::ofstream pvtu_output(pvtu_filename.c_str()); - DataOut> data_out; + DataOut data_out; data_out.attach_triangulation(*tr); // We need a dummy vector with the names of the data values in the diff --git a/source/numerics/data_out.cc b/source/numerics/data_out.cc index 113a3e350c..2507c7d819 100644 --- a/source/numerics/data_out.cc +++ b/source/numerics/data_out.cc @@ -65,8 +65,8 @@ namespace internal -template -DataOut::DataOut() +template +DataOut::DataOut() { // For the moment, just call the existing virtual functions. This // preserves backward compatibility. When these deprecated functions are @@ -83,28 +83,25 @@ DataOut::DataOut() -template +template void -DataOut::build_one_patch( - const std::pair *cell_and_index, - internal::DataOutImplementation::ParallelData - & scratch_data, - const unsigned int n_subdivisions, +DataOut::build_one_patch( + const std::pair * cell_and_index, + internal::DataOutImplementation::ParallelData &scratch_data, + const unsigned int n_subdivisions, const CurvedCellRegion curved_cell_region) { // first create the output object that we will write into - ::dealii::DataOutBase::Patch - patch; + + ::dealii::DataOutBase::Patch patch; patch.n_subdivisions = n_subdivisions; patch.reference_cell = cell_and_index->first->reference_cell(); // initialize FEValues scratch_data.reinit_all_fe_values(this->dof_data, cell_and_index->first); - const FEValuesBase - &fe_patch_values = scratch_data.get_present_fe_values(0); + const FEValuesBase &fe_patch_values = + scratch_data.get_present_fe_values(0); // set the vertices of the patch. if the mapping does not preserve locations // (e.g. MappingQEulerian), we need to compute the offset of the vertex for @@ -115,8 +112,7 @@ DataOut::build_one_patch( else patch.vertices[vertex] = fe_patch_values.get_mapping().transform_unit_to_real_cell( - cell_and_index->first, - GeometryInfo::unit_cell_vertex(vertex)); + cell_and_index->first, GeometryInfo::unit_cell_vertex(vertex)); const unsigned int n_q_points = fe_patch_values.n_quadrature_points; @@ -145,13 +141,11 @@ DataOut::build_one_patch( // note: a cell is *always* at the boundary if dimfirst->at_boundary() || - (DoFHandlerType::dimension != DoFHandlerType::space_dimension))) || + (cell_and_index->first->at_boundary() || (dim != spacedim))) || (cell_and_index->first->reference_cell() != ReferenceCells::get_hypercube())) { - Assert(patch.space_dim == DoFHandlerType::space_dimension, - ExcInternalError()); + Assert(patch.space_dim == spacedim, ExcInternalError()); // set the flag indicating that for this cell the points are // explicitly given @@ -159,16 +153,13 @@ DataOut::build_one_patch( // then resize the patch.data member in order to have enough memory for // the quadrature points as well, and copy the quadrature points there - const std::vector> &q_points = + const std::vector> &q_points = fe_patch_values.get_quadrature_points(); - patch.data.reinit(scratch_data.n_datasets + - DoFHandlerType::space_dimension, - n_q_points); - for (unsigned int i = 0; i < DoFHandlerType::space_dimension; ++i) + patch.data.reinit(scratch_data.n_datasets + spacedim, n_q_points); + for (unsigned int i = 0; i < spacedim; ++i) for (unsigned int q = 0; q < n_q_points; ++q) - patch.data(patch.data.size(0) - DoFHandlerType::space_dimension + i, - q) = q_points[q][i]; + patch.data(patch.data.size(0) - spacedim + i, q) = q_points[q][i]; } else { @@ -187,15 +178,13 @@ DataOut::build_one_patch( unsigned int dataset_number = 0; for (const auto &dataset : this->dof_data) { - const FEValuesBase - &this_fe_patch_values = - scratch_data.get_present_fe_values(dataset_number); + const FEValuesBase &this_fe_patch_values = + scratch_data.get_present_fe_values(dataset_number); const unsigned int n_components = this_fe_patch_values.get_fe().n_components(); - const DataPostprocessor - *postprocessor = dataset->postprocessor; + const DataPostprocessor *postprocessor = + dataset->postprocessor; if (postprocessor != nullptr) { @@ -240,11 +229,11 @@ DataOut::build_one_patch( scratch_data.patch_values_scalar.evaluation_points = this_fe_patch_values.get_quadrature_points(); - const typename DoFHandlerType::cell_iterator dh_cell( - &cell_and_index->first->get_triangulation(), - cell_and_index->first->level(), - cell_and_index->first->index(), - dataset->dof_handler); + const typename DoFHandler::cell_iterator + dh_cell(&cell_and_index->first->get_triangulation(), + cell_and_index->first->level(), + cell_and_index->first->index(), + dataset->dof_handler); scratch_data.patch_values_scalar.template set_cell( dh_cell); @@ -550,14 +539,10 @@ DataOut::build_one_patch( // Now do the exact same thing for the gradients if (update_flags & update_gradients) { - std::vector>> - tmp( - scratch_data.patch_values_system - .solution_gradients.size(), - std::vector< - Tensor<1, DoFHandlerType::space_dimension>>( - n_components)); + std::vector>> tmp( + scratch_data.patch_values_system + .solution_gradients.size(), + std::vector>(n_components)); // First the real part dataset->get_function_gradients( @@ -605,14 +590,10 @@ DataOut::build_one_patch( // And finally the Hessians. Same scheme as above. if (update_flags & update_hessians) { - std::vector>> - tmp( - scratch_data.patch_values_system - .solution_gradients.size(), - std::vector< - Tensor<2, DoFHandlerType::space_dimension>>( - n_components)); + std::vector>> tmp( + scratch_data.patch_values_system + .solution_gradients.size(), + std::vector>(n_components)); // First the real part dataset->get_function_hessians( @@ -664,11 +645,11 @@ DataOut::build_one_patch( scratch_data.patch_values_system.evaluation_points = this_fe_patch_values.get_quadrature_points(); - const typename DoFHandlerType::cell_iterator dh_cell( - &cell_and_index->first->get_triangulation(), - cell_and_index->first->level(), - cell_and_index->first->index(), - dataset->dof_handler); + const typename DoFHandler::cell_iterator + dh_cell(&cell_and_index->first->get_triangulation(), + cell_and_index->first->level(), + cell_and_index->first->index(), + dataset->dof_handler); scratch_data.patch_values_system.template set_cell( dh_cell); @@ -839,7 +820,7 @@ DataOut::build_one_patch( component_is_part_of_vector: { // A vector component. Put the - // DoFHandlerType::space_dimension + // spacedim // components into the next set of // contiguous rows // ('destination+c'); then move 'component' @@ -849,8 +830,7 @@ DataOut::build_one_patch( // (because we're going to put the imaginary // part of the vector into the subsequent // spacedim slots). - const unsigned int size = - DoFHandlerType::space_dimension; + const unsigned int size = spacedim; for (unsigned int c = 0; c < size; ++c) for (unsigned int q = 0; q < n_q_points; ++q) @@ -869,8 +849,7 @@ DataOut::build_one_patch( { // Same approach as for vectors above. const unsigned int size = - DoFHandlerType::space_dimension * - DoFHandlerType::space_dimension; + spacedim * spacedim; for (unsigned int c = 0; c < size; ++c) for (unsigned int q = 0; q < n_q_points; ++q) @@ -930,12 +909,11 @@ DataOut::build_one_patch( component_is_part_of_vector: { // A vector component. Put the - // DoFHandlerType::space_dimension + // spacedim // components into the set of contiguous // rows that follow the real parts // ('destination+spacedim+c'). - const unsigned int size = - DoFHandlerType::space_dimension; + const unsigned int size = spacedim; for (unsigned int c = 0; c < size; ++c) for (unsigned int q = 0; q < n_q_points; ++q) @@ -954,8 +932,7 @@ DataOut::build_one_patch( { // Same as for vectors. const unsigned int size = - DoFHandlerType::space_dimension * - DoFHandlerType::space_dimension; + spacedim * spacedim; for (unsigned int c = 0; c < size; ++c) for (unsigned int q = 0; q < n_q_points; ++q) @@ -1052,7 +1029,7 @@ DataOut::build_one_patch( (*scratch_data.cell_to_patch_index_map)[neighbor->level()].size()) || ((*scratch_data.cell_to_patch_index_map)[neighbor->level()] [neighbor->index()] == - dealii::DataOutBase::Patch::no_neighbor)) + dealii::DataOutBase::Patch::no_neighbor)) { patch.neighbors[f] = numbers::invalid_unsigned_int; continue; @@ -1080,50 +1057,42 @@ DataOut::build_one_patch( -template +template void -DataOut::build_patches(const unsigned int n_subdivisions) +DataOut::build_patches(const unsigned int n_subdivisions) { AssertDimension(this->triangulation->get_reference_cells().size(), 1); - build_patches( - this->triangulation->get_reference_cells()[0] - .template get_default_linear_mapping(), - n_subdivisions, - no_curved_cells); + build_patches(this->triangulation->get_reference_cells()[0] + .template get_default_linear_mapping(), + n_subdivisions, + no_curved_cells); } -template +template void -DataOut::build_patches( - const Mapping - & mapping, - const unsigned int n_subdivisions_, - const CurvedCellRegion curved_region) +DataOut::build_patches(const Mapping &mapping, + const unsigned int n_subdivisions_, + const CurvedCellRegion curved_region) { - hp::MappingCollection - mapping_collection(mapping); + hp::MappingCollection mapping_collection(mapping); build_patches(mapping_collection, n_subdivisions_, curved_region); } -template +template void -DataOut::build_patches( - const hp::MappingCollection &mapping, - const unsigned int n_subdivisions_, - const CurvedCellRegion curved_region) +DataOut::build_patches( + const hp::MappingCollection &mapping, + const unsigned int n_subdivisions_, + const CurvedCellRegion curved_region) { // Check consistency of redundant template parameter - Assert(dim == DoFHandlerType::dimension, - ExcDimensionMismatch(dim, DoFHandlerType::dimension)); + Assert(dim == dim, ExcDimensionMismatch(dim, dim)); Assert(this->triangulation != nullptr, Exceptions::DataOutImplementation::ExcNoTriangulationSelected()); @@ -1166,10 +1135,7 @@ DataOut::build_patches( std::max(max_index, static_cast(cell->index())); cell_to_patch_index_map[l].resize( - max_index + 1, - dealii::DataOutBase::Patch< - DoFHandlerType::dimension, - DoFHandlerType::space_dimension>::no_neighbor); + max_index + 1, dealii::DataOutBase::Patch::no_neighbor); } // will be all_cells[patch_index] = pair(cell, active_index) @@ -1259,21 +1225,19 @@ DataOut::build_patches( "The update of normal vectors may not be requested for evaluation of " "data on cells via DataPostprocessor.")); - internal::DataOutImplementation::ParallelData - thread_data(n_datasets, - n_subdivisions, - n_postprocessor_outputs, - mapping, - this->get_fes(), - update_flags, - cell_to_patch_index_map); + internal::DataOutImplementation::ParallelData thread_data( + n_datasets, + n_subdivisions, + n_postprocessor_outputs, + mapping, + this->get_fes(), + update_flags, + cell_to_patch_index_map); auto worker = [this, n_subdivisions, curved_cell_region]( const std::pair *cell_and_index, - internal::DataOutImplementation::ParallelData< - DoFHandlerType::dimension, - DoFHandlerType::space_dimension> &scratch_data, + internal::DataOutImplementation::ParallelData + &scratch_data, // this function doesn't actually need a copy data object -- // it just writes everything right into the output array int) { @@ -1304,9 +1268,9 @@ DataOut::build_patches( -template +template void -DataOut::set_cell_selection( +DataOut::set_cell_selection( const std::function &)> & first_cell, const std::function &, @@ -1318,9 +1282,9 @@ DataOut::set_cell_selection( -template +template void -DataOut::set_cell_selection( +DataOut::set_cell_selection( const FilteredIterator &filtered_iterator) { const auto first_cell = @@ -1359,46 +1323,45 @@ DataOut::set_cell_selection( -template -const std::pair::FirstCellFunctionType, - typename DataOut::NextCellFunctionType> -DataOut::get_cell_selection() const +template +const std::pair::FirstCellFunctionType, + typename DataOut::NextCellFunctionType> +DataOut::get_cell_selection() const { return std::make_pair(first_cell_function, next_cell_function); } -template -typename DataOut::cell_iterator -DataOut::first_cell() +template +typename DataOut::cell_iterator +DataOut::first_cell() { return this->triangulation->begin_active(); } -template -typename DataOut::cell_iterator -DataOut::next_cell( - const typename DataOut::cell_iterator &cell) +template +typename DataOut::cell_iterator +DataOut::next_cell( + const typename DataOut::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; } -template -typename DataOut::cell_iterator -DataOut::first_locally_owned_cell() +template +typename DataOut::cell_iterator +DataOut::first_locally_owned_cell() { - typename DataOut::cell_iterator cell = first_cell(); + typename DataOut::cell_iterator cell = first_cell(); // skip cells if the current one has no children (is active) and is a ghost // or artificial cell @@ -1411,13 +1374,12 @@ DataOut::first_locally_owned_cell() -template -typename DataOut::cell_iterator -DataOut::next_locally_owned_cell( - const typename DataOut::cell_iterator &old_cell) +template +typename DataOut::cell_iterator +DataOut::next_locally_owned_cell( + const typename DataOut::cell_iterator &old_cell) { - typename DataOut::cell_iterator cell = - next_cell(old_cell); + typename DataOut::cell_iterator cell = next_cell(old_cell); while ((cell != this->triangulation->end()) && cell->is_active() && !cell->is_locally_owned()) cell = next_cell(cell); diff --git a/source/numerics/data_out.inst.in b/source/numerics/data_out.inst.in index 83ab6315fd..4bec09f3ef 100644 --- a/source/numerics/data_out.inst.in +++ b/source/numerics/data_out.inst.in @@ -30,15 +30,14 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) } -for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS) { - template class DataOut>; + template class DataOut; #if deal_II_dimension < 3 - template class DataOut>; + template class DataOut; #endif #if deal_II_dimension == 3 - template class DataOut<1, DH<1, 3>>; + template class DataOut<1, 3>; #endif } diff --git a/source/numerics/data_out_dof_data.inst.in b/source/numerics/data_out_dof_data.inst.in index 559cf27b97..74098f7f7c 100644 --- a/source/numerics/data_out_dof_data.inst.in +++ b/source/numerics/data_out_dof_data.inst.in @@ -14,14 +14,11 @@ // --------------------------------------------------------------------- -for (VEC : VECTOR_TYPES; DH : DOFHANDLER_TEMPLATES; - deal_II_dimension : DIMENSIONS) +for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS) { - template void DataOut_DoFData, - deal_II_dimension, - deal_II_dimension>:: + template void DataOut_DoFData:: add_data_vector_internal( - const DH *, + const DoFHandler *, const VEC &, const std::vector &, const DataVectorType, @@ -29,42 +26,37 @@ for (VEC : VECTOR_TYPES; DH : DOFHANDLER_TEMPLATES; DataComponentInterpretation::DataComponentInterpretation> &, const bool); - template void DataOut_DoFData, - deal_II_dimension, - deal_II_dimension>:: - add_data_vector( - const DH &, - const VEC &, - const DataPostprocessor< - DH::space_dimension> &); + template void + DataOut_DoFData::add_data_vector( + const DoFHandler &, + const VEC &, + const DataPostprocessor::space_dimension> + &); - template void DataOut_DoFData, - deal_II_dimension, - deal_II_dimension>:: - add_mg_data_vector(const DH &, + template void DataOut_DoFData:: + add_mg_data_vector(const DoFHandler &, const MGLevelObject &, const std::string &); - template void DataOut_DoFData, - deal_II_dimension, - deal_II_dimension>:: - add_mg_data_vector( - const DH &, - const MGLevelObject &, - const std::vector &, - const std::vector< - DataComponentInterpretation::DataComponentInterpretation> &); + template void + DataOut_DoFData::add_mg_data_vector< + VEC>(const DoFHandler &, + const MGLevelObject &, + const std::vector &, + const std::vector< + DataComponentInterpretation::DataComponentInterpretation> &); // stuff needed for face data - template void DataOut_DoFData, + template void DataOut_DoFData:: add_data_vector_internal( - const DH *, + const DoFHandler *, const VEC &, const std::vector &, const DataVectorType, @@ -72,25 +64,24 @@ for (VEC : VECTOR_TYPES; DH : DOFHANDLER_TEMPLATES; DataComponentInterpretation::DataComponentInterpretation> &, const bool); - template void DataOut_DoFData, + template void DataOut_DoFData:: add_data_vector( - const DH &, + const DoFHandler &, const VEC &, - const DataPostprocessor< - DH::space_dimension> &); + const DataPostprocessor::space_dimension> + &); // things for DataOutRotation #if deal_II_dimension < 3 - template void DataOut_DoFData, - deal_II_dimension + 1, - deal_II_dimension + 1>:: + template void DataOut_DoFData:: add_data_vector_internal( - const DH *, + const DoFHandler *, const VEC &, const std::vector &, const DataVectorType, @@ -98,45 +89,40 @@ for (VEC : VECTOR_TYPES; DH : DOFHANDLER_TEMPLATES; DataComponentInterpretation::DataComponentInterpretation> &, const bool); - template void DataOut_DoFData, - deal_II_dimension + 1, - deal_II_dimension + 1>:: + template void DataOut_DoFData:: add_data_vector( - const DH &, + const DoFHandler &, const VEC &, - const DataPostprocessor< - DH::space_dimension> &); + const DataPostprocessor::space_dimension> + &); #endif } -for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS) { - template class DataOut_DoFData, deal_II_dimension>; + template class DataOut_DoFData; #if deal_II_dimension < 3 - template class DataOut_DoFData, - deal_II_dimension + 1>; - template class DataOut_DoFData, + template class DataOut_DoFData; + template class DataOut_DoFData; #endif #if deal_II_dimension >= 2 - template class DataOut_DoFData, + template class DataOut_DoFData; #endif #if deal_II_dimension == 3 - template class DataOut_DoFData, 1, 3>; + template class DataOut_DoFData<1, 1, 1, 3>; #endif - } - -for (deal_II_dimension : DIMENSIONS) - { namespace internal \{ namespace DataOutImplementation diff --git a/source/numerics/data_out_dof_data_codim.inst.in b/source/numerics/data_out_dof_data_codim.inst.in index 4efedc0e65..fe8b24e2cb 100644 --- a/source/numerics/data_out_dof_data_codim.inst.in +++ b/source/numerics/data_out_dof_data_codim.inst.in @@ -14,17 +14,16 @@ // --------------------------------------------------------------------- -for (VEC : REAL_VECTOR_TYPES; DH : DOFHANDLER_TEMPLATES; - deal_II_dimension : DIMENSIONS; +for (VEC : REAL_VECTOR_TYPES; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) { #if deal_II_dimension < deal_II_space_dimension - template void - DataOut_DoFData, - deal_II_dimension, - deal_II_space_dimension>:: + template void DataOut_DoFData:: add_data_vector_internal( - const DH *, + const DoFHandler *, const VEC &, const std::vector &, const DataVectorType, @@ -32,39 +31,42 @@ for (VEC : REAL_VECTOR_TYPES; DH : DOFHANDLER_TEMPLATES; DataComponentInterpretation::DataComponentInterpretation> &, const bool); - template void - DataOut_DoFData, - deal_II_dimension, - deal_II_space_dimension>:: + template void DataOut_DoFData:: add_data_vector( const VEC &, const DataPostprocessor< - DH::space_dimension> &); + DoFHandler::space_dimension> &); - template void - DataOut_DoFData, - deal_II_dimension, - deal_II_space_dimension>:: + template void DataOut_DoFData:: add_data_vector( - const DH &, + const DoFHandler &, const VEC &, const DataPostprocessor< - DH::space_dimension> &); + DoFHandler::space_dimension> &); #endif } -for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS) { #if deal_II_dimension < 3 - template class DataOut_DoFData, + template class DataOut_DoFData; #endif #if deal_II_dimension == 3 - template class DataOut_DoFData, 1, 3>; + template class DataOut_DoFData<1, 1, 3, 3>; #endif } diff --git a/source/numerics/data_out_faces.cc b/source/numerics/data_out_faces.cc index 52118e7a86..1844379514 100644 --- a/source/numerics/data_out_faces.cc +++ b/source/numerics/data_out_faces.cc @@ -80,22 +80,19 @@ namespace internal -template -DataOutFaces::DataOutFaces(const bool so) +template +DataOutFaces::DataOutFaces(const bool so) : surface_only(so) -{ - Assert(dim == DoFHandlerType::dimension, ExcNotImplemented()); -} +{} -template +template void -DataOutFaces::build_one_patch( - const FaceDescriptor *cell_and_face, - internal::DataOutFacesImplementation::ParallelData - & data, - DataOutBase::Patch &patch) +DataOutFaces::build_one_patch( + const FaceDescriptor * cell_and_face, + internal::DataOutFacesImplementation::ParallelData &data, + DataOutBase::Patch & patch) { Assert(cell_and_face->first->is_locally_owned(), ExcNotImplemented()); @@ -104,12 +101,12 @@ DataOutFaces::build_one_patch( // 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 < GeometryInfo::vertices_per_cell; + vertex < GeometryInfo::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, @@ -122,25 +119,24 @@ DataOutFaces::build_one_patch( data.reinit_all_fe_values(this->dof_data, cell_and_face->first, cell_and_face->second); - const FEValuesBase &fe_patch_values = - data.get_present_fe_values(0); + 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 == dimension, ExcInternalError()); - const std::vector> &q_points = + Assert(patch.space_dim == dim, 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 + dimension, patch.data.size(1)); + patch.data.reinit(data.n_datasets + dim, 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; i < dimension; ++i) + for (unsigned int i = 0; i < dim; ++i) for (unsigned int q = 0; q < n_q_points; ++q) - patch.data(patch.data.size(0) - dimension + i, q) = q_points[q][i]; + patch.data(patch.data.size(0) - dim + i, q) = q_points[q][i]; // counter for data records unsigned int offset = 0; @@ -148,7 +144,7 @@ DataOutFaces::build_one_patch( // first fill dof_data for (unsigned int dataset = 0; dataset < this->dof_data.size(); ++dataset) { - const FEValuesBase &this_fe_patch_values = + const FEValuesBase &this_fe_patch_values = data.get_present_fe_values(dataset); const unsigned int n_components = this_fe_patch_values.get_fe().n_components(); @@ -192,13 +188,12 @@ DataOutFaces::build_one_patch( data.patch_values_scalar.normals = this_fe_patch_values.get_normal_vectors(); - const typename DoFHandlerType::active_cell_iterator dh_cell( - &cell_and_face->first->get_triangulation(), - cell_and_face->first->level(), - cell_and_face->first->index(), - this->dof_data[dataset]->dof_handler); - data.patch_values_scalar.template set_cell( - dh_cell); + const typename DoFHandler::active_cell_iterator + dh_cell(&cell_and_face->first->get_triangulation(), + cell_and_face->first->level(), + cell_and_face->first->index(), + this->dof_data[dataset]->dof_handler); + data.patch_values_scalar.template set_cell(dh_cell); postprocessor->evaluate_scalar_field( data.patch_values_scalar, @@ -236,13 +231,12 @@ DataOutFaces::build_one_patch( data.patch_values_system.normals = this_fe_patch_values.get_normal_vectors(); - const typename DoFHandlerType::active_cell_iterator dh_cell( - &cell_and_face->first->get_triangulation(), - cell_and_face->first->level(), - cell_and_face->first->index(), - this->dof_data[dataset]->dof_handler); - data.patch_values_system.template set_cell( - dh_cell); + const typename DoFHandler::active_cell_iterator + dh_cell(&cell_and_face->first->get_triangulation(), + cell_and_face->first->level(), + cell_and_face->first->index(), + this->dof_data[dataset]->dof_handler); + data.patch_values_system.template set_cell(dh_cell); postprocessor->evaluate_vector_field( data.patch_values_system, @@ -300,10 +294,10 @@ DataOutFaces::build_one_patch( "The current function is trying to generate cell-data output " "for a face that does not belong to an active cell. This is " "not supported.")); - const unsigned int cell_number = - std::distance(this->triangulation->begin_active(), - typename Triangulation:: - active_cell_iterator(cell_and_face->first)); + const unsigned int cell_number = std::distance( + this->triangulation->begin_active(), + typename Triangulation::active_cell_iterator( + cell_and_face->first)); const double value = this->cell_data[dataset]->get_cell_data_value( cell_number, @@ -316,25 +310,20 @@ DataOutFaces::build_one_patch( -template +template void -DataOutFaces::build_patches( - const unsigned int n_subdivisions_) +DataOutFaces::build_patches(const unsigned int n_subdivisions_) { - build_patches(StaticMappingQ1::mapping, n_subdivisions_); + build_patches(StaticMappingQ1::mapping, n_subdivisions_); } -template +template void -DataOutFaces::build_patches( - const Mapping &mapping, - const unsigned int n_subdivisions_) +DataOutFaces::build_patches(const Mapping &mapping, + const unsigned int n_subdivisions_) { - // Check consistency of redundant template parameter - Assert(dim == dimension, ExcDimensionMismatch(dim, dimension)); - const unsigned int n_subdivisions = (n_subdivisions_ != 0) ? n_subdivisions_ : this->default_subdivisions; @@ -383,31 +372,30 @@ DataOutFaces::build_patches( this->dof_data[i]->postprocessor->get_needed_update_flags(); update_flags |= update_quadrature_points; - internal::DataOutFacesImplementation::ParallelData - thread_data(n_datasets, - n_subdivisions, - n_postprocessor_outputs, - mapping, - this->get_fes(), - update_flags); - DataOutBase::Patch sample_patch; + internal::DataOutFacesImplementation::ParallelData thread_data( + n_datasets, + n_subdivisions, + n_postprocessor_outputs, + mapping, + this->get_fes(), + update_flags); + DataOutBase::Patch sample_patch; sample_patch.n_subdivisions = n_subdivisions; - sample_patch.data.reinit( - n_datasets, Utilities::fixed_power(n_subdivisions + 1)); + sample_patch.data.reinit(n_datasets, + Utilities::fixed_power(n_subdivisions + 1)); // now build the patches in parallel WorkStream::run( all_faces.data(), all_faces.data() + all_faces.size(), [this](const FaceDescriptor *cell_and_face, - internal::DataOutFacesImplementation::ParallelData &data, - DataOutBase::Patch &patch) { + internal::DataOutFacesImplementation::ParallelData &data, + DataOutBase::Patch &patch) { this->build_one_patch(cell_and_face, data, patch); }, - [this](const DataOutBase::Patch &patch) { - internal::DataOutFacesImplementation:: - append_patch_to_list(patch, this->patches); + [this](const DataOutBase::Patch &patch) { + internal::DataOutFacesImplementation::append_patch_to_list( + patch, this->patches); }, thread_data, sample_patch); @@ -415,16 +403,14 @@ DataOutFaces::build_patches( -template -typename DataOutFaces::FaceDescriptor -DataOutFaces::first_face() +template +typename DataOutFaces::FaceDescriptor +DataOutFaces::first_face() { // simply find first active cell with a face on the boundary - typename Triangulation::active_cell_iterator - cell = this->triangulation->begin_active(); - for (; cell != this->triangulation->end(); ++cell) + for (const auto &cell : this->triangulation->active_cell_iterators()) if (cell->is_locally_owned()) - for (const unsigned int f : GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) if (!surface_only || cell->face(f)->at_boundary()) return FaceDescriptor(cell, f); @@ -436,17 +422,16 @@ DataOutFaces::first_face() -template -typename DataOutFaces::FaceDescriptor -DataOutFaces::next_face(const FaceDescriptor &old_face) +template +typename DataOutFaces::FaceDescriptor +DataOutFaces::next_face(const FaceDescriptor &old_face) { FaceDescriptor face = old_face; // first check whether the present cell has more faces on the boundary. since // we started with this face, its cell must clearly be locally owned Assert(face.first->is_locally_owned(), ExcInternalError()); - for (unsigned int f = face.second + 1; - f < GeometryInfo::faces_per_cell; + for (unsigned int f = face.second + 1; f < GeometryInfo::faces_per_cell; ++f) if (!surface_only || face.first->face(f)->at_boundary()) // yup, that is so, so return it @@ -459,8 +444,8 @@ 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; @@ -471,7 +456,7 @@ DataOutFaces::next_face(const FaceDescriptor &old_face) // check all the faces of this active cell. but skip it altogether // if it isn't locally owned if (active_cell->is_locally_owned()) - for (const unsigned int f : GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) if (!surface_only || active_cell->face(f)->at_boundary()) { face.first = active_cell; diff --git a/source/numerics/data_out_faces.inst.in b/source/numerics/data_out_faces.inst.in index 87509e1fb2..291b525682 100644 --- a/source/numerics/data_out_faces.inst.in +++ b/source/numerics/data_out_faces.inst.in @@ -18,7 +18,6 @@ for (deal_II_dimension : DIMENSIONS) { // don't instantiate anything for the 1d #if deal_II_dimension >= 2 - template class DataOutFaces>; + template class DataOutFaces; #endif } diff --git a/source/numerics/data_out_rotation.cc b/source/numerics/data_out_rotation.cc index 39b4877139..f75b1e95a0 100644 --- a/source/numerics/data_out_rotation.cc +++ b/source/numerics/data_out_rotation.cc @@ -98,14 +98,12 @@ namespace internal -template +template void -DataOutRotation::build_one_patch( - const cell_iterator * cell, - internal::DataOutRotationImplementation::ParallelData &data, - std::vector> - &my_patches) +DataOutRotation::build_one_patch( + const cell_iterator * cell, + internal::DataOutRotationImplementation::ParallelData &data, + std::vector> &my_patches) { if (dim == 3) { @@ -126,21 +124,21 @@ DataOutRotation::build_one_patch( // 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][dimension - 1] = + angle_directions[i][dim - 1] = std::cos(2 * numbers::PI * i / n_patches_per_circle); - angle_directions[i][dimension] = + angle_directions[i][dim] = std::sin(2 * numbers::PI * i / n_patches_per_circle); } for (unsigned int angle = 0; angle < n_patches_per_circle; ++angle) { // 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 + // be computed from the vertices of the cell, which has one dim // less, however. - switch (dimension) + switch (dim) { case 1: { @@ -160,9 +158,9 @@ DataOutRotation::build_one_patch( case 2: { for (const unsigned int vertex : - GeometryInfo::vertex_indices()) + GeometryInfo::vertex_indices()) { - const Point v = (*cell)->vertex(vertex); + const Point v = (*cell)->vertex(vertex); // make sure that the radial variable is nonnegative Assert(v(0) >= 0, ExcRadialVariableHasNegativeValues(v(0))); @@ -173,13 +171,11 @@ DataOutRotation::build_one_patch( my_patches[angle].vertices[vertex][0] = v(1); my_patches[angle] - .vertices[vertex + - GeometryInfo::vertices_per_cell] = + .vertices[vertex + GeometryInfo::vertices_per_cell] = v(0) * angle_directions[angle + 1]; my_patches[angle] - .vertices[vertex + - GeometryInfo::vertices_per_cell][0] = - v(1); + .vertices[vertex + GeometryInfo::vertices_per_cell] + [0] = v(1); } break; @@ -199,7 +195,7 @@ DataOutRotation::build_one_patch( for (unsigned int dataset = 0; dataset < this->dof_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(); @@ -241,13 +237,13 @@ DataOutRotation::build_one_patch( data.patch_values_scalar.evaluation_points = fe_patch_values.get_quadrature_points(); - const typename DoFHandlerType::active_cell_iterator + const typename DoFHandler::active_cell_iterator dh_cell(&(*cell)->get_triangulation(), (*cell)->level(), (*cell)->index(), this->dof_data[dataset]->dof_handler); - data.patch_values_scalar - .template set_cell(dh_cell); + data.patch_values_scalar.template set_cell(dh_cell); postprocessor->evaluate_scalar_field( data.patch_values_scalar, @@ -282,13 +278,13 @@ DataOutRotation::build_one_patch( data.patch_values_system.evaluation_points = fe_patch_values.get_quadrature_points(); - const typename DoFHandlerType::active_cell_iterator + const typename DoFHandler::active_cell_iterator dh_cell(&(*cell)->get_triangulation(), (*cell)->level(), (*cell)->index(), this->dof_data[dataset]->dof_handler); - data.patch_values_system - .template set_cell(dh_cell); + data.patch_values_system.template set_cell(dh_cell); postprocessor->evaluate_vector_field( data.patch_values_system, @@ -299,7 +295,7 @@ DataOutRotation::build_one_patch( component < this->dof_data[dataset]->n_output_variables; ++component) { - switch (dimension) + switch (dim) { case 1: for (unsigned int x = 0; x < n_points; ++x) @@ -336,7 +332,7 @@ DataOutRotation::build_one_patch( real_part, data.patch_values_scalar.solution_values); - switch (dimension) + switch (dim) { case 1: for (unsigned int x = 0; x < n_points; ++x) @@ -373,7 +369,7 @@ DataOutRotation::build_one_patch( for (unsigned int component = 0; component < n_components; ++component) { - switch (dimension) + switch (dim) { case 1: for (unsigned int x = 0; x < n_points; ++x) @@ -416,14 +412,14 @@ DataOutRotation::build_one_patch( ExcMessage("Cell must be active for cell data")); const unsigned int cell_number = std::distance( this->triangulation->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, internal::DataOutImplementation::ComponentExtractor:: real_part); - switch (dimension) + switch (dim) { case 1: for (unsigned int x = 0; x < n_points; ++x) @@ -451,15 +447,12 @@ DataOutRotation::build_one_patch( -template +template void -DataOutRotation::build_patches( +DataOutRotation::build_patches( const unsigned int n_patches_per_circle, const unsigned int nnnn_subdivisions) { - // Check consistency of redundant - // template parameter - Assert(dim == dimension, ExcDimensionMismatch(dim, dimension)); Assert(this->triangulation != nullptr, Exceptions::DataOutImplementation::ExcNoTriangulationSelected()); @@ -512,22 +505,21 @@ DataOutRotation::build_patches( else n_postprocessor_outputs[dataset] = 0; - internal::DataOutRotationImplementation::ParallelData - thread_data(n_datasets, + internal::DataOutRotationImplementation::ParallelData + thread_data(n_datasets, n_subdivisions, n_patches_per_circle, n_postprocessor_outputs, - StaticMappingQ1::mapping, + StaticMappingQ1::mapping, this->get_fes(), update_flags); - std::vector> - new_patches(n_patches_per_circle); + std::vector> new_patches( + n_patches_per_circle); for (unsigned int i = 0; i < new_patches.size(); ++i) { new_patches[i].n_subdivisions = n_subdivisions; new_patches[i].data.reinit( - n_datasets, Utilities::fixed_power(n_subdivisions + 1)); + n_datasets, Utilities::fixed_power(n_subdivisions + 1)); } // now build the patches in parallel @@ -535,16 +527,16 @@ DataOutRotation::build_patches( all_cells.data(), all_cells.data() + all_cells.size(), [this](const cell_iterator *cell, - internal::DataOutRotationImplementation:: - ParallelData &data, - std::vector> - &my_patches) { this->build_one_patch(cell, data, my_patches); }, - [this]( - const std::vector> - &new_patches) { - internal::DataOutRotationImplementation:: - append_patch_to_list(new_patches, - this->patches); + internal::DataOutRotationImplementation::ParallelData + & data, + std::vector> &my_patches) { + this->build_one_patch(cell, data, my_patches); + }, + [this](const std::vector> + &new_patches) { + internal::DataOutRotationImplementation::append_patch_to_list( + new_patches, this->patches); }, thread_data, new_patches); @@ -552,23 +544,23 @@ DataOutRotation::build_patches( -template -typename DataOutRotation::cell_iterator -DataOutRotation::first_cell() +template +typename DataOutRotation::cell_iterator +DataOutRotation::first_cell() { return this->triangulation->begin_active(); } -template -typename DataOutRotation::cell_iterator -DataOutRotation::next_cell(const cell_iterator &cell) +template +typename DataOutRotation::cell_iterator +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/source/numerics/data_out_rotation.inst.in b/source/numerics/data_out_rotation.inst.in index 50d91c797d..041dc453e8 100644 --- a/source/numerics/data_out_rotation.inst.in +++ b/source/numerics/data_out_rotation.inst.in @@ -17,7 +17,6 @@ for (deal_II_dimension : DIMENSIONS) { #if deal_II_dimension < 3 - template class DataOutRotation>; + template class DataOutRotation; #endif } diff --git a/source/numerics/fe_field_function.inst.in b/source/numerics/fe_field_function.inst.in index 6aa5072fe1..69b655745b 100644 --- a/source/numerics/fe_field_function.inst.in +++ b/source/numerics/fe_field_function.inst.in @@ -15,13 +15,10 @@ -for (DoFHandler : DOFHANDLER_TEMPLATES; VECTOR : VECTOR_TYPES; - deal_II_dimension : DIMENSIONS) +for (VECTOR : VECTOR_TYPES; deal_II_dimension : DIMENSIONS) { namespace Functions \{ - template class FEFieldFunction, - VECTOR>; + template class FEFieldFunction; \} } diff --git a/source/numerics/solution_transfer.cc b/source/numerics/solution_transfer.cc index 74b4d43123..c42f99bf93 100644 --- a/source/numerics/solution_transfer.cc +++ b/source/numerics/solution_transfer.cc @@ -42,37 +42,36 @@ DEAL_II_NAMESPACE_OPEN -template -SolutionTransfer::SolutionTransfer( - const DoFHandlerType &dof) +template +SolutionTransfer::SolutionTransfer( + const DoFHandler &dof) : dof_handler(&dof, typeid(*this).name()) , n_dofs_old(0) , prepared_for(none) { - Assert((dynamic_cast *>( - &dof_handler->get_triangulation()) == nullptr), - ExcMessage("You are calling the dealii::SolutionTransfer class " - "with a DoF handler that is built on a " - "parallel::distributed::Triangulation. This will not " - "work for parallel computations. You probably want to " - "use the parallel::distributed::SolutionTransfer class.")); + Assert( + (dynamic_cast *>( + &dof_handler->get_triangulation()) == nullptr), + ExcMessage("You are calling the dealii::SolutionTransfer class " + "with a DoFHandler that is built on a " + "parallel::distributed::Triangulation. This will not " + "work for parallel computations. You probably want to " + "use the parallel::distributed::SolutionTransfer class.")); } -template -SolutionTransfer::~SolutionTransfer() +template +SolutionTransfer::~SolutionTransfer() { clear(); } -template +template void -SolutionTransfer::clear() +SolutionTransfer::clear() { indices_on_cell.clear(); dof_values_on_cell.clear(); @@ -83,9 +82,9 @@ SolutionTransfer::clear() -template +template void -SolutionTransfer::prepare_for_pure_refinement() +SolutionTransfer::prepare_for_pure_refinement() { Assert(prepared_for != pure_refinement, ExcAlreadyPrepForRef()); Assert(prepared_for != coarsening_and_refinement, @@ -101,9 +100,9 @@ SolutionTransfer::prepare_for_pure_refinement() // the current set of subdomain ids, set subdomain ids to the "true" owner of // each cell upon construction of the TemporarilyRestoreSubdomainIds object, // and later restore these flags when it is destroyed. - const internal::parallel::shared:: - TemporarilyRestoreSubdomainIds - subdomain_modifier(dof_handler->get_triangulation()); + const internal::parallel::shared::TemporarilyRestoreSubdomainIds + subdomain_modifier(dof_handler->get_triangulation()); const unsigned int n_active_cells = dof_handler->get_triangulation().n_active_cells(); @@ -132,9 +131,9 @@ SolutionTransfer::prepare_for_pure_refinement() -template +template void -SolutionTransfer::refine_interpolate( +SolutionTransfer::refine_interpolate( const VectorType &in, VectorType & out) const { @@ -154,9 +153,9 @@ SolutionTransfer::refine_interpolate( // the current set of subdomain ids, set subdomain ids to the "true" owner of // each cell upon construction of the TemporarilyRestoreSubdomainIds object, // and later restore these flags when it is destroyed. - const internal::parallel::shared:: - TemporarilyRestoreSubdomainIds - subdomain_modifier(dof_handler->get_triangulation()); + const internal::parallel::shared::TemporarilyRestoreSubdomainIds + subdomain_modifier(dof_handler->get_triangulation()); Vector local_values(0); @@ -275,9 +274,9 @@ namespace internal -template +template void -SolutionTransfer:: +SolutionTransfer:: prepare_for_coarsening_and_refinement(const std::vector &all_in) { Assert(prepared_for != pure_refinement, ExcAlreadyPrepForRef()); @@ -307,9 +306,9 @@ SolutionTransfer:: // the current set of subdomain ids, set subdomain ids to the "true" owner of // each cell upon construction of the TemporarilyRestoreSubdomainIds object, // and later restore these flags when it is destroyed. - const internal::parallel::shared:: - TemporarilyRestoreSubdomainIds - subdomain_modifier(dof_handler->get_triangulation()); + const internal::parallel::shared::TemporarilyRestoreSubdomainIds + subdomain_modifier(dof_handler->get_triangulation()); // first count the number // of cells that will be coarsened @@ -430,9 +429,9 @@ SolutionTransfer:: -template +template void -SolutionTransfer:: +SolutionTransfer:: prepare_for_coarsening_and_refinement(const VectorType &in) { std::vector all_in(1, in); @@ -441,9 +440,9 @@ SolutionTransfer:: -template +template void -SolutionTransfer::interpolate( +SolutionTransfer::interpolate( const std::vector &all_in, std::vector & all_out) const { @@ -472,9 +471,9 @@ SolutionTransfer::interpolate( // the current set of subdomain ids, set subdomain ids to the "true" owner of // each cell upon construction of the TemporarilyRestoreSubdomainIds object, // and later restore these flags when it is destroyed. - const internal::parallel::shared:: - TemporarilyRestoreSubdomainIds - subdomain_modifier(dof_handler->get_triangulation()); + const internal::parallel::shared::TemporarilyRestoreSubdomainIds + subdomain_modifier(dof_handler->get_triangulation()); Vector local_values; std::vector dofs; @@ -585,11 +584,10 @@ SolutionTransfer::interpolate( -template +template void -SolutionTransfer::interpolate( - const VectorType &in, - VectorType & out) const +SolutionTransfer::interpolate(const VectorType &in, + VectorType &out) const { Assert(in.size() == n_dofs_old, ExcDimensionMismatch(in.size(), n_dofs_old)); Assert(out.size() == dof_handler->n_dofs(), @@ -605,9 +603,9 @@ SolutionTransfer::interpolate( -template +template std::size_t -SolutionTransfer::memory_consumption() const +SolutionTransfer::memory_consumption() const { // at the moment we do not include the memory // consumption of the cell_map as we have no @@ -622,10 +620,10 @@ SolutionTransfer::memory_consumption() const -template +template std::size_t -SolutionTransfer::Pointerstruct:: - memory_consumption() const +SolutionTransfer::Pointerstruct::memory_consumption() + const { return sizeof(*this); } diff --git a/source/numerics/solution_transfer.inst.in b/source/numerics/solution_transfer.inst.in index 4e17a70e8e..eb2c146944 100644 --- a/source/numerics/solution_transfer.inst.in +++ b/source/numerics/solution_transfer.inst.in @@ -18,13 +18,8 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension - template class SolutionTransfer< - deal_II_dimension, - VEC, - DoFHandler>; - template class SolutionTransfer< - deal_II_dimension, - VEC, - hp::DoFHandler>; + template class SolutionTransfer; #endif } -- 2.39.5