From: hartmann Date: Thu, 5 Apr 2001 17:08:03 +0000 (+0000) Subject: Extend all functions of the DerivativeApproximation to use an arbitrary mapping.... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e5624560593ae07464e4c98980c2b89d9725e26;p=dealii-svn.git Extend all functions of the DerivativeApproximation to use an arbitrary mapping. For backward compatibility keep a second version without mapping argument of each public function. Then the global mapping_q1 object can be removed. git-svn-id: https://svn.dealii.org/trunk@4384 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/derivative_approximation.h b/deal.II/deal.II/include/numerics/derivative_approximation.h index 734b459ccb..c0c545d954 100644 --- a/deal.II/deal.II/include/numerics/derivative_approximation.h +++ b/deal.II/deal.II/include/numerics/derivative_approximation.h @@ -182,11 +182,24 @@ class DerivativeApproximation */ template static void - approximate_gradient (const DoFHandler &dof, + approximate_gradient (const Mapping &mapping, + const DoFHandler &dof, const Vector &solution, Vector &derivative_norm, const unsigned int component = 0); + /** + * Calls the @p{interpolate} + * function, see above, with + * @p{mapping=MappingQ1()}. + */ + template + static void + approximate_gradient (const DoFHandler &dof, + const Vector &solution, + Vector &derivative_norm, + const unsigned int component = 0); + /** * This function is the analogue * to the one above, computing @@ -211,11 +224,24 @@ class DerivativeApproximation */ template static void - approximate_second_derivative (const DoFHandler &dof, + approximate_second_derivative (const Mapping &mapping, + const DoFHandler &dof, const Vector &solution, Vector &derivative_norm, const unsigned int component); + /** + * Calls the @p{interpolate} + * function, see above, with + * @p{mapping=MappingQ1()}. + */ + template + static void + approximate_second_derivative (const DoFHandler &dof, + const Vector &solution, + Vector &derivative_norm, + const unsigned int component); + /** * Exception */ @@ -428,7 +454,8 @@ class DerivativeApproximation */ template static void - approximate_derivative (const DoFHandler &dof, + approximate_derivative (const Mapping &mapping, + const DoFHandler &dof, const Vector &solution, const unsigned int component, Vector &derivative_norm); @@ -441,7 +468,8 @@ class DerivativeApproximation */ template static void - approximate (const DoFHandler &dof, + approximate (const Mapping &mapping, + const DoFHandler &dof, const Vector &solution, const unsigned int component, const IndexInterval &index_interval, diff --git a/deal.II/deal.II/source/numerics/derivative_approximation.cc b/deal.II/deal.II/source/numerics/derivative_approximation.cc index 63c73f3ce8..21bbd525da 100644 --- a/deal.II/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/deal.II/source/numerics/derivative_approximation.cc @@ -27,9 +27,6 @@ #include -//TODO:[RH,GK] Replace global by local object; better: have two functions, or by default arg -static const MappingQ1 mapping; - template static T sqr (const T t) @@ -190,6 +187,23 @@ DerivativeApproximation::SecondDerivative::symmetrize (Derivative &d) +template +void +DerivativeApproximation:: +approximate_gradient (const Mapping &mapping, + const DoFHandler &dof_handler, + const Vector &solution, + Vector &derivative_norm, + const unsigned int component) +{ + approximate_derivative,dim> (mapping, + dof_handler, + solution, + component, + derivative_norm); +}; + + template void DerivativeApproximation:: @@ -198,13 +212,31 @@ approximate_gradient (const DoFHandler &dof_handler, Vector &derivative_norm, const unsigned int component) { - approximate_derivative,dim> (dof_handler, + static const MappingQ1 mapping; + approximate_derivative,dim> (mapping, + dof_handler, solution, component, derivative_norm); }; +template +void +DerivativeApproximation:: +approximate_second_derivative (const Mapping &mapping, + const DoFHandler &dof_handler, + const Vector &solution, + Vector &derivative_norm, + const unsigned int component) +{ + approximate_derivative,dim> (mapping, + dof_handler, + solution, + component, + derivative_norm); +}; + template void @@ -214,18 +246,20 @@ approximate_second_derivative (const DoFHandler &dof_handler, Vector &derivative_norm, const unsigned int component) { - approximate_derivative,dim> (dof_handler, + static const MappingQ1 mapping; + approximate_derivative,dim> (mapping, + dof_handler, solution, component, derivative_norm); }; - template void DerivativeApproximation:: -approximate_derivative (const DoFHandler &dof_handler, +approximate_derivative (const Mapping &mapping, + const DoFHandler &dof_handler, const Vector &solution, const unsigned int component, Vector &derivative_norm) @@ -244,7 +278,7 @@ approximate_derivative (const DoFHandler &dof_handler, Threads::encapsulate (&DerivativeApproximation:: template approximate) - .collect_args (dof_handler, solution, component, + .collect_args (mapping, dof_handler, solution, component, index_intervals[i], derivative_norm)); thread_manager.wait (); @@ -254,7 +288,8 @@ approximate_derivative (const DoFHandler &dof_handler, template void -DerivativeApproximation::approximate (const DoFHandler &dof_handler, +DerivativeApproximation::approximate (const Mapping &mapping, + const DoFHandler &dof_handler, const Vector &solution, const unsigned int component, const IndexInterval &index_interval, @@ -475,6 +510,14 @@ DerivativeApproximation::approximate (const DoFHandler &dof_handler, template void DerivativeApproximation:: +approximate_gradient (const Mapping &mapping, + const DoFHandler &dof_handler, + const Vector &solution, + Vector &derivative_norm, + const unsigned int component); +template +void +DerivativeApproximation:: approximate_gradient (const DoFHandler &dof_handler, const Vector &solution, Vector &derivative_norm, @@ -483,6 +526,14 @@ approximate_gradient (const DoFHandler &dof_handler, template void DerivativeApproximation:: +approximate_second_derivative (const Mapping &mapping, + const DoFHandler &dof_handler, + const Vector &solution, + Vector &derivative_norm, + const unsigned int component); +template +void +DerivativeApproximation:: approximate_second_derivative (const DoFHandler &dof_handler, const Vector &solution, Vector &derivative_norm,