From 3048389789aec392f5daf271b922bd229f728aa9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 7 Feb 2006 05:17:40 +0000 Subject: [PATCH] Get rid of the old idiom where we had to cast the result of update flag concatenations explicitly back to UpdateFlags. This has long been solved more elegantly using operator overloading. git-svn-id: https://svn.dealii.org/trunk@12247 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-10/step-10.cc | 10 +++++--- deal.II/examples/step-12/step-12.cc | 40 ++++++++++++++--------------- deal.II/examples/step-13/step-13.cc | 8 +++--- deal.II/examples/step-14/step-14.cc | 8 +++--- deal.II/examples/step-15/step-15.cc | 12 +++------ deal.II/examples/step-16/step-16.cc | 12 +++------ deal.II/examples/step-17/step-17.cc | 6 ++--- deal.II/examples/step-18/step-18.cc | 8 +++--- deal.II/examples/step-20/step-20.cc | 8 +++--- deal.II/examples/step-21/step-21.cc | 36 +++++++++++++------------- deal.II/examples/step-7/step-7.cc | 14 ++++------ deal.II/examples/step-8/step-8.cc | 8 +++--- deal.II/examples/step-9/step-9.cc | 17 +++++------- 13 files changed, 80 insertions(+), 107 deletions(-) diff --git a/deal.II/examples/step-10/step-10.cc b/deal.II/examples/step-10/step-10.cc index 0b02fc6c84..64ecff8720 100644 --- a/deal.II/examples/step-10/step-10.cc +++ b/deal.II/examples/step-10/step-10.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 2001, 2002, 2003, 2004 by the deal.II authors */ +/* Copyright (C) 2001, 2002, 2003, 2004, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -385,7 +385,7 @@ void compute_pi_by_area () // the dummy finite element and // the quadrature object to the // constructor, together with - // the UpdateFlags asking for + // the update flags asking for // the `JxW' values at the // quadrature points only. This // tells the FEValues object @@ -409,7 +409,8 @@ void compute_pi_by_area () // omitted, resulting in the // implicit use of an object of // type MappingQ1. - FEValues fe_values (mapping, dummy_fe, quadrature, update_JxW_values); + FEValues fe_values (mapping, dummy_fe, quadrature, + update_JxW_values); // We employ an object of the // ConvergenceTable class to @@ -577,7 +578,8 @@ void compute_pi_by_perimeter () // the previous // function. Again, we pass a // mapping as first argument. - FEFaceValues fe_face_values (mapping, fe, quadrature, update_JxW_values); + FEFaceValues fe_face_values (mapping, fe, quadrature, + update_JxW_values); ConvergenceTable table; for (unsigned int refinement=0; refinement<6; diff --git a/deal.II/examples/step-12/step-12.cc b/deal.II/examples/step-12/step-12.cc index 14657c8fa4..8ba4184f18 100644 --- a/deal.II/examples/step-12/step-12.cc +++ b/deal.II/examples/step-12/step-12.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors */ +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -736,21 +736,21 @@ void DGMethod::assemble_system1 () std::vector dofs_neighbor (dofs_per_cell); // First we create the - // ``UpdateFlags'' for the + // ``update_flags'' for the // ``FEValues'' and the // ``FEFaceValues'' objects. - UpdateFlags update_flags = update_values - | update_gradients - | update_q_points - | update_JxW_values; + const UpdateFlags update_flags = update_values + | update_gradients + | update_q_points + | update_JxW_values; // Note, that on faces we do not // need gradients but we need // normal vectors. - UpdateFlags face_update_flags = update_values - | update_q_points - | update_JxW_values - | update_normal_vectors; + const UpdateFlags face_update_flags = update_values + | update_q_points + | update_JxW_values + | update_normal_vectors; // On the neighboring cell we only // need the shape values. Given a @@ -760,7 +760,7 @@ void DGMethod::assemble_system1 () // the normal vectors are known to // be the negative of the normal // vectors of the current cell. - UpdateFlags neighbor_face_update_flags = update_values; + const UpdateFlags neighbor_face_update_flags = update_values; // Then we create the ``FEValues'' // object. Note, that since version @@ -1221,17 +1221,17 @@ void DGMethod::assemble_system2 () std::vector dofs (dofs_per_cell); std::vector dofs_neighbor (dofs_per_cell); - UpdateFlags update_flags = update_values - | update_gradients - | update_q_points - | update_JxW_values; + const UpdateFlags update_flags = update_values + | update_gradients + | update_q_points + | update_JxW_values; - UpdateFlags face_update_flags = update_values - | update_q_points - | update_JxW_values - | update_normal_vectors; + const UpdateFlags face_update_flags = update_values + | update_q_points + | update_JxW_values + | update_normal_vectors; - UpdateFlags neighbor_face_update_flags = update_values; + const UpdateFlags neighbor_face_update_flags = update_values; // Here we do not need // ``fe_v_face_neighbor'' as case 4 diff --git a/deal.II/examples/step-13/step-13.cc b/deal.II/examples/step-13/step-13.cc index dbcc787db6..78b5705a06 100644 --- a/deal.II/examples/step-13/step-13.cc +++ b/deal.II/examples/step-13/step-13.cc @@ -1248,8 +1248,7 @@ namespace LaplaceSolver Threads::ThreadMutex &mutex) const { FEValues fe_values (*fe, *quadrature, - UpdateFlags(update_gradients | - update_JxW_values)); + update_gradients | update_JxW_values); const unsigned int dofs_per_cell = fe->dofs_per_cell; const unsigned int n_q_points = quadrature->n_quadrature_points; @@ -1578,9 +1577,8 @@ namespace LaplaceSolver assemble_rhs (Vector &rhs) const { FEValues fe_values (*this->fe, *this->quadrature, - UpdateFlags(update_values | - update_q_points | - update_JxW_values)); + update_values | update_q_points | + update_JxW_values); const unsigned int dofs_per_cell = this->fe->dofs_per_cell; const unsigned int n_q_points = this->quadrature->n_quadrature_points; diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index fd6f0ef6f0..ca5e7877d0 100644 --- a/deal.II/examples/step-14/step-14.cc +++ b/deal.II/examples/step-14/step-14.cc @@ -677,8 +677,7 @@ namespace LaplaceSolver Threads::ThreadMutex &mutex) const { FEValues fe_values (*fe, *quadrature, - UpdateFlags(update_gradients | - update_JxW_values)); + update_gradients | update_JxW_values); const unsigned int dofs_per_cell = fe->dofs_per_cell; const unsigned int n_q_points = quadrature->n_quadrature_points; @@ -932,9 +931,8 @@ namespace LaplaceSolver assemble_rhs (Vector &rhs) const { FEValues fe_values (*this->fe, *this->quadrature, - UpdateFlags(update_values | - update_q_points | - update_JxW_values)); + update_values | update_q_points | + update_JxW_values); const unsigned int dofs_per_cell = this->fe->dofs_per_cell; const unsigned int n_q_points = this->quadrature->n_quadrature_points; diff --git a/deal.II/examples/step-15/step-15.cc b/deal.II/examples/step-15/step-15.cc index 0b76b8f745..ed34c45056 100644 --- a/deal.II/examples/step-15/step-15.cc +++ b/deal.II/examples/step-15/step-15.cc @@ -407,10 +407,8 @@ void MinimizationProblem::assemble_step () // the one we have chosen here. QGauss quadrature_formula(4); FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); // Next, here are the usual two convenience // variables, followed by declarations for @@ -1252,10 +1250,8 @@ MinimizationProblem::energy (const DoFHandler &dof_handler, // is appropriate: QGauss quadrature_formula(4); FEValues fe_values (dof_handler.get_fe(), quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); const unsigned int n_q_points = quadrature_formula.n_quadrature_points; diff --git a/deal.II/examples/step-16/step-16.cc b/deal.II/examples/step-16/step-16.cc index 3c8cf5cedc..14bf6f0872 100644 --- a/deal.II/examples/step-16/step-16.cc +++ b/deal.II/examples/step-16/step-16.cc @@ -191,10 +191,8 @@ void LaplaceProblem::assemble_system () QGauss quadrature_formula(2); FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.n_quadrature_points; @@ -298,10 +296,8 @@ void LaplaceProblem::assemble_multigrid () QGauss quadrature_formula(2); FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.n_quadrature_points; diff --git a/deal.II/examples/step-17/step-17.cc b/deal.II/examples/step-17/step-17.cc index aa78eb78fd..09d003db4a 100644 --- a/deal.II/examples/step-17/step-17.cc +++ b/deal.II/examples/step-17/step-17.cc @@ -511,10 +511,8 @@ void ElasticProblem::assemble_system () // the local systems. QGauss quadrature_formula(2); FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.n_quadrature_points; diff --git a/deal.II/examples/step-18/step-18.cc b/deal.II/examples/step-18/step-18.cc index b4e6d87f60..7067de6d95 100644 --- a/deal.II/examples/step-18/step-18.cc +++ b/deal.II/examples/step-18/step-18.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 2000, 2004, 2005 by the deal.II authors */ +/* Copyright (C) 2000, 2004, 2005, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -1477,10 +1477,8 @@ namespace QuasiStaticElasticity system_matrix = 0; FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.n_quadrature_points; diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index cd22898d8b..9186a912cb 100644 --- a/deal.II/examples/step-20/step-20.cc +++ b/deal.II/examples/step-20/step-20.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors */ +/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -470,10 +470,8 @@ void LaplaceProblem::assemble_system () // giving it the update_q_points // flag: FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); // Note that the following numbers // depend on the dimension which we diff --git a/deal.II/examples/step-21/step-21.cc b/deal.II/examples/step-21/step-21.cc index 35ff4bd5ba..f840816552 100644 --- a/deal.II/examples/step-21/step-21.cc +++ b/deal.II/examples/step-21/step-21.cc @@ -789,18 +789,18 @@ void DGMethod::assemble_system1 () // ``UpdateFlags'' for the // ``FEValues'' and the // ``FEFaceValues'' objects. - UpdateFlags update_flags = update_values - | update_gradients - | update_q_points - | update_JxW_values; + const UpdateFlags update_flags = update_values + | update_gradients + | update_q_points + | update_JxW_values; // Note, that on faces we do not // need gradients but we need // normal vectors. - UpdateFlags face_update_flags = update_values - | update_q_points - | update_JxW_values - | update_normal_vectors; + const UpdateFlags face_update_flags = update_values + | update_q_points + | update_JxW_values + | update_normal_vectors; // On the neighboring cell we only // need the shape values. Given a @@ -810,7 +810,7 @@ void DGMethod::assemble_system1 () // the normal vectors are known to // be the negative of the normal // vectors of the current cell. - UpdateFlags neighbor_face_update_flags = update_values; + const UpdateFlags neighbor_face_update_flags = update_values; // Then we create the ``FEValues'' // object. Note, that since version @@ -1305,17 +1305,17 @@ void DGMethod::assemble_system1 () template void DGMethod::assemble_system2 () { - UpdateFlags update_flags = update_values - | update_gradients - | update_q_points - | update_JxW_values; + const UpdateFlags update_flags = update_values + | update_gradients + | update_q_points + | update_JxW_values; - UpdateFlags face_update_flags = update_values - | update_q_points - | update_JxW_values - | update_normal_vectors; + const UpdateFlags face_update_flags = update_values + | update_q_points + | update_JxW_values + | update_normal_vectors; - UpdateFlags neighbor_face_update_flags = update_values; + const UpdateFlags neighbor_face_update_flags = update_values; // Here we do not need // ``fe_v_face_neighbor'' as case 4 diff --git a/deal.II/examples/step-7/step-7.cc b/deal.II/examples/step-7/step-7.cc index 175a77ac7d..e64365bb9e 100644 --- a/deal.II/examples/step-7/step-7.cc +++ b/deal.II/examples/step-7/step-7.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors */ +/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -806,10 +806,8 @@ void LaplaceProblem::assemble_system () // cell) to evaluate the right hand // side function. FEValues fe_values (*fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); // For the face integrals, we only // need the values of the shape @@ -821,10 +819,8 @@ void LaplaceProblem::assemble_system () // from the exact solution object // (see below). FEFaceValues fe_face_values (*fe, face_quadrature_formula, - UpdateFlags(update_values | - update_q_points | - update_normal_vectors | - update_JxW_values)); + update_values | update_q_points | + update_normal_vectors | update_JxW_values); // In order to make programming // more readable below, we alias diff --git a/deal.II/examples/step-8/step-8.cc b/deal.II/examples/step-8/step-8.cc index bd23075d1e..8fe13b97b3 100644 --- a/deal.II/examples/step-8/step-8.cc +++ b/deal.II/examples/step-8/step-8.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors */ +/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -447,10 +447,8 @@ void ElasticProblem::assemble_system () // where they are precomputed upon // construction). FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); // The number of degrees of freedom // per cell we now obviously ask diff --git a/deal.II/examples/step-9/step-9.cc b/deal.II/examples/step-9/step-9.cc index 173d0fcc09..424f86694b 100644 --- a/deal.II/examples/step-9/step-9.cc +++ b/deal.II/examples/step-9/step-9.cc @@ -4,7 +4,7 @@ /* $Id$ */ /* Version: $Name$ */ /* */ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors */ +/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 by the deal.II authors */ /* */ /* This file is subject to QPL and may not be distributed */ /* without copyright and license information. Please refer */ @@ -988,15 +988,11 @@ assemble_system_interval (const typename DoFHandler::active_cell_iterator & // gradients, but rather the normal // vectors to the cells. FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + update_values | update_gradients | + update_q_points | update_JxW_values); FEFaceValues fe_face_values (fe, face_quadrature_formula, - UpdateFlags (update_values | - update_q_points | - update_JxW_values | - update_normal_vectors)); + update_values | update_q_points | + update_JxW_values | update_normal_vectors); // Then we define some // abbreviations to avoid @@ -1598,8 +1594,7 @@ GradientEstimation::estimate_interval (const DoFHandler &dof_handler, QMidpoint midpoint_rule; FEValues fe_midpoint_value (dof_handler.get_fe(), midpoint_rule, - UpdateFlags(update_values | - update_q_points)); + update_values | update_q_points); // Then we need space foe the // tensor ``Y'', which is the sum -- 2.39.5