From b9cac5973593f430224d4d0909775b1ca0d690dc Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 13 Sep 2007 15:47:20 +0000 Subject: [PATCH] Rename compute_derived_quantities to two different names for the scalar and vector case to avoid warnings about hiding the respective other function if only one is overloaded. git-svn-id: https://svn.dealii.org/trunk@15205 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/data_postprocessor.h | 83 ++++++++++++------- deal.II/deal.II/source/numerics/data_out.cc | 24 +++--- .../deal.II/source/numerics/data_out_faces.cc | 24 +++--- .../source/numerics/data_out_rotation.cc | 24 +++--- .../source/numerics/data_postprocessor.cc | 22 ++--- deal.II/examples/step-29/step-29.cc | 6 +- 6 files changed, 105 insertions(+), 78 deletions(-) diff --git a/deal.II/deal.II/include/numerics/data_postprocessor.h b/deal.II/deal.II/include/numerics/data_postprocessor.h index e24f1b8fe2..2f9e3c804e 100644 --- a/deal.II/deal.II/include/numerics/data_postprocessor.h +++ b/deal.II/deal.II/include/numerics/data_postprocessor.h @@ -40,17 +40,21 @@ DEAL_II_NAMESPACE_OPEN * DataPostprocessor has to live until @p build_patches has been * called. DataOutFaces and DataOutRotation can be used as well. * - * In order not to perform needless calculations, DataPostprocessor has to - * provide the information, which input data is needed for the calculation of - * the derived quantities, i.e. whether it needs the values, the first - * derivative and/or the second derivative of the provided - * data. DataPostprocessor objects which are used in combination with a - * DataOutFaces object can also ask for the normal vectors at each point. The - * information, which data is needed has to be provided via the UpdateFlags - * returned by the virtual function @p get_needed_update_flags. It is your - * responsibility to use only those values which were updated in the calculation - * of derived quantities. The DataOut object will provide references to the - * requested data in the call to @p compute_derived_quantities. + * In order not to perform needless calculations, DataPostprocessor + * has to provide the information, which input data is needed for the + * calculation of the derived quantities, i.e. whether it needs the + * values, the first derivative and/or the second derivative of the + * provided data. DataPostprocessor objects which are used in + * combination with a DataOutFaces object can also ask for the normal + * vectors at each point. The information, which data is needed has to + * be provided via the UpdateFlags returned by the virtual function @p + * get_needed_update_flags. It is your responsibility to use only + * those values which were updated in the calculation of derived + * quantities. The DataOut object will provide references to the + * requested data in the call to compute_derived_quantities_scalar() + * or compute_derived_quantities_vector() (DataOut decides which of + * the two functions to call depending on whether the finite element + * in use has only a single, or multiple vector components). * * Furthermore, derived classes have to implement the @p get_names and @p * n_output_variables functions, where the number of output variables returned @@ -91,24 +95,37 @@ class DataPostprocessor: public Subscriptor * empty vector when working on cells, not * on faces. * - * This function is called, when the - * original data vector is scalar valued. + * This function is called when + * the original data vector + * represents scalar data, + * i.e. the finite element in use + * has only a single vector + * component. */ - virtual void compute_derived_quantities (std::vector > &computed_quantities, - const std::vector &uh, - const std::vector > &duh, - const std::vector > &dduh, - const std::vector > &normals) const; + virtual + void + compute_derived_quantities_scalar (std::vector > &computed_quantities, + const std::vector &uh, + const std::vector > &duh, + const std::vector > &dduh, + const std::vector > &normals) const; + /** - * Same as above function, but this one is - * called in case of vector-valued original - * data. + * Same as above function, but + * this function is called when + * the original data vector + * represents vector data, + * i.e. the finite element in use + * has multiple vector + * components. */ - virtual void compute_derived_quantities (std::vector > &computed_quantities, - const std::vector > &uh, - const std::vector > > &duh, - const std::vector > > &dduh, - const std::vector > &normals) const; + virtual + void + compute_derived_quantities_vector (std::vector > &computed_quantities, + const std::vector > &uh, + const std::vector > > &duh, + const std::vector > > &dduh, + const std::vector > &normals) const; /** * Return the vector of strings describing @@ -130,11 +147,15 @@ class DataPostprocessor: public Subscriptor virtual UpdateFlags get_needed_update_flags () const=0; /** - * Number of postprocessed variables. Has - * to match the number of entries filled by - * @p compute_derived_quantities as well as - * the size of the vector of names returned - * by @p get_names. + * Number of postprocessed + * variables. Has to match the + * number of entries filled by + * compute_derived_quantities_scalar() + * or + * compute_derived_quantities_vector() + * as well as the size of the + * vector of names returned by + * get_names(). */ virtual unsigned int n_output_variables() const=0; diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 742bb86df8..06af410fd3 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -596,7 +596,7 @@ void DataOut::build_some_patches (Data &data) { const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; - if (postprocessor) + if (postprocessor != 0) { // we have to postprocess the // data, so determine, which @@ -616,11 +616,12 @@ void DataOut::build_some_patches (Data &data) if (update_flags & update_hessians) this->dof_data[dataset]->get_function_second_derivatives (fe_patch_values, data.patch_second_derivatives); - postprocessor->compute_derived_quantities(data.postprocessed_values[dataset], - data.patch_values, - data.patch_gradients, - data.patch_second_derivatives, - data.dummy_normals); + postprocessor-> + compute_derived_quantities_scalar(data.postprocessed_values[dataset], + data.patch_values, + data.patch_gradients, + data.patch_second_derivatives, + data.dummy_normals); } else { @@ -637,11 +638,12 @@ void DataOut::build_some_patches (Data &data) if (update_flags & update_hessians) this->dof_data[dataset]->get_function_second_derivatives (fe_patch_values, data.patch_second_derivatives_system); - postprocessor->compute_derived_quantities(data.postprocessed_values[dataset], - data.patch_values_system, - data.patch_gradients_system, - data.patch_second_derivatives_system, - data.dummy_normals); + postprocessor-> + compute_derived_quantities_vector(data.postprocessed_values[dataset], + data.patch_values_system, + data.patch_gradients_system, + data.patch_second_derivatives_system, + data.dummy_normals); } for (unsigned int q=0; q::build_some_patches (Data &data) for (unsigned int dataset=0; datasetdof_data.size(); ++dataset) { const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; - if (postprocessor) + if (postprocessor != 0) { // we have to postprocess the // data, so determine, which @@ -131,11 +131,12 @@ void DataOutFaces::build_some_patches (Data &data) if (update_flags & update_hessians) this->dof_data[dataset]->get_function_second_derivatives (fe_patch_values, data.patch_second_derivatives); - postprocessor->compute_derived_quantities(data.postprocessed_values[dataset], - data.patch_values, - data.patch_gradients, - data.patch_second_derivatives, - data.patch_normals); + postprocessor-> + compute_derived_quantities_scalar(data.postprocessed_values[dataset], + data.patch_values, + data.patch_gradients, + data.patch_second_derivatives, + data.patch_normals); } else { @@ -152,11 +153,12 @@ void DataOutFaces::build_some_patches (Data &data) if (update_flags & update_hessians) this->dof_data[dataset]->get_function_second_derivatives (fe_patch_values, data.patch_second_derivatives_system); - postprocessor->compute_derived_quantities(data.postprocessed_values[dataset], - data.patch_values_system, - data.patch_gradients_system, - data.patch_second_derivatives_system, - data.patch_normals); + postprocessor-> + compute_derived_quantities_vector(data.postprocessed_values[dataset], + data.patch_values_system, + data.patch_gradients_system, + data.patch_second_derivatives_system, + data.patch_normals); } for (unsigned int q=0; q::build_some_patches (Data &data) for (unsigned int dataset=0; datasetdof_data.size(); ++dataset) { const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; - if (postprocessor) + if (postprocessor != 0) { // we have to postprocess the // data, so determine, which @@ -215,11 +215,12 @@ void DataOutRotation::build_some_patches (Data &data) if (update_flags & update_hessians) this->dof_data[dataset]->get_function_second_derivatives (fe_patch_values, data.patch_second_derivatives); - postprocessor->compute_derived_quantities(data.postprocessed_values[dataset], - data.patch_values, - data.patch_gradients, - data.patch_second_derivatives, - data.dummy_normals); + postprocessor-> + compute_derived_quantities_scalar(data.postprocessed_values[dataset], + data.patch_values, + data.patch_gradients, + data.patch_second_derivatives, + data.dummy_normals); } else { @@ -236,11 +237,12 @@ void DataOutRotation::build_some_patches (Data &data) if (update_flags & update_hessians) this->dof_data[dataset]->get_function_second_derivatives (fe_patch_values, data.patch_second_derivatives_system); - postprocessor->compute_derived_quantities(data.postprocessed_values[dataset], - data.patch_values_system, - data.patch_gradients_system, - data.patch_second_derivatives_system, - data.dummy_normals); + postprocessor-> + compute_derived_quantities_vector(data.postprocessed_values[dataset], + data.patch_values_system, + data.patch_gradients_system, + data.patch_second_derivatives_system, + data.dummy_normals); } for (unsigned int component=0; diff --git a/deal.II/deal.II/source/numerics/data_postprocessor.cc b/deal.II/deal.II/source/numerics/data_postprocessor.cc index e018456c4a..d3e1190d99 100644 --- a/deal.II/deal.II/source/numerics/data_postprocessor.cc +++ b/deal.II/deal.II/source/numerics/data_postprocessor.cc @@ -23,11 +23,12 @@ DataPostprocessor::~DataPostprocessor() template void -DataPostprocessor::compute_derived_quantities (std::vector > &computed_quantities, - const std::vector &/*uh*/, - const std::vector > &/*duh*/, - const std::vector > &/*dduh*/, - const std::vector > &/*normals*/) const +DataPostprocessor:: +compute_derived_quantities_scalar (std::vector > &computed_quantities, + const std::vector &/*uh*/, + const std::vector > &/*duh*/, + const std::vector > &/*dduh*/, + const std::vector > &/*normals*/) const { computed_quantities.clear(); AssertThrow(false,ExcPureFunctionCalled()); @@ -37,11 +38,12 @@ DataPostprocessor::compute_derived_quantities (std::vector > template void -DataPostprocessor::compute_derived_quantities (std::vector > &computed_quantities, - const std::vector > &/*uh*/, - const std::vector > > &/*duh*/, - const std::vector > > &/*dduh*/, - const std::vector > &/*normals*/) const +DataPostprocessor:: +compute_derived_quantities_vector (std::vector > &computed_quantities, + const std::vector > &/*uh*/, + const std::vector > > &/*duh*/, + const std::vector > > &/*dduh*/, + const std::vector > &/*normals*/) const { computed_quantities.clear(); AssertThrow(false,ExcPureFunctionCalled()); diff --git a/deal.II/examples/step-29/step-29.cc b/deal.II/examples/step-29/step-29.cc index 2e6542348b..86ad0c2d76 100644 --- a/deal.II/examples/step-29/step-29.cc +++ b/deal.II/examples/step-29/step-29.cc @@ -154,9 +154,7 @@ class Postprocessor : public DataPostprocessor { public: - using DataPostprocessor::compute_derived_quantities; - - void compute_derived_quantities ( + void compute_derived_quantities_vector ( std::vector< Vector< double > > &, const std::vector< Vector< double > > &, const std::vector< std::vector< Tensor< 1, dim > > > &, @@ -202,7 +200,7 @@ Postprocessor::n_output_variables () const template void -Postprocessor::compute_derived_quantities ( +Postprocessor::compute_derived_quantities_vector ( std::vector< Vector< double > > &computed_quantities, const std::vector< Vector< double > > &uh, const std::vector< std::vector< Tensor< 1, dim > > > &/*duh*/, -- 2.39.5