From: Matthias Maier Date: Thu, 18 Jul 2013 17:06:48 +0000 (+0000) Subject: Run the fierce autoindent script X-Git-Tag: v8.0.0~82 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35409ff4bb6b790a481f18b364fff48ee24a9941;p=dealii.git Run the fierce autoindent script git-svn-id: https://svn.dealii.org/trunk@30040 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-17/step-17.cc b/deal.II/examples/step-17/step-17.cc index 5511277bbb..30a3b65196 100644 --- a/deal.II/examples/step-17/step-17.cc +++ b/deal.II/examples/step-17/step-17.cc @@ -503,8 +503,8 @@ namespace Step17 cell->get_dof_indices (local_dof_indices); hanging_node_constraints .distribute_local_to_global(cell_matrix, cell_rhs, - local_dof_indices, - system_matrix, system_rhs); + local_dof_indices, + system_matrix, system_rhs); } // Now compress the vector and the system matrix: diff --git a/deal.II/examples/step-18/step-18.cc b/deal.II/examples/step-18/step-18.cc index eea5121994..5dcd10e4bc 100644 --- a/deal.II/examples/step-18/step-18.cc +++ b/deal.II/examples/step-18/step-18.cc @@ -1135,16 +1135,16 @@ namespace Step18 cell->get_dof_indices (local_dof_indices); hanging_node_constraints - .distribute_local_to_global (cell_matrix, cell_rhs, + .distribute_local_to_global (cell_matrix, cell_rhs, local_dof_indices, - system_matrix, system_rhs); + system_matrix, system_rhs); } // Now compress the vector and the system matrix: system_matrix.compress(VectorOperation::add); system_rhs.compress(VectorOperation::add); - + // The last step is to again fix up boundary values, just as we already // did in previous programs. A slight complication is that the // apply_boundary_values function wants to have a solution diff --git a/deal.II/examples/step-26/step-26.cc b/deal.II/examples/step-26/step-26.cc index 00422f8d43..b13da46ac0 100644 --- a/deal.II/examples/step-26/step-26.cc +++ b/deal.II/examples/step-26/step-26.cc @@ -59,7 +59,7 @@ namespace Step26 void solve_time_step(); void output_results() const; void refine_mesh (const unsigned int min_grid_level, - const unsigned int max_grid_level); + const unsigned int max_grid_level); Triangulation triangulation; FE_Q fe; @@ -176,13 +176,13 @@ namespace Step26 dof_handler.distribute_dofs(fe); std::cout << std::endl - << "===========================================" - << std::endl - << "Number of active cells: " << triangulation.n_active_cells() + << "===========================================" << std::endl - << "Number of degrees of freedom: " << dof_handler.n_dofs() + << "Number of active cells: " << triangulation.n_active_cells() << std::endl - << std::endl; + << "Number of degrees of freedom: " << dof_handler.n_dofs() + << std::endl + << std::endl; constraints.clear (); DoFTools::make_hanging_node_constraints (dof_handler, @@ -203,12 +203,12 @@ namespace Step26 MatrixCreator::create_mass_matrix(dof_handler, QGauss(fe.degree+1), mass_matrix, - (const Function*)0, + (const Function *)0, constraints); MatrixCreator::create_laplace_matrix(dof_handler, QGauss(fe.degree+1), laplace_matrix, - (const Function*)0, + (const Function *)0, constraints); solution.reinit(dof_handler.n_dofs()); @@ -291,7 +291,7 @@ namespace Step26 // too high a mesh level. template void HeatEquation::refine_mesh (const unsigned int min_grid_level, - const unsigned int max_grid_level) + const unsigned int max_grid_level) { Vector estimated_error_per_cell (triangulation.n_active_cells()); @@ -310,8 +310,8 @@ namespace Step26 cell != triangulation.end(); ++cell) cell->clear_refine_flag (); for (typename Triangulation::active_cell_iterator - cell = triangulation.begin_active(min_grid_level); - cell != triangulation.end_active(min_grid_level); ++cell) + cell = triangulation.begin_active(min_grid_level); + cell != triangulation.end_active(min_grid_level); ++cell) cell->clear_coarsen_flag (); @@ -403,8 +403,8 @@ start_time_iteration: std::cout << "Time step " << timestep_number << " at t=" << time << std::endl; - tmp.reinit (solution.size()); - forcing_terms.reinit (solution.size()); + tmp.reinit (solution.size()); + forcing_terms.reinit (solution.size()); mass_matrix.vmult(system_rhs, old_solution); @@ -458,16 +458,16 @@ start_time_iteration: (pre_refinement_step < n_adaptive_pre_refinement_steps)) { refine_mesh (initial_global_refinement, - initial_global_refinement + n_adaptive_pre_refinement_steps); + initial_global_refinement + n_adaptive_pre_refinement_steps); ++pre_refinement_step; - std::cout << std::endl; + std::cout << std::endl; goto start_time_iteration; } else if ((timestep_number > 0) && (timestep_number % 5 == 0)) refine_mesh (initial_global_refinement, - initial_global_refinement + n_adaptive_pre_refinement_steps); + initial_global_refinement + n_adaptive_pre_refinement_steps); old_solution = solution; } diff --git a/deal.II/examples/step-37/step-37.cc b/deal.II/examples/step-37/step-37.cc index 7520e4aebe..38cbea4e2a 100644 --- a/deal.II/examples/step-37/step-37.cc +++ b/deal.II/examples/step-37/step-37.cc @@ -975,7 +975,7 @@ namespace Step37 typedef PreconditionChebyshev > SMOOTHER; MGSmootherPrecondition > - mg_smoother; + mg_smoother; // Then, we initialize the smoother with our level matrices and the // mandatory additional data for the Chebyshev smoother. We use quite a diff --git a/deal.II/examples/step-39/step-39.cc b/deal.II/examples/step-39/step-39.cc index c1544a4d5c..e19c5c86f3 100644 --- a/deal.II/examples/step-39/step-39.cc +++ b/deal.II/examples/step-39/step-39.cc @@ -88,13 +88,13 @@ namespace Step39 { public: void cell(MeshWorker::DoFInfo &dinfo, - typename MeshWorker::IntegrationInfo &info) const; + typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, - typename MeshWorker::IntegrationInfo &info) const; + typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; @@ -153,9 +153,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; @@ -202,9 +202,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; @@ -298,9 +298,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; // Here we have the integration on cells. There is currently no good @@ -614,7 +614,7 @@ namespace Step39 MeshWorker::Assembler::MGMatrixSimple > assembler; assembler.initialize(mg_matrix); assembler.initialize_fluxes(mg_matrix_dg_up, mg_matrix_dg_down); - + MatrixIntegrator integrator; // Here is the other difference to the previous function: we run over all // cells, not only the active ones. And we use mg_dof_handler, diff --git a/deal.II/examples/step-40/step-40.cc b/deal.II/examples/step-40/step-40.cc index 4a0faa59d0..2aea752ca7 100644 --- a/deal.II/examples/step-40/step-40.cc +++ b/deal.II/examples/step-40/step-40.cc @@ -195,7 +195,7 @@ namespace Step40 computing_timer (pcout, TimerOutput::summary, TimerOutput::wall_times) - {} + {} @@ -648,12 +648,12 @@ namespace Step40 TimerOutput::Scope t(computing_timer, "output"); output_results (cycle); } - + pcout << std::endl; computing_timer.print_summary (); computing_timer.reset (); } - + } } diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 586c023796..83aeb4c8f3 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -100,32 +100,34 @@ namespace Step42 template class Input { - public: - Input (const char* _name) : + public: + Input (const char *_name) : name (_name), mpi_communicator (MPI_COMM_WORLD), pcout (std::cout, - (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), + (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), obstacle_data (0), hx (0), hy (0), nx (0), ny (0) - {read_obstacle (name);} + { + read_obstacle (name); + } - double hv (int i, int j); + double hv (int i, int j); - double obstacle_function (double x,double y); + double obstacle_function (double x,double y); - void read_obstacle (const char* name); + void read_obstacle (const char *name); - private: - const char* name; - MPI_Comm mpi_communicator; - ConditionalOStream pcout; - std::vector obstacle_data; - double hx, hy; - int nx, ny; + private: + const char *name; + MPI_Comm mpi_communicator; + ConditionalOStream pcout; + std::vector obstacle_data; + double hx, hy; + int nx, ny; }; // This function is used in obstacle_function () @@ -212,7 +214,7 @@ namespace Step42 // obstacle datas and stores them in the std::vector // obstacle_data. It will be used only in run (). template - void Input::read_obstacle (const char* name) + void Input::read_obstacle (const char *name) { std::ifstream f(name); @@ -222,9 +224,9 @@ namespace Step42 for (int k=0; k> val; - obstacle_data.push_back(val); + double val; + f >> val; + obstacle_data.push_back(val); } hx = 1.0/(nx - 1); @@ -253,18 +255,21 @@ namespace Step42 MPI_Comm _mpi_communicator, ConditionalOStream _pcout); - void plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, + void plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, const SymmetricTensor<2,dim> &strain_tensor, - unsigned int &elast_points, - unsigned int &plast_points, - double &yield); - void linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, - SymmetricTensor<4,dim> &stress_strain_tensor, + unsigned int &elast_points, + unsigned int &plast_points, + double &yield); + void linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, + SymmetricTensor<4,dim> &stress_strain_tensor, const SymmetricTensor<2,dim> &strain_tensor); inline SymmetricTensor<2,dim> get_strain (const FEValues &fe_values, const unsigned int shape_func, const unsigned int q_point) const; - void set_sigma_0 (double sigma_hlp) {sigma_0 = sigma_hlp;} + void set_sigma_0 (double sigma_hlp) + { + sigma_0 = sigma_hlp; + } private: SymmetricTensor<4,dim> stress_strain_tensor_mu; @@ -324,11 +329,11 @@ namespace Step42 // Also we sum up the elastic and the plastic quadrature // points. template - void ConstitutiveLaw::plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, + void ConstitutiveLaw::plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, const SymmetricTensor<2,dim> &strain_tensor, - unsigned int &elast_points, - unsigned int &plast_points, - double &yield) + unsigned int &elast_points, + unsigned int &plast_points, + double &yield) { if (dim == 3) { @@ -359,9 +364,9 @@ namespace Step42 // This function returns the linearized stress strain tensor. // It contains the derivative of the nonlinear constitutive law. template - void ConstitutiveLaw::linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, - SymmetricTensor<4,dim> &stress_strain_tensor, - const SymmetricTensor<2,dim> &strain_tensor) + void ConstitutiveLaw::linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, + SymmetricTensor<4,dim> &stress_strain_tensor, + const SymmetricTensor<2,dim> &strain_tensor) { if (dim == 3) { @@ -485,7 +490,7 @@ namespace Step42 Function(dim), input_obstacle_copy(_input), use_read_obstacle(_use_read_obstacle) - {} + {} virtual double value (const Point &p, const unsigned int component = 0) const; @@ -495,7 +500,7 @@ namespace Step42 private: std_cxx1x::shared_ptr > const &input_obstacle_copy; - bool use_read_obstacle; + bool use_read_obstacle; }; template @@ -510,10 +515,10 @@ namespace Step42 return_value = p(1); if (component == 2) { - if (use_read_obstacle) - return_value = 1.999 - input_obstacle_copy->obstacle_function (p(0), p(1)); - else - return_value = -std::sqrt (0.36 - (p(0)-0.5)*(p(0)-0.5) - (p(1)-0.5)*(p(1)-0.5)) + 1.59; + if (use_read_obstacle) + return_value = 1.999 - input_obstacle_copy->obstacle_function (p(0), p(1)); + else + return_value = -std::sqrt (0.36 - (p(0)-0.5)*(p(0)-0.5) - (p(1)-0.5)*(p(1)-0.5)) + 1.59; } return return_value; } @@ -703,7 +708,7 @@ namespace Step42 computing_timer.exit_section("Setup: distribute DoFs"); } - // Setup of the hanging nodes and the Dirichlet constraints. + // Setup of the hanging nodes and the Dirichlet constraints. { constraints_hanging_nodes.clear (); constraints_hanging_nodes.reinit (locally_relevant_dofs); @@ -721,7 +726,7 @@ namespace Step42 dirichlet_constraints (); } - // Initialization for matrices and vectors. + // Initialization for matrices and vectors. { solution.reinit (locally_relevant_dofs, mpi_communicator); system_rhs_newton.reinit (locally_owned_dofs, mpi_communicator); @@ -732,7 +737,7 @@ namespace Step42 active_set.set_size (locally_relevant_dofs.size ()); } - // Here we setup sparsity pattern. + // Here we setup sparsity pattern. { computing_timer.enter_section("Setup: matrix"); TrilinosWrappers::SparsityPattern sp (locally_owned_dofs, @@ -745,12 +750,12 @@ namespace Step42 system_matrix_newton.reinit (sp); - // we are going to reuse the system - // matrix for assembling the diagonal - // of the mass matrix so that we do not - // need to allocate two sparse matrices - // at the same time: - TrilinosWrappers::SparseMatrix & mass_matrix = system_matrix_newton; + // we are going to reuse the system + // matrix for assembling the diagonal + // of the mass matrix so that we do not + // need to allocate two sparse matrices + // at the same time: + TrilinosWrappers::SparseMatrix &mass_matrix = system_matrix_newton; assemble_mass_matrix_diagonal (mass_matrix); const unsigned int start = (system_rhs_newton.local_range().first), @@ -758,10 +763,10 @@ namespace Step42 for (unsigned int j=start; j void PlasticityContactProblem::assemble_mass_matrix_diagonal (TrilinosWrappers::SparseMatrix &mass_matrix) { - QTrapez face_quadrature_formula; + QTrapez face_quadrature_formula; FEFaceValues fe_values_face (fe, face_quadrature_formula, update_values | @@ -1031,7 +1036,7 @@ namespace Step42 FullMatrix cell_matrix (dofs_per_cell, dofs_per_cell); Tensor<1,dim,double> ones (dim); for (unsigned i=0; i local_dof_indices (dofs_per_cell); @@ -1053,7 +1058,7 @@ namespace Step42 for (unsigned int q_point=0; q_pointget_dof_indices (local_dof_indices); @@ -1271,8 +1276,8 @@ namespace Step42 SolverControl solver_control (system_matrix_newton.m(), solver_tolerance); SolverBicgstab solver(solver_control, mem, - SolverBicgstab:: - AdditionalData(false, 1.e-10)); + SolverBicgstab:: + AdditionalData(false, 1.e-10)); solver.solve(system_matrix_newton, distributed_solution, system_rhs_newton, preconditioner_u); @@ -1397,9 +1402,9 @@ namespace Step42 computing_timer.exit_section("Residual and lambda"); pcout << " Residual of the non-contact part of the system: " << resid - << std::endl - << " with a damping parameter alpha = " << a - << std::endl; + << std::endl + << " with a damping parameter alpha = " << a + << std::endl; // The previous iteration of step 0 is the solution of an elastic problem. // So a linear combination of a plastic and an elastic solution makes no sense @@ -1416,7 +1421,7 @@ namespace Step42 int is_my_set_changed = (active_set == active_set_old)?0:1; int num_changed = Utilities::MPI::sum(is_my_set_changed, MPI_COMM_WORLD); if (num_changed==0 && resid < 1e-8) - break; + break; active_set_old = active_set; } @@ -1431,7 +1436,7 @@ namespace Step42 template void PlasticityContactProblem::refine_grid () { - Vector estimated_error_per_cell (triangulation.n_active_cells()); + Vector estimated_error_per_cell (triangulation.n_active_cells()); KellyErrorEstimator::estimate (dof_handler, QGauss(3), typename FunctionMap::type(), @@ -1546,13 +1551,13 @@ namespace Step42 template void PlasticityContactProblem::run () { - use_read_obstacle = false; - if (use_read_obstacle) - { - pcout << "Read the obstacle from a file." << std::endl; - input_obstacle.reset (new Input("obstacle_file.pbm")); - pcout << "Obstacle is available now." << std::endl; - } + use_read_obstacle = false; + if (use_read_obstacle) + { + pcout << "Read the obstacle from a file." << std::endl; + input_obstacle.reset (new Input("obstacle_file.pbm")); + pcout << "Obstacle is available now." << std::endl; + } const unsigned int n_cycles = 6; for (cycle=0; cycle(dof_handler)); - refine_grid (); - computing_timer.exit_section("Setup: refine mesh"); + computing_timer.enter_section("Setup: refine mesh"); + soltrans.reset (new parallel::distributed::SolutionTransfer(dof_handler)); + refine_grid (); + computing_timer.exit_section("Setup: refine mesh"); } setup_system (); @@ -1580,8 +1585,8 @@ namespace Step42 { TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton); distributed_solution = solution; - soltrans->interpolate(distributed_solution); - solution = distributed_solution; + soltrans->interpolate(distributed_solution); + solution = distributed_solution; } computing_timer.exit_section("Setup"); @@ -1618,7 +1623,7 @@ int main (int argc, char *argv[]) int _n_refinements_global = 3; if (argc == 2) - _n_refinements_global = atoi(argv[1]); + _n_refinements_global = atoi(argv[1]); PlasticityContactProblem<3> laplace_problem_3d (_n_refinements_global); laplace_problem_3d.run (); diff --git a/deal.II/examples/step-48/step-48.cc b/deal.II/examples/step-48/step-48.cc index 9e2f4a2466..d972e8e57c 100644 --- a/deal.II/examples/step-48/step-48.cc +++ b/deal.II/examples/step-48/step-48.cc @@ -473,8 +473,8 @@ namespace Step48 "solution-" + Utilities::int_to_string (timestep_number, 3); std::ofstream output ((filename + - "." + Utilities::int_to_string (Utilities::MPI:: - this_mpi_process(MPI_COMM_WORLD),4) + ".vtu").c_str()); + "." + Utilities::int_to_string (Utilities::MPI:: + this_mpi_process(MPI_COMM_WORLD),4) + ".vtu").c_str()); data_out.write_vtu (output); if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) diff --git a/deal.II/examples/step-49/step-49.cc b/deal.II/examples/step-49/step-49.cc index 2592717ce2..8f13864d6b 100644 --- a/deal.II/examples/step-49/step-49.cc +++ b/deal.II/examples/step-49/step-49.cc @@ -49,7 +49,7 @@ using namespace dealii; // format that can easily be visualized in the same way as was done in step-1. template void mesh_info(const Triangulation &tria, - const std::string &filename) + const std::string &filename) { std::cout << "Mesh info:" << std::endl << " dimension: " << dim << std::endl @@ -87,8 +87,8 @@ void mesh_info(const Triangulation &tria, GridOut grid_out; grid_out.write_eps (tria, out); std::cout << " written to " << filename - << std::endl - << std::endl; + << std::endl + << std::endl; } // @sect3{Main routines} @@ -129,7 +129,7 @@ void grid_2 () repetitions[1]=2; GridGenerator::subdivided_hyper_rectangle (tria2, repetitions, Point<2>(1.0,-1.0), - Point<2>(4.0,1.0)); + Point<2>(4.0,1.0)); Triangulation<2> triangulation; GridGenerator::merge_triangulations (tria1, tria2, triangulation); @@ -244,7 +244,7 @@ void grid_4() Point<2> grid_5_transform (const Point<2> &in) { return Point<2>(in(0), - in(1) + std::sin(in(0)/5.0*3.14159)); + in(1) + std::sin(in(0)/5.0*3.14159)); } @@ -256,7 +256,7 @@ void grid_5() repetitions[1] = 2; GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), - Point<2>(10.0,1.0)); + Point<2>(10.0,1.0)); GridTools::transform(&grid_5_transform, tria); mesh_info(tria, "grid-5.eps"); @@ -276,16 +276,16 @@ void grid_5() // vertices. struct Grid6Func { - double trans(const double y) const - { - return std::tanh(2*y)/tanh(2); - } + double trans(const double y) const + { + return std::tanh(2*y)/tanh(2); + } - Point<2> operator() (const Point<2> & in) const - { - return Point<2> (in(0), - trans(in(1))); - } + Point<2> operator() (const Point<2> &in) const + { + return Point<2> (in(0), + trans(in(1))); + } }; @@ -296,7 +296,7 @@ void grid_6() repetitions[0] = repetitions[1] = 40; GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), - Point<2>(1.0,1.0)); + Point<2>(1.0,1.0)); GridTools::transform(Grid6Func(), tria); mesh_info(tria, "grid-6.eps"); @@ -318,7 +318,7 @@ void grid_7() repetitions[0] = repetitions[1] = 16; GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), - Point<2>(1.0,1.0)); + Point<2>(1.0,1.0)); GridTools::distort_random (0.3, tria, true); mesh_info(tria, "grid-7.eps"); diff --git a/deal.II/examples/step-50/step-50.cc b/deal.II/examples/step-50/step-50.cc index 47df0fd2e8..9326eeb7fc 100644 --- a/deal.II/examples/step-50/step-50.cc +++ b/deal.II/examples/step-50/step-50.cc @@ -320,7 +320,7 @@ namespace Step50 deallog << std::endl; DoFTools::extract_locally_relevant_dofs (mg_dof_handler, - locally_relevant_set); + locally_relevant_set); //solution.reinit (mg_dof_handler.n_dofs()); @@ -431,14 +431,14 @@ namespace Step50 MGTools::make_sparsity_pattern(mg_dof_handler, csp, level); mg_matrices[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level), - mg_dof_handler.locally_owned_mg_dofs(level), - csp, - MPI_COMM_WORLD, true); + mg_dof_handler.locally_owned_mg_dofs(level), + csp, + MPI_COMM_WORLD, true); mg_interface_matrices[level].reinit(mg_dof_handler.locally_owned_mg_dofs(level), - mg_dof_handler.locally_owned_mg_dofs(level), - csp, - MPI_COMM_WORLD, true); + mg_dof_handler.locally_owned_mg_dofs(level), + csp, + MPI_COMM_WORLD, true); } } @@ -703,7 +703,7 @@ namespace Step50 mg_interface_matrices[cell->level()]); } - for (unsigned int i=0;i coarse_grid_solver; //coarse_grid_solver.initialize (coarse_matrix); @@ -841,28 +841,28 @@ namespace Step50 if (false) { - // code to optionally compare to Trilinos ML - TrilinosWrappers::PreconditionAMG prec; - - TrilinosWrappers::PreconditionAMG::AdditionalData Amg_data; - // Amg_data.constant_modes = constant_modes; - Amg_data.elliptic = true; - Amg_data.higher_order_elements = true; - Amg_data.smoother_sweeps = 2; - Amg_data.aggregation_threshold = 0.02; - // Amg_data.symmetric = true; - - prec.initialize (system_matrix, - Amg_data); - cg.solve (system_matrix, solution, system_rhs, - prec); + // code to optionally compare to Trilinos ML + TrilinosWrappers::PreconditionAMG prec; + + TrilinosWrappers::PreconditionAMG::AdditionalData Amg_data; + // Amg_data.constant_modes = constant_modes; + Amg_data.elliptic = true; + Amg_data.higher_order_elements = true; + Amg_data.smoother_sweeps = 2; + Amg_data.aggregation_threshold = 0.02; + // Amg_data.symmetric = true; + + prec.initialize (system_matrix, + Amg_data); + cg.solve (system_matrix, solution, system_rhs, + prec); } else { - cg.solve (system_matrix, solution, system_rhs, - preconditioner); + cg.solve (system_matrix, solution, system_rhs, + preconditioner); } - + constraints.distribute (solution); } @@ -894,16 +894,16 @@ namespace Step50 TrilinosWrappers::MPI::Vector temp_solution; temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD); temp_solution = solution; - + KellyErrorEstimator::estimate (static_cast&>(mg_dof_handler), QGauss(3), typename FunctionMap::type(), temp_solution, estimated_error_per_cell); parallel::distributed::GridRefinement:: - refine_and_coarsen_fixed_fraction (triangulation, - estimated_error_per_cell, - 0.3, 0.03); + refine_and_coarsen_fixed_fraction (triangulation, + estimated_error_per_cell, + 0.3, 0.03); triangulation.execute_coarsening_and_refinement (); } @@ -993,7 +993,7 @@ namespace Step50 triangulation.refine_global (3); } else - refine_grid (); + refine_grid (); deallog << " Number of active cells: " << triangulation.n_global_active_cells() diff --git a/deal.II/include/deal.II/base/data_out_base.h b/deal.II/include/deal.II/base/data_out_base.h index c600c6cb51..b054a3a822 100644 --- a/deal.II/include/deal.II/base/data_out_base.h +++ b/deal.II/include/deal.II/base/data_out_base.h @@ -1279,66 +1279,66 @@ public: */ struct SvgFlags { - public: - /** - * This denotes the number of the - * data vector which shall be used - * for generating the height - * information. By default, the - * first data vector is taken, - * i.e. height_vector==0, if - * there is any data vector. If there - * is no data vector, no height - * information is generated. - */ - unsigned int height_vector; + public: + /** + * This denotes the number of the + * data vector which shall be used + * for generating the height + * information. By default, the + * first data vector is taken, + * i.e. height_vector==0, if + * there is any data vector. If there + * is no data vector, no height + * information is generated. + */ + unsigned int height_vector; - /* - * Angles for the perspective view - */ - int azimuth_angle, polar_angle; - - unsigned int line_thickness; + /* + * Angles for the perspective view + */ + int azimuth_angle, polar_angle; - /* - * Draw a margin of 5% around the plotted area - */ - bool margin; + unsigned int line_thickness; - /* - * Draw a colorbar encoding the cell coloring - */ - bool draw_colorbar; + /* + * Draw a margin of 5% around the plotted area + */ + bool margin; - /* - * Constructor. - */ - SvgFlags(const unsigned int height_vector = 0, - const int azimuth_angle = 37, - const int polar_angle = 45, - const unsigned int line_thickness = 1, - const bool margin = true, - const bool draw_colorbar = true); + /* + * Draw a colorbar encoding the cell coloring + */ + bool draw_colorbar; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; - - private: + /* + * Constructor. + */ + SvgFlags(const unsigned int height_vector = 0, + const int azimuth_angle = 37, + const int polar_angle = 45, + const unsigned int line_thickness = 1, + const bool margin = true, + const bool draw_colorbar = true); + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; + + private: }; @@ -1496,7 +1496,7 @@ public: vtu, /** - * Output in + * Output in * SVG format. */ svg, @@ -1870,23 +1870,23 @@ public: const std::vector > &vector_data_ranges, const VtkFlags &flags, std::ostream &out); - + /** * Write the given list of patches to the output stream in SVG format. * - * SVG (Scalable Vector Graphics) is an XML-based vector image format - * developed and maintained by the World Wide Web Consortium (W3C). - * This function conforms to the latest specification SVG 1.1, + * SVG (Scalable Vector Graphics) is an XML-based vector image format + * developed and maintained by the World Wide Web Consortium (W3C). + * This function conforms to the latest specification SVG 1.1, * released on August 16, 2011. Controlling the graphic output is - * possible by setting or clearing the respective flags (see the - * SvgFlags struct). At present, this format only supports output + * possible by setting or clearing the respective flags (see the + * SvgFlags struct). At present, this format only supports output * for two-dimensional data, with values in the third direction * taken from a data vector. - * - * For the output, each patch is subdivided into four triangles - * which are then written as polygons and filled with a linear - * color gradient. The arising coloring of the patches visualizes - * the data values at the vertices taken from the specified data + * + * For the output, each patch is subdivided into four triangles + * which are then written as polygons and filled with a linear + * color gradient. The arising coloring of the patches visualizes + * the data values at the vertices taken from the specified data * vector. A colorbar can be drawn to encode the coloring. * * @note Yet only implemented for two dimensions with an additional @@ -1898,7 +1898,7 @@ public: const std::vector > &vector_data_ranges, const SvgFlags &flags, std::ostream &out); - + /** * Write the given list of patches to the output stream in deal.II * intermediate format. This is not a format understood by any other @@ -2129,19 +2129,19 @@ private: /** - * This function projects a three-dimensional point (Point<3> point) - * onto a two-dimensional image plane, specified by the position of - * the camera viewing system (Point<3> camera_position), camera - * direction (Point<3> camera_position), camera horizontal (Point<3> - * camera_horizontal, necessary for the correct alignment of the + * This function projects a three-dimensional point (Point<3> point) + * onto a two-dimensional image plane, specified by the position of + * the camera viewing system (Point<3> camera_position), camera + * direction (Point<3> camera_position), camera horizontal (Point<3> + * camera_horizontal, necessary for the correct alignment of the * later images), and the focus of the camera (float camera_focus). * * For SVG output. */ - static Point<2> svg_project_point(Point<3> point, - Point<3> camera_position, - Point<3> camera_direction, - Point<3> camera_horizontal, + static Point<2> svg_project_point(Point<3> point, + Point<3> camera_position, + Point<3> camera_direction, + Point<3> camera_horizontal, float camera_focus); /** * Function to compute the gradient parameters for @@ -2681,7 +2681,7 @@ public: * in SVG format. See * DataOutBase::write_svg. */ - void write_svg(std::ostream &out) const; + void write_svg(std::ostream &out) const; /** * Obtain data through get_patches() diff --git a/deal.II/include/deal.II/base/derivative_form.h b/deal.II/include/deal.II/base/derivative_form.h index 880d6db1f1..313c343759 100644 --- a/deal.II/include/deal.II/base/derivative_form.h +++ b/deal.II/include/deal.II/base/derivative_form.h @@ -360,7 +360,7 @@ DerivativeForm::covariant_form() const Tensor<2,dim> DF_t (dealii::transpose(invert( (Tensor<2,dim>)(*this) ))); DerivativeForm<1,dim, spacedim> result = DF_t; - return(result); + return (result); } else { diff --git a/deal.II/include/deal.II/base/exceptions.h b/deal.II/include/deal.II/base/exceptions.h index e8608444cf..ffea72d31a 100644 --- a/deal.II/include/deal.II/base/exceptions.h +++ b/deal.II/include/deal.II/base/exceptions.h @@ -830,7 +830,7 @@ namespace StandardExceptions ExcIndexRange((index),0,(range))) #define AssertGlobalIndexRange(index,range) Assert((index) < (range), \ - ExcIndexRange((index),0,(range))) + ExcIndexRange((index),0,(range))) using namespace StandardExceptions; diff --git a/deal.II/include/deal.II/base/logstream.h b/deal.II/include/deal.II/base/logstream.h index bbc3c08dee..8afb3ea2cb 100644 --- a/deal.II/include/deal.II/base/logstream.h +++ b/deal.II/include/deal.II/base/logstream.h @@ -177,7 +177,7 @@ public: /** * Enable output to a second stream o. * - * The optional argument @p print_job_id specifies whether + * The optional argument @p print_job_id specifies whether */ void attach (std::ostream &o, const bool print_job_id = true); diff --git a/deal.II/include/deal.II/base/memory_consumption.h b/deal.II/include/deal.II/base/memory_consumption.h index c8c64f59f4..f5add851ca 100644 --- a/deal.II/include/deal.II/base/memory_consumption.h +++ b/deal.II/include/deal.II/base/memory_consumption.h @@ -472,7 +472,7 @@ namespace MemoryConsumption { return sizeof(int); } - + inline @@ -481,7 +481,7 @@ namespace MemoryConsumption return sizeof(unsigned int); } - + inline std::size_t memory_consumption (const unsigned long long int) diff --git a/deal.II/include/deal.II/base/mpi.h b/deal.II/include/deal.II/base/mpi.h index 91d4d920a5..cb88fcc2ec 100644 --- a/deal.II/include/deal.II/base/mpi.h +++ b/deal.II/include/deal.II/base/mpi.h @@ -381,8 +381,8 @@ namespace Utilities * Called by the constructors. */ void do_init(int &argc, - char ** &argv, - unsigned int max_num_threads); + char ** &argv, + unsigned int max_num_threads); }; namespace internal @@ -414,7 +414,7 @@ namespace Utilities { return MPI_UNSIGNED_LONG; } - + inline MPI_Datatype mpi_type_id (const unsigned long long int *) { diff --git a/deal.II/include/deal.II/base/multithread_info.h b/deal.II/include/deal.II/base/multithread_info.h index 178d687c5d..3b72975556 100644 --- a/deal.II/include/deal.II/base/multithread_info.h +++ b/deal.II/include/deal.II/base/multithread_info.h @@ -42,7 +42,7 @@ DEAL_II_NAMESPACE_OPEN * To set n_default_threads add the following at the start of your main(): * * multithread_info.n_default_threads=1; - * + * * * @ingroup threads * @author Thomas Richter, Wolfgang Bangerth, 2000 diff --git a/deal.II/include/deal.II/base/partitioner.h b/deal.II/include/deal.II/base/partitioner.h index 532d7a2533..977f40a321 100644 --- a/deal.II/include/deal.II/base/partitioner.h +++ b/deal.II/include/deal.II/base/partitioner.h @@ -277,7 +277,7 @@ namespace Utilities * Returns the MPI communicator underlying the * partitioner object. */ - const MPI_Comm& get_communicator() const; + const MPI_Comm &get_communicator() const; /** * Computes the memory consumption of this @@ -290,7 +290,7 @@ namespace Utilities */ DeclException2 (ExcIndexNotPresent, types::global_dof_index, - unsigned int, + unsigned int, << "Global index " << arg1 << " neither owned nor ghost on proc " << arg2); @@ -413,7 +413,7 @@ namespace Utilities { types::global_dof_index size= local_range_data.second - local_range_data.first; Assert(size<=std::numeric_limits::max(), - ExcNotImplemented()); + ExcNotImplemented()); return static_cast(size); } @@ -574,7 +574,7 @@ namespace Utilities inline - const MPI_Comm& + const MPI_Comm & Partitioner::get_communicator() const { return communicator; diff --git a/deal.II/include/deal.II/base/polynomials_piecewise.h b/deal.II/include/deal.II/base/polynomials_piecewise.h index 8ae182806b..8ff4d0b786 100644 --- a/deal.II/include/deal.II/base/polynomials_piecewise.h +++ b/deal.II/include/deal.II/base/polynomials_piecewise.h @@ -192,7 +192,7 @@ namespace Polynomials y = offset+step+step-x; } else - { + { const number offset = step * interval; if (xoffset+step) return 0; diff --git a/deal.II/include/deal.II/base/subscriptor.h b/deal.II/include/deal.II/base/subscriptor.h index 824fadccab..a6372e016e 100644 --- a/deal.II/include/deal.II/base/subscriptor.h +++ b/deal.II/include/deal.II/base/subscriptor.h @@ -136,10 +136,10 @@ public: int, char *, std::string &, << "Object of class " << arg2 << " is still used by " << arg1 << " other objects.\n" - << "(Additional information: " << arg3 << ")\n" - << "Note the entry in the Frequently Asked Questions of " - << "deal.II (linked to from http://www.dealii.org/) for " - << "more information on what this error means."); + << "(Additional information: " << arg3 << ")\n" + << "Note the entry in the Frequently Asked Questions of " + << "deal.II (linked to from http://www.dealii.org/) for " + << "more information on what this error means."); /** * A subscriber with the diff --git a/deal.II/include/deal.II/base/table_indices.h b/deal.II/include/deal.II/base/table_indices.h index 509435ccfa..44dd9fd9a6 100644 --- a/deal.II/include/deal.II/base/table_indices.h +++ b/deal.II/include/deal.II/base/table_indices.h @@ -46,12 +46,12 @@ public: * ith index. */ unsigned int operator[] (const unsigned int i) const; - + /** * Write access the value of the * ith index. */ - unsigned int & operator[] (const unsigned int i); + unsigned int &operator[] (const unsigned int i); /** * Compare two index fields for @@ -438,7 +438,7 @@ TableIndicesBase::operator [] (const unsigned int i) const template inline unsigned int & -TableIndicesBase::operator [] (const unsigned int i) +TableIndicesBase::operator [] (const unsigned int i) { Assert (i < N, ExcIndexRange (i, 0, N)); return indices[i]; diff --git a/deal.II/include/deal.II/base/tensor.h b/deal.II/include/deal.II/base/tensor.h index 8120cb729e..5ddc7dc752 100644 --- a/deal.II/include/deal.II/base/tensor.h +++ b/deal.II/include/deal.II/base/tensor.h @@ -82,7 +82,7 @@ public: * number of independent components of each sub-tensor. */ static const unsigned int - n_independent_components = Tensor::n_independent_components * dim; + n_independent_components = Tensor::n_independent_components *dim; /** * Type of stored objects. This @@ -151,13 +151,13 @@ public: /** * Read access using TableIndices indices */ - Number operator [](const TableIndices & indices) const; - + Number operator [](const TableIndices &indices) const; + /** * Read and write access using TableIndices indices */ - Number &operator [](const TableIndices & indices); - + Number &operator [](const TableIndices &indices); + /** * Assignment operator. */ @@ -422,30 +422,30 @@ Tensor::operator[] (const unsigned int i) const template inline -Number -Tensor::operator[] (const TableIndices & indices) const +Number +Tensor::operator[] (const TableIndices &indices) const { - const unsigned int inner_ind = indices[0]; - Assert (inner_ind indices1; - for (unsigned int i = 0; i < rank_-1;i++) - indices1[i] = indices[i+1]; - return (subtensor[inner_ind])[indices1]; + const unsigned int inner_ind = indices[0]; + Assert (inner_ind indices1; + for (unsigned int i = 0; i < rank_-1; i++) + indices1[i] = indices[i+1]; + return (subtensor[inner_ind])[indices1]; } template inline -Number & -Tensor::operator[] (const TableIndices & indices) +Number & +Tensor::operator[] (const TableIndices &indices) { - const unsigned int inner_ind = indices[0]; - Assert (inner_ind indices1; - for (unsigned int i = 0; i < rank_-1;i++) - indices1[i] = indices[i+1]; - return (subtensor[inner_ind])[indices1]; + const unsigned int inner_ind = indices[0]; + Assert (inner_ind indices1; + for (unsigned int i = 0; i < rank_-1; i++) + indices1[i] = indices[i+1]; + return (subtensor[inner_ind])[indices1]; } template @@ -647,11 +647,11 @@ unsigned int Tensor::component_to_unrolled_index(const TableIndices &indices) { TableIndices indices1; - for (unsigned int i = 0; i < rank_-1;i++) + for (unsigned int i = 0; i < rank_-1; i++) indices1[i] = indices[i]; Assert (indices[rank_-1] < dim, - ExcIndexRange (indices[rank_-1], 0, dim)); + ExcIndexRange (indices[rank_-1], 0, dim)); return ( Tensor::component_to_unrolled_index(indices1) * dim + indices[rank_-1]); } @@ -661,7 +661,7 @@ TableIndices Tensor::unrolled_to_component_indices(const unsigned int i) { Assert (i < n_independent_components, - ExcIndexRange (i, 0, n_independent_components)); + ExcIndexRange (i, 0, n_independent_components)); TableIndices indices; diff --git a/deal.II/include/deal.II/base/tensor_base.h b/deal.II/include/deal.II/base/tensor_base.h index 3a7593b2b8..94c8e1b3e9 100644 --- a/deal.II/include/deal.II/base/tensor_base.h +++ b/deal.II/include/deal.II/base/tensor_base.h @@ -439,16 +439,16 @@ public: * backcompatibility. */ Number &operator [] (const unsigned int index); - + /** * Read access using TableIndices indices */ - Number operator [](const TableIndices<1> & indices) const; - + Number operator [](const TableIndices<1> &indices) const; + /** * Read and write access using TableIndices indices */ - Number &operator [](const TableIndices<1> & indices); + Number &operator [](const TableIndices<1> &indices); /** * Assignment operator. @@ -999,7 +999,7 @@ Number &Tensor<1,dim,Number>::operator [] (const unsigned int index) template inline -Number Tensor<1,dim,Number>::operator [] (const TableIndices<1> & indices) const +Number Tensor<1,dim,Number>::operator [] (const TableIndices<1> &indices) const { Assert (indices[0]::operator [] (const TableIndices<1> & indices) const template inline -Number &Tensor<1,dim,Number>::operator [] (const TableIndices<1> & indices) +Number &Tensor<1,dim,Number>::operator [] (const TableIndices<1> &indices) { Assert (indices[0],6> - spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const) DEAL_II_DEPRECATED; + spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const) DEAL_II_DEPRECATED; template ,7> - spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; + spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator,7> @@ -2781,13 +2781,13 @@ namespace Threads inline internal::fun_encapsulator,7> - spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; + spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) DEAL_II_DEPRECATED; template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator,7> @@ -2813,13 +2813,13 @@ namespace Threads internal::fun_encapsulator,7> - spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const) DEAL_II_DEPRECATED; + spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const) DEAL_II_DEPRECATED; template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator scratch_data; bool currently_in_use; - /** - * Default constructor. - */ - ScratchDataObject () - : - currently_in_use (false) - {} - - ScratchDataObject (ScratchData *p, - const bool in_use) - : - scratch_data (p), - currently_in_use (in_use) - {} + /** + * Default constructor. + */ + ScratchDataObject () + : + currently_in_use (false) + {} + + ScratchDataObject (ScratchData *p, + const bool in_use) + : + scratch_data (p), + currently_in_use (in_use) + {} }; @@ -254,17 +254,17 @@ namespace WorkStream const ScratchData *sample_scratch_data; - /** - * Default constructor. - * Initialize everything that doesn't - * have a default constructor itself. - */ - ItemType () - : - n_items (0), - scratch_data (0), - sample_scratch_data (0) - {} + /** + * Default constructor. + * Initialize everything that doesn't + * have a default constructor itself. + */ + ItemType () + : + n_items (0), + scratch_data (0), + sample_scratch_data (0) + {} }; @@ -286,7 +286,7 @@ namespace WorkStream tbb::filter (/*is_serial=*/true), remaining_iterator_range (begin, end), ring_buffer (buffer_size), - sample_scratch_data (sample_scratch_data), + sample_scratch_data (sample_scratch_data), n_emitted_items (0), chunk_size (chunk_size) { @@ -431,9 +431,9 @@ namespace WorkStream ring_buffer[element].work_items .resize (chunk_size, remaining_iterator_range.second); ring_buffer[element].scratch_data - = &thread_local_scratch; + = &thread_local_scratch; ring_buffer[element].sample_scratch_data - = &sample_scratch_data; + = &sample_scratch_data; ring_buffer[element].copy_datas .resize (chunk_size, sample_copy_data); } @@ -502,8 +502,8 @@ namespace WorkStream // see if there is an unused object. if so, grab it and mark // it as used for (typename ItemType::ScratchDataList::iterator - p = scratch_data_list.begin(); - p != scratch_data_list.end(); ++p) + p = scratch_data_list.begin(); + p != scratch_data_list.end(); ++p) if (p->currently_in_use == false) { scratch_data = p->scratch_data.get(); @@ -517,7 +517,7 @@ namespace WorkStream scratch_data = new ScratchData(*current_item->sample_scratch_data); typename ItemType::ScratchDataList::value_type - new_scratch_object (scratch_data, true); + new_scratch_object (scratch_data, true); scratch_data_list.push_back (new_scratch_object); } } @@ -527,22 +527,22 @@ namespace WorkStream // nothing good can happen if they throw an exception and we are best // off catching it and showing an error message for (unsigned int i=0; in_items; ++i) - { - try - { - worker (current_item->work_items[i], - *scratch_data, - current_item->copy_datas[i]); - } - catch (const std::exception &exc) - { - Threads::internal::handle_std_exception (exc); - } - catch (...) - { - Threads::internal::handle_unknown_exception (); - } - } + { + try + { + worker (current_item->work_items[i], + *scratch_data, + current_item->copy_datas[i]); + } + catch (const std::exception &exc) + { + Threads::internal::handle_std_exception (exc); + } + catch (...) + { + Threads::internal::handle_unknown_exception (); + } + } // finally mark the scratch object as unused again. as above, there // is no need to lock anything here since the object we work on @@ -552,8 +552,8 @@ namespace WorkStream scratch_data_list = current_item->scratch_data->get(); for (typename ItemType::ScratchDataList::iterator p = - scratch_data_list.begin(); p != scratch_data_list.end(); - ++p) + scratch_data_list.begin(); p != scratch_data_list.end(); + ++p) if (p->scratch_data.get() == scratch_data) { Assert(p->currently_in_use == true, ExcInternalError()); @@ -630,20 +630,20 @@ namespace WorkStream // above, catch exceptions rather than letting it propagate into // unknown territories for (unsigned int i=0; in_items; ++i) - { - try - { - copier (current_item->copy_datas[i]); - } - catch (const std::exception &exc) - { - Threads::internal::handle_std_exception (exc); - } - catch (...) - { - Threads::internal::handle_unknown_exception (); - } - } + { + try + { + copier (current_item->copy_datas[i]); + } + catch (const std::exception &exc) + { + Threads::internal::handle_std_exception (exc); + } + catch (...) + { + Threads::internal::handle_unknown_exception (); + } + } // return an invalid diff --git a/deal.II/include/deal.II/dofs/dof_accessor.h b/deal.II/include/deal.II/dofs/dof_accessor.h index b8f2a01676..d91ecaab76 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.h @@ -419,15 +419,15 @@ public: * level this line lives on. */ void get_mg_dof_indices (const int level, - std::vector &dof_indices, - const unsigned int fe_index = DH::default_fe_index) const; + std::vector &dof_indices, + const unsigned int fe_index = DH::default_fe_index) const; /** * Sets the level DoF indices that are returned by get_mg_dof_indices. */ void set_mg_dof_indices (const int level, - const std::vector &dof_indices, - const unsigned int fe_index = DH::default_fe_index); + const std::vector &dof_indices, + const unsigned int fe_index = DH::default_fe_index); /** * Global DoF index of the i @@ -475,9 +475,9 @@ public: * level @p level. Also see vertex_dof_index(). */ types::global_dof_index mg_vertex_dof_index (const int level, - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; + const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; /** * Index of the ith degree diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index cd7518cafd..fec073b8c5 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -1181,7 +1181,7 @@ namespace internal } else pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); } } @@ -1270,7 +1270,7 @@ namespace internal return *(pointer + 1 + local_index); else pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); } } @@ -1316,7 +1316,7 @@ namespace internal else { pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); ++counter; } } @@ -1375,7 +1375,7 @@ namespace internal ExcInternalError()); pointer += static_cast( - (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); + (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1); ++counter; } } @@ -1512,7 +1512,7 @@ template inline types::global_dof_index DoFAccessor::mg_dof_index (const int level, - const unsigned int i) const + const unsigned int i) const { return this->dof_handler->template get_dof_index (level, this->present_index, 0, i); } @@ -1607,9 +1607,9 @@ template inline types::global_dof_index DoFAccessor::mg_vertex_dof_index (const int level, - const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const + const unsigned int vertex, + const unsigned int i, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); @@ -1624,7 +1624,7 @@ inline void DoFAccessor::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, - const types::global_dof_index index, + const types::global_dof_index index, const unsigned int fe_index) const { dealii::internal::DoFAccessor::Implementation::set_vertex_dof_index @@ -1640,10 +1640,10 @@ template inline void DoFAccessor::set_mg_vertex_dof_index (const int level, - const unsigned int vertex, - const unsigned int i, - const types::global_dof_index index, - const unsigned int fe_index) const + const unsigned int vertex, + const unsigned int i, + const types::global_dof_index index, + const unsigned int fe_index) const { Assert (this->dof_handler != 0, ExcInvalidObject ()); Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ()); @@ -1657,8 +1657,8 @@ template inline void DoFAccessor::set_mg_dof_index (const int level, - const unsigned int i, - const types::global_dof_index index) const + const unsigned int i, + const types::global_dof_index index) const { this->dof_handler->template set_dof_index (level, this->present_index, 0, i, index); } @@ -2161,10 +2161,10 @@ DoFAccessor::line (const unsigned int i) const // checking of 'i' happens in line_index(i) return typename dealii::internal::DoFHandler::Iterators::line_iterator - (this->tria, - 0, // only sub-objects are allowed, which have no level - this->line_index(i), - this->dof_handler); + (this->tria, + 0, // only sub-objects are allowed, which have no level + this->line_index(i), + this->dof_handler); } @@ -2196,10 +2196,10 @@ DoFAccessor::quad (const unsigned int i) const // checking of 'i' happens in quad_index(i) return typename dealii::internal::DoFHandler::Iterators::quad_iterator - (this->tria, - 0, // only sub-objects are allowed, which have no level - this->quad_index(i), - this->dof_handler); + (this->tria, + 0, // only sub-objects are allowed, which have no level + this->quad_index(i), + this->dof_handler); } diff --git a/deal.II/include/deal.II/dofs/dof_handler.h b/deal.II/include/deal.II/dofs/dof_handler.h index f680454dea..ac781134dd 100644 --- a/deal.II/include/deal.II/dofs/dof_handler.h +++ b/deal.II/include/deal.II/dofs/dof_handler.h @@ -997,8 +997,8 @@ private: * given (inclusive) range of levels. */ void init (const unsigned int coarsest_level, - const unsigned int finest_level, - const unsigned int dofs_per_vertex); + const unsigned int finest_level, + const unsigned int dofs_per_vertex); /** * Return the coarsest level for which this structure @@ -1018,7 +1018,7 @@ private: */ types::global_dof_index get_index (const unsigned int level, - const unsigned int dof_number) const; + const unsigned int dof_number) const; /** * Set the index of the dof_numberth degree of @@ -1026,8 +1026,8 @@ private: * to index. */ void set_index (const unsigned int level, - const unsigned int dof_number, - const types::global_dof_index index); + const unsigned int dof_number, + const types::global_dof_index index); /** * Exception. diff --git a/deal.II/include/deal.II/fe/fe_values.h b/deal.II/include/deal.II/fe/fe_values.h index 3688b45711..1b0164b656 100644 --- a/deal.II/include/deal.II/fe/fe_values.h +++ b/deal.II/include/deal.II/fe/fe_values.h @@ -1253,14 +1253,14 @@ namespace FEValuesViews */ typedef dealii::Tensor<1, spacedim> divergence_type; - /** - * A structure where for each shape - * function we pre-compute a bunch of - * data that will make later accesses - * much cheaper. - */ - struct ShapeFunctionData - { + /** + * A structure where for each shape + * function we pre-compute a bunch of + * data that will make later accesses + * much cheaper. + */ + struct ShapeFunctionData + { /** * For each pair (shape * function,component within @@ -1276,7 +1276,7 @@ namespace FEValuesViews * (e.g. for RT elements it depends * on the shape of a cell). */ - bool is_nonzero_shape_function_component[value_type::n_independent_components]; + bool is_nonzero_shape_function_component[value_type::n_independent_components]; /** * For each pair (shape function, @@ -1294,7 +1294,7 @@ namespace FEValuesViews * harder to compute this * information. */ - unsigned int row_index[value_type::n_independent_components]; + unsigned int row_index[value_type::n_independent_components]; /** * For each shape function say the @@ -1313,15 +1313,15 @@ namespace FEValuesViews * no components are nonzero then * store -2. */ - int single_nonzero_component; - unsigned int single_nonzero_component_index; - }; + int single_nonzero_component; + unsigned int single_nonzero_component_index; + }; /** * Default constructor. Creates an * invalid object. */ - Tensor(); + Tensor(); /** @@ -1338,8 +1338,8 @@ namespace FEValuesViews * index of the first component of the * selected symmetric second order tensor. */ - Tensor(const FEValuesBase &fe_values_base, - const unsigned int first_tensor_component); + Tensor(const FEValuesBase &fe_values_base, + const unsigned int first_tensor_component); /** @@ -1348,7 +1348,7 @@ namespace FEValuesViews * copying and generate an exception if * this function is called. */ - Tensor &operator=(const Tensor<2, dim, spacedim> &); + Tensor &operator=(const Tensor<2, dim, spacedim> &); /** * Return the value of the vector @@ -1374,9 +1374,9 @@ namespace FEValuesViews * the quadrature point at which * function is to be evaluated */ - value_type - value (const unsigned int shape_function, - const unsigned int q_point) const; + value_type + value (const unsigned int shape_function, + const unsigned int q_point) const; /** * Return the vector divergence of @@ -1394,9 +1394,9 @@ namespace FEValuesViews * is as documented for the value() * function. */ - divergence_type - divergence (const unsigned int shape_function, - const unsigned int q_point) const; + divergence_type + divergence (const unsigned int shape_function, + const unsigned int q_point) const; /** * Return the values of the selected @@ -1414,9 +1414,9 @@ namespace FEValuesViews * function but it only works on the * selected vector components. */ - template - void get_function_values (const InputVector &fe_function, - std::vector &values) const; + template + void get_function_values (const InputVector &fe_function, + std::vector &values) const; /** @@ -1442,30 +1442,30 @@ namespace FEValuesViews * definition of the * divergence. */ - template - void get_function_divergences (const InputVector &fe_function, - std::vector &divergences) const; + template + void get_function_divergences (const InputVector &fe_function, + std::vector &divergences) const; - private: - /** - * A reference to the FEValuesBase object - * we operate on. - */ - const FEValuesBase &fe_values; + private: + /** + * A reference to the FEValuesBase object + * we operate on. + */ + const FEValuesBase &fe_values; - /** - * The first component of the vector - * this view represents of the - * FEValuesBase object. - */ - const unsigned int first_tensor_component; + /** + * The first component of the vector + * this view represents of the + * FEValuesBase object. + */ + const unsigned int first_tensor_component; - /** - * Store the data about shape - * functions. - */ - std::vector shape_function_data; - }; + /** + * Store the data about shape + * functions. + */ + std::vector shape_function_data; + }; } @@ -4663,11 +4663,12 @@ namespace FEValuesViews { value_type return_value; for (unsigned int d = 0; d < dim*dim; ++d) - if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) { - const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(d); - return_value[indices] - = fe_values.shape_values(shape_function_data[shape_function].row_index[d],q_point); - } + if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) + { + const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(d); + return_value[indices] + = fe_values.shape_values(shape_function_data[shape_function].row_index[d],q_point); + } return return_value; } } @@ -4703,7 +4704,7 @@ namespace FEValuesViews // is a first order tensor. // // assume the second-order tensor is - // A with components A_{ij}. + // A with components A_{ij}. // divergence as: // b_j := \dfrac{\partial phi_{ij}}{\partial x_i}. // diff --git a/deal.II/include/deal.II/grid/cell_id.h b/deal.II/include/deal.II/grid/cell_id.h index 5edbdc5cf9..588a7f04af 100644 --- a/deal.II/include/deal.II/grid/cell_id.h +++ b/deal.II/include/deal.II/grid/cell_id.h @@ -44,29 +44,29 @@ public: * construct CellId with a given coarse_cell_index and list of child indices */ explicit CellId(unsigned int coarse_cell_id_, std::vector id_) - : coarse_cell_id(coarse_cell_id_), id(id_) + : coarse_cell_id(coarse_cell_id_), id(id_) {} /** * construct an empty CellId. */ CellId() - : coarse_cell_id(-1) + : coarse_cell_id(-1) {} /** * compare two CellIds */ - bool operator== (const CellId & other) const; + bool operator== (const CellId &other) const; /** * compare two CellIds */ - bool operator!= (const CellId & other) const; + bool operator!= (const CellId &other) const; - friend std::istream& operator>> (std::istream& is, CellId& cid); - friend std::ostream& operator<< (std::ostream& os, const CellId& cid); + friend std::istream &operator>> (std::istream &is, CellId &cid); + friend std::ostream &operator<< (std::ostream &os, const CellId &cid); private: unsigned int coarse_cell_id; std::vector id; @@ -75,10 +75,10 @@ private: /** * output CellId into a stream */ -inline std::ostream& operator<< (std::ostream& os, const CellId& cid) +inline std::ostream &operator<< (std::ostream &os, const CellId &cid) { os << cid.coarse_cell_id << '_' << cid.id.size() << ':'; - for (unsigned int i=0;i(cid.id[i]); return os; } @@ -86,7 +86,7 @@ inline std::ostream& operator<< (std::ostream& os, const CellId& cid) /** * read CellId from a stream */ -inline std::istream& operator>> (std::istream& is, CellId& cid) +inline std::istream &operator>> (std::istream &is, CellId &cid) { unsigned int cellid; is >> cellid; @@ -104,7 +104,7 @@ inline std::istream& operator>> (std::istream& is, CellId& cid) char value; cid.id.clear(); - for (unsigned int i=0;i> value; cid.id.push_back(value-'0'); @@ -113,7 +113,7 @@ inline std::istream& operator>> (std::istream& is, CellId& cid) } inline bool -CellId::operator== (const CellId & other) const +CellId::operator== (const CellId &other) const { if (this->coarse_cell_id != other.coarse_cell_id) return false; @@ -124,7 +124,7 @@ CellId::operator== (const CellId & other) const * */ inline bool -CellId::operator!= (const CellId & other) const +CellId::operator!= (const CellId &other) const { return !(*this == other); } diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index bc41d02836..3967669860 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -692,7 +692,7 @@ public: */ static void - extrude_triangulation(const Triangulation<2, 2> & input, + extrude_triangulation(const Triangulation<2, 2> &input, const size_type n_slices, const double height, Triangulation<3,3> &result); diff --git a/deal.II/include/deal.II/grid/grid_out.h b/deal.II/include/deal.II/grid/grid_out.h index 8e8648ae7c..22359a950a 100644 --- a/deal.II/include/deal.II/grid/grid_out.h +++ b/deal.II/include/deal.II/grid/grid_out.h @@ -628,13 +628,15 @@ namespace GridOutFlags /** * Background style. */ - enum Background{ - /// Use transparent value of SVG - transparent, - /// Use white background - white, - /// Use a gradient from white (top) to steelblue (bottom), and add date and time plus a deal.II logo. Automatically draws a margin. - dealii}; + enum Background + { + /// Use transparent value of SVG + transparent, + /// Use white background + white, + /// Use a gradient from white (top) to steelblue (bottom), and add date and time plus a deal.II logo. Automatically draws a margin. + dealii + }; Background background; @@ -651,18 +653,20 @@ namespace GridOutFlags /** * Cell coloring. */ - enum Coloring{ - /// No cell coloring - none, - /// Convert the material id into the cell color (default) - material_id, - /// Convert the level number into the cell color - level_number, - /// Convert the subdomain id into the cell color - subdomain_id, - /// Convert the level subdomain id into the cell color - level_subdomain_id}; - + enum Coloring + { + /// No cell coloring + none, + /// Convert the material id into the cell color (default) + material_id, + /// Convert the level number into the cell color + level_number, + /// Convert the subdomain id into the cell color + subdomain_id, + /// Convert the level subdomain id into the cell color + level_subdomain_id + }; + Coloring coloring; /// Interpret the level number of the cells as altitude over the x-y-plane (useful in the perpspective view). @@ -670,7 +674,7 @@ namespace GridOutFlags /** * Cell labeling (fixed order). - * + * * The following booleans determine which properties of the cell * shall be displayed as text in the middle of each cell. */ @@ -1051,15 +1055,15 @@ public: /** * Write the triangulation in the SVG format. - * - * SVG (Scalable Vector Graphics) is - * an XML-based vector image format - * developed and maintained by the - * World Wide Web Consortium (W3C). - * This function conforms to the - * latest specification SVG 1.1, + * + * SVG (Scalable Vector Graphics) is + * an XML-based vector image format + * developed and maintained by the + * World Wide Web Consortium (W3C). + * This function conforms to the + * latest specification SVG 1.1, * released on August 16, 2011. - * + * * The cells of the triangulation are written as polygons with * additional lines at the boundary of the triangulation. A coloring * of the cells is further possible in order to visualize a certain @@ -1067,10 +1071,10 @@ public: * colorbar can be drawn to encode the chosen coloring. Moreover, a * cell label can be added, showing level index, etc. * - * @note Yet only implemented for + * @note Yet only implemented for * two-dimensional grids in two * space dimensions. - * + * */ template void write_svg (const Triangulation &tria, @@ -1096,7 +1100,7 @@ public: */ template void write_mathgl (const Triangulation &tria, - std::ostream &out) const; + std::ostream &out) const; /** * Write grid to @p out according to the given data format. This @@ -1508,19 +1512,19 @@ private: /** - * This function projects a three-dimensional point (Point<3> point) - * onto a two-dimensional image plane, specified by the position of - * the camera viewing system (Point<3> camera_position), camera - * direction (Point<3> camera_position), camera horizontal (Point<3> - * camera_horizontal, necessary for the correct alignment of the + * This function projects a three-dimensional point (Point<3> point) + * onto a two-dimensional image plane, specified by the position of + * the camera viewing system (Point<3> camera_position), camera + * direction (Point<3> camera_position), camera horizontal (Point<3> + * camera_horizontal, necessary for the correct alignment of the * later images), and the focus of the camera (float camera_focus). * * For SVG output of grids. */ - static Point<2> svg_project_point(Point<3> point, - Point<3> camera_position, - Point<3> camera_direction, - Point<3> camera_horizontal, + static Point<2> svg_project_point(Point<3> point, + Point<3> camera_position, + Point<3> camera_direction, + Point<3> camera_horizontal, float camera_focus); /** diff --git a/deal.II/include/deal.II/grid/tria_accessor.h b/deal.II/include/deal.II/grid/tria_accessor.h index 4717812ee1..e0524d2291 100644 --- a/deal.II/include/deal.II/grid/tria_accessor.h +++ b/deal.II/include/deal.II/grid/tria_accessor.h @@ -324,7 +324,7 @@ protected: TriaAccessorBase (const Triangulation *parent = 0, const int level = -1, const int index = -1, - const AccessorData * = 0); + const AccessorData * = 0); /** * Copy constructor. Creates an @@ -350,14 +350,14 @@ protected: * object with exactly the same data. */ TriaAccessorBase &operator = (const TriaAccessorBase &); - + /** * Ordering of accessors. If #structure_dimension is less than * #dimension, we simply compare the index of such an object. If * #structure_dimension equals #dimension, we compare the level() * first, and the index() only if levels are equal. */ - bool operator < (const TriaAccessorBase& other) const; + bool operator < (const TriaAccessorBase &other) const; protected: /** @@ -2861,7 +2861,7 @@ public: * for more information. */ bool active () const; - + /** * Ordering of accessors. This function implements a total ordering * of cells even on a parallel::distributed::Triangulation. This @@ -2869,7 +2869,7 @@ public: * and both cells are active, it compares subdomain_id(). If this is * inconclusive, TriaAccessorBase::operator < () is called. */ - bool operator < (const CellAccessor& other) const; + bool operator < (const CellAccessor &other) const; /** @@ -3222,7 +3222,7 @@ CellAccessor::id() const { // find the 'v'st child of our parent we are unsigned char v=-1; - for (unsigned int c=0;cn_children();++c) + for (unsigned int c=0; cn_children(); ++c) { if (ptr.parent()->child_index(c)==ptr.index()) { diff --git a/deal.II/include/deal.II/grid/tria_accessor.templates.h b/deal.II/include/deal.II/grid/tria_accessor.templates.h index 1b9e5e5dd1..bdf5d52cab 100644 --- a/deal.II/include/deal.II/grid/tria_accessor.templates.h +++ b/deal.II/include/deal.II/grid/tria_accessor.templates.h @@ -147,10 +147,10 @@ bool TriaAccessorBase::operator < (const TriaAccessorBase &other) const { Assert (tria == other.tria, TriaAccessorExceptions::ExcCantCompareIterators()); - + if (present_level != other.present_level) return (present_level < other.present_level); - + return (present_index < other.present_index); } @@ -3010,14 +3010,14 @@ bool CellAccessor::operator < (const CellAccessor &other) const { Assert (this->tria == other.tria, TriaAccessorExceptions::ExcCantCompareIterators()); - + if (level_subdomain_id() != other.level_subdomain_id()) return (level_subdomain_id() < other.level_subdomain_id()); - + if (active() && other.active() && (subdomain_id() != other.subdomain_id())) return (subdomain_id() < other.subdomain_id()); - + return TriaAccessorBase::operator < (other); } diff --git a/deal.II/include/deal.II/grid/tria_iterator.h b/deal.II/include/deal.II/grid/tria_iterator.h index 09c4eacf63..07321efd84 100644 --- a/deal.II/include/deal.II/grid/tria_iterator.h +++ b/deal.II/include/deal.II/grid/tria_iterator.h @@ -1189,13 +1189,13 @@ TriaRawIterator::operator < (const TriaRawIterator &other) c Assert (&accessor.get_triangulation() == &other.accessor.get_triangulation(), ExcInvalidComparison()); - + // Deal with iterators past end if (state()==IteratorState::past_the_end) return false; if (other.state()==IteratorState::past_the_end) return true; - + return ((**this) < (*other)); } @@ -1293,8 +1293,8 @@ TriaIterator::TriaIterator (const TriaRawIterator &i) template template TriaIterator::TriaIterator (const OtherAccessor &a) -: -TriaRawIterator (a) + : + TriaRawIterator (a) { #ifdef DEBUG // do this like this, because: diff --git a/deal.II/include/deal.II/hp/dof_handler.h b/deal.II/include/deal.II/hp/dof_handler.h index afb742aa18..4d0177fc41 100644 --- a/deal.II/include/deal.II/hp/dof_handler.h +++ b/deal.II/include/deal.II/hp/dof_handler.h @@ -383,7 +383,7 @@ namespace hp * DoFs which are constrained by * hanging nodes, see @ref constraints. */ - types::global_dof_index n_dofs () const; + types::global_dof_index n_dofs () const; /** * The number of multilevel diff --git a/deal.II/include/deal.II/hp/dof_objects.h b/deal.II/include/deal.II/hp/dof_objects.h index e6f3b622d5..54aee6dc70 100644 --- a/deal.II/include/deal.II/hp/dof_objects.h +++ b/deal.II/include/deal.II/hp/dof_objects.h @@ -319,8 +319,8 @@ namespace internal return *(pointer + 1 + local_index); else pointer += static_cast( - dof_handler.get_fe()[*pointer] - .template n_dofs_per_object() + 1); + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object() + 1); } } } @@ -623,8 +623,8 @@ namespace internal return true; else pointer += static_cast( - dof_handler.get_fe()[*pointer] - .template n_dofs_per_object()+1); + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object()+1); } } } diff --git a/deal.II/include/deal.II/integrators/elasticity.h b/deal.II/include/deal.II/integrators/elasticity.h index 37cfae251e..d772cf695c 100644 --- a/deal.II/include/deal.II/integrators/elasticity.h +++ b/deal.II/include/deal.II/integrators/elasticity.h @@ -100,12 +100,12 @@ namespace LocalIntegrators const double dx = factor * fe.JxW(k); for (unsigned int i=0; i &n = fe1.normal_vector(k); - + for (unsigned int i=0; i (eigenvalues_real[i], - eigenvalues_im[i]); + eigenvalues[i] = std::complex (eigenvalues_real[i], + eigenvalues_im[i]); } } diff --git a/deal.II/include/deal.II/lac/block_indices.h b/deal.II/include/deal.II/lac/block_indices.h index f336ed7d7e..7b37682ea0 100644 --- a/deal.II/include/deal.II/lac/block_indices.h +++ b/deal.II/include/deal.II/lac/block_indices.h @@ -419,7 +419,7 @@ BlockIndices::global_to_local (const size_type i) const --block; return std::pair(block, - i-start_indices[block]); + i-start_indices[block]); } diff --git a/deal.II/include/deal.II/lac/block_list.h b/deal.II/include/deal.II/lac/block_list.h index 8a86c0cd6c..97bfc00e20 100644 --- a/deal.II/include/deal.II/lac/block_list.h +++ b/deal.II/include/deal.II/lac/block_list.h @@ -612,7 +612,7 @@ BlockList::initialize_vertex_patches_mg( inline -BlockList::size_type +BlockList::size_type BlockList::size() const { return index_sets.size(); @@ -620,7 +620,7 @@ BlockList::size() const inline -BlockList::size_type +BlockList::size_type BlockList::block_size(size_type block) const { return index_sets[block].size(); @@ -646,7 +646,7 @@ BlockList::end(size_type block) const inline -BlockList::size_type +BlockList::size_type BlockList::local_index(size_type block, size_type index) const { AssertIndexRange(block, index_sets.size()); diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h index 3939c24f01..a056125fb4 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h @@ -540,9 +540,9 @@ Tvmult_add (BlockVector &dst, ExcDimensionMismatch(src.n_blocks(), n_block_rows())); for (unsigned int row=0; row & value_type; + const Accessor &value_type; /** * Constructor. Create an iterator into the matrix @p matrix for the given @@ -1351,7 +1351,7 @@ ChunkSparseMatrix::m () const template inline -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n () const { Assert (cols != 0, ExcNotInitialized()); @@ -1373,13 +1373,13 @@ ChunkSparseMatrix::get_sparsity_pattern () const template inline -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::compute_location (const size_type i, const size_type j) const { const size_type chunk_size = cols->get_chunk_size(); const size_type chunk_index - = cols->sparsity_pattern(i/chunk_size, j/chunk_size); + = cols->sparsity_pattern(i/chunk_size, j/chunk_size); if (chunk_index == ChunkSparsityPattern::invalid_entry) return ChunkSparsityPattern::invalid_entry; diff --git a/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h b/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h index 753ed8141b..f9d396419d 100644 --- a/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h @@ -211,9 +211,9 @@ namespace internal const size_type n_filled_last_cols = n % chunk_size; const size_type last_regular_row = n_filled_last_rows > 0 ? - std::min(m/chunk_size, - static_cast(end_row)) : - end_row; + std::min(m/chunk_size, + static_cast(end_row)) : + end_row; const size_type irregular_col = n/chunk_size; typename OutVector::iterator dst_ptr = dst.begin()+chunk_size*begin_row; @@ -455,7 +455,7 @@ ChunkSparseMatrix::reinit (const ChunkSparsityPattern &sparsity) // chunks. this entails some padding elements const size_type chunk_size = cols->get_chunk_size(); const size_type N = cols->sparsity_pattern.n_nonzero_elements() * - chunk_size * chunk_size; + chunk_size * chunk_size; if (N > max_len || max_len == 0) { if (val != 0) @@ -497,7 +497,7 @@ ChunkSparseMatrix::empty () const template -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -507,7 +507,7 @@ ChunkSparseMatrix::n_nonzero_elements () const template -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_actually_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -592,7 +592,7 @@ ChunkSparseMatrix::add (const number factor, * chunk_size * chunk_size]; while (val_ptr != end_ptr) - *val_ptr++ += factor * *matrix_ptr++; + *val_ptr++ += factor **matrix_ptr++; } diff --git a/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h b/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h index f7aa14f555..08f148a21d 100644 --- a/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h @@ -544,10 +544,10 @@ public: const ForwardIterator end, const size_type chunk_size); - /** - * @deprecated This function is deprecated. Use the function - * without the last argument - */ + /** + * @deprecated This function is deprecated. Use the function + * without the last argument + */ template void copy_from (const size_type n_rows, const size_type n_cols, @@ -923,7 +923,7 @@ namespace ChunkSparsityPatternIterators const unsigned int row) : sparsity_pattern(sparsity_pattern), - reduced_accessor(row==sparsity_pattern->n_rows() ? + reduced_accessor(row==sparsity_pattern->n_rows() ? *sparsity_pattern->sparsity_pattern.end() : *sparsity_pattern->sparsity_pattern. begin(row/sparsity_pattern->get_chunk_size())), @@ -951,12 +951,12 @@ namespace ChunkSparsityPatternIterators Accessor::is_valid_entry () const { return reduced_accessor.is_valid_entry() - && - sparsity_pattern->get_chunk_size()*reduced_accessor.row()+chunk_row < - sparsity_pattern->n_rows() - && - sparsity_pattern->get_chunk_size()*reduced_accessor.column()+chunk_col < - sparsity_pattern->n_cols(); + && + sparsity_pattern->get_chunk_size()*reduced_accessor.row()+chunk_row < + sparsity_pattern->n_rows() + && + sparsity_pattern->get_chunk_size()*reduced_accessor.column()+chunk_col < + sparsity_pattern->n_cols(); } @@ -968,7 +968,7 @@ namespace ChunkSparsityPatternIterators Assert (is_valid_entry() == true, ExcInvalidIterator()); return sparsity_pattern->get_chunk_size()*reduced_accessor.row() + - chunk_row; + chunk_row; } @@ -980,7 +980,7 @@ namespace ChunkSparsityPatternIterators Assert (is_valid_entry() == true, ExcInvalidIterator()); return sparsity_pattern->get_chunk_size()*reduced_accessor.column() + - chunk_col; + chunk_col; } @@ -1028,10 +1028,10 @@ namespace ChunkSparsityPatternIterators return true; const unsigned int - global_row = sparsity_pattern->get_chunk_size()*reduced_accessor.row() - +chunk_row, - other_global_row = sparsity_pattern->get_chunk_size()* - other.reduced_accessor.row()+other.chunk_row; + global_row = sparsity_pattern->get_chunk_size()*reduced_accessor.row() + +chunk_row, + other_global_row = sparsity_pattern->get_chunk_size()* + other.reduced_accessor.row()+other.chunk_row; if (global_row < other_global_row) return true; else if (global_row > other_global_row) @@ -1214,7 +1214,7 @@ ChunkSparsityPattern::iterator ChunkSparsityPattern::end (const unsigned int r) const { Assert (rbegin(); j!=end_of_row; ++j) { const size_type col - = internal::SparsityPatternTools::get_column_index_from_iterator(*j); + = internal::SparsityPatternTools::get_column_index_from_iterator(*j); Assert (col < n_cols, ExcInvalidIndex(col,n_cols)); add (row, col); diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index 56bf859baa..8237b943d9 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -1523,7 +1523,7 @@ public: * @ingroup Exceptions */ DeclException2 (ExcIncorrectConstraint, - int, int, + int, int, << "While distributing the constraint for DoF " << arg1 << ", it turns out that one of the processors " << "who own the " << arg2 @@ -1534,7 +1534,7 @@ public: << "with the appropriate locally_relevant set so " << "that every processor who owns a DoF that constrains " << "another DoF also knows about this constraint?"); - + private: /** diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index 1772bedcb3..4a1ce1888c 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -391,7 +391,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, // which line in the constraint matrix // handles this index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c &uncondensed, // in the constraint matrix handles this // index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c::const_iterator it = cm.begin(); it != cm.end(); ++it) - vec(*it) = 0.; + vec(*it) = 0.; } template @@ -1139,7 +1139,7 @@ ConstraintMatrix::distribute (VectorType &vec) const typedef std::vector::const_iterator constraint_iterator; for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) + it != lines.end(); ++it) if (vec_owned_elements.is_element(it->line)) for (unsigned int i=0; ientries.size(); ++i) if (!vec_owned_elements.is_element(it->entries[i].first)) @@ -1152,11 +1152,11 @@ ConstraintMatrix::distribute (VectorType &vec) const internal::bool2type::value>()); for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) + it != lines.end(); ++it) if (vec_owned_elements.is_element(it->line)) { typename VectorType::value_type - new_value = it->inhomogeneity; + new_value = it->inhomogeneity; for (unsigned int i=0; ientries.size(); ++i) new_value += (static_cast (ghosted_vector(it->entries[i].first)) * @@ -1188,7 +1188,7 @@ ConstraintMatrix::distribute (VectorType &vec) const for (unsigned int i=0; ientries.size(); ++i) new_value += (static_cast (vec(next_constraint->entries[i].first)) * - next_constraint->entries[i].second); + next_constraint->entries[i].second); Assert(numbers::is_finite(new_value), ExcNumberNotFinite()); vec(next_constraint->line) = new_value; } @@ -1363,7 +1363,7 @@ namespace internals individual_size[index]++; } - size_type + size_type get_size (const size_type index) const { return individual_size[index]; @@ -1973,7 +1973,7 @@ namespace internals const size_type loc_row = global_rows.local_row(i); typename SparseMatrix::iterator - matrix_values = sparse_matrix->begin(row); + matrix_values = sparse_matrix->begin(row); const bool optimize_diagonal = sparsity.n_rows() == sparsity.n_cols(); // distinguish three cases about what can @@ -2434,7 +2434,7 @@ make_sorted_row_list (const std::vector &local_dof_indices, Utilities::lower_bound(active_dofs.begin(), active_dofs.end()-i+1, new_index); - if (*it != new_index) + if (*it != new_index) active_dofs.insert(it, new_index); } } @@ -2724,7 +2724,7 @@ distribute_local_to_global (const FullMatrix &local_matrix, for (size_type block_col=0; block_col &local_dof_indices, for (size_type block_col=0; block_col::iterator col_ptr = cols.begin(); internals::resolve_matrix_row (global_rows, i, begin_block, end_block, dof_mask, col_ptr); diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index c7087970db..ad8a7fc09a 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -1543,7 +1543,7 @@ FullMatrix::copy_from (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) this->el(row, entry->column()) = entry->value(); } } @@ -1564,7 +1564,7 @@ FullMatrix::copy_transposed (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) this->el(entry->column(), row) = entry->value(); } } @@ -1869,11 +1869,11 @@ FullMatrix::print (STREAM &s, for (size_type i=0; im(); ++i) { for (size_type j=0; jn(); ++j) - { - s.width(w); - s.precision(p); - s << this->el(i,j); - } + { + s.width(w); + s.precision(p); + s << this->el(i,j); + } s << std::endl; } diff --git a/deal.II/include/deal.II/lac/full_matrix.templates.h b/deal.II/include/deal.II/lac/full_matrix.templates.h index 0a6b0454c0..44c3bb8933 100644 --- a/deal.II/include/deal.II/lac/full_matrix.templates.h +++ b/deal.II/include/deal.II/lac/full_matrix.templates.h @@ -343,9 +343,9 @@ void FullMatrix::fill (const FullMatrix &src, // Compute maximal size of copied block const size_type rows = std::min (m() - dst_offset_i, - src.m() - src_offset_i); + src.m() - src_offset_i); const size_type cols = std::min (n() - dst_offset_j, - src.n() - src_offset_j); + src.n() - src_offset_j); for (size_type i=0; i::Tadd (const FullMatrix &src, // Compute maximal size of copied block const size_type rows = std::min (m() - dst_offset_i, src.n() - src_offset_j); const size_type cols = std::min (n() - dst_offset_j, - src.m() - src_offset_i); + src.m() - src_offset_i); for (size_type i=0; i::precondition_Jacobi (Vector &dst, const somenumber *src_ptr = src.begin(); for (size_type i=0; i::copy_from (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) this->el(row, entry->column()) = entry->value(); } @@ -750,7 +750,7 @@ LAPACKFullMatrix::fill ( { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) { const size_type i = transpose ? entry->column() : row; const size_type j = transpose ? row : entry->column(); diff --git a/deal.II/include/deal.II/lac/matrix_out.h b/deal.II/include/deal.II/lac/matrix_out.h index 1e657d40b2..55c8452217 100644 --- a/deal.II/include/deal.II/lac/matrix_out.h +++ b/deal.II/include/deal.II/lac/matrix_out.h @@ -391,7 +391,7 @@ MatrixOut::build_patches (const Matrix &matrix, const std::string &name, const Options options) { - size_type + size_type gridpoints_x = (matrix.n() / options.block_size + (matrix.n() % options.block_size != 0 ? 1 : 0)), diff --git a/deal.II/include/deal.II/lac/parallel_block_vector.h b/deal.II/include/deal.II/lac/parallel_block_vector.h index ce4c615870..d0f5387851 100644 --- a/deal.II/include/deal.II/lac/parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/parallel_block_vector.h @@ -622,7 +622,7 @@ namespace parallel if (this->block(0).partitioner->n_mpi_processes() > 1) return Utilities::MPI::sum (local_result, this->block(0).partitioner->get_communicator())/ - (real_type)this->size(); + (real_type)this->size(); else return local_result/(real_type)this->size(); } diff --git a/deal.II/include/deal.II/lac/parallel_vector.h b/deal.II/include/deal.II/lac/parallel_vector.h index 48fefa6759..613fb61ab4 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.h +++ b/deal.II/include/deal.II/lac/parallel_vector.h @@ -488,7 +488,7 @@ namespace parallel * not owned by the current processor but can be written into or read * from locally (ghost elements). */ - const IndexSet& ghost_elements() const; + const IndexSet &ghost_elements() const; /** * Returns whether the given global index is a ghost index on the @@ -774,7 +774,7 @@ namespace parallel * vector. */ const MPI_Comm &get_mpi_communicator () const; - + /** * Checks whether the given partitioner is compatible with the * partitioner used for this vector. Two partitioners are compatible if @@ -1042,7 +1042,7 @@ namespace parallel else if (partitioner.get() != c.partitioner.get()) { size_type local_ranges_different_loc = (local_range() != - c.local_range()); + c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, partitioner->get_communicator()) != 0) @@ -1074,7 +1074,7 @@ namespace parallel else if (partitioner.get() != c.partitioner.get()) { size_type local_ranges_different_loc = (local_range() != - c.local_range()); + c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, partitioner->get_communicator()) != 0) @@ -1209,8 +1209,8 @@ namespace parallel Vector::vectors_equal_local (const Vector &v) const { return partitioner->local_size()>0 ? - vector_view.template operator == (v.vector_view) - : true; + vector_view.template operator == (v.vector_view) + : true; } @@ -1325,7 +1325,7 @@ namespace parallel return Utilities::MPI::sum (local_result * (real_type)partitioner->local_size(), partitioner->get_communicator()) - /(real_type)partitioner->size(); + /(real_type)partitioner->size(); else return local_result; } @@ -1441,8 +1441,8 @@ namespace parallel template inline std::pair::size_type, - typename Vector::size_type> - Vector::local_range () const + typename Vector::size_type> + Vector::local_range () const { return partitioner->local_range(); } @@ -1477,7 +1477,7 @@ namespace parallel template inline - typename Vector::size_type + typename Vector::size_type Vector::n_ghost_entries () const { return partitioner->n_ghost_indices(); @@ -1487,7 +1487,7 @@ namespace parallel template inline - const IndexSet& + const IndexSet & Vector::ghost_elements() const { return partitioner->ghost_indices(); @@ -2008,7 +2008,7 @@ namespace parallel template inline - const MPI_Comm& + const MPI_Comm & Vector::get_mpi_communicator() const { return partitioner->get_communicator(); diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index d5372403b1..6ef2b51596 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -69,11 +69,11 @@ namespace PETScWrappers class Accessor { public: - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; - + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Since we use * accessors only for read @@ -193,7 +193,7 @@ namespace PETScWrappers * Declare type for container size. */ typedef types::global_dof_index size_type; - + /** * Constructor. Create an iterator * into the matrix @p matrix for the @@ -306,11 +306,11 @@ namespace PETScWrappers * class. */ typedef MatrixIterators::const_iterator const_iterator; - - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; + + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * Declare a typedef in analogy to all @@ -954,8 +954,8 @@ namespace PETScWrappers * Add the matrix @p other scaled by the factor @p factor to the current * matrix. */ - MatrixBase & add (const MatrixBase &other, - const PetscScalar factor); + MatrixBase &add (const MatrixBase &other, + const PetscScalar factor); /** * Matrix-vector multiplication: @@ -1312,7 +1312,7 @@ namespace PETScWrappers /** * purposefully not implemented */ - MatrixBase& operator=(const MatrixBase &); + MatrixBase &operator=(const MatrixBase &); /** * An internal array of integer @@ -1365,7 +1365,7 @@ namespace PETScWrappers inline - const_iterator::Accessor::size_type + const_iterator::Accessor::size_type const_iterator::Accessor::row() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1374,7 +1374,7 @@ namespace PETScWrappers inline - const_iterator::Accessor::size_type + const_iterator::Accessor::size_type const_iterator::Accessor::column() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1383,7 +1383,7 @@ namespace PETScWrappers inline - const_iterator::Accessor::size_type + const_iterator::Accessor::size_type const_iterator::Accessor::index() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); diff --git a/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h index d529531349..f52a9a5f30 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h @@ -189,17 +189,17 @@ namespace PETScWrappers * hand in the same vector for the first two arguments. */ void reinit(const std::vector &rows, - const std::vector &cols, - const BlockCompressedSimpleSparsityPattern &bcsp, - const MPI_Comm &com); + const std::vector &cols, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com); /** * Same as above but for a symmetric structure only. */ void reinit(const std::vector &sizes, - const BlockCompressedSimpleSparsityPattern &bcsp, - const MPI_Comm &com); + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com); diff --git a/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h index 27f6896a32..7d52ee3792 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h @@ -142,8 +142,8 @@ namespace PETScWrappers * Same as above, but include ghost elements */ BlockVector (const std::vector ¶llel_partitioning, - const std::vector &ghost_indices, - const MPI_Comm &communicator); + const std::vector &ghost_indices, + const MPI_Comm &communicator); @@ -299,7 +299,7 @@ namespace PETScWrappers void reinit (const std::vector ¶llel_partitioning, const std::vector &ghost_entries, const MPI_Comm &communicator); - + /** * Change the number of blocks to * num_blocks. The individual @@ -415,15 +415,15 @@ namespace PETScWrappers inline BlockVector::BlockVector (const std::vector ¶llel_partitioning, - const MPI_Comm &communicator) + const MPI_Comm &communicator) { reinit(parallel_partitioning, communicator); } inline BlockVector::BlockVector (const std::vector ¶llel_partitioning, - const std::vector &ghost_indices, - const MPI_Comm &communicator) + const std::vector &ghost_indices, + const MPI_Comm &communicator) { reinit(parallel_partitioning, ghost_indices, communicator); } @@ -502,7 +502,7 @@ namespace PETScWrappers inline void BlockVector::reinit (const std::vector ¶llel_partitioning, - const MPI_Comm &communicator) + const MPI_Comm &communicator) { std::vector sizes(parallel_partitioning.size()); for (unsigned int i=0; i ¶llel_partitioning, - const std::vector &ghost_entries, - const MPI_Comm &communicator) + void + BlockVector::reinit (const std::vector ¶llel_partitioning, + const std::vector &ghost_entries, + const MPI_Comm &communicator) { std::vector sizes(parallel_partitioning.size()); for (unsigned int i=0; i - void reinit (const IndexSet & local_rows, - const IndexSet & local_columns, + void reinit (const IndexSet &local_rows, + const IndexSet &local_columns, const SparsityType &sparsity_pattern, const MPI_Comm &communicator); @@ -504,9 +504,9 @@ namespace PETScWrappers * Same as previous functions. */ template - void do_reinit (const IndexSet & local_rows, - const IndexSet & local_columns, - const SparsityType &sparsity_pattern); + void do_reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern); /** * To allow calling protected diff --git a/deal.II/include/deal.II/lac/petsc_parallel_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_vector.h index 0467450e4e..95cdddc214 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_vector.h @@ -176,10 +176,10 @@ namespace PETScWrappers */ static const bool supports_distributed_data = true; - /** - * Default constructor. Initialize the - * vector as empty. - */ + /** + * Default constructor. Initialize the + * vector as empty. + */ Vector (); /** @@ -298,8 +298,8 @@ namespace PETScWrappers * vector. */ Vector (const IndexSet &local, - const IndexSet &ghost, - const MPI_Comm &communicator); + const IndexSet &ghost, + const MPI_Comm &communicator); /** * Constructs a new parallel PETSc diff --git a/deal.II/include/deal.II/lac/petsc_solver.h b/deal.II/include/deal.II/lac/petsc_solver.h index c52246193c..b3c9ac5c84 100644 --- a/deal.II/include/deal.II/lac/petsc_solver.h +++ b/deal.II/include/deal.II/lac/petsc_solver.h @@ -224,11 +224,11 @@ namespace PETScWrappers * convergence has been reached. */ static - PetscErrorCode convergence_test (KSP ksp, - const PetscInt iteration, - const PetscReal residual_norm, - KSPConvergedReason *reason, - void *solver_control); + PetscErrorCode convergence_test (KSP ksp, + const PetscInt iteration, + const PetscReal residual_norm, + KSPConvergedReason *reason, + void *solver_control); /** * A structure that contains the PETSc @@ -1216,11 +1216,11 @@ namespace PETScWrappers * to see if convergence has been reached. */ static - PetscErrorCode convergence_test (KSP ksp, - const PetscInt iteration, - const PetscReal residual_norm, - KSPConvergedReason *reason, - void *solver_control); + PetscErrorCode convergence_test (KSP ksp, + const PetscInt iteration, + const PetscReal residual_norm, + KSPConvergedReason *reason, + void *solver_control); /** * A structure that contains the diff --git a/deal.II/include/deal.II/lac/petsc_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_sparse_matrix.h index 34a4989d96..cd12e0c2d5 100644 --- a/deal.II/include/deal.II/lac/petsc_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_sparse_matrix.h @@ -174,7 +174,7 @@ namespace PETScWrappers */ template explicit SparseMatrix (const SparsityType &sparsity_pattern, - const bool preset_nonzero_locations = true); + const bool preset_nonzero_locations = true); /** * This operator assigns a scalar to @@ -214,7 +214,7 @@ namespace PETScWrappers * the constructor of this class with * the same argument list as the * present function. - */ + */ void reinit (const size_type m, const size_type n, const std::vector &row_lengths, @@ -333,7 +333,7 @@ namespace PETScWrappers /** * Purposefully not implemented */ - SparseMatrix& operator= (const SparseMatrix &); + SparseMatrix &operator= (const SparseMatrix &); /** * Do the actual work for the diff --git a/deal.II/include/deal.II/lac/petsc_vector_base.h b/deal.II/include/deal.II/lac/petsc_vector_base.h index 844377081b..8d0f7e056f 100644 --- a/deal.II/include/deal.II/lac/petsc_vector_base.h +++ b/deal.II/include/deal.II/lac/petsc_vector_base.h @@ -88,7 +88,7 @@ namespace PETScWrappers */ typedef types::global_dof_index size_type; - private: + private: /** * Constructor. It is made private so * as to only allow the actual vector @@ -98,8 +98,8 @@ namespace PETScWrappers const size_type index); - public: - + public: + /** * This looks like a copy operator, * but does something different than diff --git a/deal.II/include/deal.II/lac/precondition.h b/deal.II/include/deal.II/lac/precondition.h index 371e396486..d2e059fd36 100644 --- a/deal.II/include/deal.II/lac/precondition.h +++ b/deal.II/include/deal.II/lac/precondition.h @@ -1321,7 +1321,7 @@ PreconditionSSOR::initialize (const MATRIX &rA, // only. note: the first entry in each line denotes the diagonal // element, which we need not check. typename SparseMatrix::const_iterator - it = mat->begin(row)+1; + it = mat->begin(row)+1; for ( ; it < mat->end(row); ++it) if (it->column() > row) break; @@ -1776,7 +1776,7 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, // attach stream to SolverCG, run it with log report for eigenvalues std::ostream *old_stream = deallog.has_file() ? &deallog.get_file_stream() : - static_cast(0); + static_cast(0); if (old_stream) deallog.detach(); @@ -1796,7 +1796,7 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, cg_data.compute_eigenvalues = true; SolverCG solver (control, memory, cg_data); internal::PreconditionChebyshev::DiagonalPreconditioner - preconditioner(data.matrix_diagonal_inverse); + preconditioner(data.matrix_diagonal_inverse); try { solver.solve(matrix, *dummy, *rhs, preconditioner); diff --git a/deal.II/include/deal.II/lac/precondition_block.h b/deal.II/include/deal.II/lac/precondition_block.h index 117a1cfb1c..a2d4e1cded 100644 --- a/deal.II/include/deal.II/lac/precondition_block.h +++ b/deal.II/include/deal.II/lac/precondition_block.h @@ -1127,7 +1127,7 @@ Accessor (const PreconditionBlockJacobi *matrix, template inline -typename PreconditionBlockJacobi::size_type +typename PreconditionBlockJacobi::size_type PreconditionBlockJacobi::const_iterator::Accessor::row() const { Assert (a_block < matrix->size(), diff --git a/deal.II/include/deal.II/lac/precondition_block.templates.h b/deal.II/include/deal.II/lac/precondition_block.templates.h index 03aeeff0f6..17dfe41f86 100644 --- a/deal.II/include/deal.II/lac/precondition_block.templates.h +++ b/deal.II/include/deal.II/lac/precondition_block.templates.h @@ -863,8 +863,8 @@ void PreconditionBlockSOR::backward ( { const size_type column = entry->column(); const size_type inverse_permuted_column = permuted - ? this->inverse_permutation[column] - : column; + ? this->inverse_permutation[column] + : column; if (inverse_permuted_column >= block_end) b_cell_row -= entry->value() * dst(column); else if (!this->inverses_ready() && column >= block_start) diff --git a/deal.II/include/deal.II/lac/relaxation_block.templates.h b/deal.II/include/deal.II/lac/relaxation_block.templates.h index 34e4aaecdd..621ed76280 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.templates.h +++ b/deal.II/include/deal.II/lac/relaxation_block.templates.h @@ -221,10 +221,10 @@ RelaxationBlock::do_step ( // Apply inverse diagonal this->inverse_vmult(block, x_cell, b_cell); #ifdef DEBUG - for (unsigned int i=0;iblock_list.begin(block); diff --git a/deal.II/include/deal.II/lac/slepc_solver.h b/deal.II/include/deal.II/lac/slepc_solver.h index d828dca5f4..b5135d7403 100644 --- a/deal.II/include/deal.II/lac/slepc_solver.h +++ b/deal.II/include/deal.II/lac/slepc_solver.h @@ -236,7 +236,7 @@ namespace SLEPcWrappers * deal.II's own SolverControl objects to see if convergence has * been reached. */ - void + void get_solver_state (const SolverControl::State state); /** @@ -725,8 +725,8 @@ namespace SLEPcWrappers * change that. */ SolverLAPACK (SolverControl &cn, - const MPI_Comm &mpi_communicator = PETSC_COMM_SELF, - const AdditionalData &data = AdditionalData()); + const MPI_Comm &mpi_communicator = PETSC_COMM_SELF, + const AdditionalData &data = AdditionalData()); protected: @@ -750,122 +750,122 @@ namespace SLEPcWrappers // todo: The logic of these functions can be simplified without breaking backward compatibility... template - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - std::vector &eigenvalues, - std::vector &eigenvectors, - const size_type n_eigenpairs) - { - // Panic if the number of eigenpairs wanted is out of bounds. - AssertThrow ((n_eigenpairs > 0) && (n_eigenpairs <= A.m ()), - ExcSLEPcWrappersUsageError()); - - // Set the matrices of the problem - set_matrices (A); - - // and solve - size_type n_converged = 0; - solve (n_eigenpairs, &n_converged); - - if (n_converged > n_eigenpairs) - n_converged = n_eigenpairs; - AssertThrow (n_converged == n_eigenpairs, - ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); - - AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); - eigenvectors.resize (n_converged, eigenvectors.front()); - eigenvalues.resize (n_converged); - - for (size_type index=0; index &eigenvalues, + std::vector &eigenvectors, + const size_type n_eigenpairs) + { + // Panic if the number of eigenpairs wanted is out of bounds. + AssertThrow ((n_eigenpairs > 0) && (n_eigenpairs <= A.m ()), + ExcSLEPcWrappersUsageError()); + + // Set the matrices of the problem + set_matrices (A); + + // and solve + size_type n_converged = 0; + solve (n_eigenpairs, &n_converged); + + if (n_converged > n_eigenpairs) + n_converged = n_eigenpairs; + AssertThrow (n_converged == n_eigenpairs, + ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); + + AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); + eigenvectors.resize (n_converged, eigenvectors.front()); + eigenvalues.resize (n_converged); + + for (size_type index=0; index - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - const PETScWrappers::MatrixBase &B, - std::vector &eigenvalues, - std::vector &eigenvectors, - const size_type n_eigenpairs) - { - // Guard against incompatible matrix sizes: - AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); - AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); - - // Panic if the number of eigenpairs wanted is out of bounds. - AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), - ExcSLEPcWrappersUsageError()); - - // Set the matrices of the problem - set_matrices (A, B); - - // and solve - size_type n_converged = 0; - solve (n_eigenpairs, &n_converged); - - if (n_converged>=n_eigenpairs) - n_converged = n_eigenpairs; - - AssertThrow (n_converged==n_eigenpairs, - ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); - AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); - - eigenvectors.resize (n_converged, eigenvectors.front()); - eigenvalues.resize (n_converged); - - for (size_type index=0; index &eigenvalues, + std::vector &eigenvectors, + const size_type n_eigenpairs) + { + // Guard against incompatible matrix sizes: + AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); + AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); + + // Panic if the number of eigenpairs wanted is out of bounds. + AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), + ExcSLEPcWrappersUsageError()); + + // Set the matrices of the problem + set_matrices (A, B); + + // and solve + size_type n_converged = 0; + solve (n_eigenpairs, &n_converged); + + if (n_converged>=n_eigenpairs) + n_converged = n_eigenpairs; + + AssertThrow (n_converged==n_eigenpairs, + ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); + AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); + + eigenvectors.resize (n_converged, eigenvectors.front()); + eigenvalues.resize (n_converged); + + for (size_type index=0; index - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - const PETScWrappers::MatrixBase &B, - std::vector &real_eigenvalues, - std::vector &imag_eigenvalues, - std::vector &real_eigenvectors, - std::vector &imag_eigenvectors, - const size_type n_eigenpairs) - { - // Guard against incompatible matrix sizes: - AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); - AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); - - // and incompatible eigenvalue/eigenvector sizes - AssertThrow (real_eigenvalues.size() == imag_eigenvalues.size(), - ExcDimensionMismatch(real_eigenvalues.size(), imag_eigenvalues.size())); - AssertThrow (real_eigenvectors.size() == imag_eigenvectors.n (), - ExcDimensionMismatch(real_eigenvectors.size(), imag_eigenvectors.size())); - - // Panic if the number of eigenpairs wanted is out of bounds. - AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), - ExcSLEPcWrappersUsageError()); - - // Set the matrices of the problem - set_matrices (A, B); - - // and solve - size_type n_converged = 0; - solve (n_eigenpairs, &n_converged); - - if (n_converged>=n_eigenpairs) - n_converged = n_eigenpairs; - - AssertThrow (n_converged==n_eigenpairs, - ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); - AssertThrow ((real_eigenvectors.size()!=0) && (imag_eigenvectors.size()!=0), - ExcSLEPcWrappersUsageError()); - - real_eigenvectors.resize (n_converged, real_eigenvectors.front()); - imag_eigenvectors.resize (n_converged, imag_eigenvectors.front()); - real_eigenvalues.resize (n_converged); - imag_eigenvalues.resize (n_converged); - - for (size_type index=0; index &real_eigenvalues, + std::vector &imag_eigenvalues, + std::vector &real_eigenvectors, + std::vector &imag_eigenvectors, + const size_type n_eigenpairs) + { + // Guard against incompatible matrix sizes: + AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); + AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); + + // and incompatible eigenvalue/eigenvector sizes + AssertThrow (real_eigenvalues.size() == imag_eigenvalues.size(), + ExcDimensionMismatch(real_eigenvalues.size(), imag_eigenvalues.size())); + AssertThrow (real_eigenvectors.size() == imag_eigenvectors.n (), + ExcDimensionMismatch(real_eigenvectors.size(), imag_eigenvectors.size())); + + // Panic if the number of eigenpairs wanted is out of bounds. + AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), + ExcSLEPcWrappersUsageError()); + + // Set the matrices of the problem + set_matrices (A, B); + + // and solve + size_type n_converged = 0; + solve (n_eigenpairs, &n_converged); + + if (n_converged>=n_eigenpairs) + n_converged = n_eigenpairs; + + AssertThrow (n_converged==n_eigenpairs, + ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); + AssertThrow ((real_eigenvectors.size()!=0) && (imag_eigenvectors.size()!=0), + ExcSLEPcWrappersUsageError()); + + real_eigenvectors.resize (n_converged, real_eigenvectors.front()); + imag_eigenvectors.resize (n_converged, imag_eigenvectors.front()); + real_eigenvalues.resize (n_converged); + imag_eigenvalues.resize (n_converged); + + for (size_type index=0; indexeigensolver: * @code * // Set a transformation, this one shifts the eigenspectrum by 3.142.. - * SLEPcWrappers::TransformationShift::AdditionalData additional_data (3.142); + * SLEPcWrappers::TransformationShift::AdditionalData additional_data (3.142); * SLEPcWrappers::TransformationShift shift (additional_data); * eigensolver.set_transformation (shift); * @endcode @@ -57,7 +57,7 @@ namespace SLEPcWrappers * SolverArnoldi system (solver_control, mpi_communicator); * eigensolver.solve (A, B, lambda, x, size_of_spectrum); * @endcode - * + * * @note These options can also be set at the commandline. * * @ingroup SLEPcWrappers diff --git a/deal.II/include/deal.II/lac/solver_gmres.h b/deal.II/include/deal.II/lac/solver_gmres.h index b3dfd8437d..902b00493b 100644 --- a/deal.II/include/deal.II/lac/solver_gmres.h +++ b/deal.II/include/deal.II/lac/solver_gmres.h @@ -710,7 +710,7 @@ SolverGMRES::solve (const MATRIX &A, precondition.vmult(vv,p); } else - { + { precondition.vmult(p, tmp_vectors[inner_iteration]); A.vmult(vv,p); }; diff --git a/deal.II/include/deal.II/lac/sparse_decomposition.templates.h b/deal.II/include/deal.II/lac/sparse_decomposition.templates.h index e05b3325e5..278929f843 100644 --- a/deal.II/include/deal.II/lac/sparse_decomposition.templates.h +++ b/deal.II/include/deal.II/lac/sparse_decomposition.templates.h @@ -179,19 +179,19 @@ void SparseLUDecomposition::prebuild_lower_bound() { const size_type *const - column_numbers = this->get_sparsity_pattern().colnums; + column_numbers = this->get_sparsity_pattern().colnums; const std::size_t *const - rowstart_indices = this->get_sparsity_pattern().rowstart; + rowstart_indices = this->get_sparsity_pattern().rowstart; const size_type N = this->m(); - - prebuilt_lower_bound.resize (N); - - for (size_type row=0; row::copy_from (const SparseMatrix &matrix { typename SparseMatrix::iterator index = this->begin(row); typename SparseMatrix::const_iterator - in_index = matrix.begin(row); + in_index = matrix.begin(row); index->value() = in_index->value(); ++index, ++in_index; while (index < this->end(row) && in_index < matrix.end(row)) diff --git a/deal.II/include/deal.II/lac/sparse_direct.h b/deal.II/include/deal.II/lac/sparse_direct.h index 21faa7cbb1..8ef14a7a38 100644 --- a/deal.II/include/deal.II/lac/sparse_direct.h +++ b/deal.II/include/deal.II/lac/sparse_direct.h @@ -170,40 +170,40 @@ public: * inverse of the matrix, $A^{-1}$. */ void vmult (Vector &dst, - const Vector &src) const; + const Vector &src) const; /** * Same as before, but for block vectors. */ void vmult (BlockVector &dst, - const BlockVector &src) const; + const BlockVector &src) const; /** * Same as before, but uses the transpose of the matrix, i.e. this * function multiplies with $A^{-T}$. */ void Tvmult (Vector &dst, - const Vector &src) const; + const Vector &src) const; /** * Same as before, but for block vectors */ void Tvmult (BlockVector &dst, - const BlockVector &src) const; + const BlockVector &src) const; /** * Same as vmult(), but adding to the previous solution. Not implemented * yet but necessary for compiling certain other classes. */ void vmult_add (Vector &dst, - const Vector &src) const; + const Vector &src) const; /** * Same as before, but uses the transpose of the matrix, i.e. this * function multiplies with $A^{-T}$. */ void Tvmult_add (Vector &dst, - const Vector &src) const; + const Vector &src) const; /** * @} @@ -262,7 +262,7 @@ public: /** * @} */ - + /** * One of the UMFPack routines threw an error. The error code is included * in the output and can be looked up in the UMFPack user manual. The diff --git a/deal.II/include/deal.II/lac/sparse_matrix.h b/deal.II/include/deal.II/lac/sparse_matrix.h index f692f2ff36..79b71911ac 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix.h +++ b/deal.II/include/deal.II/lac/sparse_matrix.h @@ -713,7 +713,7 @@ public: * object. See MemoryConsumption. */ std::size_t memory_consumption () const; - + /** * Dummy function for compatibility with distributed, parallel matrices. */ @@ -949,7 +949,7 @@ public: SparseMatrix & copy_from (const TrilinosWrappers::SparseMatrix &matrix); #endif - + /** * Add matrix scaled by factor to this matrix, i.e. the * matrix factor*matrix is added to this. This function @@ -2478,43 +2478,43 @@ void SparseMatrix::print (STREAM &out, bool across, bool diagonal_first) { Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - + bool hanging_diagonal = false; number diagonal; - + for (size_type i=0; irows; ++i) { for (size_type j=cols->rowstart[i]; jrowstart[i+1]; ++j) - { - if (!diagonal_first && i == cols->colnums[j]) - { - diagonal = val[j]; - hanging_diagonal = true; - } - else - { - if (hanging_diagonal && cols->colnums[j]>i) - { - if (across) - out << ' ' << i << ',' << i << ':' << diagonal; - else - out << '(' << i << ',' << i << ") " << diagonal << std::endl; - hanging_diagonal = false; - } - if (across) - out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; - else - out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; - } - } + { + if (!diagonal_first && i == cols->colnums[j]) + { + diagonal = val[j]; + hanging_diagonal = true; + } + else + { + if (hanging_diagonal && cols->colnums[j]>i) + { + if (across) + out << ' ' << i << ',' << i << ':' << diagonal; + else + out << '(' << i << ',' << i << ") " << diagonal << std::endl; + hanging_diagonal = false; + } + if (across) + out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; + else + out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; + } + } if (hanging_diagonal) - { - if (across) - out << ' ' << i << ',' << i << ':' << diagonal; - else - out << '(' << i << ',' << i << ") " << diagonal << std::endl; - hanging_diagonal = false; - } + { + if (across) + out << ' ' << i << ',' << i << ':' << diagonal; + else + out << '(' << i << ',' << i << ") " << diagonal << std::endl; + hanging_diagonal = false; + } } if (across) out << std::endl; diff --git a/deal.II/include/deal.II/lac/sparse_matrix.templates.h b/deal.II/include/deal.II/lac/sparse_matrix.templates.h index fc04cb8a84..e007579833 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/sparse_matrix.templates.h @@ -250,7 +250,7 @@ SparseMatrix::empty () const template -typename SparseMatrix::size_type +typename SparseMatrix::size_type SparseMatrix::get_row_length (const size_type row) const { Assert (cols != 0, ExcNotInitialized()); @@ -260,7 +260,7 @@ SparseMatrix::get_row_length (const size_type row) const template -typename SparseMatrix::size_type +typename SparseMatrix::size_type SparseMatrix::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -270,7 +270,7 @@ SparseMatrix::n_nonzero_elements () const template -typename SparseMatrix::size_type +typename SparseMatrix::size_type SparseMatrix::n_actually_nonzero_elements (const double threshold) const { Assert (cols != 0, ExcNotInitialized()); @@ -366,7 +366,7 @@ SparseMatrix::copy_from (const TrilinosWrappers::SparseMatrix &matrix) { Assert (m() == matrix.m(), ExcDimensionMismatch(m(), matrix.m())); Assert (n() == matrix.n(), ExcDimensionMismatch(n(), matrix.n())); - + // first delete previous content *this = 0; @@ -382,10 +382,10 @@ SparseMatrix::copy_from (const TrilinosWrappers::SparseMatrix &matrix) // length of the row int ncols; int ierr - = matrix.trilinos_matrix().ExtractGlobalRowCopy - (row, matrix.row_length(row), ncols, - &(value_cache[0]), - reinterpret_cast(&(colnum_cache[0]))); + = matrix.trilinos_matrix().ExtractGlobalRowCopy + (row, matrix.row_length(row), ncols, + &(value_cache[0]), + reinterpret_cast(&(colnum_cache[0]))); Assert (ierr==0, ExcTrilinosError(ierr)); // resize arrays to the size actually used @@ -394,8 +394,8 @@ SparseMatrix::copy_from (const TrilinosWrappers::SparseMatrix &matrix) // then copy everything in one swoop this->set(row, - colnum_cache, - value_cache); + colnum_cache, + value_cache); } return *this; @@ -419,7 +419,7 @@ SparseMatrix::add (const number factor, const number *const end_ptr = &val[cols->n_nonzero_elements()]; while (val_ptr != end_ptr) - *val_ptr++ += factor * *matrix_ptr++; + *val_ptr++ += factor **matrix_ptr++; } @@ -987,9 +987,9 @@ SparseMatrix::mmult (SparseMatrix &C, { const size_type col = *rows; size_type *new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[col]]); + (&sp_B.colnums[sp_B.rowstart[col]]); size_type *end_new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[col+1]]); + (&sp_B.colnums[sp_B.rowstart[col+1]]); // if B has a diagonal, need to add that manually. this way, // we maintain sortedness. @@ -1052,7 +1052,7 @@ SparseMatrix::mmult (SparseMatrix &C, &B.val[new_cols-&sp_B.colnums[sp_B.rowstart[0]]]; const numberB *const end_cols = &B.val[sp_B.rowstart[col+1]]; for (; B_val_ptr != end_cols; ++B_val_ptr) - *new_ptr++ = A_val * *B_val_ptr * (use_vector ? V(col) : 1); + *new_ptr++ = A_val **B_val_ptr * (use_vector ? V(col) : 1); C.add (i, new_ptr-&new_entries[0], new_cols, &new_entries[0], false, true); @@ -1112,10 +1112,10 @@ SparseMatrix::Tmmult (SparseMatrix &C, const size_type *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; // cast away constness to conform with csp.add_entries interface - size_type *new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[i]]); - size_type *end_new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[i+1]]); + size_type *new_cols = const_cast + (&sp_B.colnums[sp_B.rowstart[i]]); + size_type *end_new_cols = const_cast + (&sp_B.colnums[sp_B.rowstart[i+1]]); if (sp_B.n_rows() == sp_B.n_cols()) ++new_cols; @@ -1182,7 +1182,7 @@ SparseMatrix::Tmmult (SparseMatrix &C, const numberB *B_val_ptr = &B.val[new_cols-&sp_B.colnums[sp_B.rowstart[0]]]; for (; B_val_ptr != end_cols; ++B_val_ptr) - *new_ptr++ = A_val * *B_val_ptr * (use_vector ? V(i) : 1); + *new_ptr++ = A_val **B_val_ptr * (use_vector ? V(i) : 1); C.add (row, new_ptr-&new_entries[0], new_cols, &new_entries[0], false, true); @@ -1357,7 +1357,7 @@ SparseMatrix::precondition_Jacobi (Vector &dst, // square matrix by above assertion if (om != 1.) for (size_type i=0; i *matrix, template inline -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::const_iterator::Accessor::row() const { return a_row; @@ -1147,7 +1147,7 @@ SparseMatrixEZ::const_iterator::Accessor::row() const template inline -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::const_iterator::Accessor::column() const { return matrix->data[matrix->row_info[a_row].start+a_index].column; @@ -1628,7 +1628,7 @@ SparseMatrixEZ::copy_from (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) if (entry->value() != 0) set(row, entry->column(), entry->value()); } @@ -1656,7 +1656,7 @@ SparseMatrixEZ::add (const number factor, { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) if (entry->value() != 0) add(row, entry->column(), factor * entry->value()); } diff --git a/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h b/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h index e448dc8f5a..eac1a95b32 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h +++ b/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h @@ -259,7 +259,7 @@ SparseMatrixEZ::precondition_Jacobi (Vector &dst, for (; ri != end; ++dst_ptr, ++src_ptr, ++ri) { Assert (ri->diagonal != RowInfo::invalid_diagonal, ExcNoDiagonal()); - *dst_ptr = om * *src_ptr / data[ri->start + ri->diagonal].value; + *dst_ptr = om **src_ptr / data[ri->start + ri->diagonal].value; } } @@ -393,7 +393,7 @@ SparseMatrixEZ::memory_consumption() const template -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::get_row_length (const size_type row) const { return row_info[row].length; @@ -402,7 +402,7 @@ SparseMatrixEZ::get_row_length (const size_type row) const template -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::n_nonzero_elements() const { typename std::vector::const_iterator row = row_info.begin(); diff --git a/deal.II/include/deal.II/lac/sparse_vanka.templates.h b/deal.II/include/deal.II/lac/sparse_vanka.templates.h index 3955aa894e..de72b05d8a 100644 --- a/deal.II/include/deal.II/lac/sparse_vanka.templates.h +++ b/deal.II/include/deal.II/lac/sparse_vanka.templates.h @@ -72,10 +72,10 @@ SparseVanka::compute_inverses () #else const size_type n_inverses = std::count (selected.begin(), selected.end(), - true); + true); - const size_type n_inverses_per_thread = std::max(n_inverses / n_threads, - static_cast (1U)); + const size_type n_inverses_per_thread = std::max(n_inverses / n_threads, + static_cast (1U)); // set up start and end index // for each of the @@ -293,7 +293,7 @@ SparseVanka::apply_preconditioner (Vector &dst, // number of DoFs coupling to // irow (including irow itself) for (typename SparseMatrix::const_iterator p=matrix->begin(row); - p != matrix->end(row); ++p) + p != matrix->end(row); ++p) { // find out whether this DoF // (that couples with @p irow, @@ -396,8 +396,8 @@ SparseBlockVanka::compute_dof_masks (const SparseMatrix &M, selected.end(), true); - const size_type n_inverses_per_block = std::max(n_inverses / n_blocks, - static_cast (1U)); + const size_type n_inverses_per_block = std::max(n_inverses / n_blocks, + static_cast (1U)); // precompute the splitting points std::vector > intervals (n_blocks); diff --git a/deal.II/include/deal.II/lac/sparsity_pattern.h b/deal.II/include/deal.II/lac/sparsity_pattern.h index ceec401921..6643607688 100644 --- a/deal.II/include/deal.II/lac/sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/sparsity_pattern.h @@ -66,7 +66,7 @@ namespace internals * the copy_from() function, if the inner iterator type points to plain * unsigned integers. */ - size_type + size_type get_column_index_from_iterator (const size_type i); /** @@ -75,7 +75,7 @@ namespace internals * unsigned integers and some other value. */ template - size_type + size_type get_column_index_from_iterator (const std::pair &i); /** @@ -84,7 +84,7 @@ namespace internals * std::map). */ template - size_type + size_type get_column_index_from_iterator (const std::pair &i); } @@ -1493,12 +1493,12 @@ namespace SparsityPatternIterators inline - size_type + size_type Accessor::row() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); - const std::size_t * insert_point = + const std::size_t *insert_point = std::upper_bound(sparsity_pattern->rowstart, sparsity_pattern->rowstart + sparsity_pattern->rows + 1, index_within_sparsity); @@ -1507,7 +1507,7 @@ namespace SparsityPatternIterators inline - size_type + size_type Accessor::column() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); @@ -1517,7 +1517,7 @@ namespace SparsityPatternIterators inline - size_type + size_type Accessor::index() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); @@ -1715,7 +1715,7 @@ SparsityPattern::row_end (const size_type r) const inline -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::n_rows () const { return rows; @@ -1723,7 +1723,7 @@ SparsityPattern::n_rows () const inline -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::n_cols () const { return cols; @@ -1782,7 +1782,7 @@ SparsityPattern::row_length (const size_type row) const inline -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::column_number (const size_type row, const unsigned int index) const { @@ -1869,14 +1869,14 @@ SparsityPattern::operator == (const SparsityPattern &sp2) const namespace internal { namespace SparsityPatternTools - { + { /** * Declare type for container size. */ - typedef types::global_dof_index size_type; - + typedef types::global_dof_index size_type; + inline - size_type + size_type get_column_index_from_iterator (const size_type i) { return i; @@ -1886,7 +1886,7 @@ namespace internal template inline - size_type + size_type get_column_index_from_iterator (const std::pair &i) { return i.first; @@ -1896,7 +1896,7 @@ namespace internal template inline - size_type + size_type get_column_index_from_iterator (const std::pair &i) { return i.first; diff --git a/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h b/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h index e785117f5b..f35166b1c3 100644 --- a/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h @@ -125,7 +125,7 @@ namespace TrilinosWrappers * processes. */ explicit BlockVector (const std::vector ¶llel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Copy-Constructor. Set all the diff --git a/deal.II/include/deal.II/lac/trilinos_solver.h b/deal.II/include/deal.II/lac/trilinos_solver.h index 4f798b7644..1c4ead78a8 100644 --- a/deal.II/include/deal.II/lac/trilinos_solver.h +++ b/deal.II/include/deal.II/lac/trilinos_solver.h @@ -162,9 +162,9 @@ namespace TrilinosWrappers /** * Solve the linear system - * Ax=b where A - * is an operator. This function - * can be used for matrix free + * Ax=b where A + * is an operator. This function + * can be used for matrix free * computation. Depending on * the information provided by * derived classes and the @@ -207,7 +207,7 @@ namespace TrilinosWrappers /** * Solve the linear system * Ax=b where A - * is an operator. This function can + * is an operator. This function can * be used for matric free. Depending on the * information provided by derived * classes and the object passed as a diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index d2e4e3f344..8349654f99 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -2972,26 +2972,26 @@ namespace TrilinosWrappers Epetra_CombineMode mode = last_action; if (last_action == Zero) - { - if ((operation==::dealii::VectorOperation::add) || - (operation==::dealii::VectorOperation::unknown)) - mode = Add; - else if (operation==::dealii::VectorOperation::insert) - mode = Insert; - } + { + if ((operation==::dealii::VectorOperation::add) || + (operation==::dealii::VectorOperation::unknown)) + mode = Add; + else if (operation==::dealii::VectorOperation::insert) + mode = Insert; + } else - { - Assert( + { + Assert( ((last_action == Add) && (operation!=::dealii::VectorOperation::insert)) || ((last_action == Insert) && (operation!=::dealii::VectorOperation::add)), ExcMessage("operation and argument to compress() do not match")); - } + } // flush buffers int ierr; ierr = matrix->GlobalAssemble (*column_space_map, matrix->RowMap(), - true, mode); + true, mode); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); @@ -3137,7 +3137,7 @@ namespace TrilinosWrappers if (elide_zero_values == false) { col_index_ptr = (TrilinosWrappers::types::int_type *)col_indices; - col_value_ptr = const_cast(values); + col_value_ptr = const_cast(values); n_columns = n_cols; } else @@ -3187,9 +3187,9 @@ namespace TrilinosWrappers if (matrix->Filled() == false) { ierr = matrix->Epetra_CrsMatrix::InsertGlobalValues( - static_cast(row), - static_cast(n_columns),const_cast(col_value_ptr), - col_index_ptr); + static_cast(row), + static_cast(n_columns),const_cast(col_value_ptr), + col_index_ptr); // When inserting elements, we do not want to create exceptions in // the case when inserting non-local data (since that's what we @@ -3362,7 +3362,7 @@ namespace TrilinosWrappers if (elide_zero_values == false) { col_index_ptr = (TrilinosWrappers::types::int_type *)col_indices; - col_value_ptr = const_cast(values); + col_value_ptr = const_cast(values); n_columns = n_cols; #ifdef DEBUG for (size_type j=0; jFilled(), ExcMatrixNotCompressed()); - (void)src; - (void)dst; + (void)src; + (void)dst; internal::SparseMatrix::check_vector_map_equality(*matrix, src, dst); const size_type dst_local_size = dst.end() - dst.begin(); AssertDimension (dst_local_size, static_cast(matrix->RangeMap().NumMyElements())); - (void)dst_local_size; + (void)dst_local_size; const size_type src_local_size = src.end() - src.begin(); AssertDimension (src_local_size, static_cast(matrix->DomainMap().NumMyElements())); - (void)src_local_size; + (void)src_local_size; Epetra_MultiVector tril_dst (View, matrix->RangeMap(), dst.begin(), matrix->DomainMap().NumMyPoints(), 1); @@ -3713,7 +3713,7 @@ namespace TrilinosWrappers } - + template inline void diff --git a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h index f6f6f8de5a..bd0d7c70ea 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -1661,8 +1661,8 @@ namespace TrilinosWrappers // from it which we can by evaluating an expression such as when // multiplying the value produced by 2 Assert (sizeof(TrilinosWrappers::types::int_type) == - sizeof((*begin)*2), - ExcNotImplemented()); + sizeof((*begin)*2), + ExcNotImplemented()); TrilinosWrappers::types::int_type *col_index_ptr = (TrilinosWrappers::types::int_type *)(&*begin); diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index b4453c6999..d8b651925b 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_vector.h @@ -50,16 +50,16 @@ namespace TrilinosWrappers namespace { #ifndef DEAL_II_USE_LARGE_INDEX_TYPE - // define a helper function that queries the global ID of local ID of - // an Epetra_BlockMap object by calling either the 32- or 64-bit + // define a helper function that queries the global ID of local ID of + // an Epetra_BlockMap object by calling either the 32- or 64-bit // function necessary. int gid(const Epetra_BlockMap &map, int i) { return map.GID(i); } #else - // define a helper function that queries the global ID of local ID of - // an Epetra_BlockMap object by calling either the 32- or 64-bit + // define a helper function that queries the global ID of local ID of + // an Epetra_BlockMap object by calling either the 32- or 64-bit // function necessary. long long int gid(const Epetra_BlockMap &map, int i) { @@ -287,8 +287,8 @@ namespace TrilinosWrappers * values ghost. */ void reinit (const IndexSet &local, - const IndexSet &ghost, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const IndexSet &ghost, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Set all components of the @@ -423,7 +423,7 @@ namespace TrilinosWrappers * details. */ Vector (const Epetra_Map ¶llel_partitioning, - const VectorBase &v); + const VectorBase &v); /** * Reinitialize from a deal.II @@ -452,7 +452,7 @@ namespace TrilinosWrappers */ template Vector (const Epetra_Map ¶llel_partitioning, - const dealii::Vector &v); + const dealii::Vector &v); //@} /** * @name Initialization with an IndexSet @@ -469,7 +469,7 @@ namespace TrilinosWrappers * vector. */ explicit Vector (const IndexSet ¶llel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Creates a ghosted parallel vector. @@ -490,8 +490,8 @@ namespace TrilinosWrappers * partitioning details. */ Vector (const IndexSet ¶llel_partitioning, - const VectorBase &v, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const VectorBase &v, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Copy-constructor from deal.II @@ -501,8 +501,8 @@ namespace TrilinosWrappers */ template Vector (const IndexSet ¶llel_partitioning, - const dealii::Vector &v, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const dealii::Vector &v, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Reinit functionality. This function @@ -696,7 +696,7 @@ namespace TrilinosWrappers * be generated internally. */ explicit Vector (const IndexSet &partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * This constructor takes a diff --git a/deal.II/include/deal.II/lac/trilinos_vector_base.h b/deal.II/include/deal.II/lac/trilinos_vector_base.h index 9458b5710d..674b6ca0d4 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector_base.h +++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h @@ -690,7 +690,7 @@ namespace TrilinosWrappers /** * Make the Vector class a bit like the vector<> class of * the C++ standard library by returning iterators to the start and end - * of the locally owned elements of this vector. The ordering of local elements corresponds to the one given + * of the locally owned elements of this vector. The ordering of local elements corresponds to the one given * * It holds that end() - begin() == local_size(). */ @@ -1268,9 +1268,9 @@ namespace TrilinosWrappers { const size_type n_indices = vector->Map().NumMyElements(); #ifndef DEAL_II_USE_LARGE_INDEX_TYPE - unsigned int * vector_indices = (unsigned int*)vector->Map().MyGlobalElements(); + unsigned int *vector_indices = (unsigned int *)vector->Map().MyGlobalElements(); #else - size_type * vector_indices = (size_type*)vector->Map().MyGlobalElements64(); + size_type *vector_indices = (size_type *)vector->Map().MyGlobalElements64(); #endif is.add_indices(vector_indices, vector_indices+n_indices); is.compress(); diff --git a/deal.II/include/deal.II/matrix_free/dof_info.h b/deal.II/include/deal.II/matrix_free/dof_info.h index 902a265d96..25d3af79de 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.h @@ -55,17 +55,17 @@ namespace internal */ struct DoFInfo { - + /** * size_type of the dof_indicies object. */ - + typedef std::vector::size_type size_dof; - + /** * size_type of the constraint_indicators object. */ - + typedef std::vector >::size_type size_constraint; /** @@ -82,7 +82,7 @@ namespace internal * Clears all data fields in this class. */ void clear (); - + /** * Returns a pointer to the first index in the DoF row @p row. @@ -191,7 +191,7 @@ namespace internal * DoFHandlers. */ void compute_renumber_hp_serial (SizeInfo &size_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells); /** @@ -432,7 +432,7 @@ namespace internal #ifndef DOXYGEN inline - const types::global_dof_index * + const types::global_dof_index * DoFInfo::begin_indices (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); @@ -444,7 +444,7 @@ namespace internal inline - const types::global_dof_index * + const types::global_dof_index * DoFInfo::end_indices (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); diff --git a/deal.II/include/deal.II/matrix_free/dof_info.templates.h b/deal.II/include/deal.II/matrix_free/dof_info.templates.h index 2f9133a6f9..6b6975afe3 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.templates.h @@ -74,7 +74,7 @@ namespace internal template unsigned short ConstraintValues:: - insert_entries (const std::vector > &entries) + insert_entries (const std::vector > &entries) { next_constraint.first.resize(entries.size()); if (entries.size() > 0) @@ -173,7 +173,7 @@ namespace internal void - DoFInfo::read_dof_indices (const std::vector &local_indices, + DoFInfo::read_dof_indices (const std::vector &local_indices, const std::vector &lexicographic_inv, const ConstraintMatrix &constraints, const unsigned int cell_number, @@ -191,7 +191,7 @@ namespace internal dofs_per_cell[0] : dofs_per_cell[cell_active_fe_index[cell_number]]; for (unsigned int i=0; i > *entries_ptr = @@ -287,8 +287,8 @@ no_constraint: } } row_starts[cell_number+1] = std_cxx1x::tuple + size_constraint, + unsigned int> (dof_indices.size(), constraint_indicator.size(), 0); // now to the plain indices: in case we have constraints on this cell, @@ -305,7 +305,7 @@ no_constraint: { for (unsigned int i=0; i 1 && (current_dof < first_owned || @@ -332,7 +332,7 @@ no_constraint: // sort ghost dofs and compress out duplicates const types::global_dof_index n_owned = (vector_partitioner->local_range().second- - vector_partitioner->local_range().first); + vector_partitioner->local_range().first); const size_dof n_ghosts = ghost_dofs.size(); unsigned int n_unique_ghosts= 0; #ifdef DEBUG @@ -356,7 +356,7 @@ no_constraint: } std::sort (ghost_origin.begin(), ghost_origin.end()); - types::global_dof_index last_contiguous_start = ghost_origin[0].first; + types::global_dof_index last_contiguous_start = ghost_origin[0].first; ghost_numbering[ghost_origin[0].second] = 0; for (size_dof i=1; i - (begin_indices(boundary_cells[i])); + types::global_dof_index *data_ptr = const_cast + (begin_indices(boundary_cells[i])); const types::global_dof_index *row_end = end_indices(boundary_cells[i]); for ( ; data_ptr != row_end; ++data_ptr) @@ -410,7 +410,7 @@ no_constraint: if (row_length_indicators(boundary_cells[i]) > 0) { types::global_dof_index *data_ptr = const_cast - (begin_indices_plain(boundary_cells[i])); + (begin_indices_plain(boundary_cells[i])); const types::global_dof_index *row_end = (end_indices_plain(boundary_cells[i])); for ( ; data_ptr != row_end; ++data_ptr) @@ -444,7 +444,7 @@ no_constraint: std::vector &renumbering) { std::vector reverse_numbering (size_info.n_active_cells, - numbers::invalid_unsigned_int); + numbers::invalid_unsigned_int); const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int j=0; j &renumbering) { std::vector reverse_numbering (size_info.n_active_cells, - numbers::invalid_unsigned_int); + numbers::invalid_unsigned_int); const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int j=0; jlocal_range().second- - vector_partitioner->local_range().first) - + vector_partitioner->ghost_indices().n_elements(); + vector_partitioner->local_range().first) + + vector_partitioner->ghost_indices().n_elements(); for (size_dof i=0; ilocal_range().second- - vector_partitioner->local_range().first); + vector_partitioner->local_range().first); for (unsigned int row=0; rowlocal_range().second- - vector_partitioner->local_range().first) - + vector_partitioner->ghost_indices().n_elements(); + (vector_partitioner->local_range().second- + vector_partitioner->local_range().first) + + vector_partitioner->ghost_indices().n_elements(); const types::global_dof_index n_blocks = (do_blocking == true) ? - task_info.n_blocks : size_info.n_active_cells; + task_info.n_blocks : size_info.n_active_cells; // first determine row lengths std::vector row_lengths(n_rows); @@ -1849,7 +1849,7 @@ not_connect: else { const types::global_dof_index *it = begin_indices (block), - * end_cell = end_indices (block); + * end_cell = end_indices (block); for ( ; it != end_cell; ++it) if (row_lengths[*it] > 0) { @@ -1884,7 +1884,7 @@ not_connect: types::global_dof_index counter = 0; std::vector::iterator dof_ind = dof_indices.begin(), - end_ind = dof_indices.end(); + end_ind = dof_indices.end(); for ( ; dof_ind != end_ind; ++dof_ind) { if (*dof_ind < local_size) @@ -1941,7 +1941,7 @@ not_connect: { out << " Memory row starts indices: "; size_info.print_memory_statistics - (out, (row_starts.capacity()*sizeof(std_cxx1x::tuple))); + (out, (row_starts.capacity()*sizeof(std_cxx1x::tuple))); out << " Memory dof indices: "; size_info.print_memory_statistics (out, MemoryConsumption::memory_consumption (dof_indices)); diff --git a/deal.II/include/deal.II/matrix_free/fe_evaluation.h b/deal.II/include/deal.II/matrix_free/fe_evaluation.h index 96279f355c..34a849fc3a 100644 --- a/deal.II/include/deal.II/matrix_free/fe_evaluation.h +++ b/deal.II/include/deal.II/matrix_free/fe_evaluation.h @@ -1774,7 +1774,7 @@ namespace internal { typedef typename VectorType::BlockType BaseVectorType; - static BaseVectorType* get_vector_component (VectorType &vec, + static BaseVectorType *get_vector_component (VectorType &vec, const unsigned int component) { AssertIndexRange (component, vec.n_blocks()); @@ -1787,7 +1787,7 @@ namespace internal { typedef VectorType BaseVectorType; - static BaseVectorType* get_vector_component (VectorType &vec, + static BaseVectorType *get_vector_component (VectorType &vec, const unsigned int) { return &vec; @@ -2131,7 +2131,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector::value>::BaseVectorType *src_data[n_components]; + IsBlockVector::value>::BaseVectorType *src_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(const_cast(src), d); @@ -2214,7 +2214,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data const typename internal::BlockVectorSelector::value>::BaseVectorType *src_data[n_components]; + IsBlockVector::value>::BaseVectorType *src_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(const_cast(src), d); @@ -2281,7 +2281,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector::value>::BaseVectorType *dst_data[n_components]; + IsBlockVector::value>::BaseVectorType *dst_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(dst, d); @@ -2359,7 +2359,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector::value>::BaseVectorType *dst_data[n_components]; + IsBlockVector::value>::BaseVectorType *dst_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(dst, d); @@ -3882,12 +3882,12 @@ namespace internal inline void apply_tensor_product_values (const VectorizedArray *shape_values, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = dof_to_quad ? (fe_degree+1) : n_q_points_1d, - nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); + nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); const int n_cols = nn / 2; const int mid = mm / 2; @@ -3901,132 +3901,132 @@ namespace internal { for (int col=0; col val0, val1, in0, in1, res0, res1; - if (dof_to_quad == true) - { - val0 = shape_values[col]; - val1 = shape_values[nn-1-col]; - } - else - { - val0 = shape_values[col*n_q_points_1d]; - val1 = shape_values[(col+1)*n_q_points_1d-1]; - } - if (mid > 0) - { - in0 = in[0]; - in1 = in[stride*(mm-1)]; - res0 = val0 * in0; - res1 = val1 * in0; - res0 += val1 * in1; - res1 += val0 * in1; - for (int ind=1; ind(); - if (dof_to_quad == true) - { - if (mm % 2 == 1) - { - val0 = shape_values[mid*n_q_points_1d+col]; - val1 = val0 * in[stride*mid]; - res0 += val1; - res1 += val1; - } - } - else - { - if (mm % 2 == 1 && nn % 2 == 0) - { - val0 = shape_values[col*n_q_points_1d+mid]; - val1 = val0 * in[stride*mid]; - res0 += val1; - res1 += val1; - } - } - if (add == false) - { - out[stride*col] = res0; - out[stride*(nn-1-col)] = res1; - } - else - { - out[stride*col] += res0; - out[stride*(nn-1-col)] += res1; - } + VectorizedArray val0, val1, in0, in1, res0, res1; + if (dof_to_quad == true) + { + val0 = shape_values[col]; + val1 = shape_values[nn-1-col]; + } + else + { + val0 = shape_values[col*n_q_points_1d]; + val1 = shape_values[(col+1)*n_q_points_1d-1]; + } + if (mid > 0) + { + in0 = in[0]; + in1 = in[stride*(mm-1)]; + res0 = val0 * in0; + res1 = val1 * in0; + res0 += val1 * in1; + res1 += val0 * in1; + for (int ind=1; ind(); + if (dof_to_quad == true) + { + if (mm % 2 == 1) + { + val0 = shape_values[mid*n_q_points_1d+col]; + val1 = val0 * in[stride*mid]; + res0 += val1; + res1 += val1; + } + } + else + { + if (mm % 2 == 1 && nn % 2 == 0) + { + val0 = shape_values[col*n_q_points_1d+mid]; + val1 = val0 * in[stride*mid]; + res0 += val1; + res1 += val1; + } + } + if (add == false) + { + out[stride*col] = res0; + out[stride*(nn-1-col)] = res1; + } + else + { + out[stride*col] += res0; + out[stride*(nn-1-col)] += res1; + } } if ( dof_to_quad == true && nn%2==1 && mm%2==1 ) { - if (add==false) - out[stride*n_cols] = in[stride*mid]; - else - out[stride*n_cols] += in[stride*mid]; + if (add==false) + out[stride*n_cols] = in[stride*mid]; + else + out[stride*n_cols] += in[stride*mid]; } else if (dof_to_quad == true && nn%2==1) { - VectorizedArray res0; - VectorizedArray val0 = shape_values[n_cols]; - if (mid > 0) - { - res0 = in[0] + in[stride*(mm-1)]; - res0 *= val0; - for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; - val1 *= val0; - res0 += val1; - } - } - else - res0 = VectorizedArray(); - if (add == false) - out[stride*n_cols] = res0; - else - out[stride*n_cols] += res0; + VectorizedArray res0; + VectorizedArray val0 = shape_values[n_cols]; + if (mid > 0) + { + res0 = in[0] + in[stride*(mm-1)]; + res0 *= val0; + for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; + val1 *= val0; + res0 += val1; + } + } + else + res0 = VectorizedArray(); + if (add == false) + out[stride*n_cols] = res0; + else + out[stride*n_cols] += res0; } else if (dof_to_quad == false && nn%2 == 1) { - VectorizedArray res0; - if (mid > 0) - { - VectorizedArray val0 = shape_values[n_cols*n_q_points_1d]; - res0 = in[0] + in[stride*(mm-1)]; - res0 *= val0; - for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; - val1 *= val0; - res0 += val1; - } - if (mm % 2) - res0 += in[stride*mid]; - } - else - res0 = in[0]; - if (add == false) - out[stride*n_cols] = res0; - else - out[stride*n_cols] += res0; + VectorizedArray res0; + if (mid > 0) + { + VectorizedArray val0 = shape_values[n_cols*n_q_points_1d]; + res0 = in[0] + in[stride*(mm-1)]; + res0 *= val0; + for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; + val1 *= val0; + res0 += val1; + } + if (mm % 2) + res0 += in[stride*mid]; + } + else + res0 = in[0]; + if (add == false) + out[stride*n_cols] = res0; + else + out[stride*n_cols] += res0; } // increment: in regular case, just go to the next point in @@ -4035,16 +4035,16 @@ namespace internal switch (direction) { case 0: - in += mm; - out += nn; - break; + in += mm; + out += nn; + break; case 1: case 2: - ++in; - ++out; - break; + ++in; + ++out; + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } } if (direction == 1) @@ -4085,12 +4085,12 @@ namespace internal inline void apply_tensor_product_gradients (const VectorizedArray *shape_gradients, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = dof_to_quad ? (fe_degree+1) : n_q_points_1d, - nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); + nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); const int n_cols = nn / 2; const int mid = mm / 2; @@ -4229,12 +4229,12 @@ namespace internal inline void apply_tensor_product_hessians (const VectorizedArray *shape_hessians, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = dof_to_quad ? (fe_degree+1) : n_q_points_1d, - nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); + nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); const int n_cols = nn / 2; const int mid = mm / 2; @@ -4403,8 +4403,8 @@ namespace internal inline void apply_tensor_product_gradients_gl (const VectorizedArray *shape_gradients, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = fe_degree+1; diff --git a/deal.II/include/deal.II/matrix_free/matrix_free.templates.h b/deal.II/include/deal.II/matrix_free/matrix_free.templates.h index fb3688d3c8..f01f109faf 100644 --- a/deal.II/include/deal.II/matrix_free/matrix_free.templates.h +++ b/deal.II/include/deal.II/matrix_free/matrix_free.templates.h @@ -530,7 +530,7 @@ void MatrixFree::initialize_indices dynamic_cast,dim,dim>*> (&fe.base_element(0)); const FE_Poly >,dim,dim> *fe_poly_piece = + PiecewisePolynomial >,dim,dim> *fe_poly_piece = dynamic_cast >,dim,dim>*> (&fe.base_element(0)); diff --git a/deal.II/include/deal.II/matrix_free/shape_info.templates.h b/deal.II/include/deal.II/matrix_free/shape_info.templates.h index 9a5a0d43de..1f9147f828 100644 --- a/deal.II/include/deal.II/matrix_free/shape_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/shape_info.templates.h @@ -65,13 +65,13 @@ namespace internal const FE_Poly,dim,dim> *fe_poly = dynamic_cast,dim,dim>*>(&fe); const FE_Poly >,dim,dim> *fe_poly_piece = + PiecewisePolynomial >,dim,dim> *fe_poly_piece = dynamic_cast >,dim,dim>*> (&fe); Assert (fe_poly != 0 || fe_poly_piece, ExcNotImplemented()); lexicographic = fe_poly != 0 ? - fe_poly->get_poly_space_numbering_inverse() : - fe_poly_piece->get_poly_space_numbering_inverse(); + fe_poly->get_poly_space_numbering_inverse() : + fe_poly_piece->get_poly_space_numbering_inverse(); // to evaluate 1D polynomials, evaluate along the line where y=z=0, // assuming that shape_value(0,Point()) == 1. otherwise, need diff --git a/deal.II/include/deal.II/meshworker/dof_info.h b/deal.II/include/deal.II/meshworker/dof_info.h index 3c6ad7e539..402f7822ea 100644 --- a/deal.II/include/deal.II/meshworker/dof_info.h +++ b/deal.II/include/deal.II/meshworker/dof_info.h @@ -122,7 +122,7 @@ namespace MeshWorker * pointer empty, but setting * the #aux_local_indices. */ - DoFInfo (const DoFHandler& dof_handler); + DoFInfo (const DoFHandler &dof_handler); /** * Set the current cell and @@ -156,7 +156,7 @@ namespace MeshWorker template void set_face (const DHFaceIterator &f, const unsigned int face_no); - + /** * Switch to a new subface of the same cell. Does not change @p * indices and does not reset data in LocalResults. diff --git a/deal.II/include/deal.II/meshworker/local_integrator.h b/deal.II/include/deal.II/meshworker/local_integrator.h index 97e4920ac6..2516135024 100644 --- a/deal.II/include/deal.II/meshworker/local_integrator.h +++ b/deal.II/include/deal.II/meshworker/local_integrator.h @@ -105,7 +105,7 @@ namespace MeshWorker * is to be used in the loop. Defaults to true. */ bool use_face; - + /** * This error is thrown if one of the virtual functions cell(), * boundary(), or face() is called without being overloaded in a diff --git a/deal.II/include/deal.II/meshworker/local_results.h b/deal.II/include/deal.II/meshworker/local_results.h index 8bdc4dbd64..828632548a 100644 --- a/deal.II/include/deal.II/meshworker/local_results.h +++ b/deal.II/include/deal.II/meshworker/local_results.h @@ -325,14 +325,14 @@ namespace MeshWorker * @note This function is usually only called by the assembler. */ void initialize_numbers(const unsigned int n); - + /** * Initialize the vector with vector values. * * @note This function is usually only called by the assembler. */ void initialize_vectors(const unsigned int n); - + /** * Allocate @p n local matrices. Additionally, set their block row * and column coordinates to zero. The matrices themselves are diff --git a/deal.II/include/deal.II/meshworker/simple.h b/deal.II/include/deal.II/meshworker/simple.h index e26c92c3c2..88e201777a 100644 --- a/deal.II/include/deal.II/meshworker/simple.h +++ b/deal.II/include/deal.II/meshworker/simple.h @@ -120,8 +120,8 @@ namespace MeshWorker */ SmartPointer > constraints; }; - - + + /** * Assemble local matrices into a single global matrix. If this global * matrix has a block structure, this structure is not used, but @@ -515,8 +515,8 @@ namespace MeshWorker inline void ResidualSimple::initialize_local_blocks(const BlockIndices &) {} - - + + template template inline void @@ -540,13 +540,13 @@ namespace MeshWorker } else { - if (info.indices_by_block.size() == 0) - constraints->distribute_local_to_global(info.vector(k).block(0), info.indices, (*residuals(k))); - else - for (unsigned int i=0;i != info.vector(k).n_blocks();++i) - constraints->distribute_local_to_global(info.vector(k).block(i), info.indices_by_block[i], (*residuals(k))); - } - } + if (info.indices_by_block.size() == 0) + constraints->distribute_local_to_global(info.vector(k).block(0), info.indices, (*residuals(k))); + else + for (unsigned int i=0; i != info.vector(k).n_blocks(); ++i) + constraints->distribute_local_to_global(info.vector(k).block(i), info.indices_by_block[i], (*residuals(k))); + } + } } template @@ -566,27 +566,27 @@ namespace MeshWorker } else { - if (info1.indices_by_block.size() == 0 && info2.indices_by_block.size() == 0) - { - constraints->distribute_local_to_global - (info1.vector(k).block(0), info1.indices, (*residuals(k))); - constraints->distribute_local_to_global - (info2.vector(k).block(0), info2.indices, (*residuals(k))); - } - else if (info1.indices_by_block.size() != 0 && info2.indices_by_block.size() != 0) - { - for (unsigned int i=0;idistribute_local_to_global - (info1.vector(k).block(i), info1.indices_by_block[i], (*residuals(k))); - constraints->distribute_local_to_global - (info2.vector(k).block(i), info2.indices_by_block[i], (*residuals(k))); - } - } - else - { - Assert(false, ExcNotImplemented()); - } + if (info1.indices_by_block.size() == 0 && info2.indices_by_block.size() == 0) + { + constraints->distribute_local_to_global + (info1.vector(k).block(0), info1.indices, (*residuals(k))); + constraints->distribute_local_to_global + (info2.vector(k).block(0), info2.indices, (*residuals(k))); + } + else if (info1.indices_by_block.size() != 0 && info2.indices_by_block.size() != 0) + { + for (unsigned int i=0; idistribute_local_to_global + (info1.vector(k).block(i), info1.indices_by_block[i], (*residuals(k))); + constraints->distribute_local_to_global + (info2.vector(k).block(i), info2.indices_by_block[i], (*residuals(k))); + } + } + else + { + Assert(false, ExcNotImplemented()); + } } } } @@ -726,9 +726,9 @@ namespace MeshWorker info2.indices_by_block[row], info1.indices_by_block[column]); } else - { - Assert(false, ExcNotImplemented()); - } + { + Assert(false, ExcNotImplemented()); + } } @@ -971,17 +971,17 @@ namespace MeshWorker for (unsigned int j=0; j= threshold) - // Enter values into matrix only if j corresponds to a - // degree of freedom on the refinemenent edge, k does - // not, and both are not on the boundary. This is part - // the difference between the complete matrix with no - // boundary condition at the refinement edge and and - // the matrix assembled above by assemble(). - - // Thus the logic is: enter the row if it is - // constrained by hanging node constraints (actually, - // the whole refinement edge), but not if it is - // constrained by a boundary constraint. + // Enter values into matrix only if j corresponds to a + // degree of freedom on the refinemenent edge, k does + // not, and both are not on the boundary. This is part + // the difference between the complete matrix with no + // boundary condition at the refinement edge and and + // the matrix assembled above by assemble(). + + // Thus the logic is: enter the row if it is + // constrained by hanging node constraints (actually, + // the whole refinement edge), but not if it is + // constrained by a boundary constraint. if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && !mg_constrained_dofs->at_refinement_edge(level, i2[k])) { diff --git a/deal.II/include/deal.II/multigrid/mg_coarse.h b/deal.II/include/deal.II/multigrid/mg_coarse.h index 801fac7f88..d586cf353a 100644 --- a/deal.II/include/deal.II/multigrid/mg_coarse.h +++ b/deal.II/include/deal.II/multigrid/mg_coarse.h @@ -313,9 +313,9 @@ MGCoarseGridHouseholder::initialize( template void MGCoarseGridHouseholder::operator() ( - const unsigned int /*level*/, - VECTOR &dst, - const VECTOR &src) const + const unsigned int /*level*/, + VECTOR &dst, + const VECTOR &src) const { householder.least_squares(dst, src); } @@ -344,9 +344,9 @@ MGCoarseGridSVD::initialize( template void MGCoarseGridSVD::operator() ( - const unsigned int /*level*/, - VECTOR &dst, - const VECTOR &src) const + const unsigned int /*level*/, + VECTOR &dst, + const VECTOR &src) const { matrix.vmult(dst, src); } diff --git a/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h b/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h index c965d1cb73..85389cdffa 100644 --- a/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h +++ b/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h @@ -40,7 +40,7 @@ template struct FunctionMap; class MGConstrainedDoFs : public Subscriptor { public: - + typedef std::vector >::size_type size_dof; /** * Fill the internal data diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.h b/deal.II/include/deal.II/multigrid/mg_transfer.h index 6b438a1632..6d869a3720 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.h @@ -48,9 +48,9 @@ namespace internal { typedef ::dealii::SparsityPattern Sparsity; typedef ::dealii::SparseMatrix Matrix; - + template - static void reinit(Matrix& matrix, Sparsity& sparsity, int level, const CSP& csp, const DH&) + static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const CSP &csp, const DH &) { sparsity.copy_from (csp); matrix.reinit (sparsity); @@ -63,15 +63,15 @@ namespace internal { typedef ::dealii::TrilinosWrappers::SparsityPattern Sparsity; typedef ::dealii::TrilinosWrappers::SparseMatrix Matrix; - + template - static void reinit(Matrix& matrix, Sparsity& sparsity, int level, const CSP& csp, DH& dh) + static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const CSP &csp, DH &dh) { matrix.reinit(dh.locally_owned_mg_dofs(level+1), - dh.locally_owned_mg_dofs(level), - csp, MPI_COMM_WORLD, true); + dh.locally_owned_mg_dofs(level), + csp, MPI_COMM_WORLD, true); } - + }; template <> @@ -79,9 +79,9 @@ namespace internal { typedef ::dealii::TrilinosWrappers::SparsityPattern Sparsity; typedef ::dealii::TrilinosWrappers::SparseMatrix Matrix; - + template - static void reinit(Matrix& matrix, Sparsity& sparsity, int level, const CSP& csp, DH& dh) + static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const CSP &csp, DH &dh) { } }; @@ -235,17 +235,17 @@ public: * Memory used by this object. */ std::size_t memory_consumption () const; - + /** * Print all the matrices for debugging purposes. */ - void print_matrices(std::ostream& os) const; + void print_matrices(std::ostream &os) const; /** * Print the copy index fields for debugging purposes. */ - void print_indices(std::ostream& os) const; - + void print_indices(std::ostream &os) const; + private: /** @@ -268,7 +268,7 @@ private: /** * Mapping for the copy_to_mg() and copy_from_mg() functions. Here only * index pairs locally owned - * + * * The data is organized as follows: one vector per level. Each * element of these vectors contains first the global index, then * the level index. @@ -295,7 +295,7 @@ private: */ std::vector > > copy_indices_from_me; - + /** * The vector that stores what diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h index fd2c6d1c2d..59e3cde2c1 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h @@ -203,24 +203,24 @@ MGTransferPrebuilt::copy_from_mg( // First copy all indices local to this process if (constraints==0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) = src[level](i->second); + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) = src[level](i->second); else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); - + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + // Do the same for the indices where the level index is local, // but the global index is not if (constraints==0) - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - dst(i->first) = src[level](i->second); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) = src[level](i->second); else - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); } } @@ -245,24 +245,24 @@ MGTransferPrebuilt::copy_from_mg_add ( { typedef std::vector >::const_iterator IT; if (constraints==0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) += src[level](i->second); + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) += src[level](i->second); else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); - + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + // Do the same for the indices where the level index is local, // but the global index is not if (constraints==0) - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - dst(i->first) += src[level](i->second); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) += src[level](i->second); else - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); } } diff --git a/deal.II/include/deal.II/numerics/fe_field_function.templates.h b/deal.II/include/deal.II/numerics/fe_field_function.templates.h index a1464cd12d..93824a0f03 100644 --- a/deal.II/include/deal.II/numerics/fe_field_function.templates.h +++ b/deal.II/include/deal.II/numerics/fe_field_function.templates.h @@ -66,16 +66,16 @@ namespace Functions typename DH::active_cell_iterator cell = cell_hint.get(); if (cell == dh->end()) cell = dh->begin_active(); - + boost::optional > qp = get_reference_coordinates (cell, p); if (!qp) { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; } @@ -124,9 +124,9 @@ namespace Functions { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; } @@ -177,9 +177,9 @@ namespace Functions { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; } @@ -445,9 +445,9 @@ namespace Functions const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[0]); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; point_flags[0] = true; @@ -509,9 +509,9 @@ namespace Functions { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[first_outside]); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cells.push_back(my_pair.first); qpoints.push_back(std::vector >(1, my_pair.second)); maps.push_back(std::vector(1, first_outside)); diff --git a/deal.II/include/deal.II/numerics/vector_tools.templates.h b/deal.II/include/deal.II/numerics/vector_tools.templates.h index 10d5e12f12..a38d7b3750 100644 --- a/deal.II/include/deal.II/numerics/vector_tools.templates.h +++ b/deal.II/include/deal.II/numerics/vector_tools.templates.h @@ -623,7 +623,7 @@ namespace VectorTools // interpolate the boundary values and then condense the matrix and vector if (constraints_are_compatible) { - const Function* dummy = 0; + const Function *dummy = 0; MatrixCreator::create_mass_matrix (mapping, dof, quadrature, mass_matrix, function, tmp, dummy, constraints); @@ -5429,7 +5429,7 @@ namespace VectorTools subtract_mean_value(VECTOR &v, const std::vector &p_select) { - if(p_select.size() == 0) + if (p_select.size() == 0) { // In case of an empty boolean mask operate on the whole vector: v.add( - v.mean_value() ); @@ -5439,12 +5439,12 @@ namespace VectorTools // This function is not implemented for distributed vectors, so // if v is not a boring Vector or BlockVector: Assert( dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v), - ExcNotImplemented()); + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v), + ExcNotImplemented()); const unsigned int n = v.size(); diff --git a/deal.II/source/base/auto_derivative_function.cc b/deal.II/source/base/auto_derivative_function.cc index 9c404d76e9..7788498ea0 100644 --- a/deal.II/source/base/auto_derivative_function.cc +++ b/deal.II/source/base/auto_derivative_function.cc @@ -166,7 +166,7 @@ vector_gradient (const Point &p, Point q1, q2, q3, q4; Vector v1(this->n_components), v2(this->n_components), - v3(this->n_components), v4(this->n_components); + v3(this->n_components), v4(this->n_components); const double h_inv_12=1./(12*h); for (unsigned int i=0; i DataOutBase::svg_get_gradient_parameters(Point<3> points[]) int i, j; for (i = 0; i < 2; ++i) - { - for (j = 0; j < 2-i; ++j) { - if (points[j][2] > points[j + 1][2]) - { - Point<3> temp = points[j]; - points[j] = points[j+1]; - points[j+1] = temp; - } + for (j = 0; j < 2-i; ++j) + { + if (points[j][2] > points[j + 1][2]) + { + Point<3> temp = points[j]; + points[j] = points[j+1]; + points[j+1] = temp; + } + } } - } // save the related three-dimensional vectors v_min, v_inter, and v_max v_min = points[0]; @@ -2578,47 +2578,47 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) bool col_change = false; if (A[0][0] == 0) - { - col_change = true; + { + col_change = true; - A[0][0] = A[0][1]; - A[0][1] = 0; + A[0][0] = A[0][1]; + A[0][1] = 0; - double temp = A[1][0]; - A[1][0] = A[1][1]; - A[1][1] = temp; - } + double temp = A[1][0]; + A[1][0] = A[1][1]; + A[1][1] = temp; + } - for (unsigned int k = 0; k < 1; k++) - { - for (unsigned int i = k+1; i < 2; i++) + for (unsigned int k = 0; k < 1; k++) { - x = A[i][k] / A[k][k]; + for (unsigned int i = k+1; i < 2; i++) + { + x = A[i][k] / A[k][k]; - for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; + for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; - b[i] = b[i] - b[k]*x; + b[i] = b[i] - b[k]*x; + } } - } b[1] = b[1] / A[1][1]; - for (int i = 0; i >= 0; i--) - { - sum = b[i]; + for (int i = 0; i >= 0; i--) + { + sum = b[i]; - for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; + for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; - b[i] = sum / A[i][i]; - } + b[i] = sum / A[i][i]; + } if (col_change) - { - double temp = b[0]; - b[0] = b[1]; - b[1] = temp; - } + { + double temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } double c = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) + v_min[2]; @@ -2634,47 +2634,47 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) col_change = false; if (A[0][0] == 0) - { - col_change = true; + { + col_change = true; - A[0][0] = A[0][1]; - A[0][1] = 0; + A[0][0] = A[0][1]; + A[0][1] = 0; - double temp = A[1][0]; - A[1][0] = A[1][1]; - A[1][1] = temp; - } + double temp = A[1][0]; + A[1][0] = A[1][1]; + A[1][1] = temp; + } - for (unsigned int k = 0; k < 1; k++) - { - for (unsigned int i = k+1; i < 2; i++) + for (unsigned int k = 0; k < 1; k++) { - x = A[i][k] / A[k][k]; + for (unsigned int i = k+1; i < 2; i++) + { + x = A[i][k] / A[k][k]; - for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; + for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; - b[i] = b[i] - b[k] * x; + b[i] = b[i] - b[k] * x; + } } - } b[1]=b[1] / A[1][1]; - for (int i = 0; i >= 0; i--) - { - sum = b[i]; + for (int i = 0; i >= 0; i--) + { + sum = b[i]; - for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j]*b[j]; + for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j]*b[j]; - b[i] = sum / A[i][i]; - } + b[i] = sum / A[i][i]; + } if (col_change) - { - double temp = b[0]; - b[0] = b[1]; - b[1] = temp; - } + { + double temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } gradient[0] = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) - c + v_min[2]; @@ -2690,46 +2690,46 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) col_change = false; if (A[0][0] == 0) - { - col_change = true; + { + col_change = true; - A[0][0] = A[0][1]; - A[0][1] = 0; + A[0][0] = A[0][1]; + A[0][1] = 0; - double temp = A[1][0]; - A[1][0] = A[1][1]; - A[1][1] = temp; - } + double temp = A[1][0]; + A[1][0] = A[1][1]; + A[1][1] = temp; + } - for (unsigned int k = 0; k < 1; k++) - { - for (unsigned int i = k+1; i < 2; i++) + for (unsigned int k = 0; k < 1; k++) { - x = A[i][k] / A[k][k]; + for (unsigned int i = k+1; i < 2; i++) + { + x = A[i][k] / A[k][k]; - for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; + for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; - b[i] = b[i] - b[k] * x; + b[i] = b[i] - b[k] * x; + } } - } b[1] = b[1] / A[1][1]; - for (int i = 0; i >= 0; i--) - { - sum = b[i]; + for (int i = 0; i >= 0; i--) + { + sum = b[i]; - for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; + for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; - b[i] = sum / A[i][i]; - } + b[i] = sum / A[i][i]; + } if (col_change) - { - double temp = b[0]; - b[0] = b[1]; - b[1] = temp; - } + { + double temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } gradient[1] = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) - c + v_min[2]; @@ -2744,7 +2744,7 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) gradient_parameters[0] = v_min[0]; gradient_parameters[1] = v_min[1]; - + gradient_parameters[2] = v_min[0] + lambda * gradient[0]; gradient_parameters[3] = v_min[1] + lambda * gradient[1]; @@ -5333,7 +5333,7 @@ void DataOutBase::write_vtu_main (const std::vector > &patch if (n_metadata > 0) out << "\n"; -} + } VtuStream vtu_out(out, flags); @@ -5606,7 +5606,7 @@ void DataOutBase::write_svg (const std::vector > &patches, // margin around the plotted area unsigned int margin_in_percent = 0; - if(flags.margin) margin_in_percent = 5; + if (flags.margin) margin_in_percent = 5; // determine the bounding box in the model space @@ -5627,8 +5627,8 @@ void DataOutBase::write_svg (const std::vector > &patches, Point<2> projection_decomposition; Point<2> projection_decompositions[4]; - compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); - + compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); + Assert ((flags.height_vector < patch->data.n_rows()) || patch->data.n_rows() == 0, ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); @@ -5642,55 +5642,55 @@ void DataOutBase::write_svg (const std::vector > &patches, // iterate over the patches for (; patch != patches.end(); ++patch) - { - n_subdivisions = patch->n_subdivisions; - n = n_subdivisions + 1; + { + n_subdivisions = patch->n_subdivisions; + n = n_subdivisions + 1; - for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) - { - for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) - { - compute_node(projected_points[0], &*patch, i1, i2, 0, n_subdivisions); - compute_node(projected_points[1], &*patch, i1+1, i2, 0, n_subdivisions); - compute_node(projected_points[2], &*patch, i1, i2+1, 0, n_subdivisions); - compute_node(projected_points[3], &*patch, i1+1, i2+1, 0, n_subdivisions); - - x_min = std::min(x_min, (double)projected_points[0][0]); - x_min = std::min(x_min, (double)projected_points[1][0]); - x_min = std::min(x_min, (double)projected_points[2][0]); - x_min = std::min(x_min, (double)projected_points[3][0]); - - x_max = std::max(x_max, (double)projected_points[0][0]); - x_max = std::max(x_max, (double)projected_points[1][0]); - x_max = std::max(x_max, (double)projected_points[2][0]); - x_max = std::max(x_max, (double)projected_points[3][0]); - - y_min = std::min(y_min, (double)projected_points[0][1]); - y_min = std::min(y_min, (double)projected_points[1][1]); - y_min = std::min(y_min, (double)projected_points[2][1]); - y_min = std::min(y_min, (double)projected_points[3][1]); - - y_max = std::max(y_max, (double)projected_points[0][1]); - y_max = std::max(y_max, (double)projected_points[1][1]); - y_max = std::max(y_max, (double)projected_points[2][1]); - y_max = std::max(y_max, (double)projected_points[3][1]); - - Assert ((flags.height_vector < patch->data.n_rows()) || - patch->data.n_rows() == 0, - ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); - - z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); - z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); - z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); - z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); - - z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); - z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); - z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); - z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); - } + for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) + { + for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) + { + compute_node(projected_points[0], &*patch, i1, i2, 0, n_subdivisions); + compute_node(projected_points[1], &*patch, i1+1, i2, 0, n_subdivisions); + compute_node(projected_points[2], &*patch, i1, i2+1, 0, n_subdivisions); + compute_node(projected_points[3], &*patch, i1+1, i2+1, 0, n_subdivisions); + + x_min = std::min(x_min, (double)projected_points[0][0]); + x_min = std::min(x_min, (double)projected_points[1][0]); + x_min = std::min(x_min, (double)projected_points[2][0]); + x_min = std::min(x_min, (double)projected_points[3][0]); + + x_max = std::max(x_max, (double)projected_points[0][0]); + x_max = std::max(x_max, (double)projected_points[1][0]); + x_max = std::max(x_max, (double)projected_points[2][0]); + x_max = std::max(x_max, (double)projected_points[3][0]); + + y_min = std::min(y_min, (double)projected_points[0][1]); + y_min = std::min(y_min, (double)projected_points[1][1]); + y_min = std::min(y_min, (double)projected_points[2][1]); + y_min = std::min(y_min, (double)projected_points[3][1]); + + y_max = std::max(y_max, (double)projected_points[0][1]); + y_max = std::max(y_max, (double)projected_points[1][1]); + y_max = std::max(y_max, (double)projected_points[2][1]); + y_max = std::max(y_max, (double)projected_points[3][1]); + + Assert ((flags.height_vector < patch->data.n_rows()) || + patch->data.n_rows() == 0, + ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); + + z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); + z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); + z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); + z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); + + z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); + z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); + z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); + z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); + } + } } - } x_dimension = x_max - x_min; y_dimension = y_max - y_min; @@ -5770,7 +5770,7 @@ void DataOutBase::write_svg (const std::vector > &patches, camera_position[1] -= (z_min + 2. * z_dimension) * sin(angle_factor * flags.polar_angle) * cos(angle_factor * flags.azimuth_angle); -// determine the bounding box on the projection plane +// determine the bounding box on the projection plane double x_min_perspective, y_min_perspective; double x_max_perspective, y_max_perspective; double x_dimension_perspective, y_dimension_perspective; @@ -5782,8 +5782,8 @@ void DataOutBase::write_svg (const std::vector > &patches, Point<3> point(true); - compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); - + compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); + Assert ((flags.height_vector < patch->data.n_rows()) || patch->data.n_rows() == 0, ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); @@ -5801,69 +5801,69 @@ void DataOutBase::write_svg (const std::vector > &patches, // iterate over the patches for (; patch != patches.end(); ++patch) - { - n_subdivisions = patch->n_subdivisions; - n = n_subdivisions + 1; + { + n_subdivisions = patch->n_subdivisions; + n = n_subdivisions + 1; - for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) - { - for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) - { - Point projected_vertices[4]; - Point<3> vertices[4]; - - compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); - compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); - compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); - compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); - - Assert ((flags.height_vector < patch->data.n_rows()) || - patch->data.n_rows() == 0, - ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); - - vertices[0][0] = projected_vertices[0][0]; - vertices[0][1] = projected_vertices[0][1]; - vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; - - vertices[1][0] = projected_vertices[1][0]; - vertices[1][1] = projected_vertices[1][1]; - vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; - - vertices[2][0] = projected_vertices[2][0]; - vertices[2][1] = projected_vertices[2][1]; - vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; - - vertices[3][0] = projected_vertices[3][0]; - vertices[3][1] = projected_vertices[3][1]; - vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; - - projection_decompositions[0] = svg_project_point(vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); - projection_decompositions[1] = svg_project_point(vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); - projection_decompositions[2] = svg_project_point(vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); - projection_decompositions[3] = svg_project_point(vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); - - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[0][0]); - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[1][0]); - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[2][0]); - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[3][0]); - - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[0][0]); - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[1][0]); - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[2][0]); - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[3][0]); - - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[0][1]); - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[1][1]); - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[2][1]); - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[3][1]); - - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[0][1]); - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[1][1]); - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[2][1]); - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[3][1]); - } + for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) + { + for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) + { + Point projected_vertices[4]; + Point<3> vertices[4]; + + compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); + compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); + compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); + compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); + + Assert ((flags.height_vector < patch->data.n_rows()) || + patch->data.n_rows() == 0, + ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); + + vertices[0][0] = projected_vertices[0][0]; + vertices[0][1] = projected_vertices[0][1]; + vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; + + vertices[1][0] = projected_vertices[1][0]; + vertices[1][1] = projected_vertices[1][1]; + vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; + + vertices[2][0] = projected_vertices[2][0]; + vertices[2][1] = projected_vertices[2][1]; + vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; + + vertices[3][0] = projected_vertices[3][0]; + vertices[3][1] = projected_vertices[3][1]; + vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; + + projection_decompositions[0] = svg_project_point(vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); + projection_decompositions[1] = svg_project_point(vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); + projection_decompositions[2] = svg_project_point(vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); + projection_decompositions[3] = svg_project_point(vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); + + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[0][0]); + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[1][0]); + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[2][0]); + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[3][0]); + + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[0][0]); + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[1][0]); + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[2][0]); + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[3][0]); + + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[0][1]); + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[1][1]); + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[2][1]); + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[3][1]); + + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[0][1]); + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[1][1]); + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[2][1]); + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[3][1]); + } + } } - } x_dimension_perspective = x_max_perspective - x_min_perspective; y_dimension_perspective = y_max_perspective - y_min_perspective; @@ -5872,290 +5872,360 @@ void DataOutBase::write_svg (const std::vector > &patches, // iterate over the patches for (patch = patches.begin(); patch != patches.end(); ++patch) - { - n_subdivisions = patch->n_subdivisions; - n = n_subdivisions + 1; + { + n_subdivisions = patch->n_subdivisions; + n = n_subdivisions + 1; - for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) - { - for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) - { - Point projected_vertices[4]; - SvgCell cell; - - compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); - compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); - compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); - compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); - - Assert ((flags.height_vector < patch->data.n_rows()) || - patch->data.n_rows() == 0, - ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); - - cell.vertices[0][0] = projected_vertices[0][0]; - cell.vertices[0][1] = projected_vertices[0][1]; - cell.vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; - - cell.vertices[1][0] = projected_vertices[1][0]; - cell.vertices[1][1] = projected_vertices[1][1]; - cell.vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; - - cell.vertices[2][0] = projected_vertices[2][0]; - cell.vertices[2][1] = projected_vertices[2][1]; - cell.vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; - - cell.vertices[3][0] = projected_vertices[3][0]; - cell.vertices[3][1] = projected_vertices[3][1]; - cell.vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; - - cell.projected_vertices[0] = svg_project_point(cell.vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); - cell.projected_vertices[1] = svg_project_point(cell.vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); - cell.projected_vertices[2] = svg_project_point(cell.vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); - cell.projected_vertices[3] = svg_project_point(cell.vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); - - cell.center = .25 * (cell.vertices[0] + cell.vertices[1] + cell.vertices[2] + cell.vertices[3]); - cell.projected_center = svg_project_point(cell.center, camera_position, camera_direction, camera_horizontal, camera_focus); - - cell.depth = cell.center.distance(camera_position); - - cells.insert(cell); - } + for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) + { + for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) + { + Point projected_vertices[4]; + SvgCell cell; + + compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); + compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); + compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); + compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); + + Assert ((flags.height_vector < patch->data.n_rows()) || + patch->data.n_rows() == 0, + ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); + + cell.vertices[0][0] = projected_vertices[0][0]; + cell.vertices[0][1] = projected_vertices[0][1]; + cell.vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; + + cell.vertices[1][0] = projected_vertices[1][0]; + cell.vertices[1][1] = projected_vertices[1][1]; + cell.vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; + + cell.vertices[2][0] = projected_vertices[2][0]; + cell.vertices[2][1] = projected_vertices[2][1]; + cell.vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; + + cell.vertices[3][0] = projected_vertices[3][0]; + cell.vertices[3][1] = projected_vertices[3][1]; + cell.vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; + + cell.projected_vertices[0] = svg_project_point(cell.vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); + cell.projected_vertices[1] = svg_project_point(cell.vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); + cell.projected_vertices[2] = svg_project_point(cell.vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); + cell.projected_vertices[3] = svg_project_point(cell.vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); + + cell.center = .25 * (cell.vertices[0] + cell.vertices[1] + cell.vertices[2] + cell.vertices[3]); + cell.projected_center = svg_project_point(cell.center, camera_position, camera_direction, camera_horizontal, camera_focus); + + cell.depth = cell.center.distance(camera_position); + + cells.insert(cell); + } + } } - } // write the svg file width = static_cast(.5 + height * (x_dimension_perspective / y_dimension_perspective)); unsigned int additional_width = 0; - if(flags.draw_colorbar) additional_width = static_cast(.5 + height * .3); // additional width for colorbar - + if (flags.draw_colorbar) additional_width = static_cast(.5 + height * .3); // additional width for colorbar + // basic svg header and background rectangle - out << "" << '\n' + out << "" << '\n' << " " << '\n' << '\n'; unsigned int triangle_counter = 0; - + // write the cells in the correct order for (typename std::multiset::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) - { - Point<3> points3d_triangle[3]; - - for (unsigned int triangle_index = 0; triangle_index < 4; triangle_index++) { - switch (triangle_index) - { - case 0: points3d_triangle[0] = cell->vertices[0], points3d_triangle[1] = cell->vertices[1], points3d_triangle[2] = cell->center; break; - case 1: points3d_triangle[0] = cell->vertices[1], points3d_triangle[1] = cell->vertices[3], points3d_triangle[2] = cell->center; break; - case 2: points3d_triangle[0] = cell->vertices[3], points3d_triangle[1] = cell->vertices[2], points3d_triangle[2] = cell->center; break; - case 3: points3d_triangle[0] = cell->vertices[2], points3d_triangle[1] = cell->vertices[0], points3d_triangle[2] = cell->center; break; - default: break; - } + Point<3> points3d_triangle[3]; - Point<6> gradient_param = svg_get_gradient_parameters(points3d_triangle); + for (unsigned int triangle_index = 0; triangle_index < 4; triangle_index++) + { + switch (triangle_index) + { + case 0: + points3d_triangle[0] = cell->vertices[0], points3d_triangle[1] = cell->vertices[1], points3d_triangle[2] = cell->center; + break; + case 1: + points3d_triangle[0] = cell->vertices[1], points3d_triangle[1] = cell->vertices[3], points3d_triangle[2] = cell->center; + break; + case 2: + points3d_triangle[0] = cell->vertices[3], points3d_triangle[1] = cell->vertices[2], points3d_triangle[2] = cell->center; + break; + case 3: + points3d_triangle[0] = cell->vertices[2], points3d_triangle[1] = cell->vertices[0], points3d_triangle[2] = cell->center; + break; + default: + break; + } - double start_h = .667 - ((gradient_param[4] - z_min) / z_dimension) * .667; - double stop_h = .667 - ((gradient_param[5] - z_min) / z_dimension) * .667; + Point<6> gradient_param = svg_get_gradient_parameters(points3d_triangle); - unsigned int start_r = 0; - unsigned int start_g = 0; - unsigned int start_b = 0; + double start_h = .667 - ((gradient_param[4] - z_min) / z_dimension) * .667; + double stop_h = .667 - ((gradient_param[5] - z_min) / z_dimension) * .667; - unsigned int stop_r = 0; - unsigned int stop_g = 0; - unsigned int stop_b = 0; + unsigned int start_r = 0; + unsigned int start_g = 0; + unsigned int start_b = 0; - unsigned int start_i = static_cast(start_h * 6.); - unsigned int stop_i = static_cast(stop_h * 6.); + unsigned int stop_r = 0; + unsigned int stop_g = 0; + unsigned int stop_b = 0; - double start_f = start_h * 6. - start_i; - double start_q = 1. - start_f; + unsigned int start_i = static_cast(start_h * 6.); + unsigned int stop_i = static_cast(stop_h * 6.); - double stop_f = stop_h * 6. - stop_i; - double stop_q = 1. - stop_f; + double start_f = start_h * 6. - start_i; + double start_q = 1. - start_f; - switch (start_i % 6) - { - case 0: start_r = 255, start_g = static_cast(.5 + 255. * start_f); break; - case 1: start_r = static_cast(.5 + 255. * start_q), start_g = 255; break; - case 2: start_g = 255, start_b = static_cast(.5 + 255. * start_f); break; - case 3: start_g = static_cast(.5 + 255. * start_q), start_b = 255; break; - case 4: start_r = static_cast(.5 + 255. * start_f), start_b = 255; break; - case 5: start_r = 255, start_b = static_cast(.5 + 255. * start_q); break; - default: break; - } + double stop_f = stop_h * 6. - stop_i; + double stop_q = 1. - stop_f; - switch (stop_i % 6) - { - case 0: stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); break; - case 1: stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; break; - case 2: stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); break; - case 3: stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; break; - case 4: stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; break; - case 5: stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); break; - default: break; - } + switch (start_i % 6) + { + case 0: + start_r = 255, start_g = static_cast(.5 + 255. * start_f); + break; + case 1: + start_r = static_cast(.5 + 255. * start_q), start_g = 255; + break; + case 2: + start_g = 255, start_b = static_cast(.5 + 255. * start_f); + break; + case 3: + start_g = static_cast(.5 + 255. * start_q), start_b = 255; + break; + case 4: + start_r = static_cast(.5 + 255. * start_f), start_b = 255; + break; + case 5: + start_r = 255, start_b = static_cast(.5 + 255. * start_q); + break; + default: + break; + } - Point<3> gradient_start_point_3d, gradient_stop_point_3d; - - gradient_start_point_3d[0] = gradient_param[0]; - gradient_start_point_3d[1] = gradient_param[1]; - gradient_start_point_3d[2] = gradient_param[4]; - - gradient_stop_point_3d[0] = gradient_param[2]; - gradient_stop_point_3d[1] = gradient_param[3]; - gradient_stop_point_3d[2] = gradient_param[5]; - - Point<2> gradient_start_point = svg_project_point(gradient_start_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); - Point<2> gradient_stop_point = svg_project_point(gradient_stop_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); - - // define linear gradient - out << " (.5 + ((gradient_start_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << "\" " - << "y1=\"" - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_start_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << "\" " - << "x2=\"" - << static_cast(.5 + ((gradient_stop_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << "\" " - << "y2=\"" - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_stop_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << "\"" - << ">" << '\n' - << " " << '\n' - << " " << '\n' - << " " << '\n'; - - // draw current triangle - double x1 = 0, y1 = 0, x2 = 0, y2 = 0; - double x3 = cell->projected_center[0]; - double y3 = cell->projected_center[1]; - - switch (triangle_index) - { - case 0: x1 = cell->projected_vertices[0][0], y1 = cell->projected_vertices[0][1], x2 = cell->projected_vertices[1][0], y2 = cell->projected_vertices[1][1]; break; - case 1: x1 = cell->projected_vertices[1][0], y1 = cell->projected_vertices[1][1], x2 = cell->projected_vertices[3][0], y2 = cell->projected_vertices[3][1]; break; - case 2: x1 = cell->projected_vertices[3][0], y1 = cell->projected_vertices[3][1], x2 = cell->projected_vertices[2][0], y2 = cell->projected_vertices[2][1]; break; - case 3: x1 = cell->projected_vertices[2][0], y1 = cell->projected_vertices[2][1], x2 = cell->projected_vertices[0][0], y2 = cell->projected_vertices[0][1]; break; - default: break; - } + switch (stop_i % 6) + { + case 0: + stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); + break; + case 1: + stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; + break; + case 2: + stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); + break; + case 3: + stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; + break; + case 4: + stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; + break; + case 5: + stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); + break; + default: + break; + } - out << " (.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast(.5 + ((x2 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y2 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast(.5 + ((x3 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y3 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << "\" style=\"stroke:black; fill:url(#" << triangle_counter << "); stroke-width:" << flags.line_thickness << "\"/>" << '\n'; - - triangle_counter++; + Point<3> gradient_start_point_3d, gradient_stop_point_3d; + + gradient_start_point_3d[0] = gradient_param[0]; + gradient_start_point_3d[1] = gradient_param[1]; + gradient_start_point_3d[2] = gradient_param[4]; + + gradient_stop_point_3d[0] = gradient_param[2]; + gradient_stop_point_3d[1] = gradient_param[3]; + gradient_stop_point_3d[2] = gradient_param[5]; + + Point<2> gradient_start_point = svg_project_point(gradient_start_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); + Point<2> gradient_stop_point = svg_project_point(gradient_stop_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); + + // define linear gradient + out << " (.5 + ((gradient_start_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << "\" " + << "y1=\"" + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_start_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << "\" " + << "x2=\"" + << static_cast(.5 + ((gradient_stop_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << "\" " + << "y2=\"" + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_stop_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << "\"" + << ">" << '\n' + << " " << '\n' + << " " << '\n' + << " " << '\n'; + + // draw current triangle + double x1 = 0, y1 = 0, x2 = 0, y2 = 0; + double x3 = cell->projected_center[0]; + double y3 = cell->projected_center[1]; + + switch (triangle_index) + { + case 0: + x1 = cell->projected_vertices[0][0], y1 = cell->projected_vertices[0][1], x2 = cell->projected_vertices[1][0], y2 = cell->projected_vertices[1][1]; + break; + case 1: + x1 = cell->projected_vertices[1][0], y1 = cell->projected_vertices[1][1], x2 = cell->projected_vertices[3][0], y2 = cell->projected_vertices[3][1]; + break; + case 2: + x1 = cell->projected_vertices[3][0], y1 = cell->projected_vertices[3][1], x2 = cell->projected_vertices[2][0], y2 = cell->projected_vertices[2][1]; + break; + case 3: + x1 = cell->projected_vertices[2][0], y1 = cell->projected_vertices[2][1], x2 = cell->projected_vertices[0][0], y2 = cell->projected_vertices[0][1]; + break; + default: + break; + } + + out << " (.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast(.5 + ((x2 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y2 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast(.5 + ((x3 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y3 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << "\" style=\"stroke:black; fill:url(#" << triangle_counter << "); stroke-width:" << flags.line_thickness << "\"/>" << '\n'; + + triangle_counter++; + } } - } // draw the colorbar if (flags.draw_colorbar) - { - out << '\n' << " " << '\n'; + { + out << '\n' << " " << '\n'; - unsigned int element_height = static_cast(((height/100.) * (71. - 2.*margin_in_percent)) / 4); - unsigned int element_width = static_cast(.5 + (height/100.) * 2.5); + unsigned int element_height = static_cast(((height/100.) * (71. - 2.*margin_in_percent)) / 4); + unsigned int element_width = static_cast(.5 + (height/100.) * 2.5); - additional_width = 0; - if (!flags.margin) additional_width = static_cast(.5 + (height/100.) * 2.5); + additional_width = 0; + if (!flags.margin) additional_width = static_cast(.5 + (height/100.) * 2.5); - for (unsigned int index = 0; index < 4; index++) - { - double start_h = .667 - ((index+1) / 4.) * .667; - double stop_h = .667 - (index / 4.) * .667; + for (unsigned int index = 0; index < 4; index++) + { + double start_h = .667 - ((index+1) / 4.) * .667; + double stop_h = .667 - (index / 4.) * .667; - unsigned int start_r = 0; - unsigned int start_g = 0; - unsigned int start_b = 0; + unsigned int start_r = 0; + unsigned int start_g = 0; + unsigned int start_b = 0; - unsigned int stop_r = 0; - unsigned int stop_g = 0; - unsigned int stop_b = 0; + unsigned int stop_r = 0; + unsigned int stop_g = 0; + unsigned int stop_b = 0; - unsigned int start_i = static_cast(start_h * 6.); - unsigned int stop_i = static_cast(stop_h * 6.); + unsigned int start_i = static_cast(start_h * 6.); + unsigned int stop_i = static_cast(stop_h * 6.); - double start_f = start_h * 6. - start_i; - double start_q = 1. - start_f; + double start_f = start_h * 6. - start_i; + double start_q = 1. - start_f; - double stop_f = stop_h * 6. - stop_i; - double stop_q = 1. - stop_f; + double stop_f = stop_h * 6. - stop_i; + double stop_q = 1. - stop_f; - switch (start_i % 6) - { - case 0: start_r = 255, start_g = static_cast(.5 + 255. * start_f); break; - case 1: start_r = static_cast(.5 + 255. * start_q), start_g = 255; break; - case 2: start_g = 255, start_b = static_cast(.5 + 255. * start_f); break; - case 3: start_g = static_cast(.5 + 255. * start_q), start_b = 255; break; - case 4: start_r = static_cast(.5 + 255. * start_f), start_b = 255; break; - case 5: start_r = 255, start_b = static_cast(.5 + 255. * start_q); break; - default: break; - } + switch (start_i % 6) + { + case 0: + start_r = 255, start_g = static_cast(.5 + 255. * start_f); + break; + case 1: + start_r = static_cast(.5 + 255. * start_q), start_g = 255; + break; + case 2: + start_g = 255, start_b = static_cast(.5 + 255. * start_f); + break; + case 3: + start_g = static_cast(.5 + 255. * start_q), start_b = 255; + break; + case 4: + start_r = static_cast(.5 + 255. * start_f), start_b = 255; + break; + case 5: + start_r = 255, start_b = static_cast(.5 + 255. * start_q); + break; + default: + break; + } - switch (stop_i % 6) - { - case 0: stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); break; - case 1: stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; break; - case 2: stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); break; - case 3: stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; break; - case 4: stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; break; - case 5: stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); break; - default: break; - } + switch (stop_i % 6) + { + case 0: + stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); + break; + case 1: + stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; + break; + case 2: + stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); + break; + case 3: + stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; + break; + case 4: + stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; + break; + case 5: + stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); + break; + default: + break; + } - // define gradient - out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height << "\" " - << "x2=\"" << width + additional_width << "\" " - << "y2=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29)) + (4-index) * element_height << "\"" - << ">" << '\n' - << " " << '\n' - << " " << '\n' - << " " << '\n'; - - // draw box corresponding to the gradient above - out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height - << "\" width=\"" << element_width - << "\" height=\"" << element_height - << "\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_" << index << ")\"/>" << '\n'; - } - - for (unsigned int index = 0; index < 5; index++) - { - out << " (1.5 * element_width) - << "\" y=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29) + (4.-index) * element_height + 30.) << "\"" - << " style=\"text-anchor:start; font-size:80; font-family:Helvetica"; + // define gradient + out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height << "\" " + << "x2=\"" << width + additional_width << "\" " + << "y2=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29)) + (4-index) * element_height << "\"" + << ">" << '\n' + << " " << '\n' + << " " << '\n' + << " " << '\n'; + + // draw box corresponding to the gradient above + out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height + << "\" width=\"" << element_width + << "\" height=\"" << element_height + << "\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_" << index << ")\"/>" << '\n'; + } + + for (unsigned int index = 0; index < 5; index++) + { + out << " (1.5 * element_width) + << "\" y=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29) + (4.-index) * element_height + 30.) << "\"" + << " style=\"text-anchor:start; font-size:80; font-family:Helvetica"; - if (index == 0 || index == 4) out << "; font-weight:bold"; + if (index == 0 || index == 4) out << "; font-weight:bold"; - out << "\">" << (float)(((int)((z_min + index * (z_dimension / 4.))*10000))/10000.); + out << "\">" << (float)(((int)((z_min + index * (z_dimension / 4.))*10000))/10000.); - if (index == 4) out << " max"; - if (index == 0) out << " min"; + if (index == 4) out << " max"; + if (index == 0) out << " min"; - out << "" << '\n'; + out << "" << '\n'; + } } - } // finalize the svg file out << '\n' << ""; diff --git a/deal.II/source/base/logstream.cc b/deal.II/source/base/logstream.cc index 11c5990fd8..ba7f8773f3 100644 --- a/deal.II/source/base/logstream.cc +++ b/deal.II/source/base/logstream.cc @@ -149,10 +149,10 @@ LogStream::operator<< (std::ostream& (*p) (std::ostream &)) if (at_newline) print_line_head(); - if(p == p_flush) + if (p == p_flush) at_newline = false; - if(p == p_endl) + if (p == p_endl) at_newline = true; if (get_prefixes().size() <= std_depth) @@ -352,7 +352,7 @@ LogStream::get_prefixes() const // If this is a new locally stored stack, copy the "blessed" prefixes // from the initial thread that created logstream. - if(! exists) + if (! exists) { const tbb::enumerable_thread_specific > &impl = prefixes.get_implementation(); diff --git a/deal.II/source/base/mpi.cc b/deal.II/source/base/mpi.cc index 07def80fc2..663d647dad 100644 --- a/deal.II/source/base/mpi.cc +++ b/deal.II/source/base/mpi.cc @@ -312,10 +312,10 @@ namespace Utilities MPI_InitFinalize::MPI_InitFinalize (int &argc, - char ** &argv, - unsigned int max_num_threads) - : - owns_mpi (true) + char ** &argv, + unsigned int max_num_threads) + : + owns_mpi (true) { do_init(argc, argv, max_num_threads); } @@ -334,8 +334,8 @@ namespace Utilities void MPI_InitFinalize::do_init(int &argc, - char ** &argv, - unsigned int max_num_threads) + char ** &argv, + unsigned int max_num_threads) { static bool constructor_has_already_run = false; Assert (constructor_has_already_run == false, @@ -422,8 +422,8 @@ namespace Utilities // or just end PETSc. PetscFinalize(); # endif - } -#endif + } +#endif // only MPI_Finalize if we are running with MPI and we are not using PETSc diff --git a/deal.II/source/base/multithread_info.cc b/deal.II/source/base/multithread_info.cc index 5a39f78ec2..e79373d0aa 100644 --- a/deal.II/source/base/multithread_info.cc +++ b/deal.II/source/base/multithread_info.cc @@ -102,7 +102,7 @@ unsigned int MultithreadInfo::get_n_cpus() void MultithreadInfo::set_thread_limit(const unsigned int max_threads) { unsigned int max_threads_env = numbers::invalid_unsigned_int; - char* penv; + char *penv; penv = getenv ("DEAL_II_NUM_THREADS"); if (penv!=NULL) @@ -112,9 +112,9 @@ void MultithreadInfo::set_thread_limit(const unsigned int max_threads) if (n_max_threads == numbers::invalid_unsigned_int) n_max_threads = tbb::task_scheduler_init::default_num_threads(); else - { - static tbb::task_scheduler_init dummy (n_max_threads); - } + { + static tbb::task_scheduler_init dummy (n_max_threads); + } } bool MultithreadInfo::is_running_single_threaded() diff --git a/deal.II/source/base/parameter_handler.cc b/deal.II/source/base/parameter_handler.cc index f4be871d0e..6a8c426d4e 100644 --- a/deal.II/source/base/parameter_handler.cc +++ b/deal.II/source/base/parameter_handler.cc @@ -1085,20 +1085,20 @@ ParameterHandler::mangle (const std::string &s) for (unsigned int i=0; i(s[i])/16]); - u.push_back (hex[static_cast(s[i])%16]); - } + { + u.push_back ('_'); + static const char hex[16] + = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; + u.push_back (hex[static_cast(s[i])/16]); + u.push_back (hex[static_cast(s[i])%16]); + } } return u; diff --git a/deal.II/source/base/partitioner.cc b/deal.II/source/base/partitioner.cc index c35505f4b7..bd9748bc5b 100644 --- a/deal.II/source/base/partitioner.cc +++ b/deal.II/source/base/partitioner.cc @@ -303,7 +303,7 @@ namespace Utilities ExcIndexRange(expanded_import_indices[i], local_range_data.first, local_range_data.second)); types::global_dof_index new_index = (expanded_import_indices[i] - - local_range_data.first); + local_range_data.first); if (new_index == last_index+1) compressed_import_indices.back().second++; else diff --git a/deal.II/source/base/polynomials_piecewise.cc b/deal.II/source/base/polynomials_piecewise.cc index 63c9b03577..facd247735 100644 --- a/deal.II/source/base/polynomials_piecewise.cc +++ b/deal.II/source/base/polynomials_piecewise.cc @@ -74,7 +74,7 @@ namespace Polynomials } } else - { + { const double offset = step * interval; if (xoffset+step) { diff --git a/deal.II/source/base/subscriptor.cc b/deal.II/source/base/subscriptor.cc index 9454d80b51..fa2af252e4 100644 --- a/deal.II/source/base/subscriptor.cc +++ b/deal.II/source/base/subscriptor.cc @@ -94,17 +94,17 @@ Subscriptor::~Subscriptor () { if (std::uncaught_exception() == false) { - std::string infostring; - for (map_iterator it = counter_map.begin(); it != counter_map.end(); ++it) - { - if (it->second > 0) - infostring += std::string("\n from Subscriber ") - + std::string(it->first); - } - - if (infostring == "") - infostring = ""; - + std::string infostring; + for (map_iterator it = counter_map.begin(); it != counter_map.end(); ++it) + { + if (it->second > 0) + infostring += std::string("\n from Subscriber ") + + std::string(it->first); + } + + if (infostring == "") + infostring = ""; + Assert (counter == 0, ExcInUse (counter, object_info->name(), infostring)); } diff --git a/deal.II/source/base/tensor_product_polynomials.cc b/deal.II/source/base/tensor_product_polynomials.cc index 1001f65ffc..318f022658 100644 --- a/deal.II/source/base/tensor_product_polynomials.cc +++ b/deal.II/source/base/tensor_product_polynomials.cc @@ -35,7 +35,7 @@ namespace internal void compute_tensor_index(const unsigned int, const unsigned int, const unsigned int, - unsigned int (&)[dim]) + unsigned int ( &)[dim]) { Assert(false, ExcNotImplemented()); } diff --git a/deal.II/source/base/timer.cc b/deal.II/source/base/timer.cc index f99d6ebb17..431cd2c65c 100644 --- a/deal.II/source/base/timer.cc +++ b/deal.II/source/base/timer.cc @@ -268,13 +268,13 @@ void Timer::reset () TimerOutput::TimerOutput (std::ostream &stream, const enum OutputFrequency output_frequency, const enum OutputType output_type) - : - output_frequency (output_frequency), - output_type (output_type), - out_stream (stream, true), - output_is_enabled (true) +: +output_frequency (output_frequency), + output_type (output_type), + out_stream (stream, true), + output_is_enabled (true) #ifdef DEAL_II_WITH_MPI - , mpi_communicator (MPI_COMM_SELF) + , mpi_communicator (MPI_COMM_SELF) #endif {} @@ -283,13 +283,13 @@ TimerOutput::TimerOutput (std::ostream &stream, TimerOutput::TimerOutput (ConditionalOStream &stream, const enum OutputFrequency output_frequency, const enum OutputType output_type) - : - output_frequency (output_frequency), - output_type (output_type), - out_stream (stream), - output_is_enabled (true) +: +output_frequency (output_frequency), +output_type (output_type), +out_stream (stream), +output_is_enabled (true) #ifdef DEAL_II_WITH_MPI - , mpi_communicator (MPI_COMM_SELF) +, mpi_communicator (MPI_COMM_SELF) #endif {} @@ -300,12 +300,12 @@ TimerOutput::TimerOutput (MPI_Comm mpi_communicator, std::ostream &stream, const enum OutputFrequency output_frequency, const enum OutputType output_type) - : - output_frequency (output_frequency), - output_type (output_type), - out_stream (stream, true), - output_is_enabled (true), - mpi_communicator (mpi_communicator) +: +output_frequency (output_frequency), +output_type (output_type), +out_stream (stream, true), +output_is_enabled (true), +mpi_communicator (mpi_communicator) {} @@ -314,12 +314,12 @@ TimerOutput::TimerOutput (MPI_Comm mpi_communicator, ConditionalOStream &stream, const enum OutputFrequency output_frequency, const enum OutputType output_type) - : - output_frequency (output_frequency), - output_type (output_type), - out_stream (stream), - output_is_enabled (true), - mpi_communicator (mpi_communicator) +: +output_frequency (output_frequency), +output_type (output_type), +out_stream (stream), +output_is_enabled (true), +mpi_communicator (mpi_communicator) {} #endif @@ -331,7 +331,7 @@ TimerOutput::~TimerOutput() leave_subsection(); if ( (output_frequency == summary || output_frequency == every_call_and_summary) - && output_is_enabled == true) + && output_is_enabled == true) print_summary(); } diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index 0717ed4e4e..3613f5b7ca 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -1462,7 +1462,7 @@ namespace void *ptr = static_cast(q->p.user_data) + offset; typename parallel::distributed::Triangulation::CellStatus status = * static_cast< - typename parallel::distributed::Triangulation::CellStatus* + typename parallel::distributed::Triangulation::CellStatus * >(q->p.user_data); switch (status) { @@ -2863,12 +2863,12 @@ namespace parallel // do not allow anisotropic refinement #ifdef DEBUG for (typename Triangulation::active_cell_iterator - cell = this->begin_active(); - cell != this->end(); ++cell) - if (cell->is_locally_owned() && cell->refine_flag_set()) - Assert (cell->refine_flag_set() == - RefinementPossibilities::isotropic_refinement, - ExcMessage ("This class does not support anisotropic refinement")); + cell = this->begin_active(); + cell != this->end(); ++cell) + if (cell->is_locally_owned() && cell->refine_flag_set()) + Assert (cell->refine_flag_set() == + RefinementPossibilities::isotropic_refinement, + ExcMessage ("This class does not support anisotropic refinement")); #endif @@ -2876,11 +2876,11 @@ namespace parallel if (this->n_levels()==dealii::internal::p4est::functions::max_level) { for (typename Triangulation::active_cell_iterator - cell = this->begin_active(dealii::internal::p4est::functions::max_level-1); - cell != this->end(dealii::internal::p4est::functions::max_level-1); ++cell) + cell = this->begin_active(dealii::internal::p4est::functions::max_level-1); + cell != this->end(dealii::internal::p4est::functions::max_level-1); ++cell) { AssertThrow(!(cell->refine_flag_set()), - ExcMessage("Fatal Error: maximum refinement level of p4est reached.")); + ExcMessage("Fatal Error: maximum refinement level of p4est reached.")); } } @@ -3247,8 +3247,8 @@ namespace parallel try { dealii::Triangulation:: - copy_triangulation (old_tria); - } + copy_triangulation (old_tria); + } catch (const typename dealii::Triangulation::DistortedCellList &) { // the underlying @@ -3270,7 +3270,7 @@ namespace parallel "if they are not refined!")); if (const dealii::parallel::distributed::Triangulation * - old_tria_x = dynamic_cast *>(&old_tria)) + old_tria_x = dynamic_cast *>(&old_tria)) { Assert (!old_tria_x->refinement_in_progress, ExcMessage ("Parallel distributed triangulations can only " diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index e87e8f7e26..6aaaef2dd8 100644 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@ -89,7 +89,7 @@ namespace internal max_couplings_between_dofs (const DoFHandler<1,spacedim> &dof_handler) { return std::min(static_cast(3*dof_handler.selected_fe->dofs_per_vertex + - 2*dof_handler.selected_fe->dofs_per_line), + 2*dof_handler.selected_fe->dofs_per_line), dof_handler.n_dofs()); } diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index 9afa14106d..30a9c96ecb 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -589,9 +589,9 @@ namespace internal const bool check_validity) { for (typename std::vector::MGVertexDoFs>::iterator - i=dof_handler.mg_vertex_dofs.begin(); + i=dof_handler.mg_vertex_dofs.begin(); i!=dof_handler.mg_vertex_dofs.end(); - ++i) + ++i) // if the present vertex lives on // the current level if ((i->get_coarsest_level() <= level) && @@ -611,9 +611,9 @@ namespace internal for (std::vector::iterator - i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); + i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); i!=dof_handler.mg_levels[level]->dof_object.dofs.end(); - ++i) + ++i) { if (*i != DoFHandler<1>::invalid_dof_index) { @@ -846,8 +846,8 @@ namespace internal static void renumber_mg_dofs (const std::vector &, - const IndexSet &, - DoFHandler<3,spacedim> &, + const IndexSet &, + DoFHandler<3,spacedim> &, const unsigned int , const bool ) { @@ -1327,7 +1327,7 @@ namespace internal const typename dealii::internal::p4est::types::quadrant &p4est_cell, const typename DoFHandler::level_cell_iterator &dealii_cell, const typename dealii::internal::p4est::types::quadrant &quadrant, - dealii::types::global_dof_index* dofs, + dealii::types::global_dof_index *dofs, unsigned int level) { if (internal::p4est::quadrant_is_equal(p4est_cell, quadrant)) @@ -1582,10 +1582,10 @@ namespace internal =reinterpret_cast::quadrant *>(ptr); ptr+=cells*sizeof(typename dealii::internal::p4est::types::quadrant); dealii::types::global_dof_index *dofs - = reinterpret_cast(ptr); + = reinterpret_cast(ptr); - // the dofs pointer contains for each cell the number of dofs - // on that cell (dofs[0]) followed by the dof indices itself. + // the dofs pointer contains for each cell the number of dofs + // on that cell (dofs[0]) followed by the dof indices itself. for (unsigned int c=0; c::level_cell_iterator @@ -1821,10 +1821,10 @@ namespace internal =reinterpret_cast::quadrant *>(ptr); ptr+=cells*sizeof(typename dealii::internal::p4est::types::quadrant); dealii::types::global_dof_index *dofs - = reinterpret_cast(ptr); + = reinterpret_cast(ptr); - // the dofs pointer contains for each cell the number of dofs - // on that cell (dofs[0]) followed by the dof indices itself. + // the dofs pointer contains for each cell the number of dofs + // on that cell (dofs[0]) followed by the dof indices itself. for (unsigned int c=0; c::level_cell_iterator diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index e7d5e2ac75..52646d1be3 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -535,7 +535,7 @@ namespace DoFRenumbering { //TODO: Merge with previous function std::vector renumbering (dof_handler.n_dofs(), - hp::DoFHandler::invalid_dof_index); + hp::DoFHandler::invalid_dof_index); typename hp::DoFHandler::active_cell_iterator start = dof_handler.begin_active(); @@ -568,7 +568,7 @@ namespace DoFRenumbering ExcNotInitialized()); std::vector renumbering (dof_handler.n_dofs(level), - DH::invalid_dof_index); + DH::invalid_dof_index); typename DH::level_cell_iterator start =dof_handler.begin(level); typename DH::level_cell_iterator end = dof_handler.end(level); @@ -761,10 +761,10 @@ namespace DoFRenumbering Utilities::MPI::n_mpi_processes (tria->get_communicator())); MPI_Allgather ( &local_dof_count[0], - n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - &all_dof_counts[0], n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - tria->get_communicator()); + &all_dof_counts[0], + n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, + tria->get_communicator()); for (unsigned int i=0; ilocally_owned_subdomain()+i] @@ -834,7 +834,7 @@ namespace DoFRenumbering block_wise (DoFHandler &dof_handler) { std::vector renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); typename DoFHandler::active_cell_iterator start = dof_handler.begin_active(); @@ -903,7 +903,7 @@ namespace DoFRenumbering ExcNotInitialized()); std::vector renumbering (dof_handler.n_dofs(level), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); typename DoFHandler::level_cell_iterator start =dof_handler.begin(level); @@ -1058,13 +1058,13 @@ namespace DoFRenumbering all_dof_counts(fe_collection.n_components() * Utilities::MPI::n_mpi_processes (tria->get_communicator())); - Assert (sizeof(types::global_dof_index) == sizeof(unsigned int), - ExcNotImplemented()); + Assert (sizeof(types::global_dof_index) == sizeof(unsigned int), + ExcNotImplemented()); MPI_Allgather ( &local_dof_count[0], - n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - &all_dof_counts[0], n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - tria->get_communicator()); + &all_dof_counts[0], + n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, + tria->get_communicator()); for (unsigned int i=0; ilocally_owned_subdomain()+i] @@ -1186,7 +1186,7 @@ namespace DoFRenumbering hierarchical (DoFHandler &dof_handler) { std::vector renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); typename DoFHandler::level_cell_iterator cell; @@ -1279,7 +1279,7 @@ namespace DoFRenumbering ExcNotInitialized()); std::vector renumbering(dof_handler.n_dofs(level), - DH::invalid_dof_index); + DH::invalid_dof_index); compute_sort_selected_dofs_back(renumbering, dof_handler, selected_dofs, level); dof_handler.renumber_dofs(level, renumbering); diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index 5d87b15432..c7bcd8cd8d 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@ -614,7 +614,7 @@ namespace DoFTools if (!cell->neighbor(face)->active() || (cell->neighbor(face)->subdomain_id() != - cell->subdomain_id())) + cell->subdomain_id())) constraints.add_entries_local_to_global (dofs_on_other_cell, dofs_on_this_cell, sparsity, keep_constrained_dofs); @@ -2893,9 +2893,9 @@ namespace DoFTools for (unsigned int i=0; iget_communicator()); + MPI_SUM, tria->get_communicator()); } #endif } @@ -4600,7 +4600,7 @@ namespace DoFTools { const FiniteElement &fe = fe_collection[this_fe]; std::fill (dofs_per_block.begin(), dofs_per_block.end(), - types::global_dof_index(0)); + types::global_dof_index(0)); // If the empty vector was given as default argument, set up this // vector as identity. @@ -4652,9 +4652,9 @@ namespace DoFTools { std::vector local_dof_count = dofs_per_block; MPI_Allreduce ( &local_dof_count[0], &dofs_per_block[0], - n_target_blocks, + n_target_blocks, DEAL_II_DOF_INDEX_MPI_TYPE, - MPI_SUM, tria->get_communicator()); + MPI_SUM, tria->get_communicator()); } #endif #endif @@ -4813,7 +4813,7 @@ namespace DoFTools if (global_parameter_representation(i) != 0) { const types::global_dof_index wi = parameter_dof_indices[local_dof], - wj = weight_mapping[i]; + wj = weight_mapping[i]; weights[wi][wj] = global_parameter_representation(i); }; } @@ -4895,7 +4895,7 @@ namespace DoFTools // global numbers of dofs const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(), - n_fine_dofs = fine_grid.n_dofs(); + n_fine_dofs = fine_grid.n_dofs(); // local numbers of dofs const unsigned int fine_dofs_per_cell = fine_fe.dofs_per_cell; @@ -5134,7 +5134,7 @@ namespace DoFTools // global numbers of dofs const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(), - n_fine_dofs = fine_grid.n_dofs(); + n_fine_dofs = fine_grid.n_dofs(); // get an array in which we store which dof on the coarse grid is a @@ -5249,7 +5249,7 @@ namespace DoFTools j = weights[row].find(col); if ((j != weights[row].end()) && (j->second != 0)) constraint_line.push_back (std::pair(representants[row], - j->second)); + j->second)); }; constraints.add_entries (global_dof, constraint_line); @@ -5309,7 +5309,7 @@ namespace DoFTools // first construct the inverse mapping of weight_mapping std::vector inverse_weight_mapping (n_global_parm_dofs, - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); for (types::global_dof_index i=0; i::initialize_support_points (const unsigned int degree) // Initialize quadratures to obtain // quadrature points later on. const QGauss reference_edge_quadrature (degree + 1); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); const unsigned int n_boundary_points = GeometryInfo::lines_per_cell * n_edge_points; @@ -527,7 +527,7 @@ FE_Nedelec::initialize_restriction () const QGauss<1> edge_quadrature (2 * this->degree); const std::vector > &edge_quadrature_points = edge_quadrature.get_points (); - const unsigned int& + const unsigned int & n_edge_quadrature_points = edge_quadrature.size (); const unsigned int index = RefinementCase::isotropic_refinement - 1; @@ -3306,7 +3306,7 @@ FE_Nedelec::interpolate (std::vector &local_dofs, { const QGauss<1> reference_edge_quadrature (this->degree); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); // Let us begin with the @@ -4167,7 +4167,7 @@ FE_Nedelec::interpolate (std::vector &local_dofs, // the interior shape // functions. const QGauss reference_quadrature (this->degree); - const unsigned int& + const unsigned int & n_interior_points = reference_quadrature.size (); // We create the @@ -4572,7 +4572,7 @@ const // Let us begin with the // interpolation part. const QGauss reference_edge_quadrature (this->degree); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); for (unsigned int i = 0; i < 2; ++i) @@ -4688,7 +4688,7 @@ const // vertical, interior // shape functions. const QGauss reference_quadrature (this->degree); - const unsigned int& + const unsigned int & n_interior_points = reference_quadrature.size (); const std::vector > & legendre_polynomials @@ -4843,7 +4843,7 @@ const // Let us begin with the // interpolation part. const QGauss<1> reference_edge_quadrature (this->degree); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); for (unsigned int q_point = 0; q_point < n_edge_points; ++q_point) diff --git a/deal.II/source/fe/fe_poly_tensor.cc b/deal.II/source/fe/fe_poly_tensor.cc index e239c6a618..9f6460c363 100644 --- a/deal.II/source/fe/fe_poly_tensor.cc +++ b/deal.II/source/fe/fe_poly_tensor.cc @@ -87,14 +87,14 @@ namespace void - get_face_sign_change_rt (const Triangulation<3>::cell_iterator & cell, + get_face_sign_change_rt (const Triangulation<3>::cell_iterator &cell, const unsigned int dofs_per_face, std::vector &face_sign) { std::fill (face_sign.begin (), face_sign.end (), 1.0); //TODO: think about what it would take here } - + void get_face_sign_change_nedelec (const Triangulation<1>::cell_iterator &, const unsigned int , @@ -117,7 +117,7 @@ namespace void - get_face_sign_change_nedelec (const Triangulation<3>::cell_iterator & cell, + get_face_sign_change_nedelec (const Triangulation<3>::cell_iterator &cell, const unsigned int dofs_per_face, std::vector &face_sign) { @@ -421,19 +421,18 @@ FE_PolyTensor::fill_fe_values ( // Compute eventual sign changes depending on the neighborhood // between two faces. std::vector sign_change (this->dofs_per_cell, 1.0); - + if (mapping_type == mapping_raviart_thomas) get_face_sign_change_rt (cell, this->dofs_per_face, sign_change); - - else - if (mapping_type == mapping_nedelec) - get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); + + else if (mapping_type == mapping_nedelec) + get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); // for Piola mapping, the similarity // concept cannot be used because of // possible sign changes from one cell to // the next. if ( (mapping_type == mapping_piola) || (mapping_type == mapping_raviart_thomas) - || (mapping_type == mapping_nedelec)) + || (mapping_type == mapping_nedelec)) if (cell_similarity == CellSimilarity::translation) cell_similarity = CellSimilarity::none; @@ -634,13 +633,12 @@ FE_PolyTensor::fill_fe_face_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. std::vector sign_change (this->dofs_per_cell, 1.0); - + if (mapping_type == mapping_raviart_thomas) get_face_sign_change_rt (cell, this->dofs_per_face, sign_change); - - else - if (mapping_type == mapping_nedelec) - get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); + + else if (mapping_type == mapping_nedelec) + get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); for (unsigned int i=0; idofs_per_cell; ++i) { @@ -782,7 +780,7 @@ FE_PolyTensor::fill_fe_face_values ( for (unsigned int k = 0; k < n_q_points; ++k) for (unsigned int d = 0; d < dim; ++d) data.shape_gradients[first + d][k] = sign_change[i] * shape_grads1[k][d]; - + break; } @@ -844,13 +842,12 @@ FE_PolyTensor::fill_fe_subface_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. std::vector sign_change (this->dofs_per_cell, 1.0); - + if (mapping_type == mapping_raviart_thomas) get_face_sign_change_rt (cell, this->dofs_per_face, sign_change); - - else - if (mapping_type == mapping_nedelec) - get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); + + else if (mapping_type == mapping_nedelec) + get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); for (unsigned int i=0; idofs_per_cell; ++i) { diff --git a/deal.II/source/fe/fe_q_base.cc b/deal.II/source/fe/fe_q_base.cc index 3a4d5bf1b2..77aab44e1a 100644 --- a/deal.II/source/fe/fe_q_base.cc +++ b/deal.II/source/fe/fe_q_base.cc @@ -1011,7 +1011,7 @@ FE_Q_Base::initialize_constraints (const std::vector template -const FullMatrix& +const FullMatrix & FE_Q_Base ::get_prolongation_matrix (const unsigned int child, const RefinementCase &refinement_case) const @@ -1066,7 +1066,7 @@ FE_Q_Base // almost negligible also for high order elements const unsigned int dofs1d = this->degree+1; std::vector > - subcell_evaluations (dim, Table<2,double>(dofs1d, dofs1d)); + subcell_evaluations (dim, Table<2,double>(dofs1d, dofs1d)); const std::vector &index_map_inverse = this->poly_space.get_numbering_inverse(); @@ -1188,7 +1188,7 @@ FE_Q_Base template -const FullMatrix& +const FullMatrix & FE_Q_Base ::get_restriction_matrix (const unsigned int child, const RefinementCase &refinement_case) const diff --git a/deal.II/source/fe/fe_q_dg0.cc b/deal.II/source/fe/fe_q_dg0.cc index 77c7e41144..8ecc7df865 100644 --- a/deal.II/source/fe/fe_q_dg0.cc +++ b/deal.II/source/fe/fe_q_dg0.cc @@ -264,7 +264,7 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, x_source_fe.dofs_per_cell)); this->FE_Q_Base,dim,spacedim>:: - get_interpolation_matrix(x_source_fe, interpolation_matrix); + get_interpolation_matrix(x_source_fe, interpolation_matrix); } diff --git a/deal.II/source/fe/fe_q_iso_q1.cc b/deal.II/source/fe/fe_q_iso_q1.cc index 428ff5aea3..6aba97cfac 100644 --- a/deal.II/source/fe/fe_q_iso_q1.cc +++ b/deal.II/source/fe/fe_q_iso_q1.cc @@ -33,7 +33,7 @@ FE_Q_iso_Q1::FE_Q_iso_Q1 (const unsigned int subdivisions) : FE_Q_Base >, dim, spacedim> ( TensorProductPolynomials > - (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)), + (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)), FiniteElementData(this->get_dpo_vector(subdivisions), 1, subdivisions, FiniteElementData::H1), diff --git a/deal.II/source/fe/fe_system.cc b/deal.II/source/fe/fe_system.cc index 68b70291ed..2f45064642 100644 --- a/deal.II/source/fe/fe_system.cc +++ b/deal.II/source/fe/fe_system.cc @@ -593,7 +593,7 @@ FESystem::get_interpolation_matrix ( template -const FullMatrix& +const FullMatrix & FESystem ::get_restriction_matrix (const unsigned int child, const RefinementCase &refinement_case) const @@ -620,7 +620,7 @@ FESystem // shortcut for accessing local restrictions further down std::vector *> - base_matrices(this->n_base_elements()); + base_matrices(this->n_base_elements()); for (unsigned int i=0; in_base_elements(); ++i) { @@ -660,11 +660,11 @@ FESystem // so get the common base element and the indices therein: const unsigned int - base = this->system_to_base_table[i].first.first; + base = this->system_to_base_table[i].first.first; const unsigned int - base_index_i = this->system_to_base_table[i].second, - base_index_j = this->system_to_base_table[j].second; + base_index_i = this->system_to_base_table[i].second, + base_index_j = this->system_to_base_table[j].second; // if we are sure that DoFs i and j may couple, then copy // entries of the matrices: @@ -682,7 +682,7 @@ FESystem template -const FullMatrix& +const FullMatrix & FESystem ::get_prolongation_matrix (const unsigned int child, const RefinementCase &refinement_case) const @@ -706,7 +706,7 @@ FESystem bool do_prolongation = true; std::vector *> - base_matrices(this->n_base_elements()); + base_matrices(this->n_base_elements()); for (unsigned int i=0; in_base_elements(); ++i) { base_matrices[i] = @@ -729,11 +729,11 @@ FESystem this->system_to_base_table[j].first) continue; const unsigned int - base = this->system_to_base_table[i].first.first; + base = this->system_to_base_table[i].first.first; const unsigned int - base_index_i = this->system_to_base_table[i].second, - base_index_j = this->system_to_base_table[j].second; + base_index_i = this->system_to_base_table[i].second, + base_index_j = this->system_to_base_table[j].second; prolongate(i,j) = (*base_matrices[base])(base_index_i,base_index_j); } prolongate.swap(const_cast &> @@ -2462,17 +2462,17 @@ FESystem::multiply_dof_numbers ( unsigned int index = 0; for (unsigned int index=0; index0) - { - total_conformity = fes[index]->conforming_space; - break; - } + { + total_conformity = fes[index]->conforming_space; + break; + } for (; index0) - total_conformity = - typename FiniteElementData::Conformity(total_conformity - & - fes[index]->conforming_space); + total_conformity = + typename FiniteElementData::Conformity(total_conformity + & + fes[index]->conforming_space); } std::vector dpo; @@ -2482,10 +2482,10 @@ FESystem::multiply_dof_numbers ( if (dim>2) dpo.push_back(multiplied_dofs_per_hex); return FiniteElementData (dpo, - multiplied_n_components, - degree, - total_conformity, - summed_multiplicities); + multiplied_n_components, + degree, + total_conformity, + summed_multiplicities); } diff --git a/deal.II/source/fe/fe_tools.cc b/deal.II/source/fe/fe_tools.cc index 07b537bf98..fe6be9fd8c 100644 --- a/deal.II/source/fe/fe_tools.cc +++ b/deal.II/source/fe/fe_tools.cc @@ -1694,10 +1694,10 @@ namespace FETools DoFTools::extract_locally_relevant_dofs (dof2, dof2_locally_relevant_dofs); - parallel::distributed::Vector - u2 (dof2_locally_owned_dofs, - dof2_locally_relevant_dofs, - u1.get_mpi_communicator()); + parallel::distributed::Vector + u2 (dof2_locally_owned_dofs, + dof2_locally_relevant_dofs, + u1.get_mpi_communicator()); interpolate(dof1, u1, dof2, constraints2, u2); u2.update_ghost_values (); diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index 0278002da2..0602d5fd09 100644 --- a/deal.II/source/fe/fe_values.cc +++ b/deal.II/source/fe/fe_values.cc @@ -347,7 +347,7 @@ namespace FEValuesViews template Tensor<2, dim, spacedim>:: Tensor(const FEValuesBase &fe_values, - const unsigned int first_tensor_component) + const unsigned int first_tensor_component) : fe_values(fe_values), first_tensor_component(first_tensor_component), @@ -480,7 +480,7 @@ namespace FEValuesViews const double *shape_value_ptr = &shape_values(shape_function_data[shape_function].row_index, 0); for (unsigned int q_point=0; q_point *shape_derivative_ptr = &shape_derivatives[shape_function_data[shape_function].row_index][0]; for (unsigned int q_point=0; q_point *shape_derivative_ptr = &shape_derivatives[snc][0]; for (unsigned int q_point=0; q_point()); + dealii::Tensor<1,spacedim>()); for (unsigned int shape_function=0; shape_function()); + dealii::Tensor<1,spacedim>()); for (unsigned int shape_function=0; shape_function - void - do_function_values (const ::dealii::Vector &dof_values, - const Table<2,double> &shape_values, - const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &values) + template + void + do_function_values (const ::dealii::Vector &dof_values, + const Table<2,double> &shape_values, + const std::vector::ShapeFunctionData> &shape_function_data, + std::vector > &values) + { + const unsigned int dofs_per_cell = dof_values.size(); + const unsigned int n_quadrature_points = dofs_per_cell > 0 ? + shape_values.n_cols() : values.size(); + AssertDimension (values.size(), n_quadrature_points); + + std::fill (values.begin(), values.end(), + dealii::Tensor<2,spacedim>()); + + for (unsigned int shape_function=0; + shape_function 0 ? - shape_values.n_cols() : values.size(); - AssertDimension (values.size(), n_quadrature_points); + const int snc = shape_function_data[shape_function].single_nonzero_component; - std::fill (values.begin(), values.end(), - dealii::Tensor<2,spacedim>()); + if (snc == -2) + // shape function is zero for the selected components + continue; - for (unsigned int shape_function=0; - shape_function indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); - if (snc != -1) + const double *shape_value_ptr = &shape_values(snc,0); + for (unsigned int q_point=0; q_point indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(d); - const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); - - const double *shape_value_ptr = &shape_values(snc,0); + const double *shape_value_ptr = + &shape_values(shape_function_data[shape_function].row_index[d],0); for (unsigned int q_point=0; q_point indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(d); - - const double *shape_value_ptr = - &shape_values(shape_function_data[shape_function].row_index[d],0); - for (unsigned int q_point=0; q_point - void - do_function_divergences (const ::dealii::Vector &dof_values, - const std::vector > > &shape_gradients, - const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &divergences) - { - const unsigned int dofs_per_cell = dof_values.size(); - const unsigned int n_quadrature_points = dofs_per_cell > 0 ? - shape_gradients[0].size() : divergences.size(); - AssertDimension (divergences.size(), n_quadrature_points); + template + void + do_function_divergences (const ::dealii::Vector &dof_values, + const std::vector > > &shape_gradients, + const std::vector::ShapeFunctionData> &shape_function_data, + std::vector > &divergences) + { + const unsigned int dofs_per_cell = dof_values.size(); + const unsigned int n_quadrature_points = dofs_per_cell > 0 ? + shape_gradients[0].size() : divergences.size(); + AssertDimension (divergences.size(), n_quadrature_points); - std::fill (divergences.begin(), divergences.end(), - dealii::Tensor<1,spacedim>()); + std::fill (divergences.begin(), divergences.end(), + dealii::Tensor<1,spacedim>()); - for (unsigned int shape_function=0; - shape_function *shape_gradient_ptr = - &shape_gradients[snc][0]; + const dealii::Tensor < 1, spacedim> *shape_gradient_ptr = + &shape_gradients[snc][0]; - const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); - const unsigned int ii = indices[0]; - const unsigned int jj = indices[1]; + const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); + const unsigned int ii = indices[0]; + const unsigned int jj = indices[1]; - for (unsigned int q_point = 0; q_point < n_quadrature_points; - ++q_point, ++shape_gradient_ptr) - { - divergences[q_point][jj] += value * (*shape_gradient_ptr)[ii]; - } - } - else + for (unsigned int q_point = 0; q_point < n_quadrature_points; + ++q_point, ++shape_gradient_ptr) { - for (unsigned int d = 0; - d < dim*dim; ++d) - if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) - { - Assert (false, ExcNotImplemented()); - } + divergences[q_point][jj] += value * (*shape_gradient_ptr)[ii]; } } + else + { + for (unsigned int d = 0; + d < dim*dim; ++d) + if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) + { + Assert (false, ExcNotImplemented()); + } + } } + } } // end of namespace internal @@ -1716,7 +1716,7 @@ namespace internal #endif new (&second_order_tensors[component]) dealii::FEValuesViews::Tensor<2, dim, spacedim > (fe_values, - component); + component); } } } @@ -2237,7 +2237,7 @@ namespace internal const double *shape_value_ptr = &shape_values(shape_func, 0); for (unsigned int point=0; point *shape_derivative_ptr = &shape_derivatives[shape_func][0]; for (unsigned int point=0; point &triangulation, const double half_length) { // Determine number of cells and vertices - const size_type + const size_type n_cells = static_cast(std::floor (half_length / - std::max (radius_0, - radius_1) + - 0.5)); + std::max (radius_0, + radius_1) + + 0.5)); const size_type n_vertices = 4 * (n_cells + 1); std::vector > vertices_tmp(n_vertices); @@ -2714,17 +2714,18 @@ GridGenerator::half_hyper_ball (Triangulation<3> &tria, { cell->face(i)->set_boundary_indicator(1); for (unsigned int j=0; j::lines_per_face; ++j) - { - const Point<3> vertices[2] - = { cell->face(i)->line(j)->vertex(0), - cell->face(i)->line(j)->vertex(1) }; - if ((std::fabs(vertices[0].distance(center)-radius) > - 1e-5*radius) - || - (std::fabs(vertices[1].distance(center)-radius) > - 1e-5*radius)) - cell->face(i)->line(j)->set_boundary_indicator(1); - } + { + const Point<3> vertices[2] + = { cell->face(i)->line(j)->vertex(0), + cell->face(i)->line(j)->vertex(1) + }; + if ((std::fabs(vertices[0].distance(center)-radius) > + 1e-5*radius) + || + (std::fabs(vertices[1].distance(center)-radius) > + 1e-5*radius)) + cell->face(i)->line(j)->set_boundary_indicator(1); + } } } ++cell; @@ -3440,14 +3441,14 @@ extrude_triangulation(const Triangulation<2, 2> &input, { quad.boundary_id = cell->face(f)->boundary_indicator(); bid = std::max(bid, quad.boundary_id); - for (size_type slice=0; sliceface(f)->vertex_index(0)+slice*input.n_vertices(); - quad.vertices[1] = cell->face(f)->vertex_index(1)+slice*input.n_vertices(); - quad.vertices[2] = cell->face(f)->vertex_index(0)+(slice+1)*input.n_vertices(); - quad.vertices[3] = cell->face(f)->vertex_index(1)+(slice+1)*input.n_vertices(); - s.boundary_quads.push_back(quad); - } + for (size_type slice=0; sliceface(f)->vertex_index(0)+slice*input.n_vertices(); + quad.vertices[1] = cell->face(f)->vertex_index(1)+slice*input.n_vertices(); + quad.vertices[2] = cell->face(f)->vertex_index(0)+(slice+1)*input.n_vertices(); + quad.vertices[3] = cell->face(f)->vertex_index(1)+(slice+1)*input.n_vertices(); + s.boundary_quads.push_back(quad); + } } } diff --git a/deal.II/source/grid/grid_out.cc b/deal.II/source/grid/grid_out.cc index 3cefd36157..839f3ff04b 100644 --- a/deal.II/source/grid/grid_out.cc +++ b/deal.II/source/grid/grid_out.cc @@ -1439,7 +1439,7 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const // auxiliary array for the level subdomains being used int level_subdomains[256]; - for(int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) + for (int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) level_subdomains[level_subdomain_index] = 0; // We use an active cell iterator to determine the @@ -1463,7 +1463,7 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const materials[(unsigned int)cell->material_id()] = 1; levels[(unsigned int)cell->level()] = 1; if (cell->active()) - subdomains[cell->subdomain_id()+2] = 1; + subdomains[cell->subdomain_id()+2] = 1; level_subdomains[cell->level_subdomain_id()+2] = 1; } @@ -1489,14 +1489,14 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const } // count the level subdomains being used - for(int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) - { - if(level_subdomains[level_subdomain_index]) n_level_subdomains++; - } + for (int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) + { + if (level_subdomains[level_subdomain_index]) n_level_subdomains++; + } switch (svg_flags.coloring) { - case GridOutFlags::Svg::material_id: + case GridOutFlags::Svg::material_id: n = n_materials; break; case GridOutFlags::Svg::level_number: @@ -1505,7 +1505,8 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case GridOutFlags::Svg::subdomain_id: n = n_subdomains; break; - case GridOutFlags::Svg::level_subdomain_id: n = n_level_subdomains; + case GridOutFlags::Svg::level_subdomain_id: + n = n_level_subdomains; break; default: break; @@ -1770,9 +1771,9 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case GridOutFlags::Svg::subdomain_id: while (!subdomains[labeling_index]) labeling_index++; break; - case GridOutFlags::Svg::level_subdomain_id: - while(!level_subdomains[labeling_index]) labeling_index++; - break; + case GridOutFlags::Svg::level_subdomain_id: + while (!level_subdomains[labeling_index]) labeling_index++; + break; default: break; } @@ -1849,14 +1850,14 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const out << (unsigned int)cell->level(); break; case GridOutFlags::Svg::subdomain_id: - if (cell->active()) - out << cell->subdomain_id() + 2; - else - out << 'X'; + if (cell->active()) + out << cell->subdomain_id() + 2; + else + out << 'X'; + break; + case GridOutFlags::Svg::level_subdomain_id: + out << cell->level_subdomain_id() + 2; break; - case GridOutFlags::Svg::level_subdomain_id: - out << cell->level_subdomain_id() + 2; - break; default: break; } @@ -1965,24 +1966,24 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const if (svg_flags.label_subdomain_id) { if (svg_flags.label_level_number - || svg_flags.label_cell_index - || svg_flags.label_material_id) - out << ','; - if (cell->active()) - out << static_cast(cell->subdomain_id()); - else - out << 'X'; + || svg_flags.label_cell_index + || svg_flags.label_material_id) + out << ','; + if (cell->active()) + out << static_cast(cell->subdomain_id()); + else + out << 'X'; } - if(svg_flags.label_level_subdomain_id) - { - if(svg_flags.label_level_number - || svg_flags.label_cell_index - || svg_flags.label_material_id - || svg_flags.label_subdomain_id) - out << ','; - out << static_cast(cell->level_subdomain_id()); - } + if (svg_flags.label_level_subdomain_id) + { + if (svg_flags.label_level_number + || svg_flags.label_cell_index + || svg_flags.label_material_id + || svg_flags.label_subdomain_id) + out << ','; + out << static_cast(cell->level_subdomain_id()); + } out << "" << '\n'; } @@ -2103,21 +2104,21 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const << "\">" << "subdomain_id"; - if(svg_flags.label_level_subdomain_id) - out << ','; + if (svg_flags.label_level_subdomain_id) + out << ','; out << "" << '\n'; } - if(svg_flags.label_level_subdomain_id) - { - out << " (.5 + (height/100.) * 2.) - << "\" y=\"" << static_cast(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size ) - << "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size - << "\">" - << "level_subdomain_id" - << "" << '\n'; - } + if (svg_flags.label_level_subdomain_id) + { + out << " (.5 + (height/100.) * 2.) + << "\" y=\"" << static_cast(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size ) + << "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size + << "\">" + << "level_subdomain_id" + << "" << '\n'; + } } // show azimuth angle and polar angle as text below the explanation of the cell labeling @@ -2150,8 +2151,9 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case 3: out << "subdomain_id"; break; - case 4: out << "level_subdomain_id"; - break; + case 4: + out << "level_subdomain_id"; + break; default: break; } @@ -2176,8 +2178,9 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case GridOutFlags::Svg::subdomain_id: while (!subdomains[labeling_index]) labeling_index++; break; - case GridOutFlags::Svg::level_subdomain_id: while(!level_subdomains[labeling_index]) labeling_index++; - break; + case GridOutFlags::Svg::level_subdomain_id: + while (!level_subdomains[labeling_index]) labeling_index++; + break; default: break; } @@ -2297,11 +2300,11 @@ void GridOut::write_mathgl (const Triangulation &tria, { case 2: out << "\nlist f 0 1 2 3" - << "\n"; + << "\n"; break; case 3: out << "\nlist f 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7 | 0 1 2 3 | 4 5 6 7" - << "\n"; + << "\n"; break; default: Assert (false, ExcNotImplemented ()); diff --git a/deal.II/source/grid/tria.cc b/deal.II/source/grid/tria.cc index a5df24b512..4a9ba696f2 100644 --- a/deal.II/source/grid/tria.cc +++ b/deal.II/source/grid/tria.cc @@ -11035,15 +11035,15 @@ Triangulation::last_active () const { // get the last used cell cell_iterator cell = last(); - + if (cell != end()) { // then move to the last active one if (cell->active()==true) - return cell; + return cell; while ((--cell).state() == IteratorState::valid) - if (cell->active()==true) - return cell; + if (cell->active()==true) + return cell; } return cell; } @@ -11057,15 +11057,15 @@ Triangulation::last_active (const unsigned int level) const // get the last used cell on this level cell_iterator cell = last(level); - if (cell != end(level)) - { - // then move to the last active one - if (cell->active()==true) - return cell; - while ((--cell).state() == IteratorState::valid) - if (cell->active()==true) - return cell; - } + if (cell != end(level)) + { + // then move to the last active one + if (cell->active()==true) + return cell; + while ((--cell).state() == IteratorState::valid) + if (cell->active()==true) + return cell; + } return cell; } @@ -11194,7 +11194,7 @@ Triangulation::begin_raw_line (const unsigned int level) const { case 1: Assert (level= levels.size() || levels[level]->cells.cells.size() == 0) return end_line(); @@ -11354,10 +11354,10 @@ Triangulation::begin_raw_hex (const unsigned int level) const case 3: { Assert (level= levels.size() || levels[level]->cells.cells.size() == 0) return end_hex(); - + return raw_hex_iterator (const_cast*>(this), level, 0); diff --git a/deal.II/source/grid/tria_boundary_lib.cc b/deal.II/source/grid/tria_boundary_lib.cc index 8929d75b11..df1f4e9911 100644 --- a/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/source/grid/tria_boundary_lib.cc @@ -843,10 +843,10 @@ get_new_point_on_line (const typename Triangulation::line_iterator &line) c if ((line_center(0) == this->center(0)) && ((std::fabs(vertices[0].distance(this->center)-this->radius) > - 1e-5*this->radius) + 1e-5*this->radius) || (std::fabs(vertices[1].distance(this->center)-this->radius) > - 1e-5*this->radius))) + 1e-5*this->radius))) return line_center; else return HyperBallBoundary::get_new_point_on_line (line); diff --git a/deal.II/source/hp/dof_handler.cc b/deal.II/source/hp/dof_handler.cc index 7ab0e8f5fb..c87c3f5dcb 100644 --- a/deal.II/source/hp/dof_handler.cc +++ b/deal.II/source/hp/dof_handler.cc @@ -847,7 +847,7 @@ namespace internal // non-invalid value later on dof_handler.faces->lines.dof_offsets = std::vector (dof_handler.tria->n_raw_lines(), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); dof_handler.faces->lines.dofs = std::vector (n_line_slots, DoFHandler::invalid_dof_index); @@ -1060,7 +1060,7 @@ namespace internal { dof_handler.levels[level]->dof_object.dof_offsets = std::vector (dof_handler.tria->n_raw_hexs(level), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); types::global_dof_index next_free_dof = 0; for (typename DoFHandler::active_cell_iterator @@ -1215,7 +1215,7 @@ namespace internal { dof_handler.faces->quads.dof_offsets = std::vector (dof_handler.tria->n_raw_quads(), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); dof_handler.faces->quads.dofs = std::vector (n_quad_slots, DoFHandler::invalid_dof_index); @@ -1482,9 +1482,9 @@ namespace internal max_couplings_between_dofs (const DoFHandler<1,spacedim> &dof_handler) { return std::min(static_cast (3* - dof_handler.finite_elements->max_dofs_per_vertex() + - 2*dof_handler.finite_elements->max_dofs_per_line()), - dof_handler.n_dofs()); + dof_handler.finite_elements->max_dofs_per_vertex() + + 2*dof_handler.finite_elements->max_dofs_per_line()), + dof_handler.n_dofs()); } @@ -2680,7 +2680,7 @@ namespace hp ExcMessage ("Global number of degrees of freedom is too large.")); number_cache.n_locally_owned_dofs_per_processor = std::vector (1, - (types::global_dof_index) number_cache.n_global_dofs); + (types::global_dof_index) number_cache.n_global_dofs); number_cache.locally_owned_dofs_per_processor = std::vector (1, diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index 2d8316b80c..a9e5b9de0b 100644 --- a/deal.II/source/lac/chunk_sparsity_pattern.cc +++ b/deal.II/source/lac/chunk_sparsity_pattern.cc @@ -190,10 +190,10 @@ ChunkSparsityPattern::reinit ( void ChunkSparsityPattern::reinit ( - const size_type m, - const size_type n, - const VectorSlice > &row_lengths, - const size_type chunk_size) + const size_type m, + const size_type n, + const VectorSlice > &row_lengths, + const size_type chunk_size) { Assert (row_lengths.size() == m, ExcInvalidNumber (m)); Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -337,13 +337,13 @@ void ChunkSparsityPattern::copy_from (const FullMatrix &matrix, for (size_type row=0; rowcolumn() != sparsity_pattern.n_cols() - 1)) - n += chunk_size * chunk_size; - else if ((row == sparsity_pattern.n_rows() - 1) - && - (p->column() != sparsity_pattern.n_cols() - 1)) - // last chunk row, but not last chunk column. only a smaller - // number (n_rows % chunk_size) of rows actually exist - n += (n_rows() % chunk_size) * chunk_size; - else if ((row != sparsity_pattern.n_rows() - 1) - && - (p->column() == sparsity_pattern.n_cols() - 1)) - // last chunk column, but not row - n += (n_cols() % chunk_size) * chunk_size; - else - // bottom right chunk - n += (n_cols() % chunk_size) * - (n_rows() % chunk_size); - } - - return n; + // if columns don't align, then just iterate over all chunks and see + // what this leads to. follow the advice in the documentation of the + // sparsity pattern iterators to do the loop over individual rows, + // rather than all elements + size_type n = 0; + + for (size_type row = 0; row < sparsity_pattern.n_rows(); ++row) + { + SparsityPattern::const_iterator p = sparsity_pattern.begin(row); + for (; p!=sparsity_pattern.end(row); ++p) + if ((row != sparsity_pattern.n_rows() - 1) + && + (p->column() != sparsity_pattern.n_cols() - 1)) + n += chunk_size * chunk_size; + else if ((row == sparsity_pattern.n_rows() - 1) + && + (p->column() != sparsity_pattern.n_cols() - 1)) + // last chunk row, but not last chunk column. only a smaller + // number (n_rows % chunk_size) of rows actually exist + n += (n_rows() % chunk_size) * chunk_size; + else if ((row != sparsity_pattern.n_rows() - 1) + && + (p->column() == sparsity_pattern.n_cols() - 1)) + // last chunk column, but not row + n += (n_cols() % chunk_size) * chunk_size; + else + // bottom right chunk + n += (n_cols() % chunk_size) * + (n_rows() % chunk_size); + } + + return n; } } } @@ -644,7 +644,7 @@ ChunkSparsityPattern::print_gnuplot (std::ostream &out) const -ChunkSparsityPattern::size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::bandwidth () const { // calculate the bandwidth from that of the underlying sparsity diff --git a/deal.II/source/lac/compressed_set_sparsity_pattern.cc b/deal.II/source/lac/compressed_set_sparsity_pattern.cc index d4939cbc85..8086c68642 100644 --- a/deal.II/source/lac/compressed_set_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_set_sparsity_pattern.cc @@ -110,7 +110,7 @@ CompressedSetSparsityPattern::empty () const -CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::max_entries_per_row () const { size_type m = 0; @@ -213,7 +213,7 @@ CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const -CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::bandwidth () const { size_type b=0; @@ -231,7 +231,7 @@ CompressedSetSparsityPattern::bandwidth () const -CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_nonzero_elements () const { size_type n=0; diff --git a/deal.II/source/lac/compressed_simple_sparsity_pattern.cc b/deal.II/source/lac/compressed_simple_sparsity_pattern.cc index a8ce822a7e..df3953b87f 100644 --- a/deal.II/source/lac/compressed_simple_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_simple_sparsity_pattern.cc @@ -317,7 +317,7 @@ CompressedSimpleSparsityPattern::empty () const -CompressedSimpleSparsityPattern::size_type +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::max_entries_per_row () const { size_type m = 0; @@ -430,7 +430,7 @@ CompressedSimpleSparsityPattern::print_gnuplot (std::ostream &out) const -CompressedSimpleSparsityPattern::size_type +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::bandwidth () const { size_type b=0; @@ -451,7 +451,7 @@ CompressedSimpleSparsityPattern::bandwidth () const -CompressedSimpleSparsityPattern::size_type +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::n_nonzero_elements () const { size_type n=0; diff --git a/deal.II/source/lac/compressed_sparsity_pattern.cc b/deal.II/source/lac/compressed_sparsity_pattern.cc index 8917c6c007..a857dec9c1 100644 --- a/deal.II/source/lac/compressed_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_sparsity_pattern.cc @@ -402,7 +402,7 @@ CompressedSparsityPattern::empty () const -CompressedSparsityPattern::size_type +CompressedSparsityPattern::size_type CompressedSparsityPattern::max_entries_per_row () const { size_type m = 0; @@ -513,7 +513,7 @@ CompressedSparsityPattern::print_gnuplot (std::ostream &out) const -CompressedSparsityPattern::size_type +CompressedSparsityPattern::size_type CompressedSparsityPattern::bandwidth () const { size_type b=0; @@ -534,7 +534,7 @@ CompressedSparsityPattern::bandwidth () const -CompressedSparsityPattern::size_type +CompressedSparsityPattern::size_type CompressedSparsityPattern::n_nonzero_elements () const { size_type n=0; diff --git a/deal.II/source/lac/constraint_matrix.cc b/deal.II/source/lac/constraint_matrix.cc index 9f3cb23638..099e3703d6 100644 --- a/deal.II/source/lac/constraint_matrix.cc +++ b/deal.II/source/lac/constraint_matrix.cc @@ -197,7 +197,7 @@ void ConstraintMatrix::close () // won't modify the size any more after this point. { std::vector new_lines (lines_cache.size(), - numbers::invalid_size_type); + numbers::invalid_size_type); size_type counter = 0; for (std::vector::const_iterator line=lines.begin(); line!=lines.end(); ++line, ++counter) @@ -529,7 +529,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, for (ConstraintLine::Entries::const_iterator j=other_line->begin(); j!=other_line->end(); ++j) tmp.push_back (std::pair(j->first, - j->second*weight)); + j->second*weight)); line->inhomogeneity += other_constraints.get_inhomogeneity(line->entries[i].first) * weight; @@ -871,7 +871,7 @@ void ConstraintMatrix::condense (CompressedSparsityPattern &sparsity) const q!=lines[distribute[column]].entries.size(); ++q) { - const size_type + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); @@ -948,7 +948,7 @@ void ConstraintMatrix::condense (CompressedSetSparsityPattern &sparsity) const q!=lines[distribute[column]].entries.size(); ++q) { - const size_type + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); @@ -1000,7 +1000,7 @@ void ConstraintMatrix::condense (CompressedSimpleSparsityPattern &sparsity) cons // otherwise, the number states which line in the constraint matrix // handles this index std::vector distribute(sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c(c); @@ -1321,7 +1321,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co // otherwise, the number states which line in the constraint matrix // handles this index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c(c); @@ -1434,7 +1434,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) // otherwise, the number states which line in the constraint matrix // handles this index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c(c); @@ -1503,7 +1503,8 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and // regular column global_col. - { for (size_type q=0; + { + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); @@ -1511,7 +1512,8 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) else // distribute entry at irregular row @p{row} and // irregular column @p{global_col} - { for (size_type p=0; + { + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, @@ -1541,7 +1543,7 @@ bool ConstraintMatrix::is_identity_constrained (const size_type index) const -ConstraintMatrix::size_type +ConstraintMatrix::size_type ConstraintMatrix::max_constraint_indirections () const { size_type return_value = 0; diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index 0c2c758ef3..fb96b311eb 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -281,7 +281,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase::n () const { PetscInt n_rows, n_cols; @@ -294,7 +294,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase::local_size () const { PetscInt n_rows, n_cols; @@ -321,7 +321,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase::n_nonzero_elements () const { MatInfo mat_info; @@ -334,7 +334,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase:: row_length (const size_type row) const { @@ -469,16 +469,16 @@ namespace PETScWrappers MatrixBase & MatrixBase::add (const MatrixBase &other, - const PetscScalar factor) + const PetscScalar factor) { const int ierr = MatAXPY (matrix, factor, - other, DIFFERENT_NONZERO_PATTERN); + other, DIFFERENT_NONZERO_PATTERN); Assert (ierr == 0, ExcPETScError(ierr)); return *this; } - + void MatrixBase::vmult (VectorBase &dst, @@ -612,7 +612,7 @@ namespace PETScWrappers void MatrixBase::print (std::ostream &out, - const bool alternative_output) const + const bool alternative_output) const { std::pair loc_range = local_range(); diff --git a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc index 0b0f206b6a..531cd6be06 100644 --- a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc @@ -71,9 +71,9 @@ namespace PETScWrappers void BlockSparseMatrix:: reinit(const std::vector &rows, - const std::vector &cols, - const BlockCompressedSimpleSparsityPattern &bcsp, - const MPI_Comm &com) + const std::vector &cols, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com) { Assert(rows.size() == bcsp.n_block_rows(), ExcMessage("invalid size")); Assert(cols.size() == bcsp.n_block_cols(), ExcMessage("invalid size")); @@ -81,31 +81,31 @@ namespace PETScWrappers clear(); this->sub_objects.reinit (bcsp.n_block_rows(), - bcsp.n_block_cols()); + bcsp.n_block_cols()); std::vector row_sizes; for (unsigned int r=0; rrow_block_indices.reinit (row_sizes); std::vector col_sizes; for (unsigned int c=0; ccolumn_block_indices.reinit (col_sizes); for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) - { - Assert(rows[r].size() == bcsp.block(r,c).n_rows(), ExcMessage("invalid size")); - Assert(cols[c].size() == bcsp.block(r,c).n_cols(), ExcMessage("invalid size")); - - BlockType *p = new BlockType(); - p->reinit(rows[r], - cols[c], - bcsp.block(r,c), - com); - this->sub_objects[r][c] = p; - } + for (unsigned int c=0; cn_block_cols(); ++c) + { + Assert(rows[r].size() == bcsp.block(r,c).n_rows(), ExcMessage("invalid size")); + Assert(cols[c].size() == bcsp.block(r,c).n_cols(), ExcMessage("invalid size")); + + BlockType *p = new BlockType(); + p->reinit(rows[r], + cols[c], + bcsp.block(r,c), + com); + this->sub_objects[r][c] = p; + } collect_sizes(); } @@ -113,8 +113,8 @@ namespace PETScWrappers void BlockSparseMatrix:: reinit(const std::vector &sizes, - const BlockCompressedSimpleSparsityPattern &bcsp, - const MPI_Comm &com) + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com) { reinit(sizes, sizes, bcsp, com); } diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index 1c0c933a2e..e366b66458 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -193,10 +193,10 @@ namespace PETScWrappers template void SparseMatrix:: - reinit (const IndexSet & local_rows, - const IndexSet & local_columns, - const SparsityType &sparsity_pattern, - const MPI_Comm &communicator) + reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern, + const MPI_Comm &communicator) { this->communicator = communicator; @@ -343,166 +343,166 @@ namespace PETScWrappers template void SparseMatrix:: - do_reinit (const IndexSet & local_rows, - const IndexSet & local_columns, - const SparsityType &sparsity_pattern) + do_reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern) { Assert(sparsity_pattern.n_rows()==local_rows.size(), - ExcMessage("SparsityPattern and IndexSet have different number of rows")); + ExcMessage("SparsityPattern and IndexSet have different number of rows")); Assert(sparsity_pattern.n_cols()==local_columns.size(), - ExcMessage("SparsityPattern and IndexSet have different number of columns")); + ExcMessage("SparsityPattern and IndexSet have different number of columns")); Assert(local_rows.is_contiguous() && local_columns.is_contiguous(), - ExcMessage("PETSc only supports contiguous row/column ranges")); + ExcMessage("PETSc only supports contiguous row/column ranges")); - // create the matrix. We do not set row length but set the - // correct SparsityPattern later. - int ierr; + // create the matrix. We do not set row length but set the + // correct SparsityPattern later. + int ierr; + + ierr = MatCreate(communicator,&matrix); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = MatSetSizes(matrix, + local_rows.n_elements(), + local_columns.n_elements(), + sparsity_pattern.n_rows(), + sparsity_pattern.n_cols()); + AssertThrow (ierr == 0, ExcPETScError(ierr)); - ierr = MatCreate(communicator,&matrix); - AssertThrow (ierr == 0, ExcPETScError(ierr)); + ierr = MatSetType(matrix,MATMPIAIJ); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + + // next preset the exact given matrix + // entries with zeros. this doesn't avoid any + // memory allocations, but it at least + // avoids some searches later on. the + // key here is that we can use the + // matrix set routines that set an + // entire row at once, not a single + // entry at a time + // + // for the usefulness of this option + // read the documentation of this + // class. + //if (preset_nonzero_locations == true) + if (local_rows.n_elements()>0) + { + Assert(local_columns.n_elements()>0, ExcInternalError()); + // MatMPIAIJSetPreallocationCSR + // can be used to allocate the sparsity + // pattern of a matrix - ierr = MatSetSizes(matrix, - local_rows.n_elements(), - local_columns.n_elements(), - sparsity_pattern.n_rows(), - sparsity_pattern.n_cols()); - AssertThrow (ierr == 0, ExcPETScError(ierr)); + const PetscInt local_row_start = local_rows.nth_index_in_set(0); + const PetscInt + local_row_end = local_row_start + local_rows.n_elements(); - ierr = MatSetType(matrix,MATMPIAIJ); - AssertThrow (ierr == 0, ExcPETScError(ierr)); + // first set up the column number + // array for the rows to be stored + // on the local processor. have one + // dummy entry at the end to make + // sure petsc doesn't read past the + // end + std::vector - // next preset the exact given matrix - // entries with zeros. this doesn't avoid any - // memory allocations, but it at least - // avoids some searches later on. the - // key here is that we can use the - // matrix set routines that set an - // entire row at once, not a single - // entry at a time - // - // for the usefulness of this option - // read the documentation of this - // class. - //if (preset_nonzero_locations == true) - if (local_rows.n_elements()>0) + rowstart_in_window (local_row_end - local_row_start + 1, 0), + colnums_in_window; + { + unsigned int n_cols = 0; + for (PetscInt i=local_row_start; i0, ExcInternalError()); - // MatMPIAIJSetPreallocationCSR - // can be used to allocate the sparsity - // pattern of a matrix - - const PetscInt local_row_start = local_rows.nth_index_in_set(0); - const PetscInt - local_row_end = local_row_start + local_rows.n_elements(); - - - // first set up the column number - // array for the rows to be stored - // on the local processor. have one - // dummy entry at the end to make - // sure petsc doesn't read past the - // end - std::vector - - rowstart_in_window (local_row_end - local_row_start + 1, 0), - colnums_in_window; - { - unsigned int n_cols = 0; - for (PetscInt i=local_row_start; i(solver_control_x); diff --git a/deal.II/source/lac/petsc_sparse_matrix.cc b/deal.II/source/lac/petsc_sparse_matrix.cc index 01b596a492..3b31a75316 100644 --- a/deal.II/source/lac/petsc_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_sparse_matrix.cc @@ -197,7 +197,7 @@ namespace PETScWrappers // convert, unless we want to play dirty // tricks with conversions of pointers const std::vector - int_row_lengths (row_lengths.begin(), row_lengths.end()); + int_row_lengths (row_lengths.begin(), row_lengths.end()); const int ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, 0, diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index b838981583..ae6e39c52b 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -154,8 +154,8 @@ namespace PETScWrappers attained_ownership(true) { Assert( multithread_info.is_running_single_threaded(), - ExcMessage("PETSc does not support multi-threaded access, set " - "the thread limit to 1 in MPI_InitFinalize().")); + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); } @@ -169,8 +169,8 @@ namespace PETScWrappers attained_ownership(true) { Assert( multithread_info.is_running_single_threaded(), - ExcMessage("PETSc does not support multi-threaded access, set " - "the thread limit to 1 in MPI_InitFinalize().")); + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); int ierr = VecDuplicate (v.vector, &vector); AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -190,8 +190,8 @@ namespace PETScWrappers attained_ownership(false) { Assert( multithread_info.is_running_single_threaded(), - ExcMessage("PETSc does not support multi-threaded access, set " - "the thread limit to 1 in MPI_InitFinalize().")); + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); } @@ -269,7 +269,7 @@ namespace PETScWrappers - VectorBase::size_type + VectorBase::size_type VectorBase::size () const { PetscInt sz; @@ -281,7 +281,7 @@ namespace PETScWrappers - VectorBase::size_type + VectorBase::size_type VectorBase::local_size () const { PetscInt sz; @@ -469,13 +469,13 @@ namespace PETScWrappers return mean; #else // PETSC_USE_COMPLEX - Assert ((false), - ExcMessage ("Your PETSc/SLEPc installation was configured with scalar-type complex " - "but this function is not defined for complex types.")); + Assert ((false), + ExcMessage ("Your PETSc/SLEPc installation was configured with scalar-type complex " + "but this function is not defined for complex types.")); - // Prevent compiler warning about no return value - PetscScalar dummy; - return dummy; + // Prevent compiler warning about no return value + PetscScalar dummy; + return dummy; #endif } diff --git a/deal.II/source/lac/slepc_solver.cc b/deal.II/source/lac/slepc_solver.cc index bd06c532ab..b821a61c71 100644 --- a/deal.II/source/lac/slepc_solver.cc +++ b/deal.II/source/lac/slepc_solver.cc @@ -110,8 +110,8 @@ namespace SLEPcWrappers } void - SolverBase::solve (const size_type n_eigenpairs, - size_type *n_converged) + SolverBase::solve (const size_type n_eigenpairs, + size_type *n_converged) { int ierr; @@ -158,7 +158,7 @@ namespace SLEPcWrappers // set target eigenvalues to solve for ierr = EPSSetTarget (solver_data->eps, target_eigenvalue); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - + // set which portion of the eigenspectrum to solve for ierr = EPSSetWhichEigenpairs (solver_data->eps, set_which); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); @@ -227,8 +227,8 @@ namespace SLEPcWrappers // get converged eigenpair int ierr = EPSGetEigenpair (solver_data->eps, index, - &eigenvalues, PETSC_NULL, - eigenvectors, PETSC_NULL); + &eigenvalues, PETSC_NULL, + eigenvectors, PETSC_NULL); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } @@ -242,11 +242,11 @@ namespace SLEPcWrappers { #ifndef PETSC_USE_COMPLEX AssertThrow (solver_data.get() != 0, ExcSLEPcWrappersUsageError()); - + // get converged eigenpair int ierr = EPSGetEigenpair (solver_data->eps, index, - &real_eigenvalues, &imag_eigenvalues, - real_eigenvectors, imag_eigenvectors); + &real_eigenvalues, &imag_eigenvalues, + real_eigenvectors, imag_eigenvectors); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); #else Assert ((false), @@ -495,8 +495,8 @@ namespace SLEPcWrappers /* ---------------------- LAPACK ------------------------- */ SolverLAPACK::SolverLAPACK (SolverControl &cn, - const MPI_Comm &mpi_communicator, - const AdditionalData &data) + const MPI_Comm &mpi_communicator, + const AdditionalData &data) : SolverBase (cn, mpi_communicator), additional_data (data) diff --git a/deal.II/source/lac/sparse_direct.cc b/deal.II/source/lac/sparse_direct.cc index 9c1849d9fd..ed801cea31 100644 --- a/deal.II/source/lac/sparse_direct.cc +++ b/deal.II/source/lac/sparse_direct.cc @@ -251,7 +251,7 @@ factorize (const Matrix &matrix) for (size_type row = 0; row < matrix.m(); ++row) { for (typename Matrix::const_iterator p=matrix.begin(row); - p!=matrix.end(row); ++p) + p!=matrix.end(row); ++p) { // write entry into the first free one for this row Ai[row_pointers[row]] = p->column(); @@ -552,7 +552,7 @@ void SparseDirectMUMPS::initialize_matrix (const Matrix &matrix) for (size_type row = 0; row < matrix.m(); ++row) { for (typename Matrix::const_iterator ptr = matrix.begin (row); - ptr != matrix.end (row); ++ptr) + ptr != matrix.end (row); ++ptr) if (std::abs (ptr->value ()) > 0.0) { a[index] = ptr->value (); diff --git a/deal.II/source/lac/sparsity_pattern.cc b/deal.II/source/lac/sparsity_pattern.cc index 89cbcac230..18f2c1b0de 100644 --- a/deal.II/source/lac/sparsity_pattern.cc +++ b/deal.II/source/lac/sparsity_pattern.cc @@ -389,8 +389,8 @@ SparsityPattern::reinit (const size_type m, std::size_t vec_len = 0; for (size_type i=0; i(store_diagonal_first_in_row ? - std::max(row_lengths[i], 1U) : - row_lengths[i]), + std::max(row_lengths[i], 1U) : + row_lengths[i]), n); // sometimes, no entries are @@ -416,7 +416,7 @@ SparsityPattern::reinit (const size_type m, max_row_length = (row_lengths.size() == 0 ? 0 : std::min (static_cast(*std::max_element(row_lengths.begin(), - row_lengths.end())), + row_lengths.end())), n)); if (store_diagonal_first_in_row && (max_row_length==0) && (m!=0)) @@ -468,7 +468,7 @@ SparsityPattern::reinit (const size_type m, rowstart[i] = rowstart[i-1] + (store_diagonal_first_in_row ? std::max(std::min(static_cast(row_lengths[i-1]),n), - static_cast (1U)) : + static_cast (1U)) : std::min(static_cast(row_lengths[i-1]),n)); Assert ((rowstart[rows]==vec_len) || @@ -775,7 +775,7 @@ SparsityPattern::empty () const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::max_entries_per_row () const { // if compress() has not yet been @@ -797,7 +797,7 @@ SparsityPattern::max_entries_per_row () const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::operator () (const size_type i, const size_type j) const { @@ -835,8 +835,8 @@ SparsityPattern::operator () (const size_type i, &colnums[rowstart[i]]); const size_type *const p = Utilities::lower_bound (sorted_region_start, - &colnums[rowstart[i+1]], - j); + &colnums[rowstart[i+1]], + j); if ((p != &colnums[rowstart[i+1]]) && (*p == j)) return (p - &colnums[0]); else @@ -935,7 +935,7 @@ SparsityPattern::exists (const size_type i, const size_type j) const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::row_position (const size_type i, const size_type j) const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); @@ -1071,7 +1071,7 @@ SparsityPattern::print_gnuplot (std::ostream &out) const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::bandwidth () const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); diff --git a/deal.II/source/lac/trilinos_precondition.cc b/deal.II/source/lac/trilinos_precondition.cc index 03da162dcc..d8342f04d2 100644 --- a/deal.II/source/lac/trilinos_precondition.cc +++ b/deal.II/source/lac/trilinos_precondition.cc @@ -629,7 +629,7 @@ namespace TrilinosWrappers for (size_type d=0; d(n_rows), - 0, communicator)); + vector_distributor.reset (new Epetra_Map(static_cast(n_rows), + 0, communicator)); if (trilinos_matrix.get() == 0) trilinos_matrix.reset (new SparseMatrix()); diff --git a/deal.II/source/lac/trilinos_solver.cc b/deal.II/source/lac/trilinos_solver.cc index f04ca39f85..635dec1690 100644 --- a/deal.II/source/lac/trilinos_solver.cc +++ b/deal.II/source/lac/trilinos_solver.cc @@ -49,9 +49,9 @@ namespace TrilinosWrappers SolverBase::SolverBase (const enum SolverBase::SolverName solver_name, SolverControl &cn) - : - solver_name (solver_name), - solver_control (cn) + : + solver_name (solver_name), + solver_control (cn) {} diff --git a/deal.II/source/lac/trilinos_sparse_matrix.cc b/deal.II/source/lac/trilinos_sparse_matrix.cc index d663b1dfc7..dddb391a86 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_sparse_matrix.cc @@ -440,8 +440,8 @@ namespace TrilinosWrappers { namespace { - // distinguish between compressed sparsity types that define row_begin() - // and SparsityPattern that uses begin() as iterator type + // distinguish between compressed sparsity types that define row_begin() + // and SparsityPattern that uses begin() as iterator type template void copy_row (const Sparsity &csp, const size_type row, @@ -501,7 +501,7 @@ namespace TrilinosWrappers column_space_map.reset (new Epetra_Map (input_col_map)); const size_type first_row = min_my_gid(input_row_map), - last_row = max_my_gid(input_row_map)+1; + last_row = max_my_gid(input_row_map)+1; std::vector n_entries_per_row(last_row-first_row); for (size_type row=first_row; row( - n_global_cols(*graph))); + n_global_cols(*graph))); // And now finally generate the matrix. matrix.reset (new Epetra_FECrsMatrix(Copy, *graph, false)); @@ -848,7 +848,7 @@ namespace TrilinosWrappers // Extract local indices in // the matrix. int trilinos_i = matrix->LRID(static_cast(i)), - trilinos_j = matrix->LCID(static_cast(j)); + trilinos_j = matrix->LCID(static_cast(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -923,7 +923,7 @@ namespace TrilinosWrappers // Extract local indices in // the matrix. int trilinos_i = matrix->LRID(static_cast(i)), - trilinos_j = matrix->LCID(static_cast(j)); + trilinos_j = matrix->LCID(static_cast(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -1482,9 +1482,9 @@ namespace TrilinosWrappers SparseMatrix::memory_consumption () const { size_type static_memory = sizeof(this) + sizeof (*matrix) - + sizeof(*matrix->Graph().DataPtr()); + + sizeof(*matrix->Graph().DataPtr()); return ((sizeof(TrilinosScalar)+sizeof(TrilinosWrappers::types::int_type))* - matrix->NumMyNonzeros() + sizeof(int)*local_size() + static_memory); + matrix->NumMyNonzeros() + sizeof(int)*local_size() + static_memory); } } diff --git a/deal.II/source/lac/trilinos_sparsity_pattern.cc b/deal.II/source/lac/trilinos_sparsity_pattern.cc index 34d7fcbd98..92d0789b74 100644 --- a/deal.II/source/lac/trilinos_sparsity_pattern.cc +++ b/deal.II/source/lac/trilinos_sparsity_pattern.cc @@ -55,7 +55,7 @@ namespace TrilinosWrappers return graph.NumGlobalRows(); } - int n_global_cols(const Epetra_CrsGraph &graph) + int n_global_cols(const Epetra_CrsGraph &graph) { return graph.NumGlobalCols(); } @@ -69,7 +69,7 @@ namespace TrilinosWrappers { return graph.GRID(i); } - #else +#else long long int n_global_elements (const Epetra_BlockMap &map) { return map.NumGlobalElements64(); @@ -148,7 +148,7 @@ namespace TrilinosWrappers // would it point to?) Assert (ncols != 0, ExcInternalError()); colnum_cache.reset (new std::vector (colnums, - colnums+ncols)); + colnums+ncols)); } } @@ -169,12 +169,12 @@ namespace TrilinosWrappers compressed (true) { column_space_map.reset(new Epetra_Map (TrilinosWrappers::types::int_type(0), - TrilinosWrappers::types::int_type(0), - Utilities::Trilinos::comm_self())); + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())); graph.reset (new Epetra_FECrsGraph(View, - *column_space_map, - *column_space_map, - 0)); + *column_space_map, + *column_space_map, + 0)); graph->FillComplete(); } @@ -236,13 +236,13 @@ namespace TrilinosWrappers : Subscriptor(), column_space_map (new Epetra_Map(TrilinosWrappers::types::int_type(0), - TrilinosWrappers::types::int_type(0), - Utilities::Trilinos::comm_self())), + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())), compressed (false), graph (new Epetra_FECrsGraph(View, - *column_space_map, *column_space_map, - 0)) + *column_space_map, + 0)) { Assert (input_sparsity.n_rows() == 0, ExcMessage ("Copy constructor only works for empty sparsity patterns.")); @@ -269,9 +269,9 @@ namespace TrilinosWrappers const size_type n_entries_per_row) { const Epetra_Map rows (TrilinosWrappers::types::int_type(m), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); const Epetra_Map columns (TrilinosWrappers::types::int_type(n), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -321,9 +321,9 @@ namespace TrilinosWrappers const std::vector &n_entries_per_row) { const Epetra_Map rows (TrilinosWrappers::types::int_type(m), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); const Epetra_Map columns (TrilinosWrappers::types::int_type(n), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -371,8 +371,8 @@ namespace TrilinosWrappers namespace { typedef dealii::types::global_dof_index size_type; - // distinguish between compressed sparsity types that define row_begin() - // and SparsityPattern that uses begin() as iterator type + // distinguish between compressed sparsity types that define row_begin() + // and SparsityPattern that uses begin() as iterator type template void copy_row (const Sparsity &csp, const size_type row, @@ -417,11 +417,11 @@ namespace TrilinosWrappers ExcMessage ("This function is not efficient if the map is not contiguous.")); const size_type first_row = min_my_gid(input_row_map), - last_row = max_my_gid(input_row_map)+1; + last_row = max_my_gid(input_row_map)+1; std::vector n_entries_per_row(last_row - first_row); - // Trilinos wants the row length as an int - // this is hopefully never going to be a problem. + // Trilinos wants the row length as an int + // this is hopefully never going to be a problem. for (size_type row=first_row; row(sp.row_length(row)); @@ -487,9 +487,9 @@ namespace TrilinosWrappers SparsityPattern::copy_from (const SparsityType &sp) { const Epetra_Map rows (TrilinosWrappers::types::int_type(sp.n_rows()), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); const Epetra_Map columns (TrilinosWrappers::types::int_type(sp.n_cols()), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); reinit (rows, columns, sp); } @@ -503,8 +503,8 @@ namespace TrilinosWrappers // the pointer and generate an // empty sparsity pattern. column_space_map.reset (new Epetra_Map (TrilinosWrappers::types::int_type(0), - TrilinosWrappers::types::int_type(0), - Utilities::Trilinos::comm_self())); + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())); graph.reset (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); graph->FillComplete(); @@ -540,7 +540,7 @@ namespace TrilinosWrappers // Extract local indices in // the matrix. int trilinos_i = graph->LRID(static_cast(i)), - trilinos_j = graph->LCID(static_cast(j)); + trilinos_j = graph->LCID(static_cast(j)); // If the data is not on the // present processor, we throw @@ -566,12 +566,12 @@ namespace TrilinosWrappers // Generate the view and make // sure that we have not generated // an error. - // TODO: trilinos_i is the local row index -> it is an int but + // TODO: trilinos_i is the local row index -> it is an int but // ExtractGlobalRowView requires trilinos_i to be the global row // index and thus it should be a long long int int ierr = graph->ExtractGlobalRowView( - static_cast(trilinos_i), - nnz_extracted, col_indices); + static_cast(trilinos_i), + nnz_extracted, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); Assert (nnz_present == nnz_extracted, ExcDimensionMismatch(nnz_present, nnz_extracted)); @@ -591,7 +591,7 @@ namespace TrilinosWrappers // Prepare pointers for extraction // of a view of the row. int nnz_present = graph->NumGlobalIndices( - static_cast(i)); + static_cast(i)); int nnz_extracted; int *col_indices; @@ -599,7 +599,7 @@ namespace TrilinosWrappers // sure that we have not generated // an error. int ierr = graph->ExtractMyRowView(trilinos_i, - nnz_extracted, col_indices); + nnz_extracted, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); Assert (nnz_present == nnz_extracted, @@ -607,7 +607,7 @@ namespace TrilinosWrappers // Search the index int *el_find = std::find(col_indices, col_indices + nnz_present, - static_cast(trilinos_j)); + static_cast(trilinos_j)); int local_col_index = (int)(el_find - col_indices); @@ -783,7 +783,7 @@ namespace TrilinosWrappers // x-y, that is we have to exchange // the order of output out << indices[global_row_index(*graph,static_cast(j))] - << " " << -static_cast(row) << std::endl; + << " " << -static_cast(row) << std::endl; } AssertThrow (out, ExcIO()); diff --git a/deal.II/source/lac/trilinos_vector.cc b/deal.II/source/lac/trilinos_vector.cc index fc2f03a3ec..a8b0265287 100644 --- a/deal.II/source/lac/trilinos_vector.cc +++ b/deal.II/source/lac/trilinos_vector.cc @@ -46,12 +46,12 @@ namespace TrilinosWrappers // by calling either the 32- or 64-bit function necessary, and returns the // result in the correct data type so that we can use it in calling other // Epetra member functions that are overloaded by index type - int* my_global_elements(const Epetra_BlockMap &map) + int *my_global_elements(const Epetra_BlockMap &map) { - return map.MyGlobalElements(); + return map.MyGlobalElements(); } // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. int global_length(const Epetra_FEVector &vector) { @@ -71,12 +71,12 @@ namespace TrilinosWrappers // by calling either the 32- or 64-bit function necessary, and returns the // result in the correct data type so that we can use it in calling other // Epetra member functions that are overloaded by index type - long long int* my_global_elements(const Epetra_BlockMap &map) + long long int *my_global_elements(const Epetra_BlockMap &map) { - return map.MyGlobalElements64(); + return map.MyGlobalElements64(); } // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. long long int global_length(const Epetra_FEVector &vector) { @@ -129,8 +129,8 @@ namespace TrilinosWrappers VectorBase() { AssertThrow (n_global_elements(input_map) == n_global_elements(v.vector->Map()), - ExcDimensionMismatch (n_global_elements(input_map), - n_global_elements(v.vector->Map()))); + ExcDimensionMismatch (n_global_elements(input_map), + n_global_elements(v.vector->Map()))); last_action = Zero; @@ -151,7 +151,7 @@ namespace TrilinosWrappers : VectorBase() { - AssertThrow (parallel_partitioner.size() == + AssertThrow (parallel_partitioner.size() == static_cast(n_global_elements(v.vector->Map())), ExcDimensionMismatch (parallel_partitioner.size(), n_global_elements(v.vector->Map()))); diff --git a/deal.II/source/lac/trilinos_vector_base.cc b/deal.II/source/lac/trilinos_vector_base.cc index 93609f5d4a..a04d816612 100644 --- a/deal.II/source/lac/trilinos_vector_base.cc +++ b/deal.II/source/lac/trilinos_vector_base.cc @@ -31,7 +31,7 @@ namespace TrilinosWrappers { #ifndef DEAL_II_USE_LARGE_INDEX_TYPE // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. int global_length(const Epetra_FEVector &vector) { @@ -39,7 +39,7 @@ namespace TrilinosWrappers } #else // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. long long int global_length(const Epetra_FEVector &vector) { @@ -63,7 +63,7 @@ namespace TrilinosWrappers // we can use []. Note that we // can only get local values. - const TrilinosWrappers::types::int_type local_index = + const TrilinosWrappers::types::int_type local_index = vector.vector->Map().LID(static_cast(index)); Assert (local_index >= 0, ExcAccessToNonLocalElement (index, @@ -191,7 +191,7 @@ namespace TrilinosWrappers { // Extract local indices in // the vector. - TrilinosWrappers::types::int_type trilinos_i = + TrilinosWrappers::types::int_type trilinos_i = vector->Map().LID(static_cast(index)); TrilinosScalar value = 0.; @@ -220,7 +220,7 @@ namespace TrilinosWrappers { // Extract local indices in // the vector. - TrilinosWrappers::types::int_type trilinos_i = + TrilinosWrappers::types::int_type trilinos_i = vector->Map().LID(static_cast(index)); TrilinosScalar value = 0.; @@ -449,7 +449,7 @@ namespace TrilinosWrappers //entry. return sizeof(*this) + this->local_size()*( sizeof(double)+ - sizeof(TrilinosWrappers::types::int_type) ); + sizeof(TrilinosWrappers::types::int_type) ); } } /* end of namespace TrilinosWrappers */ diff --git a/deal.II/source/meshworker/mesh_worker.cc b/deal.II/source/meshworker/mesh_worker.cc index e89e9b2ee6..f2bbd879f5 100644 --- a/deal.II/source/meshworker/mesh_worker.cc +++ b/deal.II/source/meshworker/mesh_worker.cc @@ -80,7 +80,7 @@ namespace MeshWorker template void LocalIntegrator::cell (DoFInfo &, - IntegrationInfo &) const + IntegrationInfo &) const { Assert(false, ExcPureFunction()); } @@ -89,7 +89,7 @@ namespace MeshWorker template void LocalIntegrator::boundary (DoFInfo &, - IntegrationInfo &) const + IntegrationInfo &) const { Assert(false, ExcPureFunction()); } @@ -98,9 +98,9 @@ namespace MeshWorker template void LocalIntegrator::face (DoFInfo &, - DoFInfo &, - IntegrationInfo &, - IntegrationInfo &) const + DoFInfo &, + IntegrationInfo &, + IntegrationInfo &) const { Assert(false, ExcPureFunction()); } diff --git a/deal.II/source/multigrid/mg_tools.cc b/deal.II/source/multigrid/mg_tools.cc index c05994c522..5d74887ef2 100644 --- a/deal.II/source/multigrid/mg_tools.cc +++ b/deal.II/source/multigrid/mg_tools.cc @@ -591,8 +591,8 @@ namespace MGTools endc = dof.end(level); for (; cell!=endc; ++cell) { - if (!cell->is_locally_owned_on_level()) continue; - + if (!cell->is_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // make sparsity pattern for this cell for (unsigned int i=0; iis_locally_owned_on_level()) continue; - + if (!cell->is_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // Loop over all interior neighbors for (unsigned int face = 0; @@ -746,9 +746,9 @@ namespace MGTools for (; cell!=endc; ++cell) { - if (!cell->is_locally_owned_on_level()) continue; - - cell->get_mg_dof_indices (dofs_on_this_cell); + if (!cell->is_locally_owned_on_level()) continue; + + cell->get_mg_dof_indices (dofs_on_this_cell); // make sparsity pattern for this cell for (unsigned int i=0; iis_locally_owned_on_level()) continue; - + if (!cell->is_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // Loop over all interior neighbors for (unsigned int face = 0; @@ -1248,120 +1248,120 @@ namespace MGTools for (; cell!=endc; ++cell) if (dof.get_tria().locally_owned_subdomain()==numbers::invalid_subdomain_id || cell->level_subdomain_id()==dof.get_tria().locally_owned_subdomain()) - for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; - ++face_no) - { - if (cell->at_boundary(face_no) == false) - continue; + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + { + if (cell->at_boundary(face_no) == false) + continue; - const FiniteElement &fe = cell->get_fe(); - const unsigned int level = cell->level(); - - // we can presently deal only with - // primitive elements for boundary - // values. this does not preclude - // us using non-primitive elements - // in components that we aren't - // interested in, however. make - // sure that all shape functions - // that are non-zero for the - // components we are interested in, - // are in fact primitive - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - { - const ComponentMask &nonzero_component_array - = cell->get_fe().get_nonzero_components (i); - for (unsigned int c=0; cget_fe().is_primitive (i), - ExcMessage ("This function can only deal with requested boundary " - "values that correspond to primitive (scalar) base " - "elements")); - } + const FiniteElement &fe = cell->get_fe(); + const unsigned int level = cell->level(); + + // we can presently deal only with + // primitive elements for boundary + // values. this does not preclude + // us using non-primitive elements + // in components that we aren't + // interested in, however. make + // sure that all shape functions + // that are non-zero for the + // components we are interested in, + // are in fact primitive + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + { + const ComponentMask &nonzero_component_array + = cell->get_fe().get_nonzero_components (i); + for (unsigned int c=0; cget_fe().is_primitive (i), + ExcMessage ("This function can only deal with requested boundary " + "values that correspond to primitive (scalar) base " + "elements")); + } - typename DoFHandler::face_iterator face = cell->face(face_no); - const types::boundary_id boundary_component = face->boundary_indicator(); - if (function_map.find(boundary_component) != function_map.end()) - // face is of the right component - { - // get indices, physical location and - // boundary values of dofs on this - // face - local_dofs.resize (fe.dofs_per_face); - face->get_mg_dof_indices (level, local_dofs); - if (fe_is_system) - { - // enter those dofs - // into the list that - // match the - // component - // signature. avoid - // the usual - // complication that - // we can't just use - // *_system_to_component_index - // for non-primitive - // FEs - for (unsigned int i=0; i::face_iterator face = cell->face(face_no); + const types::boundary_id boundary_component = face->boundary_indicator(); + if (function_map.find(boundary_component) != function_map.end()) + // face is of the right component + { + // get indices, physical location and + // boundary values of dofs on this + // face + local_dofs.resize (fe.dofs_per_face); + face->get_mg_dof_indices (level, local_dofs); + if (fe_is_system) + { + // enter those dofs + // into the list that + // match the + // component + // signature. avoid + // the usual + // complication that + // we can't just use + // *_system_to_component_index + // for non-primitive + // FEs + for (unsigned int i=0; i::build_matrices ( cell != mg_dof.end(level); ++cell) if (cell->has_children() && ( mg_dof.get_tria().locally_owned_subdomain()==numbers::invalid_subdomain_id - || cell->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain() - )) + || cell->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain() + )) { cell->get_mg_dof_indices (dof_indices_parent); @@ -185,23 +185,23 @@ void MGTransferPrebuilt::build_matrices ( } } } - + internal::MatrixSelector::reinit(*prolongation_matrices[level], - *prolongation_sparsities[level], - level, - csp, - mg_dof); + *prolongation_sparsities[level], + level, + csp, + mg_dof); csp.reinit(0,0); - + FullMatrix prolongation; - + // now actually build the matrices for (typename DoFHandler::cell_iterator cell=mg_dof.begin(level); cell != mg_dof.end(level); ++cell) if (cell->has_children() && (mg_dof.get_tria().locally_owned_subdomain()==numbers::invalid_subdomain_id || cell->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain()) - ) + ) { cell->get_mg_dof_indices (dof_indices_parent); @@ -215,12 +215,12 @@ void MGTransferPrebuilt::build_matrices ( prolongation = mg_dof.get_fe().get_prolongation_matrix (child, cell->refinement_case()); - - if (mg_constrained_dofs != 0 && mg_constrained_dofs->set_boundary_values()) - for (unsigned int j=0;jis_boundary_index(level, dof_indices_parent[j])) - for (unsigned int i=0; iset_boundary_values()) + for (unsigned int j=0; jis_boundary_index(level, dof_indices_parent[j])) + for (unsigned int i=0; ichild(child)->get_mg_dof_indices (dof_indices_child); @@ -243,9 +243,9 @@ void MGTransferPrebuilt::build_matrices ( // of the global and mgdof, so that we later not access non-local elements // in copy_to/from_mg. // We keep track in the bitfield dof_touched which global dof has - // been processed already (on the current level). This is the same as + // been processed already (on the current level). This is the same as // the multigrid running in serial. - // Only entering on the finest level gives wrong results (why?) + // Only entering on the finest level gives wrong results (why?) copy_indices.resize(n_levels); copy_indices_from_me.resize(n_levels); @@ -272,8 +272,8 @@ void MGTransferPrebuilt::build_matrices ( { if (mg_dof.get_tria().locally_owned_subdomain()!=numbers::invalid_subdomain_id && (level_cell->level_subdomain_id()==numbers::artificial_subdomain_id - || level_cell->subdomain_id()==numbers::artificial_subdomain_id) - ) + || level_cell->subdomain_id()==numbers::artificial_subdomain_id) + ) continue; // get the dof numbers of this cell for the global and the level-wise @@ -296,13 +296,13 @@ void MGTransferPrebuilt::build_matrices ( if (global_mine && level_mine) copy_indices[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::pair (global_dof_indices[i], level_dof_indices[i])); else if (level_mine) copy_indices_from_me[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::pair (global_dof_indices[i], level_dof_indices[i])); else if (global_mine) copy_indices_to_me[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::pair (global_dof_indices[i], level_dof_indices[i])); else continue; @@ -315,11 +315,11 @@ void MGTransferPrebuilt::build_matrices ( // more reliable output for regression texts #ifdef DEBUG std::less > compare; - for (unsigned int level=0;level::build_matrices ( template void -MGTransferPrebuilt::print_matrices (std::ostream& os) const +MGTransferPrebuilt::print_matrices (std::ostream &os) const { - for (unsigned int level = 0;levelprint(os); @@ -339,26 +339,26 @@ MGTransferPrebuilt::print_matrices (std::ostream& os) const template void -MGTransferPrebuilt::print_indices (std::ostream& os) const +MGTransferPrebuilt::print_indices (std::ostream &os) const { - for (unsigned int level = 0;level &mapping, for (unsigned int s=0; s::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); + endd = boundary_values.end(); for (; dof != endd; ++dof) { Assert (dof->first < n_dofs, ExcInternalError()); diff --git a/deal.II/source/numerics/time_dependent.cc b/deal.II/source/numerics/time_dependent.cc index ee649a6d18..97db6b277b 100644 --- a/deal.II/source/numerics/time_dependent.cc +++ b/deal.II/source/numerics/time_dependent.cc @@ -217,8 +217,8 @@ void TimeDependent::end_sweep () void (TimeDependent::*p) (const unsigned int, const unsigned int) = &TimeDependent::end_sweep; parallel::apply_to_subranges (0U, timesteps.size(), - std_cxx1x::bind (p, this, std_cxx1x::_1, std_cxx1x::_2), - 1); + std_cxx1x::bind (p, this, std_cxx1x::_1, std_cxx1x::_2), + 1); }