From: kanschat Date: Sun, 2 Mar 2014 07:12:29 +0000 (+0000) Subject: Change q_point to q_index so students do not think it is a point X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bd544bbf13d542a32a99a0b0274b501e188eabd;p=dealii-svn.git Change q_point to q_index so students do not think it is a point Do the quadrature loop in step 3 outside the loop over shape functions, thus being consistent with later steps and allowing for easier modifications; git-svn-id: https://svn.dealii.org/trunk@32597 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-3/step-3.cc b/deal.II/examples/step-3/step-3.cc index f6ab655810..fc7496b1b1 100644 --- a/deal.II/examples/step-3/step-3.cc +++ b/deal.II/examples/step-3/step-3.cc @@ -367,44 +367,45 @@ void Step3::assemble_system () // global right hand side to zero, before we fill them: cell_matrix = 0; cell_rhs = 0; - - // Then finally assemble the matrix: For the Laplace problem, the matrix - // on each cell is the integral over the gradients of shape function i - // and j. Since we do not integrate, but rather use quadrature, this is - // the sum over all quadrature points of the integrands times the - // determinant of the Jacobian matrix at the quadrature point times the - // weight of this quadrature point. You can get the gradient of shape - // function $i$ at quadrature point q_point by using - // fe_values.shape_grad(i,q_point); this gradient is a - // 2-dimensional vector (in fact it is of type Tensor@<1,dim@>, with - // here dim=2) and the product of two such vectors is the scalar - // product, i.e. the product of the two shape_grad function calls is the - // dot product. This is in turn multiplied by the Jacobian determinant - // and the quadrature point weight (that one gets together by the call - // to FEValues::JxW() ). Finally, this is repeated for all shape - // functions $i$ and $j$: - for (unsigned int i=0; ife_values.shape_grad(i,q_index); this + // gradient is a 2-dimensional vector (in fact it is of type + // Tensor@<1,dim@>, with here dim=2) and the product of two + // such vectors is the scalar product, i.e. the product of + // the two shape_grad function calls is the dot + // product. This is in turn multiplied by the Jacobian + // determinant and the quadrature point weight (that one + // gets together by the call to FEValues::JxW() ). Finally, + // this is repeated for all shape functions $i$ and $j$: + for (unsigned int i=0; i::assemble_system () // difference to how we did things in step-3: Instead of using a // constant right hand side with value 1, we use the object representing // the right hand side and evaluate it at the quadrature points: - for (unsigned int q_point=0; q_pointcell_matrix(i,j), we have to multiply - // the gradients of shape functions $i$ and $j$ at point q_point and + // the gradients of shape functions $i$ and $j$ at point number + // q_index and // multiply it with the scalar weights JxW. This is what actually - // happens: fe_values.shape_grad(i,q_point) returns a + // happens: fe_values.shape_grad(i,q_index) returns a // dim dimensional vector, represented by a // Tensor@<1,dim@> object, and the operator* that // multiplies it with the result of - // fe_values.shape_grad(j,q_point) makes sure that the + // fe_values.shape_grad(j,q_index) makes sure that the // dim components of the two vectors are properly // contracted, and the result is a scalar floating point number that // then is multiplied with the weights. Internally, this operator* makes diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index f1d146935b..66169fee91 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -369,18 +369,18 @@ void Step5::assemble_system () coefficient.value_list (fe_values.get_quadrature_points(), coefficient_values); - for (unsigned int q_point=0; q_point::assemble_system () coefficient.value_list (fe_values.get_quadrature_points(), coefficient_values); - for (unsigned int q_point=0; q_point