From 57c5f21c8b9d389d20c6f3442811dcd1ddafde99 Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 8 Mar 2002 10:39:40 +0000 Subject: [PATCH] Make access to shape values and gradients more consistent by using the new vector2d::operator[]. git-svn-id: https://svn.dealii.org/trunk@5552 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-5/step-5.cc | 27 ++++++--------------------- deal.II/examples/step-6/step-6.cc | 4 ++-- deal.II/examples/step-7/step-7.cc | 8 ++++---- deal.II/examples/step-8/step-8.cc | 2 +- deal.II/examples/step-9/step-9.cc | 10 +++++----- 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index ebbf6f3f1e..a244c6f713 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -470,10 +470,10 @@ void LaplaceProblem::assemble_system () // Instead of writing // fe_values.shape_value(j,q) // we can now write - // shape_values(j,q), i.e. the + // shape_values[j][q], i.e. the // function call needed // previously for each access - // has been optimized away. + // will be optimized away. // // There are alike functions // for almost all data elements @@ -487,7 +487,8 @@ void LaplaceProblem::assemble_system () // in the matrix (j,q) now // needs to be the gradient of // the shape function, which is - // a vector. + // a tensor rather than a + // scalar. // // Similarly, access to the // place where quadrature @@ -514,23 +515,7 @@ void LaplaceProblem::assemble_system () // fe_values object is no more // explicitely needed to access // the different fields (see - // below). Unfortunately, - // things became a bit - // inconsistent, since the - // shape values are accessed - // via the FullMatrix operator - // (), i.e. using parentheses, - // while all the other fields - // are accessed through vector - // operator [], i.e. using - // brackets. This is due to - // historical reasons and - // frequently leads to a bit of - // confusion, but since the - // places where this happens - // are few in well-written - // programs, this is not too - // big a problem. + // below). // There is one more thing: in // this example, we want to use @@ -610,7 +595,7 @@ void LaplaceProblem::assemble_system () // For the right hand // side, a constant value // is used again: - cell_rhs(i) += (shape_values (i,q_point) * + cell_rhs(i) += (shape_values[i][q_point] * 1.0 * JxW_values[q_point]); }; diff --git a/deal.II/examples/step-6/step-6.cc b/deal.II/examples/step-6/step-6.cc index bcfa77fb09..96163f9add 100644 --- a/deal.II/examples/step-6/step-6.cc +++ b/deal.II/examples/step-6/step-6.cc @@ -533,9 +533,9 @@ void LaplaceProblem::assemble_system () shape_grads[j][q_point]) * JxW_values[q_point]); - cell_rhs(i) += (shape_values (i,q_point) * + cell_rhs(i) += (shape_values[i][q_point] * 1.0 * - fe_values.JxW (q_point)); + JxW_values[q_point]); }; diff --git a/deal.II/examples/step-7/step-7.cc b/deal.II/examples/step-7/step-7.cc index 2a119ec194..a27f10c6bd 100644 --- a/deal.II/examples/step-7/step-7.cc +++ b/deal.II/examples/step-7/step-7.cc @@ -888,13 +888,13 @@ void LaplaceProblem::assemble_system () shape_grads[j][q_point] * JxW_values[q_point]) + - (shape_values(i,q_point) * - shape_values(j,q_point) * + (shape_values[i][q_point] * + shape_values[j][q_point] * JxW_values[q_point])); cell_rhs(i) += (shape_values (i,q_point) * rhs_values [q_point] * - fe_values.JxW (q_point)); + JxW_values[q_point]); }; // Then there is that second @@ -988,7 +988,7 @@ void LaplaceProblem::assemble_system () // shape function: for (unsigned int i=0; i::assemble_system () component_i = fe.system_to_component_index(i).first; for (unsigned int q_point=0; q_point::active_cell_iterator & for (unsigned int j=0; j::active_cell_iterator & for (unsigned int j=0; j