From 4ecd06cae65b583f1a76619c9d4d24ddaf25085a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 20 Oct 2020 13:47:44 -0600 Subject: [PATCH] Use operator^ to create FESystem objects in the tutorials. --- examples/step-17/step-17.cc | 4 ++-- examples/step-18/step-18.cc | 2 +- examples/step-20/step-20.cc | 2 +- examples/step-21/step-21.cc | 5 +---- examples/step-22/step-22.cc | 2 +- examples/step-29/step-29.cc | 11 +++++++---- examples/step-31/step-31.cc | 4 ++-- examples/step-32/step-32.cc | 6 ++---- examples/step-33/step-33.cc | 2 +- examples/step-35/step-35.cc | 5 ++--- examples/step-42/step-42.cc | 2 +- examples/step-43/step-43.cc | 2 +- examples/step-44/step-44.cc | 9 +++------ examples/step-45/step-45.cc | 2 +- examples/step-46/step-46.cc | 18 ++++++------------ examples/step-51/step-51.cc | 2 +- examples/step-55/step-55.cc | 2 +- examples/step-56/step-56.cc | 7 ++++--- examples/step-57/step-57.cc | 2 +- examples/step-60/step-60.cc | 2 +- examples/step-61/step-61.cc | 2 +- examples/step-62/step-62.cc | 2 +- examples/step-67/step-67.cc | 2 +- examples/step-68/step-68.cc | 2 +- examples/step-70/step-70.cc | 9 +++------ examples/step-8/step-8.cc | 20 +++++++++++++++++--- 26 files changed, 64 insertions(+), 64 deletions(-) diff --git a/examples/step-17/step-17.cc b/examples/step-17/step-17.cc index 6089836ea6..9db1233126 100644 --- a/examples/step-17/step-17.cc +++ b/examples/step-17/step-17.cc @@ -225,7 +225,7 @@ namespace Step17 // The first step in the actual implementation is the constructor of // the main class. Apart from initializing the same member variables // that we already had in step-8, we here initialize the MPI - // communicator variable we shall use with the global MPI + // communicator variable we want to use with the global MPI // communicator linking all processes together (in more complex // applications, one could here use a communicator object that only // links a subset of all processes), and call the Utilities::MPI @@ -242,7 +242,7 @@ namespace Step17 , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)) , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)) , pcout(std::cout, (this_mpi_process == 0)) - , fe(FE_Q(1), dim) + , fe(FE_Q(1) ^ dim) , dof_handler(triangulation) {} diff --git a/examples/step-18/step-18.cc b/examples/step-18/step-18.cc index 0980521e00..973b104bb1 100644 --- a/examples/step-18/step-18.cc +++ b/examples/step-18/step-18.cc @@ -694,7 +694,7 @@ namespace Step18 template TopLevel::TopLevel() : triangulation(MPI_COMM_WORLD) - , fe(FE_Q(1), dim) + , fe(FE_Q(1) ^ dim) , dof_handler(triangulation) , quadrature_formula(fe.degree + 1) , present_time(0.0) diff --git a/examples/step-20/step-20.cc b/examples/step-20/step-20.cc index 2599b02e66..7676c1eeca 100644 --- a/examples/step-20/step-20.cc +++ b/examples/step-20/step-20.cc @@ -320,7 +320,7 @@ namespace Step20 template MixedLaplaceProblem::MixedLaplaceProblem(const unsigned int degree) : degree(degree) - , fe(FE_RaviartThomas(degree), 1, FE_DGQ(degree), 1) + , fe(FE_RaviartThomas(degree), FE_DGQ(degree)) , dof_handler(triangulation) {} diff --git a/examples/step-21/step-21.cc b/examples/step-21/step-21.cc index bb574b4a29..59de4bec66 100644 --- a/examples/step-21/step-21.cc +++ b/examples/step-21/step-21.cc @@ -509,11 +509,8 @@ namespace Step21 TwoPhaseFlowProblem::TwoPhaseFlowProblem(const unsigned int degree) : degree(degree) , fe(FE_RaviartThomas(degree), - 1, FE_DGQ(degree), - 1, - FE_DGQ(degree), - 1) + FE_DGQ(degree)) , dof_handler(triangulation) , n_refinement_steps(5) , time(/*start time*/ 0., /*end time*/ 1.) diff --git a/examples/step-22/step-22.cc b/examples/step-22/step-22.cc index d173f41acf..022fbb9bfb 100644 --- a/examples/step-22/step-22.cc +++ b/examples/step-22/step-22.cc @@ -405,7 +405,7 @@ namespace Step22 StokesProblem::StokesProblem(const unsigned int degree) : degree(degree) , triangulation(Triangulation::maximum_smoothing) - , fe(FE_Q(degree + 1), dim, FE_Q(degree), 1) + , fe(FE_Q(degree + 1) ^ dim, FE_Q(degree)) , dof_handler(triangulation) {} diff --git a/examples/step-29/step-29.cc b/examples/step-29/step-29.cc index 765a2868ab..ef4d7a46b3 100644 --- a/examples/step-29/step-29.cc +++ b/examples/step-29/step-29.cc @@ -387,13 +387,16 @@ namespace Step29 // The constructor takes the ParameterHandler object and stores it in a // reference. It also initializes the DoF-Handler and the finite element - // system, which consists of two copies of the scalar Q1 field, one for $v$ - // and one for $w$: + // system, which consists of two copies of the scalar $Q_1$ field, one for + // $v$ and one for $w$. In other words, we want the finite element space + // $Q_1\times Q_1 = Q_1^2$, which is easily constructed and passed as the + // constructor argument to the FESystem class (i.e., the type of the `fe` + // member being initialized here): template UltrasoundProblem::UltrasoundProblem(ParameterHandler ¶m) : prm(param) , dof_handler(triangulation) - , fe(FE_Q(1), 2) + , fe(FE_Q(1) ^ 2) {} // @sect4{UltrasoundProblem::make_grid} @@ -590,7 +593,7 @@ namespace Step29 // compute from the given two shape functions. Fortunately, // the FESystem object can provide us with this information, // namely it has a function - // FESystem::system_to_component_index, that for each local + // FESystem::system_to_component_index(), that for each local // DoF index returns a pair of integers of which the first // indicates to which component of the system the DoF // belongs. The second integer of the pair indicates which diff --git a/examples/step-31/step-31.cc b/examples/step-31/step-31.cc index 7222de350a..5c97bf0db8 100644 --- a/examples/step-31/step-31.cc +++ b/examples/step-31/step-31.cc @@ -526,7 +526,7 @@ namespace Step31 // The constructor of this class is an extension of the constructor in // step-22. We need to add the various variables that concern the // temperature. As discussed in the introduction, we are going to use - // $Q_2\times Q_1$ (Taylor-Hood) elements again for the Stokes part, and + // $Q_2^d\times Q_1$ (Taylor-Hood) elements again for the Stokes part, and // $Q_2$ elements for the temperature. However, by using variables that // store the polynomial degree of the Stokes and temperature finite // elements, it is easy to consistently modify the degree of the elements as @@ -538,7 +538,7 @@ namespace Step31 : triangulation(Triangulation::maximum_smoothing) , global_Omega_diameter(std::numeric_limits::quiet_NaN()) , stokes_degree(1) - , stokes_fe(FE_Q(stokes_degree + 1), dim, FE_Q(stokes_degree), 1) + , stokes_fe(FE_Q(stokes_degree + 1) ^ dim, FE_Q(stokes_degree)) , stokes_dof_handler(triangulation) , diff --git a/examples/step-32/step-32.cc b/examples/step-32/step-32.cc index e6f3c5af77..a26812f157 100644 --- a/examples/step-32/step-32.cc +++ b/examples/step-32/step-32.cc @@ -1190,14 +1190,12 @@ namespace Step32 mapping(4) , - stokes_fe(FE_Q(parameters.stokes_velocity_degree), - dim, + stokes_fe(FE_Q(parameters.stokes_velocity_degree) ^ dim, (parameters.use_locally_conservative_discretization ? static_cast &>( FE_DGP(parameters.stokes_velocity_degree - 1)) : static_cast &>( - FE_Q(parameters.stokes_velocity_degree - 1))), - 1) + FE_Q(parameters.stokes_velocity_degree - 1)))) , stokes_dof_handler(triangulation) diff --git a/examples/step-33/step-33.cc b/examples/step-33/step-33.cc index 15ac9725dd..11376d966e 100644 --- a/examples/step-33/step-33.cc +++ b/examples/step-33/step-33.cc @@ -1377,7 +1377,7 @@ namespace Step33 template ConservationLaw::ConservationLaw(const char *input_filename) : mapping() - , fe(FE_Q(1), EulerEquations::n_components) + , fe(FE_Q(1) ^ EulerEquations::n_components) , dof_handler(triangulation) , quadrature(fe.degree + 1) , face_quadrature(fe.degree + 1) diff --git a/examples/step-35/step-35.cc b/examples/step-35/step-35.cc index 5b5db632b1..f215b414ab 100644 --- a/examples/step-35/step-35.cc +++ b/examples/step-35/step-35.cc @@ -1291,9 +1291,8 @@ namespace Step35 void NavierStokesProjection::output_results(const unsigned int step) { assemble_vorticity((step == 1)); - const FESystem joint_fe( - fe_velocity, dim, fe_pressure, 1, fe_velocity, 1); - DoFHandler joint_dof_handler(triangulation); + const FESystem joint_fe(fe_velocity ^ dim, fe_pressure, fe_velocity); + DoFHandler joint_dof_handler(triangulation); joint_dof_handler.distribute_dofs(joint_fe); Assert(joint_dof_handler.n_dofs() == ((dim + 1) * dof_handler_velocity.n_dofs() + diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index a8d84d047f..e6b437ce36 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -814,7 +814,7 @@ namespace Step42 prm.get_integer("number of initial refinements")) , triangulation(mpi_communicator) , fe_degree(prm.get_integer("polynomial degree")) - , fe(FE_Q(QGaussLobatto<1>(fe_degree + 1)), dim) + , fe(FE_Q(QGaussLobatto<1>(fe_degree + 1)) ^ dim) , dof_handler(triangulation) , e_modulus(200000) diff --git a/examples/step-43/step-43.cc b/examples/step-43/step-43.cc index bbcc2d1a7b..f805288e73 100644 --- a/examples/step-43/step-43.cc +++ b/examples/step-43/step-43.cc @@ -590,7 +590,7 @@ namespace Step43 , global_Omega_diameter(std::numeric_limits::quiet_NaN()) , degree(degree) , darcy_degree(degree) - , darcy_fe(FE_Q(darcy_degree + 1), dim, FE_Q(darcy_degree), 1) + , darcy_fe(FE_Q(darcy_degree + 1) ^ dim, FE_Q(darcy_degree)) , darcy_dof_handler(triangulation) , diff --git a/examples/step-44/step-44.cc b/examples/step-44/step-44.cc index 0e9fcba5c2..383441fe40 100644 --- a/examples/step-44/step-44.cc +++ b/examples/step-44/step-44.cc @@ -1042,12 +1042,9 @@ namespace Step44 // condition, while $Q_1 \times DGP_0 \times DGP_0$ elements do // not. However, it has been shown that the latter demonstrate good // convergence characteristics nonetheless. - fe(FE_Q(parameters.poly_degree), - dim, // displacement - FE_DGP(parameters.poly_degree - 1), - 1, // pressure - FE_DGP(parameters.poly_degree - 1), - 1) // dilatation + fe(FE_Q(parameters.poly_degree) ^ dim, // displacement + FE_DGP(parameters.poly_degree - 1), // pressure + FE_DGP(parameters.poly_degree - 1)) // dilatation , dof_handler(triangulation) , dofs_per_cell(fe.n_dofs_per_cell()) , u_fe(first_u_component) diff --git a/examples/step-45/step-45.cc b/examples/step-45/step-45.cc index f7a44ecd1f..d19696d8a9 100644 --- a/examples/step-45/step-45.cc +++ b/examples/step-45/step-45.cc @@ -291,7 +291,7 @@ namespace Step45 : degree(degree) , mpi_communicator(MPI_COMM_WORLD) , triangulation(mpi_communicator) - , fe(FE_Q(degree + 1), dim, FE_Q(degree), 1) + , fe(FE_Q(degree + 1) ^ dim, FE_Q(degree)) , dof_handler(triangulation) , pcout(std::cout, Utilities::MPI::this_mpi_process(mpi_communicator) == 0) , mapping(degree + 1) diff --git a/examples/step-46/step-46.cc b/examples/step-46/step-46.cc index 167938cfe5..ca0641007c 100644 --- a/examples/step-46/step-46.cc +++ b/examples/step-46/step-46.cc @@ -220,18 +220,12 @@ namespace Step46 : stokes_degree(stokes_degree) , elasticity_degree(elasticity_degree) , triangulation(Triangulation::maximum_smoothing) - , stokes_fe(FE_Q(stokes_degree + 1), - dim, - FE_Q(stokes_degree), - 1, - FE_Nothing(), - dim) - , elasticity_fe(FE_Nothing(), - dim, - FE_Nothing(), - 1, - FE_Q(elasticity_degree), - dim) + , stokes_fe(FE_Q(stokes_degree + 1) ^ dim, // for the fluid velocity + FE_Q(stokes_degree), // for the fluid pressure + FE_Nothing() ^ dim) // for the solid displacement + , elasticity_fe(FE_Nothing() ^ dim, // for the fluid velocity + FE_Nothing(), // for the fluid pressure + FE_Q(elasticity_degree)) // for the solid displacement , dof_handler(triangulation) , viscosity(2) , lambda(1) diff --git a/examples/step-51/step-51.cc b/examples/step-51/step-51.cc index 6914a25ea1..ad1b7be6bb 100644 --- a/examples/step-51/step-51.cc +++ b/examples/step-51/step-51.cc @@ -383,7 +383,7 @@ namespace Step51 // gradient/flux part and the scalar part. template HDG::HDG(const unsigned int degree, const RefinementMode refinement_mode) - : fe_local(FE_DGQ(degree), dim, FE_DGQ(degree), 1) + : fe_local(FE_DGQ(degree) ^ dim, FE_DGQ(degree)) , dof_handler_local(triangulation) , fe(degree) , dof_handler(triangulation) diff --git a/examples/step-55/step-55.cc b/examples/step-55/step-55.cc index 6b6b671cd8..eee56e9ac8 100644 --- a/examples/step-55/step-55.cc +++ b/examples/step-55/step-55.cc @@ -328,7 +328,7 @@ namespace Step55 : velocity_degree(velocity_degree) , viscosity(0.1) , mpi_communicator(MPI_COMM_WORLD) - , fe(FE_Q(velocity_degree), dim, FE_Q(velocity_degree - 1), 1) + , fe(FE_Q(velocity_degree) ^ dim, FE_Q(velocity_degree - 1)) , triangulation(mpi_communicator, typename Triangulation::MeshSmoothing( Triangulation::smoothing_on_refinement | diff --git a/examples/step-56/step-56.cc b/examples/step-56/step-56.cc index 2322fdcb8f..c4cb510a85 100644 --- a/examples/step-56/step-56.cc +++ b/examples/step-56/step-56.cc @@ -454,11 +454,12 @@ namespace Step56 , solver_type(solver_type) , triangulation(Triangulation::maximum_smoothing) , - // Finite element for the velocity only: - velocity_fe(FE_Q(pressure_degree + 1), dim) + // Finite element for the velocity only -- we choose the + // $Q_{\text{pressure_degree}}^d$ element: + velocity_fe(FE_Q(pressure_degree + 1) ^ dim) , // Finite element for the whole system: - fe(velocity_fe, 1, FE_Q(pressure_degree), 1) + fe(velocity_fe, FE_Q(pressure_degree)) , dof_handler(triangulation) , velocity_dof_handler(triangulation) , computing_timer(std::cout, TimerOutput::never, TimerOutput::wall_times) diff --git a/examples/step-57/step-57.cc b/examples/step-57/step-57.cc index 4acd4f5069..395c6d05d2 100644 --- a/examples/step-57/step-57.cc +++ b/examples/step-57/step-57.cc @@ -265,7 +265,7 @@ namespace Step57 , gamma(1.0) , degree(degree) , triangulation(Triangulation::maximum_smoothing) - , fe(FE_Q(degree + 1), dim, FE_Q(degree), 1) + , fe(FE_Q(degree + 1) ^ dim, FE_Q(degree)) , dof_handler(triangulation) {} diff --git a/examples/step-60/step-60.cc b/examples/step-60/step-60.cc index 9e1bcd7dcc..b0fb18fc20 100644 --- a/examples/step-60/step-60.cc +++ b/examples/step-60/step-60.cc @@ -647,7 +647,7 @@ namespace Step60 embedded_configuration_fe = std::make_unique>( FE_Q( - parameters.embedded_configuration_finite_element_degree), + parameters.embedded_configuration_finite_element_degree) ^ spacedim); embedded_configuration_dh = diff --git a/examples/step-61/step-61.cc b/examples/step-61/step-61.cc index f6bf740857..e7c73a730d 100644 --- a/examples/step-61/step-61.cc +++ b/examples/step-61/step-61.cc @@ -260,7 +260,7 @@ namespace Step61 // interface pressures, $p^\circ$ and $p^\partial$. template WGDarcyEquation::WGDarcyEquation(const unsigned int degree) - : fe(FE_DGQ(degree), 1, FE_FaceQ(degree), 1) + : fe(FE_DGQ(degree), FE_FaceQ(degree)) , dof_handler(triangulation) , fe_dgrt(degree) , dof_handler_dgrt(triangulation) diff --git a/examples/step-62/step-62.cc b/examples/step-62/step-62.cc index 551ac1b4e3..fbaba8d938 100644 --- a/examples/step-62/step-62.cc +++ b/examples/step-62/step-62.cc @@ -710,7 +710,7 @@ namespace step62 Triangulation::smoothing_on_refinement | Triangulation::smoothing_on_coarsening)) , quadrature_formula(2) - , fe(FE_Q(1), dim) + , fe(FE_Q(1) ^ dim) , dof_handler(triangulation) , frequency(parameters.nb_frequency_points) , probe_positions(parameters.nb_probe_points, dim) diff --git a/examples/step-67/step-67.cc b/examples/step-67/step-67.cc index 0e13d851f9..fb127ff0bd 100644 --- a/examples/step-67/step-67.cc +++ b/examples/step-67/step-67.cc @@ -1934,7 +1934,7 @@ namespace Euler_DG #ifdef DEAL_II_WITH_P4EST , triangulation(MPI_COMM_WORLD) #endif - , fe(FE_DGQ(fe_degree), dim + 2) + , fe(FE_DGQ(fe_degree) ^ (dim + 2)) , mapping(fe_degree) , dof_handler(triangulation) , timer(pcout, TimerOutput::never, TimerOutput::wall_times) diff --git a/examples/step-68/step-68.cc b/examples/step-68/step-68.cc index 47680ef395..b451131f2f 100644 --- a/examples/step-68/step-68.cc +++ b/examples/step-68/step-68.cc @@ -305,7 +305,7 @@ namespace Step68 , mpi_communicator(MPI_COMM_WORLD) , background_triangulation(mpi_communicator) , fluid_dh(background_triangulation) - , fluid_fe(FE_Q(par.velocity_degree), dim) + , fluid_fe(FE_Q(par.velocity_degree) ^ dim) , pcout(std::cout, Utilities::MPI::this_mpi_process(mpi_communicator) == 0) , interpolated_velocity(interpolated_velocity) diff --git a/examples/step-70/step-70.cc b/examples/step-70/step-70.cc index 011964a3e1..c71a9cfdf6 100644 --- a/examples/step-70/step-70.cc +++ b/examples/step-70/step-70.cc @@ -1191,12 +1191,9 @@ namespace Step70 { TimerOutput::Scope t(computing_timer, "Initial setup"); - fluid_fe = - std::make_unique>(FE_Q(par.velocity_degree), - spacedim, - FE_Q(par.velocity_degree - - 1), - 1); + fluid_fe = std::make_unique>( + FE_Q(par.velocity_degree) ^ spacedim, + FE_Q(par.velocity_degree - 1)); solid_fe = std::make_unique>(); diff --git a/examples/step-8/step-8.cc b/examples/step-8/step-8.cc index 9d4be1af3d..4063c92e5b 100644 --- a/examples/step-8/step-8.cc +++ b/examples/step-8/step-8.cc @@ -189,12 +189,26 @@ namespace Step8 // the solution function has, which is dim since we consider // displacement in each space direction. The FESystem class can handle this: // we pass it the finite element of which we would like to compose the - // system of, and how often it shall be repeated: - + // system of, and how often to repeat it. There are different ways to + // tell the FESystem constructor how to do this, but the one that is + // closest to mathematical notation is to write out what we want to do + // mathematically: We want to construct the finite element space + // $Q_1^d$ where the index 1 corresponds to the polynomial degree and + // the exponent $d$ to the space dimension -- because the *displacement* + // we try to simulate here is a vector with exactly $d$ components. The + // FESystem class then lets us create this space by initialization with + // `FE_Q(1)^dim`, emulating the mathematical notation. + // + // (We could also have written `fe(FE_Q(1), dim)`, which would simply + // have called a different constructor of the FESystem class that first + // takes the "base element" and then a "multiplicity", i.e., a number that + // indicates how many times the base element is to be repeated. The two + // ways of writing things are entirely equivalent; we choose the one that + // is closer to mathematical notation.) template ElasticProblem::ElasticProblem() : dof_handler(triangulation) - , fe(FE_Q(1), dim) + , fe(FE_Q(1) ^ dim) {} // In fact, the FESystem class has several more constructors which can // perform more complex operations than just stacking together several -- 2.39.5