From: Timo Heister Date: Wed, 26 Feb 2014 18:12:19 +0000 (+0000) Subject: step-22: add comment X-Git-Tag: v8.2.0-rc1~773 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f20cf91f914664c1403636bb5939a892620a1f06;p=dealii.git step-22: add comment git-svn-id: https://svn.dealii.org/trunk@32558 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-22/step-22.cc b/deal.II/examples/step-22/step-22.cc index e63bae370c..69fbc3b615 100644 --- a/deal.II/examples/step-22/step-22.cc +++ b/deal.II/examples/step-22/step-22.cc @@ -674,6 +674,18 @@ namespace Step22 } + // For the right-hand side we use the fact that the shape + // functions are only non-zero in one component (because our + // elements are primitive). Instead of multiplying the tensor + // representing the dim+1 values of shape function i with the + // whole right-hand side vector, we only look at the only + // non-zero component. The Function + // FiniteElement::system_to_component_index(i) will return + // which component this shape function lives in (0=x velocity, + // 1=y velocity, 2=pressure in 2d), which we use to pick out + // the correct component of the right-hand side vector to + // multiply with. + const unsigned int component_i = fe.system_to_component_index(i).first; local_rhs(i) += fe_values.shape_value(i,q) *