From 6a352a6292bb1a9e0966a0048d6ab81739e05be9 Mon Sep 17 00:00:00 2001 From: "Benjamin S. Kirk" Date: Tue, 2 Apr 2013 17:46:40 -0500 Subject: [PATCH] run make beautify --- Makefile.in | 29 ++- examples/Makefile.am | 3 +- .../adaptivity/adaptivity_ex1/Makefile.am | 2 +- .../adaptivity_ex1/adaptivity_ex1.C | 36 +-- .../adaptivity/adaptivity_ex2/Makefile.am | 2 +- .../adaptivity_ex2/adaptivity_ex2.C | 138 +++++----- .../adaptivity_ex3/adaptivity_ex3.C | 82 +++--- .../adaptivity/adaptivity_ex4/Makefile.am | 2 +- .../adaptivity_ex4/adaptivity_ex4.C | 70 ++--- .../adaptivity/adaptivity_ex5/Makefile.am | 2 +- .../adaptivity_ex5/adaptivity_ex5.C | 130 +++++----- examples/adjoints/adjoints_ex1/L-shaped.C | 40 +-- examples/adjoints/adjoints_ex1/L-shaped.h | 12 +- examples/adjoints/adjoints_ex1/adjoints_ex1.C | 178 ++++++------- .../adjoints_ex1/element_postprocess.C | 22 +- .../adjoints_ex1/element_qoi_derivative.C | 16 +- .../adjoints/adjoints_ex1/femparameters.C | 8 +- .../adjoints/adjoints_ex1/femparameters.h | 16 +- .../adjoints/adjoints_ex1/side_postprocess.C | 20 +- .../adjoints_ex1/side_qoi_derivative.C | 18 +- examples/adjoints/adjoints_ex2/L-qoi.C | 38 ++- examples/adjoints/adjoints_ex2/L-qoi.h | 10 +- examples/adjoints/adjoints_ex2/L-shaped.C | 30 +-- examples/adjoints/adjoints_ex2/L-shaped.h | 10 +- examples/adjoints/adjoints_ex2/adjoints_ex2.C | 144 +++++----- .../adjoints/adjoints_ex2/femparameters.C | 8 +- .../adjoints/adjoints_ex2/femparameters.h | 20 +- examples/adjoints/adjoints_ex3/H-qoi.C | 58 ++--- examples/adjoints/adjoints_ex3/H-qoi.h | 10 +- examples/adjoints/adjoints_ex3/Makefile.am | 2 +- examples/adjoints/adjoints_ex3/adjoints_ex3.C | 165 ++++++------ .../adjoints/adjoints_ex3/coupled_system.C | 101 ++++---- .../adjoints/adjoints_ex3/coupled_system.h | 22 +- examples/adjoints/adjoints_ex3/domain.C | 6 +- .../adjoints/adjoints_ex3/femparameters.C | 4 +- .../adjoints/adjoints_ex3/femparameters.h | 10 +- examples/adjoints/adjoints_ex3/initial.C | 4 +- examples/adjoints/adjoints_ex4/L-shaped.C | 40 +-- examples/adjoints/adjoints_ex4/L-shaped.h | 12 +- examples/adjoints/adjoints_ex4/adjoints_ex4.C | 184 ++++++------- .../adjoints_ex4/element_postprocess.C | 22 +- .../adjoints_ex4/element_qoi_derivative.C | 16 +- .../adjoints/adjoints_ex4/femparameters.C | 8 +- .../adjoints/adjoints_ex4/femparameters.h | 16 +- .../adjoints/adjoints_ex4/side_postprocess.C | 20 +- .../adjoints_ex4/side_qoi_derivative.C | 20 +- .../adjoints/adjoints_ex5/adjoint_initial.C | 6 +- examples/adjoints/adjoints_ex5/adjoints_ex5.C | 160 ++++++------ .../adjoints_ex5/element_qoi_derivative.C | 20 +- .../adjoints/adjoints_ex5/factoryfunction.C | 1 - .../adjoints/adjoints_ex5/femparameters.C | 42 +-- examples/adjoints/adjoints_ex5/heatsystem.C | 38 +-- examples/adjoints/adjoints_ex5/heatsystem.h | 10 +- examples/adjoints/adjoints_ex5/initial.C | 4 +- .../eigenproblems_ex1/eigenproblems_ex1.C | 64 ++--- .../eigenproblems_ex2/eigenproblems_ex2.C | 64 ++--- .../eigenproblems_ex3/eigenproblems_ex3.C | 33 ++- .../fem_system_ex1/fem_system_ex1.C | 18 +- .../fem_system/fem_system_ex1/naviersystem.C | 30 +-- .../fem_system_ex2/fem_system_ex2.C | 3 +- .../fem_system_ex2/nonlinear_neohooke_cc.h | 1 - .../fem_system/fem_system_ex2/solid_system.C | 1 - .../introduction_ex1/introduction_ex1.C | 14 +- .../introduction_ex2/introduction_ex2.C | 44 ++-- .../introduction_ex3/exact_solution.C | 6 +- .../introduction_ex3/introduction_ex3.C | 74 +++--- .../introduction/introduction_ex4/Makefile.am | 2 +- .../introduction_ex4/introduction_ex4.C | 98 +++---- .../introduction/introduction_ex5/Makefile.am | 2 +- .../introduction_ex5/introduction_ex5.C | 166 ++++++------ .../miscellaneous_ex1/miscellaneous_ex1.C | 243 +++++++++-------- .../miscellaneous_ex2/miscellaneous_ex2.C | 184 ++++++------- .../miscellaneous_ex3/Makefile.am | 2 +- .../miscellaneous_ex3/miscellaneous_ex3.C | 126 ++++----- .../miscellaneous_ex4/miscellaneous_ex4.C | 81 +++--- .../miscellaneous_ex5/Makefile.am | 2 +- .../miscellaneous_ex5/miscellaneous_ex5.C | 144 +++++----- .../miscellaneous_ex6/Makefile.am | 2 +- .../miscellaneous_ex6/miscellaneous_ex6.C | 52 ++-- .../miscellaneous_ex7/Makefile.am | 2 +- .../miscellaneous_ex7/biharmonic_jr.C | 2 +- .../miscellaneous_ex7/miscellaneous_ex7.C | 2 - .../meshless_interpolation_function.h | 7 +- .../miscellaneous_ex8/miscellaneous_ex8.C | 54 ++-- .../reduced_basis_ex1/Makefile.am | 4 +- .../reduced_basis_ex1/assembly.h | 10 +- .../reduced_basis_ex1/rb_classes.h | 12 +- .../reduced_basis_ex1/reduced_basis_ex1.C | 25 +- .../reduced_basis_ex2/assembly.h | 9 +- .../reduced_basis_ex2/rb_classes.h | 16 +- .../reduced_basis_ex2/reduced_basis_ex2.C | 23 +- .../reduced_basis_ex3/assembly.h | 8 +- .../reduced_basis_ex3/rb_classes.h | 8 +- .../reduced_basis_ex3/reduced_basis_ex3.C | 19 +- .../reduced_basis_ex4/Makefile.am | 2 +- .../reduced_basis_ex4/assembly.h | 4 +- .../reduced_basis_ex4/eim_classes.h | 10 +- .../reduced_basis_ex4/rb_classes.h | 10 +- .../reduced_basis_ex4/reduced_basis_ex4.C | 14 +- .../reduced_basis_ex5/assembly.C | 56 ++-- .../reduced_basis_ex5/assembly.h | 24 +- .../reduced_basis_ex5/rb_classes.h | 6 +- .../reduced_basis_ex5/reduced_basis_ex5.C | 30 +-- .../reduced_basis_ex6/Makefile.am | 2 +- .../reduced_basis_ex6/assembly.h | 18 +- .../reduced_basis_ex6/eim_classes.h | 10 +- .../reduced_basis_ex6/rb_classes.h | 14 +- .../reduced_basis_ex6/reduced_basis_ex6.C | 27 +- .../reduced_basis_ex7/assembly.h | 20 +- .../reduced_basis_ex7/rb_classes.h | 8 +- .../reduced_basis_ex7/reduced_basis_ex7.C | 29 +-- .../solution_transfer_ex1/main.C | 14 +- .../subdomains/subdomains_ex1/Makefile.am | 2 +- .../subdomains_ex1/subdomains_ex1.C | 160 ++++++------ .../subdomains/subdomains_ex2/Makefile.am | 2 +- .../subdomains_ex2/subdomains_ex2.C | 114 ++++---- .../systems_of_equations_ex1.C | 96 +++---- .../systems_of_equations_ex2.C | 116 ++++----- .../systems_of_equations_ex3.C | 114 ++++---- .../systems_of_equations_ex4.C | 42 +-- .../systems_of_equations_ex5.C | 46 ++-- .../systems_of_equations_ex6.C | 66 ++--- .../transient/transient_ex1/exact_solution.C | 8 +- .../transient/transient_ex1/transient_ex1.C | 116 ++++----- .../transient/transient_ex2/transient_ex2.C | 92 +++---- examples/vector_fe/vector_fe_ex1/Makefile.am | 2 +- .../vector_fe/vector_fe_ex1/exact_solution.C | 6 +- .../vector_fe/vector_fe_ex1/vector_fe_ex1.C | 74 +++--- .../vector_fe_ex2/laplace_exact_solution.h | 8 +- .../vector_fe/vector_fe_ex2/laplace_system.C | 26 +- .../vector_fe/vector_fe_ex2/laplace_system.h | 12 +- .../vector_fe/vector_fe_ex2/vector_fe_ex2.C | 20 +- examples/vector_fe/vector_fe_ex3/Makefile.am | 2 +- .../vector_fe_ex3/curl_curl_exact_solution.h | 6 +- .../vector_fe_ex3/curl_curl_system.C | 24 +- .../vector_fe_ex3/curl_curl_system.h | 8 +- .../vector_fe/vector_fe_ex3/vector_fe_ex3.C | 16 +- include/Makefile.am | 5 +- include/base/dof_map.h | 14 +- include/base/dof_object.h | 28 +- include/base/getpot.h | 2 - include/base/libmesh_common.h | 2 +- include/base/libmesh_singleton.h | 4 +- include/base/periodic_boundary.h | 4 +- include/base/periodic_boundary_base.h | 8 +- include/base/reference_counted_object.h | 4 - include/base/reference_counter.h | 4 - include/enums/enum_eigen_solver_type.h | 4 - include/enums/enum_elem_type.h | 4 - include/enums/enum_fe_family.h | 6 +- include/enums/enum_io_package.h | 4 - include/enums/enum_norm_type.h | 6 +- include/enums/enum_parallel_type.h | 4 - include/enums/enum_point_locator_type.h | 4 - include/enums/enum_preconditioner_type.h | 4 - include/enums/enum_quadrature_type.h | 4 - include/enums/enum_solver_type.h | 4 - include/enums/enum_subset_solve_mode.h | 1 - include/enums/enum_xdr_mode.h | 4 - .../adjoint_refinement_estimator.h | 3 +- .../adjoint_residual_error_estimator.h | 3 +- .../error_estimation/discontinuity_measure.h | 1 - include/error_estimation/error_estimator.h | 1 - .../error_estimation/exact_error_estimator.h | 1 - .../fourth_error_estimators.h | 1 - include/error_estimation/hp_coarsentest.h | 1 - include/error_estimation/hp_selector.h | 1 - include/error_estimation/hp_singular.h | 1 - .../error_estimation/jump_error_estimator.h | 1 - .../error_estimation/kelly_error_estimator.h | 1 - .../uniform_refinement_estimator.h | 1 - .../weighted_patch_recovery_error_estimator.h | 4 +- include/fe/fe.h | 2 +- include/fe/fe_abstract.h | 8 +- include/fe/fe_base.h | 4 +- include/fe/fe_compute_data.h | 4 - include/fe/fe_interface.h | 6 +- include/fe/fe_map.h | 186 ++++++------- include/fe/fe_transformation_base.h | 18 +- include/fe/fe_type.h | 4 - include/fe/fe_xyz_map.h | 2 +- include/fe/h1_fe_transformation.h | 16 +- include/fe/hcurl_fe_transformation.h | 16 +- include/geom/cell_prism15.h | 1 - include/geom/cell_prism18.h | 1 - include/geom/elem.h | 10 +- include/geom/elem_type.h | 4 - include/geom/face.h | 4 - include/geom/face_inf_quad.h | 4 - include/geom/face_tri.h | 2 - include/geom/node.h | 2 +- include/geom/reference_elem.h | 2 +- include/geom/remote_elem.h | 2 +- include/libmesh/Makefile.am | 3 +- include/mesh/mesh_base.h | 2 +- include/mesh/mesh_function.h | 1 - include/mesh/mesh_inserter_iterator.h | 8 +- include/mesh/mesh_output.h | 4 +- include/mesh/mesh_refinement.h | 6 +- include/mesh/mesh_triangle_wrapper.h | 1 - include/mesh/tecplot_io.h | 4 +- include/mesh/ucd_io.h | 6 +- include/mesh/xdr_head.h | 1 - include/numerics/analytic_function.h | 1 - include/numerics/const_function.h | 2 +- include/numerics/dense_matrix.h | 13 +- include/numerics/dense_matrix_base.h | 1 - include/numerics/dense_submatrix.h | 1 - include/numerics/dense_subvector.h | 1 - include/numerics/dense_vector.h | 1 - include/numerics/dense_vector_base.h | 1 - include/numerics/eigen_sparse_matrix.h | 4 +- include/numerics/eigen_sparse_vector.h | 22 +- include/numerics/fem_function_base.h | 2 +- include/numerics/petsc_vector.h | 8 - include/numerics/raw_accessor.h | 2 +- include/numerics/refinement_selector.h | 1 - include/numerics/tensor_tools.h | 50 ++-- include/numerics/trilinos_epetra_vector.h | 8 - include/numerics/type_tensor.h | 6 +- include/numerics/type_vector.h | 4 +- include/numerics/zero_function.h | 2 +- include/parallel/parallel.h | 12 +- include/parallel/parallel_algebra.h | 1 - include/parallel/parallel_bin_sorter.h | 1 - include/parallel/parallel_hilbert.h | 1 - include/parallel/parallel_histogram.h | 1 - include/parallel/parallel_implementation.h | 10 +- include/parallel/threads.h | 4 +- include/physics/diff_physics.h | 18 +- include/physics/diff_qoi.h | 24 +- include/physics/fem_physics.h | 6 +- include/quadrature/quadrature_conical.h | 1 - include/quadrature/quadrature_rules.h | 4 - include/reduced_basis/rb_assembly_expansion.h | 4 +- include/reduced_basis/rb_construction.h | 6 +- include/reduced_basis/rb_construction_base.h | 12 +- include/reduced_basis/rb_eim_construction.h | 16 +- include/reduced_basis/rb_eim_evaluation.h | 8 +- include/reduced_basis/rb_evaluation.h | 6 +- include/reduced_basis/rb_parameters.h | 20 +- include/reduced_basis/rb_parametrized.h | 8 +- .../reduced_basis/rb_parametrized_function.h | 2 +- include/reduced_basis/rb_scm_construction.h | 4 +- include/reduced_basis/rb_scm_evaluation.h | 2 +- .../rb_temporal_discretization.h | 2 +- .../direct_solution_transfer.h | 2 +- include/solution_transfer/dtk_adapter.h | 4 +- .../solution_transfer/dtk_solution_transfer.h | 6 +- .../meshfree_interpolation.h | 60 ++--- .../meshfree_solution_transfer.h | 2 +- .../meshfunction_solution_transfer.h | 2 +- .../radial_basis_functions.h | 16 +- .../radial_basis_interpolation.h | 10 +- include/solvers/memory_solution_history.h | 24 +- include/solvers/no_solution_history.h | 8 +- include/solvers/solution_history.h | 10 +- include/solvers/time_solver.h | 4 +- include/systems/diff_context.h | 16 +- include/systems/diff_system.h | 26 +- include/systems/eigen_system.h | 4 +- include/systems/fem_context.h | 40 +-- include/systems/system_subset.h | 1 - include/systems/system_subset_by_subdomain.h | 1 - include/utils/error_vector.h | 1 - include/utils/ignore_warnings.h | 2 +- include/utils/null_output_iterator.h | 8 +- include/utils/ostream_proxy.h | 1 - include/utils/point_locator_base.h | 2 - include/utils/point_locator_list.h | 2 - include/utils/point_locator_tree.h | 2 - include/utils/restore_warnings.h | 2 +- include/utils/string_to_enum.h | 4 - src/apps/getpot_parse.C | 2 +- src/apps/grid2grid.C | 1 - src/apps/meshdiff.C | 8 +- src/apps/meshnorm.C | 8 +- src/apps/meshplot.C | 2 +- src/apps/meshtool.C | 1 - src/apps/solution_components.C | 10 +- src/base/dof_map.C | 62 ++--- src/base/dof_map_constraints.C | 132 +++++----- src/base/dof_object.C | 32 +-- src/base/libmesh.C | 32 +-- src/base/libmesh_singleton.C | 6 +- .../adjoint_refinement_estimator.C | 80 +++--- .../adjoint_residual_error_estimator.C | 4 +- src/error_estimation/exact_solution.C | 26 +- .../fourth_error_estimators.C | 2 - src/error_estimation/hp_coarsentest.C | 4 +- src/error_estimation/hp_selector.C | 1 - src/error_estimation/jump_error_estimator.C | 4 +- .../patch_recovery_error_estimator.C | 1 - .../weighted_patch_recovery_estimator.C | 47 ++-- src/fe/fe.C | 8 +- src/fe/fe_abstract.C | 2 +- src/fe/fe_boundary.C | 2 +- src/fe/fe_hermite_shape_1D.C | 8 +- src/fe/fe_hermite_shape_2D.C | 8 +- src/fe/fe_hermite_shape_3D.C | 8 +- src/fe/fe_interface.C | 4 +- src/fe/fe_interface_inf_fe.C | 1 - src/fe/fe_lagrange_vec.C | 134 +++++----- src/fe/fe_map.C | 8 +- src/fe/fe_nedelec_one.C | 26 +- src/fe/fe_nedelec_one_shape_2D.C | 10 +- src/fe/fe_nedelec_one_shape_3D.C | 2 +- src/fe/fe_szabab_shape_2D.C | 1 - src/fe/fe_szabab_shape_3D.C | 1 - src/fe/fe_transformation_base.C | 2 +- src/fe/fe_xyz.C | 2 +- src/fe/fe_xyz_map.C | 4 +- src/fe/h1_fe_transformation.C | 68 ++--- src/fe/hcurl_fe_transformation.C | 46 ++-- src/fe/inf_fe.C | 7 +- src/fe/inf_fe_base_radial.C | 1 - src/fe/inf_fe_boundary.C | 3 +- src/fe/inf_fe_jacobi_20_00_eval.C | 1 - src/fe/inf_fe_jacobi_30_00_eval.C | 1 - src/fe/inf_fe_lagrange_eval.C | 1 - src/fe/inf_fe_legendre_eval.C | 1 - src/fe/inf_fe_map.C | 1 - src/fe/inf_fe_map_eval.C | 1 - src/fe/inf_fe_static.C | 1 - src/geom/cell_hex.C | 2 +- src/geom/cell_inf_hex18.C | 1 - src/geom/cell_prism15.C | 5 - src/geom/edge_inf_edge2.C | 2 - src/geom/elem.C | 8 +- src/geom/elem_refinement.C | 1 - src/geom/face.C | 4 - src/geom/face_inf_quad4.C | 2 - src/geom/face_quad.C | 2 +- src/geom/face_quad8.C | 1 - src/geom/face_quad9.C | 2 - src/geom/node.C | 6 +- src/geom/point.C | 1 - src/geom/remote_elem.C | 8 +- src/mesh/abaqus_io.C | 2 +- src/mesh/gmsh_io.C | 1 - src/mesh/medit_io.C | 4 - src/mesh/mesh_base.C | 9 +- src/mesh/mesh_communication.C | 6 +- src/mesh/mesh_data_unv_support.C | 4 - src/mesh/mesh_data_xdr_support.C | 2 - src/mesh/mesh_function.C | 7 +- src/mesh/mesh_modification.C | 6 +- src/mesh/mesh_smoother.C | 3 - src/mesh/mesh_smoother_vsmoother.C | 2 +- src/mesh/mesh_tools.C | 4 +- src/mesh/mesh_triangle_interface.C | 8 - src/mesh/off_io.C | 2 +- src/mesh/parallel_mesh.C | 8 +- src/mesh/serial_mesh.C | 88 +++---- src/mesh/tecplot_io.C | 59 +++-- src/mesh/tetgen_io.C | 1 - src/mesh/ucd_io.C | 20 +- src/mesh/unstructured_mesh.C | 3 - src/mesh/unv_io.C | 1 - src/mesh/vtk_io.C | 8 +- src/mesh/xdr_io.C | 2 +- src/mesh/xdr_soln.C | 2 - src/numerics/coupling_matrix.C | 1 - src/numerics/dense_matrix_blas_lapack.C | 1 - src/numerics/eigen_preconditioner.C | 4 +- src/numerics/eigen_sparse_matrix.C | 14 +- src/numerics/eigen_sparse_vector.C | 24 +- src/numerics/function_base.C | 6 - src/numerics/petsc_matrix.C | 4 +- src/numerics/petsc_vector.C | 6 +- src/numerics/preconditioner.C | 3 - src/numerics/sparse_shell_matrix.C | 1 - src/numerics/sum_shell_matrix.C | 1 - src/numerics/tensor_shell_matrix.C | 1 - src/numerics/tensor_tools.C | 2 +- src/parallel/parallel_bin_sorter.C | 1 - src/parallel/parallel_elem.C | 34 +-- src/parallel/parallel_ghost_sync.C | 2 - src/parallel/parallel_histogram.C | 1 - src/parallel/parallel_node.C | 16 +- src/partitioning/metis_partitioner.C | 2 - src/physics/diff_physics.C | 6 +- src/physics/diff_qoi.C | 6 +- src/quadrature/quadrature_build.C | 1 - src/quadrature/quadrature_clough.C | 3 - src/quadrature/quadrature_clough_1D.C | 2 - src/quadrature/quadrature_gauss.C | 2 - src/quadrature/quadrature_gauss_1D.C | 2 - src/quadrature/quadrature_grid.C | 3 - src/quadrature/quadrature_grid_1D.C | 2 - src/quadrature/quadrature_jacobi.C | 3 - src/quadrature/quadrature_jacobi_1D.C | 2 - src/quadrature/quadrature_rules.C | 5 - src/reduced_basis/rb_assembly_expansion.C | 10 +- src/reduced_basis/rb_construction.C | 31 +-- src/reduced_basis/rb_construction_base.C | 50 ++-- src/reduced_basis/rb_eim_assembly.C | 2 +- src/reduced_basis/rb_eim_construction.C | 31 ++- src/reduced_basis/rb_eim_evaluation.C | 30 +-- src/reduced_basis/rb_evaluation.C | 66 ++--- src/reduced_basis/rb_parameters.C | 8 +- src/reduced_basis/rb_parametrized.C | 34 +-- src/reduced_basis/rb_scm_construction.C | 8 +- src/reduced_basis/rb_scm_evaluation.C | 36 +-- .../transient_rb_assembly_expansion.C | 2 +- src/reduced_basis/transient_rb_construction.C | 8 +- src/reduced_basis/transient_rb_evaluation.C | 36 +-- .../direct_solution_transfer.C | 8 +- src/solution_transfer/dtk_evaluator.C | 6 +- .../meshfree_interpolation.C | 89 ++++--- .../meshfree_solution_transfer.C | 18 +- .../meshfunction_solution_transfer.C | 4 +- .../radial_basis_interpolation.C | 67 +++-- src/solvers/eigen_sparse_linear_solver.C | 18 +- src/solvers/linear_solver.C | 3 - src/solvers/memory_solution_history.C | 22 +- src/solvers/nonlinear_solver.C | 3 - src/solvers/petscdmlibmesh.C | 86 +++--- src/solvers/steady_solver.C | 1 - src/solvers/unsteady_solver.C | 2 +- src/systems/diff_context.C | 5 +- src/systems/equation_systems.C | 6 +- src/systems/equation_systems_io.C | 6 +- src/systems/fem_context.C | 106 ++++---- src/systems/fem_system.C | 2 +- src/systems/implicit_system.C | 1 - src/systems/steady_system.C | 1 - src/systems/system_io.C | 245 +++++++++--------- src/systems/system_projection.C | 16 +- src/systems/system_subset.C | 1 - src/systems/system_subset_by_subdomain.C | 1 - src/utils/error_vector.C | 1 - src/utils/libmesh_version.C | 4 +- src/utils/point_locator_base.C | 1 - src/utils/point_locator_list.C | 1 - src/utils/point_locator_tree.C | 1 - src/utils/string_to_enum.C | 3 - src/utils/tree.C | 9 - src/utils/tree_node.C | 7 - 439 files changed, 4135 insertions(+), 4508 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4fef2c8973c..658bda6a391 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4243,13 +4243,13 @@ vtkversion = @vtkversion@ # test/Makefile.in \ # test/common/Makefile.in \ # test/comp_ns/Makefile.in \ -# test/unit/Makefile.in +# test/unit/Makefile.in SUBDIRS = include contrib $(am__append_6) $(am__append_10) -AUTOMAKE_OPTIONS = subdir-objects +AUTOMAKE_OPTIONS = subdir-objects ACLOCAL_AMFLAGS = -I m4 AM_CFLAGS = $(libmesh_CFLAGS) -# AM_CPPFLAGS are method-independent cppflags that +# AM_CPPFLAGS are method-independent cppflags that # we use when compiling libmesh proper, or its utility # codes. These will be augmented with method-specific # cppflags later on @@ -4724,33 +4724,33 @@ libmesh_SOURCES = \ src/utils/xdr_cxx.C -# A convenience library to hold proper libMesh -# objects. This will get appended with any contributed +# A convenience library to hold proper libMesh +# objects. This will get appended with any contributed # sources to create the final library. lib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3) \ $(am__append_4) $(am__append_5) @LIBMESH_DBG_MODE_TRUE@libmesh_dbg_la_SOURCES = $(libmesh_SOURCES) -@LIBMESH_DBG_MODE_TRUE@libmesh_dbg_la_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) +@LIBMESH_DBG_MODE_TRUE@libmesh_dbg_la_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) @LIBMESH_DBG_MODE_TRUE@libmesh_dbg_la_CXXFLAGS = $(CXXFLAGS_DBG) @LIBMESH_DBG_MODE_TRUE@libmesh_dbg_la_CFLAGS = $(CFLAGS_DBG) @LIBMESH_DBG_MODE_TRUE@libmesh_dbg_la_LIBADD = contrib/libcontrib_dbg.la $(LIBS) @LIBMESH_DEVEL_MODE_TRUE@libmesh_devel_la_SOURCES = $(libmesh_SOURCES) -@LIBMESH_DEVEL_MODE_TRUE@libmesh_devel_la_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) +@LIBMESH_DEVEL_MODE_TRUE@libmesh_devel_la_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) @LIBMESH_DEVEL_MODE_TRUE@libmesh_devel_la_CXXFLAGS = $(CXXFLAGS_DEVEL) @LIBMESH_DEVEL_MODE_TRUE@libmesh_devel_la_CFLAGS = $(CFLAGS_DEVEL) @LIBMESH_DEVEL_MODE_TRUE@libmesh_devel_la_LIBADD = contrib/libcontrib_devel.la $(LIBS) @LIBMESH_OPT_MODE_TRUE@libmesh_opt_la_SOURCES = $(libmesh_SOURCES) -@LIBMESH_OPT_MODE_TRUE@libmesh_opt_la_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) +@LIBMESH_OPT_MODE_TRUE@libmesh_opt_la_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) @LIBMESH_OPT_MODE_TRUE@libmesh_opt_la_CXXFLAGS = $(CXXFLAGS_OPT) @LIBMESH_OPT_MODE_TRUE@libmesh_opt_la_CFLAGS = $(CFLAGS_OPT) @LIBMESH_OPT_MODE_TRUE@libmesh_opt_la_LIBADD = contrib/libcontrib_opt.la $(LIBS) @LIBMESH_PROF_MODE_TRUE@libmesh_prof_la_SOURCES = $(libmesh_SOURCES) -@LIBMESH_PROF_MODE_TRUE@libmesh_prof_la_CPPFLAGS = $(CPPFLAGS_PROF) $(AM_CPPFLAGS) +@LIBMESH_PROF_MODE_TRUE@libmesh_prof_la_CPPFLAGS = $(CPPFLAGS_PROF) $(AM_CPPFLAGS) @LIBMESH_PROF_MODE_TRUE@libmesh_prof_la_CXXFLAGS = $(CXXFLAGS_PROF) @LIBMESH_PROF_MODE_TRUE@libmesh_prof_la_CFLAGS = $(CFLAGS_PROF) @LIBMESH_PROF_MODE_TRUE@libmesh_prof_la_LIBADD = contrib/libcontrib_prof.la $(LIBS) @LIBMESH_OPROF_MODE_TRUE@libmesh_oprof_la_SOURCES = $(libmesh_SOURCES) -@LIBMESH_OPROF_MODE_TRUE@libmesh_oprof_la_CPPFLAGS = $(CPPFLAGS_OPROF) $(AM_CPPFLAGS) +@LIBMESH_OPROF_MODE_TRUE@libmesh_oprof_la_CPPFLAGS = $(CPPFLAGS_OPROF) $(AM_CPPFLAGS) @LIBMESH_OPROF_MODE_TRUE@libmesh_oprof_la_CXXFLAGS = $(CXXFLAGS_OPROF) @LIBMESH_OPROF_MODE_TRUE@libmesh_oprof_la_CFLAGS = $(CFLAGS_OPROF) @LIBMESH_OPROF_MODE_TRUE@libmesh_oprof_la_LIBADD = contrib/libcontrib_oprof.la $(LIBS) @@ -27331,6 +27331,13 @@ install-data-hook: cat $(DESTDIR)$(libmesh_configdir)/libmesh-config | $(SED) "s/has_been_installed=no/has_been_installed=yes/g" > $(DESTDIR)$(libmesh_configdir)/libmesh-config.installed mv $(DESTDIR)$(libmesh_configdir)/libmesh-config.installed $(DESTDIR)$(libmesh_configdir)/libmesh-config && chmod +x $(DESTDIR)$(libmesh_configdir)/libmesh-config +# this rule invokes emacs on each source file to remove trailing whitespace. +beautify: + for file in `find $(srcdir)/{src,include,examples} -name "*.C" -o -name "*.h" -o -name Makefile.am -type f` ; do \ + echo $$file ; \ + emacs -batch $$file --eval '(delete-trailing-whitespace)' -f save-buffer 2>/dev/null ; \ + done + # .PHONY: examples_doc doc svnexpand @@ -27384,7 +27391,7 @@ test_headers: @cd $(top_builddir)/include && $(MAKE) test_headers # General philosophy is to maintain code coverage for the -# base library as generated by "make check" tests. +# base library as generated by "make check" tests. @CODE_COVERAGE_ENABLED_TRUE@lcov-report: @CODE_COVERAGE_ENABLED_TRUE@ @mkdir -p $(lcov_dir) diff --git a/examples/Makefile.am b/examples/Makefile.am index b31f8f51d25..845a38ec9d8 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -49,7 +49,7 @@ SUBDIRS = \ vector_fe/vector_fe_ex2 \ vector_fe/vector_fe_ex3 -AUTOMAKE_OPTIONS = subdir-objects +AUTOMAKE_OPTIONS = subdir-objects AM_CPPFLAGS = $(libmesh_CPPFLAGS) AM_CFLAGS = $(libmesh_CFLAGS) @@ -106,4 +106,3 @@ doc: if CODE_COVERAGE_ENABLED CLEANFILES = */*/*.gcda */*/*.gcno endif - diff --git a/examples/adaptivity/adaptivity_ex1/Makefile.am b/examples/adaptivity/adaptivity_ex1/Makefile.am index 37bd6d59bba..37f6f6a5275 100644 --- a/examples/adaptivity/adaptivity_ex1/Makefile.am +++ b/examples/adaptivity/adaptivity_ex1/Makefile.am @@ -4,7 +4,7 @@ install_dir = $(examples_install_path)/adaptivity/ex1 data = adaptivity_ex1.C run.sh sources = $(data) run.sh -CLEANFILES = gnuplot_script_data gnuplot_script +CLEANFILES = gnuplot_script_data gnuplot_script ############################################## # include common example environment diff --git a/examples/adaptivity/adaptivity_ex1/adaptivity_ex1.C b/examples/adaptivity/adaptivity_ex1/adaptivity_ex1.C index 32650012961..70289864d63 100644 --- a/examples/adaptivity/adaptivity_ex1/adaptivity_ex1.C +++ b/examples/adaptivity/adaptivity_ex1/adaptivity_ex1.C @@ -16,15 +16,15 @@ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //

Adaptivity Example 1 - Solving 1D PDE Using Adaptive Mesh Refinement

- // + // // This example demonstrates how to solve a simple 1D problem // using adaptive mesh refinement. The PDE that is solved is: - // -epsilon*u''(x) + u(x) = 1, on the domain [0,1] with boundary conditions + // -epsilon*u''(x) + u(x) = 1, on the domain [0,1] with boundary conditions // u(0) = u(1) = 0 and where epsilon << 1. // // The approach used to solve 1D problems in libMesh is virtually identical to // solving 2D or 3D problems, so in this sense this example represents a good - // starting point for new users. Note that many concepts are used in this + // starting point for new users. Note that many concepts are used in this // example which are explained more fully in subsequent examples. // Libmesh includes @@ -52,7 +52,7 @@ using namespace libMesh; void assemble_1D(EquationSystems& es, const std::string& system_name); int main(int argc, char** argv) -{ +{ // Initialize the library. This is necessary because the library // may depend on a number of other libraries (i.e. MPI and PETSc) // that require initialization before use. When the LibMeshInit @@ -74,7 +74,7 @@ int main(int argc, char** argv) if ( command_line.search(1, "-n") ) n = command_line.next(n); - // Build a 1D mesh with 4 elements from x=0 to x=1, using + // Build a 1D mesh with 4 elements from x=0 to x=1, using // EDGE3 (i.e. quadratic) 1D elements. They are called EDGE3 elements // because a quadratic element contains 3 nodes. MeshTools::Generation::build_line(mesh,n,0.,1.,EDGE3); @@ -88,7 +88,7 @@ int main(int argc, char** argv) // Add a variable "u" to the system, using second-order approximation system.add_variable("u",SECOND); - // Give the system a pointer to the matrix assembly function. This + // Give the system a pointer to the matrix assembly function. This // will be called when needed by the library. system.attach_assemble_function(assemble_1D); @@ -97,8 +97,8 @@ int main(int argc, char** argv) MeshRefinement mesh_refinement(mesh); // These parameters determine the proportion of elements that will - // be refined and coarsened. Any element within 30% of the maximum - // error on any element will be refined, and any element within 30% + // be refined and coarsened. Any element within 30% of the maximum + // error on any element will be refined, and any element within 30% // of the minimum error on any element might be coarsened mesh_refinement.refine_fraction() = 0.7; mesh_refinement.coarsen_fraction() = 0.3; @@ -140,7 +140,7 @@ int main(int argc, char** argv) mesh_refinement.refine_and_coarsen_elements(); // Reinitialize the equation_systems object for the newly refined - // mesh. One of the steps in this is project the solution onto the + // mesh. One of the steps in this is project the solution onto the // new mesh equation_systems.reinit(); } @@ -155,7 +155,7 @@ int main(int argc, char** argv) // Load gnuplot, then type "call 'gnuplot_script'" from gnuplot prompt plot.write_equation_systems("gnuplot_script",equation_systems); #endif // #ifndef LIBMESH_ENABLE_AMR - + // All done. libMesh objects are destroyed here. Because the // LibMeshInit object was created first, its destruction occurs // last, and it's destructor finalizes any external libraries and @@ -189,7 +189,7 @@ void assemble_1D(EquationSystems& es, const std::string& system_name) // freedom numbers. DofMap's are discussed in more detail in future examples. const DofMap& dof_map = system.get_dof_map(); - // Get a constant reference to the Finite Element type for the first + // Get a constant reference to the Finite Element type for the first // (and only) variable in the system. FEType fe_type = dof_map.variable_type(0); @@ -203,7 +203,7 @@ void assemble_1D(EquationSystems& es, const std::string& system_name) QGauss qrule(dim,FIFTH); fe->attach_quadrature_rule(&qrule); - // Here we define some references to cell-specific data that will be used to + // Here we define some references to cell-specific data that will be used to // assemble the linear system. // The element Jacobian * quadrature weight at each integration point. @@ -238,13 +238,13 @@ void assemble_1D(EquationSystems& es, const std::string& system_name) // It is convenient to store a pointer to the current element const Elem* elem = *el; - // Get the degree of freedom indices for the current element. - // These define where in the global matrix and right-hand-side this + // Get the degree of freedom indices for the current element. + // These define where in the global matrix and right-hand-side this // element will contribute to. dof_map.dof_indices(elem, dof_indices); - // Compute the element-specific data for the current element. This - // involves computing the location of the quadrature points (q_point) + // Compute the element-specific data for the current element. This + // involves computing the location of the quadrature points (q_point) // and the shape functions (phi, dphi) for the current element. fe->reinit(elem); @@ -252,7 +252,7 @@ void assemble_1D(EquationSystems& es, const std::string& system_name) const int n_dofs = dof_indices.size(); // We resize and zero out Ke and Fe (resize() also clears the matrix and - // vector). In this example, all elements in the mesh are EDGE3's, so + // vector). In this example, all elements in the mesh are EDGE3's, so // Ke will always be 3x3, and Fe will always be 3x1. If the mesh contained // different element types, then the size of Ke and Fe would change. Ke.resize(n_dofs, n_dofs); @@ -270,7 +270,7 @@ void assemble_1D(EquationSystems& es, const std::string& system_name) for(unsigned int j=0; jAdaptivity Example 2 - Solving a Transient System with Adaptive Mesh Refinement - // + // // This example shows how a simple, linear transient // system can be solved in parallel. The system is simple // scalar convection-diffusion with a specified external @@ -27,7 +27,7 @@ // Also, we use this example to demonstrate writing out and reading // in of solutions. We do 25 time steps, then save the solution // and do another 25 time steps starting from the saved solution. - + // C++ include files that we need #include #include @@ -153,11 +153,11 @@ int main (int argc, char** argv) // This value is also obtained from the commandline and it specifies the // initial value for the t_step looping variable. We must - // distinguish between the two cases here, whether we read in the + // distinguish between the two cases here, whether we read in the // solution or we started from scratch, so that we do not overwrite the // gmv output files. unsigned int init_timestep = 0; - + // Search the command line for the "init_timestep" flag and if it is // present, set init_timestep accordingly. if(command_line.search("-init_timestep")) @@ -216,13 +216,13 @@ int main (int argc, char** argv) // Print information about the mesh to the screen. mesh.print_info(); - - + + // Declare the system and its variables. // Begin by creating a transient system // named "Convection-Diffusion". - TransientLinearImplicitSystem & system = - equation_systems.add_system + TransientLinearImplicitSystem & system = + equation_systems.add_system ("Convection-Diffusion"); // Adds the variable "u" to "Convection-Diffusion". "u" @@ -238,7 +238,7 @@ int main (int argc, char** argv) equation_systems.init (); } // Otherwise we read in the solution and mesh - else + else { // Read in the mesh stored in "saved_mesh.xda" mesh.read("saved_mesh.xda"); @@ -250,8 +250,8 @@ int main (int argc, char** argv) equation_systems.read("saved_solution.xda", libMeshEnums::READ); // Get a reference to the system so that we can call update() on it - TransientLinearImplicitSystem & system = - equation_systems.get_system + TransientLinearImplicitSystem & system = + equation_systems.get_system ("Convection-Diffusion"); // We need to call update to put system in a consistent state @@ -271,12 +271,12 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + equation_systems.parameters.set ("linear solver maximum iterations") = 250; equation_systems.parameters.set ("linear solver tolerance") = TOLERANCE; - + if(!read_solution) // Write out the initial condition GMVIO(mesh).write_equation_systems ("out.gmv.000", @@ -290,13 +290,13 @@ int main (int argc, char** argv) // the flow velocity. We will specify it as a RealVectorValue // data type and then use the Parameters object to pass it to // the assemble function. - equation_systems.parameters.set("velocity") = + equation_systems.parameters.set("velocity") = RealVectorValue (0.8, 0.8); // The Convection-Diffusion system also requires a specified // diffusivity. We use an isotropic (hence Real) value. equation_systems.parameters.set("diffusivity") = 0.01; - + // Solve the system "Convection-Diffusion". This will be done by // looping over the specified time interval and calling the // \p solve() member at each time step. This will assemble the @@ -311,11 +311,11 @@ int main (int argc, char** argv) const Real dt = 0.025; system.time = init_timestep*dt; - + // We do 25 timesteps both before and after writing out the // intermediate solution - for(unsigned int t_step=init_timestep; - t_step<(init_timestep+n_timesteps); + for(unsigned int t_step=init_timestep; + t_step<(init_timestep+n_timesteps); t_step++) { // Increment the time counter, set the time and the @@ -327,7 +327,7 @@ int main (int argc, char** argv) // A pretty update message std::cout << " Solving time step "; - + // Add a set of scope braces to enforce data locality. { std::ostringstream out; @@ -346,17 +346,17 @@ int main (int argc, char** argv) std::cout << out.str() << std::endl; } - + // At this point we need to update the old // solution vector. The old solution vector // will be the current solution vector from the // previous time step. *system.old_local_solution = *system.current_local_solution; - + // The number of refinement steps per time step. const unsigned int max_r_steps = 2; - + // A refinement loop. for (unsigned int r_step=0; r_step ("time") = system.time = 0; - + system.project_solution(exact_value, NULL, es.parameters); } @@ -488,28 +488,28 @@ void assemble_cd (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Convection-Diffusion"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Convection-Diffusion system object. TransientLinearImplicitSystem & system = es.get_system ("Convection-Diffusion"); - - // Get the Finite Element type for the first (and only) + + // Get the Finite Element type for the first (and only) // variable in the system. FEType fe_type = system.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // \p FEBase::build() member dynamically creates memory we will // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -524,7 +524,7 @@ void assemble_cd (EquationSystems& es, // with the element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); const std::vector& JxW_face = fe_face->get_JxW(); - + // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); const std::vector >& psi = fe_face->get_phi(); @@ -535,20 +535,20 @@ void assemble_cd (EquationSystems& es, // The XY locations of the quadrature points used for face integration const std::vector& qface_points = fe_face->get_xyz(); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap // in future examples. const DofMap& dof_map = system.get_dof_map(); - + // Define data structures to contain the element matrix // and right-hand-side vector contribution. Following // basic finite element terminology we will denote these // "Ke" and "Fe". DenseMatrix Ke; DenseVector Fe; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system // the element degrees of freedom get mapped. @@ -570,14 +570,14 @@ void assemble_cd (EquationSystems& es, // will be refined we want to only consider the ACTIVE elements, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -589,7 +589,7 @@ void assemble_cd (EquationSystems& es, // quadrature points (q_point) and the shape functions // (phi, dphi) for the current element. fe->reinit (elem); - + // Zero the element matrix and right-hand side before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from @@ -600,7 +600,7 @@ void assemble_cd (EquationSystems& es, dof_indices.size()); Fe.resize (dof_indices.size()); - + // Now we will build the element matrix and right-hand-side. // Constructing the RHS requires the solution and its // gradient from the previous timestep. This myst be @@ -612,62 +612,62 @@ void assemble_cd (EquationSystems& es, // Values to hold the old solution & its gradient. Number u_old = 0.; Gradient grad_u_old; - + // Compute the old solution & its gradient. for (unsigned int l=0; lneighbor(s) == NULL) { fe_face->reinit(elem,s); - + for (unsigned int qp=0; qpadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); - + } // Finished computing the sytem matrix and right-hand side. #endif // #ifdef LIBMESH_ENABLE_AMR diff --git a/examples/adaptivity/adaptivity_ex3/adaptivity_ex3.C b/examples/adaptivity/adaptivity_ex3/adaptivity_ex3.C index e0b56273bdc..4ef249ede49 100644 --- a/examples/adaptivity/adaptivity_ex3/adaptivity_ex3.C +++ b/examples/adaptivity/adaptivity_ex3/adaptivity_ex3.C @@ -90,7 +90,7 @@ Number exact_solution(const Point& p, const std::string&, // sys_name, not needed const std::string&); // unk_name, not needed); -// Prototype for calculation of the gradient of the exact solution. +// Prototype for calculation of the gradient of the exact solution. Gradient exact_derivative(const Point& p, const Parameters&, // EquationSystems parameters, not needed const std::string&, // sys_name, not needed @@ -136,10 +136,10 @@ int main(int argc, char** argv) dim = input_file("dimension", 2); const std::string indicator_type = input_file("indicator_type", "kelly"); singularity = input_file("singularity", true); - + // Skip higher-dimensional examples on a lower-dimensional libMesh build libmesh_example_assert(dim <= LIBMESH_DIM, "2D/3D support"); - + // Output file for plotting the error as a function of // the number of degrees of freedom. std::string approx_name = ""; @@ -161,14 +161,14 @@ int main(int argc, char** argv) output_file += "_adaptive.m"; else output_file += "_uniform.m"; - + std::ofstream out (output_file.c_str()); out << "% dofs L2-error H1-error" << std::endl; out << "e = [" << std::endl; - + // Create a mesh. Mesh mesh; - + // Read in the mesh if (dim == 1) MeshTools::Generation::build_line(mesh,1,-1.,0.); @@ -200,8 +200,8 @@ int main(int argc, char** argv) // Creates a system named "Laplace" LinearImplicitSystem& system = equation_systems.add_system ("Laplace"); - - // Adds the variable "u" to "Laplace", using + + // Adds the variable "u" to "Laplace", using // the finite element type and order specified // in the config file system.add_variable("u", static_cast(approx_order), @@ -221,7 +221,7 @@ int main(int argc, char** argv) // Linear solver tolerance. equation_systems.parameters.set("linear solver tolerance") = std::pow(TOLERANCE, 2.5); - + // Prints information about the system to the screen. equation_systems.print_info(); @@ -237,7 +237,7 @@ int main(int argc, char** argv) for (unsigned int r_step=0; r_step 1) ? p(1) : 0.; - + if (singularity) { // The exact solution to the singular problem, @@ -473,7 +473,7 @@ Number exact_solution(const Point& p, // Make the 3D solution similar const Real z = (dim > 2) ? p(2) : 0; - + return pow(x*x + y*y, 1./3.)*sin(2./3.*theta) + z; } else @@ -500,7 +500,7 @@ Gradient exact_derivative(const Point& p, { // Gradient value to be returned. Gradient gradu; - + // x and y coordinates in space const Real x = p(0); const Real y = dim > 1 ? p(1) : 0.; @@ -513,14 +513,14 @@ Gradient exact_derivative(const Point& p, // For convenience... const Real tt = 2./3.; const Real ot = 1./3.; - + // The value of the radius, squared const Real r2 = x*x + y*y; // The boundary value, given by the exact solution, // u_exact = r^(2/3)*sin(2*theta/3). Real theta = atan2(y,x); - + // Make sure 0 <= theta <= 2*pi if (theta < 0) theta += 2. * libMesh::pi; @@ -573,7 +573,7 @@ void assemble_laplace(EquationSystems& es, // logging, since there may be many PerfLogs in an // application. PerfLog perf_log ("Matrix Assembly",false); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -582,7 +582,7 @@ void assemble_laplace(EquationSystems& es, // Get a reference to the LinearImplicitSystem we are solving LinearImplicitSystem& system = es.get_system("Laplace"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -599,7 +599,7 @@ void assemble_laplace(EquationSystems& es, // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(mesh_dim, fe_type)); AutoPtr fe_face (FEBase::build(mesh_dim, fe_type)); - + // Quadrature rules for numerical integration. AutoPtr qrule(fe_type.default_quadrature_rule(mesh_dim)); AutoPtr qface(fe_type.default_quadrature_rule(mesh_dim-1)); @@ -611,7 +611,7 @@ void assemble_laplace(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); const std::vector& JxW_face = fe_face->get_JxW(); @@ -655,14 +655,14 @@ void assemble_laplace(EquationSystems& es, // active elements while ignoring parent elements which have been // refined. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) { // Start logging the shape function initialization. // This is done through a simple function call with // the name of the event to log. - perf_log.push("elem init"); + perf_log.push("elem init"); // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. @@ -694,7 +694,7 @@ void assemble_laplace(EquationSystems& es, // Stop logging the shape function initialization. // If you forget to stop logging an event the PerfLog // object will probably catch the error and abort. - perf_log.pop("elem init"); + perf_log.pop("elem init"); // Now we will build the element matrix. This involves // a double loop to integrate the test funcions (i) against @@ -738,7 +738,7 @@ void assemble_laplace(EquationSystems& es, // Start logging the boundary condition computation perf_log.push ("BCs"); - // The penalty value. + // The penalty value. const Real penalty = 1.e10; // The following loops over the sides of the element. @@ -748,7 +748,7 @@ void assemble_laplace(EquationSystems& es, if (elem->neighbor(s) == NULL) { fe_face->reinit(elem,s); - + for (unsigned int qp=0; qpn_points(); qp++) { const Number value = exact_solution (qface_points[qp], @@ -765,12 +765,12 @@ void assemble_laplace(EquationSystems& es, for (unsigned int j=0; j ("linear solver tolerance") = TOLERANCE * TOLERANCE; - + // Prints information about the system to the screen. equation_systems.print_info(); @@ -278,7 +278,7 @@ int main(int argc, char** argv) equation_systems.print_info(); std::cout << "Beginning Solve " << r_step << std::endl; - + // Solve the system "Biharmonic", just like example 2. system.solve(); @@ -345,7 +345,7 @@ int main(int argc, char** argv) { mesh_refinement.uniformly_refine(1); } - + // This call reinitializes the \p EquationSystems object for // the newly refined mesh. One of the steps in the // reinitialization is projecting the \p solution, @@ -353,8 +353,8 @@ int main(int argc, char** argv) // the current one. equation_systems.reinit (); } - } - + } + #ifdef LIBMESH_HAVE_EXODUS_API // Write out the solution // After solving the system write the solution @@ -373,8 +373,8 @@ int main(int argc, char** argv) << "ylabel('log(error)');\n" << "title('C1 " << approx_type << " elements');\n" << "legend('L2-error', 'H1-error', 'H2-error');\n"; - - // All done. + + // All done. return 0; #endif // #ifndef LIBMESH_ENABLE_SECOND_DERIVATIVES #endif // #ifndef LIBMESH_ENABLE_AMR @@ -424,7 +424,7 @@ Tensor exact_2D_hessian(const Point& p, { // Second derivatives to be returned. Tensor hessu; - + // x and y coordinates in space const Real x = p(0); const Real y = p(1); @@ -462,7 +462,7 @@ Number exact_3D_solution(const Point& p, const Real x = p(0); const Real y = p(1); const Real z = p(2); - + // analytic solution value return 4096.*(x-x*x)*(x-x*x)*(y-y*y)*(y-y*y)*(z-z*z)*(z-z*z); } @@ -475,7 +475,7 @@ Gradient exact_3D_derivative(const Point& p, { // First derivatives to be returned. Gradient gradu; - + // xyz coordinates in space const Real x = p(0); const Real y = p(1); @@ -497,7 +497,7 @@ Tensor exact_3D_hessian(const Point& p, { // Second derivatives to be returned. Tensor hessu; - + // xyz coordinates in space const Real x = p(0); const Real y = p(1); @@ -558,7 +558,7 @@ void assemble_biharmonic(EquationSystems& es, // logging, since there may be many PerfLogs in an // application. PerfLog perf_log ("Matrix Assembly",false); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -567,7 +567,7 @@ void assemble_biharmonic(EquationSystems& es, // Get a reference to the LinearImplicitSystem we are solving LinearImplicitSystem& system = es.get_system("Biharmonic"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -583,7 +583,7 @@ void assemble_biharmonic(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // Quadrature rule for numerical integration. // With 2D triangles, the Clough quadrature rule puts a Gaussian // quadrature rule on each of the 3 subelements @@ -595,7 +595,7 @@ void assemble_biharmonic(EquationSystems& es, // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires another quadraure rule, // with dimensionality one less than the dimensionality // of the element. @@ -609,7 +609,7 @@ void assemble_biharmonic(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); // The physical XY locations of the quadrature points on the element. @@ -646,14 +646,14 @@ void assemble_biharmonic(EquationSystems& es, // example 3 for a discussion of the element iterators. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) { // Start logging the shape function initialization. // This is done through a simple function call with // the name of the event to log. - perf_log.push("elem init"); + perf_log.push("elem init"); // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. @@ -684,7 +684,7 @@ void assemble_biharmonic(EquationSystems& es, // Stop logging the shape function initialization. // If you forget to stop logging an event the PerfLog // object will probably catch the error and abort. - perf_log.pop("elem init"); + perf_log.pop("elem init"); // Now we will build the element matrix. This involves // a double loop to integrate laplacians of the test funcions @@ -726,7 +726,7 @@ void assemble_biharmonic(EquationSystems& es, // Start logging the boundary condition computation perf_log.push ("BCs"); - // The penalty values, for solution boundary trace and flux. + // The penalty values, for solution boundary trace and flux. const Real penalty = 1e10; const Real penalty2 = 1e10; @@ -749,7 +749,7 @@ void assemble_biharmonic(EquationSystems& es, // The Jacobian * Quadrature Weight at the quadrature // points on the face. const std::vector& JxW_face = fe_face->get_JxW(); - + // The XYZ locations (in physical space) of the // quadrature points on the face. This is where // we will interpolate the boundary value function. @@ -761,7 +761,7 @@ void assemble_biharmonic(EquationSystems& es, // Compute the shape function values on the element // face. fe_face->reinit(elem, s); - + // Loop over the face quagrature points for integration. for (unsigned int qp=0; qpn_points(); qp++) { @@ -793,17 +793,17 @@ void assemble_biharmonic(EquationSystems& es, for (unsigned int i=0; in_points(); qp++) for (unsigned int i=0; iAdaptivity Example 5 - Periodic Boundary Conditions with Adaptive Mesh Refinement - // + // // This example uses the same simple, linear transient // system as in example 10; however in this case periodic boundary // conditions are applied at the sides of the domain. - // + // // This code also contains an example use of ParsedFunction, to // allow users to specify an exact solution on the command line. - + // C++ include files that we need #include #include @@ -168,11 +168,11 @@ int main (int argc, char** argv) // This value is also obtained from the commandline and it specifies the // initial value for the t_step looping variable. We must - // distinguish between the two cases here, whether we read in the + // distinguish between the two cases here, whether we read in the // solution or we started from scratch, so that we do not overwrite the // gmv output files. unsigned int init_timestep = 0; - + // Search the command line for the "init_timestep" flag and if it is // present, set init_timestep accordingly. if(command_line.search("-init_timestep")) @@ -239,13 +239,13 @@ int main (int argc, char** argv) // Print information about the mesh to the screen. mesh.print_info(); - - + + // Declare the system and its variables. // Begin by creating a transient system // named "Convection-Diffusion". - TransientLinearImplicitSystem & system = - equation_systems.add_system + TransientLinearImplicitSystem & system = + equation_systems.add_system ("Convection-Diffusion"); // Adds the variable "u" to "Convection-Diffusion". "u" @@ -256,7 +256,7 @@ int main (int argc, char** argv) system.attach_init_function (init_cd); } // Otherwise we read in the solution and mesh - else + else { // Read in the mesh stored in "saved_mesh.xda" mesh.read("saved_mesh.xdr"); @@ -269,8 +269,8 @@ int main (int argc, char** argv) } // Get a reference to the system so that we can attach things to it - TransientLinearImplicitSystem & system = - equation_systems.get_system + TransientLinearImplicitSystem & system = + equation_systems.get_system ("Convection-Diffusion"); // Give the system a pointer to the assembly function. @@ -278,7 +278,7 @@ int main (int argc, char** argv) // Creating and attaching Periodic Boundaries DofMap & dof_map = system.get_dof_map(); - + // Create a boundary periodic with one displaced 2.0 in the x // direction PeriodicBoundary horz(RealVectorValue(2.0, 0., 0.)); @@ -290,7 +290,7 @@ int main (int argc, char** argv) // Add it to the PeriodicBoundaries dof_map.add_periodic_boundary(horz); - + // Create a boundary periodic with one displaced 2.0 in the y // direction PeriodicBoundary vert(RealVectorValue(0., 2.0, 0.)); @@ -307,7 +307,7 @@ int main (int argc, char** argv) equation_systems.init (); else equation_systems.reinit (); - + // Print out the H1 norm of the initialized or saved solution, for // verification purposes: Real H1norm = system.calculate_norm(*system.solution, SystemNorm(H1)); @@ -316,12 +316,12 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + equation_systems.parameters.set ("linear solver maximum iterations") = 250; equation_systems.parameters.set ("linear solver tolerance") = TOLERANCE; - + if(!read_solution) { // Write out the initial condition @@ -346,19 +346,19 @@ int main (int argc, char** argv) equation_systems); #endif } - + // The Convection-Diffusion system requires that we specify // the flow velocity. We will specify it as a RealVectorValue // data type and then use the Parameters object to pass it to // the assemble function. - equation_systems.parameters.set("velocity") = + equation_systems.parameters.set("velocity") = RealVectorValue (0.8, 0.8); // The Convection-Diffusion system also requires a specified // diffusivity. We use an isotropic (hence Real) value. equation_systems.parameters.set("diffusivity") = 0.01; - + // Solve the system "Convection-Diffusion". This will be done by // looping over the specified time interval and calling the // \p solve() member at each time step. This will assemble the @@ -366,8 +366,8 @@ int main (int argc, char** argv) const Real dt = 0.025; system.time = init_timestep*dt; - - + + // Tell the MeshRefinement object about the periodic boundaries so // that it can get heuristics like level-one conformity and // unrefined island elimination right. @@ -375,8 +375,8 @@ int main (int argc, char** argv) // We do 25 timesteps both before and after writing out the // intermediate solution - for(unsigned int t_step=init_timestep; - t_step<(init_timestep+n_timesteps); + for(unsigned int t_step=init_timestep; + t_step<(init_timestep+n_timesteps); t_step++) { // Increment the time counter, set the time and the @@ -388,7 +388,7 @@ int main (int argc, char** argv) // A pretty update message std::cout << " Solving time step "; - + { // Save flags to avoid polluting cout with custom precision values, etc. std::ios_base::fmtflags os_flags = std::cout.flags(); @@ -406,7 +406,7 @@ int main (int argc, char** argv) // Restore flags std::cout.flags(os_flags); } - + // At this point we need to update the old // solution vector. The old solution vector // will be the current solution vector from the @@ -416,12 +416,12 @@ int main (int argc, char** argv) // (and systems derived from them) contain old solutions // we need to specify the system type when we ask for it. *system.old_local_solution = *system.current_local_solution; - + // The number of refinement steps per time step. unsigned int max_r_steps = 1; if(command_line.search("-max_r_steps")) max_r_steps = command_line.next(0); - + // A refinement loop. for (unsigned int r_step=0; r_step ("time") = system.time = 0; - + if (parsed_solution) system.project_solution(parsed_solution, NULL); else @@ -571,28 +571,28 @@ void assemble_cd (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Convection-Diffusion"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Convection-Diffusion system object. TransientLinearImplicitSystem & system = es.get_system ("Convection-Diffusion"); - - // Get the Finite Element type for the first (and only) + + // Get the Finite Element type for the first (and only) // variable in the system. FEType fe_type = system.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // \p FEBase::build() member dynamically creates memory we will // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -606,7 +606,7 @@ void assemble_cd (EquationSystems& es, // will be used to assemble the linear system. We will start // with the element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); - + // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); @@ -619,14 +619,14 @@ void assemble_cd (EquationSystems& es, // to degree of freedom numbers. We will talk more about the \p DofMap // in future examples. const DofMap& dof_map = system.get_dof_map(); - + // Define data structures to contain the element matrix // and right-hand-side vector contribution. Following // basic finite element terminology we will denote these // "Ke" and "Fe". DenseMatrix Ke; DenseVector Fe; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system // the element degrees of freedom get mapped. @@ -648,14 +648,14 @@ void assemble_cd (EquationSystems& es, // will be refined we want to only consider the ACTIVE elements, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -667,7 +667,7 @@ void assemble_cd (EquationSystems& es, // quadrature points (q_point) and the shape functions // (phi, dphi) for the current element. fe->reinit (elem); - + // Zero the element matrix and right-hand side before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from @@ -678,7 +678,7 @@ void assemble_cd (EquationSystems& es, dof_indices.size()); Fe.resize (dof_indices.size()); - + // Now we will build the element matrix and right-hand-side. // Constructing the RHS requires the solution and its // gradient from the previous timestep. This myst be @@ -690,50 +690,50 @@ void assemble_cd (EquationSystems& es, // Values to hold the old solution & its gradient. Number u_old = 0.; Gradient grad_u_old; - + // Compute the old solution & its gradient. for (unsigned int l=0; ladd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); - + } // Finished computing the sytem matrix and right-hand side. #endif // #ifdef LIBMESH_ENABLE_AMR diff --git a/examples/adjoints/adjoints_ex1/L-shaped.C b/examples/adjoints/adjoints_ex1/L-shaped.C index b588d83df4f..56c8c04df22 100644 --- a/examples/adjoints/adjoints_ex1/L-shaped.C +++ b/examples/adjoints/adjoints_ex1/L-shaped.C @@ -22,7 +22,7 @@ void LaplaceSystem::init_data () GetPot infile("l-shaped.in"); exact_QoI[0] = infile("QoI_0", 0.0); exact_QoI[1] = infile("QoI_1", 0.0); - + // Do the parent's initialization after variables are defined FEMSystem::init_data(); @@ -63,9 +63,9 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // Element basis functions const std::vector > &dphi = c.element_fe_var[0]->get_dphi(); - + // The number of local degrees of freedom in each variable - const unsigned int n_T_dofs = c.dof_indices_var[0].size(); + const unsigned int n_T_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; @@ -80,7 +80,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, unsigned int n_qpoints = (c.get_element_qrule())->n_points(); for (unsigned int qp=0; qp != n_qpoints; qp++) - { + { // Compute the solution gradient at the Newton iterate Gradient grad_T = c.interior_gradient(0, qp); @@ -93,7 +93,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // The analytic jacobian K(i,j) += JxW[qp] * ( dphi[i][qp] * dphi[j][qp] ); } // end of the quadrature point qp-loop - + return compute_jacobian; } @@ -101,11 +101,11 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, bool LaplaceSystem::side_constraint (bool request_jacobian, DiffContext &context) { - // Are the jacobians specified analytically ? + // Are the jacobians specified analytically ? bool compute_jacobian = request_jacobian && _analytic_jacobians; FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -119,12 +119,12 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, const std::vector &qside_point = c.side_fe_var[0]->get_xyz(); // The number of local degrees of freedom in each variable - const unsigned int n_T_dofs = c.dof_indices_var[0].size(); + const unsigned int n_T_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; DenseSubVector &F = *c.elem_subresiduals[0]; - + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); const Real penalty = 1./(TOLERANCE*TOLERANCE); @@ -133,7 +133,7 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, { // Compute the solution at the old Newton iterate Number T = c.side_value(0, qp); - + // We get the Dirichlet bcs from the exact solution Number u_dirichlet = exact_solution (qside_point[qp]); @@ -144,17 +144,17 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, for (unsigned int i=0; i != n_T_dofs; i++) for (unsigned int j=0; j != n_T_dofs; ++j) // The analytic jacobian - K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp]; - + K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp]; + } // end of the quadrature point qp-loop - + return compute_jacobian; } -// Override the default DiffSystem postprocess function to compute the -// approximations to the QoIs +// Override the default DiffSystem postprocess function to compute the +// approximations to the QoIs void LaplaceSystem::postprocess() -{ +{ // Reset the array holding the computed QoIs computed_QoI[0] = 0.0; computed_QoI[1] = 0.0; @@ -164,12 +164,12 @@ void LaplaceSystem::postprocess() Parallel::sum(computed_QoI[0]); Parallel::sum(computed_QoI[1]); - + } // The exact solution to the singular problem, // u_exact = r^(2/3)*sin(2*theta/3). We use this to set the Dirichlet boundary conditions -Number LaplaceSystem::exact_solution(const Point& p)// xyz location +Number LaplaceSystem::exact_solution(const Point& p)// xyz location { const Real x1 = p(0); const Real x2 = p(1); @@ -179,7 +179,7 @@ Number LaplaceSystem::exact_solution(const Point& p)// xyz location // Make sure 0 <= theta <= 2*pi if (theta < 0) theta += 2. * libMesh::pi; - + return pow(x1*x1 + x2*x2, 1./3.)*sin(2./3.*theta); - + } diff --git a/examples/adjoints/adjoints_ex1/L-shaped.h b/examples/adjoints/adjoints_ex1/L-shaped.h index c0589034ba1..250448648a5 100644 --- a/examples/adjoints/adjoints_ex1/L-shaped.h +++ b/examples/adjoints/adjoints_ex1/L-shaped.h @@ -57,7 +57,7 @@ class LaplaceSystem : public FEMSystem // Overloading the postprocess function - virtual void element_postprocess(DiffContext &context); + virtual void element_postprocess(DiffContext &context); virtual void side_postprocess(DiffContext &context); @@ -65,24 +65,24 @@ class LaplaceSystem : public FEMSystem virtual void element_qoi_derivative (DiffContext &context, - const QoISet & qois); + const QoISet & qois); // Overloading the qoi function on sides virtual void side_qoi_derivative (DiffContext &context, - const QoISet & qois); + const QoISet & qois); Number exact_solution (const Point&); // Variables to hold the computed QoIs - + Number computed_QoI[2]; // Variables to read in the exact QoIs from l-shaped.in - + Number exact_QoI[2]; - + // The FE type to use std::string _fe_family; unsigned int _fe_order; diff --git a/examples/adjoints/adjoints_ex1/adjoints_ex1.C b/examples/adjoints/adjoints_ex1/adjoints_ex1.C index 9dbe1a8c8f0..22ff15ee431 100644 --- a/examples/adjoints/adjoints_ex1/adjoints_ex1.C +++ b/examples/adjoints/adjoints_ex1/adjoints_ex1.C @@ -19,14 +19,14 @@ // // This example solves the Laplace equation on the classic "L-shaped" // domain with adaptive mesh refinement. The exact - // solution is u(r,\theta) = r^{2/3} * \sin ( (2/3) * \theta). The kelly and - // adjoint residual error estimators are used to develop error indicators and - // guide mesh adaptation. Since we use the adjoint capabilities of libMesh in + // solution is u(r,\theta) = r^{2/3} * \sin ( (2/3) * \theta). The kelly and + // adjoint residual error estimators are used to develop error indicators and + // guide mesh adaptation. Since we use the adjoint capabilities of libMesh in // this example, we use the DiffSystem framework. This file (adjoints_ex1.C) // contains the declaration of mesh and equation system objects, L-shaped.C - // contains the assembly of the system, element_qoi_derivative.C and - // side_qoi_derivative.C contain the RHS for the adjoint systems. - // Postprocessing to compute the QoIs is done in element_postprocess.C and + // contains the assembly of the system, element_qoi_derivative.C and + // side_qoi_derivative.C contain the RHS for the adjoint systems. + // Postprocessing to compute the QoIs is done in element_postprocess.C and // side_postprocess.C. // The initial mesh contains three QUAD9 elements which represent the @@ -89,7 +89,7 @@ using namespace libMesh; // Write gmv output -void write_output(EquationSystems &es, +void write_output(EquationSystems &es, unsigned int a_step, // The adaptive step count std::string solution_type) // primal or adjoint solve { @@ -103,10 +103,10 @@ void write_output(EquationSystems &es, << std::setfill('0') << std::right << a_step; - + GMVIO(mesh).write_equation_systems (file_name_gmv.str(), es); -#endif +#endif } // Set the parameters for the nonlinear and linear solvers to be used during the simulation @@ -139,7 +139,7 @@ void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m) { NewtonSolver *solver = new NewtonSolver(system); system.time_solver->diff_solver() = AutoPtr(solver); - + solver->quiet = param.solver_quiet; solver->max_nonlinear_iterations = param.max_nonlinear_iterations; solver->minsteplength = param.min_step_length; @@ -152,11 +152,11 @@ void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m) solver->continue_after_max_iterations = true; solver->continue_after_backtrack_failure = true; } - + // And the linear solver options solver->max_linear_iterations = param.max_linear_iterations; solver->initial_linear_tolerance = param.initial_linear_tolerance; - solver->minimum_linear_tolerance = param.minimum_linear_tolerance; + solver->minimum_linear_tolerance = param.minimum_linear_tolerance; } } @@ -170,9 +170,9 @@ AutoPtr build_mesh_refinement(MeshBase &mesh, AutoPtr mesh_refinement(new MeshRefinement(mesh)); mesh_refinement->coarsen_by_parents() = true; mesh_refinement->absolute_global_tolerance() = param.global_tolerance; - mesh_refinement->nelem_target() = param.nelem_target; + mesh_refinement->nelem_target() = param.nelem_target; mesh_refinement->refine_fraction() = param.refine_fraction; - mesh_refinement->coarsen_fraction() = param.coarsen_fraction; + mesh_refinement->coarsen_fraction() = param.coarsen_fraction; mesh_refinement->coarsen_threshold() = param.coarsen_threshold; return mesh_refinement; @@ -202,25 +202,25 @@ AutoPtr build_error_estimator(FEMParameters ¶m, QoISet &qois std::cout<<"Using Adjoint Residual Error Estimator with Patch Recovery Weights"<qoi_set() = qois; + + adjoint_residual_estimator->qoi_set() = qois; adjoint_residual_estimator->error_plot_suffix = "error.gmv"; - + PatchRecoveryErrorEstimator *p1 = new PatchRecoveryErrorEstimator; adjoint_residual_estimator->primal_error_estimator().reset(p1); - + PatchRecoveryErrorEstimator *p2 = new PatchRecoveryErrorEstimator; - adjoint_residual_estimator->dual_error_estimator().reset(p2); + adjoint_residual_estimator->dual_error_estimator().reset(p2); adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(0, H1_SEMINORM); - p1->set_patch_reuse(param.patch_reuse); + p1->set_patch_reuse(param.patch_reuse); - adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(0, H1_SEMINORM); + adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(0, H1_SEMINORM); p2->set_patch_reuse(param.patch_reuse); } else @@ -249,9 +249,9 @@ int main (int argc, char** argv) std::ifstream i("general.in"); if (!i) { - std::cerr << '[' << libMesh::processor_id() - << "] Can't find general.in; exiting early." - << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Can't find general.in; exiting early." + << std::endl; libmesh_error(); } } @@ -263,7 +263,7 @@ int main (int argc, char** argv) // Skip this default-2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Create a mesh. Mesh mesh; @@ -286,7 +286,7 @@ int main (int argc, char** argv) // on the coarse grid read in from lshaped.xda MeshRefinement initial_uniform_refinements(mesh); initial_uniform_refinements.uniformly_refine(param.coarserefinements); - + std::cout << "Building system" << std::endl; // Build the FEMSystem @@ -294,7 +294,7 @@ int main (int argc, char** argv) // Set its parameters set_system_parameters(system, param); - + std::cout << "Initializing systems" << std::endl; equation_systems.init (); @@ -304,11 +304,11 @@ int main (int argc, char** argv) equation_systems.print_info(); LinearSolver *linear_solver = system.get_linear_solver(); - { + { // Adaptively solve the timestep unsigned int a_step = 0; for (; a_step != param.max_adaptivesteps; ++a_step) - { + { // We can't adapt to both a tolerance and a // target mesh size if (param.global_tolerance != 0.) @@ -317,15 +317,15 @@ int main (int argc, char** argv) // target mesh size else libmesh_assert_greater (param.nelem_target, 0); - + linear_solver->reuse_preconditioner(false); // Solve the forward problem system.solve(); - // Write out the computed primal solution + // Write out the computed primal solution write_output(equation_systems, a_step, "primal"); - + // Get a pointer to the primal solution vector NumericVector &primal_solution = *system.solution; @@ -340,20 +340,20 @@ int main (int argc, char** argv) // Set weights for each index, these will weight the contribution of each QoI in the final error // estimate to be used for flagging elements for refinement - qois.set_weight(0, 0.5); - qois.set_weight(1, 0.5); + qois.set_weight(0, 0.5); + qois.set_weight(1, 0.5); // Make sure we get the contributions to the adjoint RHS from the sides system.assemble_qoi_sides = true; // We are about to solve the adjoint system, but before we do this we see the same preconditioner - // flag to reuse the preconditioner from the forward solver + // flag to reuse the preconditioner from the forward solver linear_solver->reuse_preconditioner(param.reuse_preconditioner); - + // Solve the adjoint system. This takes the transpose of the stiffness matrix and then // solves the resulting system system.adjoint_solve(); - + // Now that we have solved the adjoint, set the adjoint_already_solved boolean to true, so we dont solve unneccesarily in the error estimator system.set_adjoint_already_solved(true); @@ -361,84 +361,84 @@ int main (int argc, char** argv) NumericVector &dual_solution_0 = system.get_adjoint_solution(0); // Swap the primal and dual solutions so we can write out the adjoint solution - primal_solution.swap(dual_solution_0); + primal_solution.swap(dual_solution_0); write_output(equation_systems, a_step, "adjoint_0"); // Swap back primal_solution.swap(dual_solution_0); - + // Get a pointer to the solution vector of the adjoint problem for QoI 0 NumericVector &dual_solution_1 = system.get_adjoint_solution(1); - + // Swap again - primal_solution.swap(dual_solution_1); + primal_solution.swap(dual_solution_1); write_output(equation_systems, a_step, "adjoint_1"); // Swap back again primal_solution.swap(dual_solution_1); - + std::cout << "Adaptive step " << a_step << ", we have " << mesh.n_active_elem() << " active elements and " << equation_systems.n_active_dofs() << " active dofs." << std::endl ; // Postprocess, compute the approximate QoIs and write them out to the console - std::cout << "Postprocessing: " << std::endl; + std::cout << "Postprocessing: " << std::endl; system.postprocess_sides = true; system.postprocess(); Number QoI_0_computed = system.get_QoI_value("computed", 0); Number QoI_0_exact = system.get_QoI_value("exact", 0); Number QoI_1_computed = system.get_QoI_value("computed", 1); Number QoI_1_exact = system.get_QoI_value("exact", 1); - + std::cout<< "The relative error in QoI 0 is " << std::setprecision(17) << std::abs(QoI_0_computed - QoI_0_exact) / std::abs(QoI_0_exact) << std::endl; - - std::cout<< "The relative error in QoI 1 is " << std::setprecision(17) + + std::cout<< "The relative error in QoI 1 is " << std::setprecision(17) << std::abs(QoI_1_computed - QoI_1_exact) / std::abs(QoI_1_exact) << std::endl << std::endl; - - // Now we construct the data structures for the mesh refinement process + + // Now we construct the data structures for the mesh refinement process ErrorVector error; - + // Build an error estimator object AutoPtr error_estimator = build_error_estimator(param, qois); - + // Estimate the error in each element using the Adjoint Residual or Kelly error estimator error_estimator->estimate_error(system, error); - - // We have to refine either based on reaching an error tolerance or + + // We have to refine either based on reaching an error tolerance or // a number of elements target, which should be verified above - // Otherwise we flag elements by error tolerance or nelem target + // Otherwise we flag elements by error tolerance or nelem target // Uniform refinement if(param.refine_uniformly) - { + { mesh_refinement->uniformly_refine(1); } // Adaptively refine based on reaching an error tolerance else if(param.global_tolerance >= 0. && param.nelem_target == 0.) - { - mesh_refinement->flag_elements_by_error_tolerance (error); - + { + mesh_refinement->flag_elements_by_error_tolerance (error); + mesh_refinement->refine_and_coarsen_elements(); } // Adaptively refine based on reaching a target number of elements - else - { + else + { if (mesh.n_active_elem() >= param.nelem_target) { std::cout<<"We reached the target number of elements."<flag_elements_by_nelem_target (error); - + mesh_refinement->refine_and_coarsen_elements(); } - + // Dont forget to reinit the system after each adaptive refinement ! equation_systems.reinit(); @@ -451,74 +451,74 @@ int main (int argc, char** argv) // Do one last solve if necessary if (a_step == param.max_adaptivesteps) - { - linear_solver->reuse_preconditioner(false); + { + linear_solver->reuse_preconditioner(false); system.solve(); - + write_output(equation_systems, a_step, "primal"); NumericVector &primal_solution = *system.solution; - + QoISet qois; std::vector qoi_indices; qoi_indices.push_back(0); qoi_indices.push_back(1); qois.add_indices(qoi_indices); - - qois.set_weight(0, 0.5); - qois.set_weight(1, 0.5); - system.assemble_qoi_sides = true; + qois.set_weight(0, 0.5); + qois.set_weight(1, 0.5); + + system.assemble_qoi_sides = true; linear_solver->reuse_preconditioner(param.reuse_preconditioner); system.adjoint_solve(); - + // Now that we have solved the adjoint, set the adjoint_already_solved boolean to true, so we dont solve unneccesarily in the error estimator system.set_adjoint_already_solved(true); NumericVector &dual_solution_0 = system.get_adjoint_solution(0); - - primal_solution.swap(dual_solution_0); + + primal_solution.swap(dual_solution_0); write_output(equation_systems, a_step, "adjoint_0"); primal_solution.swap(dual_solution_0); - + NumericVector &dual_solution_1 = system.get_adjoint_solution(1); - - primal_solution.swap(dual_solution_1); + + primal_solution.swap(dual_solution_1); write_output(equation_systems, a_step, "adjoint_1"); primal_solution.swap(dual_solution_1); - + std::cout << "Adaptive step " << a_step << ", we have " << mesh.n_active_elem() << " active elements and " << equation_systems.n_active_dofs() - << " active dofs." << std::endl ; - - std::cout << "Postprocessing: " << std::endl; + << " active dofs." << std::endl ; + + std::cout << "Postprocessing: " << std::endl; system.postprocess_sides = true; system.postprocess(); - + Number QoI_0_computed = system.get_QoI_value("computed", 0); Number QoI_0_exact = system.get_QoI_value("exact", 0); Number QoI_1_computed = system.get_QoI_value("computed", 1); Number QoI_1_exact = system.get_QoI_value("exact", 1); - + std::cout<< "The relative error in QoI 0 is " << std::setprecision(17) << std::abs(QoI_0_computed - QoI_0_exact) / std::abs(QoI_0_exact) << std::endl; - + std::cout<< "The relative error in QoI 1 is " << std::setprecision(17) << std::abs(QoI_1_computed - QoI_1_exact) / std::abs(QoI_1_exact) << std::endl << std::endl; } } - std::cerr << '[' << libMesh::processor_id() - << "] Completing output." << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Completing output." << std::endl; #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. + + // All done. return 0; } diff --git a/examples/adjoints/adjoints_ex1/element_postprocess.C b/examples/adjoints/adjoints_ex1/element_postprocess.C index 8019e2c0348..a650fdb246c 100644 --- a/examples/adjoints/adjoints_ex1/element_postprocess.C +++ b/examples/adjoints/adjoints_ex1/element_postprocess.C @@ -14,14 +14,14 @@ using namespace libMesh; // Last modified: Feb 13, 2009 -// Define the postprocess function to compute QoI 0, the integral of the the solution +// Define the postprocess function to compute QoI 0, the integral of the the solution // over a subdomain void LaplaceSystem::element_postprocess (DiffContext &context) -{ +{ FEMContext &c = libmesh_cast_ref(context); - + // Element Jacobian * quadrature weights for interior integration const std::vector &JxW = c.element_fe_var[0]->get_JxW(); @@ -31,14 +31,14 @@ void LaplaceSystem::element_postprocess (DiffContext &context) unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - // The function R = int_{omega} T dR + // The function R = int_{omega} T dR // omega is a subset of Omega (the whole domain), omega = [0.75, 1.0] x [0.0, 0.25] Number dQoI_0 = 0.; - - // Loop over quadrature points - - for (unsigned int qp = 0; qp != n_qpoints; qp++) + + // Loop over quadrature points + + for (unsigned int qp = 0; qp != n_qpoints; qp++) { // Get co-ordinate locations of the current quadrature point const Real x = xyz[qp](0); @@ -46,7 +46,7 @@ void LaplaceSystem::element_postprocess (DiffContext &context) // If in the sub-domain omega, add the contribution to the integral R if(fabs(x - 0.875) <= 0.125 && fabs(y - 0.125) <= 0.125) - { + { // Get the solution value at the quadrature point Number T = c.interior_value(0, qp); @@ -57,6 +57,6 @@ void LaplaceSystem::element_postprocess (DiffContext &context) // Update the computed value of the global functional R, by adding the contribution from this element - computed_QoI[0] = computed_QoI[0] + dQoI_0; - + computed_QoI[0] = computed_QoI[0] + dQoI_0; + } diff --git a/examples/adjoints/adjoints_ex1/element_qoi_derivative.C b/examples/adjoints/adjoints_ex1/element_qoi_derivative.C index 6797dfc3c6f..c6610b4ef94 100644 --- a/examples/adjoints/adjoints_ex1/element_qoi_derivative.C +++ b/examples/adjoints/adjoints_ex1/element_qoi_derivative.C @@ -18,7 +18,7 @@ void LaplaceSystem::element_qoi_derivative (DiffContext &context, const QoISet & /* qois */) { FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -27,32 +27,32 @@ void LaplaceSystem::element_qoi_derivative (DiffContext &context, // The basis functions for the element const std::vector > &phi = c.element_fe_var[0]->get_phi(); - + // The element quadrature points const std::vector &q_point = c.element_fe_var[0]->get_xyz(); // The number of local degrees of freedom in each variable const unsigned int n_T_dofs = c.dof_indices_var[0].size(); - unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + unsigned int n_qpoints = (c.get_element_qrule())->n_points(); + // Fill the QoI RHS corresponding to this QoI. Since this is the 0th QoI // we fill in the [0][i] subderivatives, i corresponding to the variable index. // Our system has only one variable, so we only have to fill the [0][0] subderivative DenseSubVector &Q = *c.elem_qoi_subderivatives[0][0]; - + // Loop over the qps for (unsigned int qp=0; qp != n_qpoints; qp++) { const Real x = q_point[qp](0); const Real y = q_point[qp](1); - + // If in the sub-domain over which QoI 0 is supported, add contributions // to the adjoint rhs if(fabs(x - 0.875) <= 0.125 && fabs(y - 0.125) <= 0.125) - { + { for (unsigned int i=0; i != n_T_dofs; i++) Q(i) += JxW[qp] *phi[i][qp] ; } - + } // end of the quadrature point qp-loop } diff --git a/examples/adjoints/adjoints_ex1/femparameters.C b/examples/adjoints/adjoints_ex1/femparameters.C index a6a09481376..c66024a21d0 100644 --- a/examples/adjoints/adjoints_ex1/femparameters.C +++ b/examples/adjoints/adjoints_ex1/femparameters.C @@ -14,9 +14,9 @@ void FEMParameters::read(GetPot &input) { std::vector variable_names; - - - GETPOT_INT_INPUT(coarserefinements); + + + GETPOT_INT_INPUT(coarserefinements); GETPOT_INPUT(domainfile); GETPOT_INPUT(solver_quiet); @@ -35,7 +35,7 @@ void FEMParameters::read(GetPot &input) GETPOT_INPUT(refine_fraction); GETPOT_INPUT(coarsen_fraction); GETPOT_INPUT(coarsen_threshold); - GETPOT_INT_INPUT(max_adaptivesteps); + GETPOT_INT_INPUT(max_adaptivesteps); GETPOT_INPUT(refine_uniformly); GETPOT_INPUT(indicator_type); GETPOT_INPUT(patch_reuse); diff --git a/examples/adjoints/adjoints_ex1/femparameters.h b/examples/adjoints/adjoints_ex1/femparameters.h index e30f80b4e30..b972f96742c 100644 --- a/examples/adjoints/adjoints_ex1/femparameters.h +++ b/examples/adjoints/adjoints_ex1/femparameters.h @@ -13,9 +13,9 @@ using namespace libMesh; class FEMParameters { public: - FEMParameters() : + FEMParameters() : domainfile("lshaped.xda"), - coarserefinements(0), + coarserefinements(0), solver_quiet(true), reuse_preconditioner(false), require_residual_reduction(true), @@ -27,19 +27,19 @@ class FEMParameters nelem_target(30000), global_tolerance(0.0), refine_fraction(0.3), coarsen_fraction(0.3), coarsen_threshold(10), refine_uniformly(false), - max_adaptivesteps(1), + max_adaptivesteps(1), indicator_type("kelly"), patch_reuse(true), - fe_family(1, "LAGRANGE"), fe_order(1, 1), + fe_family(1, "LAGRANGE"), fe_order(1, 1), analytic_jacobians(true), verify_analytic_jacobians(0.0), print_solution_norms(false), print_solutions(false), print_residual_norms(false), print_residuals(false), print_jacobian_norms(false), print_jacobians(false) {} void read(GetPot &input); - + std::string domainfile; unsigned int coarserefinements; - + bool solver_quiet, reuse_preconditioner, require_residual_reduction; Real min_step_length; unsigned int max_linear_iterations, max_nonlinear_iterations; @@ -52,8 +52,8 @@ class FEMParameters Real refine_fraction, coarsen_fraction, coarsen_threshold; bool refine_uniformly; unsigned int max_adaptivesteps; - - std::string indicator_type; + + std::string indicator_type; bool patch_reuse; std::vector fe_family; diff --git a/examples/adjoints/adjoints_ex1/side_postprocess.C b/examples/adjoints/adjoints_ex1/side_postprocess.C index edcffb3fa9d..257429b56aa 100644 --- a/examples/adjoints/adjoints_ex1/side_postprocess.C +++ b/examples/adjoints/adjoints_ex1/side_postprocess.C @@ -17,9 +17,9 @@ using namespace libMesh; void LaplaceSystem::side_postprocess(DiffContext &context) { - + FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -30,8 +30,8 @@ void LaplaceSystem::side_postprocess(DiffContext &context) const std::vector &face_normals = c.side_fe_var[0]->get_normals(); - unsigned int n_qpoints = (c.get_side_qrule())->n_points(); - + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); + Number dQoI_1 = 0. ; // Loop over qp's, compute the function at each qp and add @@ -42,18 +42,18 @@ void LaplaceSystem::side_postprocess(DiffContext &context) const Real y = q_point[qp](1); const Real TOL = 1.e-5; - + // If on the bottom horizontal bdry (y = -1) if(fabs(y - 1.0) <= TOL && x > 0.0) { // Get the value of the gradient at this point - const Gradient grad_T = c.side_gradient(0,qp); + const Gradient grad_T = c.side_gradient(0,qp); // Add the contribution of this qp to the integral QoI - dQoI_1 += JxW[qp] * (grad_T * face_normals[qp]) ; + dQoI_1 += JxW[qp] * (grad_T * face_normals[qp]) ; } - + } // end of the quadrature point qp-loop - - computed_QoI[1] = computed_QoI[1] + dQoI_1; + + computed_QoI[1] = computed_QoI[1] + dQoI_1; } diff --git a/examples/adjoints/adjoints_ex1/side_qoi_derivative.C b/examples/adjoints/adjoints_ex1/side_qoi_derivative.C index 2be4d246cdf..ebe015ed2df 100644 --- a/examples/adjoints/adjoints_ex1/side_qoi_derivative.C +++ b/examples/adjoints/adjoints_ex1/side_qoi_derivative.C @@ -18,7 +18,7 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, const QoISet & /* qois */) { FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -27,7 +27,7 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, // The basis functions for the side const std::vector > &dphi = c.side_fe_var[0]->get_dphi(); - + // The side quadrature points const std::vector &q_point = c.side_fe_var[0]->get_xyz(); @@ -36,7 +36,7 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, // The number of local degrees of freedom in each variable const unsigned int n_T_dofs = c.dof_indices_var[0].size(); - unsigned int n_qpoints = (c.get_side_qrule())->n_points(); + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); // Fill the QoI RHS corresponding to this QoI. Since this is QoI 1 // we fill in the [1][i] subderivatives, i corresponding to the variable index. @@ -48,15 +48,15 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, for (unsigned int qp=0; qp != n_qpoints; qp++) { const Real x = q_point[qp](0); - const Real y = q_point[qp](1); - + const Real y = q_point[qp](1); + // If on the sides where the boundary QoI is supported, add contributions // to the adjoint rhs if(fabs(y - 1.0) <= TOL && x > 0.0) - { + { for (unsigned int i=0; i != n_T_dofs; i++) - Q(i) += JxW[qp] * (dphi[i][qp] * face_normals[qp]); - } - + Q(i) += JxW[qp] * (dphi[i][qp] * face_normals[qp]); + } + } // end of the quadrature point qp-loop } diff --git a/examples/adjoints/adjoints_ex2/L-qoi.C b/examples/adjoints/adjoints_ex2/L-qoi.C index 28c33977225..17191a5fbf2 100644 --- a/examples/adjoints/adjoints_ex2/L-qoi.C +++ b/examples/adjoints/adjoints_ex2/L-qoi.C @@ -14,21 +14,21 @@ void LaplaceQoI::init_qoi( std::vector& sys_qoi ) void LaplaceQoI::element_qoi (DiffContext &context, const QoISet & /* qois */ ) -{ +{ FEMContext &c = libmesh_cast_ref(context); - + // Element Jacobian * quadrature weights for interior integration const std::vector &JxW = c.element_fe_var[0]->get_JxW(); const std::vector &xyz = c.element_fe_var[0]->get_xyz(); unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + Number dQoI_0 = 0.; - - // Loop over quadrature points - - for (unsigned int qp = 0; qp != n_qpoints; qp++) + + // Loop over quadrature points + + for (unsigned int qp = 0; qp != n_qpoints; qp++) { // Get co-ordinate locations of the current quadrature point const Real xf = xyz[qp](0); @@ -36,7 +36,7 @@ void LaplaceQoI::element_qoi (DiffContext &context, // If in the sub-domain omega, add the contribution to the integral R if(fabs(xf - 0.875) <= 0.125 && fabs(yf - 0.125) <= 0.125) - { + { // Get the solution value at the quadrature point Number T = c.interior_value(0, qp); @@ -48,8 +48,8 @@ void LaplaceQoI::element_qoi (DiffContext &context, // Update the computed value of the global functional R, by adding the contribution from this element - c.elem_qoi[0] = c.elem_qoi[0] + dQoI_0; - + c.elem_qoi[0] = c.elem_qoi[0] + dQoI_0; + } // We only have one QoI, so we don't bother checking the qois argument @@ -58,7 +58,7 @@ void LaplaceQoI::element_qoi_derivative (DiffContext &context, const QoISet & /* qois */) { FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -67,34 +67,32 @@ void LaplaceQoI::element_qoi_derivative (DiffContext &context, // The basis functions for the element const std::vector > &phi = c.element_fe_var[0]->get_phi(); - + // The element quadrature points const std::vector &q_point = c.element_fe_var[0]->get_xyz(); // The number of local degrees of freedom in each variable const unsigned int n_T_dofs = c.dof_indices_var[0].size(); - unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + unsigned int n_qpoints = (c.get_element_qrule())->n_points(); + // Fill the QoI RHS corresponding to this QoI. Since this is the 0th QoI // we fill in the [0][i] subderivatives, i corresponding to the variable index. // Our system has only one variable, so we only have to fill the [0][0] subderivative DenseSubVector &Q = *c.elem_qoi_subderivatives[0][0]; - + // Loop over the qps for (unsigned int qp=0; qp != n_qpoints; qp++) { const Real x = q_point[qp](0); const Real y = q_point[qp](1); - + // If in the sub-domain over which QoI 0 is supported, add contributions // to the adjoint rhs if(fabs(x - 0.875) <= 0.125 && fabs(y - 0.125) <= 0.125) - { + { for (unsigned int i=0; i != n_T_dofs; i++) Q(i) += JxW[qp] *phi[i][qp] ; } - + } // end of the quadrature point qp-loop } - - diff --git a/examples/adjoints/adjoints_ex2/L-qoi.h b/examples/adjoints/adjoints_ex2/L-qoi.h index bde87ad2893..3b45fc65eab 100644 --- a/examples/adjoints/adjoints_ex2/L-qoi.h +++ b/examples/adjoints/adjoints_ex2/L-qoi.h @@ -17,15 +17,15 @@ class LaplaceQoI : public DifferentiableQoI { public: LaplaceQoI(){} - virtual ~LaplaceQoI(){} + virtual ~LaplaceQoI(){} virtual void init_qoi( std::vector& sys_qoi ); - virtual void postprocess( ){} - - virtual void element_qoi_derivative(DiffContext &context, const QoISet & qois); + virtual void postprocess( ){} - virtual void element_qoi (DiffContext &context, const QoISet & qois); + virtual void element_qoi_derivative(DiffContext &context, const QoISet & qois); + + virtual void element_qoi (DiffContext &context, const QoISet & qois); virtual AutoPtr clone( ) { return AutoPtr ( new LaplaceQoI(*this) ); diff --git a/examples/adjoints/adjoints_ex2/L-shaped.C b/examples/adjoints/adjoints_ex2/L-shaped.C index 75e071a5a41..3a587b4172f 100644 --- a/examples/adjoints/adjoints_ex2/L-shaped.C +++ b/examples/adjoints/adjoints_ex2/L-shaped.C @@ -22,7 +22,7 @@ void LaplaceSystem::init_data () GetPot infile("l-shaped.in"); parameters.push_back(infile("alpha_1", 1.0)); parameters.push_back(infile("alpha_2", 1.0)); - + // Do the parent's initialization after variables are defined FEMSystem::init_data(); @@ -63,9 +63,9 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // Element basis function gradients const std::vector > &dphi = c.element_fe_var[0]->get_dphi(); - + // The number of local degrees of freedom in each variable - const unsigned int n_T_dofs = c.dof_indices_var[0].size(); + const unsigned int n_T_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; @@ -80,7 +80,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, unsigned int n_qpoints = (c.get_element_qrule())->n_points(); for (unsigned int qp=0; qp != n_qpoints; qp++) - { + { // Compute the solution gradient at the Newton iterate Gradient grad_T = c.interior_gradient(0, qp); @@ -93,7 +93,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // The analytic jacobian K(i,j) += JxW[qp] * (parameters[0] + (2.*parameters[1])) * ( dphi[i][qp] * dphi[j][qp] ); } // end of the quadrature point qp-loop - + return compute_jacobian; } @@ -101,11 +101,11 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, bool LaplaceSystem::side_constraint (bool request_jacobian, DiffContext &context) { - // Are the jacobians specified analytically ? + // Are the jacobians specified analytically ? bool compute_jacobian = request_jacobian && _analytic_jacobians; FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -119,12 +119,12 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, const std::vector &qside_point = c.side_fe_var[0]->get_xyz(); // The number of local degrees of freedom in each variable - const unsigned int n_T_dofs = c.dof_indices_var[0].size(); + const unsigned int n_T_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; DenseSubVector &F = *c.elem_subresiduals[0]; - + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); const Real penalty = 1./(TOLERANCE*TOLERANCE); @@ -133,7 +133,7 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, { // Compute the solution at the old Newton iterate Number T = c.side_value(0, qp); - + // We get the Dirichlet bcs from the exact solution Number u_dirichlet = exact_solution (qside_point[qp]); @@ -144,16 +144,16 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, for (unsigned int i=0; i != n_T_dofs; i++) for (unsigned int j=0; j != n_T_dofs; ++j) // The analytic jacobian - K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp]; - + K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp]; + } // end of the quadrature point qp-loop - + return compute_jacobian; } // The exact solution to the singular problem, // u_exact = r^(2/3)*sin(2*theta/3). We use this to set the Dirichlet boundary conditions -Number LaplaceSystem::exact_solution(const Point& p)// xyz location +Number LaplaceSystem::exact_solution(const Point& p)// xyz location { const Real x1 = p(0); const Real x2 = p(1); @@ -163,6 +163,6 @@ Number LaplaceSystem::exact_solution(const Point& p)// xyz location // Make sure 0 <= theta <= 2*pi if (theta < 0) theta += 2. * libMesh::pi; - + return (parameters[0] + (2.*parameters[1])) * pow(x1*x1 + x2*x2, 1./3.)*sin(2./3.*theta); } diff --git a/examples/adjoints/adjoints_ex2/L-shaped.h b/examples/adjoints/adjoints_ex2/L-shaped.h index 952ae491867..c2c6e7efd14 100644 --- a/examples/adjoints/adjoints_ex2/L-shaped.h +++ b/examples/adjoints/adjoints_ex2/L-shaped.h @@ -36,10 +36,10 @@ class LaplaceSystem : public FEMSystem { parameter_vector[i] = ¶meters[i]; } - + return parameter_vector; } - + protected: // System initialization virtual void init_data (); @@ -55,16 +55,16 @@ class LaplaceSystem : public FEMSystem // Constraint parts virtual bool side_constraint (bool request_jacobian, DiffContext &context); - + Number exact_solution (const Point&); // Parameters associated with the system std::vector parameters; - + // The ParameterVector object that will contain pointers to // the system parameters ParameterVector parameter_vector; - + // The FE type to use std::string _fe_family; unsigned int _fe_order; diff --git a/examples/adjoints/adjoints_ex2/adjoints_ex2.C b/examples/adjoints/adjoints_ex2/adjoints_ex2.C index d3569ca2fc3..0453be55be4 100644 --- a/examples/adjoints/adjoints_ex2/adjoints_ex2.C +++ b/examples/adjoints/adjoints_ex2/adjoints_ex2.C @@ -98,14 +98,14 @@ using namespace libMesh; // Write gmv output -void write_output(EquationSystems &es, +void write_output(EquationSystems &es, unsigned int a_step, // The adaptive step count std::string solution_type) // primal or adjoint solve { MeshBase &mesh = es.get_mesh(); #ifdef LIBMESH_HAVE_GMV - + std::ostringstream file_name_gmv; file_name_gmv << solution_type << ".out.gmv." @@ -113,11 +113,11 @@ void write_output(EquationSystems &es, << std::setfill('0') << std::right << a_step; - + GMVIO(mesh).write_equation_systems (file_name_gmv.str(), es); - -#endif + +#endif } // Set the parameters for the nonlinear and linear solvers to be used during the simulation @@ -150,7 +150,7 @@ void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m) { NewtonSolver *solver = new NewtonSolver(system); system.time_solver->diff_solver() = AutoPtr(solver); - + solver->quiet = param.solver_quiet; solver->max_nonlinear_iterations = param.max_nonlinear_iterations; solver->minsteplength = param.min_step_length; @@ -163,11 +163,11 @@ void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m) solver->continue_after_max_iterations = true; solver->continue_after_backtrack_failure = true; } - + // And the linear solver options solver->max_linear_iterations = param.max_linear_iterations; solver->initial_linear_tolerance = param.initial_linear_tolerance; - solver->minimum_linear_tolerance = param.minimum_linear_tolerance; + solver->minimum_linear_tolerance = param.minimum_linear_tolerance; } } @@ -181,9 +181,9 @@ AutoPtr build_mesh_refinement(MeshBase &mesh, AutoPtr mesh_refinement(new MeshRefinement(mesh)); mesh_refinement->coarsen_by_parents() = true; mesh_refinement->absolute_global_tolerance() = param.global_tolerance; - mesh_refinement->nelem_target() = param.nelem_target; + mesh_refinement->nelem_target() = param.nelem_target; mesh_refinement->refine_fraction() = param.refine_fraction; - mesh_refinement->coarsen_fraction() = param.coarsen_fraction; + mesh_refinement->coarsen_fraction() = param.coarsen_fraction; mesh_refinement->coarsen_threshold() = param.coarsen_threshold; return mesh_refinement; @@ -213,22 +213,22 @@ AutoPtr build_error_estimator(FEMParameters ¶m) std::cout<<"Using Adjoint Residual Error Estimator with Patch Recovery Weights"<error_plot_suffix = "error.gmv"; - + PatchRecoveryErrorEstimator *p1 = new PatchRecoveryErrorEstimator; adjoint_residual_estimator->primal_error_estimator().reset(p1); - + PatchRecoveryErrorEstimator *p2 = new PatchRecoveryErrorEstimator; - adjoint_residual_estimator->dual_error_estimator().reset(p2); + adjoint_residual_estimator->dual_error_estimator().reset(p2); adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(0, H1_SEMINORM); - - adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(0, H1_SEMINORM); + + adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(0, H1_SEMINORM); } else { @@ -256,9 +256,9 @@ int main (int argc, char** argv) std::ifstream i("general.in"); if (!i) { - std::cerr << '[' << libMesh::processor_id() - << "] Can't find general.in; exiting early." - << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Can't find general.in; exiting early." + << std::endl; libmesh_error(); } } @@ -270,7 +270,7 @@ int main (int argc, char** argv) // Skip this default-2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Create a mesh. Mesh mesh; @@ -293,18 +293,18 @@ int main (int argc, char** argv) // on the coarse grid read in from lshaped.xda MeshRefinement initial_uniform_refinements(mesh); initial_uniform_refinements.uniformly_refine(param.coarserefinements); - + std::cout << "Building system" << std::endl; // Build the FEMSystem LaplaceSystem &system = equation_systems.add_system ("LaplaceSystem"); QoISet qois; - + std::vector qoi_indices; qoi_indices.push_back(0); qois.add_indices(qoi_indices); - + qois.set_weight(0, 0.5); // Put some scope here to test that the cloning is working right @@ -315,7 +315,7 @@ int main (int argc, char** argv) // Set its parameters set_system_parameters(system, param); - + std::cout << "Initializing systems" << std::endl; equation_systems.init (); @@ -324,11 +324,11 @@ int main (int argc, char** argv) mesh.print_info(); equation_systems.print_info(); - { + { // Adaptively solve the timestep unsigned int a_step = 0; for (; a_step != param.max_adaptivesteps; ++a_step) - { + { // We can't adapt to both a tolerance and a // target mesh size if (param.global_tolerance != 0.) @@ -337,13 +337,13 @@ int main (int argc, char** argv) // target mesh size else libmesh_assert_greater (param.nelem_target, 0); - + // Solve the forward problem system.solve(); - // Write out the computed primal solution + // Write out the computed primal solution write_output(equation_systems, a_step, "primal"); - + // Get a pointer to the primal solution vector NumericVector &primal_solution = *system.solution; @@ -369,7 +369,7 @@ int main (int argc, char** argv) Number sensitivity_QoI_0_0_exact = infile_l_shaped("sensitivity_0_0", 0.0); Number sensitivity_QoI_0_1_computed = sensitivities[0][1]; Number sensitivity_QoI_0_1_exact = infile_l_shaped("sensitivity_0_1", 0.0); - + std::cout << "Adaptive step " << a_step << ", we have " << mesh.n_active_elem() << " active elements and " << equation_systems.n_active_dofs() @@ -378,63 +378,63 @@ int main (int argc, char** argv) std::cout<<"Sensitivity of QoI one to Parameter one is "< &dual_solution_0 = system.get_adjoint_solution(0); // Swap the primal and dual solutions so we can write out the adjoint solution - primal_solution.swap(dual_solution_0); + primal_solution.swap(dual_solution_0); write_output(equation_systems, a_step, "adjoint_0"); // Swap back primal_solution.swap(dual_solution_0); - - // We have to refine either based on reaching an error tolerance or + + // We have to refine either based on reaching an error tolerance or // a number of elements target, which should be verified above - // Otherwise we flag elements by error tolerance or nelem target + // Otherwise we flag elements by error tolerance or nelem target // Uniform refinement if(param.refine_uniformly) - { + { std::cout<<"Refining Uniformly"<uniformly_refine(1); } // Adaptively refine based on reaching an error tolerance else if(param.global_tolerance >= 0. && param.nelem_target == 0.) - { - // Now we construct the data structures for the mesh refinement process + { + // Now we construct the data structures for the mesh refinement process ErrorVector error; - + // Build an error estimator object AutoPtr error_estimator = build_error_estimator(param); // Estimate the error in each element using the Adjoint Residual or Kelly error estimator error_estimator->estimate_error(system, error); - - mesh_refinement->flag_elements_by_error_tolerance (error); - + + mesh_refinement->flag_elements_by_error_tolerance (error); + mesh_refinement->refine_and_coarsen_elements(); } // Adaptively refine based on reaching a target number of elements - else + else { - // Now we construct the data structures for the mesh refinement process + // Now we construct the data structures for the mesh refinement process ErrorVector error; - + // Build an error estimator object AutoPtr error_estimator = build_error_estimator(param); - + // Estimate the error in each element using the Adjoint Residual or Kelly error estimator error_estimator->estimate_error(system, error); @@ -442,13 +442,13 @@ int main (int argc, char** argv) { std::cout<<"We reached the target number of elements."<flag_elements_by_nelem_target (error); - + mesh_refinement->refine_and_coarsen_elements(); } - + // Dont forget to reinit the system after each adaptive refinement ! equation_systems.reinit(); @@ -461,23 +461,23 @@ int main (int argc, char** argv) // Do one last solve if necessary if (a_step == param.max_adaptivesteps) - { + { system.solve(); - + write_output(equation_systems, a_step, "primal"); NumericVector &primal_solution = *system.solution; - + SensitivityData sensitivities(qois, system, system.get_parameter_vector()); - + system.assemble_qoi_sides = true; - + // Here we solve the adjoint problem inside the adjoint_qoi_parameter_sensitivity // function, so we have to set the adjoint_already_solved boolean to false system.set_adjoint_already_solved(false); system.adjoint_qoi_parameter_sensitivity(qois, system.get_parameter_vector(), sensitivities); - + // Now that we have solved the adjoint, set the adjoint_already_solved boolean to true, so we dont solve unneccesarily in the error estimator system.set_adjoint_already_solved(true); @@ -487,11 +487,11 @@ int main (int argc, char** argv) Number sensitivity_QoI_0_0_exact = infile_l_shaped("sensitivity_0_0", 0.0); Number sensitivity_QoI_0_1_computed = sensitivities[0][1]; Number sensitivity_QoI_0_1_exact = infile_l_shaped("sensitivity_0_1", 0.0); - + std::cout << "Adaptive step " << a_step << ", we have " << mesh.n_active_elem() << " active elements and " << equation_systems.n_active_dofs() - << " active dofs." << std::endl ; + << " active dofs." << std::endl ; std::cout<<"Sensitivity of QoI one to Parameter one is "< &dual_solution_0 = system.get_adjoint_solution(0); - - primal_solution.swap(dual_solution_0); + + primal_solution.swap(dual_solution_0); write_output(equation_systems, a_step, "adjoint_0"); - primal_solution.swap(dual_solution_0); + primal_solution.swap(dual_solution_0); } } - std::cerr << '[' << libMesh::processor_id() - << "] Completing output." << std::endl; - + std::cerr << '[' << libMesh::processor_id() + << "] Completing output." << std::endl; + #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. + + // All done. return 0; } diff --git a/examples/adjoints/adjoints_ex2/femparameters.C b/examples/adjoints/adjoints_ex2/femparameters.C index 2ca94bae5bb..abe7133074b 100644 --- a/examples/adjoints/adjoints_ex2/femparameters.C +++ b/examples/adjoints/adjoints_ex2/femparameters.C @@ -14,9 +14,9 @@ void FEMParameters::read(GetPot &input) { std::vector variable_names; - - - GETPOT_INT_INPUT(coarserefinements); + + + GETPOT_INT_INPUT(coarserefinements); GETPOT_INPUT(domainfile); GETPOT_INPUT(solver_quiet); @@ -34,7 +34,7 @@ void FEMParameters::read(GetPot &input) GETPOT_INPUT(refine_fraction); GETPOT_INPUT(coarsen_fraction); GETPOT_INPUT(coarsen_threshold); - GETPOT_INT_INPUT(max_adaptivesteps); + GETPOT_INT_INPUT(max_adaptivesteps); GETPOT_INPUT(refine_uniformly); GETPOT_INPUT(indicator_type); diff --git a/examples/adjoints/adjoints_ex2/femparameters.h b/examples/adjoints/adjoints_ex2/femparameters.h index 6e330d71fd6..9ba7a311048 100644 --- a/examples/adjoints/adjoints_ex2/femparameters.h +++ b/examples/adjoints/adjoints_ex2/femparameters.h @@ -13,9 +13,9 @@ using namespace libMesh; class FEMParameters { public: - FEMParameters() : + FEMParameters() : domainfile("lshaped.xda"), - coarserefinements(0), + coarserefinements(0), solver_quiet(true), require_residual_reduction(true), min_step_length(1e-5), @@ -26,21 +26,21 @@ class FEMParameters nelem_target(30000), global_tolerance(0.0), refine_fraction(0.3), coarsen_fraction(0.3), coarsen_threshold(10), refine_uniformly(false), - max_adaptivesteps(1), + max_adaptivesteps(1), indicator_type("kelly"), - fe_family(1, "LAGRANGE"), fe_order(1, 1), + fe_family(1, "LAGRANGE"), fe_order(1, 1), analytic_jacobians(true), verify_analytic_jacobians(0.0), print_solution_norms(false), print_solutions(false), print_residual_norms(false), print_residuals(false), print_jacobian_norms(false), print_jacobians(false) {} void read(GetPot &input); - - unsigned int dimension; - Real elementorder; + + unsigned int dimension; + Real elementorder; std::string domainfile; unsigned int coarserefinements; - + bool solver_quiet, require_residual_reduction; Real min_step_length; unsigned int max_linear_iterations, max_nonlinear_iterations; @@ -53,8 +53,8 @@ class FEMParameters Real refine_fraction, coarsen_fraction, coarsen_threshold; bool refine_uniformly; unsigned int max_adaptivesteps; - - std::string indicator_type; + + std::string indicator_type; std::vector fe_family; std::vector fe_order; diff --git a/examples/adjoints/adjoints_ex3/H-qoi.C b/examples/adjoints/adjoints_ex3/H-qoi.C index 2e246af8fa5..30157a18a2b 100644 --- a/examples/adjoints/adjoints_ex3/H-qoi.C +++ b/examples/adjoints/adjoints_ex3/H-qoi.C @@ -1,7 +1,7 @@ #include "H-qoi.h" -// Here we define the functions to compute the QoI (side_qoi) -// and supply the right hand side for the associated adjoint problem (side_qoi_derivative) +// Here we define the functions to compute the QoI (side_qoi) +// and supply the right hand side for the associated adjoint problem (side_qoi_derivative) using namespace libMesh; @@ -19,7 +19,7 @@ void CoupledSystemQoI::side_qoi_derivative (DiffContext &context, const QoISet & /* qois */) { FEMContext &c = libmesh_cast_ref(context); - + // Element Jacobian * quadrature weights for interior integration const std::vector &JxW = c.side_fe_var[0]->get_JxW(); @@ -27,21 +27,21 @@ void CoupledSystemQoI::side_qoi_derivative (DiffContext &context, const std::vector > &phi = c.side_fe_var[0]->get_phi(); const std::vector &q_point = c.side_fe_var[0]->get_xyz(); - - // The number of local degrees of freedom in each variable - const unsigned int n_u_dofs = c.dof_indices_var[1].size(); - + + // The number of local degrees of freedom in each variable + const unsigned int n_u_dofs = c.dof_indices_var[1].size(); + DenseSubVector &Qu = *c.elem_qoi_subderivatives[0][0]; DenseSubVector &QC = *c.elem_qoi_subderivatives[0][3]; - + // Now we will build the element Jacobian and residual. // Constructing the residual requires the solution and its // gradient from the previous timestep. This must be // calculated at each quadrature point by summing the // solution degree-of-freedom values by the appropriate // weight functions. - unsigned int n_qpoints = c.side_qrule->n_points(); - + unsigned int n_qpoints = c.side_qrule->n_points(); + Number u = 0. ; Number C = 0. ; @@ -50,16 +50,16 @@ void CoupledSystemQoI::side_qoi_derivative (DiffContext &context, { // Loop over all the qps on this side for (unsigned int qp=0; qp != n_qpoints; qp++) - { + { Real x = q_point[qp](0); // If side is on left outlet if(x < 0.) { - // Get u at the qp + // Get u at the qp u = c.side_value(0,qp); C = c.side_value(3,qp); - + // Add the contribution from each basis function for (unsigned int i=0; i != n_u_dofs; i++) { @@ -67,7 +67,7 @@ void CoupledSystemQoI::side_qoi_derivative (DiffContext &context, QC(i) += JxW[qp] * phi[i][qp] * -u; } } // end if - + } // end quadrature loop } // end if on outlet @@ -76,9 +76,9 @@ void CoupledSystemQoI::side_qoi_derivative (DiffContext &context, // This function computes the actual QoI void CoupledSystemQoI::side_qoi(DiffContext &context, const QoISet & /* qois */) { - + FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -90,33 +90,33 @@ void CoupledSystemQoI::side_qoi(DiffContext &context, const QoISet & /* qois */) // Loop over qp's, compute the function at each qp and add // to get the QoI - unsigned int n_qpoints = c.side_qrule->n_points(); - + unsigned int n_qpoints = c.side_qrule->n_points(); + Number dQoI_0 = 0. ; Number u = 0. ; Number C = 0. ; - + // If side is on the left outlet - if(c.has_side_boundary_id(2)) - { - //Loop over all the qps on this side - for (unsigned int qp=0; qp != n_qpoints; qp++) - { + if(c.has_side_boundary_id(2)) + { + //Loop over all the qps on this side + for (unsigned int qp=0; qp != n_qpoints; qp++) + { Real x = q_point[qp](0); if(x < 0.) { - // Get u and C at the qp + // Get u and C at the qp u = c.side_value(0,qp); C = c.side_value(3,qp); - + dQoI_0 += JxW[qp] * -u * C; } // end if - + } // end quadrature loop } // end if on bdry - + c.elem_qoi[0] += dQoI_0; - + } diff --git a/examples/adjoints/adjoints_ex3/H-qoi.h b/examples/adjoints/adjoints_ex3/H-qoi.h index 0386f04a0c7..484829aa220 100644 --- a/examples/adjoints/adjoints_ex3/H-qoi.h +++ b/examples/adjoints/adjoints_ex3/H-qoi.h @@ -16,17 +16,17 @@ class CoupledSystemQoI : public DifferentiableQoI { public: CoupledSystemQoI(){} - virtual ~CoupledSystemQoI(){} + virtual ~CoupledSystemQoI(){} virtual void init_qoi( std::vector& sys_qoi); - virtual void postprocess( ){} - - virtual void side_qoi_derivative(DiffContext &context, const QoISet & qois); + virtual void postprocess( ){} + + virtual void side_qoi_derivative(DiffContext &context, const QoISet & qois); virtual void side_qoi(DiffContext &context, const QoISet & qois); virtual AutoPtr clone( ) - { AutoPtr my_clone( new CoupledSystemQoI ); + { AutoPtr my_clone( new CoupledSystemQoI ); *my_clone = *this; return my_clone; } diff --git a/examples/adjoints/adjoints_ex3/Makefile.am b/examples/adjoints/adjoints_ex3/Makefile.am index f5de2b0f59a..2f53545c201 100644 --- a/examples/adjoints/adjoints_ex3/Makefile.am +++ b/examples/adjoints/adjoints_ex3/Makefile.am @@ -4,7 +4,7 @@ install_dir = $(examples_install_path)/adjoints/ex3 data = H-qoi.C H-qoi.h H_channel_quads.xda adjoints_ex3.C coupled_system.C coupled_system.h coupled_system.in domain.C domain.h femparameters.C femparameters.h general.in initial.C initial.h mysystems.h output.C output.h run.sh sources = $(data) run.sh -CLEANFILES = primal.out.gmv.000.05 primal.out.gmv.000.04 primal.out.gmv.000.03 primal.out.gmv.000.02 primal.out.gmv.000.01 primal.out.gmv.000.00 out_timesteps.m out_time.m out_solvesteps.m out_clocktime.m out_activemesh.m error.gmv.004.00_with_pressure error.gmv.004.00_total error.gmv.004.00_non_pressure error.gmv.004.00_convection_diffusion_y error.gmv.004.00_convection_diffusion_x error.gmv.003.00_with_pressure error.gmv.003.00_total error.gmv.003.00_non_pressure error.gmv.003.00_convection_diffusion_y error.gmv.003.00_convection_diffusion_x error.gmv.002.00_with_pressure error.gmv.002.00_total error.gmv.002.00_non_pressure error.gmv.002.00_convection_diffusion_y error.gmv.002.00_convection_diffusion_x error.gmv.001.00_with_pressure error.gmv.001.00_total error.gmv.001.00_non_pressure error.gmv.001.00_convection_diffusion_y error.gmv.001.00_convection_diffusion_x error.gmv.000.00_with_pressure error.gmv.000.00_total error.gmv.000.00_non_pressure error.gmv.000.00_convection_diffusion_y error.gmv.000.00_convection_diffusion_x complete adjoint.out.gmv.000.04 adjoint.out.gmv.000.03 adjoint.out.gmv.000.02 adjoint.out.gmv.000.01 adjoint.out.gmv.000.00 +CLEANFILES = primal.out.gmv.000.05 primal.out.gmv.000.04 primal.out.gmv.000.03 primal.out.gmv.000.02 primal.out.gmv.000.01 primal.out.gmv.000.00 out_timesteps.m out_time.m out_solvesteps.m out_clocktime.m out_activemesh.m error.gmv.004.00_with_pressure error.gmv.004.00_total error.gmv.004.00_non_pressure error.gmv.004.00_convection_diffusion_y error.gmv.004.00_convection_diffusion_x error.gmv.003.00_with_pressure error.gmv.003.00_total error.gmv.003.00_non_pressure error.gmv.003.00_convection_diffusion_y error.gmv.003.00_convection_diffusion_x error.gmv.002.00_with_pressure error.gmv.002.00_total error.gmv.002.00_non_pressure error.gmv.002.00_convection_diffusion_y error.gmv.002.00_convection_diffusion_x error.gmv.001.00_with_pressure error.gmv.001.00_total error.gmv.001.00_non_pressure error.gmv.001.00_convection_diffusion_y error.gmv.001.00_convection_diffusion_x error.gmv.000.00_with_pressure error.gmv.000.00_total error.gmv.000.00_non_pressure error.gmv.000.00_convection_diffusion_y error.gmv.000.00_convection_diffusion_x complete adjoint.out.gmv.000.04 adjoint.out.gmv.000.03 adjoint.out.gmv.000.02 adjoint.out.gmv.000.01 adjoint.out.gmv.000.00 # also need links for VPATH builds if LIBMESH_VPATH_BUILD diff --git a/examples/adjoints/adjoints_ex3/adjoints_ex3.C b/examples/adjoints/adjoints_ex3/adjoints_ex3.C index 61e82439722..eaa0a1d41b1 100644 --- a/examples/adjoints/adjoints_ex3/adjoints_ex3.C +++ b/examples/adjoints/adjoints_ex3/adjoints_ex3.C @@ -48,15 +48,15 @@ #include "output.h" #include "H-qoi.h" -// We solve a coupled Stokes + Convection Diffusion system in an H channel geometry -// with 2 inlets and 2 outlets. The QoI is the species +// We solve a coupled Stokes + Convection Diffusion system in an H channel geometry +// with 2 inlets and 2 outlets. The QoI is the species // flux from left outlet // Channel Geometry: // Wall // ---------------------------------------------------------------- // 0 1 -// ---------------------------- ------------------------------- +// ---------------------------- ------------------------------- // | | // Wall | | Wall // | | @@ -67,23 +67,23 @@ // The equations governing this flow are: // Stokes: -VectorLaplacian(velocity) + grad(pressure) = vector(0) -// Convection-Diffusion: - dot(velocity, grad(concentration) ) + Laplacian(concentration) = 0 +// Convection-Diffusion: - dot(velocity, grad(concentration) ) + Laplacian(concentration) = 0 // The boundary conditions are: -// u_1(0) = -(y-2)*(y-3), u_2(0) = 0 ; u_1(1) = (y-2)*(y-3), u_2(1) = 0 ; +// u_1(0) = -(y-2)*(y-3), u_2(0) = 0 ; u_1(1) = (y-2)*(y-3), u_2(1) = 0 ; // u_1(walls) = 0, u_2(walls) = 0; // C(0) = 1 ; C(1) = 0; // grad(C) dot n (walls) = 0 ; -// grad(C) dot n (2) = 0 ; grad(C) dot n (3) = 0 +// grad(C) dot n (2) = 0 ; grad(C) dot n (3) = 0 // The QoI is: // Q((u,v), C) = integral_{left_outlet} - u * C ds -// The complete equal order adjoint QoI error estimate is: (Notation for derivatives: grad(C) = C,1 + C,2) -// Q(u) - Q(u_h) \leq -// |e(u_1)|_{H1} |e(u_1^*)|_{H1} + |e(u_2)|_{H1} |e(u_2^*)|_{H1} + (1/Pe) * |e(C)|_{H1} |e(C^*)|_{H1} + +// The complete equal order adjoint QoI error estimate is: (Notation for derivatives: grad(C) = C,1 + C,2) +// Q(u) - Q(u_h) \leq +// |e(u_1)|_{H1} |e(u_1^*)|_{H1} + |e(u_2)|_{H1} |e(u_2^*)|_{H1} + (1/Pe) * |e(C)|_{H1} |e(C^*)|_{H1} + // ||e(u_1,1)||_{L2} ||e(p^*)||_{L2} + ||e(u_2,2)||_{L2} ||e(p^*)||_{L2} + ||e(u_1,1^*)||_{L2} ||e(p)||_{L2} + ||e(u_2,2^*)||_{L2} ||e(p)||_{L2} + -// ||e((u_1)_h C,1)||_{L2} ||e(C^*)||_{L2} + ||e(u1 C,1_h)||_{L2} ||e(C^*)||_{L2} +// ||e((u_1)_h C,1)||_{L2} ||e(C^*)||_{L2} + ||e(u1 C,1_h)||_{L2} ||e(C^*)||_{L2} // ||e((u_2)_h C,2)||_{L2} ||e(C^*)||_{L2} + ||e(u2 C,2_h)||_{L2} ||e(C^*)||_{L2} // = error_non_pressure + error_with_pressure + error_convection_diffusion_x + error_convection_diffusion_y @@ -125,7 +125,7 @@ std::string numbered_filename(unsigned int t_step, // The timestep count // Write tecplot, gmv and xda/xdr output -void write_output(EquationSystems &es, +void write_output(EquationSystems &es, unsigned int t_step, // The timestep count unsigned int a_step, // The adaptive step count std::string solution_type, // primal or adjoint solve @@ -355,7 +355,7 @@ void write_error(EquationSystems &, void read_output(EquationSystems &es, unsigned int t_step, unsigned int a_step, - std::string solution_type, + std::string solution_type, FEMParameters ¶m) { MeshBase &mesh = es.get_mesh(); @@ -542,7 +542,7 @@ void set_system_parameters(FEMSystem &system, FEMParameters ¶m) // And the linear solver options solver->max_linear_iterations = param.max_linear_iterations; solver->initial_linear_tolerance = param.initial_linear_tolerance; - solver->minimum_linear_tolerance = param.minimum_linear_tolerance; + solver->minimum_linear_tolerance = param.minimum_linear_tolerance; } } @@ -554,9 +554,9 @@ AutoPtr build_mesh_refinement(MeshBase &mesh, AutoPtr mesh_refinement(new MeshRefinement(mesh)); mesh_refinement->coarsen_by_parents() = true; mesh_refinement->absolute_global_tolerance() = param.global_tolerance; - mesh_refinement->nelem_target() = param.nelem_target; + mesh_refinement->nelem_target() = param.nelem_target; mesh_refinement->refine_fraction() = param.refine_fraction; - mesh_refinement->coarsen_fraction() = param.coarsen_fraction; + mesh_refinement->coarsen_fraction() = param.coarsen_fraction; mesh_refinement->coarsen_threshold() = param.coarsen_threshold; return mesh_refinement; @@ -565,7 +565,7 @@ AutoPtr build_mesh_refinement(MeshBase &mesh, #endif // LIBMESH_ENABLE_AMR // This function builds the Kelly error indicator. This indicator can be used -// for comparisons of adjoint and non-adjoint based error indicators +// for comparisons of adjoint and non-adjoint based error indicators AutoPtr build_error_estimator(FEMParameters& /* param */) { AutoPtr error_estimator; @@ -576,21 +576,21 @@ AutoPtr build_error_estimator(FEMParameters& /* param */) } // Functions to build the adjoint based error indicators -// The error_non_pressure and error_pressure constributions are estimated using +// The error_non_pressure and error_pressure constributions are estimated using // the build_error_estimator_component_wise function below AutoPtr build_error_estimator_component_wise - (FEMParameters ¶m, + (FEMParameters ¶m, std::vector > &term_weights, std::vector &primal_error_norm_type, std::vector &dual_error_norm_type) -{ +{ AutoPtr error_estimator; AdjointResidualErrorEstimator *adjoint_residual_estimator = new AdjointResidualErrorEstimator; error_estimator.reset (adjoint_residual_estimator); - + // Both the primal and dual weights are going to be estimated using the patch recovery error estimator PatchRecoveryErrorEstimator *p1 = new PatchRecoveryErrorEstimator; @@ -598,21 +598,21 @@ build_error_estimator_component_wise PatchRecoveryErrorEstimator *p2 = new PatchRecoveryErrorEstimator; - adjoint_residual_estimator->dual_error_estimator().reset(p2); + adjoint_residual_estimator->dual_error_estimator().reset(p2); // Set the boolean for specifying whether we are reusing patches while building the patch recovery estimates p1->set_patch_reuse(param.patch_reuse); p2->set_patch_reuse(param.patch_reuse); - // Using the user filled error norm type vector, we pass the type of norm to be used for + // Using the user filled error norm type vector, we pass the type of norm to be used for // the error in each variable, we can have different types of norms for the primal and // dual variables unsigned int size = primal_error_norm_type.size(); - + libmesh_assert_equal_to (size, dual_error_norm_type.size()); for (unsigned int i = 0; i != size; ++i) { - adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(i, primal_error_norm_type[i]); + adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(i, primal_error_norm_type[i]); adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(i, dual_error_norm_type[i]); } @@ -631,7 +631,7 @@ build_error_estimator_component_wise return error_estimator; } -// The error_convection_diffusion_x and error_convection_diffusion_y are the nonlinear contributions which +// The error_convection_diffusion_x and error_convection_diffusion_y are the nonlinear contributions which // are computed using the build_weighted_error_estimator_component_wise below AutoPtr build_weighted_error_estimator_component_wise @@ -640,14 +640,14 @@ build_weighted_error_estimator_component_wise std::vector &primal_error_norm_type, std::vector &dual_error_norm_type, std::vector*> coupled_system_weight_functions) -{ +{ AutoPtr error_estimator; AdjointResidualErrorEstimator *adjoint_residual_estimator = new AdjointResidualErrorEstimator; error_estimator.reset (adjoint_residual_estimator); - - // Using the user filled error norm type vector, we pass the type of norm to be used for + + // Using the user filled error norm type vector, we pass the type of norm to be used for // the error in each variable, we can have different types of norms for the primal and // dual variables @@ -657,7 +657,7 @@ build_weighted_error_estimator_component_wise PatchRecoveryErrorEstimator *p2 = new PatchRecoveryErrorEstimator; - adjoint_residual_estimator->dual_error_estimator().reset(p2); + adjoint_residual_estimator->dual_error_estimator().reset(p2); p1->set_patch_reuse(param.patch_reuse); p2->set_patch_reuse(param.patch_reuse); @@ -675,7 +675,7 @@ build_weighted_error_estimator_component_wise for (unsigned int i = 0; i != size; ++i) { p1->weight_functions.push_back(coupled_system_weight_functions[i]); - adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(i, primal_error_norm_type[i]); + adjoint_residual_estimator->primal_error_estimator()->error_norm.set_type(i, primal_error_norm_type[i]); adjoint_residual_estimator->dual_error_estimator()->error_norm.set_type(i, dual_error_norm_type[i]); } @@ -712,9 +712,9 @@ int main (int argc, char** argv) std::ifstream i("general.in"); if (!i) { - std::cerr << '[' << libMesh::processor_id() - << "] Can't find general.in; exiting early." - << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Can't find general.in; exiting early." + << std::endl; libmesh_error(); } } @@ -727,7 +727,7 @@ int main (int argc, char** argv) // Skip higher-dimensional examples on a lower-dimensional libMesh build libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Create a mesh. Mesh mesh (param.dimension); @@ -767,7 +767,7 @@ int main (int argc, char** argv) std::cout<<"Starting adaptive loop"<reuse_preconditioner(false); @@ -809,7 +809,7 @@ int main (int argc, char** argv) // We just call a postprocess here to set the variable computed_QoI to the value computed by assemble_qoi system.postprocess(); - // Get the value of the computed_QoI variable of the CoupledSystem class + // Get the value of the computed_QoI variable of the CoupledSystem class Number QoI_0_computed = (dynamic_cast(system)).get_QoI_value(); std::cout<< "The boundary QoI is " << std::setprecision(17) << QoI_0_computed << std::endl << std::endl; @@ -825,7 +825,7 @@ int main (int argc, char** argv) // We are about to solve the adjoint system, but before we // do this we see the same preconditioner flag to reuse the - // preconditioner from the forward solver + // preconditioner from the forward solver linear_solver->reuse_preconditioner(param.reuse_preconditioner); // Solve the adjoint system @@ -835,7 +835,7 @@ int main (int argc, char** argv) // Now that we have solved the adjoint, set the adjoint_already_solved boolean to true, so we dont solve unneccesarily in the error estimator system.set_adjoint_already_solved(true); - // To plot the adjoint solution, we swap it with the primal solution + // To plot the adjoint solution, we swap it with the primal solution // and use the write_output function NumericVector &dual_solution = system.get_adjoint_solution(); primal_solution.swap(dual_solution); @@ -854,22 +854,22 @@ int main (int argc, char** argv) // error_estimator_convection_diffusion_x + // error_estimator_convection_diffusion_y ErrorVector error; - - // We first construct the non-pressure contributions + + // We first construct the non-pressure contributions ErrorVector error_non_pressure; // First we build the norm_type_vector_non_pressure vectors and // weights_matrix_non_pressure matrix for the non-pressure term // error contributions std::vector - primal_norm_type_vector_non_pressure; + primal_norm_type_vector_non_pressure; primal_norm_type_vector_non_pressure.push_back(H1_SEMINORM); primal_norm_type_vector_non_pressure.push_back(H1_SEMINORM); primal_norm_type_vector_non_pressure.push_back(L2); primal_norm_type_vector_non_pressure.push_back(H1_SEMINORM); std::vector - dual_norm_type_vector_non_pressure; + dual_norm_type_vector_non_pressure; dual_norm_type_vector_non_pressure.push_back(H1_SEMINORM); dual_norm_type_vector_non_pressure.push_back(H1_SEMINORM); dual_norm_type_vector_non_pressure.push_back(L2); @@ -884,7 +884,7 @@ int main (int argc, char** argv) // We build the error estimator to estimate the contributions // to the QoI error from the non pressure term - AutoPtr error_estimator_non_pressure = + AutoPtr error_estimator_non_pressure = build_error_estimator_component_wise (param, weights_matrix_non_pressure, primal_norm_type_vector_non_pressure, @@ -904,14 +904,14 @@ int main (int argc, char** argv) // weights_matrix_with_pressure matrix for the pressure term // error contributions std::vector - primal_norm_type_vector_with_pressure; + primal_norm_type_vector_with_pressure; primal_norm_type_vector_with_pressure.push_back(H1_X_SEMINORM); primal_norm_type_vector_with_pressure.push_back(H1_Y_SEMINORM); primal_norm_type_vector_with_pressure.push_back(L2); primal_norm_type_vector_with_pressure.push_back(L2); std::vector - dual_norm_type_vector_with_pressure; + dual_norm_type_vector_with_pressure; dual_norm_type_vector_with_pressure.push_back(H1_X_SEMINORM); dual_norm_type_vector_with_pressure.push_back(H1_Y_SEMINORM); dual_norm_type_vector_with_pressure.push_back(L2); @@ -936,57 +936,57 @@ int main (int argc, char** argv) primal_norm_type_vector_with_pressure, dual_norm_type_vector_with_pressure); - // Estimate the contributions to the QoI error from the pressure terms + // Estimate the contributions to the QoI error from the pressure terms error_estimator_with_pressure->estimate_error(system, error_with_pressure); // Plot the error due to the pressure terms write_error(equation_systems, error_with_pressure, 0, a_step, param, "_with_pressure"); // Now for the convection diffusion term errors (in the x and y directions) - + ErrorVector error_convection_diffusion_x; // The norm type vectors and weights matrix for the convection_diffusion_x errors std::vector - primal_norm_type_vector_convection_diffusion_x; + primal_norm_type_vector_convection_diffusion_x; primal_norm_type_vector_convection_diffusion_x.push_back(L2); primal_norm_type_vector_convection_diffusion_x.push_back(L2); primal_norm_type_vector_convection_diffusion_x.push_back(L2); primal_norm_type_vector_convection_diffusion_x.push_back(H1_X_SEMINORM); std::vector - dual_norm_type_vector_convection_diffusion_x; + dual_norm_type_vector_convection_diffusion_x; dual_norm_type_vector_convection_diffusion_x.push_back(L2); dual_norm_type_vector_convection_diffusion_x.push_back(L2); dual_norm_type_vector_convection_diffusion_x.push_back(L2); // Note that we need the error of the dual concentration in L2 dual_norm_type_vector_convection_diffusion_x.push_back(L2); - + std::vector > weights_matrix_convection_diffusion_x (system.n_vars(), std::vector(system.n_vars(), 0.0)); - weights_matrix_convection_diffusion_x[0][3] = 1.; - weights_matrix_convection_diffusion_x[3][3] = 1.; + weights_matrix_convection_diffusion_x[0][3] = 1.; + weights_matrix_convection_diffusion_x[3][3] = 1.; // We will also have to build and pass the weight functions to the weighted patch recovery estimators - + // We pass the identity function as weights to error entries that the above matrix will scale to 0. ConstFEMFunction identity(1); - // Declare object of class CoupledFEMFunctionsx, the definition of the function contains the weight + // Declare object of class CoupledFEMFunctionsx, the definition of the function contains the weight // to be applied to the relevant terms // For ||e(u1 C,1_h)||_{L2} ||e(C^*)||_{L2} term, returns C,1_h - CoupledFEMFunctionsx convdiffx0(system, 0); + CoupledFEMFunctionsx convdiffx0(system, 0); // For ||e((u_1)_h C,1)||_{L2} ||e(C^*)||_{L2} term, returns (u_1)_h - CoupledFEMFunctionsx convdiffx3(system, 3); + CoupledFEMFunctionsx convdiffx3(system, 3); // Make a vector of pointers to these objects std::vector *> coupled_system_weight_functions_x; coupled_system_weight_functions_x.push_back(&convdiffx0); coupled_system_weight_functions_x.push_back(&identity); - coupled_system_weight_functions_x.push_back(&identity); - coupled_system_weight_functions_x.push_back(&convdiffx3); + coupled_system_weight_functions_x.push_back(&identity); + coupled_system_weight_functions_x.push_back(&convdiffx3); // Build the error estimator to estimate the contributions // to the QoI error from the convection diffusion x term @@ -998,51 +998,51 @@ int main (int argc, char** argv) coupled_system_weight_functions_x); // Estimate the contributions to the QoI error from the - // convection diffusion x term + // convection diffusion x term error_estimator_convection_diffusion_x->estimate_error (system, error_convection_diffusion_x); // Plot this error write_error(equation_systems, error_convection_diffusion_x, 0, a_step, param, "_convection_diffusion_x"); - + // Now for the y direction terms ErrorVector error_convection_diffusion_y; // The norm type vectors and weights matrix for the convection_diffusion_x errors std::vector - primal_norm_type_vector_convection_diffusion_y; + primal_norm_type_vector_convection_diffusion_y; primal_norm_type_vector_convection_diffusion_y.push_back(L2); primal_norm_type_vector_convection_diffusion_y.push_back(L2); primal_norm_type_vector_convection_diffusion_y.push_back(L2); primal_norm_type_vector_convection_diffusion_y.push_back(H1_Y_SEMINORM); std::vector - dual_norm_type_vector_convection_diffusion_y; + dual_norm_type_vector_convection_diffusion_y; dual_norm_type_vector_convection_diffusion_y.push_back(L2); dual_norm_type_vector_convection_diffusion_y.push_back(L2); dual_norm_type_vector_convection_diffusion_y.push_back(L2); // Note that we need the error of the dual concentration in L2 dual_norm_type_vector_convection_diffusion_y.push_back(L2); - + std::vector > weights_matrix_convection_diffusion_y (system.n_vars(), std::vector(system.n_vars(), 0.0)); - weights_matrix_convection_diffusion_y[1][3] = 1.; - weights_matrix_convection_diffusion_y[3][3] = 1.; - - // For ||e(u2 C,2_h)||_{L2} ||e(C^*)||_{L2} term, returns C,2_h - CoupledFEMFunctionsy convdiffy1(system, 1); + weights_matrix_convection_diffusion_y[1][3] = 1.; + weights_matrix_convection_diffusion_y[3][3] = 1.; + + // For ||e(u2 C,2_h)||_{L2} ||e(C^*)||_{L2} term, returns C,2_h + CoupledFEMFunctionsy convdiffy1(system, 1); // For ||e((u_2)_h C,2)||_{L2} ||e(C^*)||_{L2} term, returns (u_2)_h - CoupledFEMFunctionsy convdiffy3(system, 3); + CoupledFEMFunctionsy convdiffy3(system, 3); // Make a vector of pointers to these objects std::vector *> coupled_system_weight_functions_y; coupled_system_weight_functions_y.push_back(&identity); coupled_system_weight_functions_y.push_back(&convdiffy1); coupled_system_weight_functions_y.push_back(&identity); - coupled_system_weight_functions_y.push_back(&convdiffy3); - + coupled_system_weight_functions_y.push_back(&convdiffy3); + // Build the error estimator to estimate the contributions // to the QoI error from the convection diffsion y term AutoPtr error_estimator_convection_diffusion_y = @@ -1053,12 +1053,12 @@ int main (int argc, char** argv) coupled_system_weight_functions_y); // Estimate the contributions to the QoI error from the - // convection diffusion y terms + // convection diffusion y terms error_estimator_convection_diffusion_y->estimate_error(system, error_convection_diffusion_y); // Plot this error write_error(equation_systems, error_convection_diffusion_y, 0, a_step, param, "_convection_diffusion_y"); - + if(param.indicator_type == "adjoint_residual") { error.resize(error_non_pressure.size()); @@ -1066,7 +1066,7 @@ int main (int argc, char** argv) // Now combine the contribs from the pressure and non // pressure terms to get the complete estimate for(unsigned int i = 0; i < error.size(); i++) - { + { error[i] = error_non_pressure[i] + error_with_pressure[i] + error_convection_diffusion_x[i] + error_convection_diffusion_y[i]; } } @@ -1094,14 +1094,14 @@ int main (int argc, char** argv) mesh_refinement->uniformly_refine(1); } else if(param.global_tolerance >= 0. && param.nelem_target == 0.) // Refine based on reaching an error tolerance - { - mesh_refinement->flag_elements_by_error_tolerance (error); + { + mesh_refinement->flag_elements_by_error_tolerance (error); // Carry out the adaptive mesh refinement/coarsening mesh_refinement->refine_and_coarsen_elements(); } else // Refine based on reaching a target number of elements - { + { //If we have reached the desired number of elements, we //dont do any more adaptive steps if (mesh.n_active_elem() >= param.nelem_target) @@ -1126,9 +1126,8 @@ int main (int argc, char** argv) write_output_footers(param); #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. - return 0; -} + // All done. + return 0; +} diff --git a/examples/adjoints/adjoints_ex3/coupled_system.C b/examples/adjoints/adjoints_ex3/coupled_system.C index a76075ebe8e..dd33588c346 100644 --- a/examples/adjoints/adjoints_ex3/coupled_system.C +++ b/examples/adjoints/adjoints_ex3/coupled_system.C @@ -54,7 +54,7 @@ public: const Real y=p(1); // Set the parabolic inflow boundary conditions at stations 0 & 1 output(_u_var) = (_sign)*((y-2) * (y-3)); - output(_v_var) = 0; + output(_v_var) = 0; } virtual AutoPtr > clone() const @@ -67,10 +67,10 @@ private: void CoupledSystem::init_data () -{ +{ // Check the input file for Reynolds number, application type, // approximation type - GetPot infile("coupled_system.in"); + GetPot infile("coupled_system.in"); Peclet = infile("Peclet", 1.); unsigned int pressure_p = infile("pressure_p", 1); std::string fe_family = infile("fe_family", std::string("LAGRANGE")); @@ -88,7 +88,7 @@ void CoupledSystem::init_data () fefamily); v_var = this->add_variable ("v", static_cast(pressure_p+1), fefamily); - + // Add the pressure variable "p". This will // be approximated with a first-order basis, // providing an LBB-stable pressure-velocity pair. @@ -100,7 +100,7 @@ void CoupledSystem::init_data () C_var = this->add_variable ("C", static_cast(pressure_p+1), fefamily); - // Tell the system to march velocity forward in time, but + // Tell the system to march velocity forward in time, but // leave p as a constraint only this->time_evolving(u_var); this->time_evolving(v_var); @@ -127,13 +127,13 @@ void CoupledSystem::init_data () const boundary_id_type wall_id = 3; std::set wall_bdy; wall_bdy.insert(wall_id); - + // The uv identifier for the setting the inlet and wall velocity boundary conditions std::vector uv(1, u_var); uv.push_back(v_var); // The C_only identifier for setting the concentrations at the inlets std::vector C_only(1, C_var); - + // The zero and constant functions ZeroFunction zero; ConstFunction one(1); @@ -154,7 +154,7 @@ void CoupledSystem::init_data () (DirichletBoundary (left_inlet_bdy, uv, &inflow_left)); this->get_dof_map().add_dirichlet_boundary (DirichletBoundary (left_inlet_bdy, C_only, &one)); - + // On the inlet (right), we apply parabolic inflow boundary conditions for the velocity, u = (y-2)*(y-3), v=0 // and set C = 0 this->get_dof_map().add_dirichlet_boundary @@ -162,10 +162,10 @@ void CoupledSystem::init_data () this->get_dof_map().add_dirichlet_boundary (DirichletBoundary (right_inlet_bdy, C_only, &zero)); - // Note that the remaining boundary conditions are the natural boundary conditions for the concentration - // on the wall (grad(c) dot n = 0) and natural boundary conditions for the velocity and the concentration + // Note that the remaining boundary conditions are the natural boundary conditions for the concentration + // on the wall (grad(c) dot n = 0) and natural boundary conditions for the velocity and the concentration // on the outlets ((grad(velocity) dot n - p n) dot t = 0, grad(C) dot n = 0) - + // Do the parent's initialization after variables and boundary constraints are defined FEMSystem::init_data(); } @@ -182,7 +182,7 @@ void CoupledSystem::init_context(DiffContext &context) c.element_fe_var[u_var]->get_phi(); c.element_fe_var[u_var]->get_dphi(); c.element_fe_var[u_var]->get_xyz(); - + c.element_fe_var[p_var]->get_phi(); c.side_fe_var[u_var]->get_JxW(); @@ -200,11 +200,11 @@ bool CoupledSystem::element_time_derivative (bool request_jacobian, // will be used to assemble the linear system. // Element Jacobian * quadrature weights for interior integration - const std::vector &JxW = + const std::vector &JxW = c.element_fe_var[u_var]->get_JxW(); // The velocity shape functions at interior quadrature points. - const std::vector >& phi = + const std::vector >& phi = c.element_fe_var[u_var]->get_phi(); // The velocity shape function gradients at interior @@ -216,26 +216,26 @@ bool CoupledSystem::element_time_derivative (bool request_jacobian, // quadrature points. const std::vector >& psi = c.element_fe_var[p_var]->get_phi(); - + // The number of local degrees of freedom in each variable const unsigned int n_p_dofs = c.dof_indices_var[p_var].size(); - const unsigned int n_u_dofs = c.dof_indices_var[u_var].size(); - libmesh_assert_equal_to (n_u_dofs, c.dof_indices_var[v_var].size()); + const unsigned int n_u_dofs = c.dof_indices_var[u_var].size(); + libmesh_assert_equal_to (n_u_dofs, c.dof_indices_var[v_var].size()); // The subvectors and submatrices we need to fill: DenseSubMatrix &Kuu = *c.elem_subjacobians[u_var][u_var]; DenseSubMatrix &Kup = *c.elem_subjacobians[u_var][p_var]; DenseSubVector &Fu = *c.elem_subresiduals[u_var]; - - DenseSubMatrix &Kvv = *c.elem_subjacobians[v_var][v_var]; - DenseSubMatrix &Kvp = *c.elem_subjacobians[v_var][p_var]; - DenseSubVector &Fv = *c.elem_subresiduals[v_var]; + + DenseSubMatrix &Kvv = *c.elem_subjacobians[v_var][v_var]; + DenseSubMatrix &Kvp = *c.elem_subjacobians[v_var][p_var]; + DenseSubVector &Fv = *c.elem_subresiduals[v_var]; DenseSubMatrix &KCu = *c.elem_subjacobians[C_var][u_var]; - DenseSubMatrix &KCv = *c.elem_subjacobians[C_var][v_var]; + DenseSubMatrix &KCv = *c.elem_subjacobians[C_var][v_var]; DenseSubMatrix &KCC = *c.elem_subjacobians[C_var][C_var]; DenseSubVector &FC = *c.elem_subresiduals[C_var]; - + // Now we will build the element Jacobian and residual. // Constructing the residual requires the solution and its // gradient from the previous timestep. This must be @@ -247,16 +247,16 @@ bool CoupledSystem::element_time_derivative (bool request_jacobian, for (unsigned int qp=0; qp != n_qpoints; qp++) { // Compute the solution & its gradient at the old Newton iterate - Number p = c.interior_value(p_var, qp), + Number p = c.interior_value(p_var, qp), u = c.interior_value(u_var, qp), - v = c.interior_value(v_var, qp); + v = c.interior_value(v_var, qp); Gradient grad_u = c.interior_gradient(u_var, qp), grad_v = c.interior_gradient(v_var, qp), - grad_C = c.interior_gradient(C_var, qp); + grad_C = c.interior_gradient(C_var, qp); // Definitions for convenience. It is sometimes simpler to do a // dot product if you have the full vector at your disposal. - NumberVectorValue U (u, v); + NumberVectorValue U (u, v); const Number C_x = grad_C(0); const Number C_y = grad_C(1); @@ -268,16 +268,16 @@ bool CoupledSystem::element_time_derivative (bool request_jacobian, // Stokes equations residuals Fu(i) += JxW[qp] * (p*dphi[i][qp](0) - // pressure term - (grad_u*dphi[i][qp])); // diffusion term - + (grad_u*dphi[i][qp])); // diffusion term + Fv(i) += JxW[qp] * (p*dphi[i][qp](1) - // pressure term - (grad_v*dphi[i][qp])); // diffusion term + (grad_v*dphi[i][qp])); // diffusion term // Concentration Equation Residual - FC(i) += JxW[qp] * + FC(i) += JxW[qp] * ( (U*grad_C)*phi[i][qp] + // convection term - (1./Peclet)*(grad_C*dphi[i][qp]) ); // diffusion term + (1./Peclet)*(grad_C*dphi[i][qp]) ); // diffusion term // Note that the Fp block is identically zero unless we are using // some kind of artificial compressibility scheme... @@ -290,18 +290,18 @@ bool CoupledSystem::element_time_derivative (bool request_jacobian, for (unsigned int j=0; j != n_u_dofs; j++) { Kuu(i,j) += JxW[qp] * (-(dphi[i][qp]*dphi[j][qp])); /* diffusion term */ - + Kvv(i,j) += JxW[qp] * (-(dphi[i][qp]*dphi[j][qp])); /* diffusion term */ - + KCu(i,j) += JxW[qp]* ( (phi[j][qp]*C_x)*phi[i][qp] ); /* convection term */ - - KCv(i,j) += JxW[qp]*( (phi[j][qp]*C_y)*phi[i][qp] ); /* convection term */ - + + KCv(i,j) += JxW[qp]*( (phi[j][qp]*C_y)*phi[i][qp] ); /* convection term */ + KCC(i,j) += JxW[qp]* - ( (U*dphi[j][qp])*phi[i][qp] + /* nonlinear term (convection) */ + ( (U*dphi[j][qp])*phi[i][qp] + /* nonlinear term (convection) */ (1./Peclet)*(dphi[j][qp]*dphi[i][qp]) ); /* diffusion term */ } - + // Matrix contributions for the up and vp couplings. for (unsigned int j=0; j != n_p_dofs; j++) { @@ -310,10 +310,10 @@ bool CoupledSystem::element_time_derivative (bool request_jacobian, } } } - + } // end of the quadrature point qp-loop - return request_jacobian; + return request_jacobian; } @@ -344,7 +344,7 @@ bool CoupledSystem::element_constraint (bool request_jacobian, // The subvectors and submatrices we need to fill: DenseSubMatrix &Kpu = *c.elem_subjacobians[p_var][u_var]; - DenseSubMatrix &Kpv = *c.elem_subjacobians[p_var][v_var]; + DenseSubMatrix &Kpv = *c.elem_subjacobians[p_var][v_var]; DenseSubVector &Fp = *c.elem_subresiduals[p_var]; // Add the constraint given by the continuity equation @@ -353,14 +353,14 @@ bool CoupledSystem::element_constraint (bool request_jacobian, { // Compute the velocity gradient at the old Newton iterate Gradient grad_u = c.interior_gradient(u_var, qp), - grad_v = c.interior_gradient(v_var, qp); + grad_v = c.interior_gradient(v_var, qp); // Now a loop over the pressure degrees of freedom. This // computes the contributions of the continuity equation. for (unsigned int i=0; i != n_p_dofs; i++) { Fp(i) += JxW[qp] * psi[i][qp] * - (grad_u(0) + grad_v(1)); + (grad_u(0) + grad_v(1)); if (request_jacobian && c.elem_solution_derivative) { @@ -369,7 +369,7 @@ bool CoupledSystem::element_constraint (bool request_jacobian, for (unsigned int j=0; j != n_u_dofs; j++) { Kpu(i,j) += JxW[qp]*psi[i][qp]*dphi[j][qp](0); - Kpv(i,j) += JxW[qp]*psi[i][qp]*dphi[j][qp](1); + Kpv(i,j) += JxW[qp]*psi[i][qp]*dphi[j][qp](1); } } } @@ -379,27 +379,27 @@ bool CoupledSystem::element_constraint (bool request_jacobian, } void CoupledSystem::postprocess() -{ +{ // We need to overload the postprocess function to set the computed_QoI variable of the CoupledSystem class // to the qoi value stored in System::qoi[0] - + computed_QoI = 0.0; computed_QoI = System::qoi[0]; } -// These functions supply the nonlinear weighting for the adjoint residual error estimate which +// These functions supply the nonlinear weighting for the adjoint residual error estimate which // arise due to the convection term in the convection-diffusion equation: // ||e((u_1)_h C,1)||_{L2} ||e(C^*)||_{L2} + ||e(u1 C,1_h)||_{L2} ||e(C^*)||_{L2} // ||e((u_2)_h C,2)||_{L2} ||e(C^*)||_{L2} + ||e(u2 C,2_h)||_{L2} ||e(C^*)||_{L2} // These functions compute (u_1)_h or C,1_h , and (u_2)_h or C,2_h , and supply it to the weighted patch recovery error estimator -// In CoupledFEMFunctionsx, the object built with var = 0, returns the (u_1)_h weight, while +// In CoupledFEMFunctionsx, the object built with var = 0, returns the (u_1)_h weight, while // the object built with var = 1, returns the C,1_h weight. The switch statment // distinguishes the behavior of the two objects // Same thing for CoupledFEMFunctionsy Number CoupledFEMFunctionsx::operator()(const FEMContext& c, const Point& p, const Real /* time */) -{ +{ Number weight = 0.0; switch(var) @@ -463,4 +463,3 @@ Number CoupledFEMFunctionsy::operator()(const FEMContext& c, const Point& p, return weight; } - diff --git a/examples/adjoints/adjoints_ex3/coupled_system.h b/examples/adjoints/adjoints_ex3/coupled_system.h index 71ac23b88cd..da2c9c579ba 100644 --- a/examples/adjoints/adjoints_ex3/coupled_system.h +++ b/examples/adjoints/adjoints_ex3/coupled_system.h @@ -37,14 +37,14 @@ class CoupledSystem : public FEMSystem const std::string& name_in, const unsigned int number_in) : FEMSystem(es, name_in, number_in), Peclet(1.) {qoi.resize(1);} - + // Function to get computed QoI values Number &get_QoI_value() { - return computed_QoI; + return computed_QoI; } - + Number &get_parameter_value(unsigned int parameter_index) { return parameters[parameter_index]; @@ -57,13 +57,13 @@ class CoupledSystem : public FEMSystem { parameter_vector[i] = ¶meters[i]; } - + return parameter_vector; } Real &get_Pe() { - return Peclet; + return Peclet; } protected: @@ -113,7 +113,7 @@ class CoupledFEMFunctionsx : public FEMFunctionBase // Destructor virtual ~CoupledFEMFunctionsx () {} - + virtual AutoPtr > clone () const {return AutoPtr >( new CoupledFEMFunctionsx(*this) ); } @@ -125,9 +125,9 @@ class CoupledFEMFunctionsx : public FEMFunctionBase const Real time = 0.); private: - + unsigned int var; - + }; @@ -139,7 +139,7 @@ class CoupledFEMFunctionsy : public FEMFunctionBase // Destructor virtual ~CoupledFEMFunctionsy () {} - + virtual AutoPtr > clone () const {return AutoPtr >( new CoupledFEMFunctionsy(*this) ); } @@ -150,9 +150,9 @@ class CoupledFEMFunctionsy : public FEMFunctionBase virtual Number operator() (const FEMContext&, const Point& p, const Real time = 0.); - + private: - + unsigned int var; }; diff --git a/examples/adjoints/adjoints_ex3/domain.C b/examples/adjoints/adjoints_ex3/domain.C index 68e711b1086..cfc68d6c978 100644 --- a/examples/adjoints/adjoints_ex3/domain.C +++ b/examples/adjoints/adjoints_ex3/domain.C @@ -16,11 +16,11 @@ using namespace libMesh; void build_domain (Mesh &mesh, FEMParameters ¶m) { mesh.read(param.domainfile); - + std::cout<<"Making elements 2nd order"< bad_variables = // input.unidentified_arguments(variable_names); diff --git a/examples/adjoints/adjoints_ex3/femparameters.h b/examples/adjoints/adjoints_ex3/femparameters.h index 59b87774720..ec2ced089c3 100644 --- a/examples/adjoints/adjoints_ex3/femparameters.h +++ b/examples/adjoints/adjoints_ex3/femparameters.h @@ -27,9 +27,9 @@ class FEMParameters steadystate_tolerance(0.), timesolver_norm(0,L2), dimension(2), - domaintype("square"), domainfile("mesh.xda"), elementtype("quad"), + domaintype("square"), domainfile("mesh.xda"), elementtype("quad"), fine_mesh_file_primal("fine_mesh.xda"), fine_mesh_soln_primal("fine_mesh_soln.xda"), - fine_mesh_file_adjoint("fine_mesh.xda"), fine_mesh_soln_adjoint("fine_mesh_soln.xda"), + fine_mesh_file_adjoint("fine_mesh.xda"), fine_mesh_soln_adjoint("fine_mesh_soln.xda"), elementorder(2), domain_xmin(0.0), domain_ymin(0.0), domain_zmin(0.0), domain_edge_width(1.0), domain_edge_length(1.0), domain_edge_height(1.0), @@ -60,7 +60,7 @@ class FEMParameters output_gmv(false), output_tecplot(false), run_simulation(true), run_postprocess(false), fe_family(1, "LAGRANGE"), fe_order(1, 1), - extra_quadrature_order(0), + extra_quadrature_order(0), analytic_jacobians(true), verify_analytic_jacobians(0.0), print_solution_norms(false), print_solutions(false), print_residual_norms(false), print_residuals(false), @@ -107,7 +107,7 @@ class FEMParameters std::string indicator_type; bool patch_reuse; unsigned int sobolev_order; - std::string adjoint_residual_type; + std::string adjoint_residual_type; bool alternate_with_uniform_steps; unsigned int alternate_step_number; bool component_wise_error; @@ -127,7 +127,7 @@ class FEMParameters std::vector fe_family; std::vector fe_order; int extra_quadrature_order; - + bool analytic_jacobians; Real verify_analytic_jacobians; diff --git a/examples/adjoints/adjoints_ex3/initial.C b/examples/adjoints/adjoints_ex3/initial.C index b7b21f5290b..de46ceaabc3 100644 --- a/examples/adjoints/adjoints_ex3/initial.C +++ b/examples/adjoints/adjoints_ex3/initial.C @@ -20,9 +20,9 @@ Number initial_value(const Point& /* p */, const std::string&, const std::string&) { - + return 1.; - + } diff --git a/examples/adjoints/adjoints_ex4/L-shaped.C b/examples/adjoints/adjoints_ex4/L-shaped.C index f7b02335ab5..410afbf155c 100644 --- a/examples/adjoints/adjoints_ex4/L-shaped.C +++ b/examples/adjoints/adjoints_ex4/L-shaped.C @@ -22,7 +22,7 @@ void LaplaceSystem::init_data () GetPot infile("l-shaped.in"); exact_QoI[0] = infile("QoI_0", 0.0); exact_QoI[1] = infile("QoI_1", 0.0); - + // Do the parent's initialization after variables are defined FEMSystem::init_data(); @@ -63,9 +63,9 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // Element basis functions const std::vector > &dphi = c.element_fe_var[0]->get_dphi(); - + // The number of local degrees of freedom in each variable - const unsigned int n_T_dofs = c.dof_indices_var[0].size(); + const unsigned int n_T_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; @@ -80,7 +80,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, unsigned int n_qpoints = (c.get_element_qrule())->n_points(); for (unsigned int qp=0; qp != n_qpoints; qp++) - { + { // Compute the solution gradient at the Newton iterate Gradient grad_T = c.interior_gradient(0, qp); @@ -93,7 +93,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // The analytic jacobian K(i,j) += JxW[qp] * ( dphi[i][qp] * dphi[j][qp] ); } // end of the quadrature point qp-loop - + return compute_jacobian; } @@ -101,11 +101,11 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, bool LaplaceSystem::side_constraint (bool request_jacobian, DiffContext &context) { - // Are the jacobians specified analytically ? + // Are the jacobians specified analytically ? bool compute_jacobian = request_jacobian && _analytic_jacobians; FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -119,12 +119,12 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, const std::vector &qside_point = c.side_fe_var[0]->get_xyz(); // The number of local degrees of freedom in each variable - const unsigned int n_T_dofs = c.dof_indices_var[0].size(); + const unsigned int n_T_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; DenseSubVector &F = *c.elem_subresiduals[0]; - + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); const Real penalty = 1./(TOLERANCE*TOLERANCE); @@ -133,7 +133,7 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, { // Compute the solution at the old Newton iterate Number T = c.side_value(0, qp); - + // We get the Dirichlet bcs from the exact solution Number u_dirichlet = exact_solution (qside_point[qp]); @@ -144,17 +144,17 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, for (unsigned int i=0; i != n_T_dofs; i++) for (unsigned int j=0; j != n_T_dofs; ++j) // The analytic jacobian - K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp]; - + K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp]; + } // end of the quadrature point qp-loop - + return compute_jacobian; } -// Override the default DiffSystem postprocess function to compute the -// approximations to the QoIs +// Override the default DiffSystem postprocess function to compute the +// approximations to the QoIs void LaplaceSystem::postprocess() -{ +{ // Reset the array holding the computed QoIs computed_QoI[0] = 0.0; computed_QoI[1] = 0.0; @@ -164,12 +164,12 @@ void LaplaceSystem::postprocess() CommWorld.sum(computed_QoI[0]); CommWorld.sum(computed_QoI[1]); - + } // The exact solution to the singular problem, // u_exact = r^(2/3)*sin(2*theta/3). We use this to set the Dirichlet boundary conditions -Number LaplaceSystem::exact_solution(const Point& p)// xyz location +Number LaplaceSystem::exact_solution(const Point& p)// xyz location { const Real x1 = p(0); const Real x2 = p(1); @@ -179,7 +179,7 @@ Number LaplaceSystem::exact_solution(const Point& p)// xyz location // Make sure 0 <= theta <= 2*pi if (theta < 0) theta += 2. * libMesh::pi; - + return pow(x1*x1 + x2*x2, 1./3.)*sin(2./3.*theta); - + } diff --git a/examples/adjoints/adjoints_ex4/L-shaped.h b/examples/adjoints/adjoints_ex4/L-shaped.h index c0589034ba1..250448648a5 100644 --- a/examples/adjoints/adjoints_ex4/L-shaped.h +++ b/examples/adjoints/adjoints_ex4/L-shaped.h @@ -57,7 +57,7 @@ class LaplaceSystem : public FEMSystem // Overloading the postprocess function - virtual void element_postprocess(DiffContext &context); + virtual void element_postprocess(DiffContext &context); virtual void side_postprocess(DiffContext &context); @@ -65,24 +65,24 @@ class LaplaceSystem : public FEMSystem virtual void element_qoi_derivative (DiffContext &context, - const QoISet & qois); + const QoISet & qois); // Overloading the qoi function on sides virtual void side_qoi_derivative (DiffContext &context, - const QoISet & qois); + const QoISet & qois); Number exact_solution (const Point&); // Variables to hold the computed QoIs - + Number computed_QoI[2]; // Variables to read in the exact QoIs from l-shaped.in - + Number exact_QoI[2]; - + // The FE type to use std::string _fe_family; unsigned int _fe_order; diff --git a/examples/adjoints/adjoints_ex4/adjoints_ex4.C b/examples/adjoints/adjoints_ex4/adjoints_ex4.C index 2ca8f8792e0..7cfe29ca0ef 100644 --- a/examples/adjoints/adjoints_ex4/adjoints_ex4.C +++ b/examples/adjoints/adjoints_ex4/adjoints_ex4.C @@ -19,14 +19,14 @@ // // This example solves the Laplace equation on the classic "L-shaped" // domain with adaptive mesh refinement. The exact - // solution is u(r,\theta) = r^{2/3} * \sin ( (2/3) * \theta). The kelly and - // adjoint residual error estimators are used to develop error indicators and - // guide mesh adaptation. Since we use the adjoint capabilities of libMesh in + // solution is u(r,\theta) = r^{2/3} * \sin ( (2/3) * \theta). The kelly and + // adjoint residual error estimators are used to develop error indicators and + // guide mesh adaptation. Since we use the adjoint capabilities of libMesh in // this example, we use the DiffSystem framework. This file (adjoints_ex1.C) // contains the declaration of mesh and equation system objects, L-shaped.C - // contains the assembly of the system, element_qoi_derivative.C and - // side_qoi_derivative.C contain the RHS for the adjoint systems. - // Postprocessing to compute the QoIs is done in element_postprocess.C and + // contains the assembly of the system, element_qoi_derivative.C and + // side_qoi_derivative.C contain the RHS for the adjoint systems. + // Postprocessing to compute the QoIs is done in element_postprocess.C and // side_postprocess.C. // The initial mesh contains three QUAD9 elements which represent the @@ -85,7 +85,7 @@ using namespace libMesh; // Write gmv output -void write_output(EquationSystems &es, +void write_output(EquationSystems &es, unsigned int a_step, // The adaptive step count std::string solution_type) // primal or adjoint solve { @@ -99,10 +99,10 @@ void write_output(EquationSystems &es, << std::setfill('0') << std::right << a_step; - + GMVIO(mesh).write_equation_systems (file_name_gmv.str(), es); -#endif +#endif } // Set the parameters for the nonlinear and linear solvers to be used during the simulation @@ -135,7 +135,7 @@ void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m) { NewtonSolver *solver = new NewtonSolver(system); system.time_solver->diff_solver() = AutoPtr(solver); - + solver->quiet = param.solver_quiet; solver->max_nonlinear_iterations = param.max_nonlinear_iterations; solver->minsteplength = param.min_step_length; @@ -148,11 +148,11 @@ void set_system_parameters(LaplaceSystem &system, FEMParameters ¶m) solver->continue_after_max_iterations = true; solver->continue_after_backtrack_failure = true; } - + // And the linear solver options solver->max_linear_iterations = param.max_linear_iterations; solver->initial_linear_tolerance = param.initial_linear_tolerance; - solver->minimum_linear_tolerance = param.minimum_linear_tolerance; + solver->minimum_linear_tolerance = param.minimum_linear_tolerance; } } @@ -166,9 +166,9 @@ AutoPtr build_mesh_refinement(MeshBase &mesh, AutoPtr mesh_refinement(new MeshRefinement(mesh)); mesh_refinement->coarsen_by_parents() = true; mesh_refinement->absolute_global_tolerance() = param.global_tolerance; - mesh_refinement->nelem_target() = param.nelem_target; + mesh_refinement->nelem_target() = param.nelem_target; mesh_refinement->refine_fraction() = param.refine_fraction; - mesh_refinement->coarsen_fraction() = param.coarsen_fraction; + mesh_refinement->coarsen_fraction() = param.coarsen_fraction; mesh_refinement->coarsen_threshold() = param.coarsen_threshold; return mesh_refinement; @@ -184,14 +184,14 @@ AutoPtr build_adjoint_refinement_error_estimator(QoI std::cout<<"Computing the error estimate using the Adjoint Refinement Error Estimator"<qoi_set() = qois; // We enrich the FE space for the dual problem by doing 2 uniform h refinements adjoint_refinement_estimator->number_h_refinements = 2; - + return error_estimator; } @@ -216,9 +216,9 @@ int main (int argc, char** argv) std::ifstream i("general.in"); if (!i) { - std::cerr << '[' << libMesh::processor_id() - << "] Can't find general.in; exiting early." - << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Can't find general.in; exiting early." + << std::endl; libmesh_error(); } } @@ -230,7 +230,7 @@ int main (int argc, char** argv) // Skip this default-2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Create a mesh. Mesh mesh; @@ -253,7 +253,7 @@ int main (int argc, char** argv) // on the coarse grid read in from lshaped.xda MeshRefinement initial_uniform_refinements(mesh); initial_uniform_refinements.uniformly_refine(param.coarserefinements); - + std::cout << "Building system" << std::endl; // Build the FEMSystem @@ -261,7 +261,7 @@ int main (int argc, char** argv) // Set its parameters set_system_parameters(system, param); - + std::cout << "Initializing systems" << std::endl; equation_systems.init (); @@ -271,11 +271,11 @@ int main (int argc, char** argv) equation_systems.print_info(); LinearSolver *linear_solver = system.get_linear_solver(); - { + { // Adaptively solve the timestep unsigned int a_step = 0; for (; a_step != param.max_adaptivesteps; ++a_step) - { + { // We can't adapt to both a tolerance and a // target mesh size if (param.global_tolerance != 0.) @@ -284,15 +284,15 @@ int main (int argc, char** argv) // target mesh size else libmesh_assert_greater (param.nelem_target, 0); - + linear_solver->reuse_preconditioner(false); // Solve the forward problem system.solve(); - // Write out the computed primal solution + // Write out the computed primal solution write_output(equation_systems, a_step, "primal"); - + // Get a pointer to the primal solution vector NumericVector &primal_solution = *system.solution; @@ -302,21 +302,21 @@ int main (int argc, char** argv) // Declare a qoi_indices vector, each index will correspond to a QoI std::vector qoi_indices; qoi_indices.push_back(0); - qoi_indices.push_back(1); + qoi_indices.push_back(1); qois.add_indices(qoi_indices); // Set weights for each index, these will weight the contribution of each QoI in the final error // estimate to be used for flagging elements for refinement - qois.set_weight(0, 0.5); - qois.set_weight(1, 0.5); + qois.set_weight(0, 0.5); + qois.set_weight(1, 0.5); // Make sure we get the contributions to the adjoint RHS from the sides system.assemble_qoi_sides = true; // We are about to solve the adjoint system, but before we do this we see the same preconditioner - // flag to reuse the preconditioner from the forward solver + // flag to reuse the preconditioner from the forward solver linear_solver->reuse_preconditioner(param.reuse_preconditioner); - + // Solve the adjoint system. This takes the transpose of the stiffness matrix and then // solves the resulting system system.adjoint_solve(); @@ -328,61 +328,61 @@ int main (int argc, char** argv) NumericVector &dual_solution_0 = system.get_adjoint_solution(0); // Swap the primal and dual solutions so we can write out the adjoint solution - primal_solution.swap(dual_solution_0); + primal_solution.swap(dual_solution_0); write_output(equation_systems, a_step, "adjoint_0"); // Swap back primal_solution.swap(dual_solution_0); - + // Get a pointer to the solution vector of the adjoint problem for QoI 0 NumericVector &dual_solution_1 = system.get_adjoint_solution(1); - + // Swap again - primal_solution.swap(dual_solution_1); + primal_solution.swap(dual_solution_1); write_output(equation_systems, a_step, "adjoint_1"); // Swap back again primal_solution.swap(dual_solution_1); - + std::cout << "Adaptive step " << a_step << ", we have " << mesh.n_active_elem() << " active elements and " << equation_systems.n_active_dofs() << " active dofs." << std::endl ; // Postprocess, compute the approximate QoIs and write them out to the console - std::cout << "Postprocessing: " << std::endl; + std::cout << "Postprocessing: " << std::endl; system.postprocess_sides = true; system.postprocess(); Number QoI_0_computed = system.get_QoI_value("computed", 0); Number QoI_0_exact = system.get_QoI_value("exact", 0); Number QoI_1_computed = system.get_QoI_value("computed", 1); Number QoI_1_exact = system.get_QoI_value("exact", 1); - + std::cout<< "The relative error in QoI 0 is " << std::setprecision(17) << std::abs(QoI_0_computed - QoI_0_exact) / std::abs(QoI_0_exact) << std::endl; - - std::cout<< "The relative error in QoI 1 is " << std::setprecision(17) + + std::cout<< "The relative error in QoI 1 is " << std::setprecision(17) << std::abs(QoI_1_computed - QoI_1_exact) / std::abs(QoI_1_exact) << std::endl << std::endl; - - // We will declare an error vector for passing to the adjoint refinement error estimator + + // We will declare an error vector for passing to the adjoint refinement error estimator ErrorVector QoI_elementwise_error; // Build an adjoint refinement error estimator object AutoPtr adjoint_refinement_error_estimator = build_adjoint_refinement_error_estimator(qois); - + // Estimate the error in each element using the Adjoint Refinement estimator adjoint_refinement_error_estimator->estimate_error(system, QoI_elementwise_error); - // Print out the computed error estimate, note that we access the global error estimates + // Print out the computed error estimate, note that we access the global error estimates // using an accessor function, right now sum(QoI_elementwise_error) != global_QoI_error_estimate std::cout<< "The computed relative error in QoI 0 is " << std::setprecision(17) << std::abs(adjoint_refinement_error_estimator->get_global_QoI_error_estimate(0)) / std::abs(QoI_0_exact) << std::endl; - - std::cout<< "The computed relative error in QoI 1 is " << std::setprecision(17) + + std::cout<< "The computed relative error in QoI 1 is " << std::setprecision(17) << std::abs(adjoint_refinement_error_estimator->get_global_QoI_error_estimate(1)) / std::abs(QoI_1_exact) << std::endl << std::endl; @@ -394,37 +394,37 @@ int main (int argc, char** argv) std::cout<< "The effectivity index for the computed error in QoI 1 is " << std::setprecision(17) << std::abs(adjoint_refinement_error_estimator->get_global_QoI_error_estimate(1)) / std::abs(QoI_1_computed - QoI_1_exact) << std::endl << std::endl; - - // We have to refine either based on reaching an error tolerance or + + // We have to refine either based on reaching an error tolerance or // a number of elements target, which should be verified above - // Otherwise we flag elements by error tolerance or nelem target + // Otherwise we flag elements by error tolerance or nelem target // Uniform refinement if(param.refine_uniformly) - { + { mesh_refinement->uniformly_refine(1); } // Adaptively refine based on reaching an error tolerance else if(param.global_tolerance >= 0. && param.nelem_target == 0.) - { - mesh_refinement->flag_elements_by_error_tolerance (QoI_elementwise_error); - + { + mesh_refinement->flag_elements_by_error_tolerance (QoI_elementwise_error); + mesh_refinement->refine_and_coarsen_elements(); } // Adaptively refine based on reaching a target number of elements - else - { + else + { if (mesh.n_active_elem() >= param.nelem_target) { std::cout<<"We reached the target number of elements."<flag_elements_by_nelem_target (QoI_elementwise_error); - + mesh_refinement->refine_and_coarsen_elements(); } - + // Dont forget to reinit the system after each adaptive refinement ! equation_systems.reinit(); @@ -437,63 +437,63 @@ int main (int argc, char** argv) // Do one last solve if necessary if (a_step == param.max_adaptivesteps) - { - linear_solver->reuse_preconditioner(false); + { + linear_solver->reuse_preconditioner(false); system.solve(); - + write_output(equation_systems, a_step, "primal"); NumericVector &primal_solution = *system.solution; - + QoISet qois; std::vector qoi_indices; qoi_indices.push_back(0); - qoi_indices.push_back(1); + qoi_indices.push_back(1); qois.add_indices(qoi_indices); - - qois.set_weight(0, 0.5); - qois.set_weight(1, 0.5); - system.assemble_qoi_sides = true; + qois.set_weight(0, 0.5); + qois.set_weight(1, 0.5); + + system.assemble_qoi_sides = true; linear_solver->reuse_preconditioner(param.reuse_preconditioner); system.adjoint_solve(); - + // Now that we have solved the adjoint, set the adjoint_already_solved boolean to true, so we dont solve unneccesarily in the error estimator system.set_adjoint_already_solved(true); NumericVector &dual_solution_0 = system.get_adjoint_solution(0); - - primal_solution.swap(dual_solution_0); + + primal_solution.swap(dual_solution_0); write_output(equation_systems, a_step, "adjoint_0"); primal_solution.swap(dual_solution_0); - + NumericVector &dual_solution_1 = system.get_adjoint_solution(1); - - primal_solution.swap(dual_solution_1); + + primal_solution.swap(dual_solution_1); write_output(equation_systems, a_step, "adjoint_1"); primal_solution.swap(dual_solution_1); - + std::cout << "Adaptive step " << a_step << ", we have " << mesh.n_active_elem() << " active elements and " << equation_systems.n_active_dofs() - << " active dofs." << std::endl ; - - std::cout << "Postprocessing: " << std::endl; + << " active dofs." << std::endl ; + + std::cout << "Postprocessing: " << std::endl; system.postprocess_sides = true; system.postprocess(); - + Number QoI_0_computed = system.get_QoI_value("computed", 0); Number QoI_0_exact = system.get_QoI_value("exact", 0); Number QoI_1_computed = system.get_QoI_value("computed", 1); Number QoI_1_exact = system.get_QoI_value("exact", 1); - + std::cout<< "The relative error in QoI 0 is " << std::setprecision(17) << std::abs(QoI_0_computed - QoI_0_exact) / std::abs(QoI_0_exact) << std::endl; - + std::cout<< "The relative error in QoI 1 is " << std::setprecision(17) << std::abs(QoI_1_computed - QoI_1_exact) / std::abs(QoI_1_exact) << std::endl << std::endl; @@ -506,19 +506,19 @@ int main (int argc, char** argv) // Build an adjoint refinement error estimator object AutoPtr adjoint_refinement_error_estimator = build_adjoint_refinement_error_estimator(qois); - + // Estimate the error in each element using the Adjoint Refinement estimator adjoint_refinement_error_estimator->estimate_error(system, QoI_elementwise_error); - // Print out the computed error estimate, note that we access the global error estimates + // Print out the computed error estimate, note that we access the global error estimates // using an accessor function, right now sum(QoI_elementwise_error) != global_QoI_error_estimate std::cout<< "The computed relative error in QoI 0 is " << std::setprecision(17) << std::abs(adjoint_refinement_error_estimator->get_global_QoI_error_estimate(0)) / std::abs(QoI_0_exact) << std::endl; - - std::cout<< "The computed relative error in QoI 1 is " << std::setprecision(17) + + std::cout<< "The computed relative error in QoI 1 is " << std::setprecision(17) << std::abs(adjoint_refinement_error_estimator->get_global_QoI_error_estimate(1)) / - std::abs(QoI_1_exact) << std::endl << std::endl; + std::abs(QoI_1_exact) << std::endl << std::endl; // Also print out effecitivity indices (estimated error/true error) std::cout<< "The effectivity index for the computed error in QoI 0 is " << std::setprecision(17) @@ -532,11 +532,11 @@ int main (int argc, char** argv) } } - std::cerr << '[' << libMesh::processor_id() - << "] Completing output." << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Completing output." << std::endl; #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. + + // All done. return 0; } diff --git a/examples/adjoints/adjoints_ex4/element_postprocess.C b/examples/adjoints/adjoints_ex4/element_postprocess.C index 8019e2c0348..a650fdb246c 100644 --- a/examples/adjoints/adjoints_ex4/element_postprocess.C +++ b/examples/adjoints/adjoints_ex4/element_postprocess.C @@ -14,14 +14,14 @@ using namespace libMesh; // Last modified: Feb 13, 2009 -// Define the postprocess function to compute QoI 0, the integral of the the solution +// Define the postprocess function to compute QoI 0, the integral of the the solution // over a subdomain void LaplaceSystem::element_postprocess (DiffContext &context) -{ +{ FEMContext &c = libmesh_cast_ref(context); - + // Element Jacobian * quadrature weights for interior integration const std::vector &JxW = c.element_fe_var[0]->get_JxW(); @@ -31,14 +31,14 @@ void LaplaceSystem::element_postprocess (DiffContext &context) unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - // The function R = int_{omega} T dR + // The function R = int_{omega} T dR // omega is a subset of Omega (the whole domain), omega = [0.75, 1.0] x [0.0, 0.25] Number dQoI_0 = 0.; - - // Loop over quadrature points - - for (unsigned int qp = 0; qp != n_qpoints; qp++) + + // Loop over quadrature points + + for (unsigned int qp = 0; qp != n_qpoints; qp++) { // Get co-ordinate locations of the current quadrature point const Real x = xyz[qp](0); @@ -46,7 +46,7 @@ void LaplaceSystem::element_postprocess (DiffContext &context) // If in the sub-domain omega, add the contribution to the integral R if(fabs(x - 0.875) <= 0.125 && fabs(y - 0.125) <= 0.125) - { + { // Get the solution value at the quadrature point Number T = c.interior_value(0, qp); @@ -57,6 +57,6 @@ void LaplaceSystem::element_postprocess (DiffContext &context) // Update the computed value of the global functional R, by adding the contribution from this element - computed_QoI[0] = computed_QoI[0] + dQoI_0; - + computed_QoI[0] = computed_QoI[0] + dQoI_0; + } diff --git a/examples/adjoints/adjoints_ex4/element_qoi_derivative.C b/examples/adjoints/adjoints_ex4/element_qoi_derivative.C index 6797dfc3c6f..c6610b4ef94 100644 --- a/examples/adjoints/adjoints_ex4/element_qoi_derivative.C +++ b/examples/adjoints/adjoints_ex4/element_qoi_derivative.C @@ -18,7 +18,7 @@ void LaplaceSystem::element_qoi_derivative (DiffContext &context, const QoISet & /* qois */) { FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -27,32 +27,32 @@ void LaplaceSystem::element_qoi_derivative (DiffContext &context, // The basis functions for the element const std::vector > &phi = c.element_fe_var[0]->get_phi(); - + // The element quadrature points const std::vector &q_point = c.element_fe_var[0]->get_xyz(); // The number of local degrees of freedom in each variable const unsigned int n_T_dofs = c.dof_indices_var[0].size(); - unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + unsigned int n_qpoints = (c.get_element_qrule())->n_points(); + // Fill the QoI RHS corresponding to this QoI. Since this is the 0th QoI // we fill in the [0][i] subderivatives, i corresponding to the variable index. // Our system has only one variable, so we only have to fill the [0][0] subderivative DenseSubVector &Q = *c.elem_qoi_subderivatives[0][0]; - + // Loop over the qps for (unsigned int qp=0; qp != n_qpoints; qp++) { const Real x = q_point[qp](0); const Real y = q_point[qp](1); - + // If in the sub-domain over which QoI 0 is supported, add contributions // to the adjoint rhs if(fabs(x - 0.875) <= 0.125 && fabs(y - 0.125) <= 0.125) - { + { for (unsigned int i=0; i != n_T_dofs; i++) Q(i) += JxW[qp] *phi[i][qp] ; } - + } // end of the quadrature point qp-loop } diff --git a/examples/adjoints/adjoints_ex4/femparameters.C b/examples/adjoints/adjoints_ex4/femparameters.C index a6a09481376..c66024a21d0 100644 --- a/examples/adjoints/adjoints_ex4/femparameters.C +++ b/examples/adjoints/adjoints_ex4/femparameters.C @@ -14,9 +14,9 @@ void FEMParameters::read(GetPot &input) { std::vector variable_names; - - - GETPOT_INT_INPUT(coarserefinements); + + + GETPOT_INT_INPUT(coarserefinements); GETPOT_INPUT(domainfile); GETPOT_INPUT(solver_quiet); @@ -35,7 +35,7 @@ void FEMParameters::read(GetPot &input) GETPOT_INPUT(refine_fraction); GETPOT_INPUT(coarsen_fraction); GETPOT_INPUT(coarsen_threshold); - GETPOT_INT_INPUT(max_adaptivesteps); + GETPOT_INT_INPUT(max_adaptivesteps); GETPOT_INPUT(refine_uniformly); GETPOT_INPUT(indicator_type); GETPOT_INPUT(patch_reuse); diff --git a/examples/adjoints/adjoints_ex4/femparameters.h b/examples/adjoints/adjoints_ex4/femparameters.h index e30f80b4e30..b972f96742c 100644 --- a/examples/adjoints/adjoints_ex4/femparameters.h +++ b/examples/adjoints/adjoints_ex4/femparameters.h @@ -13,9 +13,9 @@ using namespace libMesh; class FEMParameters { public: - FEMParameters() : + FEMParameters() : domainfile("lshaped.xda"), - coarserefinements(0), + coarserefinements(0), solver_quiet(true), reuse_preconditioner(false), require_residual_reduction(true), @@ -27,19 +27,19 @@ class FEMParameters nelem_target(30000), global_tolerance(0.0), refine_fraction(0.3), coarsen_fraction(0.3), coarsen_threshold(10), refine_uniformly(false), - max_adaptivesteps(1), + max_adaptivesteps(1), indicator_type("kelly"), patch_reuse(true), - fe_family(1, "LAGRANGE"), fe_order(1, 1), + fe_family(1, "LAGRANGE"), fe_order(1, 1), analytic_jacobians(true), verify_analytic_jacobians(0.0), print_solution_norms(false), print_solutions(false), print_residual_norms(false), print_residuals(false), print_jacobian_norms(false), print_jacobians(false) {} void read(GetPot &input); - + std::string domainfile; unsigned int coarserefinements; - + bool solver_quiet, reuse_preconditioner, require_residual_reduction; Real min_step_length; unsigned int max_linear_iterations, max_nonlinear_iterations; @@ -52,8 +52,8 @@ class FEMParameters Real refine_fraction, coarsen_fraction, coarsen_threshold; bool refine_uniformly; unsigned int max_adaptivesteps; - - std::string indicator_type; + + std::string indicator_type; bool patch_reuse; std::vector fe_family; diff --git a/examples/adjoints/adjoints_ex4/side_postprocess.C b/examples/adjoints/adjoints_ex4/side_postprocess.C index 621958e5a83..b99553bef38 100644 --- a/examples/adjoints/adjoints_ex4/side_postprocess.C +++ b/examples/adjoints/adjoints_ex4/side_postprocess.C @@ -17,9 +17,9 @@ using namespace libMesh; void LaplaceSystem::side_postprocess(DiffContext &context) { - + FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -30,8 +30,8 @@ void LaplaceSystem::side_postprocess(DiffContext &context) const std::vector &face_normals = c.side_fe_var[0]->get_normals(); - unsigned int n_qpoints = (c.get_side_qrule())->n_points(); - + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); + Number dQoI_1 = 0. ; // Loop over qp's, compute the function at each qp and add @@ -42,18 +42,18 @@ void LaplaceSystem::side_postprocess(DiffContext &context) const Real y = q_point[qp](1); const Real TOL = 1.e-5; - + // If on the bottom horizontal bdry (y = -1) if(fabs(y - 1.0) <= TOL && x > 0.0) { // Get the value of the gradient at this point - const Gradient grad_T = c.side_gradient(0,qp); + const Gradient grad_T = c.side_gradient(0,qp); // Add the contribution of this qp to the integral QoI - dQoI_1 += JxW[qp] * (grad_T * face_normals[qp] * x * (x - 1.)) ; + dQoI_1 += JxW[qp] * (grad_T * face_normals[qp] * x * (x - 1.)) ; } - + } // end of the quadrature point qp-loop - - computed_QoI[1] = computed_QoI[1] + dQoI_1; + + computed_QoI[1] = computed_QoI[1] + dQoI_1; } diff --git a/examples/adjoints/adjoints_ex4/side_qoi_derivative.C b/examples/adjoints/adjoints_ex4/side_qoi_derivative.C index 7f67f646d14..10167bc4f0b 100644 --- a/examples/adjoints/adjoints_ex4/side_qoi_derivative.C +++ b/examples/adjoints/adjoints_ex4/side_qoi_derivative.C @@ -18,7 +18,7 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, const QoISet & /* qois */) { FEMContext &c = libmesh_cast_ref(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -27,7 +27,7 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, // Basis Functions const std::vector > &dphi = c.side_fe_var[0]->get_dphi(); - + // The side quadrature points const std::vector &q_point = c.side_fe_var[0]->get_xyz(); @@ -36,7 +36,7 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, // The number of local degrees of freedom in each variable const unsigned int n_T_dofs = c.dof_indices_var[0].size(); - unsigned int n_qpoints = (c.get_side_qrule())->n_points(); + unsigned int n_qpoints = (c.get_side_qrule())->n_points(); // Fill the QoI RHS corresponding to this QoI. Since this is QoI 1 // we fill in the [1][i] subderivatives, i corresponding to the variable index. @@ -48,17 +48,17 @@ void LaplaceSystem::side_qoi_derivative (DiffContext &context, for (unsigned int qp=0; qp != n_qpoints; qp++) { const Real x = q_point[qp](0); - const Real y = q_point[qp](1); - + const Real y = q_point[qp](1); + // If on the sides where the boundary QoI is supported, add contributions // to the adjoint rhs if(fabs(y - 1.0) <= TOL && x > 0.0) - { + { for (unsigned int i=0; i != n_T_dofs; i++) - { - Q1(i) += JxW[qp] * (dphi[i][qp] * face_normals[qp]) * x * (x - 1.); + { + Q1(i) += JxW[qp] * (dphi[i][qp] * face_normals[qp]) * x * (x - 1.); } - } - + } + } // end of the quadrature point qp-loop } diff --git a/examples/adjoints/adjoints_ex5/adjoint_initial.C b/examples/adjoints/adjoints_ex5/adjoint_initial.C index 822cc2093ce..7a11629b3ac 100644 --- a/examples/adjoints/adjoints_ex5/adjoint_initial.C +++ b/examples/adjoints/adjoints_ex5/adjoint_initial.C @@ -40,9 +40,9 @@ Number adjoint_initial_value(const Point& p, Real x = p(0), y = p(1); Number val = 0.; - + val = sin(M_PI * x) * sin(M_PI * y); - + return val; } @@ -56,5 +56,5 @@ Gradient adjoint_initial_grad(const Point& p, Real x = p(0), y = p(1); return Gradient(M_PI*cos(M_PI * x) * sin(M_PI * y), - M_PI*sin(M_PI * x) * cos(M_PI * y)); + M_PI*sin(M_PI * x) * cos(M_PI * y)); } diff --git a/examples/adjoints/adjoints_ex5/adjoints_ex5.C b/examples/adjoints/adjoints_ex5/adjoints_ex5.C index ccd137d7b0e..17a2eace5ba 100644 --- a/examples/adjoints/adjoints_ex5/adjoints_ex5.C +++ b/examples/adjoints/adjoints_ex5/adjoints_ex5.C @@ -19,7 +19,7 @@ // Adjoints Example 5 - SolutionHistory, General Localized Vectors and Unsteady Adjoints. // This example showcases three new capabilities in libMesh. The primary motivation is adjoint sensitivity analysis for unsteady problems. The PDE we are interested in is the simple 2-d heat equation: - // partial(T)/partial(t) - K Laplacian(T) = 0 + // partial(T)/partial(t) - K Laplacian(T) = 0 // with initial condition: // T(x,y;0) = sin(pi*x) sin(pi*y) and boundary conditions: // T(boundary;t) = 0 @@ -27,21 +27,21 @@ // For these initial and boundary conditions, the exact solution // u = exp(-K pi^2 t) * sin(pi*x) * sin(pi*y) - // We specify our Quantity of Interest (QoI) as - // Q(u) = int_{domain} u(x,y;1) sin(pi*x) sin(pi*y) dx dy, and + // We specify our Quantity of Interest (QoI) as + // Q(u) = int_{domain} u(x,y;1) sin(pi*x) sin(pi*y) dx dy, and // are interested in computing the sensitivity dQ/dK // For this QoI, the continuous adjoint problem reads, - // -partial(z)/partial(t) - K Laplacian(z) = 0 + // -partial(z)/partial(t) - K Laplacian(z) = 0 // with initial condition: - // T(x,y;1) = sin(pi*x) sin(pi*y) - // and boundary condition: + // T(x,y;1) = sin(pi*x) sin(pi*y) + // and boundary condition: // T(boundary;t) = 0 - - // which has the exact solution, + + // which has the exact solution, // z = exp(-K pi^2 (1 - t)) * sin(pi*x) * sin(pi*y) // which is the mirror image in time of the forward solution - + // For an adjoint consistent space-time formulation, the discrete // adjoint can be obtained by marching backwards from the adjoint // initial condition and solving the transpose of the discrete primal @@ -101,7 +101,7 @@ #include #include -void write_output(EquationSystems &es, +void write_output(EquationSystems &es, unsigned int a_step, // The adaptive step count std::string solution_type) // primal or adjoint solve { @@ -115,10 +115,10 @@ void write_output(EquationSystems &es, << std::setfill('0') << std::right << a_step; - + GMVIO(mesh).write_equation_systems (file_name_gmv.str(), es); -#endif +#endif } void set_system_parameters(HeatSystem &system, FEMParameters ¶m) @@ -167,7 +167,7 @@ void set_system_parameters(HeatSystem &system, FEMParameters ¶m) else system.time_solver = AutoPtr(new SteadySolver(system)); - + // The Memory Solution History object we will set the system SolutionHistory object to MemorySolutionHistory heatsystem_solution_history(system); system.time_solver->set_solution_history(heatsystem_solution_history); @@ -177,11 +177,11 @@ void set_system_parameters(HeatSystem &system, FEMParameters ¶m) system.time_solver->quiet = param.time_solver_quiet; // Create any Dirichlet boundary conditions - typedef + typedef std::map *>:: const_iterator Iter; - for (Iter i = param.dirichlet_conditions.begin(); + for (Iter i = param.dirichlet_conditions.begin(); i != param.dirichlet_conditions.end(); ++i) { boundary_id_type b = i->first; @@ -259,9 +259,9 @@ int main (int argc, char** argv) std::ifstream i("general.in"); if (!i) { - std::cerr << '[' << libMesh::processor_id() - << "] Can't find general.in; exiting early." - << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Can't find general.in; exiting early." + << std::endl; libmesh_error(); } } @@ -275,7 +275,7 @@ int main (int argc, char** argv) // And an object to refine it AutoPtr mesh_refinement(new MeshRefinement(mesh)); - + // And an EquationSystems to run on it EquationSystems equation_systems (mesh); @@ -283,7 +283,7 @@ int main (int argc, char** argv) // Build a unit square ElemType elemtype; - + if (param.elementtype == "tri" || param.elementtype == "unstructured") elemtype = TRI3; @@ -306,7 +306,7 @@ int main (int argc, char** argv) // Initialize the system equation_systems.init (); - + // Refine the grid again if requested for (unsigned int i=0; i != param.extrarefinements; ++i) { @@ -315,11 +315,11 @@ int main (int argc, char** argv) } std::cout<<"Setting primal initial conditions"<advance_timestep(); - - // Write out this timestep - write_output(equation_systems, t_step+1, "primal"); + system.time_solver->advance_timestep(); + + // Write out this timestep + write_output(equation_systems, t_step+1, "primal"); } // End timestep loop - + ///////////////// Now for the Adjoint Solution ////////////////////////////////////// - + // Now we will solve the backwards in time adjoint problem std::cout << std::endl << "Solving the adjoint problem" << std::endl; // We need to tell the library that it needs to project the adjoint, so - // MemorySolutionHistory knows it has to save it - + // MemorySolutionHistory knows it has to save it + // Tell the library to project the adjoint vector, and hence, memory solution history to - // save it + // save it system.set_vector_preservation(adjoint_solution_name, true); std::cout << "Setting adjoint initial conditions Z("<(p+dp) - (p+dp) // To do this we need to step forward in time, and compute the perturbed R at each time step and accumulate it // Then once all time steps are over, we can compute (R(u,z;p+dp) - R(u,z;p-dp))/(2*dp) - + // Now we begin the timestep loop to compute the time-accurate // adjoint sensitivities for (unsigned int t_step=param.initial_timestep; @@ -479,38 +479,38 @@ int main (int argc, char** argv) // A pretty update message std::cout << "Retrieving " << t_step << ", time = " << system.time << std::endl; - + // Retrieve the primal and adjoint solutions at the current timestep system.time_solver->retrieve_timestep(); libMesh::out << "|U(" <(context); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -46,11 +46,11 @@ void HeatSystem::element_qoi_derivative (DiffContext &context, // The basis functions for the element const std::vector > &phi = c.element_fe_var[0]->get_phi(); - + // The number of local degrees of freedom in each variable const unsigned int n_T_dofs = c.dof_indices_var[0].size(); - unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + unsigned int n_qpoints = (c.get_element_qrule())->n_points(); + // Fill the QoI RHS corresponding to this QoI. Since this is the 0th QoI // we fill in the [0][i] subderivatives, i corresponding to the variable index. // Our system has only one variable, so we only have to fill the [0][0] subderivative @@ -58,26 +58,26 @@ void HeatSystem::element_qoi_derivative (DiffContext &context, // A reference to the system context is built with const System & sys = c.get_system(); - + // Get a pointer to the adjoint solution vector NumericVector &adjoint_solution = const_cast(sys).get_adjoint_solution(0); // Get the previous adjoint solution values at all the qps - + std::vector old_adjoint (n_qpoints, 0); - + c.interior_values(0, adjoint_solution, old_adjoint); // Our QoI depends solely on the final time, so there are no QoI contributions. - // However, there is a contribution from the adjoint solution timestep, for the + // However, there is a contribution from the adjoint solution timestep, for the // time part of the residual of the adjoint problem // Loop over the qps for (unsigned int qp=0; qp != n_qpoints; qp++) - { + { for (unsigned int i=0; i != n_T_dofs; i++) { Q(i) += -JxW[qp] * old_adjoint[qp] * phi[i][qp] ; } - + } // end of the quadrature point qp-loop } diff --git a/examples/adjoints/adjoints_ex5/factoryfunction.C b/examples/adjoints/adjoints_ex5/factoryfunction.C index f75bcb735ed..8faecd100aa 100644 --- a/examples/adjoints/adjoints_ex5/factoryfunction.C +++ b/examples/adjoints/adjoints_ex5/factoryfunction.C @@ -70,4 +70,3 @@ FactoryImp > example_one_factory ("exam #ifdef LIBMESH_USE_SEPARATE_NAMESPACE } // namespace libMesh #endif - diff --git a/examples/adjoints/adjoints_ex5/femparameters.C b/examples/adjoints/adjoints_ex5/femparameters.C index ae1d8fd1469..aa98a7a8a38 100644 --- a/examples/adjoints/adjoints_ex5/femparameters.C +++ b/examples/adjoints/adjoints_ex5/femparameters.C @@ -52,7 +52,7 @@ FEMParameters::FEMParameters() : steadystate_tolerance(0.), timesolver_norm(0,L2), - dimension(2), + dimension(2), domaintype("square"), domainfile("mesh.xda"), elementtype("quad"), elementorder(2), domain_xmin(0.0), domain_ymin(0.0), domain_zmin(0.0), @@ -63,7 +63,7 @@ FEMParameters::FEMParameters() : nelem_target(8000), global_tolerance(0.0), refine_fraction(0.3), coarsen_fraction(0.3), coarsen_threshold(10), max_adaptivesteps(1), - initial_adaptivesteps(0), + initial_adaptivesteps(0), write_interval(10), write_gmv_error(false), write_tecplot_error(false), @@ -270,9 +270,9 @@ void FEMParameters::read(GetPot &input) if (n_periodic_bcs) { - if (domaintype != "square" && - domaintype != "cylinder" && - domaintype != "file" && + if (domaintype != "square" && + domaintype != "cylinder" && + domaintype != "file" && domaintype != "od2") { libMesh::out << "Periodic boundaries need rectilinear domains" << std::endl;; @@ -346,7 +346,7 @@ void FEMParameters::read(GetPot &input) << " Dirichlet condition types does not match " << input.vector_variable_size("dirichlet_condition_values") << " Dirichlet condition values." << std::endl; - + libmesh_error(); } @@ -357,7 +357,7 @@ void FEMParameters::read(GetPot &input) << " Dirichlet condition types does not match " << input.vector_variable_size("dirichlet_condition_boundaries") << " Dirichlet condition boundaries." << std::endl; - + libmesh_error(); } @@ -368,7 +368,7 @@ void FEMParameters::read(GetPot &input) << " Dirichlet condition types does not match " << input.vector_variable_size("dirichlet_condition_variables") << " Dirichlet condition variables sets." << std::endl; - + libmesh_error(); } @@ -395,7 +395,7 @@ void FEMParameters::read(GetPot &input) dirichlet_condition_variables[func_boundary].push_back(j); else if (variable_set[j] != '0') { - libMesh::out << "Unable to understand Dirichlet variable set" + libMesh::out << "Unable to understand Dirichlet variable set" << variable_set << std::endl; libmesh_error(); } @@ -417,7 +417,7 @@ void FEMParameters::read(GetPot &input) << " Neumann condition types does not match " << input.vector_variable_size("neumann_condition_values") << " Neumann condition values." << std::endl; - + libmesh_error(); } @@ -428,7 +428,7 @@ void FEMParameters::read(GetPot &input) << " Neumann condition types does not match " << input.vector_variable_size("neumann_condition_boundaries") << " Neumann condition boundaries." << std::endl; - + libmesh_error(); } @@ -439,7 +439,7 @@ void FEMParameters::read(GetPot &input) << " Neumann condition types does not match " << input.vector_variable_size("neumann_condition_variables") << " Neumann condition variables sets." << std::endl; - + libmesh_error(); } @@ -466,7 +466,7 @@ void FEMParameters::read(GetPot &input) neumann_condition_variables[func_boundary].push_back(j); else if (variable_set[j] != '0') { - libMesh::out << "Unable to understand Neumann variable set" + libMesh::out << "Unable to understand Neumann variable set" << variable_set << std::endl; libmesh_error(); } @@ -487,7 +487,7 @@ void FEMParameters::read(GetPot &input) << " initial condition types does not match " << input.vector_variable_size("initial_condition_values") << " initial condition values." << std::endl; - + libmesh_error(); } @@ -498,7 +498,7 @@ void FEMParameters::read(GetPot &input) << " initial condition types does not match " << input.vector_variable_size("initial_condition_subdomains") << " initial condition subdomains." << std::endl; - + libmesh_error(); } @@ -532,7 +532,7 @@ void FEMParameters::read(GetPot &input) << " other interior function types does not match " << input.vector_variable_size("other_interior_function_values") << " other interior function values." << std::endl; - + libmesh_error(); } @@ -543,7 +543,7 @@ void FEMParameters::read(GetPot &input) << " other interior function types does not match " << input.vector_variable_size("other_interior_function_subdomains") << " other interior function subdomains." << std::endl; - + libmesh_error(); } @@ -554,7 +554,7 @@ void FEMParameters::read(GetPot &input) << " other interior function types does not match " << input.vector_variable_size("other_interior_function_ids") << " other interior function ids." << std::endl; - + libmesh_error(); } @@ -591,7 +591,7 @@ void FEMParameters::read(GetPot &input) << " other boundary function types does not match " << input.vector_variable_size("other_boundary_function_values") << " other boundary function values." << std::endl; - + libmesh_error(); } @@ -602,7 +602,7 @@ void FEMParameters::read(GetPot &input) << " other boundary function types does not match " << input.vector_variable_size("other_boundary_function_boundaries") << " other boundary function boundaries." << std::endl; - + libmesh_error(); } @@ -613,7 +613,7 @@ void FEMParameters::read(GetPot &input) << " other boundary function types does not match " << input.vector_variable_size("other_boundary_function_ids") << " other boundary function ids." << std::endl; - + libmesh_error(); } diff --git a/examples/adjoints/adjoints_ex5/heatsystem.C b/examples/adjoints/adjoints_ex5/heatsystem.C index 22869c4e697..de8388f5919 100644 --- a/examples/adjoints/adjoints_ex5/heatsystem.C +++ b/examples/adjoints/adjoints_ex5/heatsystem.C @@ -44,9 +44,9 @@ void HeatSystem::init_data () std::ifstream i("heat.in"); if (!i) { - std::cerr << '[' << libMesh::processor_id() - << "] Can't find heat.in; exiting early." - << std::endl; + std::cerr << '[' << libMesh::processor_id() + << "] Can't find heat.in; exiting early." + << std::endl; libmesh_error(); } } @@ -70,7 +70,7 @@ void HeatSystem::init_data () this->get_dof_map().add_dirichlet_boundary (DirichletBoundary (all_bdys, T_only, &zero)); - + FEMSystem::init_data(); } @@ -82,7 +82,7 @@ void HeatSystem::init_context(DiffContext &context) // Now make sure we have requested all the data // we need to build the linear system. - c.element_fe_var[0]->get_JxW(); + c.element_fe_var[0]->get_JxW(); c.element_fe_var[0]->get_dphi(); // We'll have a more automatic solution to preparing adjoint @@ -91,12 +91,12 @@ void HeatSystem::init_context(DiffContext &context) { // A reference to the system context is built with const System & sys = c.get_system(); - + // Get a pointer to the adjoint solution vector NumericVector &adjoint_solution = const_cast(sys).get_adjoint_solution(0); - // Add this adjoint solution to the vectors that diff context should localize + // Add this adjoint solution to the vectors that diff context should localize c.add_localized_vector(adjoint_solution, sys); } @@ -126,7 +126,7 @@ bool HeatSystem::element_time_derivative (bool request_jacobian, optassert(c.dof_indices_var.size() > 0); // The number of local degrees of freedom in each variable - const unsigned int n_u_dofs = c.dof_indices_var[0].size(); + const unsigned int n_u_dofs = c.dof_indices_var[0].size(); // The subvectors and submatrices we need to fill: DenseSubMatrix &K = *c.elem_subjacobians[0][0]; @@ -152,7 +152,7 @@ bool HeatSystem::element_time_derivative (bool request_jacobian, for (unsigned int j=0; j != n_u_dofs; ++j) K(i,j) += JxW[qp] * -parameters[0] * (dphi[i][qp] * dphi[j][qp]); } // end of the quadrature point qp-loop - + return compute_jacobian; } @@ -160,33 +160,33 @@ bool HeatSystem::element_time_derivative (bool request_jacobian, void HeatSystem::perturb_accumulate_residuals(const ParameterVector& parameters_in) { const unsigned int Np = parameters_in.size(); - + for (unsigned int j=0; j != Np; ++j) { Number old_parameter = *parameters_in[j]; - + *parameters_in[j] = old_parameter - dp; this->assembly(true, false); - this->rhs->close(); - - AutoPtr > R_minus = this->rhs->clone(); + this->rhs->close(); + + AutoPtr > R_minus = this->rhs->clone(); // The contribution at a single time step would be [f(z;p+dp) - (p+dp) - (p+dp)] * dt - // But since we compute the residual already scaled by dt, there is no need for the * dt + // But since we compute the residual already scaled by dt, there is no need for the * dt R_minus_dp += -R_minus->dot(this->get_adjoint_solution(0)); - + *parameters_in[j] = old_parameter + dp; this->assembly(true, false); this->rhs->close(); - AutoPtr > R_plus = this->rhs->clone(); - + AutoPtr > R_plus = this->rhs->clone(); + R_plus_dp += -R_plus->dot(this->get_adjoint_solution(0)); - + *parameters_in[j] = old_parameter; } diff --git a/examples/adjoints/adjoints_ex5/heatsystem.h b/examples/adjoints/adjoints_ex5/heatsystem.h index ecfbaa3575e..9377f4de0e9 100644 --- a/examples/adjoints/adjoints_ex5/heatsystem.h +++ b/examples/adjoints/adjoints_ex5/heatsystem.h @@ -63,13 +63,13 @@ class HeatSystem : public FEMSystem { parameter_vector[i] = ¶meters[i]; } - + return parameter_vector; } Number &get_QoI_value(unsigned int QoI_index) { - return computed_QoI[QoI_index]; + return computed_QoI[QoI_index]; } protected: @@ -92,11 +92,11 @@ class HeatSystem : public FEMSystem virtual void element_qoi_derivative (DiffContext &context, const QoISet & /* qois */); - //virtual void element_qoi (DiffContext &context, const QoISet & qois); + //virtual void element_qoi (DiffContext &context, const QoISet & qois); // Parameters associated with the system std::vector parameters; - + // The ParameterVector object that will contain pointers to // the system parameters ParameterVector parameter_vector; @@ -129,5 +129,5 @@ class HeatSystem : public FEMSystem // The final computed sensitivity Number final_sensitivity; - + }; diff --git a/examples/adjoints/adjoints_ex5/initial.C b/examples/adjoints/adjoints_ex5/initial.C index 8a0304d8030..ab6e555ecd3 100644 --- a/examples/adjoints/adjoints_ex5/initial.C +++ b/examples/adjoints/adjoints_ex5/initial.C @@ -38,7 +38,7 @@ Number initial_value(const Point& p, const std::string&) { Real x = p(0), y = p(1); - + return sin(M_PI * x) * sin(M_PI * y); } @@ -52,5 +52,5 @@ Gradient initial_grad(const Point& p, Real x = p(0), y = p(1); return Gradient(M_PI*cos(M_PI * x) * sin(M_PI * y), - M_PI*sin(M_PI * x) * cos(M_PI * y)); + M_PI*sin(M_PI * x) * cos(M_PI * y)); } diff --git a/examples/eigenproblems/eigenproblems_ex1/eigenproblems_ex1.C b/examples/eigenproblems/eigenproblems_ex1/eigenproblems_ex1.C index 23dbe175645..f94bfc72b1b 100644 --- a/examples/eigenproblems/eigenproblems_ex1/eigenproblems_ex1.C +++ b/examples/eigenproblems/eigenproblems_ex1/eigenproblems_ex1.C @@ -21,7 +21,7 @@ // // This example introduces the EigenSystem and shows // how libMesh can be used for eigenvalue analysis. -// +// // For solving eigen problems, libMesh interfaces // SLEPc (www.grycap.upv.es/slepc/) which again is based on PETSc. // Hence, this example will only work if the library is compiled @@ -82,15 +82,15 @@ int main (int argc, char** argv) << std::endl; libmesh_error(); } - + // Tell the user what we are doing. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; i("eigenpairs") = nev; equation_systems.parameters.set("basis vectors") = nev*3; - // You may optionally change the default eigensolver used by SLEPc. + // You may optionally change the default eigensolver used by SLEPc. // The Krylov-Schur method is mathematically equivalent to implicitly // restarted Arnoldi, the method of Arpack, so there is currently no // point in using SLEPc with Arpack. // ARNOLDI = default in SLEPc 2.3.1 and earlier // KRYLOVSCHUR default in SLEPc 2.3.2 and later - // eigen_system.eigen_solver->set_eigensolver_type(KRYLOVSCHUR); + // eigen_system.eigen_solver->set_eigensolver_type(KRYLOVSCHUR); - // Set the solver tolerance and the maximum number of iterations. + // Set the solver tolerance and the maximum number of iterations. equation_systems.parameters.set ("linear solver tolerance") = pow(TOLERANCE, 5./3.); equation_systems.parameters.set @@ -157,7 +157,7 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + // Solve the system "Eigensystem". eigen_system.solve(); @@ -171,7 +171,7 @@ int main (int argc, char** argv) if (nconv != 0) { eigen_system.get_eigenpair(nconv-1); - + #ifdef LIBMESH_HAVE_EXODUS_API // Write the eigen vector to file. ExodusII_IO (mesh).write_equation_systems ("out.e", equation_systems); @@ -182,7 +182,7 @@ int main (int argc, char** argv) std::cout << "WARNING: Solver did not converge!\n" << nconv << std::endl; } - // All done. + // All done. return 0; } @@ -194,7 +194,7 @@ int main (int argc, char** argv) void assemble_mass(EquationSystems& es, const std::string& system_name) { - + // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Eigensystem"); @@ -222,7 +222,7 @@ void assemble_mass(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Use the default quadrature order. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -230,7 +230,7 @@ void assemble_mass(EquationSystems& es, // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. @@ -262,7 +262,7 @@ void assemble_mass(EquationSystems& es, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { // Store a pointer to the element we are currently @@ -291,7 +291,7 @@ void assemble_mass(EquationSystems& es, // Now loop over the quadrature points. This handles // the numeric integration. - // + // // We will build the element matrix. This involves // a double loop to integrate the test funcions (i) against // the trial functions (j). @@ -299,7 +299,7 @@ void assemble_mass(EquationSystems& es, for (unsigned int i=0; iEigenproblems Example 2 - Solving a generalized Eigen Problem // -// This example shows how the previous EigenSolver example +// This example shows how the previous EigenSolver example // can be adapted to solve generailzed eigenvalue problems. -// +// // For solving eigen problems, libMesh interfaces // SLEPc (www.grycap.upv.es/slepc/) which again is based on PETSc. // Hence, this example will only work if the library is compiled @@ -86,15 +86,15 @@ int main (int argc, char** argv) << std::endl; libmesh_error(); } - + // Tell the user what we are doing. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; i("eigenpairs") = nev; equation_systems.parameters.set("basis vectors") = nev*3; - // You may optionally change the default eigensolver used by SLEPc. + // You may optionally change the default eigensolver used by SLEPc. // The Krylov-Schur method is mathematically equivalent to implicitly // restarted Arnoldi, the method of Arpack, so there is currently no // point in using SLEPc with Arpack. // ARNOLDI = default in SLEPc 2.3.1 and earlier // KRYLOVSCHUR default in SLEPc 2.3.2 and later - // eigen_system.eigen_solver->set_eigensolver_type(KRYLOVSCHUR); + // eigen_system.eigen_solver->set_eigensolver_type(KRYLOVSCHUR); - // Set the solver tolerance and the maximum number of iterations. + // Set the solver tolerance and the maximum number of iterations. equation_systems.parameters.set("linear solver tolerance") = pow(TOLERANCE, 5./3.); equation_systems.parameters.set ("linear solver maximum iterations") = 1000; @@ -168,7 +168,7 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + // Solve the system "Eigensystem". eigen_system.solve(); @@ -182,7 +182,7 @@ int main (int argc, char** argv) if (nconv != 0) { eigen_system.get_eigenpair(nconv-1); - + #ifdef LIBMESH_HAVE_EXODUS_API // Write the eigen vector to file. ExodusII_IO (mesh).write_equation_systems ("out.e", equation_systems); @@ -195,7 +195,7 @@ int main (int argc, char** argv) #endif // LIBMESH_HAVE_SLEPC - // All done. + // All done. return 0; } @@ -204,7 +204,7 @@ int main (int argc, char** argv) void assemble_mass(EquationSystems& es, const std::string& system_name) { - + // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Eigensystem"); @@ -233,7 +233,7 @@ void assemble_mass(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Use the default quadrature order. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -241,7 +241,7 @@ void assemble_mass(EquationSystems& es, // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. @@ -274,7 +274,7 @@ void assemble_mass(EquationSystems& es, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { // Store a pointer to the element we are currently @@ -304,7 +304,7 @@ void assemble_mass(EquationSystems& es, // Now loop over the quadrature points. This handles // the numeric integration. - // + // // We will build the element matrix. This involves // a double loop to integrate the test funcions (i) against // the trial functions (j). @@ -344,27 +344,3 @@ void assemble_mass(EquationSystems& es, return; } - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/eigenproblems/eigenproblems_ex3/eigenproblems_ex3.C b/examples/eigenproblems/eigenproblems_ex3/eigenproblems_ex3.C index ed001023b09..7b4d97a7d29 100644 --- a/examples/eigenproblems/eigenproblems_ex3/eigenproblems_ex3.C +++ b/examples/eigenproblems/eigenproblems_ex3/eigenproblems_ex3.C @@ -114,10 +114,10 @@ int main (int argc, char** argv) // Tell the user what we are doing. { std::cout << "Running " << argv[0]; - + for (int i=1; i("eigenpairs") = n_evals; equation_systems.parameters.set("basis vectors") = n_evals*3; - // Set the solver tolerance and the maximum number of iterations. + // Set the solver tolerance and the maximum number of iterations. equation_systems.parameters.set("linear solver tolerance") = pow(TOLERANCE, 5./3.); equation_systems.parameters.set ("linear solver maximum iterations") = 1000; @@ -220,11 +220,11 @@ int main (int argc, char** argv) for(unsigned int i=0; i eval = eigen_system.get_eigenpair(i); - + // The eigenvalues should be real! libmesh_assert_less (eval.second, TOLERANCE); evals_file << eval.first << std::endl; - + // plot the specified eigenvector if(i == plotting_index) { @@ -236,12 +236,12 @@ int main (int argc, char** argv) #endif // #ifdef LIBMESH_HAVE_EXODUS_API } } - + evals_file.close(); #endif // LIBMESH_HAVE_SLEPC - // All done. + // All done. return 0; } @@ -250,7 +250,7 @@ int main (int argc, char** argv) void assemble_matrices(EquationSystems& es, const std::string& system_name) { - + // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Eigensystem"); @@ -279,7 +279,7 @@ void assemble_matrices(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Use the default quadrature order. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -287,7 +287,7 @@ void assemble_matrices(EquationSystems& es, // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. @@ -320,7 +320,7 @@ void assemble_matrices(EquationSystems& es, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { // Store a pointer to the element we are currently @@ -350,7 +350,7 @@ void assemble_matrices(EquationSystems& es, // Now loop over the quadrature points. This handles // the numeric integration. - // + // // We will build the element matrix. This involves // a double loop to integrate the test funcions (i) against // the trial functions (j). @@ -415,7 +415,7 @@ void get_dirichlet_dofs(EquationSystems& es, // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. FEType fe_type = eigen_system.get_dof_map().variable_type(0); - + const DofMap& dof_map = eigen_system.get_dof_map(); // This vector will hold the degree of freedom indices for @@ -432,7 +432,7 @@ void get_dirichlet_dofs(EquationSystems& es, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { // Store a pointer to the element we are currently @@ -469,4 +469,3 @@ void get_dirichlet_dofs(EquationSystems& es, return; } - diff --git a/examples/fem_system/fem_system_ex1/fem_system_ex1.C b/examples/fem_system/fem_system_ex1/fem_system_ex1.C index bd1b5d21b0c..f51dceb7c00 100644 --- a/examples/fem_system/fem_system_ex1/fem_system_ex1.C +++ b/examples/fem_system/fem_system_ex1/fem_system_ex1.C @@ -86,13 +86,13 @@ int main (int argc, char** argv) // Skip higher-dimensional examples on a lower-dimensional libMesh build libmesh_example_assert(dim <= LIBMESH_DIM, "2D/3D support"); - + // We have only defined 2 and 3 dimensional problems libmesh_assert (dim == 2 || dim == 3); // Create a mesh. Mesh mesh; - + // And an object to refine it MeshRefinement mesh_refinement(mesh); mesh_refinement.coarsen_by_parents() = true; @@ -133,7 +133,7 @@ int main (int argc, char** argv) EquationSystems equation_systems (mesh); // Declare the system "Navier-Stokes" and its variables. - NavierSystem & system = + NavierSystem & system = equation_systems.add_system ("Navier-Stokes"); // Solve this as a time-dependent or steady system @@ -165,7 +165,7 @@ int main (int argc, char** argv) infile("relative_residual_tolerance", 0.0); solver.absolute_residual_tolerance = infile("absolute_residual_tolerance", 0.0); - + // And the linear solver options solver.max_linear_iterations = infile("max_linear_iterations", 50000); @@ -241,7 +241,7 @@ int main (int argc, char** argv) Real global_error = error.l2_norm(); std::cout << "Adaptive step " << a_step << ": " << std::endl; if (global_tolerance != 0.) - std::cout << "Global_error = " << global_error + std::cout << "Global_error = " << global_error << std::endl; if (global_tolerance != 0.) std::cout << "Worst element error = " << error.maximum() @@ -304,15 +304,15 @@ int main (int argc, char** argv) << ".e"; ExodusII_IO(mesh).write_timestep(file_name.str(), - equation_systems, - 1, /* This number indicates how many time steps + equation_systems, + 1, /* This number indicates how many time steps are being written to the file */ system.time); } #endif // #ifdef LIBMESH_HAVE_EXODUS_API } #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. + + // All done. return 0; } diff --git a/examples/fem_system/fem_system_ex1/naviersystem.C b/examples/fem_system/fem_system_ex1/naviersystem.C index 3f90fc55ea5..3691ce42fd5 100644 --- a/examples/fem_system/fem_system_ex1/naviersystem.C +++ b/examples/fem_system/fem_system_ex1/naviersystem.C @@ -109,7 +109,7 @@ void NavierSystem::init_data () static_cast(pressure_p), fefamily); - // Tell the system to march velocity forward in time, but + // Tell the system to march velocity forward in time, but // leave p as a constraint only this->time_evolving(u_var); this->time_evolving(v_var); @@ -124,7 +124,7 @@ void NavierSystem::init_data () // Set Dirichlet boundary conditions const boundary_id_type top_id = (dim==3) ? 5 : 2; - + std::set top_bdys; top_bdys.insert(top_id); @@ -193,7 +193,7 @@ void NavierSystem::init_context(DiffContext &context) u_elem_fe->get_phi(); u_elem_fe->get_dphi(); u_elem_fe->get_xyz(); - + p_elem_fe->get_phi(); u_side_fe->get_JxW(); @@ -235,8 +235,8 @@ bool NavierSystem::element_time_derivative (bool request_jacobian, // The number of local degrees of freedom in each variable const unsigned int n_p_dofs = c.get_dof_indices( p_var ).size(); - const unsigned int n_u_dofs = c.get_dof_indices( u_var ).size(); - libmesh_assert_equal_to (n_u_dofs, c.get_dof_indices( v_var ).size()); + const unsigned int n_u_dofs = c.get_dof_indices( u_var ).size(); + libmesh_assert_equal_to (n_u_dofs, c.get_dof_indices( v_var ).size()); // The subvectors and submatrices we need to fill: const unsigned int dim = this->get_mesh().mesh_dimension(); @@ -255,7 +255,7 @@ bool NavierSystem::element_time_derivative (bool request_jacobian, DenseSubVector &Fu = c.get_elem_residual( u_var ); DenseSubVector &Fv = c.get_elem_residual( v_var ); DenseSubVector &Fw = c.get_elem_residual( w_var ); - + // Now we will build the element Jacobian and residual. // Constructing the residual requires the solution and its // gradient from the previous timestep. This must be @@ -305,7 +305,7 @@ bool NavierSystem::element_time_derivative (bool request_jacobian, f(0)*phi[i][qp] // forcing function ); - + Fv(i) += JxW[qp] * (-Reynolds*(U*grad_v)*phi[i][qp] + // convection term p*dphi[i][qp](1) - // pressure term @@ -346,7 +346,7 @@ bool NavierSystem::element_time_derivative (bool request_jacobian, /* diffusion term */ (dphi[i][qp]*dphi[j][qp]) - /* Newton term */ Reynolds*v_y*phi[i][qp]*phi[j][qp]); - Kvu(i,j) += JxW[qp] * + Kvu(i,j) += JxW[qp] * /* Newton term */ -Reynolds*v_x*phi[i][qp]*phi[j][qp]; if (dim == 3) { @@ -376,7 +376,7 @@ bool NavierSystem::element_time_derivative (bool request_jacobian, } } } // end of the quadrature point qp-loop - + return request_jacobian; } @@ -455,7 +455,7 @@ bool NavierSystem::element_constraint (bool request_jacobian, return request_jacobian; } - + bool NavierSystem::side_constraint (bool request_jacobian, DiffContext &context) @@ -476,7 +476,7 @@ bool NavierSystem::side_constraint (bool request_jacobian, DenseSubMatrix &Kpp = c.get_elem_jacobian( p_var, p_var ); DenseSubVector &Fp = c.get_elem_residual( p_var ); - const unsigned int n_p_dofs = c.get_dof_indices( p_var ).size(); + const unsigned int n_p_dofs = c.get_dof_indices( p_var ).size(); Number p = c.point_value(p_var, zero); Number p_value = 0.; @@ -602,7 +602,7 @@ bool NavierSystem::mass_residual (bool request_jacobian, void NavierSystem::postprocess() -{ +{ const unsigned int dim = this->get_mesh().mesh_dimension(); Point p(1./3., 1./3.); @@ -610,9 +610,9 @@ void NavierSystem::postprocess() v = point_value(v_var, p), w = (dim == 3) ? point_value(w_var, p) : 0; - std::cout << "u(1/3,1/3) = (" - << u << ", " - << v << ", " + std::cout << "u(1/3,1/3) = (" + << u << ", " + << v << ", " << w << ")" << std::endl; } diff --git a/examples/fem_system/fem_system_ex2/fem_system_ex2.C b/examples/fem_system/fem_system_ex2/fem_system_ex2.C index fc944b1e364..7c8bd2cbebe 100644 --- a/examples/fem_system/fem_system_ex2/fem_system_ex2.C +++ b/examples/fem_system/fem_system_ex2/fem_system_ex2.C @@ -46,7 +46,7 @@ void setup(EquationSystems& systems, Mesh& mesh, GetPot& args) { const unsigned int dim = mesh.mesh_dimension(); // We currently invert tensors with the assumption that they're 3x3 - libmesh_assert (dim == 3); + libmesh_assert (dim == 3); // Generating Mesh ElemType eltype = Utility::string_to_enum(args("mesh/generation/element_type", "hex8")); @@ -175,4 +175,3 @@ int main(int argc, char** argv) out << "Finished calculations" << std::endl; return 0; } - diff --git a/examples/fem_system/fem_system_ex2/nonlinear_neohooke_cc.h b/examples/fem_system/fem_system_ex2/nonlinear_neohooke_cc.h index 688ed8ca93e..469a271d799 100644 --- a/examples/fem_system/fem_system_ex2/nonlinear_neohooke_cc.h +++ b/examples/fem_system/fem_system_ex2/nonlinear_neohooke_cc.h @@ -83,4 +83,3 @@ class NonlinearNeoHookeCurrentConfig { }; #endif /* NONLINEAR_NEOHOOKE_CC_H_ */ - diff --git a/examples/fem_system/fem_system_ex2/solid_system.C b/examples/fem_system/fem_system_ex2/solid_system.C index 3bfb65f7290..1216481660e 100644 --- a/examples/fem_system/fem_system_ex2/solid_system.C +++ b/examples/fem_system/fem_system_ex2/solid_system.C @@ -367,4 +367,3 @@ bool SolidSystem::side_time_derivative(bool request_jacobian, return request_jacobian; } - diff --git a/examples/introduction/introduction_ex1/introduction_ex1.C b/examples/introduction/introduction_ex1/introduction_ex1.C index 9f05e8a5edd..4f81d785467 100644 --- a/examples/introduction/introduction_ex1/introduction_ex1.C +++ b/examples/introduction/introduction_ex1/introduction_ex1.C @@ -16,7 +16,7 @@ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //

Introduction Example 1 - Creation of a Mesh Object

- // + // // This is the first example program. It simply demonstrates // how to create a mesh object. A mesh is read from file, // information is printed to the screen, and the mesh is then @@ -51,28 +51,28 @@ int main (int argc, char** argv) if (libMesh::processor_id() == 0) std::cerr << "Usage: " << argv[0] << " -d 2 in.mesh [-o out.mesh]" << std::endl; - + // This handy function will print the file name, line number, // and then abort. Currently the library does not use C++ // exception handling. libmesh_error(); } - + // Get the dimensionality of the mesh from argv[2] const unsigned int dim = std::atoi(argv[2]); // Skip higher-dimensional examples on a lower-dimensional libMesh build libmesh_example_assert(dim <= LIBMESH_DIM, "2D/3D support"); - + // Create a mesh Mesh mesh; - + // Read the input mesh. mesh.read (argv[3]); - + // Print information about the mesh to the screen. mesh.print_info(); - + // Write the output mesh if the user specified an // output file name. if (argc >= 6 && std::string("-o") == argv[4]) diff --git a/examples/introduction/introduction_ex2/introduction_ex2.C b/examples/introduction/introduction_ex2/introduction_ex2.C index 3658e9eea10..5147bc4794a 100644 --- a/examples/introduction/introduction_ex2/introduction_ex2.C +++ b/examples/introduction/introduction_ex2/introduction_ex2.C @@ -35,7 +35,7 @@ // to see what PETSc is doing behind the scenes or // // ./introduction_ex2 -log_summary - // + // // to get a summary of what PETSc did. // Among other things, libMesh::init() initializes the MPI // communications library and PETSc numeric library on your system if @@ -66,17 +66,17 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // A brief message to the user to inform her of the // exact name of the program being run, and its command line. std::cout << "Running " << argv[0]; for (int i=1; i ("test") = true; - + // Set a simulation-specific parameter visible for all systems. // This helps in inter-system-communication. equation_systems.parameters.set ("dummy") = 42.; - - // Set another simulation-specific parameter + + // Set another simulation-specific parameter equation_systems.parameters.set ("nobody") = 0.; - + // Now we declare the system and its variables. // We begin by adding a "TransientLinearImplicitSystem" to the // EquationSystems object, and we give it the name // "Simple System". equation_systems.add_system ("Simple System"); - + // Adds the variable "u" to "Simple System". "u" // will be approximated using first-order approximation. equation_systems.get_system("Simple System").add_variable("u", FIRST); @@ -121,16 +121,16 @@ int main (int argc, char** argv) equation_systems.add_system ("Complex System"); // Give "Complex System" three variables -- each with a different approximation - // order. Variables "c" and "T" will use first-order Lagrange approximation, + // order. Variables "c" and "T" will use first-order Lagrange approximation, // while variable "dv" will use a second-order discontinuous // approximation space. equation_systems.get_system("Complex System").add_variable("c", FIRST); equation_systems.get_system("Complex System").add_variable("T", FIRST); equation_systems.get_system("Complex System").add_variable("dv", SECOND, MONOMIAL); - + // Initialize the data structures for the equation system. equation_systems.init(); - + // Print information about the mesh to the screen. mesh.print_info(); // Prints information about the system to the screen. @@ -152,16 +152,16 @@ int main (int argc, char** argv) { std::cout << "<<< Writing system to file " << argv[1] << std::endl; - + // Write the system. equation_systems.write (argv[1], libMeshEnums::WRITE); - + // Clear the equation systems data structure. equation_systems.clear (); std::cout << ">>> Reading system from file " << argv[1] << std::endl << std::endl; - + // Read the file we just wrote. This better // work! equation_systems.read (argv[1], libMeshEnums::READ); @@ -169,7 +169,7 @@ int main (int argc, char** argv) // Print the information again. equation_systems.print_info(); } - + // All done. libMesh objects are destroyed here. Because the // LibMeshInit object was created first, its destruction occurs // last, and it's destructor finalizes any external libraries and diff --git a/examples/introduction/introduction_ex3/exact_solution.C b/examples/introduction/introduction_ex3/exact_solution.C index 7fba9e671eb..b839e3f8efe 100644 --- a/examples/introduction/introduction_ex3/exact_solution.C +++ b/examples/introduction/introduction_ex3/exact_solution.C @@ -1,16 +1,16 @@ // The libMesh Finite Element Library. // Copyright (C) 2003 Benjamin S. Kirk - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/examples/introduction/introduction_ex3/introduction_ex3.C b/examples/introduction/introduction_ex3/introduction_ex3.C index 056a1789224..ad81df71e3a 100644 --- a/examples/introduction/introduction_ex3/introduction_ex3.C +++ b/examples/introduction/introduction_ex3/introduction_ex3.C @@ -82,23 +82,23 @@ int main (int argc, char** argv) // Brief message to the user regarding the program name // and command line arguments. std::cout << "Running " << argv[0]; - + for (int i=1; i ("Poisson"); @@ -124,10 +124,10 @@ int main (int argc, char** argv) // function. This will be called when needed by the // library. equation_systems.get_system("Poisson").attach_assemble_function (assemble_poisson); - + // Initialize the data structures for the equation system. equation_systems.init(); - + // Prints information about the system to the screen. equation_systems.print_info(); @@ -156,7 +156,7 @@ int main (int argc, char** argv) #endif // #ifdef LIBMESH_HAVE_VTK - // All done. + // All done. return 0; } @@ -170,12 +170,12 @@ int main (int argc, char** argv) void assemble_poisson(EquationSystems& es, const std::string& system_name) { - + // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Poisson"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -190,11 +190,11 @@ void assemble_poisson(EquationSystems& es, // to degree of freedom numbers. We will talk more about the DofMap // in future examples. const DofMap& dof_map = system.get_dof_map(); - + // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. FEType fe_type = dof_map.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // FEBase::build() member dynamically creates memory we will // store the object as an AutoPtr. This can be thought @@ -202,22 +202,22 @@ void assemble_poisson(EquationSystems& es, // describes some advantages of AutoPtr's in the context of // quadrature rules. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); - + // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - + // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, FIFTH); - + // Tell the finite element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); @@ -225,7 +225,7 @@ void assemble_poisson(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The physical XY locations of the quadrature points on the element. @@ -269,7 +269,7 @@ void assemble_poisson(EquationSystems& es, // elements; hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + // Loop over the elements. Note that ++el is preferred to // el++ since the latter requires an unnecessary temporary // object. @@ -319,7 +319,7 @@ void assemble_poisson(EquationSystems& es, { Ke(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]); } - + // This is the end of the matrix summation loop // Now we build the element right-hand-side contribution. // This involves a single loop in which we integrate the @@ -328,7 +328,7 @@ void assemble_poisson(EquationSystems& es, const Real x = q_point[qp](0); const Real y = q_point[qp](1); const Real eps = 1.e-3; - + // "fxy" is the forcing function for the Poisson equation. // In this case we set fxy to be a finite difference @@ -349,12 +349,12 @@ void assemble_poisson(EquationSystems& es, exact_solution(x-eps,y) + exact_solution(x+eps,y) - 4.*exact_solution(x,y))/eps/eps; - + for (unsigned int i=0; i >& phi_face = fe_face->get_phi(); - + // The Jacobian * Quadrature Weight at the quadrature // points on the face. const std::vector& JxW_face = fe_face->get_JxW(); - + // The XYZ locations (in physical space) of the // quadrature points on the face. This is where // we will interpolate the boundary value function. const std::vector& qface_point = fe_face->get_xyz(); - + // Compute the shape function values on the element // face. fe_face->reinit(elem, side); - + // Loop over the face quadrature points for integration. for (unsigned int qp=0; qpadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } - + // All done! } diff --git a/examples/introduction/introduction_ex4/Makefile.am b/examples/introduction/introduction_ex4/Makefile.am index 3dc9cb3e55e..6e080b02fd2 100644 --- a/examples/introduction/introduction_ex4/Makefile.am +++ b/examples/introduction/introduction_ex4/Makefile.am @@ -1,6 +1,6 @@ BUILT_SOURCES = exact_solution.C DISTCLEANFILES = $(BUILT_SOURCES) -exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C +exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C $(AM_V_GEN)$(LN_S) $< $@ example_name = introduction_ex4 diff --git a/examples/introduction/introduction_ex4/introduction_ex4.C b/examples/introduction/introduction_ex4/introduction_ex4.C index 8ed909e28a2..c4039f2e6f2 100644 --- a/examples/introduction/introduction_ex4/introduction_ex4.C +++ b/examples/introduction/introduction_ex4/introduction_ex4.C @@ -118,10 +118,10 @@ int main (int argc, char** argv) // Declare a performance log for the main program // PerfLog perf_main("Main Program"); - + // Create a GetPot object to parse the command line GetPot command_line (argc, argv); - + // Check for proper calling arguments. if (argc < 3) { @@ -135,19 +135,19 @@ int main (int argc, char** argv) // exception handling. libmesh_error(); } - + // Brief message to the user regarding the program name // and command line arguments. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; i ("Poisson"); - + // Add the variable "u" to "Poisson". "u" // will be approximated using second-order approximation. unsigned int u_var = system.add_variable("u", @@ -248,7 +248,7 @@ int main (int argc, char** argv) system.attach_assemble_function (assemble_poisson); // Construct a Dirichlet boundary condition object - + // Indicate which boundary IDs we impose the BC on // We either build a line, a square or a cube, and // here we indicate the boundaries IDs in each case @@ -272,16 +272,16 @@ int main (int argc, char** argv) // Create a vector storing the variable numbers which the BC applies to std::vector variables(1); variables[0] = u_var; - + // Create an AnalyticFunction object that we use to project the BC // This function just calls the function exact_solution via exact_solution_wrapper AnalyticFunction<> exact_solution_object(exact_solution_wrapper); - + DirichletBoundary dirichlet_bc(boundary_ids, variables, &exact_solution_object); - // We must add the Dirichlet boundary condition _before_ + // We must add the Dirichlet boundary condition _before_ // we call equation_systems.init() system.get_dof_map().add_dirichlet_boundary(dirichlet_bc); @@ -299,19 +299,19 @@ int main (int argc, char** argv) // After solving the system write the solution // to a GMV-formatted plot file. if(dim == 1) - { + { GnuPlotIO plot(mesh,"Introduction Example 4, 1D",GnuPlotIO::GRID_ON); plot.write_equation_systems("gnuplot_script",equation_systems); } #ifdef LIBMESH_HAVE_EXODUS_API else { - ExodusII_IO (mesh).write_equation_systems ((dim == 3) ? + ExodusII_IO (mesh).write_equation_systems ((dim == 3) ? "out_3.e" : "out_2.e",equation_systems); } #endif // #ifdef LIBMESH_HAVE_EXODUS_API - - // All done. + + // All done. return 0; } @@ -335,7 +335,7 @@ void assemble_poisson(EquationSystems& es, // logging, since there may be many PerfLogs in an // application. PerfLog perf_log ("Matrix Assembly"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -344,7 +344,7 @@ void assemble_poisson(EquationSystems& es, // Get a reference to the LinearImplicitSystem we are solving LinearImplicitSystem& system = es.get_system("Poisson"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -360,7 +360,7 @@ void assemble_poisson(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); @@ -370,12 +370,12 @@ void assemble_poisson(EquationSystems& es, // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, FIFTH); - + // Tell the finte element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); @@ -383,7 +383,7 @@ void assemble_poisson(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); // The physical XY locations of the quadrature points on the element. @@ -422,7 +422,7 @@ void assemble_poisson(EquationSystems& es, // Start logging the shape function initialization. // This is done through a simple function call with // the name of the event to log. - perf_log.push("elem init"); + perf_log.push("elem init"); // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. @@ -454,7 +454,7 @@ void assemble_poisson(EquationSystems& es, // Stop logging the shape function initialization. // If you forget to stop logging an event the PerfLog // object will probably catch the error and abort. - perf_log.pop("elem init"); + perf_log.pop("elem init"); // Now we will build the element matrix. This involves // a double loop to integrate the test funcions (i) against @@ -471,7 +471,7 @@ void assemble_poisson(EquationSystems& es, for (unsigned int i=0; i 1 const Real y = q_point[qp](1); @@ -515,11 +515,11 @@ void assemble_poisson(EquationSystems& es, const Real uxx = (exact_solution(x-eps,y,z) + exact_solution(x+eps,y,z) + -2.*exact_solution(x,y,z))/eps/eps; - + const Real uyy = (exact_solution(x,y-eps,z) + exact_solution(x,y+eps,z) + -2.*exact_solution(x,y,z))/eps/eps; - + const Real uzz = (exact_solution(x,y,z-eps) + exact_solution(x,y,z+eps) + -2.*exact_solution(x,y,z))/eps/eps; @@ -535,16 +535,16 @@ void assemble_poisson(EquationSystems& es, else { fxy = - (uxx + uyy + ((dim==2) ? 0. : uzz)); - } + } // Add the RHS contribution for (unsigned int i=0; iadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); diff --git a/examples/introduction/introduction_ex5/Makefile.am b/examples/introduction/introduction_ex5/Makefile.am index 2763d850566..b54d71dfc4b 100644 --- a/examples/introduction/introduction_ex5/Makefile.am +++ b/examples/introduction/introduction_ex5/Makefile.am @@ -1,6 +1,6 @@ BUILT_SOURCES = exact_solution.C DISTCLEANFILES = $(BUILT_SOURCES) -exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C +exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C $(AM_V_GEN)$(LN_S) $< $@ example_name = introduction_ex5 diff --git a/examples/introduction/introduction_ex5/introduction_ex5.C b/examples/introduction/introduction_ex5/introduction_ex5.C index 7140589c0e6..26da77eb2c4 100644 --- a/examples/introduction/introduction_ex5/introduction_ex5.C +++ b/examples/introduction/introduction_ex5/introduction_ex5.C @@ -28,7 +28,7 @@ // C++ include files that we need #include -#include +#include #include #include @@ -108,7 +108,7 @@ int main (int argc, char** argv) { // Initialize libMesh and any dependent libaries, like in example 2. LibMeshInit init (argc, argv); - + // Check for proper usage. The quadrature rule // must be given at run time. if (argc < 3) @@ -119,41 +119,41 @@ int main (int argc, char** argv) << std::endl; std::cerr << " where n stands for:" << std::endl; - + // Note that only some of all quadrature rules are // valid choices. For example, the Jacobi quadrature // is actually a "helper" for higher-order rules, // included in QGauss. for (unsigned int n=0; n(std::atoi(argv[2])); // Skip this 3D example if libMesh was compiled as 1D-only. libmesh_example_assert(3 <= LIBMESH_DIM, "3D support"); - + // The following is identical to example 4, and therefore // not commented. Differences are mentioned when present. Mesh mesh; @@ -169,19 +169,19 @@ int main (int argc, char** argv) -1., 1., -1., 1., HEX8); - + mesh.print_info(); - + EquationSystems equation_systems (mesh); - + equation_systems.add_system ("Poisson"); - + unsigned int u_var = equation_systems.get_system("Poisson").add_variable("u", FIRST); equation_systems.get_system("Poisson").attach_assemble_function (assemble_poisson); // Construct a Dirichlet boundary condition object - + // Indicate which boundary IDs we impose the BC on // We either build a line, a square or a cube, and // here we indicate the boundaries IDs in each case @@ -197,21 +197,21 @@ int main (int argc, char** argv) // Create a vector storing the variable numbers which the BC applies to std::vector variables(1); variables[0] = u_var; - + // Create an AnalyticFunction object that we use to project the BC // This function just calls the function exact_solution via exact_solution_wrapper AnalyticFunction<> exact_solution_object(exact_solution_wrapper); - + DirichletBoundary dirichlet_bc(boundary_ids, variables, &exact_solution_object); - // We must add the Dirichlet boundary condition _before_ + // We must add the Dirichlet boundary condition _before_ // we call equation_systems.init() equation_systems.get_system("Poisson").get_dof_map().add_dirichlet_boundary(dirichlet_bc); equation_systems.init(); - + equation_systems.print_info(); equation_systems.get_system("Poisson").solve(); @@ -243,116 +243,116 @@ void assemble_poisson(EquationSystems& es, const unsigned int dim = mesh.mesh_dimension(); LinearImplicitSystem& system = es.get_system("Poisson"); - + const DofMap& dof_map = system.get_dof_map(); - + FEType fe_type = dof_map.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // \p FEBase::build() member dynamically creates memory we will // store the object as an \p AutoPtr. Below, the - // functionality of \p AutoPtr's is described more detailed in + // functionality of \p AutoPtr's is described more detailed in // the context of building quadrature rules. AutoPtr fe (FEBase::build(dim, fe_type)); - - - // Now this deviates from example 4. we create a + + + // Now this deviates from example 4. we create a // 5th order quadrature rule of user-specified type // for numerical integration. Note that not all // quadrature rules support this order. AutoPtr qrule(QBase::build(quad_type, dim, THIRD)); - + // Tell the finte element object to use our // quadrature rule. Note that a \p AutoPtr returns - // a QBase* pointer to the object it handles with \p get(). - // However, using \p get(), the \p AutoPtr \p qrule is - // still in charge of this pointer. I.e., when \p qrule goes - // out of scope, it will safely delete the \p QBase object it + // a QBase* pointer to the object it handles with \p get(). + // However, using \p get(), the \p AutoPtr \p qrule is + // still in charge of this pointer. I.e., when \p qrule goes + // out of scope, it will safely delete the \p QBase object it // points to. This behavior may be overridden using // \p AutoPtr::release(), but is currently not // recommended. fe->attach_quadrature_rule (qrule.get()); - + // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - - - // As already seen in example 3, boundary integration + + + // As already seen in example 3, boundary integration // requires a quadrature rule. Here, however, // we use the more convenient way of building this - // rule at run-time using \p quad_type. Note that one - // could also have initialized the face quadrature rules - // with the type directly determined from \p qrule, namely + // rule at run-time using \p quad_type. Note that one + // could also have initialized the face quadrature rules + // with the type directly determined from \p qrule, namely // through: // \verbatim // AutoPtr qface (QBase::build(qrule->type(), - // dim-1, + // dim-1, // THIRD)); // \endverbatim // And again: using the \p AutoPtr relaxes // the need to delete the object afterwards, // they clean up themselves. AutoPtr qface (QBase::build(quad_type, - dim-1, + dim-1, THIRD)); - - + + // Tell the finte element object to use our // quadrature rule. Note that a \p AutoPtr returns - // a \p QBase* pointer to the object it handles with \p get(). - // However, using \p get(), the \p AutoPtr \p qface is - // still in charge of this pointer. I.e., when \p qface goes - // out of scope, it will safely delete the \p QBase object it + // a \p QBase* pointer to the object it handles with \p get(). + // However, using \p get(), the \p AutoPtr \p qface is + // still in charge of this pointer. I.e., when \p qface goes + // out of scope, it will safely delete the \p QBase object it // points to. This behavior may be overridden using // \p AutoPtr::release(), but is not recommended. fe_face->attach_quadrature_rule (qface.get()); - - + + // This is again identical to example 4, and not commented. const std::vector& JxW = fe->get_JxW(); - + const std::vector& q_point = fe->get_xyz(); - + const std::vector >& phi = fe->get_phi(); - + const std::vector >& dphi = fe->get_dphi(); - + DenseMatrix Ke; DenseVector Fe; - + std::vector dof_indices; - - - - - + + + + + // Now we will loop over all the elements in the mesh. // See example 3 for details. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { const Elem* elem = *el; - + dof_map.dof_indices (elem, dof_indices); - + fe->reinit (elem); - + Ke.resize (dof_indices.size(), dof_indices.size()); - + Fe.resize (dof_indices.size()); - - + + // Now loop over the quadrature points. This handles // the numeric integration. Note the slightly different // access to the QBase members! @@ -362,8 +362,8 @@ void assemble_poisson(EquationSystems& es, for (unsigned int i=0; iadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); - + } // end of element loop - - - - + + + + // All done! return; } diff --git a/examples/miscellaneous/miscellaneous_ex1/miscellaneous_ex1.C b/examples/miscellaneous/miscellaneous_ex1/miscellaneous_ex1.C index 63d6337c6db..aa79b5d87e2 100644 --- a/examples/miscellaneous/miscellaneous_ex1/miscellaneous_ex1.C +++ b/examples/miscellaneous/miscellaneous_ex1/miscellaneous_ex1.C @@ -74,7 +74,7 @@ using namespace libMesh; // Function prototype. This is similar to the Poisson -// assemble function of example 4. +// assemble function of example 4. void assemble_wave (EquationSystems& es, const std::string& system_name); @@ -83,22 +83,22 @@ int main (int argc, char** argv) { // Initialize libMesh, like in example 2. LibMeshInit init (argc, argv); - - // This example requires Infinite Elements + + // This example requires Infinite Elements #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS libmesh_example_assert(false, "--enable-ifem"); #else - + // Skip this 3D example if libMesh was compiled as 1D/2D-only. libmesh_example_assert(3 <= LIBMESH_DIM, "3D support"); - + // Tell the user what we are doing. - std::cout << "Running ex6 with dim = 3" << std::endl << std::endl; - + std::cout << "Running ex6 with dim = 3" << std::endl << std::endl; + // Create a serialized mesh. // InfElemBuilder still requires some updates to be ParallelMesh // compatible - + SerialMesh mesh; // Use the internal mesh generator to create elements @@ -109,7 +109,7 @@ int main (int argc, char** argv) -1., 1., -1., 1., HEX8); - + // Print information about the mesh to the screen. mesh.print_info(); @@ -122,7 +122,7 @@ int main (int argc, char** argv) // libMesh, only conventional elements exist. The infinite // elements used here, however, require prescribed // nodal locations (with specified distances from an imaginary - // origin) and configurations that a conventional mesh creator + // origin) and configurations that a conventional mesh creator // in general does not offer. Therefore, an efficient method // for building infinite elements is offered. It can account // for symmetry planes and creates infinite elements in a fully @@ -131,7 +131,7 @@ int main (int argc, char** argv) // Right now, the simplified interface is used, automatically // determining the origin. Check \p MeshBase for a generalized // method that can even return the element faces of interior - // vibrating surfaces. The \p bool determines whether to be + // vibrating surfaces. The \p bool determines whether to be // verbose. InfElemBuilder builder(mesh); builder.build_inf_elem(true); @@ -145,54 +145,54 @@ int main (int argc, char** argv) ExodusII_IO(mesh).write ("ifems_added.e"); #endif - // After building infinite elements, we have to let + // After building infinite elements, we have to let // the elements find their neighbors again. mesh.find_neighbors(); - + // Create an equation systems object, where \p ThinSystem - // offers only the crucial functionality for solving a + // offers only the crucial functionality for solving a // system. Use \p ThinSystem when you want the sleekest // system possible. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Create a system named "Wave". This can // be a simple, steady system equation_systems.add_system ("Wave"); - + // Create an FEType describing the approximation // characteristics of the InfFE object. Note that // the constructor automatically defaults to some - // sensible values. But use \p FIRST order + // sensible values. But use \p FIRST order // approximation. FEType fe_type(FIRST); - + // Add the variable "p" to "Wave". Note that there exist - // various approaches in adding variables. In example 3, + // various approaches in adding variables. In example 3, // \p add_variable took the order of approximation and used - // default values for the \p FEFamily, while here the \p FEType + // default values for the \p FEFamily, while here the \p FEType // is used. equation_systems.get_system("Wave").add_variable("p", fe_type); - + // Give the system a pointer to the matrix assembly // function. equation_systems.get_system("Wave").attach_assemble_function (assemble_wave); - + // Set the speed of sound and fluid density // as \p EquationSystems parameter, // so that \p assemble_wave() can access it. equation_systems.parameters.set("speed") = 1.; equation_systems.parameters.set("fluid density") = 1.; - + // Initialize the data structures for the equation system. equation_systems.init(); - + // Prints information about the system to the screen. equation_systems.print_info(); // Solve the system "Wave". equation_systems.get_system("Wave").solve(); - + // Write the whole EquationSystems object to file. // For infinite elements, the concept of nodal_soln() // is not applicable. Therefore, writing the mesh in @@ -202,8 +202,8 @@ int main (int argc, char** argv) // determine physically correct results within an // infinite element. equation_systems.write ("eqn_sys.dat", libMeshEnums::WRITE); - - // All done. + + // All done. return 0; #endif // else part of ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS @@ -220,126 +220,126 @@ void assemble_wave(EquationSystems& es, #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); // Get a reference to the system we are solving. LinearImplicitSystem & system = es.get_system("Wave"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. const DofMap& dof_map = system.get_dof_map(); - + // The dimension that we are running. const unsigned int dim = mesh.mesh_dimension(); - + // Copy the speed of sound to a local variable. const Real speed = es.parameters.get("speed"); - + // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. const FEType& fe_type = dof_map.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // \p FEBase::build() member dynamically creates memory we will // store the object as an \p AutoPtr. Check ex5 for details. AutoPtr fe (FEBase::build(dim, fe_type)); - + // Do the same for an infinite element. AutoPtr inf_fe (FEBase::build_InfFE(dim, fe_type)); - + // A 2nd order Gauss quadrature rule for numerical integration. QGauss qrule (dim, SECOND); - - // Tell the finite element object to use our quadrature rule. + + // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - - // Due to its internal structure, the infinite element handles + + // Due to its internal structure, the infinite element handles // quadrature rules differently. It takes the quadrature // rule which has been initialized for the FE object, but // creates suitable quadrature rules by @e itself. The user - // need not worry about this. + // need not worry about this. inf_fe->attach_quadrature_rule (&qrule); - + // Define data structures to contain the element matrix // and right-hand-side vector contribution. Following // basic finite element terminology we will denote these // "Ke", "Ce", "Me", and "Fe" for the stiffness, damping - // and mass matrices, and the load vector. Note that in - // Acoustics, these descriptors though do @e not match the - // true physical meaning of the projectors. The final - // overall system, however, resembles the conventional - // notation again. + // and mass matrices, and the load vector. Note that in + // Acoustics, these descriptors though do @e not match the + // true physical meaning of the projectors. The final + // overall system, however, resembles the conventional + // notation again. DenseMatrix Ke; DenseMatrix Ce; DenseMatrix Me; DenseVector Fe; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system - // the element degrees of freedom get mapped. + // the element degrees of freedom get mapped. std::vector dof_indices; - + // Now we will loop over all the elements in the mesh. // We will compute the element matrix and right-hand-side // contribution. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently - // working on. This allows for nicer syntax later. + // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will - // contribute to. + // contribute to. dof_map.dof_indices (elem, dof_indices); - + // The mesh contains both finite and infinite elements. These // elements are handled through different classes, namely // \p FE and \p InfFE, respectively. However, since both // are derived from \p FEBase, they share the same interface, // and overall burden of coding is @e greatly reduced through // using a pointer, which is adjusted appropriately to the - // current element type. + // current element type. FEBase* cfe=NULL; - + // This here is almost the only place where we need to // distinguish between finite and infinite elements. // For faster computation, however, different approaches // may be feasible. // // Up to now, we do not know what kind of element we - // have. Aske the element of what type it is: + // have. Aske the element of what type it is: if (elem->infinite()) - { + { // We have an infinite element. Let \p cfe point // to our \p InfFE object. This is handled through // an AutoPtr. Through the \p AutoPtr::get() we "borrow" // the pointer, while the \p AutoPtr \p inf_fe is - // still in charge of memory management. - cfe = inf_fe.get(); + // still in charge of memory management. + cfe = inf_fe.get(); } else { - // This is a conventional finite element. Let \p fe handle it. + // This is a conventional finite element. Let \p fe handle it. cfe = fe.get(); - + // Boundary conditions. - // Here we just zero the rhs-vector. For natural boundary - // conditions check e.g. previous examples. - { - // Zero the RHS for this element. + // Here we just zero the rhs-vector. For natural boundary + // conditions check e.g. previous examples. + { + // Zero the RHS for this element. Fe.resize (dof_indices.size()); - + system.rhs->add_vector (Fe, dof_indices); - } // end boundary condition section + } // end boundary condition section } // else ( if (elem->infinite())) ) // This is slightly different from the Poisson solver: @@ -347,24 +347,24 @@ void assemble_wave(EquationSystems& es, // initialize the constant references to the data fields // each time again, when a new element is processed. // - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = cfe->get_JxW(); - - // The element shape functions evaluated at the quadrature points. + + // The element shape functions evaluated at the quadrature points. const std::vector >& phi = cfe->get_phi(); - + // The element shape function gradients evaluated at the quadrature - // points. + // points. const std::vector >& dphi = cfe->get_dphi(); - // The infinite elements need more data fields than conventional FE. - // These are the gradients of the phase term \p dphase, an additional + // The infinite elements need more data fields than conventional FE. + // These are the gradients of the phase term \p dphase, an additional // radial weight for the test functions \p Sobolev_weight, and its // gradient. - // + // // Note that these data fields are also initialized appropriately by // the \p FE method, so that the weak form (below) is valid for @e both - // finite and infinite elements. + // finite and infinite elements. const std::vector& dphase = cfe->get_dphase(); const std::vector& weight = cfe->get_Sobolev_weight(); const std::vector& dweight = cfe->get_Sobolev_dweight(); @@ -373,30 +373,30 @@ void assemble_wave(EquationSystems& es, // or an \p InfFE. Nice, hm? ;-) // // Compute the element-specific data, as described - // in previous examples. + // in previous examples. cfe->reinit (elem); - + // Zero the element matrices. Boundary conditions were already - // processed in the \p FE-only section, see above. + // processed in the \p FE-only section, see above. Ke.resize (dof_indices.size(), dof_indices.size()); Ce.resize (dof_indices.size(), dof_indices.size()); Me.resize (dof_indices.size(), dof_indices.size()); - + // The total number of quadrature points for infinite elements // @e has to be determined in a different way, compared to // conventional finite elements. This type of access is also // valid for finite elements, so this can safely be used // anytime, instead of asking the quadrature rule, as - // seen in previous examples. + // seen in previous examples. unsigned int max_qp = cfe->n_quadrature_points(); - - // Loop over the quadrature points. + + // Loop over the quadrature points. for (unsigned int qp=0; qpn_shape_functions(); // Now we will build the element matrices. Since the infinite @@ -411,47 +411,47 @@ void assemble_wave(EquationSystems& es, // test functions: weight[qp]*phi[i][qp] // trial functions: phi[j][qp] // phase term: phase[qp] - // + // // derivatives are similar, but note that these are of type - // Point, not of type Real. + // Point, not of type Real. for (unsigned int i=0; i #include @@ -52,7 +52,7 @@ #include "libmesh/elem.h" // Include FrequencySystem. Compared to GeneralSystem, -// this class offers added functionality for the solution of +// this class offers added functionality for the solution of // frequency-dependent systems. #include "libmesh/frequency_system.h" @@ -67,7 +67,7 @@ #include "libmesh/dense_matrix.h" #include "libmesh/dense_vector.h" -// Define matrix and vector data types for the global +// Define matrix and vector data types for the global // equation system. These are base classes, // from which specific implementations, like // the PETSc or LASPACK implementations, are derived. @@ -113,19 +113,19 @@ int main (int argc, char** argv) { // Initialize libraries, like in example 2. LibMeshInit init (argc, argv); - - // This example is designed for complex numbers. + + // This example is designed for complex numbers. #ifndef LIBMESH_USE_COMPLEX_NUMBERS libmesh_example_assert(false, "--enable-complex"); #else - + // Check for proper usage. if (argc < 3) { if (libMesh::processor_id() == 0) std::cerr << "Usage: " << argv[0] << " -f [frequency]" << std::endl; - + libmesh_error(); } @@ -138,26 +138,26 @@ int main (int argc, char** argv) } return 0; } - + // Tell the user what we are doing. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; ifloat, // currently, solve for 1/3rd, 2/3rd and 1/1th of the given frequency const Real frequency_in = atof(argv[2]); - const unsigned int n_frequencies = 3; - + const unsigned int n_frequencies = 3; + // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Create a mesh. Mesh mesh; @@ -172,7 +172,7 @@ int main (int argc, char** argv) mesh.read("lshape.unv", &mesh_data); // Print information about the mesh to the screen. - mesh.print_info(); + mesh.print_info(); // The load on the boundary of the domain is stored in // the .unv formated mesh data file lshape_data.unv. @@ -185,25 +185,25 @@ int main (int argc, char** argv) // Create an equation systems object, which now handles // a frequency system, as opposed to previous examples. - // Also pass a MeshData pointer so the data can be + // Also pass a MeshData pointer so the data can be // accessed in the matrix and rhs assembly. EquationSystems equation_systems (mesh, &mesh_data); - + // Create a FrequencySystem named "Helmholtz" & store a // reference to it. - FrequencySystem & f_system = + FrequencySystem & f_system = equation_systems.add_system ("Helmholtz"); - + // Add the variable "p" to "Helmholtz". "p" // will be approximated using second-order approximation. f_system.add_variable("p", SECOND); - + // Tell the frequency system about the two user-provided // functions. In other circumstances, at least the // solve function has to be attached. f_system.attach_assemble_function (assemble_helmholtz); f_system.attach_solve_function (add_M_C_K_helmholtz); - + // To enable the fast solution scheme, additional // global matrices and one global vector, all appropriately sized, // have to be added. The system object takes care of the @@ -214,7 +214,7 @@ int main (int argc, char** argv) f_system.add_matrix ("damping"); f_system.add_matrix ("mass"); f_system.add_vector ("rhs"); - + // Communicates the frequencies to the system. Note that // the frequency system stores the frequencies as parameters // in the equation systems object, so that our assemble and solve @@ -223,33 +223,33 @@ int main (int argc, char** argv) f_system.set_frequencies_by_steps (frequency_in/n_frequencies, frequency_in, n_frequencies); - + // Use the parameters of the equation systems object to // tell the frequency system about the wave velocity and fluid // density. The frequency system provides default values, but // these may be overridden, as shown here. equation_systems.parameters.set ("wave speed") = 1.; equation_systems.parameters.set ("rho") = 1.; - + // Initialize the data structures for the equation system. Always // prior to this, the frequencies have to be communicated to the system. equation_systems.init (); - + // Prints information about the system to the screen. equation_systems.print_info (); for (unsigned int n=0; n < n_frequencies; n++) { - // Solve the system "Helmholtz" for the n-th frequency. + // Solve the system "Helmholtz" for the n-th frequency. // Since we attached an assemble() function to the system, // the mass, damping and stiffness contributions will only // be assembled once. Then, the system is solved for the - // given frequencies. Note that solve() may also solve + // given frequencies. Note that solve() may also solve // the system only for specific frequencies. f_system.solve (n,n); - + // After solving the system, write the solution - // to an ExodusII-formatted plot file, for every frequency. + // to an ExodusII-formatted plot file, for every frequency. #ifdef LIBMESH_HAVE_EXODUS_API char buf[14]; sprintf (buf, "out%04d.exd", n); @@ -258,17 +258,17 @@ int main (int argc, char** argv) equation_systems); #endif } - + // Alternatively, the whole EquationSystems object can be // written to disk. By default, the additional vectors are also // saved. equation_systems.write ("eqn_sys.dat", libMeshEnums::WRITE); - - // All done. + + // All done. return 0; -#endif +#endif } @@ -279,26 +279,26 @@ int main (int argc, char** argv) void assemble_helmholtz(EquationSystems& es, const std::string& system_name) { - + // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Helmholtz"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are in const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to our system, as before FrequencySystem & f_system = es.get_system (system_name); - + // A const reference to the DofMap object for this system. The DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. const DofMap& dof_map = f_system.get_dof_map(); - + // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. const FEType& fe_type = dof_map.variable_type(0); @@ -306,17 +306,17 @@ void assemble_helmholtz(EquationSystems& es, // For the admittance boundary condition, // get the fluid density const Real rho = es.parameters.get("rho"); - + // In here, we will add the element matrices to the // additional matrices "stiffness_mass", "damping", - // and the additional vector "rhs", not to the members + // and the additional vector "rhs", not to the members // "matrix" and "rhs". Therefore, get writable // references to them SparseMatrix& stiffness = f_system.get_matrix("stiffness"); SparseMatrix& damping = f_system.get_matrix("damping"); SparseMatrix& mass = f_system.get_matrix("mass"); NumericVector& freq_indep_rhs = f_system.get_vector("rhs"); - + // Some solver packages (PETSc) are especially picky about // allocating sparsity structure and truly assigning values // to this structure. Namely, matrix additions, as performed @@ -325,7 +325,7 @@ void assemble_helmholtz(EquationSystems& es, // values in the collective matrix, so that matrix additions // encounter identical sparsity structures. SparseMatrix& matrix = *f_system.matrix; - + // ------------------------------------------------------------------ // Finite Element related stuff // @@ -334,19 +334,19 @@ void assemble_helmholtz(EquationSystems& es, // store the object as an AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - - // The element Jacobian// quadrature weight at each integration point. + + // The element Jacobian// quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); - + // The element shape function gradients evaluated at the quadrature // points. const std::vector >& dphi = fe->get_dphi(); @@ -355,15 +355,15 @@ void assemble_helmholtz(EquationSystems& es, // We will not add directly to the overall (PETSc/LASPACK) matrix, // but to the additional matrices "stiffness_mass" and "damping". // The same holds for the right-hand-side vector Fe, which we will - // later on store in the additional vector "rhs". + // later on store in the additional vector "rhs". // The zero_matrix is used to explicitly induce the same sparsity // structure in the overall matrix. - // see later on. (At least) the mass, and stiffness matrices, however, + // see later on. (At least) the mass, and stiffness matrices, however, // are inherently real. Therefore, store these as one complex // matrix. This will definitely save memory. DenseMatrix Ke, Ce, Me, zero_matrix; DenseVector Fe; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system // the element degrees of freedom get mapped. @@ -375,16 +375,16 @@ void assemble_helmholtz(EquationSystems& es, MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { // Start logging the element initialization. START_LOG("elem init","assemble_helmholtz"); - + // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -396,7 +396,7 @@ void assemble_helmholtz(EquationSystems& es, // quadrature points (q_point) and the shape functions // (phi, dphi) for the current element. fe->reinit (elem); - + // Zero & resize the element matrix and right-hand side before // summing them, with different element types in the mesh this // is quite necessary. @@ -409,7 +409,7 @@ void assemble_helmholtz(EquationSystems& es, zero_matrix.resize (n_dof_indices, n_dof_indices); Fe.resize (n_dof_indices); } - + // Stop logging the element initialization. STOP_LOG("elem init","assemble_helmholtz"); @@ -429,58 +429,58 @@ void assemble_helmholtz(EquationSystems& es, { Ke(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]); Me(i,j) += JxW[qp]*(phi[i][qp]*phi[j][qp]); - } + } } STOP_LOG("stiffness & mass","assemble_helmholtz"); // Now compute the contribution to the element matrix // (due to mixed boundary conditions) if the current - // element lies on the boundary. + // element lies on the boundary. // // The following loops over the sides of the element. // If the element has no neighbor on a side then that // side MUST live on a boundary of the domain. - + for (unsigned int side=0; siden_sides(); side++) if (elem->neighbor(side) == NULL) { START_LOG("damping","assemble_helmholtz"); - + // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, SECOND); - + // Tell the finte element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); - + // The value of the shape functions at the quadrature // points. const std::vector >& phi_face = fe_face->get_phi(); - + // The Jacobian// Quadrature Weight at the quadrature // points on the face. const std::vector& JxW_face = fe_face->get_JxW(); - + // Compute the shape function values on the element // face. fe_face->reinit(elem, side); - + // For the Robin BCs consider a normal admittance an=1 // at some parts of the bounfdary const Real an_value = 1.; - + // Loop over the face quadrature points for integration. for (unsigned int qp=0; qp (system_name); - + // Get the frequency, fluid density, and speed of sound // for which we should currently solve const Real frequency = es.parameters.get ("current frequency"); const Real rho = es.parameters.get ("rho"); const Real speed = es.parameters.get ("wave speed"); - + // Compute angular frequency omega and wave number k const Real omega = 2.0*libMesh::pi*frequency; const Real k = omega / speed; - - // Get writable references to the overall matrix and vector, where the + + // Get writable references to the overall matrix and vector, where the // frequency-dependent system is to be collected SparseMatrix& matrix = *f_system.matrix; NumericVector& rhs = *f_system.rhs; - + // Get writable references to the frequency-independent matrices // and rhs, though we only need to extract values. This write access - // is necessary, since solver packages have to close the data structure + // is necessary, since solver packages have to close the data structure // before they can extract values for computation. SparseMatrix& stiffness = f_system.get_matrix("stiffness"); SparseMatrix& damping = f_system.get_matrix("damping"); SparseMatrix& mass = f_system.get_matrix("mass"); NumericVector& freq_indep_rhs = f_system.get_vector("rhs"); - + // form the scaling values for the coming matrix and vector axpy's const Number scale_stiffness ( 1., 0. ); const Number scale_damping ( 0., omega); const Number scale_mass (-k*k, 0. ); const Number scale_rhs ( 0., -(rho*omega)); - + // Now simply add the matrices together, store the result // in matrix and rhs. Clear them first. matrix.close(); matrix.zero (); rhs.close(); rhs.zero (); - + // The matrices from which values are added to another matrix - // have to be closed. The add() method does take care of + // have to be closed. The add() method does take care of // that, but let us do it explicitly. stiffness.close (); damping.close (); @@ -621,7 +621,7 @@ void add_M_C_K_helmholtz(EquationSystems& es, STOP_LOG("init phase","add_M_C_K_helmholtz"); START_LOG("global matrix & vector additions","add_M_C_K_helmholtz"); - + // add the stiffness and mass with the proper frequency to the // overall system. For this to work properly, matrix has // to be not only initialized, but filled with the identical @@ -637,8 +637,8 @@ void add_M_C_K_helmholtz(EquationSystems& es, rhs.add (scale_rhs, freq_indep_rhs); STOP_LOG("global matrix & vector additions","add_M_C_K_helmholtz"); - - // The "matrix" and "rhs" are now ready for solution + + // The "matrix" and "rhs" are now ready for solution } #endif // LIBMESH_USE_COMPLEX_NUMBERS diff --git a/examples/miscellaneous/miscellaneous_ex3/Makefile.am b/examples/miscellaneous/miscellaneous_ex3/Makefile.am index c2684477b1f..5fa4dd7dbac 100644 --- a/examples/miscellaneous/miscellaneous_ex3/Makefile.am +++ b/examples/miscellaneous/miscellaneous_ex3/Makefile.am @@ -9,7 +9,7 @@ data = miscellaneous_ex3.C ../../adjoints/adjoints_ex1/lshaped.xda run. sources = $(data) run.sh check_SCRIPTS = run.sh -CLEANFILES = lshaped.xda out.e +CLEANFILES = lshaped.xda out.e ############################################## # include common example environment diff --git a/examples/miscellaneous/miscellaneous_ex3/miscellaneous_ex3.C b/examples/miscellaneous/miscellaneous_ex3/miscellaneous_ex3.C index c5c34babb08..34ecede513c 100644 --- a/examples/miscellaneous/miscellaneous_ex3/miscellaneous_ex3.C +++ b/examples/miscellaneous/miscellaneous_ex3/miscellaneous_ex3.C @@ -22,21 +22,21 @@ // This example shows how to use the NonlinearImplicitSystem class // to efficiently solve nonlinear problems in parallel. // - // In nonlinear systems, we aim at finding x that satisfy R(x) = 0. - // In nonlinear finite element analysis, the residual is typically - // of the form R(x) = K(x)*x - f, with K(x) the system matrix and f - // the "right-hand-side". The NonlinearImplicitSystem class expects - // two callback functions to compute the residual R and its Jacobian - // for the Newton iterations. Here, we just approximate + // In nonlinear systems, we aim at finding x that satisfy R(x) = 0. + // In nonlinear finite element analysis, the residual is typically + // of the form R(x) = K(x)*x - f, with K(x) the system matrix and f + // the "right-hand-side". The NonlinearImplicitSystem class expects + // two callback functions to compute the residual R and its Jacobian + // for the Newton iterations. Here, we just approximate // the true Jacobian by K(x). // // You can turn on preconditining of the matrix free system using the // jacobian by passing "-pre" on the command line. Currently this only // work with Petsc so this isn't used by using "make run" // - // This example also runs with the experimental Trilinos NOX solvers by specifying + // This example also runs with the experimental Trilinos NOX solvers by specifying // the --use-trilinos command line argument. - + // C++ include files that we need #include @@ -95,9 +95,9 @@ void compute_jacobian (const NumericVector& soln, const unsigned int dim = mesh.mesh_dimension(); // Get a reference to the NonlinearImplicitSystem we are solving - NonlinearImplicitSystem& system = + NonlinearImplicitSystem& system = es.get_system("Laplace-Young"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -113,7 +113,7 @@ void compute_jacobian (const NumericVector& soln, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); @@ -123,12 +123,12 @@ void compute_jacobian (const NumericVector& soln, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); - + // The element shape function gradients evaluated at the quadrature // points. const std::vector >& dphi = fe->get_dphi(); @@ -175,7 +175,7 @@ void compute_jacobian (const NumericVector& soln, // triangle, now we are on a quadrilateral). Ke.resize (dof_indices.size(), dof_indices.size()); - + // Now we will build the element Jacobian. This involves // a double loop to integrate the test funcions (i) against // the trial functions (j). Note that the Jacobian depends @@ -185,12 +185,12 @@ void compute_jacobian (const NumericVector& soln, for (unsigned int qp=0; qp& soln, kappa*phi[i][qp]*phi[j][qp] ); } - + dof_map.constrain_element_matrix (Ke, dof_indices); - + // Add the element matrix to the system Jacobian. jacobian.add_matrix (Ke, dof_indices); } @@ -225,9 +225,9 @@ void compute_residual (const NumericVector& soln, libmesh_assert_equal_to (dim, 2); // Get a reference to the NonlinearImplicitSystem we are solving - NonlinearImplicitSystem& system = + NonlinearImplicitSystem& system = es.get_system("Laplace-Young"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -243,7 +243,7 @@ void compute_residual (const NumericVector& soln, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); @@ -253,12 +253,12 @@ void compute_residual (const NumericVector& soln, // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, FIFTH); - + // Tell the finte element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); @@ -266,12 +266,12 @@ void compute_residual (const NumericVector& soln, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); - + // The element shape function gradients evaluated at the quadrature // points. const std::vector >& dphi = fe->get_dphi(); @@ -316,11 +316,11 @@ void compute_residual (const NumericVector& soln, // element type is different (i.e. the last element was a // triangle, now we are on a quadrilateral). Re.resize (dof_indices.size()); - + // Now we will build the residual. This involves // the construction of the matrix K and multiplication of it - // with the current solution x. We rearrange this into two loops: - // In the first, we calculate only the contribution of + // with the current solution x. We rearrange this into two loops: + // In the first, we calculate only the contribution of // K_ij*x_j which is independent of the row i. In the second loops, // we multiply with the row-dependent part and add it to the element // residual. @@ -329,15 +329,15 @@ void compute_residual (const NumericVector& soln, { Number u = 0; Gradient grad_u; - + for (unsigned int j=0; j& soln, // At this point the interior element integration has // been completed. However, we have not yet addressed // boundary conditions. - + // The following loops over the sides of the element. // If the element has no neighbor on a side then that // side MUST live on a boundary of the domain. @@ -373,14 +373,14 @@ void compute_residual (const NumericVector& soln, // which has to be subtracted from the current residual for (unsigned int i=0; i ("Laplace-Young"); - // Here we specify the tolerance for the nonlinear solver and - // the maximum of nonlinear iterations. + // Here we specify the tolerance for the nonlinear solver and + // the maximum of nonlinear iterations. equation_systems.parameters.set ("nonlinear solver tolerance") = 1.e-12; equation_systems.parameters.set ("nonlinear solver maximum iterations") = 50; - + // Adds the variable "u" to "Laplace-Young". "u" // will be approximated using second-order approximation. system.add_variable("u", Utility::string_to_enum (order), Utility::string_to_enum(family)); - // Give the system a pointer to the functions that update + // Give the system a pointer to the functions that update // the residual and Jacobian. system.nonlinear_solver->residual = compute_residual; system.nonlinear_solver->jacobian = compute_jacobian; @@ -520,7 +520,7 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + // Solve the system "Laplace-Young", print the number of iterations // and final residual equation_systems.get_system("Laplace-Young").solve(); @@ -536,11 +536,11 @@ int main (int argc, char** argv) #ifdef LIBMESH_HAVE_EXODUS_API // After solving the system write the solution - ExodusII_IO (mesh).write_equation_systems ("out.e", + ExodusII_IO (mesh).write_equation_systems ("out.e", equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API #endif // #ifndef LIBMESH_ENABLE_AMR - // All done. - return 0; + // All done. + return 0; } diff --git a/examples/miscellaneous/miscellaneous_ex4/miscellaneous_ex4.C b/examples/miscellaneous/miscellaneous_ex4/miscellaneous_ex4.C index 9b5563a4618..635a708224d 100644 --- a/examples/miscellaneous/miscellaneous_ex4/miscellaneous_ex4.C +++ b/examples/miscellaneous/miscellaneous_ex4/miscellaneous_ex4.C @@ -16,11 +16,11 @@ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //

Miscellaneous Example 4 - Using a shell matrix

- // + // // This example solves the equation // // \f$-\Delta u+\int u = 1\f$ - // + // // with homogeneous Dirichlet boundary conditions. This system has // a full system matrix which can be written as the sum of of sparse // matrix and a rank 1 matrix. The shell matrix concept is used to @@ -32,7 +32,7 @@ // used, so that the example remains simple. // // The example is 2d; extension to 3d is straight forward. - + // C++ include files that we need #include #include @@ -117,9 +117,9 @@ int main (int argc, char** argv) -1., 1., -1., 1., QUAD4); - - LinearImplicitSystem & system = - equation_systems.add_system + + LinearImplicitSystem & system = + equation_systems.add_system ("System"); // Adds the variable "u" to "System". "u" @@ -143,7 +143,7 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + equation_systems.parameters.set ("linear solver maximum iterations") = 250; equation_systems.parameters.set @@ -154,7 +154,7 @@ int main (int argc, char** argv) { MeshRefinement mesh_refinement(mesh); MeshBase::element_iterator elem_it = mesh.elements_begin(); - const MeshBase::element_iterator elem_end = mesh.elements_end(); + const MeshBase::element_iterator elem_end = mesh.elements_end(); for (; elem_it != elem_end; ++elem_it) { Elem* elem = *elem_it; @@ -180,7 +180,7 @@ int main (int argc, char** argv) // Prints information about the system to the screen. equation_systems.print_info(); - + // Before the assemblation of the matrix, we have to clear the two // vectors that form the tensor matrix (since this is not performed // automatically). @@ -212,14 +212,14 @@ int main (int argc, char** argv) // Print a nice message. std::cout << "Solved linear system in " << system.n_linear_iterations() << " iterations, residual norm is " << system.final_linear_residual() << "." << std::endl; - + #if defined(LIBMESH_HAVE_VTK) && !defined(LIBMESH_ENABLE_PARMESH) // Write result to file. VTKIO(mesh).write_equation_systems ("out.pvtu", equation_systems); #endif // #ifdef LIBMESH_HAVE_VTK #endif // #ifndef LIBMESH_ENABLE_AMR - + return 0; } @@ -235,28 +235,28 @@ void assemble (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "System"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Convection-Diffusion system object. LinearImplicitSystem & system = es.get_system ("System"); - - // Get the Finite Element type for the first (and only) + + // Get the Finite Element type for the first (and only) // variable in the system. FEType fe_type = system.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // \p FEBase::build() member dynamically creates memory we will // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -271,7 +271,7 @@ void assemble (EquationSystems& es, // with the element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); const std::vector& JxW_face = fe_face->get_JxW(); - + // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); const std::vector >& psi = fe_face->get_phi(); @@ -282,13 +282,13 @@ void assemble (EquationSystems& es, // The XY locations of the quadrature points used for face integration //const std::vector& qface_points = fe_face->get_xyz(); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap // in future examples. const DofMap& dof_map = system.get_dof_map(); - + // Define data structures to contain the element matrix // and right-hand-side vector contribution. Following // basic finite element terminology we will denote these @@ -300,7 +300,7 @@ void assemble (EquationSystems& es, // the tensor shell matrix. DenseVector Ve; DenseVector We; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system // the element degrees of freedom get mapped. @@ -312,14 +312,14 @@ void assemble (EquationSystems& es, // will be refined we want to only consider the ACTIVE elements, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -331,7 +331,7 @@ void assemble (EquationSystems& es, // quadrature points (q_point) and the shape functions // (phi, dphi) for the current element. fe->reinit (elem); - + // Zero the element matrix and right-hand side before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from @@ -344,7 +344,7 @@ void assemble (EquationSystems& es, Fe.resize (dof_indices.size()); Ve.resize (dof_indices.size()); We.resize (dof_indices.size()); - + // Now we will build the element matrix and right-hand-side. // Constructing the RHS requires the solution and its // gradient from the previous timestep. This myst be @@ -360,13 +360,13 @@ void assemble (EquationSystems& es, Fe(i) += JxW[qp]*( phi[i][qp] ); - + for (unsigned int j=0; jneighbor(s) == NULL) { fe_face->reinit(elem,s); - + for (unsigned int qp=0; qp ("EllipticDG"); // Get some parameters that we need during assembly @@ -158,7 +158,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap const DofMap & dof_map = ellipticdg_system.get_dof_map(); - + // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. FEType fe_type = ellipticdg_system.variable_type(0); @@ -172,19 +172,19 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) AutoPtr fe_neighbor_face(FEBase::build(dim, fe_type)); // Quadrature rules for numerical integration. -#ifdef QORDER +#ifdef QORDER QGauss qrule (dim, QORDER); #else QGauss qrule (dim, fe_type.default_quadrature_order()); #endif fe->attach_quadrature_rule (&qrule); - -#ifdef QORDER + +#ifdef QORDER QGauss qface(dim-1, QORDER); #else QGauss qface(dim-1, fe_type.default_quadrature_order()); #endif - + // Tell the finite element object to use our quadrature rule. fe_elem_face->attach_quadrature_rule(&qface); fe_neighbor_face->attach_quadrature_rule(&qface); @@ -201,7 +201,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) const std::vector& JxW_face = fe_elem_face->get_JxW(); const std::vector& qface_normals = fe_elem_face->get_normals(); const std::vector& qface_points = fe_elem_face->get_xyz(); - + // Data for surface integrals on the neighbor boundary const std::vector >& phi_neighbor_face = fe_neighbor_face->get_phi(); const std::vector >& dphi_neighbor_face = fe_neighbor_face->get_dphi(); @@ -209,7 +209,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) // Define data structures to contain the element interior matrix // and right-hand-side vector contribution. Following // basic finite element terminology we will denote these - // "Ke" and "Fe". + // "Ke" and "Fe". DenseMatrix Ke; DenseVector Fe; @@ -221,7 +221,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) DenseMatrix Ken; DenseMatrix Kee; DenseMatrix Knn; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system // the element degrees of freedom get mapped. @@ -229,10 +229,10 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) // Now we will loop over all the elements in the mesh. We will // compute first the element interior matrix and right-hand-side contribution - // and then the element and neighbors boundary matrix contributions. + // and then the element and neighbors boundary matrix contributions. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) { // Store a pointer to the element we are currently @@ -245,7 +245,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) // contribute to. dof_map.dof_indices (elem, dof_indices); const unsigned int n_dofs = dof_indices.size(); - + // Compute the element-specific data for the current // element. This involves computing the location of the // quadrature points (q_point) and the shape functions @@ -255,10 +255,10 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) // Zero the element matrix and right-hand side before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from - // the last element. + // the last element. Ke.resize (n_dofs, n_dofs); Fe.resize (n_dofs); - + // Now we will build the element interior matrix. This involves // a double loop to integrate the test funcions (i) against // the trial functions (j). @@ -272,8 +272,8 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) } } } - - // Now we adress boundary conditions. + + // Now we adress boundary conditions. // We consider Dirichlet bc imposed via the interior penalty method // The following loops over the sides of the element. // If the element has no neighbor on a side then that @@ -284,12 +284,12 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) { // Pointer to the element face fe_elem_face->reinit(elem, side); - + AutoPtr elem_side (elem->build_side(side)); // h elemet dimension to compute the interior penalty penalty parameter const unsigned int elem_b_order = static_cast (fe_elem_face->get_order()); const double h_elem = elem->volume()/elem_side->volume() * 1./pow(elem_b_order, 2.); - + for (unsigned int qp=0; qpneighbor(side); - + // Get the global id of the element and the neighbor const unsigned int elem_id = elem->id(); const unsigned int neighbor_id = neighbor->id(); - + // If the neighbor has the same h level and is active // perform integration only if our global id is bigger than our neighbor id. // We don't want to compute twice the same contributions. // If the neighbor has a different h level perform integration - // only if the neighbor is at a lower level. + // only if the neighbor is at a lower level. if ((neighbor->active() && (neighbor->level() == elem->level()) && (elem_id < neighbor_id)) || (neighbor->level() < elem->level())) { // Pointer to the element side AutoPtr elem_side (elem->build_side(side)); - + // h dimension to compute the interior penalty penalty parameter const unsigned int elem_b_order = static_cast(fe_elem_face->get_order()); const unsigned int neighbor_b_order = static_cast(fe_neighbor_face->get_order()); const double side_order = (elem_b_order + neighbor_b_order)/2.; const double h_elem = (elem->volume()/elem_side->volume()) * 1./pow(side_order,2.); - // The quadrature point locations on the neighbor side + // The quadrature point locations on the neighbor side std::vector qface_neighbor_point; // The quadrature point locations on the element side std::vector qface_point; - + // Reinitialize shape functions on the element side fe_elem_face->reinit(elem, side); // Get the physical locations of the element quadrature points qface_point = fe_elem_face->get_xyz(); - // Find their locations on the neighbor + // Find their locations on the neighbor unsigned int side_neighbor = neighbor->which_neighbor_am_i(elem); if (refinement_type == "p") fe_neighbor_face->side_map (neighbor, elem_side.get(), side_neighbor, qface.get_points(), qface_neighbor_point); @@ -356,7 +356,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) FEInterface::inverse_map (elem->dim(), fe->get_fe_type(), neighbor, qface_point, qface_neighbor_point); // Calculate the neighbor element shape functions at those locations fe_neighbor_face->reinit(neighbor, &qface_neighbor_point); - + // Get the degree of freedom indices for the // neighbor. These define where in the global // matrix this neighbor will contribute to. @@ -367,8 +367,8 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) // Zero the element and neighbor side matrix before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from - // the last element or neighbor. - // Note that Kne and Ken are not square matrices if neighbor + // the last element or neighbor. + // Note that Kne and Ken are not square matrices if neighbor // and element have a different p level Kne.resize (n_neighbor_dofs, n_dofs); Ken.resize (n_dofs, n_neighbor_dofs); @@ -383,7 +383,7 @@ void assemble_ellipticdg(EquationSystems& es, const std::string& system_name) { // Kee Matrix. Integrate the element test function i // against the element test function j - for (unsigned int i=0; iadd_matrix(Kne,neighbor_dof_indices,dof_indices); ellipticdg_system.matrix->add_matrix(Ken,dof_indices,neighbor_dof_indices); @@ -471,7 +471,7 @@ int main (int argc, char** argv) // Skip higher-dimensional examples on a lower-dimensional libMesh build libmesh_example_assert(dim <= LIBMESH_DIM, "2D/3D support"); - + // Skip adaptive examples on a non-adaptive libMesh build #ifndef LIBMESH_ENABLE_AMR libmesh_example_assert(false, "--enable-amr"); @@ -491,18 +491,18 @@ int main (int argc, char** argv) if (element_type == "simplex") MeshTools::Modification::all_tri(mesh); - // Mesh Refinement object + // Mesh Refinement object MeshRefinement mesh_refinement(mesh); mesh_refinement.refine_fraction() = refine_fraction; mesh_refinement.coarsen_fraction() = coarsen_fraction; mesh_refinement.max_h_level() = max_h_level; - // Do uniform refinement + // Do uniform refinement for (unsigned int rstep=0; rstep ("EllipticDG"); - + // Add a variable "u" to "ellipticdg" using the p_order specified in the config file if( on_command_line( "element_type" ) ) { @@ -526,11 +526,11 @@ int main (int argc, char** argv) libmesh_error(); } ellipticdg_system.add_variable ("u", p_order, Utility::string_to_enum(fe_str) ); - } + } else ellipticdg_system.add_variable ("u", p_order, MONOMIAL); - - // Give the system a pointer to the matrix assembly function + + // Give the system a pointer to the matrix assembly function ellipticdg_system.attach_assemble_function (assemble_ellipticdg); // Initialize the data structures for the equation system @@ -546,10 +546,10 @@ int main (int argc, char** argv) { std::cout << " Beginning Solve " << rstep << std::endl; std::cout << "Number of elements: " << mesh.n_elem() << std::endl; - + // Solve the system ellipticdg_system.solve(); - + std::cout << "System has: " << equation_system.n_active_dofs() << " degrees of freedom." << std::endl; @@ -559,7 +559,7 @@ int main (int argc, char** argv) << ", final residual: " << ellipticdg_system.final_linear_residual() << std::endl; - + // Compute the error exact_sol.compute_error("EllipticDG", "u"); @@ -567,21 +567,21 @@ int main (int argc, char** argv) std::cout << "L2-Error is: " << exact_sol.l2_error("EllipticDG", "u") << std::endl; - - // Possibly refine the mesh + + // Possibly refine the mesh if (rstep+1 < adaptive_refinement_steps) { // The ErrorVector is a particular StatisticsVector // for computing error information on a finite element mesh. ErrorVector error; - // The discontinuity error estimator - // evaluate the jump of the solution - // on elements faces + // The discontinuity error estimator + // evaluate the jump of the solution + // on elements faces DiscontinuityMeasure error_estimator; error_estimator.estimate_error(ellipticdg_system,error); - - // Take the error in error and decide which elements will be coarsened or refined + + // Take the error in error and decide which elements will be coarsened or refined mesh_refinement.flag_elements_by_error_fraction(error); if (refinement_type == "p") mesh_refinement.switch_h_to_p_refinement(); @@ -601,7 +601,7 @@ int main (int argc, char** argv) #endif #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. + + // All done. return 0; } diff --git a/examples/miscellaneous/miscellaneous_ex6/Makefile.am b/examples/miscellaneous/miscellaneous_ex6/Makefile.am index 4e9948df88e..8b31da8ffb9 100644 --- a/examples/miscellaneous/miscellaneous_ex6/Makefile.am +++ b/examples/miscellaneous/miscellaneous_ex6/Makefile.am @@ -4,7 +4,7 @@ data = miscellaneous_ex6.C run.sh sources = $(data) run.sh check_SCRIPTS = run.sh -CLEANFILES = hole_3D.e delaunay_l_shaped_hole.e +CLEANFILES = hole_3D.e delaunay_l_shaped_hole.e ############################################## # include common example environment diff --git a/examples/miscellaneous/miscellaneous_ex6/miscellaneous_ex6.C b/examples/miscellaneous/miscellaneous_ex6/miscellaneous_ex6.C index bb3b2dcf7b8..1d5434be734 100644 --- a/examples/miscellaneous/miscellaneous_ex6/miscellaneous_ex6.C +++ b/examples/miscellaneous/miscellaneous_ex6/miscellaneous_ex6.C @@ -19,7 +19,7 @@ //

Miscellaneous Example 6 - Meshing with LibMesh's TetGen and Triangle Interfaces

// - // LibMesh provides interfaces to both Triangle and TetGen for generating + // LibMesh provides interfaces to both Triangle and TetGen for generating // Delaunay triangulations and tetrahedralizations in two and three dimensions // (respectively). @@ -60,14 +60,14 @@ int main (int argc, char** argv) // 1.) 2D triangulation of L-shaped domain with three holes of different shape triangulate_domain(); - + libmesh_example_assert(3 <= LIBMESH_DIM, "3D support"); std::cout << "Tetrahedralizing a prismatic domain with a hole" << std::endl; // 2.) 3D tetrahedralization of rectangular domain with hole. tetrahedralize_domain(); - + return 0; } @@ -84,7 +84,7 @@ void triangulate_domain() // Libmesh mesh that will eventually be created. Mesh mesh(2); - + // The points which make up the L-shape: mesh.add_point(Point( 0. , 0.)); mesh.add_point(Point( 0. , -1.)); @@ -114,7 +114,7 @@ void triangulate_domain() t.smooth_after_generating() = true; // Define holes... - + // hole_1 is a circle (discretized by 50 points) PolygonHole hole_1(Point(-0.5, 0.5), // center 0.25, // radius @@ -137,15 +137,15 @@ void triangulate_domain() for (unsigned int i=0; i holes; holes.push_back(&hole_1); holes.push_back(&hole_2); holes.push_back(&hole_3); - + // ... and attach it to the triangulator object t.attach_hole_list(&holes); @@ -163,13 +163,13 @@ void triangulate_domain() void tetrahedralize_domain() { #ifdef LIBMESH_HAVE_TETGEN - // The algorithm is broken up into several steps: + // The algorithm is broken up into several steps: // 1.) A convex hull is constructed for a rectangular hole. // 2.) A convex hull is constructed for the domain exterior. // 3.) Neighbor information is updated so TetGen knows there is a convex hull // 4.) A vector of hole points is created. // 5.) The domain is tetrahedralized, the mesh is written out, etc. - + // The mesh we will eventually generate SerialMesh mesh(3); @@ -179,7 +179,7 @@ void tetrahedralize_domain() // 1.) Construct a convex hull for the hole add_cube_convex_hull_to_mesh(mesh, hole_lower_limit, hole_upper_limit); - + // 2.) Generate elements comprising the outer boundary of the domain. add_cube_convex_hull_to_mesh(mesh, Point(0.,0.,0.), Point(1., 1., 1.)); @@ -191,7 +191,7 @@ void tetrahedralize_domain() hole[0] = Point( 0.5*(hole_lower_limit + hole_upper_limit) ); // 5.) Set parameters and tetrahedralize the domain - + // 0 means "use TetGen default value" Real quality_constraint = 2.0; @@ -199,13 +199,13 @@ void tetrahedralize_domain() // volume in the Mesh. TetGen will split cells which are larger than // this size Real volume_constraint = 0.001; - + // Construct the Delaunay tetrahedralization TetGenMeshInterface t(mesh); - t.triangulate_conformingDelaunayMesh_carvehole(hole, - quality_constraint, + t.triangulate_conformingDelaunayMesh_carvehole(hole, + quality_constraint, volume_constraint); - + // Find neighbors, etc in preparation for writing out the Mesh mesh.prepare_for_use(); @@ -239,13 +239,13 @@ void add_cube_convex_hull_to_mesh(MeshBase& mesh, Point lower_limit, Point upper lower_limit(1), upper_limit(1), lower_limit(2), upper_limit(2), HEX8); - + // The pointset_convexhull() algorithm will ignore the Hex8s // in the Mesh, and just construct the triangulation // of the convex hull. TetGenMeshInterface t(cube_mesh); - t.pointset_convexhull(); - + t.pointset_convexhull(); + // Now add all nodes from the boundary of the cube_mesh to the input mesh. // Map from "node id in cube_mesh" -> "node id in mesh". Initially inserted @@ -256,23 +256,23 @@ void add_cube_convex_hull_to_mesh(MeshBase& mesh, Point lower_limit, Point upper { MeshBase::element_iterator it = cube_mesh.elements_begin(); const MeshBase::element_iterator end = cube_mesh.elements_end(); - for ( ; it != end; ++it) + for ( ; it != end; ++it) { Elem* elem = *it; - + for (unsigned s=0; sn_sides(); ++s) if (elem->neighbor(s) == NULL) { // Add the node IDs of this side to the set AutoPtr side = elem->side(s); - + for (unsigned n=0; nn_nodes(); ++n) node_id_map.insert( std::make_pair(side->node(n), /*dummy_value=*/0) ); } } } - // For each node in the map, insert it into the input mesh and keep + // For each node in the map, insert it into the input mesh and keep // track of the ID assigned. for (iterator it=node_id_map.begin(); it != node_id_map.end(); ++it) { @@ -288,14 +288,14 @@ void add_cube_convex_hull_to_mesh(MeshBase& mesh, Point lower_limit, Point upper // Track ID value of new_node in map (*it).second = new_node->id(); } - + // With the points added and the map data structure in place, we are - // ready to add each TRI3 element of the cube_mesh to the input Mesh + // ready to add each TRI3 element of the cube_mesh to the input Mesh // with proper node assignments { MeshBase::element_iterator el = cube_mesh.elements_begin(); const MeshBase::element_iterator end_el = cube_mesh.elements_end(); - + for (; el != end_el; ++el) { Elem* old_elem = *el; diff --git a/examples/miscellaneous/miscellaneous_ex7/Makefile.am b/examples/miscellaneous/miscellaneous_ex7/Makefile.am index e50abf7e4bb..18590404341 100644 --- a/examples/miscellaneous/miscellaneous_ex7/Makefile.am +++ b/examples/miscellaneous/miscellaneous_ex7/Makefile.am @@ -4,7 +4,7 @@ data = biharmonic.C biharmonic.h biharmonic_jr.C biharmonic_jr.h miscel sources = $(data) run.sh check_SCRIPTS = run.sh -CLEANFILES = bih.1.e +CLEANFILES = bih.1.e ############################################## # include common example environment diff --git a/examples/miscellaneous/miscellaneous_ex7/biharmonic_jr.C b/examples/miscellaneous/miscellaneous_ex7/biharmonic_jr.C index cc12bce2f6e..f6638642930 100644 --- a/examples/miscellaneous/miscellaneous_ex7/biharmonic_jr.C +++ b/examples/miscellaneous/miscellaneous_ex7/biharmonic_jr.C @@ -575,5 +575,5 @@ void Biharmonic::JR::bounds(NumericVector &XL, NumericVector& XU // the bounds are always -1.0 and 1.0. XL.insert(XLe, dof_indices); XU.insert(XUe, dof_indices); - } + } } diff --git a/examples/miscellaneous/miscellaneous_ex7/miscellaneous_ex7.C b/examples/miscellaneous/miscellaneous_ex7/miscellaneous_ex7.C index e0ef59b4da1..af5b52084ad 100644 --- a/examples/miscellaneous/miscellaneous_ex7/miscellaneous_ex7.C +++ b/examples/miscellaneous/miscellaneous_ex7/miscellaneous_ex7.C @@ -142,5 +142,3 @@ void print_help(int, char** argv) << "Add --use-petsc-dm -snes_type virs to run the variational inequality version that ensures the solution is between -1.0 and 1.0 at all times.\n\n" << std::endl; } - - diff --git a/examples/miscellaneous/miscellaneous_ex8/meshless_interpolation_function.h b/examples/miscellaneous/miscellaneous_ex8/meshless_interpolation_function.h index eca58cc9c0c..e8183dabe3c 100644 --- a/examples/miscellaneous/miscellaneous_ex8/meshless_interpolation_function.h +++ b/examples/miscellaneous/miscellaneous_ex8/meshless_interpolation_function.h @@ -48,7 +48,7 @@ class MeshlessInterpolationFunction : public FunctionBase mutable std::vector _pts; mutable std::vector _vals; Threads::spin_mutex &_mutex; - + public: /** @@ -59,7 +59,7 @@ class MeshlessInterpolationFunction : public FunctionBase _mfi (mfi), _mutex(mutex) {} - + /** * The actual initialization process. @@ -144,7 +144,7 @@ void MeshlessInterpolationFunction::clear () inline AutoPtr > MeshlessInterpolationFunction::clone () const -{ +{ return AutoPtr > (new MeshlessInterpolationFunction (_mfi, _mutex) ); } @@ -153,4 +153,3 @@ MeshlessInterpolationFunction::clone () const #endif // LIBMESH_MESHLESS_INTERPOLATION_FUNCTION_H - diff --git a/examples/miscellaneous/miscellaneous_ex8/miscellaneous_ex8.C b/examples/miscellaneous/miscellaneous_ex8/miscellaneous_ex8.C index f147dc6ecb1..49a64a7996c 100644 --- a/examples/miscellaneous/miscellaneous_ex8/miscellaneous_ex8.C +++ b/examples/miscellaneous/miscellaneous_ex8/miscellaneous_ex8.C @@ -19,7 +19,7 @@ //

Miscellaneous Example 8 - Meshfree Interpolation Utilities.

// -// LibMesh provides some utilities for pointcloud-type interpolation, as +// LibMesh provides some utilities for pointcloud-type interpolation, as // demonstrated in this example. // Example include files @@ -65,7 +65,7 @@ Real exact_solution_u (const Point &p) x = p(0), y = p(1), z = p(2); - + return (x*x*x + y*y*y*y + z*z*z*z*z); @@ -79,7 +79,7 @@ Real exact_solution_v (const Point &p) x = p(0), y = p(1), z = p(2); - + return (x*x + y*y + z*z*z); @@ -103,7 +103,7 @@ void init_sys(EquationSystems& es, // Get a reference to the Convection-Diffusion system object. System & system = es.get_system(system_name); - + system.project_solution(exact_value, NULL, es.parameters); } @@ -129,35 +129,35 @@ int main(int argc, char** argv) std::vector tgt_pts; std::vector tgt_data_idi, tgt_data_rbi; std::vector field_vars; - + field_vars.push_back("u"); field_vars.push_back("v"); - + InverseDistanceInterpolation<3> idi (/* n_interp_pts = */ 8, /* power = */ 2); RadialBasisInterpolation<3> rbi; - + idi.set_field_variables (field_vars); rbi.set_field_variables (field_vars); - + create_random_point_cloud (100, idi.get_source_points()); - + // Explicitly set the data values we will interpolate from { const std::vector &src_pts (idi.get_source_points()); std::vector &src_vals (idi.get_source_vals()); - + src_vals.clear(); src_vals.reserve(2*src_pts.size()); - + for (std::vector::const_iterator pt_it=src_pts.begin(); pt_it != src_pts.end(); ++pt_it) { src_vals.push_back (exact_solution_u (*pt_it)); src_vals.push_back (exact_solution_v (*pt_it)); - } + } } // give rbi the same info as idi @@ -166,9 +166,9 @@ int main(int argc, char** argv) idi.prepare_for_use(); rbi.prepare_for_use(); - + std::cout << idi; - + // Interpolate to some other random points, and evaluate the result { create_random_point_cloud (10, @@ -179,15 +179,15 @@ int main(int argc, char** argv) idi.interpolate_field_data (field_vars, tgt_pts, tgt_data_idi); - + rbi.interpolate_field_data (field_vars, tgt_pts, tgt_data_rbi); - - std::vector::const_iterator + + std::vector::const_iterator v_idi=tgt_data_idi.begin(), v_rbi=tgt_data_rbi.begin(); - + for (std::vector::const_iterator p_it=tgt_pts.begin(); p_it!=tgt_pts.end(); ++p_it) { @@ -227,7 +227,7 @@ int main(int argc, char** argv) sys_a.attach_init_function (init_sys); es_a.init(); - + // Write out the initial conditions. TecplotIO(mesh_a).write_equation_systems ("src.dat", es_a); @@ -238,7 +238,7 @@ int main(int argc, char** argv) std::vector &src_pts (idi.get_source_points()); std::vector &src_vals (idi.get_source_vals()); - std::vector field_vars; + std::vector field_vars; field_vars.push_back("Cp"); idi.set_field_variables(field_vars); @@ -253,8 +253,8 @@ int main(int argc, char** argv) const Node *node(*nd); src_pts.push_back(*node); src_vals.push_back(sys_a.current_solution(node->dof_number(0,0,0))); - } - + } + rbi.set_field_variables(field_vars); rbi.get_source_points() = idi.get_source_points(); rbi.get_source_vals() = idi.get_source_vals(); @@ -270,11 +270,11 @@ int main(int argc, char** argv) { Threads::spin_mutex mutex; MeshlessInterpolationFunction mif(idi, mutex); - + // project the solution onto system b es_b.init(); sys_b.project_solution (&mif); - + // Write the result TecplotIO(mesh_b).write_equation_systems ("dest_idi.dat", es_b); @@ -286,10 +286,10 @@ int main(int argc, char** argv) { Threads::spin_mutex mutex; MeshlessInterpolationFunction mif(rbi, mutex); - + // project the solution onto system b sys_b.project_solution (&mif); - + // Write the result TecplotIO(mesh_b).write_equation_systems ("dest_rbi.dat", es_b); @@ -297,7 +297,7 @@ int main(int argc, char** argv) } - + } return 0; } diff --git a/examples/reduced_basis/reduced_basis_ex1/Makefile.am b/examples/reduced_basis/reduced_basis_ex1/Makefile.am index 909914e6f8f..dac856bddd6 100644 --- a/examples/reduced_basis/reduced_basis_ex1/Makefile.am +++ b/examples/reduced_basis/reduced_basis_ex1/Makefile.am @@ -4,10 +4,10 @@ install_dir = $(examples_install_path)/reduced_basis/ex1 data = reduced_basis_ex1.C assembly.h rb_classes.h reduced_basis_ex1.in run.sh sources = $(data) run.sh -CLEANFILES = RB_sol.e offline_data/RB_F_000.xdr offline_data/RB_A_002.xdr offline_data/RB_A_001.xdr offline_data/RB_A_000.xdr offline_data/parameter_ranges.xdr offline_data/output_003_dual_innerprods.xdr offline_data/output_003_000.xdr offline_data/output_002_dual_innerprods.xdr offline_data/output_002_000.xdr offline_data/output_001_dual_innerprods.xdr offline_data/output_001_000.xdr offline_data/output_000_dual_innerprods.xdr offline_data/output_000_000.xdr offline_data/n_bfs.xdr offline_data/greedy_params.xdr offline_data/Fq_innerprods.xdr offline_data/Fq_Aq_innerprods.xdr offline_data/bf_header.xdr offline_data/bf9.xdr offline_data/bf8.xdr offline_data/bf7.xdr offline_data/bf6.xdr offline_data/bf5.xdr offline_data/bf4.xdr offline_data/bf3.xdr offline_data/bf2.xdr offline_data/bf19.xdr offline_data/bf18.xdr offline_data/bf17.xdr offline_data/bf16.xdr offline_data/bf15.xdr offline_data/bf14.xdr offline_data/bf13.xdr offline_data/bf12.xdr offline_data/bf11.xdr offline_data/bf10.xdr offline_data/bf1.xdr offline_data/bf0.xdr offline_data/Aq_Aq_innerprods.xdr bf0.e +CLEANFILES = RB_sol.e offline_data/RB_F_000.xdr offline_data/RB_A_002.xdr offline_data/RB_A_001.xdr offline_data/RB_A_000.xdr offline_data/parameter_ranges.xdr offline_data/output_003_dual_innerprods.xdr offline_data/output_003_000.xdr offline_data/output_002_dual_innerprods.xdr offline_data/output_002_000.xdr offline_data/output_001_dual_innerprods.xdr offline_data/output_001_000.xdr offline_data/output_000_dual_innerprods.xdr offline_data/output_000_000.xdr offline_data/n_bfs.xdr offline_data/greedy_params.xdr offline_data/Fq_innerprods.xdr offline_data/Fq_Aq_innerprods.xdr offline_data/bf_header.xdr offline_data/bf9.xdr offline_data/bf8.xdr offline_data/bf7.xdr offline_data/bf6.xdr offline_data/bf5.xdr offline_data/bf4.xdr offline_data/bf3.xdr offline_data/bf2.xdr offline_data/bf19.xdr offline_data/bf18.xdr offline_data/bf17.xdr offline_data/bf16.xdr offline_data/bf15.xdr offline_data/bf14.xdr offline_data/bf13.xdr offline_data/bf12.xdr offline_data/bf11.xdr offline_data/bf10.xdr offline_data/bf1.xdr offline_data/bf0.xdr offline_data/Aq_Aq_innerprods.xdr bf0.e clean-local: - -rm -rf offline_data + -rm -rf offline_data # also need to link files for VPATH builds if LIBMESH_VPATH_BUILD diff --git a/examples/reduced_basis/reduced_basis_ex1/assembly.h b/examples/reduced_basis/reduced_basis_ex1/assembly.h index 4da75ae4d89..f1bf9b493b8 100644 --- a/examples/reduced_basis/reduced_basis_ex1/assembly.h +++ b/examples/reduced_basis/reduced_basis_ex1/assembly.h @@ -174,7 +174,7 @@ struct OutputAssembly : ElemAssembly // Now we will build the affine operator unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + Real output_area = (max_x-min_x) * (max_y-min_y); Point centroid = c.elem->centroid(); @@ -184,7 +184,7 @@ struct OutputAssembly : ElemAssembly for (unsigned int i=0; i != n_u_dofs; i++) c.get_elem_residual()(i) += JxW[qp] * ( 1.*phi[i][qp] ) / output_area; } - + // Member variables that define the output region in 2D Real min_x, max_x, min_y, max_y; }; @@ -236,9 +236,9 @@ struct CDRBAssemblyExpansion : RBAssemblyExpansion attach_A_assembly(&A0_assembly); // Attach the lhs assembly attach_A_assembly(&A1_assembly); attach_A_assembly(&A2_assembly); - + attach_F_assembly(&F0_assembly); // Attach the rhs assembly - + attach_output_assembly(&L0); // Attach output 0 assembly attach_output_assembly(&L1); // Attach output 1 assembly attach_output_assembly(&L2); // Attach output 2 assembly @@ -257,5 +257,3 @@ struct CDRBAssemblyExpansion : RBAssemblyExpansion }; #endif - - diff --git a/examples/reduced_basis/reduced_basis_ex1/rb_classes.h b/examples/reduced_basis/reduced_basis_ex1/rb_classes.h index 06140dad59a..1565d20b946 100644 --- a/examples/reduced_basis/reduced_basis_ex1/rb_classes.h +++ b/examples/reduced_basis/reduced_basis_ex1/rb_classes.h @@ -7,12 +7,12 @@ // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // rbOOmit is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -100,10 +100,10 @@ class SimpleRBConstruction : public RBConstruction virtual void init_data() { u_var = this->add_variable ("u", FIRST); - + // Generate a DirichletBoundary object dirichlet_bc = build_zero_dirichlet_boundary_object(); - + // Set the Dirichet boundary IDs // and the Dirichlet boundary variable numbers dirichlet_bc->b.insert(0); @@ -111,7 +111,7 @@ class SimpleRBConstruction : public RBConstruction dirichlet_bc->b.insert(2); dirichlet_bc->b.insert(3); dirichlet_bc->variables.push_back(u_var); - + // Attach dirichlet_bc (must do this _before_ Parent::init_data) get_dof_map().add_dirichlet_boundary(*dirichlet_bc); @@ -142,7 +142,7 @@ class SimpleRBConstruction : public RBConstruction * Variable number for u. */ unsigned int u_var; - + /** * The object that stores the "assembly" expansion of the parameter dependent PDE, * i.e. the objects that define how to assemble the set of parameter-independent diff --git a/examples/reduced_basis/reduced_basis_ex1/reduced_basis_ex1.C b/examples/reduced_basis/reduced_basis_ex1/reduced_basis_ex1.C index b450b6fe637..dab3d53af1d 100644 --- a/examples/reduced_basis/reduced_basis_ex1/reduced_basis_ex1.C +++ b/examples/reduced_basis/reduced_basis_ex1/reduced_basis_ex1.C @@ -6,23 +6,23 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //

Reduced Basis Example 1 - Certified Reduced Basis Method

- + // In this example problem we use the Certified Reduced Basis method // to solve a steady convection-diffusion problem on the unit square. // The reduced basis method relies on an expansion of the PDE in the // form \sum_q=1^Q_a theta_a^q(\mu) * a^q(u,v) = \sum_q=1^Q_f theta_f^q(\mu) f^q(v) -// where theta_a, theta_f are parameter dependent functions and +// where theta_a, theta_f are parameter dependent functions and // a^q, f^q are parameter independent operators (\mu denotes a parameter). // We first attach the parameter dependent functions and paramater @@ -79,14 +79,14 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Parse the input file (reduced_basis_ex1.in) using GetPot std::string parameters_filename = "reduced_basis_ex1.in"; GetPot infile(parameters_filename); unsigned int n_elem = infile("n_elem", 1); // Determines the number of elements in the "truth" mesh const unsigned int dim = 2; // The number of spatial dimensions - + bool store_basis_functions = infile("store_basis_functions", true); // Do we write the RB basis functions to disk? // Read the "online_mode" flag from the command line @@ -122,7 +122,7 @@ int main (int argc, char** argv) // Reduced Basis calculations. This is required in both the // "Offline" and "Online" stages. SimpleRBEvaluation rb_eval; - + // We need to give the RBConstruction object a pointer to // our RBEvaluation object rb_con.set_rb_evaluation(rb_eval); @@ -144,10 +144,10 @@ int main (int argc, char** argv) // "truth" solves, at well-chosen parameter values and employing // these snapshots as basis functions. rb_con.train_reduced_basis(); - + // Write out the data that will subsequently be required for the Evaluation stage rb_con.get_rb_evaluation().write_offline_data_to_files(); - + // If requested, write out the RB basis functions for visualization purposes if(store_basis_functions) { @@ -159,7 +159,7 @@ int main (int argc, char** argv) { // Read in the reduced basis data rb_eval.read_offline_data_from_files(); - + // Read in online_N and initialize online parameters unsigned int online_N = infile("online_N",1); Real online_x_vel = infile("online_x_vel", 0.); @@ -191,13 +191,13 @@ int main (int argc, char** argv) { // Read in the basis functions rb_eval.read_in_basis_functions(rb_con); - + // Plot the solution rb_con.load_rb_solution(); #ifdef LIBMESH_HAVE_EXODUS_API ExodusII_IO(mesh).write_equation_systems ("RB_sol.e",equation_systems); #endif - + // Plot the first basis function that was generated from the train_reduced_basis // call in the Offline stage rb_con.load_basis_function(0); @@ -209,4 +209,3 @@ int main (int argc, char** argv) return 0; } - diff --git a/examples/reduced_basis/reduced_basis_ex2/assembly.h b/examples/reduced_basis/reduced_basis_ex2/assembly.h index 8f9a8f91ebf..caae0a205c5 100644 --- a/examples/reduced_basis/reduced_basis_ex2/assembly.h +++ b/examples/reduced_basis/reduced_basis_ex2/assembly.h @@ -213,7 +213,7 @@ struct OutputAssembly : ElemAssembly // Now we will build the affine operator unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + Real output_area = (max_x-min_x) * (max_y-min_y); Point centroid = c.elem->centroid(); @@ -223,7 +223,7 @@ struct OutputAssembly : ElemAssembly for (unsigned int i=0; i != n_u_dofs; i++) c.get_elem_residual()(i) += JxW[qp] * ( 1.*phi[i][qp] ) / output_area; } - + // Member variables that define the output region in 2D Real min_x, max_x, min_y, max_y; }; @@ -275,9 +275,9 @@ struct Ex02RBAssemblyExpansion : RBAssemblyExpansion attach_A_assembly(&A0_assembly); // Attach the lhs assembly attach_A_assembly(&A1_assembly); attach_A_assembly(&A2_assembly); - + attach_F_assembly(&F0_assembly); // Attach the rhs assembly - + attach_output_assembly(&L0); // Attach output 0 assembly attach_output_assembly(&L1); // Attach output 1 assembly attach_output_assembly(&L2); // Attach output 2 assembly @@ -299,4 +299,3 @@ struct Ex02RBAssemblyExpansion : RBAssemblyExpansion #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK #endif - diff --git a/examples/reduced_basis/reduced_basis_ex2/rb_classes.h b/examples/reduced_basis/reduced_basis_ex2/rb_classes.h index a5315319316..b086d8bbed3 100644 --- a/examples/reduced_basis/reduced_basis_ex2/rb_classes.h +++ b/examples/reduced_basis/reduced_basis_ex2/rb_classes.h @@ -7,12 +7,12 @@ // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // rbOOmit is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -63,7 +63,7 @@ class SimpleRBEvaluation : public RBEvaluation * a parameter-dependent lower bound for the coercivity constant. */ virtual Real get_stability_lower_bound() - { + { rb_scm_eval->set_parameters( get_parameters() ); return rb_scm_eval->get_SCM_LB() ; } @@ -72,7 +72,7 @@ class SimpleRBEvaluation : public RBEvaluation * Pointer to the SCM object that will provide our coercivity constant lower bound. */ RBSCMEvaluation* rb_scm_eval; - + /** * The object that stores the "theta" expansion of the parameter dependent PDE, * i.e. the set of parameter-dependent functions in the affine expansion of the PDE. @@ -118,17 +118,17 @@ class SimpleRBConstruction : public RBConstruction // Generate a DirichletBoundary object dirichlet_bc = build_zero_dirichlet_boundary_object(); - + // Set the Dirichet boundary IDs // and the Dirichlet boundary variable numbers dirichlet_bc->b.insert(3); dirichlet_bc->variables.push_back(u_var); - + // Attach dirichlet_bc (must do this _before_ Parent::init_data) get_dof_map().add_dirichlet_boundary(*dirichlet_bc); Parent::init_data(); - + // Set the rb_assembly_expansion for this Construction object. set_rb_assembly_expansion(ex02_rb_assembly_expansion); @@ -154,7 +154,7 @@ class SimpleRBConstruction : public RBConstruction * Variable number for u. */ unsigned int u_var; - + /** * The object that stores the "assembly" expansion of the parameter dependent PDE, * i.e. the objects that define how to assemble the set of parameter-independent diff --git a/examples/reduced_basis/reduced_basis_ex2/reduced_basis_ex2.C b/examples/reduced_basis/reduced_basis_ex2/reduced_basis_ex2.C index 5fd68d3d3e2..c69f016e520 100644 --- a/examples/reduced_basis/reduced_basis_ex2/reduced_basis_ex2.C +++ b/examples/reduced_basis/reduced_basis_ex2/reduced_basis_ex2.C @@ -6,12 +6,12 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -85,7 +85,7 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Parse the input file (reduced_basis_ex2.in) using GetPot std::string parameters_filename = "reduced_basis_ex2.in"; GetPot infile(parameters_filename); @@ -151,11 +151,11 @@ int main (int argc, char** argv) // Tell rb_eval about rb_scm_eval rb_eval.rb_scm_eval = &rb_scm_eval; - + // Finally, need to give rb_scm_con and rb_eval a pointer to the // SCM evaluation object, rb_scm_eval rb_scm_con.set_rb_scm_evaluation(rb_scm_eval); - + if(!online_mode) // Perform the Offline stage of the RB method { // Read in the data that defines this problem from the specified text file @@ -170,7 +170,7 @@ int main (int argc, char** argv) // This sets up the necessary data structures and performs // initial assembly of the "truth" affine expansion of the PDE. rb_con.initialize_rb_construction(); - + // Perform the SCM Greedy algorithm to derive the data required // for rb_scm_eval to provide a coercivity lower bound. rb_scm_con.perform_SCM_greedy(); @@ -179,11 +179,11 @@ int main (int argc, char** argv) // "truth" solves, at well-chosen parameter values and employing // these snapshots as basis functions. rb_con.train_reduced_basis(); - + // Write out the data that will subsequently be required for the Evaluation stage rb_con.get_rb_evaluation().write_offline_data_to_files("rb_data"); rb_scm_con.get_rb_scm_evaluation().write_offline_data_to_files("scm_data"); - + // If requested, write out the RB basis functions for visualization purposes if(store_basis_functions) { @@ -209,7 +209,7 @@ int main (int argc, char** argv) online_mu.set_value("mu_2", online_mu_2); rb_eval.set_parameters(online_mu); rb_eval.print_parameters(); - + // Now do the Online solve using the precomputed reduced basis rb_eval.rb_solve(online_N); @@ -231,13 +231,13 @@ int main (int argc, char** argv) { // Read in the basis functions rb_eval.read_in_basis_functions(rb_con,"rb_data"); - + // Plot the solution rb_con.load_rb_solution(); #ifdef LIBMESH_HAVE_EXODUS_API ExodusII_IO(mesh).write_equation_systems ("RB_sol.e",equation_systems); #endif - + // Plot the first basis function that was generated from the train_reduced_basis // call in the Offline stage rb_con.load_basis_function(0); @@ -251,4 +251,3 @@ int main (int argc, char** argv) #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK } - diff --git a/examples/reduced_basis/reduced_basis_ex3/assembly.h b/examples/reduced_basis/reduced_basis_ex3/assembly.h index f268424e61a..3a9fd685d54 100644 --- a/examples/reduced_basis/reduced_basis_ex3/assembly.h +++ b/examples/reduced_basis/reduced_basis_ex3/assembly.h @@ -202,7 +202,7 @@ struct OutputAssembly : ElemAssembly // Now we will build the affine operator unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + Real output_area = (max_x-min_x) * (max_y-min_y); Point centroid = c.elem->centroid(); @@ -212,7 +212,7 @@ struct OutputAssembly : ElemAssembly for (unsigned int i=0; i != n_u_dofs; i++) c.get_elem_residual()(i) += JxW[qp] * ( 1.*phi[i][qp] ) / output_area; } - + // Member variables that define the output region in 2D Real min_x, max_x, min_y, max_y; }; @@ -267,9 +267,9 @@ struct CDRBAssemblyExpansion : TransientRBAssemblyExpansion attach_A_assembly(&A0_assembly); // Attach the lhs assembly attach_A_assembly(&A1_assembly); attach_A_assembly(&A2_assembly); - + attach_F_assembly(&F0_assembly); // Attach the rhs assembly - + attach_output_assembly(&L0); // Attach output 0 assembly attach_output_assembly(&L1); // Attach output 1 assembly attach_output_assembly(&L2); // Attach output 2 assembly diff --git a/examples/reduced_basis/reduced_basis_ex3/rb_classes.h b/examples/reduced_basis/reduced_basis_ex3/rb_classes.h index 40c2707c993..e7dd2cfb7d7 100644 --- a/examples/reduced_basis/reduced_basis_ex3/rb_classes.h +++ b/examples/reduced_basis/reduced_basis_ex3/rb_classes.h @@ -7,12 +7,12 @@ // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // rbOOmit is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -111,7 +111,7 @@ class SimpleRBConstruction : public TransientRBConstruction dirichlet_bc->b.insert(2); dirichlet_bc->b.insert(3); dirichlet_bc->variables.push_back(u_var); - + // Attach dirichlet_bc (must do this _before_ Parent::init_data) get_dof_map().add_dirichlet_boundary(*dirichlet_bc); @@ -144,7 +144,7 @@ class SimpleRBConstruction : public TransientRBConstruction * Variable number for u. */ unsigned int u_var; - + /** * The object that stores the "assembly" expansion of the parameter dependent PDE, * i.e. the objects that define how to assemble the set of parameter-independent diff --git a/examples/reduced_basis/reduced_basis_ex3/reduced_basis_ex3.C b/examples/reduced_basis/reduced_basis_ex3/reduced_basis_ex3.C index 12c0f75a512..8e200c83696 100644 --- a/examples/reduced_basis/reduced_basis_ex3/reduced_basis_ex3.C +++ b/examples/reduced_basis/reduced_basis_ex3/reduced_basis_ex3.C @@ -6,12 +6,12 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -89,7 +89,7 @@ int main (int argc, char** argv) // Create an equation systems object. EquationSystems equation_systems (mesh); - + // We override RBConstruction with SimpleRBConstruction in order to // specialize a few functions for this particular problem. SimpleRBConstruction & rb_con = @@ -129,10 +129,10 @@ int main (int argc, char** argv) // "truth" solves, at well-chosen parameter values and employing // these snapshots as basis functions. rb_con.train_reduced_basis(); - + // Write out the data that will subsequently be required for the Evaluation stage rb_con.get_rb_evaluation().write_offline_data_to_files(); - + // If requested, write out the RB basis functions for visualization purposes if(store_basis_functions) { @@ -144,7 +144,7 @@ int main (int argc, char** argv) { // Read in the reduced basis data rb_eval.read_offline_data_from_files(); - + // Read in online_N and initialize online parameters unsigned int online_N = infile("online_N",1); Real online_x_vel = infile("online_x_vel", 0.); @@ -157,7 +157,7 @@ int main (int argc, char** argv) // Now do the Online solve using the precomputed reduced basis Real error_bound_final_time = rb_eval.rb_solve(online_N); - + libMesh::out << "Error bound (absolute) at the final time is " << error_bound_final_time << std::endl << std::endl; @@ -165,7 +165,7 @@ int main (int argc, char** argv) { // Read in the basis functions rb_eval.read_in_basis_functions(rb_con); - + // Plot the solution at the final time level rb_con.pull_temporal_discretization_data( rb_eval ); rb_con.set_time_step(rb_con.get_n_time_steps()); @@ -173,7 +173,7 @@ int main (int argc, char** argv) #ifdef LIBMESH_HAVE_EXODUS_API ExodusII_IO(mesh).write_equation_systems ("RB_sol.e",equation_systems); #endif - + // Plot the first basis function that was generated from the train_reduced_basis // call in the Offline stage rb_con.load_basis_function(0); @@ -187,4 +187,3 @@ int main (int argc, char** argv) #endif // LIBMESH_HAVE_SLEPC } - diff --git a/examples/reduced_basis/reduced_basis_ex4/Makefile.am b/examples/reduced_basis/reduced_basis_ex4/Makefile.am index 7b64c52b5cd..1dd404e170a 100644 --- a/examples/reduced_basis/reduced_basis_ex4/Makefile.am +++ b/examples/reduced_basis/reduced_basis_ex4/Makefile.am @@ -4,7 +4,7 @@ install_dir = $(examples_install_path)/reduced_basis/ex4 data = reduced_basis_ex4.C assembly.h eim_classes.h rb_classes.h reduced_basis_ex4.in eim.in rb.in run.sh sources = $(data) run.sh -CLEANFILES = RB_sol.e rb_data/RB_F_019.xdr rb_data/RB_F_018.xdr rb_data/RB_F_017.xdr rb_data/RB_F_016.xdr rb_data/RB_F_015.xdr rb_data/RB_F_014.xdr rb_data/RB_F_013.xdr rb_data/RB_F_012.xdr rb_data/RB_F_011.xdr rb_data/RB_F_010.xdr rb_data/RB_F_009.xdr rb_data/RB_F_008.xdr rb_data/RB_F_007.xdr rb_data/RB_F_006.xdr rb_data/RB_F_005.xdr rb_data/RB_F_004.xdr rb_data/RB_F_003.xdr rb_data/RB_F_002.xdr rb_data/RB_F_001.xdr rb_data/RB_F_000.xdr rb_data/RB_A_000.xdr rb_data/parameter_ranges.xdr rb_data/n_bfs.xdr rb_data/greedy_params.xdr rb_data/Fq_innerprods.xdr rb_data/Fq_Aq_innerprods.xdr rb_data/bf_header.xdr rb_data/bf9.xdr rb_data/bf8.xdr rb_data/bf7.xdr rb_data/bf6.xdr rb_data/bf5.xdr rb_data/bf4.xdr rb_data/bf3.xdr rb_data/bf2.xdr rb_data/bf14.xdr rb_data/bf13.xdr rb_data/bf12.xdr rb_data/bf11.xdr rb_data/bf10.xdr rb_data/bf1.xdr rb_data/bf0.xdr rb_data/Aq_Aq_innerprods.xdr eim_data/RB_inner_product_matrix.xdr eim_data/parameter_ranges.xdr eim_data/n_bfs.xdr eim_data/interpolation_points_var.xdr eim_data/interpolation_points.xdr eim_data/interpolation_matrix.xdr eim_data/greedy_params.xdr eim_data/Fq_innerprods.xdr eim_data/Fq_Aq_innerprods.xdr eim_data/extra_interpolation_point_var.xdr eim_data/extra_interpolation_point.xdr eim_data/extra_interpolation_matrix_row.xdr eim_data/bf_header.xdr eim_data/bf9.xdr eim_data/bf8.xdr eim_data/bf7.xdr eim_data/bf6.xdr eim_data/bf5.xdr eim_data/bf4.xdr eim_data/bf3.xdr eim_data/bf2.xdr eim_data/bf19.xdr eim_data/bf18.xdr eim_data/bf17.xdr eim_data/bf16.xdr eim_data/bf15.xdr eim_data/bf14.xdr eim_data/bf13.xdr eim_data/bf12.xdr eim_data/bf11.xdr eim_data/bf10.xdr eim_data/bf1.xdr eim_data/bf0.xdr eim_data/Aq_Aq_innerprods.xdr +CLEANFILES = RB_sol.e rb_data/RB_F_019.xdr rb_data/RB_F_018.xdr rb_data/RB_F_017.xdr rb_data/RB_F_016.xdr rb_data/RB_F_015.xdr rb_data/RB_F_014.xdr rb_data/RB_F_013.xdr rb_data/RB_F_012.xdr rb_data/RB_F_011.xdr rb_data/RB_F_010.xdr rb_data/RB_F_009.xdr rb_data/RB_F_008.xdr rb_data/RB_F_007.xdr rb_data/RB_F_006.xdr rb_data/RB_F_005.xdr rb_data/RB_F_004.xdr rb_data/RB_F_003.xdr rb_data/RB_F_002.xdr rb_data/RB_F_001.xdr rb_data/RB_F_000.xdr rb_data/RB_A_000.xdr rb_data/parameter_ranges.xdr rb_data/n_bfs.xdr rb_data/greedy_params.xdr rb_data/Fq_innerprods.xdr rb_data/Fq_Aq_innerprods.xdr rb_data/bf_header.xdr rb_data/bf9.xdr rb_data/bf8.xdr rb_data/bf7.xdr rb_data/bf6.xdr rb_data/bf5.xdr rb_data/bf4.xdr rb_data/bf3.xdr rb_data/bf2.xdr rb_data/bf14.xdr rb_data/bf13.xdr rb_data/bf12.xdr rb_data/bf11.xdr rb_data/bf10.xdr rb_data/bf1.xdr rb_data/bf0.xdr rb_data/Aq_Aq_innerprods.xdr eim_data/RB_inner_product_matrix.xdr eim_data/parameter_ranges.xdr eim_data/n_bfs.xdr eim_data/interpolation_points_var.xdr eim_data/interpolation_points.xdr eim_data/interpolation_matrix.xdr eim_data/greedy_params.xdr eim_data/Fq_innerprods.xdr eim_data/Fq_Aq_innerprods.xdr eim_data/extra_interpolation_point_var.xdr eim_data/extra_interpolation_point.xdr eim_data/extra_interpolation_matrix_row.xdr eim_data/bf_header.xdr eim_data/bf9.xdr eim_data/bf8.xdr eim_data/bf7.xdr eim_data/bf6.xdr eim_data/bf5.xdr eim_data/bf4.xdr eim_data/bf3.xdr eim_data/bf2.xdr eim_data/bf19.xdr eim_data/bf18.xdr eim_data/bf17.xdr eim_data/bf16.xdr eim_data/bf15.xdr eim_data/bf14.xdr eim_data/bf13.xdr eim_data/bf12.xdr eim_data/bf11.xdr eim_data/bf10.xdr eim_data/bf1.xdr eim_data/bf0.xdr eim_data/Aq_Aq_innerprods.xdr clean-local: -rm -rf rb_data eim_data diff --git a/examples/reduced_basis/reduced_basis_ex4/assembly.h b/examples/reduced_basis/reduced_basis_ex4/assembly.h index 0b70cb7ffa6..e27975c0f59 100644 --- a/examples/reduced_basis/reduced_basis_ex4/assembly.h +++ b/examples/reduced_basis/reduced_basis_ex4/assembly.h @@ -115,7 +115,7 @@ struct EIM_F : RBEIMAssembly { // PDE variable number const unsigned int u_var = 0; - + // EIM variable number const unsigned int eim_var = 0; @@ -124,7 +124,7 @@ struct EIM_F : RBEIMAssembly const std::vector >& phi = c.element_fe_var[u_var]->get_phi(); - + const std::vector& qpoints = c.element_fe_var[u_var]->get_xyz(); diff --git a/examples/reduced_basis/reduced_basis_ex4/eim_classes.h b/examples/reduced_basis/reduced_basis_ex4/eim_classes.h index ec6bfed285d..597a0035f36 100644 --- a/examples/reduced_basis/reduced_basis_ex4/eim_classes.h +++ b/examples/reduced_basis/reduced_basis_ex4/eim_classes.h @@ -23,7 +23,7 @@ class SimpleEIMEvaluation : public RBEIMEvaluation attach_parametrized_function(&sg); } - /** + /** * Parametrized function that we approximate with EIM */ ShiftedGaussian sg; @@ -44,12 +44,12 @@ class SimpleEIMConstruction : public RBEIMConstruction : Parent(es, name_in, number_in) { } - + /** * The type of the parent. */ typedef RBEIMConstruction Parent; - + /** * Provide an implementation of build_eim_assembly */ @@ -57,7 +57,7 @@ class SimpleEIMConstruction : public RBEIMConstruction { return AutoPtr(new EIM_F(*this, index)); } - + /** * Initialize data structures. */ @@ -79,7 +79,7 @@ class SimpleEIMConstruction : public RBEIMConstruction * Inner product assembly object */ EIM_IP_assembly ip; - + }; #endif diff --git a/examples/reduced_basis/reduced_basis_ex4/rb_classes.h b/examples/reduced_basis/reduced_basis_ex4/rb_classes.h index f2f8aa8ff37..463bfe2ecab 100644 --- a/examples/reduced_basis/reduced_basis_ex4/rb_classes.h +++ b/examples/reduced_basis/reduced_basis_ex4/rb_classes.h @@ -7,12 +7,12 @@ // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // rbOOmit is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -85,7 +85,7 @@ class SimpleRBConstruction : public RBConstruction // Generate a DirichletBoundary object dirichlet_bc = build_zero_dirichlet_boundary_object(); - + // Set the Dirichet boundary IDs // and the Dirichlet boundary variable numbers dirichlet_bc->b.insert(0); @@ -93,7 +93,7 @@ class SimpleRBConstruction : public RBConstruction dirichlet_bc->b.insert(2); dirichlet_bc->b.insert(3); dirichlet_bc->variables.push_back(u_var); - + // Attach dirichlet_bc (must do this _before_ Parent::init_data) get_dof_map().add_dirichlet_boundary(*dirichlet_bc); @@ -129,7 +129,7 @@ class SimpleRBConstruction : public RBConstruction * i.e. the set of parameter-dependent functions in the affine expansion of the PDE. */ EimTestRBThetaExpansion eim_test_rb_theta_expansion; - + /** * The object that stores the "assembly" expansion of the parameter dependent PDE, * i.e. the objects that define how to assemble the set of parameter-independent diff --git a/examples/reduced_basis/reduced_basis_ex4/reduced_basis_ex4.C b/examples/reduced_basis/reduced_basis_ex4/reduced_basis_ex4.C index 590286df3ce..61e5a8919ac 100644 --- a/examples/reduced_basis/reduced_basis_ex4/reduced_basis_ex4.C +++ b/examples/reduced_basis/reduced_basis_ex4/reduced_basis_ex4.C @@ -6,12 +6,12 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -91,7 +91,7 @@ int main (int argc, char** argv) equation_systems.add_system ("EIM"); SimpleRBConstruction & rb_construction = equation_systems.add_system ("RB"); - + // Initialize the data structures for the equation system. equation_systems.init (); @@ -104,7 +104,7 @@ int main (int argc, char** argv) // Initialize the EIM RBEvaluation object SimpleEIMEvaluation eim_rb_eval; - + // Set the rb_eval objects for the RBConstructions eim_construction.set_rb_evaluation(eim_rb_eval); rb_construction.set_rb_evaluation(rb_eval); @@ -114,7 +114,7 @@ int main (int argc, char** argv) // Read data from input file and print state eim_construction.process_parameters_file(eim_parameters); eim_construction.print_info(); - + // Perform the EIM Greedy and write out the data eim_construction.initialize_rb_construction(); eim_construction.train_reduced_basis(); @@ -126,7 +126,7 @@ int main (int argc, char** argv) // attach the EIM theta objects to the RBConstruction and RBEvaluation objects eim_rb_eval.initialize_eim_theta_objects(); rb_eval.get_rb_theta_expansion().attach_multiple_F_theta(eim_rb_eval.get_eim_theta_objects()); - + // attach the EIM assembly objects to the RBConstruction object eim_construction.initialize_eim_assembly_objects(); rb_construction.get_rb_assembly_expansion().attach_multiple_F_assembly(eim_construction.get_eim_assembly_objects()); @@ -155,7 +155,7 @@ int main (int argc, char** argv) // attach the EIM theta objects to rb_eval objects eim_rb_eval.initialize_eim_theta_objects(); rb_eval.get_rb_theta_expansion().attach_multiple_F_theta(eim_rb_eval.get_eim_theta_objects()); - + // Read in the offline data for rb_eval rb_eval.read_offline_data_from_files("rb_data"); diff --git a/examples/reduced_basis/reduced_basis_ex5/assembly.C b/examples/reduced_basis/reduced_basis_ex5/assembly.C index a04e63e2734..8270b14bbbd 100644 --- a/examples/reduced_basis/reduced_basis_ex5/assembly.C +++ b/examples/reduced_basis/reduced_basis_ex5/assembly.C @@ -54,10 +54,10 @@ Real elasticity_tensor(unsigned int i, void AssemblyA0::interior_assembly(FEMContext &c) { const unsigned int n_components = rb_sys.n_vars(); - + // make sure we have three components libmesh_assert_equal_to (n_components, 3); - + const unsigned int u_var = rb_sys.u_var; const unsigned int v_var = rb_sys.v_var; const unsigned int w_var = rb_sys.w_var; @@ -69,7 +69,7 @@ void AssemblyA0::interior_assembly(FEMContext &c) // quadrature points. const std::vector >& dphi = c.element_fe_var[u_var]->get_dphi(); - + // Now we will build the affine operator unsigned int n_qpoints = c.element_qrule->n_points(); @@ -77,7 +77,7 @@ void AssemblyA0::interior_assembly(FEMContext &c) n_var_dofs[u_var] = c.dof_indices_var[u_var].size(); n_var_dofs[v_var] = c.dof_indices_var[v_var].size(); n_var_dofs[w_var] = c.dof_indices_var[w_var].size(); - + for (unsigned int C_i = 0; C_i < n_components; C_i++) { unsigned int C_j = 0; @@ -85,7 +85,7 @@ void AssemblyA0::interior_assembly(FEMContext &c) { for (unsigned int C_l = 1; C_l < n_components; C_l++) { - + Real C_ijkl = elasticity_tensor(C_i,C_j,C_k,C_l); for (unsigned int qp=0; qp >& dphi = c.element_fe_var[u_var]->get_dphi(); - + // Now we will build the affine operator unsigned int n_qpoints = c.element_qrule->n_points(); @@ -156,7 +156,7 @@ void AssemblyA1::interior_assembly(FEMContext &c) n_var_dofs[u_var] = c.dof_indices_var[u_var].size(); n_var_dofs[v_var] = c.dof_indices_var[v_var].size(); n_var_dofs[w_var] = c.dof_indices_var[w_var].size(); - + for (unsigned int C_i = 0; C_i < n_components; C_i++) { for (unsigned int C_j = 1; C_j < n_components; C_j++) @@ -165,7 +165,7 @@ void AssemblyA1::interior_assembly(FEMContext &c) { for (unsigned int C_l = 1; C_l < n_components; C_l++) { - + Real C_ijkl = elasticity_tensor(C_i,C_j,C_k,C_l); for (unsigned int qp=0; qp >& dphi = c.element_fe_var[u_var]->get_dphi(); - + // Now we will build the affine operator unsigned int n_qpoints = c.element_qrule->n_points(); @@ -211,11 +211,11 @@ void AssemblyA2::interior_assembly(FEMContext &c) n_var_dofs[u_var] = c.dof_indices_var[u_var].size(); n_var_dofs[v_var] = c.dof_indices_var[v_var].size(); n_var_dofs[w_var] = c.dof_indices_var[w_var].size(); - + for (unsigned int C_i = 0; C_i < n_components; C_i++) { unsigned int C_j = 0; - + for (unsigned int C_k = 0; C_k < n_components; C_k++) { unsigned int C_l = 0; @@ -227,7 +227,7 @@ void AssemblyA2::interior_assembly(FEMContext &c) { for (unsigned int j=0; jn_points(); - + DenseSubMatrix& Kuu = c.get_elem_jacobian(u_var,u_var); DenseSubMatrix& Kvv = c.get_elem_jacobian(v_var,v_var); DenseSubMatrix& Kww = c.get_elem_jacobian(w_var,w_var); - + for (unsigned int qp=0; qpadd_variable("u", FIRST); v_var = this->add_variable("v", FIRST); w_var = this->add_variable("w", FIRST); - + // Generate a DirichletBoundary object dirichlet_bc = build_zero_dirichlet_boundary_object(); @@ -84,7 +84,7 @@ class ElasticityRBConstruction : public RBConstruction dirichlet_bc->variables.push_back(u_var); dirichlet_bc->variables.push_back(v_var); dirichlet_bc->variables.push_back(w_var); - + // Attach dirichlet_bc (must do this _before_ Parent::init_data) get_dof_map().add_dirichlet_boundary(*dirichlet_bc); diff --git a/examples/reduced_basis/reduced_basis_ex5/reduced_basis_ex5.C b/examples/reduced_basis/reduced_basis_ex5/reduced_basis_ex5.C index 42cd7f93609..408b0917101 100644 --- a/examples/reduced_basis/reduced_basis_ex5/reduced_basis_ex5.C +++ b/examples/reduced_basis/reduced_basis_ex5/reduced_basis_ex5.C @@ -6,12 +6,12 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -91,7 +91,7 @@ int main(int argc, char** argv) { GetPot command_line(argc, argv); int online_mode = 0; if ( command_line.search(1, "-online_mode") ) { - online_mode = command_line.next(online_mode); + online_mode = command_line.next(online_mode); } @@ -161,7 +161,7 @@ int main(int argc, char** argv) { // Write out the data that will subsequently be required for the Evaluation stage rb_con.get_rb_evaluation().write_offline_data_to_files(); - + // If requested, write out the RB basis functions for visualization purposes if(store_basis_functions) { @@ -186,7 +186,7 @@ int main(int argc, char** argv) { online_mu.set_value("load_Fz", online_load_Fz); rb_eval.set_parameters(online_mu); rb_eval.print_parameters(); - + // Now do the Online solve using the precomputed reduced basis rb_eval.rb_solve( rb_eval.get_n_basis_functions() ); @@ -220,7 +220,7 @@ void scale_mesh_and_plot(EquationSystems& es, const RBParameters& mu, const std: (*node)(0) *= mu.get_value("x_scaling"); } - + // Post-process the solution to compute the stresses compute_stresses(es); @@ -260,10 +260,10 @@ void compute_stresses(EquationSystems& es) AutoPtr fe (FEBase::build(dim, fe_type)); QGauss qrule (dim, fe_type.default_quadrature_order()); fe->attach_quadrature_rule (&qrule); - + const std::vector& JxW = fe->get_JxW(); const std::vector >& dphi = fe->get_dphi(); - + // Also, get a reference to the ExplicitSystem ExplicitSystem& stress_system = es.get_system("StressSystem"); const DofMap& stress_dof_map = stress_system.get_dof_map(); @@ -301,7 +301,7 @@ void compute_stresses(EquationSystems& es) fe->reinit (elem); elem_sigma.resize(3,3); - + for (unsigned int qp=0; qpvolume()); @@ -337,7 +337,7 @@ void compute_stresses(EquationSystems& es) // We are using CONSTANT MONOMIAL basis functions, hence we only need to get // one dof index per variable dof_id_type dof_index = stress_dof_indices_var[0]; - + if( (stress_system.solution->first_local_index() <= dof_index) && (dof_index < stress_system.solution->last_local_index()) ) { @@ -345,10 +345,10 @@ void compute_stresses(EquationSystems& es) } } - + // Also, the von Mises stress - Number vonMises_value = std::sqrt( 0.5*( pow(elem_sigma(0,0) - elem_sigma(1,1),2.) + - pow(elem_sigma(1,1) - elem_sigma(2,2),2.) + + Number vonMises_value = std::sqrt( 0.5*( pow(elem_sigma(0,0) - elem_sigma(1,1),2.) + + pow(elem_sigma(1,1) - elem_sigma(2,2),2.) + pow(elem_sigma(2,2) - elem_sigma(0,0),2.) + 6.*(pow(elem_sigma(0,1),2.) + pow(elem_sigma(1,2),2.) + pow(elem_sigma(2,0),2.)) ) ); @@ -359,7 +359,7 @@ void compute_stresses(EquationSystems& es) { stress_system.solution->set(dof_index, vonMises_value); } - + } // Should call close and update when we set vector entries directly diff --git a/examples/reduced_basis/reduced_basis_ex6/Makefile.am b/examples/reduced_basis/reduced_basis_ex6/Makefile.am index ead7ab1d1ce..4651035f7aa 100644 --- a/examples/reduced_basis/reduced_basis_ex6/Makefile.am +++ b/examples/reduced_basis/reduced_basis_ex6/Makefile.am @@ -4,7 +4,7 @@ install_dir = $(examples_install_path)/reduced_basis/ex6 data = reduced_basis_ex6.C assembly.h eim_classes.h rb_classes.h reduced_basis_ex6.in eim.in rb.in run.sh sources = $(data) run.sh -CLEANFILES = RB_sol.e rb_data/RB_F_001.xdr rb_data/RB_F_000.xdr rb_data/RB_A_005.xdr rb_data/RB_A_004.xdr rb_data/RB_A_003.xdr rb_data/RB_A_002.xdr rb_data/RB_A_001.xdr rb_data/RB_A_000.xdr rb_data/parameter_ranges.xdr rb_data/n_bfs.xdr rb_data/greedy_params.xdr rb_data/Fq_innerprods.xdr rb_data/Fq_Aq_innerprods.xdr rb_data/bf_header.xdr rb_data/bf4.xdr rb_data/bf3.xdr rb_data/bf2.xdr rb_data/bf1.xdr rb_data/bf0.xdr rb_data/Aq_Aq_innerprods.xdr eim_data/RB_inner_product_matrix.xdr eim_data/parameter_ranges.xdr eim_data/n_bfs.xdr eim_data/interpolation_points_var.xdr eim_data/interpolation_points.xdr eim_data/interpolation_matrix.xdr eim_data/greedy_params.xdr eim_data/Fq_innerprods.xdr eim_data/Fq_Aq_innerprods.xdr eim_data/extra_interpolation_point_var.xdr eim_data/extra_interpolation_point.xdr eim_data/extra_interpolation_matrix_row.xdr eim_data/bf_header.xdr eim_data/bf2.xdr eim_data/bf1.xdr eim_data/bf0.xdr eim_data/Aq_Aq_innerprods.xdr +CLEANFILES = RB_sol.e rb_data/RB_F_001.xdr rb_data/RB_F_000.xdr rb_data/RB_A_005.xdr rb_data/RB_A_004.xdr rb_data/RB_A_003.xdr rb_data/RB_A_002.xdr rb_data/RB_A_001.xdr rb_data/RB_A_000.xdr rb_data/parameter_ranges.xdr rb_data/n_bfs.xdr rb_data/greedy_params.xdr rb_data/Fq_innerprods.xdr rb_data/Fq_Aq_innerprods.xdr rb_data/bf_header.xdr rb_data/bf4.xdr rb_data/bf3.xdr rb_data/bf2.xdr rb_data/bf1.xdr rb_data/bf0.xdr rb_data/Aq_Aq_innerprods.xdr eim_data/RB_inner_product_matrix.xdr eim_data/parameter_ranges.xdr eim_data/n_bfs.xdr eim_data/interpolation_points_var.xdr eim_data/interpolation_points.xdr eim_data/interpolation_matrix.xdr eim_data/greedy_params.xdr eim_data/Fq_innerprods.xdr eim_data/Fq_Aq_innerprods.xdr eim_data/extra_interpolation_point_var.xdr eim_data/extra_interpolation_point.xdr eim_data/extra_interpolation_matrix_row.xdr eim_data/bf_header.xdr eim_data/bf2.xdr eim_data/bf1.xdr eim_data/bf0.xdr eim_data/Aq_Aq_innerprods.xdr clean-local: -rm -rf rb_data eim_data diff --git a/examples/reduced_basis/reduced_basis_ex6/assembly.h b/examples/reduced_basis/reduced_basis_ex6/assembly.h index 5a86b77e3f3..8a8dd43e81b 100644 --- a/examples/reduced_basis/reduced_basis_ex6/assembly.h +++ b/examples/reduced_basis/reduced_basis_ex6/assembly.h @@ -205,7 +205,7 @@ struct AssemblyA2 : ElemAssemblyWithConstruction c.get_elem_jacobian()(i,j) += JxW_side[qp] * phi_side[j][qp]*phi_side[i][qp]; } } - + if(*b==4) { for (unsigned int qp=0; qp != n_sidepoints; qp++) @@ -244,7 +244,7 @@ struct AssemblyEIM : RBEIMAssembly { // PDE variable numbers const unsigned int u_var = 0; - + // EIM variable numbers const unsigned int Gx_var = 0; const unsigned int Gy_var = 1; @@ -288,8 +288,8 @@ struct AssemblyEIM : RBEIMAssembly for (unsigned int i=0; i != n_u_dofs; i++) for (unsigned int j=0; j != n_u_dofs; j++) { - c.get_elem_jacobian()(i,j) += JxW[qp] * ( eim_values_Gx[qp]*dphi[i][qp](0)*dphi[j][qp](0) + - eim_values_Gy[qp]*dphi[i][qp](1)*dphi[j][qp](1) + + c.get_elem_jacobian()(i,j) += JxW[qp] * ( eim_values_Gx[qp]*dphi[i][qp](0)*dphi[j][qp](0) + + eim_values_Gy[qp]*dphi[i][qp](1)*dphi[j][qp](1) + eim_values_Gz[qp]*dphi[i][qp](2)*dphi[j][qp](2) ); } } @@ -337,7 +337,7 @@ struct AssemblyF1 : ElemAssembly const std::vector >& phi = c.element_fe_var[u_var]->get_phi(); - + const std::vector& xyz = c.element_fe_var[u_var]->get_xyz(); @@ -350,7 +350,7 @@ struct AssemblyF1 : ElemAssembly for (unsigned int qp=0; qp != n_qpoints; qp++) { Real x_hat = xyz[qp](0); - + for (unsigned int i=0; i != n_u_dofs; i++) c.get_elem_residual()(i) += JxW[qp] * ( 1.*x_hat*phi[i][qp] ); } @@ -404,7 +404,7 @@ struct Ex6EIMInnerProduct : ElemAssembly const unsigned int n_u_dofs = c.dof_indices_var[Gx_var].size(); unsigned int n_qpoints = (c.get_element_qrule())->n_points(); - + DenseSubMatrix& Kxx = c.get_elem_jacobian(Gx_var,Gx_var); DenseSubMatrix& Kyy = c.get_elem_jacobian(Gy_var,Gy_var); DenseSubMatrix& Kzz = c.get_elem_jacobian(Gz_var,Gz_var); @@ -459,7 +459,7 @@ struct Ex6AssemblyExpansion : RBAssemblyExpansion assembly_a0.rb_con = &rb_con; assembly_a1.rb_con = &rb_con; assembly_a2.rb_con = &rb_con; - + attach_A_assembly(&assembly_a0); attach_A_assembly(&assembly_a1); attach_A_assembly(&assembly_a2); @@ -476,5 +476,3 @@ struct Ex6AssemblyExpansion : RBAssemblyExpansion }; #endif - - diff --git a/examples/reduced_basis/reduced_basis_ex6/eim_classes.h b/examples/reduced_basis/reduced_basis_ex6/eim_classes.h index 0fbb27b0bf0..dd7e67700bd 100644 --- a/examples/reduced_basis/reduced_basis_ex6/eim_classes.h +++ b/examples/reduced_basis/reduced_basis_ex6/eim_classes.h @@ -19,7 +19,7 @@ class SimpleEIMEvaluation : public RBEIMEvaluation attach_parametrized_function(&g_y); attach_parametrized_function(&g_z); } - + /** * Build a ThetaEIM rather than an RBEIMTheta. */ @@ -28,7 +28,7 @@ class SimpleEIMEvaluation : public RBEIMEvaluation return AutoPtr(new ThetaEIM(*this, index)); } - /** + /** * Parametrized functions that we approximate with EIM */ Gx g_x; @@ -51,7 +51,7 @@ class SimpleEIMConstruction : public RBEIMConstruction : Parent(es, name_in, number_in) { } - + /** * The type of the parent. */ @@ -64,7 +64,7 @@ class SimpleEIMConstruction : public RBEIMConstruction { return AutoPtr(new AssemblyEIM(*this, index)); } - + /** * Initialize data structures. */ @@ -90,7 +90,7 @@ class SimpleEIMConstruction : public RBEIMConstruction * Inner product assembly object */ Ex6EIMInnerProduct eim_ip; - + }; #endif diff --git a/examples/reduced_basis/reduced_basis_ex6/rb_classes.h b/examples/reduced_basis/reduced_basis_ex6/rb_classes.h index 4d0364bc19a..174de008531 100644 --- a/examples/reduced_basis/reduced_basis_ex6/rb_classes.h +++ b/examples/reduced_basis/reduced_basis_ex6/rb_classes.h @@ -7,12 +7,12 @@ // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // rbOOmit is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -102,16 +102,16 @@ class SimpleRBConstruction : public RBConstruction virtual void init_data() { u_var = this->add_variable ("u", FIRST); - + // Generate a DirichletBoundary object dirichlet_bc = build_zero_dirichlet_boundary_object(); - + // Set the Dirichet boundary IDs // and the Dirichlet boundary variable numbers dirichlet_bc->b.insert(0); dirichlet_bc->b.insert(5); dirichlet_bc->variables.push_back(u_var); - + // Attach dirichlet_bc (must do this _before_ Parent::init_data) get_dof_map().add_dirichlet_boundary(*dirichlet_bc); @@ -142,14 +142,14 @@ class SimpleRBConstruction : public RBConstruction * Variable number for u. */ unsigned int u_var; - + /** * The object that stores the "assembly" expansion of the parameter dependent PDE, * i.e. the objects that define how to assemble the set of parameter-independent * operators in the affine expansion of the PDE. */ Ex6AssemblyExpansion ex6_assembly_expansion; - + /** * The inner product assembly object */ diff --git a/examples/reduced_basis/reduced_basis_ex6/reduced_basis_ex6.C b/examples/reduced_basis/reduced_basis_ex6/reduced_basis_ex6.C index 0b8514c594f..dbefb9a33d6 100644 --- a/examples/reduced_basis/reduced_basis_ex6/reduced_basis_ex6.C +++ b/examples/reduced_basis/reduced_basis_ex6/reduced_basis_ex6.C @@ -6,12 +6,12 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -46,7 +46,7 @@ // \partial\Omega_hat_Biot3 = [0.2] x [-0.2,0.2] x [0,3] // The term -// \kappa \int_\Omega_hat 1/(1+mu*x_hat) v_z w_z +// \kappa \int_\Omega_hat 1/(1+mu*x_hat) v_z w_z // is "non-affine" (in the Reduced Basis sense), since we can't express it // in the form \sum theta_q(kappa,mu) a(v,w). As a result, (as in // reduced_basis_ex4) we must employ the Empirical Interpolation Method (EIM) @@ -104,7 +104,7 @@ int main (int argc, char** argv) // This is a 3D example libmesh_example_assert(3 == LIBMESH_DIM, "3D support"); - + // Parse the input file using GetPot std::string eim_parameters = "eim.in"; std::string rb_parameters = "rb.in"; @@ -113,7 +113,7 @@ int main (int argc, char** argv) unsigned int n_elem_xy = infile("n_elem_xy", 1); unsigned int n_elem_z = infile("n_elem_z", 1); - + // Do we write the RB basis functions to disk? bool store_basis_functions = infile("store_basis_functions", true); @@ -152,7 +152,7 @@ int main (int argc, char** argv) // Initialize the EIM RBEvaluation object SimpleEIMEvaluation eim_rb_eval; - + // Set the rb_eval objects for the RBConstructions eim_construction.set_rb_evaluation(eim_rb_eval); rb_construction.set_rb_evaluation(rb_eval); @@ -162,20 +162,20 @@ int main (int argc, char** argv) // Read data from input file and print state eim_construction.process_parameters_file(eim_parameters); eim_construction.print_info(); - + // Perform the EIM Greedy and write out the data eim_construction.initialize_rb_construction(); - + eim_construction.train_reduced_basis(); eim_construction.get_rb_evaluation().write_offline_data_to_files("eim_data"); - + // Read data from input file and print state rb_construction.process_parameters_file(rb_parameters); // attach the EIM theta objects to the RBEvaluation eim_rb_eval.initialize_eim_theta_objects(); rb_eval.get_rb_theta_expansion().attach_multiple_A_theta(eim_rb_eval.get_eim_theta_objects()); - + // attach the EIM assembly objects to the RBConstruction eim_construction.initialize_eim_assembly_objects(); rb_construction.get_rb_assembly_expansion().attach_multiple_A_assembly(eim_construction.get_eim_assembly_objects()); @@ -204,7 +204,7 @@ int main (int argc, char** argv) // attach the EIM theta objects to rb_eval objects eim_rb_eval.initialize_eim_theta_objects(); rb_eval.get_rb_theta_expansion().attach_multiple_A_theta(eim_rb_eval.get_eim_theta_objects()); - + // Read in the offline data for rb_eval rb_eval.read_offline_data_from_files("rb_data"); @@ -244,11 +244,11 @@ void transform_mesh_and_plot(EquationSystems& es, Real curvature, const std::str MeshBase::node_iterator node_it = mesh.nodes_begin(); const MeshBase::node_iterator node_end = mesh.nodes_end(); - + for( ; node_it != node_end; node_it++) { Node* node = *node_it; - + Real x = (*node)(0); Real z = (*node)(2); @@ -260,4 +260,3 @@ void transform_mesh_and_plot(EquationSystems& es, Real curvature, const std::str ExodusII_IO(mesh).write_equation_systems(filename, es); #endif } - diff --git a/examples/reduced_basis/reduced_basis_ex7/assembly.h b/examples/reduced_basis/reduced_basis_ex7/assembly.h index 19cc8ab1c31..35c2ce7bfe3 100644 --- a/examples/reduced_basis/reduced_basis_ex7/assembly.h +++ b/examples/reduced_basis/reduced_basis_ex7/assembly.h @@ -57,7 +57,7 @@ struct AcousticsInnerProduct : ElemAssembly const std::vector >& phi = c.element_fe_var[p_var]->get_phi(); - + const std::vector >& dphi = c.element_fe_var[p_var]->get_dphi(); @@ -71,7 +71,7 @@ struct AcousticsInnerProduct : ElemAssembly for (unsigned int i=0; i != n_p_dofs; i++) for (unsigned int j=0; j != n_p_dofs; j++) c.elem_jacobian(i,j) += JxW[qp] * (dphi[j][qp](0)*libmesh_conj(dphi[i][qp](0)) + - dphi[j][qp](1)*libmesh_conj(dphi[i][qp](1)) + + dphi[j][qp](1)*libmesh_conj(dphi[i][qp](1)) + (phi[j][qp]*libmesh_conj(phi[i][qp])) ); } }; @@ -156,7 +156,7 @@ struct A2 : ElemAssembly c.elem_jacobian(i,j) += JxW_face[qp] * phi_face[j][qp] * libmesh_conj(phi_face[i][qp]); } } - + MeshBase* mesh; }; @@ -186,7 +186,7 @@ struct A3 : ElemAssembly c.elem_jacobian(i,j) += JxW_face[qp] * phi_face[j][qp] * libmesh_conj(phi_face[i][qp]); } } - + MeshBase* mesh; }; @@ -215,7 +215,7 @@ struct F0 : ElemAssembly c.elem_residual(i) += JxW_face[qp] * libmesh_conj(phi_face[i][qp]); } } - + MeshBase* mesh; }; @@ -244,7 +244,7 @@ struct Output0 : ElemAssembly c.elem_residual(i) += JxW_face[qp] * libmesh_conj(phi_face[i][qp]); } } - + MeshBase* mesh; }; @@ -263,7 +263,7 @@ struct AcousticsRBThetaExpansion : RBThetaExpansion attach_A_theta(&theta_a_3); attach_F_theta(&theta_f_0); // Attach the rhs theta - + attach_output_theta(&theta_output_0); } @@ -289,15 +289,15 @@ struct AcousticsRBAssemblyExpansion : RBAssemblyExpansion A3_assembly.mesh = &mesh_in; F0_assembly.mesh = &mesh_in; Output0_assembly.mesh = &mesh_in; - + // And set up the RBAssemblyExpansion object attach_A_assembly(&A0_assembly); // Attach the lhs assembly attach_A_assembly(&A1_assembly); attach_A_assembly(&A2_assembly); attach_A_assembly(&A3_assembly); - + attach_F_assembly(&F0_assembly); // Attach the rhs assembly - + attach_output_assembly(&Output0_assembly); } diff --git a/examples/reduced_basis/reduced_basis_ex7/rb_classes.h b/examples/reduced_basis/reduced_basis_ex7/rb_classes.h index 4cf3b2496f6..0127100e645 100644 --- a/examples/reduced_basis/reduced_basis_ex7/rb_classes.h +++ b/examples/reduced_basis/reduced_basis_ex7/rb_classes.h @@ -7,12 +7,12 @@ // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // rbOOmit is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -104,7 +104,7 @@ class SimpleRBConstruction : public RBConstruction p_var = this->add_variable ("p", SECOND); Parent::init_data(); - + acoustics_rb_assembly_expansion = new AcousticsRBAssemblyExpansion(get_mesh()); // Set the rb_assembly_expansion for this Construction object. @@ -132,7 +132,7 @@ class SimpleRBConstruction : public RBConstruction * Variable number for pd. */ unsigned int p_var; - + /** * The object that stores the "assembly" expansion of the parameter dependent PDE, * i.e. the objects that define how to assemble the set of parameter-independent diff --git a/examples/reduced_basis/reduced_basis_ex7/reduced_basis_ex7.C b/examples/reduced_basis/reduced_basis_ex7/reduced_basis_ex7.C index 0f3fc449acd..ea4fb705607 100644 --- a/examples/reduced_basis/reduced_basis_ex7/reduced_basis_ex7.C +++ b/examples/reduced_basis/reduced_basis_ex7/reduced_basis_ex7.C @@ -6,18 +6,18 @@ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation; either */ /* version 2.1 of the License, or (at your option) any later version. */ - + /* rbOOmit is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ - + /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //

Reduced Basis Example 7 - Acoustic Horn

- + // In this example problem we use the Certified Reduced Basis method // to solve a complex-valued Helmholtz problem for acoustics. There is only // one parameter in this problem: the forcing frequency at the horn inlet. @@ -72,13 +72,13 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Parse the input file (reduced_basis_ex7.in) using GetPot std::string parameters_filename = "reduced_basis_ex7.in"; GetPot infile(parameters_filename); const unsigned int dim = 2; // The number of spatial dimensions - + bool store_basis_functions = infile("store_basis_functions", true); // Do we write the RB basis functions to disk? // Read the "online_mode" flag from the command line @@ -110,7 +110,7 @@ int main (int argc, char** argv) // Reduced Basis calculations. This is required in both the // "Offline" and "Online" stages. SimpleRBEvaluation rb_eval; - + // We need to give the RBConstruction object a pointer to // our RBEvaluation object rb_con.set_rb_evaluation(rb_eval); @@ -132,10 +132,10 @@ int main (int argc, char** argv) // "truth" solves, at well-chosen parameter values and employing // these snapshots as basis functions. rb_con.train_reduced_basis(); - + // Write out the data that will subsequently be required for the Evaluation stage rb_con.get_rb_evaluation().write_offline_data_to_files(); - + // If requested, write out the RB basis functions for visualization purposes if(store_basis_functions) { @@ -147,7 +147,7 @@ int main (int argc, char** argv) { // Read in the reduced basis data rb_eval.read_offline_data_from_files(); - + // Read in online_N and initialize online parameters Real online_frequency = infile("online_frequency", 0.); RBParameters online_mu; @@ -162,16 +162,16 @@ int main (int argc, char** argv) { // Read in the basis functions rb_eval.read_in_basis_functions(rb_con); - + // Plot the solution rb_con.load_rb_solution(); - + GMVIO(mesh).write_equation_systems ("RB_sol.gmv",equation_systems); } - + // Now do a sweep over frequencies and write out the reflection coefficient for each frequency std::ofstream reflection_coeffs_out("reflection_coefficients.dat"); - + Real n_frequencies = infile("n_frequencies", 0.); Real delta_f = (rb_eval.get_parameter_max("frequency") - rb_eval.get_parameter_min("frequency")) / (n_frequencies-1); for(unsigned int freq_i=0; freq_i("From"); unsigned int from_var = from_sys.add_variable("from"); from_sys.attach_init_function(initialize); @@ -50,8 +50,8 @@ int main(int argc, char* argv[]) Mesh to_mesh; MeshTools::Generation::build_cube(to_mesh, 5, 5, 5, 0, 1, 0, 1, 0, 1, TET4); - to_mesh.print_info(); - EquationSystems to_es(to_mesh); + to_mesh.print_info(); + EquationSystems to_es(to_mesh); System & to_sys = to_es.add_system("To"); unsigned int to_var = to_sys.add_variable("to"); to_es.init(); @@ -59,11 +59,11 @@ int main(int argc, char* argv[]) DTKSolutionTransfer dtk_transfer; dtk_transfer.transfer(from_sys.variable(from_var), to_sys.variable(to_var)); - + to_es.update(); ExodusII_IO(to_mesh).write_equation_systems("to.e", to_es); - + #endif - + return 0; } diff --git a/examples/subdomains/subdomains_ex1/Makefile.am b/examples/subdomains/subdomains_ex1/Makefile.am index 0bda4da0564..f393d816e66 100644 --- a/examples/subdomains/subdomains_ex1/Makefile.am +++ b/examples/subdomains/subdomains_ex1/Makefile.am @@ -1,6 +1,6 @@ BUILT_SOURCES = exact_solution.C DISTCLEANFILES = $(BUILT_SOURCES) -exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C +exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C $(AM_V_GEN)$(LN_S) $< $@ example_name = subdomains_ex1 diff --git a/examples/subdomains/subdomains_ex1/subdomains_ex1.C b/examples/subdomains/subdomains_ex1/subdomains_ex1.C index c399747285c..15ede79120a 100644 --- a/examples/subdomains/subdomains_ex1/subdomains_ex1.C +++ b/examples/subdomains/subdomains_ex1/subdomains_ex1.C @@ -107,10 +107,10 @@ int main (int argc, char** argv) // Declare a performance log for the main program // PerfLog perf_main("Main Program"); - + // Create a GetPot object to parse the command line GetPot command_line (argc, argv); - + // Check for proper calling arguments. if (argc < 3) { @@ -124,19 +124,19 @@ int main (int argc, char** argv) // exception handling. libmesh_error(); } - + // Brief message to the user regarding the program name // and command line arguments. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; i ("Poisson"); - + // Add the variable "u" to "Poisson". "u" // will be approximated using second-order approximation. system.add_variable("u", @@ -303,7 +303,7 @@ int main (int argc, char** argv) // Give the system a pointer to the matrix assembly // function. system.attach_assemble_function (assemble_poisson); - + // Initialize the data structures for the equation system. equation_systems.init(); @@ -321,30 +321,30 @@ int main (int argc, char** argv) // Note that using \p SUBSET_ZERO will cause all dofs outside the // subdomain to be cleared. This will, however, cause some hanging // nodes outside the subdomain to have inconsistent values. - + // Solve the system "Poisson", just like example 2. equation_systems.get_system("Poisson").solve(); // After solving the system write the solution // to a GMV-formatted plot file. if(dim == 1) - { + { GnuPlotIO plot(mesh,"Subdomains Example 1, 1D",GnuPlotIO::GRID_ON); plot.write_equation_systems("gnuplot_script",equation_systems); } else { - GMVIO (mesh).write_equation_systems ((dim == 3) ? + GMVIO (mesh).write_equation_systems ((dim == 3) ? "out_3.gmv" : "out_2.gmv",equation_systems); #ifdef LIBMESH_HAVE_EXODUS_API - ExodusII_IO (mesh).write_equation_systems ((dim == 3) ? + ExodusII_IO (mesh).write_equation_systems ((dim == 3) ? "out_3.e" : "out_2.e",equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API } #endif // #ifndef LIBMESH_ENABLE_AMR - - // All done. + + // All done. return 0; } @@ -372,7 +372,7 @@ void assemble_poisson(EquationSystems& es, // logging, since there may be many PerfLogs in an // application. PerfLog perf_log ("Matrix Assembly"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -381,7 +381,7 @@ void assemble_poisson(EquationSystems& es, // Get a reference to the LinearImplicitSystem we are solving LinearImplicitSystem& system = es.get_system("Poisson"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -397,7 +397,7 @@ void assemble_poisson(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); @@ -407,12 +407,12 @@ void assemble_poisson(EquationSystems& es, // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, FIFTH); - + // Tell the finte element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); @@ -420,7 +420,7 @@ void assemble_poisson(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); // The physical XY locations of the quadrature points on the element. @@ -467,20 +467,20 @@ void assemble_poisson(EquationSystems& es, // Start logging the shape function initialization. // This is done through a simple function call with // the name of the event to log. - perf_log.push("elem init"); - + perf_log.push("elem init"); + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will // contribute to. dof_map.dof_indices (elem, dof_indices); - + // Compute the element-specific data for the current // element. This involves computing the location of the // quadrature points (q_point) and the shape functions // (phi, dphi) for the current element. fe->reinit (elem); - + // Zero the element matrix and right-hand side before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from @@ -489,14 +489,14 @@ void assemble_poisson(EquationSystems& es, // triangle, now we are on a quadrilateral). Ke.resize (dof_indices.size(), dof_indices.size()); - + Fe.resize (dof_indices.size()); - + // Stop logging the shape function initialization. // If you forget to stop logging an event the PerfLog // object will probably catch the error and abort. - perf_log.pop("elem init"); - + perf_log.pop("elem init"); + // Now we will build the element matrix. This involves // a double loop to integrate the test funcions (i) against // the trial functions (j). @@ -507,23 +507,23 @@ void assemble_poisson(EquationSystems& es, // // Now start logging the element matrix computation perf_log.push ("Ke"); - + for (unsigned int qp=0; qp 1 const Real y = q_point[qp](1); @@ -552,19 +552,19 @@ void assemble_poisson(EquationSystems& es, const Real z = 0.; #endif const Real eps = 1.e-3; - + const Real uxx = (exact_solution(x-eps,y,z) + exact_solution(x+eps,y,z) + -2.*exact_solution(x,y,z))/eps/eps; - + const Real uyy = (exact_solution(x,y-eps,z) + exact_solution(x,y+eps,z) + -2.*exact_solution(x,y,z))/eps/eps; - + const Real uzz = (exact_solution(x,y,z-eps) + exact_solution(x,y,z+eps) + -2.*exact_solution(x,y,z))/eps/eps; - + Real fxy; if(dim==1) { @@ -576,16 +576,16 @@ void assemble_poisson(EquationSystems& es, else { fxy = - (uxx + uyy + ((dim==2) ? 0. : uzz)); - } - + } + // Add the RHS contribution for (unsigned int i=0; ineighbor(side) == NULL) || (elem->neighbor(side)->subdomain_id()!=1)) { - + // The penalty value. \frac{1}{\epsilon} // in the discussion above. const Real penalty = 1.e10; - + // The value of the shape functions at the quadrature // points. const std::vector >& phi_face = fe_face->get_phi(); - + // The Jacobian * Quadrature Weight at the quadrature // points on the face. const std::vector& JxW_face = fe_face->get_JxW(); - + // The XYZ locations (in physical space) of the // quadrature points on the face. This is where // we will interpolate the boundary value function. const std::vector& qface_point = fe_face->get_xyz(); - + // Compute the shape function values on the element // face. fe_face->reinit(elem, side); - + // Loop over the face quadrature points for integration. for (unsigned int qp=0; qpadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); - + // Start logging the insertion of the local (element) // matrix and vector into the global matrix and vector perf_log.pop ("matrix insertion"); diff --git a/examples/subdomains/subdomains_ex2/Makefile.am b/examples/subdomains/subdomains_ex2/Makefile.am index df9d89c35b0..3b9849f4b08 100644 --- a/examples/subdomains/subdomains_ex2/Makefile.am +++ b/examples/subdomains/subdomains_ex2/Makefile.am @@ -1,6 +1,6 @@ BUILT_SOURCES = exact_solution.C DISTCLEANFILES = $(BUILT_SOURCES) -exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C +exact_solution.C: $(top_srcdir)/examples/introduction/introduction_ex3/exact_solution.C $(AM_V_GEN)$(LN_S) $< $@ example_name = subdomains_ex2 diff --git a/examples/subdomains/subdomains_ex2/subdomains_ex2.C b/examples/subdomains/subdomains_ex2/subdomains_ex2.C index 247484e193b..8dd2a00a8b4 100644 --- a/examples/subdomains/subdomains_ex2/subdomains_ex2.C +++ b/examples/subdomains/subdomains_ex2/subdomains_ex2.C @@ -68,7 +68,7 @@ // Bring in everything from the libMesh namespace using namespace libMesh; - + // Function prototype. This is the function that will assemble @@ -93,10 +93,10 @@ int main (int argc, char** argv) // Declare a performance log for the main program // PerfLog perf_main("Main Program"); - + // Create a GetPot object to parse the command line GetPot command_line (argc, argv); - + // Check for proper calling arguments. if (argc < 3) { @@ -110,19 +110,19 @@ int main (int argc, char** argv) // exception handling. libmesh_error(); } - + // Brief message to the user regarding the program name // and command line arguments. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; i 1) { if ((cent(0) > 0) == (cent(1) > 0)) - elem->subdomain_id() = 1; + elem->subdomain_id() = 1; } else { if (cent(0) > 0) - elem->subdomain_id() = 1; + elem->subdomain_id() = 1; } } } // Print information about the mesh to the screen. mesh.print_info(); - + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Create a system named "Poisson" LinearImplicitSystem& system = equation_systems.add_system ("Poisson"); - + std::set active_subdomains; - + // Add the variable "u" to "Poisson". "u" // will be approximated using second-order approximation. active_subdomains.clear(); active_subdomains.insert(0); @@ -252,7 +252,7 @@ int main (int argc, char** argv) // Give the system a pointer to the matrix assembly // function. system.attach_assemble_function (assemble_poisson); - + // Initialize the data structures for the equation system. equation_systems.init(); @@ -266,19 +266,19 @@ int main (int argc, char** argv) // After solving the system write the solution // to a GMV-formatted plot file. if(dim == 1) - { + { GnuPlotIO plot(mesh,"Subdomains Example 2, 1D",GnuPlotIO::GRID_ON); plot.write_equation_systems("gnuplot_script",equation_systems); } else { #ifdef LIBMESH_HAVE_EXODUS_API - ExodusII_IO (mesh).write_equation_systems ((dim == 3) ? + ExodusII_IO (mesh).write_equation_systems ((dim == 3) ? "out_3.e" : "out_2.e",equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API } - - // All done. + + // All done. return 0; } @@ -305,7 +305,7 @@ void assemble_poisson(EquationSystems& es, // logging, since there may be many PerfLogs in an // application. PerfLog perf_log ("Matrix Assembly"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -314,7 +314,7 @@ void assemble_poisson(EquationSystems& es, // Get a reference to the LinearImplicitSystem we are solving LinearImplicitSystem& system = es.get_system("Poisson"); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -330,7 +330,7 @@ void assemble_poisson(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); @@ -340,12 +340,12 @@ void assemble_poisson(EquationSystems& es, // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, FIFTH); - + // Tell the finte element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); @@ -353,7 +353,7 @@ void assemble_poisson(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // We begin with the element Jacobian * quadrature weight at each - // integration point. + // integration point. const std::vector& JxW = fe->get_JxW(); // The physical XY locations of the quadrature points on the element. @@ -397,7 +397,7 @@ void assemble_poisson(EquationSystems& es, // Start logging the shape function initialization. // This is done through a simple function call with // the name of the event to log. - perf_log.push("elem init"); + perf_log.push("elem init"); // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. @@ -411,7 +411,7 @@ void assemble_poisson(EquationSystems& es, dof_map.dof_indices (elem, dof_indices2,1); // std::cout << "dof_indices.size()=" -// << dof_indices.size() +// << dof_indices.size() // << ", dof_indices2.size()=" // << dof_indices2.size() // << std::endl; @@ -436,7 +436,7 @@ void assemble_poisson(EquationSystems& es, // Stop logging the shape function initialization. // If you forget to stop logging an event the PerfLog // object will probably catch the error and abort. - perf_log.pop("elem init"); + perf_log.pop("elem init"); // Now we will build the element matrix. This involves // a double loop to integrate the test funcions (i) against @@ -453,7 +453,7 @@ void assemble_poisson(EquationSystems& es, for (unsigned int i=0; i 1 const Real y = q_point[qp](1); @@ -497,11 +497,11 @@ void assemble_poisson(EquationSystems& es, const Real uxx = (exact_solution(x-eps,y,z) + exact_solution(x+eps,y,z) + -2.*exact_solution(x,y,z))/eps/eps; - + const Real uyy = (exact_solution(x,y-eps,z) + exact_solution(x,y+eps,z) + -2.*exact_solution(x,y,z))/eps/eps; - + const Real uzz = (exact_solution(x,y,z-eps) + exact_solution(x,y,z+eps) + -2.*exact_solution(x,y,z))/eps/eps; @@ -517,13 +517,13 @@ void assemble_poisson(EquationSystems& es, else { fxy = - (uxx + uyy + ((dim==2) ? 0. : uzz)); - } + } // Add the RHS contribution for (unsigned int i=0; ineighbor(side) == NULL) || (elem->neighbor(side)->subdomain_id() != elem->subdomain_id())) { - + // The penalty value. \frac{1}{\epsilon} // in the discussion above. const Real penalty = 1.e10; @@ -588,7 +588,7 @@ void assemble_poisson(EquationSystems& es, // The boundary value. const Real value = exact_solution(xf, yf, zf); - // Matrix contribution of the L2 projection. + // Matrix contribution of the L2 projection. for (unsigned int i=0; iadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } - + if (dof_indices2.size()) { system.matrix->add_matrix (Ke, dof_indices2); diff --git a/examples/systems_of_equations/systems_of_equations_ex1/systems_of_equations_ex1.C b/examples/systems_of_equations/systems_of_equations_ex1/systems_of_equations_ex1.C index 153d2f06936..76317bdb9d1 100644 --- a/examples/systems_of_equations/systems_of_equations_ex1/systems_of_equations_ex1.C +++ b/examples/systems_of_equations/systems_of_equations_ex1/systems_of_equations_ex1.C @@ -67,10 +67,10 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Create a mesh. Mesh mesh; - + // Use the MeshTools::Generation mesh generator to create a uniform // 2D grid on the square [-1,1]^2. We instruct the mesh generator // to build a mesh of 8x8 \p Quad9 elements. Building these @@ -81,18 +81,18 @@ int main (int argc, char** argv) 0., 1., 0., 1., QUAD9); - + // Print information about the mesh to the screen. mesh.print_info(); - + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Create a transient system named "Convection-Diffusion" - LinearImplicitSystem & system = + LinearImplicitSystem & system = equation_systems.add_system ("Stokes"); - + // Add the variables "u" & "v" to "Stokes". They // will be approximated using second-order approximation. system.add_variable ("u", SECOND); @@ -106,16 +106,16 @@ int main (int argc, char** argv) // Give the system a pointer to the matrix assembly // function. system.attach_assemble_function (assemble_stokes); - + // Initialize the data structures for the equation system. equation_systems.init (); equation_systems.parameters.set("linear solver maximum iterations") = 250; equation_systems.parameters.set ("linear solver tolerance") = TOLERANCE; - + // Prints information about the system to the screen. equation_systems.print_info(); - + // Assemble & solve the linear system, // then write the solution. equation_systems.get_system("Stokes").solve(); @@ -125,7 +125,7 @@ int main (int argc, char** argv) equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API - // All done. + // All done. return 0; } @@ -135,13 +135,13 @@ void assemble_stokes (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Stokes"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Convection-Diffusion system object. LinearImplicitSystem & system = es.get_system ("Stokes"); @@ -150,22 +150,22 @@ void assemble_stokes (EquationSystems& es, const unsigned int u_var = system.variable_number ("u"); const unsigned int v_var = system.variable_number ("v"); const unsigned int p_var = system.variable_number ("p"); - + // Get the Finite Element type for "u". Note this will be // the same as the type for "v". FEType fe_vel_type = system.variable_type(u_var); - + // Get the Finite Element type for "p". FEType fe_pres_type = system.variable_type(p_var); // Build a Finite Element object of the specified type for // the velocity variables. AutoPtr fe_vel (FEBase::build(dim, fe_vel_type)); - + // Build a Finite Element object of the specified type for // the pressure variables. AutoPtr fe_pres (FEBase::build(dim, fe_pres_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_vel_type.default_quadrature_order()); @@ -173,13 +173,13 @@ void assemble_stokes (EquationSystems& es, // Tell the finite element objects to use our quadrature rule. fe_vel->attach_quadrature_rule (&qrule); fe_pres->attach_quadrature_rule (&qrule); - + // Here we define some references to cell-specific data that // will be used to assemble the linear system. // - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe_vel->get_JxW(); - + // The element shape function gradients for the velocity // variables evaluated at the quadrature points. const std::vector >& dphi = fe_vel->get_dphi(); @@ -187,7 +187,7 @@ void assemble_stokes (EquationSystems& es, // The element shape functions for the pressure variable // evaluated at the quadrature points. const std::vector >& psi = fe_pres->get_phi(); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -218,7 +218,7 @@ void assemble_stokes (EquationSystems& es, std::vector dof_indices_u; std::vector dof_indices_v; std::vector dof_indices_p; - + // Now we will loop over all the elements in the mesh that // live on the local processor. We will compute the element // matrix and right-hand-side contribution. In case users later @@ -227,14 +227,14 @@ void assemble_stokes (EquationSystems& es, // the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -245,10 +245,10 @@ void assemble_stokes (EquationSystems& es, dof_map.dof_indices (elem, dof_indices_p, p_var); const unsigned int n_dofs = dof_indices.size(); - const unsigned int n_u_dofs = dof_indices_u.size(); - const unsigned int n_v_dofs = dof_indices_v.size(); + const unsigned int n_u_dofs = dof_indices_u.size(); + const unsigned int n_v_dofs = dof_indices_v.size(); const unsigned int n_p_dofs = dof_indices_p.size(); - + // Compute the element-specific data for the current // element. This involves computing the location of the // quadrature points (q_point) and the shape functions @@ -275,17 +275,17 @@ void assemble_stokes (EquationSystems& es, // // The \p DenseSubMatrix.repostition () member takes the // (row_offset, column_offset, row_size, column_size). - // + // // Similarly, the \p DenseSubVector.reposition () member // takes the (row_offset, row_size) Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs); Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs); Kup.reposition (u_var*n_u_dofs, p_var*n_u_dofs, n_u_dofs, n_p_dofs); - + Kvu.reposition (v_var*n_v_dofs, u_var*n_v_dofs, n_v_dofs, n_u_dofs); Kvv.reposition (v_var*n_v_dofs, v_var*n_v_dofs, n_v_dofs, n_v_dofs); Kvp.reposition (v_var*n_v_dofs, p_var*n_v_dofs, n_v_dofs, n_p_dofs); - + Kpu.reposition (p_var*n_u_dofs, u_var*n_u_dofs, n_p_dofs, n_u_dofs); Kpv.reposition (p_var*n_u_dofs, v_var*n_u_dofs, n_p_dofs, n_v_dofs); Kpp.reposition (p_var*n_u_dofs, p_var*n_u_dofs, n_p_dofs, n_p_dofs); @@ -293,7 +293,7 @@ void assemble_stokes (EquationSystems& es, Fu.reposition (u_var*n_u_dofs, n_u_dofs); Fv.reposition (v_var*n_u_dofs, n_v_dofs); Fp.reposition (p_var*n_u_dofs, n_p_dofs); - + // Now we will build the element matrix. for (unsigned int qp=0; qpneighbor(s) == NULL) { AutoPtr side (elem->build_side(s)); - + // Loop over the nodes on the side. for (unsigned int ns=0; nsn_nodes(); ns++) { // The location on the boundary of the current // node. - + // const Real xf = side->point(ns)(0); const Real yf = side->point(ns)(1); - + // The penalty value. \f$ \frac{1}{\epsilon \f$ const Real penalty = 1.e10; - + // The boundary values. - + // Set u = 1 on the top boundary, 0 everywhere else const Real u_value = (yf > .99) ? 1. : 0.; - + // Set v = 0 everywhere const Real v_value = 0.; - + // Find the node on the element matching this node on // the side. That defined where in the element matrix // the boundary condition will be applied. @@ -380,15 +380,15 @@ void assemble_stokes (EquationSystems& es, // Matrix contribution. Kuu(n,n) += penalty; Kvv(n,n) += penalty; - + // Right-hand-side contribution. Fu(n) += penalty*u_value; Fv(n) += penalty*v_value; } - } // end face node loop + } // end face node loop } // end if (elem->neighbor(side) == NULL) - } // end boundary condition section - + } // end boundary condition section + // If this assembly program were to be used on an adaptive mesh, // we would have to apply any hanging node constraint equations. dof_map.constrain_element_matrix_and_vector (Ke, Fe, dof_indices); @@ -400,7 +400,7 @@ void assemble_stokes (EquationSystems& es, system.matrix->add_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } // end of element loop - + // That's it. return; } diff --git a/examples/systems_of_equations/systems_of_equations_ex2/systems_of_equations_ex2.C b/examples/systems_of_equations/systems_of_equations_ex2/systems_of_equations_ex2.C index 9daaff9d22c..27c98f93871 100644 --- a/examples/systems_of_equations/systems_of_equations_ex2/systems_of_equations_ex2.C +++ b/examples/systems_of_equations/systems_of_equations_ex2/systems_of_equations_ex2.C @@ -82,7 +82,7 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Trilinos solver NaNs by default on the zero pressure block. // We'll skip this example for now. if (libMesh::default_solver_package() == TRILINOS_SOLVERS) @@ -94,7 +94,7 @@ int main (int argc, char** argv) // Create a mesh. Mesh mesh; - + // Use the MeshTools::Generation mesh generator to create a uniform // 2D grid on the square [-1,1]^2. We instruct the mesh generator // to build a mesh of 8x8 \p Quad9 elements in 2D. Building these @@ -107,18 +107,18 @@ int main (int argc, char** argv) QUAD4); mesh.all_second_order(); - + // Print information about the mesh to the screen. mesh.print_info(); - + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Creates a transient system named "Navier-Stokes" - TransientLinearImplicitSystem & system = + TransientLinearImplicitSystem & system = equation_systems.add_system ("Navier-Stokes"); - + // Add the variables "u" & "v" to "Navier-Stokes". They // will be approximated using second-order approximation. system.add_variable ("u", SECOND); @@ -132,7 +132,7 @@ int main (int argc, char** argv) // Give the system a pointer to the matrix assembly // function. system.attach_assemble_function (assemble_stokes); - + // Initialize the data structures for the equation system. equation_systems.init (); @@ -141,7 +141,7 @@ int main (int argc, char** argv) // Create a performance-logging object for this example PerfLog perf_log("Systems Example 2"); - + // Get a reference to the Stokes system to use later. TransientLinearImplicitSystem& navier_stokes_system = equation_systems.get_system("Navier-Stokes"); @@ -160,7 +160,7 @@ int main (int argc, char** argv) // We also set a standard linear solver flag in the EquationSystems object // which controls the maxiumum number of linear solver iterations allowed. equation_systems.parameters.set("linear solver maximum iterations") = 250; - + // Tell the system of equations what the timestep is by using // the set_parameter function. The matrix assembly routine can // then reference this parameter. @@ -199,7 +199,7 @@ int main (int argc, char** argv) // Update the nonlinear solution. last_nonlinear_soln->zero(); last_nonlinear_soln->add(*navier_stokes_system.solution); - + // Assemble & solve the linear system. perf_log.push("linear solve"); equation_systems.get_system("Navier-Stokes").solve(); @@ -217,10 +217,10 @@ int main (int argc, char** argv) // How many iterations were required to solve the linear system? const unsigned int n_linear_iterations = navier_stokes_system.n_linear_iterations(); - + // What was the final residual of the linear system? const Real final_linear_residual = navier_stokes_system.final_linear_residual(); - + // Print out convergence information for the linear and // nonlinear iterations. std::cout << "Linear solver converged at step: " @@ -242,7 +242,7 @@ int main (int argc, char** argv) << std::endl; break; } - + // Otherwise, decrease the linear system tolerance. For the inexact Newton // method, the linear solver tolerance needs to decrease as we get closer to // the solution to ensure quadratic convergence. The new linear solver tolerance @@ -252,10 +252,10 @@ int main (int argc, char** argv) std::min(Utility::pow<2>(final_linear_residual), initial_linear_solver_tol); } // end nonlinear loop - + // Write out every nth timestep to file. const unsigned int write_interval = 1; - + #ifdef LIBMESH_HAVE_EXODUS_API if ((t_step+1)%write_interval == 0) { @@ -268,14 +268,14 @@ int main (int argc, char** argv) << std::right << t_step + 1 << ".e"; - + ExodusII_IO(mesh).write_equation_systems (file_name.str(), equation_systems); } #endif // #ifdef LIBMESH_HAVE_EXODUS_API } // end timestep loop. - - // All done. + + // All done. return 0; } @@ -292,13 +292,13 @@ void assemble_stokes (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Navier-Stokes"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Stokes system object. TransientLinearImplicitSystem & navier_stokes_system = es.get_system ("Navier-Stokes"); @@ -307,22 +307,22 @@ void assemble_stokes (EquationSystems& es, const unsigned int u_var = navier_stokes_system.variable_number ("u"); const unsigned int v_var = navier_stokes_system.variable_number ("v"); const unsigned int p_var = navier_stokes_system.variable_number ("p"); - + // Get the Finite Element type for "u". Note this will be // the same as the type for "v". FEType fe_vel_type = navier_stokes_system.variable_type(u_var); - + // Get the Finite Element type for "p". FEType fe_pres_type = navier_stokes_system.variable_type(p_var); // Build a Finite Element object of the specified type for // the velocity variables. AutoPtr fe_vel (FEBase::build(dim, fe_vel_type)); - + // Build a Finite Element object of the specified type for // the pressure variables. AutoPtr fe_pres (FEBase::build(dim, fe_pres_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_vel_type.default_quadrature_order()); @@ -330,11 +330,11 @@ void assemble_stokes (EquationSystems& es, // Tell the finite element objects to use our quadrature rule. fe_vel->attach_quadrature_rule (&qrule); fe_pres->attach_quadrature_rule (&qrule); - + // Here we define some references to cell-specific data that // will be used to assemble the linear system. // - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe_vel->get_JxW(); // The element shape functions evaluated at the quadrature points. @@ -350,7 +350,7 @@ void assemble_stokes (EquationSystems& es, // The value of the linear shape function gradients at the quadrature points // const std::vector >& dpsi = fe_pres->get_dphi(); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -394,21 +394,21 @@ void assemble_stokes (EquationSystems& es, // simulation, you should see that it is monotonically decreasing in time. const Real dt = es.parameters.get("dt"); const Real theta = 1.; - + // Now we will loop over all the elements in the mesh that // live on the local processor. We will compute the element // matrix and right-hand-side contribution. Since the mesh // will be refined we want to only consider the ACTIVE elements, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -419,10 +419,10 @@ void assemble_stokes (EquationSystems& es, dof_map.dof_indices (elem, dof_indices_p, p_var); const unsigned int n_dofs = dof_indices.size(); - const unsigned int n_u_dofs = dof_indices_u.size(); - const unsigned int n_v_dofs = dof_indices_v.size(); + const unsigned int n_u_dofs = dof_indices_u.size(); + const unsigned int n_v_dofs = dof_indices_v.size(); const unsigned int n_p_dofs = dof_indices_p.size(); - + // Compute the element-specific data for the current // element. This involves computing the location of the // quadrature points (q_point) and the shape functions @@ -449,17 +449,17 @@ void assemble_stokes (EquationSystems& es, // // The \p DenseSubMatrix.repostition () member takes the // (row_offset, column_offset, row_size, column_size). - // + // // Similarly, the \p DenseSubVector.reposition () member // takes the (row_offset, row_size) Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs); Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs); Kup.reposition (u_var*n_u_dofs, p_var*n_u_dofs, n_u_dofs, n_p_dofs); - + Kvu.reposition (v_var*n_v_dofs, u_var*n_v_dofs, n_v_dofs, n_u_dofs); Kvv.reposition (v_var*n_v_dofs, v_var*n_v_dofs, n_v_dofs, n_v_dofs); Kvp.reposition (v_var*n_v_dofs, p_var*n_v_dofs, n_v_dofs, n_p_dofs); - + Kpu.reposition (p_var*n_u_dofs, u_var*n_u_dofs, n_p_dofs, n_u_dofs); Kpv.reposition (p_var*n_u_dofs, v_var*n_u_dofs, n_p_dofs, n_v_dofs); Kpp.reposition (p_var*n_u_dofs, p_var*n_u_dofs, n_p_dofs, n_p_dofs); @@ -482,7 +482,7 @@ void assemble_stokes (EquationSystems& es, Number p_old = 0.; Gradient grad_u, grad_u_old; Gradient grad_v, grad_v_old; - + // Compute the velocity & its gradient from the previous timestep // and the old Newton iterate. for (unsigned int l=0; lneighbor(s) == NULL) { AutoPtr side (elem->build_side(s)); - + // Loop over the nodes on the side. for (unsigned int ns=0; nsn_nodes(); ns++) { @@ -610,10 +610,10 @@ void assemble_stokes (EquationSystems& es, // Set u = 1 on the top boundary, 0 everywhere else const Real u_value = (mesh.boundary_info->has_boundary_id(elem,s,2)) ? 1. : 0.; - + // Set v = 0 everywhere const Real v_value = 0.; - + // Find the node on the element matching this node on // the side. That defined where in the element matrix // the boundary condition will be applied. @@ -623,14 +623,14 @@ void assemble_stokes (EquationSystems& es, // Matrix contribution. Kuu(n,n) += penalty; Kvv(n,n) += penalty; - + // Right-hand-side contribution. Fu(n) += penalty*u_value; Fv(n) += penalty*v_value; } - } // end face node loop + } // end face node loop } // end if (elem->neighbor(side) == NULL) - + // Pin the pressure to zero at global node number "pressure_node". // This effectively removes the non-trivial null space of constant // pressure solutions. @@ -646,8 +646,8 @@ void assemble_stokes (EquationSystems& es, Fp(c) += penalty*p_value; } } - } // end boundary condition section - + } // end boundary condition section + // If this assembly program were to be used on an adaptive mesh, // we would have to apply any hanging node constraint equations dof_map.constrain_element_matrix_and_vector (Ke, Fe, dof_indices); @@ -659,7 +659,7 @@ void assemble_stokes (EquationSystems& es, navier_stokes_system.matrix->add_matrix (Ke, dof_indices); navier_stokes_system.rhs->add_vector (Fe, dof_indices); } // end of element loop - + // That's it. return; } diff --git a/examples/systems_of_equations/systems_of_equations_ex3/systems_of_equations_ex3.C b/examples/systems_of_equations/systems_of_equations_ex3/systems_of_equations_ex3.C index 350c6599724..b08fb6a0986 100644 --- a/examples/systems_of_equations/systems_of_equations_ex3/systems_of_equations_ex3.C +++ b/examples/systems_of_equations/systems_of_equations_ex3/systems_of_equations_ex3.C @@ -73,7 +73,7 @@ int main (int argc, char** argv) // Skip this 2D example if libMesh was compiled as 1D-only. libmesh_example_assert(2 <= LIBMESH_DIM, "2D support"); - + // Trilinos solver NaNs by default on the zero pressure block. // We'll skip this example for now. if (libMesh::default_solver_package() == TRILINOS_SOLVERS) @@ -85,7 +85,7 @@ int main (int argc, char** argv) // Create a mesh. Mesh mesh; - + // Use the MeshTools::Generation mesh generator to create a uniform // 2D grid on the square [-1,1]^2. We instruct the mesh generator // to build a mesh of 8x8 \p Quad9 elements in 2D. Building these @@ -96,18 +96,18 @@ int main (int argc, char** argv) 0., 1., 0., 1., QUAD9); - + // Print information about the mesh to the screen. mesh.print_info(); - + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Creates a transient system named "Navier-Stokes" - TransientLinearImplicitSystem & system = + TransientLinearImplicitSystem & system = equation_systems.add_system ("Navier-Stokes"); - + // Add the variables "u" & "v" to "Navier-Stokes". They // will be approximated using second-order approximation. system.add_variable ("u", SECOND); @@ -125,7 +125,7 @@ int main (int argc, char** argv) // Give the system a pointer to the matrix assembly // function. system.attach_assemble_function (assemble_stokes); - + // Initialize the data structures for the equation system. equation_systems.init (); @@ -134,7 +134,7 @@ int main (int argc, char** argv) // Create a performance-logging object for this example PerfLog perf_log("Systems Example 3"); - + // Get a reference to the Stokes system to use later. TransientLinearImplicitSystem& navier_stokes_system = equation_systems.get_system("Navier-Stokes"); @@ -153,7 +153,7 @@ int main (int argc, char** argv) // We also set a standard linear solver flag in the EquationSystems object // which controls the maxiumum number of linear solver iterations allowed. equation_systems.parameters.set("linear solver maximum iterations") = 250; - + // Tell the system of equations what the timestep is by using // the set_parameter function. The matrix assembly routine can // then reference this parameter. @@ -172,7 +172,7 @@ int main (int argc, char** argv) navier_stokes_system.time += dt; // A pretty update message - std::cout << "\n\n*** Solving time step " << t_step << + std::cout << "\n\n*** Solving time step " << t_step << ", time = " << navier_stokes_system.time << " ***" << std::endl; @@ -192,7 +192,7 @@ int main (int argc, char** argv) // Update the nonlinear solution. last_nonlinear_soln->zero(); last_nonlinear_soln->add(*navier_stokes_system.solution); - + // Assemble & solve the linear system. perf_log.push("linear solve"); equation_systems.get_system("Navier-Stokes").solve(); @@ -210,10 +210,10 @@ int main (int argc, char** argv) // How many iterations were required to solve the linear system? const unsigned int n_linear_iterations = navier_stokes_system.n_linear_iterations(); - + // What was the final residual of the linear system? const Real final_linear_residual = navier_stokes_system.final_linear_residual(); - + // Print out convergence information for the linear and // nonlinear iterations. std::cout << "Linear solver converged at step: " @@ -235,7 +235,7 @@ int main (int argc, char** argv) << std::endl; break; } - + // Otherwise, decrease the linear system tolerance. For the inexact Newton // method, the linear solver tolerance needs to decrease as we get closer to // the solution to ensure quadratic convergence. The new linear solver tolerance @@ -245,10 +245,10 @@ int main (int argc, char** argv) std::min(Utility::pow<2>(final_linear_residual), initial_linear_solver_tol); } // end nonlinear loop - + // Write out every nth timestep to file. const unsigned int write_interval = 1; - + #ifdef LIBMESH_HAVE_EXODUS_API if ((t_step+1)%write_interval == 0) { @@ -261,14 +261,14 @@ int main (int argc, char** argv) << std::right << t_step + 1 << ".e"; - + ExodusII_IO(mesh).write_equation_systems (file_name.str(), equation_systems); } #endif // #ifdef LIBMESH_HAVE_EXODUS_API } // end timestep loop. - - // All done. + + // All done. return 0; } @@ -285,13 +285,13 @@ void assemble_stokes (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Navier-Stokes"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Stokes system object. TransientLinearImplicitSystem & navier_stokes_system = es.get_system ("Navier-Stokes"); @@ -301,22 +301,22 @@ void assemble_stokes (EquationSystems& es, const unsigned int v_var = navier_stokes_system.variable_number ("v"); const unsigned int p_var = navier_stokes_system.variable_number ("p"); const unsigned int alpha_var = navier_stokes_system.variable_number ("alpha"); - + // Get the Finite Element type for "u". Note this will be // the same as the type for "v". FEType fe_vel_type = navier_stokes_system.variable_type(u_var); - + // Get the Finite Element type for "p". FEType fe_pres_type = navier_stokes_system.variable_type(p_var); // Build a Finite Element object of the specified type for // the velocity variables. AutoPtr fe_vel (FEBase::build(dim, fe_vel_type)); - + // Build a Finite Element object of the specified type for // the pressure variables. AutoPtr fe_pres (FEBase::build(dim, fe_pres_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_vel_type.default_quadrature_order()); @@ -324,11 +324,11 @@ void assemble_stokes (EquationSystems& es, // Tell the finite element objects to use our quadrature rule. fe_vel->attach_quadrature_rule (&qrule); fe_pres->attach_quadrature_rule (&qrule); - + // Here we define some references to cell-specific data that // will be used to assemble the linear system. // - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe_vel->get_JxW(); // The element shape functions evaluated at the quadrature points. @@ -344,7 +344,7 @@ void assemble_stokes (EquationSystems& es, // The value of the linear shape function gradients at the quadrature points // const std::vector >& dpsi = fe_pres->get_dphi(); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -391,21 +391,21 @@ void assemble_stokes (EquationSystems& es, const Real dt = es.parameters.get("dt"); // const Real time = es.parameters.get("time"); const Real theta = 1.; - + // Now we will loop over all the elements in the mesh that // live on the local processor. We will compute the element // matrix and right-hand-side contribution. Since the mesh // will be refined we want to only consider the ACTIVE elements, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will @@ -417,10 +417,10 @@ void assemble_stokes (EquationSystems& es, dof_map.dof_indices (elem, dof_indices_alpha, alpha_var); const unsigned int n_dofs = dof_indices.size(); - const unsigned int n_u_dofs = dof_indices_u.size(); - const unsigned int n_v_dofs = dof_indices_v.size(); + const unsigned int n_u_dofs = dof_indices_u.size(); + const unsigned int n_v_dofs = dof_indices_v.size(); const unsigned int n_p_dofs = dof_indices_p.size(); - + // Compute the element-specific data for the current // element. This involves computing the location of the // quadrature points (q_point) and the shape functions @@ -447,17 +447,17 @@ void assemble_stokes (EquationSystems& es, // // The \p DenseSubMatrix.repostition () member takes the // (row_offset, column_offset, row_size, column_size). - // + // // Similarly, the \p DenseSubVector.reposition () member // takes the (row_offset, row_size) Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs); Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs); Kup.reposition (u_var*n_u_dofs, p_var*n_u_dofs, n_u_dofs, n_p_dofs); - + Kvu.reposition (v_var*n_v_dofs, u_var*n_v_dofs, n_v_dofs, n_u_dofs); Kvv.reposition (v_var*n_v_dofs, v_var*n_v_dofs, n_v_dofs, n_v_dofs); Kvp.reposition (v_var*n_v_dofs, p_var*n_v_dofs, n_v_dofs, n_p_dofs); - + Kpu.reposition (p_var*n_u_dofs, u_var*n_u_dofs, n_p_dofs, n_u_dofs); Kpv.reposition (p_var*n_u_dofs, v_var*n_u_dofs, n_p_dofs, n_v_dofs); Kpp.reposition (p_var*n_u_dofs, p_var*n_u_dofs, n_p_dofs, n_p_dofs); @@ -485,7 +485,7 @@ void assemble_stokes (EquationSystems& es, Number p_old = 0.; Gradient grad_u, grad_u_old; Gradient grad_v, grad_v_old; - + // Compute the velocity & its gradient from the previous timestep // and the old Newton iterate. for (unsigned int l=0; lneighbor(s) == NULL) { AutoPtr side (elem->build_side(s)); - + // Loop over the nodes on the side. for (unsigned int ns=0; nsn_nodes(); ns++) { @@ -612,13 +612,13 @@ void assemble_stokes (EquationSystems& es, // 1=right // 2=top // 3=left - + // Set u = 1 on the top boundary, 0 everywhere else const Real u_value = (mesh.boundary_info->has_boundary_id(elem,s,2)) ? 1. : 0.; - + // Set v = 0 everywhere const Real v_value = 0.; - + // Find the node on the element matching this node on // the side. That defined where in the element matrix // the boundary condition will be applied. @@ -628,14 +628,14 @@ void assemble_stokes (EquationSystems& es, // Matrix contribution. Kuu(n,n) += penalty; Kvv(n,n) += penalty; - + // Right-hand-side contribution. Fu(n) += penalty*u_value; Fv(n) += penalty*v_value; } - } // end face node loop + } // end face node loop } // end if (elem->neighbor(side) == NULL) - } // end boundary condition section + } // end boundary condition section // If this assembly program were to be used on an adaptive mesh, // we would have to apply any hanging node constraint equations diff --git a/examples/systems_of_equations/systems_of_equations_ex4/systems_of_equations_ex4.C b/examples/systems_of_equations/systems_of_equations_ex4/systems_of_equations_ex4.C index f2ac4b620e3..13fae637fd1 100644 --- a/examples/systems_of_equations/systems_of_equations_ex4/systems_of_equations_ex4.C +++ b/examples/systems_of_equations/systems_of_equations_ex4/systems_of_equations_ex4.C @@ -89,20 +89,20 @@ int main (int argc, char** argv) 0., 0.2, QUAD9); - + // Print information about the mesh to the screen. mesh.print_info(); - - + + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Create a system named "Elasticity" LinearImplicitSystem& system = equation_systems.add_system ("Elasticity"); - + // Add two displacement variables, u and v, to the system unsigned int u_var = system.add_variable("u", SECOND, LAGRANGE); unsigned int v_var = system.add_variable("v", SECOND, LAGRANGE); @@ -119,18 +119,18 @@ int main (int argc, char** argv) // Create a vector storing the variable numbers which the BC applies to std::vector variables(2); variables[0] = u_var; variables[1] = v_var; - + // Create a ZeroFunction to initialize dirichlet_bc ZeroFunction<> zf; - + DirichletBoundary dirichlet_bc(boundary_ids, variables, &zf); - // We must add the Dirichlet boundary condition _before_ + // We must add the Dirichlet boundary condition _before_ // we call equation_systems.init() system.get_dof_map().add_dirichlet_boundary(dirichlet_bc); - + // Initialize the data structures for the equation system. equation_systems.init(); @@ -145,7 +145,7 @@ int main (int argc, char** argv) ExodusII_IO (mesh).write_equation_systems("displacement.e",equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API - // All done. + // All done. return 0; } @@ -154,7 +154,7 @@ void assemble_elasticity(EquationSystems& es, const std::string& system_name) { libmesh_assert_equal_to (system_name, "Elasticity"); - + const MeshBase& mesh = es.get_mesh(); const unsigned int dim = mesh.mesh_dimension(); @@ -204,7 +204,7 @@ void assemble_elasticity(EquationSystems& es, dof_map.dof_indices (elem, dof_indices_v, v_var); const unsigned int n_dofs = dof_indices.size(); - const unsigned int n_u_dofs = dof_indices_u.size(); + const unsigned int n_u_dofs = dof_indices_u.size(); const unsigned int n_v_dofs = dof_indices_v.size(); fe->reinit (elem); @@ -214,7 +214,7 @@ void assemble_elasticity(EquationSystems& es, Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs); Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs); - + Kvu.reposition (v_var*n_v_dofs, u_var*n_v_dofs, n_v_dofs, n_u_dofs); Kvv.reposition (v_var*n_v_dofs, v_var*n_v_dofs, n_v_dofs, n_v_dofs); @@ -233,7 +233,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kuu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kuu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -254,7 +254,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kuv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kuv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -275,7 +275,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kvu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kvu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -296,7 +296,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kvv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kvv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -328,10 +328,10 @@ void assemble_elasticity(EquationSystems& es, } } } - } + } dof_map.constrain_element_matrix_and_vector (Ke, Fe, dof_indices); - + system.matrix->add_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } @@ -344,7 +344,7 @@ Real eval_elasticity_tensor(unsigned int i, { // Define the Poisson ratio const Real nu = 0.3; - + // Define the Lame constants (lambda_1 and lambda_2) based on Poisson ratio const Real lambda_1 = nu / ( (1. + nu) * (1. - 2.*nu) ); const Real lambda_2 = 0.5 / (1 + nu); @@ -356,6 +356,6 @@ Real eval_elasticity_tensor(unsigned int i, Real delta_jl = (j == l) ? 1. : 0.; Real delta_jk = (j == k) ? 1. : 0.; Real delta_kl = (k == l) ? 1. : 0.; - + return lambda_1 * delta_ij * delta_kl + lambda_2 * (delta_ik * delta_jl + delta_il * delta_jk); } diff --git a/examples/systems_of_equations/systems_of_equations_ex5/systems_of_equations_ex5.C b/examples/systems_of_equations/systems_of_equations_ex5/systems_of_equations_ex5.C index 2b2c7f0cc81..b967d2b515e 100644 --- a/examples/systems_of_equations/systems_of_equations_ex5/systems_of_equations_ex5.C +++ b/examples/systems_of_equations/systems_of_equations_ex5/systems_of_equations_ex5.C @@ -93,24 +93,24 @@ int main (int argc, char** argv) 0., 0.2, QUAD9); - + // Print information about the mesh to the screen. mesh.print_info(); - - + + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Create a system named "Elasticity" LinearImplicitSystem& system = equation_systems.add_system ("Elasticity"); - + // Add two displacement variables, u and v, to the system unsigned int u_var = system.add_variable("u", SECOND, LAGRANGE); unsigned int v_var = system.add_variable("v", SECOND, LAGRANGE); - + // Add a SCALAR variable for the Lagrange multiplier to enforce our constraint unsigned int lambda_var = system.add_variable("lambda", FIRST, SCALAR); @@ -126,18 +126,18 @@ int main (int argc, char** argv) // Create a vector storing the variable numbers which the BC applies to std::vector variables(2); variables[0] = u_var; variables[1] = v_var; - + // Create a ZeroFunction to initialize dirichlet_bc ZeroFunction<> zf; - + DirichletBoundary dirichlet_bc(boundary_ids, variables, &zf); - // We must add the Dirichlet boundary condition _before_ + // We must add the Dirichlet boundary condition _before_ // we call equation_systems.init() system.get_dof_map().add_dirichlet_boundary(dirichlet_bc); - + // Initialize the data structures for the equation system. equation_systems.init(); @@ -152,7 +152,7 @@ int main (int argc, char** argv) ExodusII_IO (mesh).write_equation_systems("displacement.e",equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API - // All done. + // All done. return 0; } @@ -161,7 +161,7 @@ void assemble_elasticity(EquationSystems& es, const std::string& system_name) { libmesh_assert_equal_to (system_name, "Elasticity"); - + const MeshBase& mesh = es.get_mesh(); const unsigned int dim = mesh.mesh_dimension(); @@ -215,7 +215,7 @@ void assemble_elasticity(EquationSystems& es, dof_map.dof_indices (elem, dof_indices_lambda, lambda_var); const unsigned int n_dofs = dof_indices.size(); - const unsigned int n_u_dofs = dof_indices_u.size(); + const unsigned int n_u_dofs = dof_indices_u.size(); const unsigned int n_v_dofs = dof_indices_v.size(); const unsigned int n_lambda_dofs = dof_indices_lambda.size(); @@ -226,7 +226,7 @@ void assemble_elasticity(EquationSystems& es, Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs); Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs); - + Kvu.reposition (v_var*n_v_dofs, u_var*n_v_dofs, n_v_dofs, n_u_dofs); Kvv.reposition (v_var*n_v_dofs, v_var*n_v_dofs, n_v_dofs, n_v_dofs); @@ -249,7 +249,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kuu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kuu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -270,7 +270,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kuv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kuv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -291,7 +291,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kvu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kvu(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -312,7 +312,7 @@ void assemble_elasticity(EquationSystems& es, C_j=0, C_l=0; Kvv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); - + C_j=1, C_l=0; Kvv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); @@ -359,7 +359,7 @@ void assemble_elasticity(EquationSystems& es, { Kv_lambda(i,j) += JxW_face[qp]* (-1.) * phi_face[i][qp]; } - + for (unsigned int i=0; iadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } @@ -385,7 +385,7 @@ Real eval_elasticity_tensor(unsigned int i, { // Define the Poisson ratio const Real nu = 0.3; - + // Define the Lame constants (lambda_1 and lambda_2) based on Poisson ratio const Real lambda_1 = nu / ( (1. + nu) * (1. - 2.*nu) ); const Real lambda_2 = 0.5 / (1 + nu); @@ -397,6 +397,6 @@ Real eval_elasticity_tensor(unsigned int i, Real delta_jl = (j == l) ? 1. : 0.; Real delta_jk = (j == k) ? 1. : 0.; Real delta_kl = (k == l) ? 1. : 0.; - + return lambda_1 * delta_ij * delta_kl + lambda_2 * (delta_ik * delta_jl + delta_il * delta_jk); } diff --git a/examples/systems_of_equations/systems_of_equations_ex6/systems_of_equations_ex6.C b/examples/systems_of_equations/systems_of_equations_ex6/systems_of_equations_ex6.C index d58b1a307f3..f02473e8ae0 100644 --- a/examples/systems_of_equations/systems_of_equations_ex6/systems_of_equations_ex6.C +++ b/examples/systems_of_equations/systems_of_equations_ex6/systems_of_equations_ex6.C @@ -73,7 +73,7 @@ using namespace libMesh; // Matrix and right-hand side assembly void assemble_elasticity(EquationSystems& es, const std::string& system_name); - + // Post-process the solution to compute stresses void compute_stresses(EquationSystems& es); @@ -110,19 +110,19 @@ int main (int argc, char** argv) 0., 0.1, HEX8); - + // Print information about the mesh to the screen. mesh.print_info(); - - + + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Declare the system and its variables. // Create a system named "Elasticity" LinearImplicitSystem& system = equation_systems.add_system ("Elasticity"); - + // Add three displacement variables, u and v, to the system unsigned int u_var = system.add_variable("u", FIRST, LAGRANGE); unsigned int v_var = system.add_variable("v", FIRST, LAGRANGE); @@ -139,22 +139,22 @@ int main (int argc, char** argv) variables.push_back(u_var); variables.push_back(v_var); variables.push_back(w_var); - + // Create a ZeroFunction to initialize dirichlet_bc ZeroFunction<> zf; - + DirichletBoundary dirichlet_bc(boundary_ids, variables, &zf); - // We must add the Dirichlet boundary condition _before_ + // We must add the Dirichlet boundary condition _before_ // we call equation_systems.init() system.get_dof_map().add_dirichlet_boundary(dirichlet_bc); - + // Also, initialize an ExplicitSystem to store stresses ExplicitSystem& stress_system = equation_systems.add_system ("StressSystem"); - + stress_system.add_variable("sigma_00", CONSTANT, MONOMIAL); stress_system.add_variable("sigma_01", CONSTANT, MONOMIAL); stress_system.add_variable("sigma_02", CONSTANT, MONOMIAL); @@ -165,7 +165,7 @@ int main (int argc, char** argv) stress_system.add_variable("sigma_21", CONSTANT, MONOMIAL); stress_system.add_variable("sigma_22", CONSTANT, MONOMIAL); stress_system.add_variable("vonMises", CONSTANT, MONOMIAL); - + // Initialize the data structures for the equation system. equation_systems.init(); @@ -174,7 +174,7 @@ int main (int argc, char** argv) // Solve the system system.solve(); - + // Post-process the solution to compute the stresses compute_stresses(equation_systems); @@ -183,7 +183,7 @@ int main (int argc, char** argv) ExodusII_IO (mesh).write_equation_systems("displacement.e",equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API - // All done. + // All done. return 0; } @@ -192,7 +192,7 @@ void assemble_elasticity(EquationSystems& es, const std::string& system_name) { libmesh_assert_equal_to (system_name, "Elasticity"); - + const MeshBase& mesh = es.get_mesh(); const unsigned int dim = mesh.mesh_dimension(); @@ -248,7 +248,7 @@ void assemble_elasticity(EquationSystems& es, dof_map.dof_indices (elem, dof_indices_w, w_var); const unsigned int n_dofs = dof_indices.size(); - const unsigned int n_u_dofs = dof_indices_u.size(); + const unsigned int n_u_dofs = dof_indices_u.size(); const unsigned int n_v_dofs = dof_indices_v.size(); const unsigned int n_w_dofs = dof_indices_w.size(); @@ -260,7 +260,7 @@ void assemble_elasticity(EquationSystems& es, Kuu.reposition (u_var*n_u_dofs, u_var*n_u_dofs, n_u_dofs, n_u_dofs); Kuv.reposition (u_var*n_u_dofs, v_var*n_u_dofs, n_u_dofs, n_v_dofs); Kuw.reposition (u_var*n_u_dofs, w_var*n_u_dofs, n_u_dofs, n_w_dofs); - + Kvu.reposition (v_var*n_u_dofs, u_var*n_u_dofs, n_v_dofs, n_u_dofs); Kvv.reposition (v_var*n_u_dofs, v_var*n_u_dofs, n_v_dofs, n_v_dofs); Kvw.reposition (v_var*n_u_dofs, w_var*n_u_dofs, n_v_dofs, n_w_dofs); @@ -268,7 +268,7 @@ void assemble_elasticity(EquationSystems& es, Kwu.reposition (w_var*n_u_dofs, u_var*n_u_dofs, n_w_dofs, n_u_dofs); Kwv.reposition (w_var*n_u_dofs, v_var*n_u_dofs, n_w_dofs, n_v_dofs); Kww.reposition (w_var*n_u_dofs, w_var*n_u_dofs, n_w_dofs, n_w_dofs); - + Fu.reposition (u_var*n_u_dofs, n_u_dofs); Fv.reposition (v_var*n_u_dofs, n_v_dofs); Fw.reposition (w_var*n_u_dofs, n_w_dofs); @@ -339,7 +339,7 @@ void assemble_elasticity(EquationSystems& es, Kvv(i,j) += JxW[qp]*(eval_elasticity_tensor(C_i,C_j,C_k,C_l) * dphi[i][qp](C_j)*dphi[j][qp](C_l)); } } - + for (unsigned int i=0; iadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } @@ -450,10 +450,10 @@ void compute_stresses(EquationSystems& es) AutoPtr fe (FEBase::build(dim, fe_type)); QGauss qrule (dim, fe_type.default_quadrature_order()); fe->attach_quadrature_rule (&qrule); - + const std::vector& JxW = fe->get_JxW(); const std::vector >& dphi = fe->get_dphi(); - + // Also, get a reference to the ExplicitSystem ExplicitSystem& stress_system = es.get_system("StressSystem"); const DofMap& stress_dof_map = stress_system.get_dof_map(); @@ -491,7 +491,7 @@ void compute_stresses(EquationSystems& es) fe->reinit (elem); elem_sigma.resize(3,3); - + for (unsigned int qp=0; qpvolume()); @@ -527,7 +527,7 @@ void compute_stresses(EquationSystems& es) // We are using CONSTANT MONOMIAL basis functions, hence we only need to get // one dof index per variable dof_id_type dof_index = stress_dof_indices_var[0]; - + if( (stress_system.solution->first_local_index() <= dof_index) && (dof_index < stress_system.solution->last_local_index()) ) { @@ -535,10 +535,10 @@ void compute_stresses(EquationSystems& es) } } - + // Also, the von Mises stress - Number vonMises_value = std::sqrt( 0.5*( pow(elem_sigma(0,0) - elem_sigma(1,1),2.) + - pow(elem_sigma(1,1) - elem_sigma(2,2),2.) + + Number vonMises_value = std::sqrt( 0.5*( pow(elem_sigma(0,0) - elem_sigma(1,1),2.) + + pow(elem_sigma(1,1) - elem_sigma(2,2),2.) + pow(elem_sigma(2,2) - elem_sigma(0,0),2.) + 6.*(pow(elem_sigma(0,1),2.) + pow(elem_sigma(1,2),2.) + pow(elem_sigma(2,0),2.)) ) ); @@ -549,7 +549,7 @@ void compute_stresses(EquationSystems& es) { stress_system.solution->set(dof_index, vonMises_value); } - + } // Should call close and update when we set vector entries directly diff --git a/examples/transient/transient_ex1/exact_solution.C b/examples/transient/transient_ex1/exact_solution.C index c8ba5265e52..ea4977afc1f 100644 --- a/examples/transient/transient_ex1/exact_solution.C +++ b/examples/transient/transient_ex1/exact_solution.C @@ -1,16 +1,16 @@ // The libMesh Finite Element Library. // Copyright (C) 2003 Benjamin S. Kirk - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -41,7 +41,7 @@ Real exact_solution (const Real x, const Real yo = 0.2; const Real u = 0.8; const Real v = 0.8; - + const Real num = pow(x - u*t - xo, 2.) + pow(y - v*t - yo, 2.); diff --git a/examples/transient/transient_ex1/transient_ex1.C b/examples/transient/transient_ex1/transient_ex1.C index aca913802e6..5b25b1e3c4e 100644 --- a/examples/transient/transient_ex1/transient_ex1.C +++ b/examples/transient/transient_ex1/transient_ex1.C @@ -117,62 +117,62 @@ int main (int argc, char** argv) // simply read it in and uniformly refine it 5 times before we compute // with it. Mesh mesh; - + mesh.read ("mesh.xda"); - + // Create a MeshRefinement object to handle refinement of our mesh. // This class handles all the details of mesh refinement and coarsening. MeshRefinement mesh_refinement (mesh); - + // Uniformly refine the mesh 5 times. This is the // first time we use the mesh refinement capabilities // of the library. mesh_refinement.uniformly_refine (5); - + // Print information about the mesh to the screen. mesh.print_info(); - + // Create an equation systems object. EquationSystems equation_systems (mesh); - + // Add a transient system to the EquationSystems // object named "Convection-Diffusion". - TransientLinearImplicitSystem & system = + TransientLinearImplicitSystem & system = equation_systems.add_system ("Convection-Diffusion"); - + // Adds the variable "u" to "Convection-Diffusion". "u" // will be approximated using first-order approximation. system.add_variable ("u", FIRST); - + // Give the system a pointer to the matrix assembly // and initialization functions. system.attach_assemble_function (assemble_cd); system.attach_init_function (init_cd); - + // Initialize the data structures for the equation system. equation_systems.init (); - + // Prints information about the system to the screen. equation_systems.print_info(); - + // Write out the initial conditions. GMVIO(mesh).write_equation_systems ("out_000.gmv", equation_systems); - + // The Convection-Diffusion system requires that we specify // the flow velocity. We will specify it as a RealVectorValue // data type and then use the Parameters object to pass it to // the assemble function. - equation_systems.parameters.set("velocity") = + equation_systems.parameters.set("velocity") = RealVectorValue (0.8, 0.8); - + // Solve the system "Convection-Diffusion". This will be done by // looping over the specified time interval and calling the // solve() member at each time step. This will assemble the // system and call the linear solver. const Real dt = 0.025; system.time = 0.; - + for (unsigned int t_step = 0; t_step < 50; t_step++) { // Incremenet the time counter, set the time and the @@ -184,7 +184,7 @@ int main (int argc, char** argv) // A pretty update message std::cout << " Solving time step "; - + // Since some compilers fail to offer full stream // functionality, libMesh offers a string stream // to work around this. Note that for other compilers, @@ -209,7 +209,7 @@ int main (int argc, char** argv) std::cout << out.str() << std::endl; } - + // At this point we need to update the old // solution vector. The old solution vector // will be the current solution vector from the @@ -219,10 +219,10 @@ int main (int argc, char** argv) // (and systems derived from them) contain old solutions // we need to specify the system type when we ask for it. *system.old_local_solution = *system.current_local_solution; - + // Assemble & solve the linear system equation_systems.get_system("Convection-Diffusion").solve(); - + // Output evey 10 timesteps to file. if ( (t_step+1)%10 == 0) { @@ -241,7 +241,7 @@ int main (int argc, char** argv) } #endif // #ifdef LIBMESH_ENABLE_AMR - // All done. + // All done. return 0; } @@ -262,7 +262,7 @@ void init_cd (EquationSystems& es, // Project initial conditions at time 0 es.parameters.set ("time") = system.time = 0; - + system.project_solution(exact_value, NULL, es.parameters); } @@ -278,28 +278,28 @@ void assemble_cd (EquationSystems& es, // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Convection-Diffusion"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); - + // The dimension that we are running const unsigned int dim = mesh.mesh_dimension(); - + // Get a reference to the Convection-Diffusion system object. TransientLinearImplicitSystem & system = es.get_system ("Convection-Diffusion"); - + // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. FEType fe_type = system.variable_type(0); - + // Build a Finite Element object of the specified type. Since the // \p FEBase::build() member dynamically creates memory we will // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // A Gauss quadrature rule for numerical integration. // Let the \p FEType object decide what order rule is appropriate. QGauss qrule (dim, fe_type.default_quadrature_order()); @@ -311,10 +311,10 @@ void assemble_cd (EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. We will start - // with the element Jacobian * quadrature weight at each integration point. + // with the element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); const std::vector& JxW_face = fe_face->get_JxW(); - + // The element shape functions evaluated at the quadrature points. const std::vector >& phi = fe->get_phi(); const std::vector >& psi = fe_face->get_phi(); @@ -325,7 +325,7 @@ void assemble_cd (EquationSystems& es, // The XY locations of the quadrature points used for face integration const std::vector& qface_points = fe_face->get_xyz(); - + // A reference to the \p DofMap object for this system. The \p DofMap // object handles the index translation from node and element numbers // to degree of freedom numbers. We will talk more about the \p DofMap @@ -338,7 +338,7 @@ void assemble_cd (EquationSystems& es, // "Ke" and "Fe". DenseMatrix Ke; DenseVector Fe; - + // This vector will hold the degree of freedom indices for // the element. These define where in the global system // the element degrees of freedom get mapped. @@ -357,26 +357,26 @@ void assemble_cd (EquationSystems& es, // will be refined we want to only consider the ACTIVE elements, // hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); - const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); + const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); for ( ; el != end_el; ++el) - { + { // Store a pointer to the element we are currently // working on. This allows for nicer syntax later. const Elem* elem = *el; - + // Get the degree of freedom indices for the // current element. These define where in the global // matrix and right-hand-side this element will // contribute to. dof_map.dof_indices (elem, dof_indices); - + // Compute the element-specific data for the current // element. This involves computing the location of the // quadrature points (q_point) and the shape functions // (phi, dphi) for the current element. fe->reinit (elem); - + // Zero the element matrix and right-hand side before // summing them. We use the resize member here because // the number of degrees of freedom might have changed from @@ -387,7 +387,7 @@ void assemble_cd (EquationSystems& es, dof_indices.size()); Fe.resize (dof_indices.size()); - + // Now we will build the element matrix and right-hand-side. // Constructing the RHS requires the solution and its // gradient from the previous timestep. This myst be @@ -399,18 +399,18 @@ void assemble_cd (EquationSystems& es, // Values to hold the old solution & its gradient. Number u_old = 0.; Gradient grad_u_old; - + // Compute the old solution & its gradient. for (unsigned int l=0; lneighbor(s) == NULL) { fe_face->reinit(elem,s); - + for (unsigned int qp=0; qpadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } - + // That concludes the system matrix assembly routine. #endif // #ifdef LIBMESH_ENABLE_AMR } diff --git a/examples/transient/transient_ex2/transient_ex2.C b/examples/transient/transient_ex2/transient_ex2.C index 7ba30fc8c61..9027d93a5eb 100644 --- a/examples/transient/transient_ex2/transient_ex2.C +++ b/examples/transient/transient_ex2/transient_ex2.C @@ -56,7 +56,7 @@ #include "libmesh/dense_matrix.h" #include "libmesh/dense_vector.h" -// Define matrix and vector data types for the global +// Define matrix and vector data types for the global // equation system. These are base classes, // from which specific implementations, like // the PETSc or LASPACK implementations, are derived. @@ -110,18 +110,18 @@ int main (int argc, char** argv) if (libMesh::processor_id() == 0) std::cerr << "Usage: " << argv[0] << " [meshfile]" << std::endl; - + libmesh_error(); } - + // Tell the user what we are doing. - else + else { std::cout << "Running " << argv[0]; - + for (int i=1; i ("Wave"); - + // Add the variable "p" to "Wave". "p" // will be approximated using first-order approximation. t_system.add_variable("p", FIRST); @@ -213,9 +213,9 @@ int main (int argc, char** argv) t_system.attach_init_function (apply_initial); // Set the time step size, and optionally the - // Newmark parameters, so that \p NewmarkSystem can - // compute integration constants. Here we simply use - // pass only the time step and use default values + // Newmark parameters, so that \p NewmarkSystem can + // compute integration constants. Here we simply use + // pass only the time step and use default values // for \p alpha=.25 and \p delta=.5. t_system.set_newmark_parameters(delta_t); @@ -246,11 +246,11 @@ int main (int argc, char** argv) // Assemble the time independent system matrices and rhs. // This function will also compute the effective system matrix // K~=K+a_0*M+a_1*C and apply user specified initial - // conditions. + // conditions. t_system.assemble(); // Now solve for each time step. - // For convenience, use a local buffer of the + // For convenience, use a local buffer of the // current time. But once this time is updated, // also update the \p EquationSystems parameter // Start with t_time = 0 and write a short header @@ -274,7 +274,7 @@ int main (int argc, char** argv) // the penalty parameter should be added to the matrix // only in the first time step. The applied // boundary conditions may be time-dependent and hence - // the rhs vector is considered in each time step. + // the rhs vector is considered in each time step. if (time_step == 0) { // The local function \p fill_dirichlet_bc() @@ -335,8 +335,8 @@ int main (int argc, char** argv) << global_displacement[dof_no] << std::endl; } - - // All done. + + // All done. return 0; } @@ -344,7 +344,7 @@ int main (int argc, char** argv) // for our wave equation. void assemble_wave(EquationSystems& es, const std::string& system_name) -{ +{ // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Wave"); @@ -369,7 +369,7 @@ void assemble_wave(EquationSystems& es, // In here, we will add the element matrices to the // @e additional matrices "stiffness_mass" and "damping" - // and the additional vector "force", not to the members + // and the additional vector "force", not to the members // "matrix" and "rhs". Therefore, get writable // references to them. SparseMatrix& stiffness = t_system.get_matrix("stiffness"); @@ -393,14 +393,14 @@ void assemble_wave(EquationSystems& es, // store the object as an \p AutoPtr. This can be thought // of as a pointer that will clean up after itself. AutoPtr fe (FEBase::build(dim, fe_type)); - + // A 2nd order Gauss quadrature rule for numerical integration. QGauss qrule (dim, SECOND); // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The element shape functions evaluated at the quadrature points. @@ -430,7 +430,7 @@ void assemble_wave(EquationSystems& es, // contribution. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + for ( ; el != end_el; ++el) { // Store a pointer to the element we are currently @@ -478,17 +478,17 @@ void assemble_wave(EquationSystems& es, Ke(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]); Me(i,j) += JxW[qp]*phi[i][qp]*phi[j][qp] *1./(speed*speed); - } // end of the matrix summation loop + } // end of the matrix summation loop } // end of quadrature point loop // Now compute the contribution to the element matrix and the // right-hand-side vector if the current element lies on the - // boundary. + // boundary. { // In this example no natural boundary conditions will // be considered. The code is left here so it can easily // be extended. - // + // // don't do this for any side for (unsigned int side=0; siden_sides(); side++) if (!true) @@ -497,24 +497,24 @@ void assemble_wave(EquationSystems& es, // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, SECOND); - + // Tell the finte element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); - + // The value of the shape functions at the quadrature // points. const std::vector >& phi_face = fe_face->get_phi(); - + // The Jacobian * Quadrature Weight at the quadrature // points on the face. const std::vector& JxW_face = fe_face->get_JxW(); - + // Compute the shape function values on the element // face. fe_face->reinit(elem, side); @@ -522,7 +522,7 @@ void assemble_wave(EquationSystems& es, // Here we consider a normal acceleration acc_n=1 applied to // the whole boundary of our mesh. const Real acc_n_value = 1.0; - + // Loop over the face quadrature points for integration. for (unsigned int qp=0; qpneighbor(side) == NULL) - - // In this example the Dirichlet boundary conditions will be + + // In this example the Dirichlet boundary conditions will be // imposed via panalty method after the // system is assembled. - - } // end boundary condition section + + } // end boundary condition section // If this assembly program were to be used on an adaptive mesh, // we would have to apply any hanging node constraint equations @@ -556,16 +556,16 @@ void assemble_wave(EquationSystems& es, stiffness.add_matrix (Ke, dof_indices); damping.add_matrix (Ce, dof_indices); mass.add_matrix (Me, dof_indices); - + force.add_vector (Fe, dof_indices); - + // For the overall matrix, explicitly zero the entries where - // we added values in the other ones, so that we have + // we added values in the other ones, so that we have // identical sparsity footprints. matrix.add_matrix(zero_matrix, dof_indices); - + } // end of element loop - + // All done! return; } @@ -576,7 +576,7 @@ void apply_initial(EquationSystems& es, { // Get a reference to our system, as before NewmarkSystem & t_system = es.get_system (system_name); - + // Numeric vectors for the pressure, velocity and acceleration // values. NumericVector& pres_vec = t_system.get_vector("displacement"); diff --git a/examples/vector_fe/vector_fe_ex1/Makefile.am b/examples/vector_fe/vector_fe_ex1/Makefile.am index d7a97dbd324..912edff213a 100644 --- a/examples/vector_fe/vector_fe_ex1/Makefile.am +++ b/examples/vector_fe/vector_fe_ex1/Makefile.am @@ -4,7 +4,7 @@ install_dir = $(examples_install_path)/vector_fe/ex1 data = vector_fe_ex1.C exact_solution.C run.sh sources = $(data) run.sh -CLEANFILES = out.gmv out.e +CLEANFILES = out.gmv out.e ############################################## # include common example environment diff --git a/examples/vector_fe/vector_fe_ex1/exact_solution.C b/examples/vector_fe/vector_fe_ex1/exact_solution.C index 5b923720d9c..da60a1ac970 100644 --- a/examples/vector_fe/vector_fe_ex1/exact_solution.C +++ b/examples/vector_fe/vector_fe_ex1/exact_solution.C @@ -1,16 +1,16 @@ // The libMesh Finite Element Library. // Copyright (C) 2003 Benjamin S. Kirk - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/examples/vector_fe/vector_fe_ex1/vector_fe_ex1.C b/examples/vector_fe/vector_fe_ex1/vector_fe_ex1.C index 59ef219ddcf..882afa4fa36 100644 --- a/examples/vector_fe/vector_fe_ex1/vector_fe_ex1.C +++ b/examples/vector_fe/vector_fe_ex1/vector_fe_ex1.C @@ -80,21 +80,21 @@ int main (int argc, char** argv) // Brief message to the user regarding the program name // and command line arguments. std::cout << "Running " << argv[0]; - + for (int i=1; i ("Poisson"); @@ -120,10 +120,10 @@ int main (int argc, char** argv) // function. This will be called when needed by the // library. equation_systems.get_system("Poisson").attach_assemble_function (assemble_poisson); - + // Initialize the data structures for the equation system. equation_systems.init(); - + // Prints information about the system to the screen. equation_systems.print_info(); @@ -152,7 +152,7 @@ int main (int argc, char** argv) GMVIO(mesh).write_equation_systems( "out.gmv", equation_systems); #endif - // All done. + // All done. return 0; } @@ -166,12 +166,12 @@ int main (int argc, char** argv) void assemble_poisson(EquationSystems& es, const std::string& system_name) { - + // It is a good idea to make sure we are assembling // the proper system. libmesh_assert_equal_to (system_name, "Poisson"); - + // Get a constant reference to the mesh object. const MeshBase& mesh = es.get_mesh(); @@ -186,31 +186,31 @@ void assemble_poisson(EquationSystems& es, // to degree of freedom numbers. We will talk more about the DofMap // in future examples. const DofMap& dof_map = system.get_dof_map(); - + // Get a constant reference to the Finite Element type // for the first (and only) variable in the system. FEType fe_type = dof_map.variable_type(0); - + // Build a Finite Element object of the specified type. // Note that FEVectorBase is a typedef for the templated FE // class. AutoPtr fe (FEVectorBase::build(dim, fe_type)); - + // A 5th order Gauss quadrature rule for numerical integration. QGauss qrule (dim, FIFTH); - + // Tell the finite element object to use our quadrature rule. fe->attach_quadrature_rule (&qrule); - + // Declare a special finite element object for // boundary integration. AutoPtr fe_face (FEVectorBase::build(dim, fe_type)); - + // Boundary integration requires one quadraure rule, // with dimensionality one less than the dimensionality // of the element. QGauss qface(dim-1, FIFTH); - + // Tell the finite element object to use our // quadrature rule. fe_face->attach_quadrature_rule (&qface); @@ -218,7 +218,7 @@ void assemble_poisson(EquationSystems& es, // Here we define some references to cell-specific data that // will be used to assemble the linear system. // - // The element Jacobian * quadrature weight at each integration point. + // The element Jacobian * quadrature weight at each integration point. const std::vector& JxW = fe->get_JxW(); // The physical XY locations of the quadrature points on the element. @@ -263,7 +263,7 @@ void assemble_poisson(EquationSystems& es, // elements; hence we use a variant of the \p active_elem_iterator. MeshBase::const_element_iterator el = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end(); - + // Loop over the elements. Note that ++el is preferred to // el++ since the latter requires an unnecessary temporary // object. @@ -313,7 +313,7 @@ void assemble_poisson(EquationSystems& es, { Ke(i,j) += JxW[qp]*( dphi[i][qp].contract(dphi[j][qp]) ); } - + // This is the end of the matrix summation loop // Now we build the element right-hand-side contribution. // This involves a single loop in which we integrate the @@ -322,7 +322,7 @@ void assemble_poisson(EquationSystems& es, const Real x = q_point[qp](0); const Real y = q_point[qp](1); const Real eps = 1.e-3; - + // "f" is the forcing function for the Poisson equation. // In this case we set f to be a finite difference @@ -354,9 +354,9 @@ void assemble_poisson(EquationSystems& es, for (unsigned int i=0; i >& phi_face = fe_face->get_phi(); - + // The Jacobian * Quadrature Weight at the quadrature // points on the face. const std::vector& JxW_face = fe_face->get_JxW(); - + // The XYZ locations (in physical space) of the // quadrature points on the face. This is where // we will interpolate the boundary value function. const std::vector& qface_point = fe_face->get_xyz(); - + // Compute the shape function values on the element // face. fe_face->reinit(elem, side); - + // Loop over the face quadrature points for integration. for (unsigned int qp=0; qpadd_matrix (Ke, dof_indices); system.rhs->add_vector (Fe, dof_indices); } - + // All done! } diff --git a/examples/vector_fe/vector_fe_ex2/laplace_exact_solution.h b/examples/vector_fe/vector_fe_ex2/laplace_exact_solution.h index 1acdfeef363..714075a6e77 100644 --- a/examples/vector_fe/vector_fe_ex2/laplace_exact_solution.h +++ b/examples/vector_fe/vector_fe_ex2/laplace_exact_solution.h @@ -28,8 +28,8 @@ class LaplaceExactSolution LaplaceExactSolution(){} ~LaplaceExactSolution(){} - - Real operator()( unsigned int component, + + Real operator()( unsigned int component, Real x, Real y, Real z = 0.0) { const Real hp = 0.5*pi; @@ -58,8 +58,8 @@ class LaplaceExactGradient LaplaceExactGradient(){} ~LaplaceExactGradient(){} - - RealGradient operator()( unsigned int component, + + RealGradient operator()( unsigned int component, Real x, Real y, Real z = 0.0) { const Real hp = 0.5*pi; diff --git a/examples/vector_fe/vector_fe_ex2/laplace_system.C b/examples/vector_fe/vector_fe_ex2/laplace_system.C index 6efddd5153a..4182f7decaa 100644 --- a/examples/vector_fe/vector_fe_ex2/laplace_system.C +++ b/examples/vector_fe/vector_fe_ex2/laplace_system.C @@ -86,7 +86,7 @@ void LaplaceSystem::init_context(DiffContext &context) // Get finite element object FEGenericBase* fe; c.get_element_fe( u_var, fe ); - + // We should prerequest all the data // we will need to build the linear system. fe->get_JxW(); @@ -110,7 +110,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // Get finite element object FEGenericBase* fe = NULL; c.get_element_fe( u_var, fe ); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -123,7 +123,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, // The velocity shape function gradients at interior // quadrature points. const std::vector >& grad_phi = fe->get_dphi(); - + const std::vector& qpoint = fe->get_xyz(); // The number of local degrees of freedom in each variable @@ -132,7 +132,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, DenseSubMatrix &Kuu = *c.elem_subjacobians[u_var][u_var]; DenseSubVector &Fu = *c.elem_subresiduals[u_var]; - + // Now we will build the element Jacobian and residual. // Constructing the residual requires the solution and its // gradient from the previous timestep. This must be @@ -144,7 +144,7 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, for (unsigned int qp=0; qp != n_qpoints; qp++) { Tensor grad_u; - + c.interior_gradient( u_var, qp, grad_u ); @@ -164,12 +164,12 @@ bool LaplaceSystem::element_time_derivative (bool request_jacobian, for (unsigned int j=0; j != n_u_dofs; j++) { Kuu(i,j) += grad_phi[j][qp].contract(grad_phi[i][qp])*JxW[qp]; - + } } } } // end of the quadrature point qp-loop - + return request_jacobian; } @@ -182,7 +182,7 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, // Get finite element object FEGenericBase* side_fe = NULL; c.get_side_fe( u_var, side_fe ); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -210,14 +210,14 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, { Gradient u; c.side_value( u_var, qp, u ); - + Gradient u_exact( this->exact_solution( 0, qpoint[qp](0), qpoint[qp](1) ), this->exact_solution( 1, qpoint[qp](0), qpoint[qp](1) )); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += penalty*(u - u_exact)*phi[i][qp]*JxW[qp]; - + if (request_jacobian) { for (unsigned int j=0; j != n_u_dofs; j++) @@ -233,7 +233,7 @@ bool LaplaceSystem::side_constraint (bool request_jacobian, RealGradient LaplaceSystem::forcing( const Point& p ) { Real x = p(0); Real y = p(1); Real z = p(2); - + const Real eps = 1.e-3; const Real fx = -(exact_solution(0,x,y,z-eps) + @@ -243,7 +243,7 @@ RealGradient LaplaceSystem::forcing( const Point& p ) exact_solution(0,x-eps,y,z) + exact_solution(0,x+eps,y,z) - 6.*exact_solution(0,x,y,z))/eps/eps; - + const Real fy = -(exact_solution(1,x,y,z-eps) + exact_solution(1,x,y,z+eps) + exact_solution(1,x,y-eps,z) + @@ -259,6 +259,6 @@ RealGradient LaplaceSystem::forcing( const Point& p ) exact_solution(2,x-eps,y,z) + exact_solution(2,x+eps,y,z) - 6.*exact_solution(2,x,y,z))/eps/eps; - + return RealGradient( fx, fy, fz ); } diff --git a/examples/vector_fe/vector_fe_ex2/laplace_system.h b/examples/vector_fe/vector_fe_ex2/laplace_system.h index 774cb9d072a..378ca2885f6 100644 --- a/examples/vector_fe/vector_fe_ex2/laplace_system.h +++ b/examples/vector_fe/vector_fe_ex2/laplace_system.h @@ -39,18 +39,18 @@ class LaplaceSystem : public FEMSystem LaplaceSystem( EquationSystems& es, const std::string& name, const unsigned int number); - + // System initialization virtual void init_data (); - + // Context initialization virtual void init_context(DiffContext &context); - + // Element residual and jacobian calculations // Time dependent parts virtual bool element_time_derivative (bool request_jacobian, DiffContext& context); - + // Constraint part /* virtual bool side_constraint (bool request_jacobian, @@ -62,10 +62,10 @@ class LaplaceSystem : public FEMSystem unsigned int u_var; void init_dirichlet_bcs(); - + // Returns the value of a forcing function at point p. RealGradient forcing(const Point& p); - + LaplaceExactSolution exact_solution; }; diff --git a/examples/vector_fe/vector_fe_ex2/vector_fe_ex2.C b/examples/vector_fe/vector_fe_ex2/vector_fe_ex2.C index eec248c8a1f..34facfbfa09 100644 --- a/examples/vector_fe/vector_fe_ex2/vector_fe_ex2.C +++ b/examples/vector_fe/vector_fe_ex2/vector_fe_ex2.C @@ -56,7 +56,7 @@ int main (int argc, char** argv) // Create a mesh. Mesh mesh; - + // Use the MeshTools::Generation mesh generator to create a uniform // grid on the square [-1,1]^D. We instruct the mesh generator // to build a mesh of 8x8 \p Quad9 elements in 2D, or \p Hex27 @@ -78,7 +78,7 @@ int main (int argc, char** argv) EquationSystems equation_systems (mesh); // Declare the system "Navier-Stokes" and its variables. - LaplaceSystem & system = + LaplaceSystem & system = equation_systems.add_system ("Laplace"); // This example only implements the steady-state problem @@ -100,7 +100,7 @@ int main (int argc, char** argv) infile("relative_residual_tolerance", 0.0); solver.absolute_residual_tolerance = infile("absolute_residual_tolerance", 0.0); - + // And the linear solver options solver.max_linear_iterations = infile("max_linear_iterations", 50000); @@ -113,7 +113,7 @@ int main (int argc, char** argv) system.solve(); ExactSolution exact_sol( equation_systems ); - + std::vector* > sols; std::vector* > grads; @@ -122,14 +122,14 @@ int main (int argc, char** argv) exact_sol.attach_exact_values(sols); exact_sol.attach_exact_derivs(grads); - + // Use higher quadrature order for more accurate error results int extra_error_quadrature = infile("extra_error_quadrature",2); exact_sol.extra_quadrature_order(extra_error_quadrature); // Compute the error. exact_sol.compute_error("Laplace", "u"); - + // Print out the error values std::cout << "L2-Error is: " << exact_sol.l2_error("Laplace", "u") @@ -137,16 +137,16 @@ int main (int argc, char** argv) std::cout << "H1-Error is: " << exact_sol.h1_error("Laplace", "u") << std::endl; - + #ifdef LIBMESH_HAVE_EXODUS_API - + // We write the file in the ExodusII format. ExodusII_IO(mesh).write_equation_systems("out.e", equation_systems); - + #endif // #ifdef LIBMESH_HAVE_EXODUS_API UCDIO(mesh).write_equation_systems("out.inp", equation_systems); - // All done. + // All done. return 0; } diff --git a/examples/vector_fe/vector_fe_ex3/Makefile.am b/examples/vector_fe/vector_fe_ex3/Makefile.am index 5d95f1b3232..450c2a8db73 100644 --- a/examples/vector_fe/vector_fe_ex3/Makefile.am +++ b/examples/vector_fe/vector_fe_ex3/Makefile.am @@ -4,7 +4,7 @@ install_dir = $(examples_install_path)/vector_fe/ex3 data = curl_curl_exact_solution.h vector_fe_ex3.in curl_curl_system.C solution_function.h curl_curl_system.h vector_fe_ex3.C run.sh sources = $(data) run.sh -CLEANFILES = +CLEANFILES = # also need to link files for VPATH builds if LIBMESH_VPATH_BUILD diff --git a/examples/vector_fe/vector_fe_ex3/curl_curl_exact_solution.h b/examples/vector_fe/vector_fe_ex3/curl_curl_exact_solution.h index 1d3b1675001..d0eb120e2d1 100644 --- a/examples/vector_fe/vector_fe_ex3/curl_curl_exact_solution.h +++ b/examples/vector_fe/vector_fe_ex3/curl_curl_exact_solution.h @@ -29,12 +29,12 @@ class CurlCurlExactSolution CurlCurlExactSolution(){} ~CurlCurlExactSolution(){} - + RealGradient operator()( Real x, Real y ) { const Real ux = cos(pi*x)*sin(pi*y); const Real uy = -sin(pi*x)*cos(pi*y); - + return RealGradient( ux, uy ); } @@ -60,7 +60,7 @@ class CurlCurlExactSolution { const Real fx = (2*pi*pi + 1)*cos(pi*x)*sin(pi*y); const Real fy = -(2*pi*pi + 1)*sin(pi*x)*cos(pi*y); - + return RealGradient( fx, fy ); } diff --git a/examples/vector_fe/vector_fe_ex3/curl_curl_system.C b/examples/vector_fe/vector_fe_ex3/curl_curl_system.C index 1a2482759c5..423a2d3afcf 100644 --- a/examples/vector_fe/vector_fe_ex3/curl_curl_system.C +++ b/examples/vector_fe/vector_fe_ex3/curl_curl_system.C @@ -86,7 +86,7 @@ void CurlCurlSystem::init_context(DiffContext &context) // Get finite element object FEGenericBase* fe; c.get_element_fe( u_var, fe ); - + // We should prerequest all the data // we will need to build the linear system. fe->get_JxW(); @@ -113,7 +113,7 @@ bool CurlCurlSystem::element_time_derivative (bool request_jacobian, // Get finite element object FEGenericBase* fe = NULL; c.get_element_fe( u_var, fe ); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -126,7 +126,7 @@ bool CurlCurlSystem::element_time_derivative (bool request_jacobian, // The velocity shape function gradients at interior // quadrature points. const std::vector >& curl_phi = fe->get_curl_phi(); - + const std::vector& qpoint = fe->get_xyz(); // The number of local degrees of freedom in each variable @@ -135,7 +135,7 @@ bool CurlCurlSystem::element_time_derivative (bool request_jacobian, DenseSubMatrix &Kuu = *c.elem_subjacobians[u_var][u_var]; DenseSubVector &Fu = *c.elem_subresiduals[u_var]; - + // Now we will build the element Jacobian and residual. // Constructing the residual requires the solution and its // gradient from the previous timestep. This must be @@ -149,13 +149,13 @@ bool CurlCurlSystem::element_time_derivative (bool request_jacobian, { Gradient u; Gradient curl_u; - + c.interior_value( u_var, qp, u ); c.interior_curl( u_var, qp, curl_u ); // Value of the forcing function at this quadrature point - RealGradient f = this->forcing(qpoint[qp]); + RealGradient f = this->forcing(qpoint[qp]); // First, an i-loop over the degrees of freedom. for (unsigned int i=0; i != n_u_dofs; i++) @@ -169,13 +169,13 @@ bool CurlCurlSystem::element_time_derivative (bool request_jacobian, { Kuu(i,j) += ( curl_phi[j][qp]*curl_phi[i][qp] + phi[j][qp]*phi[i][qp] )*JxW[qp]; - + } } - + } } // end of the quadrature point qp-loop - + return request_jacobian; } @@ -188,7 +188,7 @@ bool CurlCurlSystem::side_time_derivative (bool request_jacobian, // Get finite element object FEGenericBase* side_fe = NULL; c.get_side_fe( u_var, side_fe ); - + // First we get some references to cell-specific data that // will be used to assemble the linear system. @@ -224,7 +224,7 @@ bool CurlCurlSystem::side_time_derivative (bool request_jacobian, Gradient u_exact = this->exact_solution( qpoint[qp] ) ; Gradient Ncu = (u - u_exact).cross(N); - + for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += penalty*Ncu*(phi[i][qp].cross(N))*JxW[qp]; @@ -251,6 +251,6 @@ RealGradient CurlCurlSystem::forcing( const Point& p ) RealGradient CurlCurlSystem::exact_solution( const Point& p ) { Real x = p(0); Real y = p(1); - + return soln(x,y); } diff --git a/examples/vector_fe/vector_fe_ex3/curl_curl_system.h b/examples/vector_fe/vector_fe_ex3/curl_curl_system.h index 26e71df3071..b1ce130870d 100644 --- a/examples/vector_fe/vector_fe_ex3/curl_curl_system.h +++ b/examples/vector_fe/vector_fe_ex3/curl_curl_system.h @@ -39,13 +39,13 @@ class CurlCurlSystem : public FEMSystem CurlCurlSystem( EquationSystems& es, const std::string& name, const unsigned int number ); - + // System initialization virtual void init_data (); - + // Context initialization virtual void init_context(DiffContext &context); - + // Element residual and jacobian calculations // Time dependent parts virtual bool element_time_derivative (bool request_jacobian, @@ -59,7 +59,7 @@ class CurlCurlSystem : public FEMSystem unsigned int u_var; void init_dirichlet_bcs(); - + // Returns the value of a forcing function at point p. RealGradient forcing(const Point& p); diff --git a/examples/vector_fe/vector_fe_ex3/vector_fe_ex3.C b/examples/vector_fe/vector_fe_ex3/vector_fe_ex3.C index 24ae0c143b2..f67b6a7f777 100644 --- a/examples/vector_fe/vector_fe_ex3/vector_fe_ex3.C +++ b/examples/vector_fe/vector_fe_ex3/vector_fe_ex3.C @@ -60,7 +60,7 @@ int main (int argc, char** argv) // Use the MeshTools::Generation mesh generator to create a uniform // grid on the square [-1,1]^D. We must use TRI6 elements for the // Nedelec triangle elements. - + std::string elem_str = command_line_value( std::string("element_type"), std::string("TRI6") ); @@ -87,7 +87,7 @@ int main (int argc, char** argv) EquationSystems equation_systems (mesh); // Declare the system "Navier-Stokes" and its variables. - CurlCurlSystem & system = + CurlCurlSystem & system = equation_systems.add_system ("CurlCurl"); // This example only implements the steady-state problem @@ -109,7 +109,7 @@ int main (int argc, char** argv) infile("relative_residual_tolerance", 1.0e-13); solver.absolute_residual_tolerance = infile("absolute_residual_tolerance", 0.0); - + // And the linear solver options solver.max_linear_iterations = infile("max_linear_iterations", 50000); @@ -122,7 +122,7 @@ int main (int argc, char** argv) system.solve(); ExactSolution exact_sol( equation_systems ); - + std::vector* > sols; std::vector* > grads; @@ -131,14 +131,14 @@ int main (int argc, char** argv) exact_sol.attach_exact_values(sols); exact_sol.attach_exact_derivs(grads); - + // Use higher quadrature order for more accurate error results int extra_error_quadrature = infile("extra_error_quadrature",2); exact_sol.extra_quadrature_order(extra_error_quadrature); // Compute the error. exact_sol.compute_error("CurlCurl", "u"); - + // Print out the error values std::cout << "L2-Error is: " << exact_sol.l2_error("CurlCurl", "u") @@ -156,7 +156,7 @@ int main (int argc, char** argv) ExodusII_IO(mesh).write_equation_systems("out.e", equation_systems); #endif // #ifdef LIBMESH_HAVE_EXODUS_API - - // All done. + + // All done. return 0; } diff --git a/include/Makefile.am b/include/Makefile.am index 880a503f9d0..6b19d0c0bac 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = libmesh # special handholding for prefix_config.m4 generated files # so that 'make clean ; make' works as does 'make distcheck' -# libmesh_config.h is made by ./configure, so it should get +# libmesh_config.h is made by ./configure, so it should get # cleaned by 'make distclean' DISTCLEANFILES = libmesh_config.h @@ -34,7 +34,7 @@ if LIBMESH_ENABLE_EXODUS endif if LIBMESH_ENABLE_FPARSER headers_to_test += contrib/fparser.hh -endif +endif test_headers: @echo " " @@ -55,4 +55,3 @@ installcheck-local: PKG_CONFIG_PATH=$(pkgconfigdir) \ LIBMESH_CONFIG_PATH=$(bindir) \ $(top_srcdir)/contrib/bin/test_installed_headers.sh - diff --git a/include/base/dof_map.h b/include/base/dof_map.h index 17d3af37ae5..4b9096483dc 100644 --- a/include/base/dof_map.h +++ b/include/base/dof_map.h @@ -186,14 +186,14 @@ class DofMap : public ReferenceCountedObject */ virtual void augment_send_list (std::vector & send_list) = 0; }; - + /** * Additional matrices may be handled with this \p DofMap. * They are initialized to the same sparsity structure as * the major matrix. */ void attach_matrix (SparseMatrix& matrix); - + /** * Matrices should not be attached more than once. We can test for * an already-attached matrix if necessary using \p is_attached @@ -253,7 +253,7 @@ class DofMap : public ReferenceCountedObject /** * Attach an object to populate the send_list with extra entries. - * This should only add to the send list, but no checking is done + * This should only add to the send list, but no checking is done * to enforce this behavior. * * This is an advanced function... use at your own peril! @@ -269,7 +269,7 @@ class DofMap : public ReferenceCountedObject */ void attach_extra_send_list_function(void (*func)(std::vector &, void *), void * context = NULL) { _extra_send_list_function = func; _extra_send_list_context = context; } - + /** * Takes the \p _send_list vector (which may have duplicate entries) * and sorts it. The duplicate entries are then removed, resulting in @@ -371,7 +371,7 @@ class DofMap : public ReferenceCountedObject * @returns the total number of degrees of freedom in the problem. */ dof_id_type n_dofs() const { return _n_dfs; } - + /** * @returns the number of SCALAR dofs. */ @@ -503,7 +503,7 @@ class DofMap : public ReferenceCountedObject * @returns the total number of constrained Nodes * in the mesh. */ - dof_id_type n_constrained_nodes() const + dof_id_type n_constrained_nodes() const { return libmesh_cast_int(_node_constraints.size()); } #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS @@ -993,7 +993,7 @@ class DofMap : public ReferenceCountedObject void add_constraints_to_send_list(); #endif // LIBMESH_ENABLE_CONSTRAINTS - + /** * The finite element type for each variable. */ diff --git a/include/base/dof_object.h b/include/base/dof_object.h index 3776fe28c19..fba157add21 100644 --- a/include/base/dof_object.h +++ b/include/base/dof_object.h @@ -312,7 +312,7 @@ class DofObject : public ReferenceCountedObject */ dof_id_type vg_dof_base(const unsigned int s, const unsigned int vg) const; - + /** * An invaild \p id to distinguish an uninitialized \p DofObject */ @@ -371,7 +371,7 @@ class DofObject : public ReferenceCountedObject unsigned int system_var_to_vg_var (const unsigned int s, const unsigned int vg, const unsigned int var) const; - + /** * The \p id of the \p DofObject */ @@ -416,7 +416,7 @@ class DofObject : public ReferenceCountedObject * that means is that each \p Variable in the \p VariableGroup will have the same number * of nonzero components, and they can all be indexed from the same base number. We use this * information in the ncv_# and idx_# entries as follows: - * + * * ncv_# = n_vars*ncv_magic + n_comp for variable group # * idx_# = base_offset for variable group # * @@ -435,7 +435,7 @@ class DofObject : public ReferenceCountedObject index_buffer_t _idx_buf; /** - * Above we introduced the chimera ncv, which is a hybrid of the form + * Above we introduced the chimera ncv, which is a hybrid of the form * ncv = ncv_magic*nv + nc * where nv are the number of identical variables of a given type, * and nc is the number of components for this set of variables. @@ -444,7 +444,7 @@ class DofObject : public ReferenceCountedObject * will recgnize later that #/ncv_magic is simply a bitshift */ static const index_t ncv_magic = 256; // = 2^8, in case we want to manually bitshift - + /** * The starting index for system \p s. */ @@ -633,7 +633,7 @@ bool DofObject::valid_processor_id () const inline unsigned int DofObject::n_systems () const { - return _idx_buf.empty() ? + return _idx_buf.empty() ? 0 : libmesh_cast_int(_idx_buf[0]); } @@ -655,9 +655,9 @@ unsigned int DofObject::n_vars(const unsigned int s, { libmesh_assert_less (s, this->n_systems()); libmesh_assert_less (vg, this->n_var_groups(s)); - + const unsigned int start_idx_sys = this->start_idx(s); - + libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size()); return (libmesh_cast_int @@ -672,7 +672,7 @@ unsigned int DofObject::n_vars(const unsigned int s) const libmesh_assert_less (s, this->n_systems()); const unsigned int nvg = this->n_var_groups(s); - + unsigned int val=0; for (unsigned int vg=0; vgn_systems()); libmesh_assert_less (s, _idx_buf.size()); - return ((s+1) == this->n_systems()) ? - libmesh_cast_int(_idx_buf.size()) : + return ((s+1) == this->n_systems()) ? + libmesh_cast_int(_idx_buf.size()) : libmesh_cast_int(_idx_buf[s+1]); } @@ -876,12 +876,12 @@ unsigned int DofObject::system_var_to_vg_var (const unsigned int s, const unsigned int var) const { unsigned int accumulated_sum=0; - + for (unsigned int vgc=0; vgcn_vars(s,vgc); - + libmesh_assert_less_equal (accumulated_sum, var); - + return (var - accumulated_sum); } diff --git a/include/base/getpot.h b/include/base/getpot.h index 4c2c2da3707..397483a58fe 100644 --- a/include/base/getpot.h +++ b/include/base/getpot.h @@ -3025,5 +3025,3 @@ GetPot::variable::operator=(const GetPot::variable& Other) #undef victorate #endif // LIBMESH_GETPOT_H - - diff --git a/include/base/libmesh_common.h b/include/base/libmesh_common.h index 141459b04cd..6d5048e5ae0 100644 --- a/include/base/libmesh_common.h +++ b/include/base/libmesh_common.h @@ -267,7 +267,7 @@ extern OStreamProxy err; // The libmesh_file_error(const std::string& filename) macro prints a message // and throws a FileError exception // -// The libmesh_convergence_failure() macro +// The libmesh_convergence_failure() macro // throws a ConvergenceFailure exception // // These macros no longer write traceout files themselves, but if the diff --git a/include/base/libmesh_singleton.h b/include/base/libmesh_singleton.h index f3610c54152..235e2add7bf 100644 --- a/include/base/libmesh_singleton.h +++ b/include/base/libmesh_singleton.h @@ -37,7 +37,7 @@ namespace libMesh { Singleton(); /** - * Destructor. + * Destructor. */ virtual ~Singleton() {}; @@ -54,7 +54,7 @@ namespace libMesh { * Constructor. Adds the derived object to the setup cache list. */ Setup (); - + public: /** * Destructor. diff --git a/include/base/periodic_boundary.h b/include/base/periodic_boundary.h index decb932ad26..acfc93eb047 100644 --- a/include/base/periodic_boundary.h +++ b/include/base/periodic_boundary.h @@ -61,8 +61,8 @@ namespace libMesh { PeriodicBoundary(const RealVectorValue& vector); /** - * This function should be overloaded by derived classes to - * define how one finds corresponding nodes on the periodic + * This function should be overloaded by derived classes to + * define how one finds corresponding nodes on the periodic * boundary pair. */ virtual Point get_corresponding_pos(const Point& pt) const; diff --git a/include/base/periodic_boundary_base.h b/include/base/periodic_boundary_base.h index d648c51ffee..6004adfe4de 100644 --- a/include/base/periodic_boundary_base.h +++ b/include/base/periodic_boundary_base.h @@ -59,7 +59,7 @@ class PeriodicBoundaryBase /** * Copy constructor - */ + */ PeriodicBoundaryBase(const PeriodicBoundaryBase& other); /** @@ -68,8 +68,8 @@ class PeriodicBoundaryBase virtual ~PeriodicBoundaryBase() {} /** - * This function should be overloaded by derived classes to - * define how one finds corresponding nodes on the periodic + * This function should be overloaded by derived classes to + * define how one finds corresponding nodes on the periodic * boundary pair. */ virtual Point get_corresponding_pos(const Point & pt) const = 0; @@ -82,7 +82,7 @@ class PeriodicBoundaryBase * from a forward transformation. Note that not every transformation * needs to provide an automatic way to clone an inverse: you can simply * add a pair of PeriodicBoundaryBase objects using the appropriate - * DofMap interface instead. The simplest way to implement a clone + * DofMap interface instead. The simplest way to implement a clone * function like this is in terms of a copy constructor, see periodic_boundary.h. */ virtual AutoPtr clone(TransformationType t = FORWARD) const = 0; diff --git a/include/base/reference_counted_object.h b/include/base/reference_counted_object.h index a00ba0a52b9..9dea39e2baa 100644 --- a/include/base/reference_counted_object.h +++ b/include/base/reference_counted_object.h @@ -120,7 +120,3 @@ class ReferenceCountedObject : public ReferenceCounter #endif // LIBMESH_REFERENCE_COUNTED_OBJECT_H - - - - diff --git a/include/base/reference_counter.h b/include/base/reference_counter.h index 38e5a07ddbb..e34e3f60213 100644 --- a/include/base/reference_counter.h +++ b/include/base/reference_counter.h @@ -187,7 +187,3 @@ void ReferenceCounter::increment_destructor_count (const std::string& name) #endif // LIBMESH_REFERENCE_COUNTER_H - - - - diff --git a/include/enums/enum_eigen_solver_type.h b/include/enums/enum_eigen_solver_type.h index d3902955a43..54175a73ccf 100644 --- a/include/enums/enum_eigen_solver_type.h +++ b/include/enums/enum_eigen_solver_type.h @@ -78,7 +78,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_EIGENSOLVER_TYPE_H - - - - diff --git a/include/enums/enum_elem_type.h b/include/enums/enum_elem_type.h index 84dc7d263a8..645d38288aa 100644 --- a/include/enums/enum_elem_type.h +++ b/include/enums/enum_elem_type.h @@ -78,7 +78,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_ELEM_TYPE_H - - - - diff --git a/include/enums/enum_fe_family.h b/include/enums/enum_fe_family.h index 18ed24c2996..6ccd0fd323e 100644 --- a/include/enums/enum_fe_family.h +++ b/include/enums/enum_fe_family.h @@ -79,13 +79,9 @@ namespace libMeshEnums { */ enum FEFieldType {TYPE_SCALAR = 0, TYPE_VECTOR}; - + } using namespace libMeshEnums; #endif // LIBMESH_ENUM_FE_FAMILY_H - - - - diff --git a/include/enums/enum_io_package.h b/include/enums/enum_io_package.h index 8df7296a88e..a43a565a63c 100644 --- a/include/enums/enum_io_package.h +++ b/include/enums/enum_io_package.h @@ -52,7 +52,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_IO_PACKAGE_H - - - - diff --git a/include/enums/enum_norm_type.h b/include/enums/enum_norm_type.h index 2456f665f68..98784bae27c 100644 --- a/include/enums/enum_norm_type.h +++ b/include/enums/enum_norm_type.h @@ -43,7 +43,7 @@ namespace libMeshEnums { H2_SEMINORM = 11, HCURL_SEMINORM = 12, - + HDIV_SEMINORM = 13, W1_INF_SEMINORM = 15, @@ -66,7 +66,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_NORM_TYPE_H - - - - diff --git a/include/enums/enum_parallel_type.h b/include/enums/enum_parallel_type.h index b8058d6db96..1511af25525 100644 --- a/include/enums/enum_parallel_type.h +++ b/include/enums/enum_parallel_type.h @@ -45,7 +45,3 @@ using namespace libMeshEnums; #endif // LIBMESH_ENUM_PARALLEL_TYPE_H - - - - diff --git a/include/enums/enum_point_locator_type.h b/include/enums/enum_point_locator_type.h index 1d183ced903..282495af2ed 100644 --- a/include/enums/enum_point_locator_type.h +++ b/include/enums/enum_point_locator_type.h @@ -37,7 +37,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_POINT_LOCATOR_TYPE_H - - - - diff --git a/include/enums/enum_preconditioner_type.h b/include/enums/enum_preconditioner_type.h index 85a38713171..a959e2a3709 100644 --- a/include/enums/enum_preconditioner_type.h +++ b/include/enums/enum_preconditioner_type.h @@ -53,7 +53,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_PRECONDITIONER_TYPE_H - - - - diff --git a/include/enums/enum_quadrature_type.h b/include/enums/enum_quadrature_type.h index 68ab603f6e4..cad15f6a0dc 100644 --- a/include/enums/enum_quadrature_type.h +++ b/include/enums/enum_quadrature_type.h @@ -47,7 +47,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_QUADRATURE_TYPE_H - - - - diff --git a/include/enums/enum_solver_type.h b/include/enums/enum_solver_type.h index 0b5feed1a96..5f8c9681c59 100644 --- a/include/enums/enum_solver_type.h +++ b/include/enums/enum_solver_type.h @@ -59,7 +59,3 @@ using namespace libMeshEnums; #endif // LIBMESH_ENUM_SOLVER_TYPE_H - - - - diff --git a/include/enums/enum_subset_solve_mode.h b/include/enums/enum_subset_solve_mode.h index 7d74d9d467f..5c175848c50 100644 --- a/include/enums/enum_subset_solve_mode.h +++ b/include/enums/enum_subset_solve_mode.h @@ -40,4 +40,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_SUBSET_SOLVE_MODE_H - diff --git a/include/enums/enum_xdr_mode.h b/include/enums/enum_xdr_mode.h index 4f46acabffa..ece6c10b72b 100644 --- a/include/enums/enum_xdr_mode.h +++ b/include/enums/enum_xdr_mode.h @@ -43,7 +43,3 @@ namespace libMeshEnums { using namespace libMeshEnums; #endif // LIBMESH_ENUM_XDR_MODE_H - - - - diff --git a/include/error_estimation/adjoint_refinement_estimator.h b/include/error_estimation/adjoint_refinement_estimator.h index 93d13da269f..4b9293313cc 100644 --- a/include/error_estimation/adjoint_refinement_estimator.h +++ b/include/error_estimation/adjoint_refinement_estimator.h @@ -120,7 +120,7 @@ class AdjointRefinementEstimator : public ErrorEstimator /* A vector to hold the computed global QoI error estimate */ std::vector computed_global_QoI_errors; - + /* /\** */ /* * The code for estimate_error and both estimate_errors versions is very */ /* * similar, so we use the same function for all three */ @@ -143,4 +143,3 @@ class AdjointRefinementEstimator : public ErrorEstimator #endif // #ifdef LIBMESH_ENABLE_AMR #endif // LIBMESH_ADJOINT_REFINEMENT_ESTIMATOR_H - diff --git a/include/error_estimation/adjoint_residual_error_estimator.h b/include/error_estimation/adjoint_residual_error_estimator.h index 0ff6d4579d7..6687d41e522 100644 --- a/include/error_estimation/adjoint_residual_error_estimator.h +++ b/include/error_estimation/adjoint_residual_error_estimator.h @@ -89,7 +89,7 @@ class AdjointResidualErrorEstimator : public ErrorEstimator * when computing errors */ const QoISet &qoi_set() const { return _qoi_set; } - + /** * To aid in investigating error estimator behavior, set this string * to a suffix with which to plot (prefixed by "primal_" or "dual_") @@ -134,4 +134,3 @@ class AdjointResidualErrorEstimator : public ErrorEstimator } // namespace libMesh #endif // LIBMESH_ADJOINT_RESIDUAL_ERROR_ESTIMATOR_H - diff --git a/include/error_estimation/discontinuity_measure.h b/include/error_estimation/discontinuity_measure.h index 780dc833493..6f4f1e10796 100644 --- a/include/error_estimation/discontinuity_measure.h +++ b/include/error_estimation/discontinuity_measure.h @@ -109,4 +109,3 @@ class DiscontinuityMeasure : public JumpErrorEstimator } // namespace libMesh #endif // LIBMESH_DISCONTINUITY_MEASURE_H - diff --git a/include/error_estimation/error_estimator.h b/include/error_estimation/error_estimator.h index f26f4daff61..ba86bc5f6aa 100644 --- a/include/error_estimation/error_estimator.h +++ b/include/error_estimation/error_estimator.h @@ -152,4 +152,3 @@ class ErrorEstimator } // namespace libMesh #endif // LIBMESH_ERROR_ESTIMATOR_H - diff --git a/include/error_estimation/exact_error_estimator.h b/include/error_estimation/exact_error_estimator.h index 75445a7eaa9..8e934d635fe 100644 --- a/include/error_estimation/exact_error_estimator.h +++ b/include/error_estimation/exact_error_estimator.h @@ -259,4 +259,3 @@ class ExactErrorEstimator : public ErrorEstimator } // namespace libMesh #endif // LIBMESH_EXACT_ERROR_ESTIMATOR_H - diff --git a/include/error_estimation/fourth_error_estimators.h b/include/error_estimation/fourth_error_estimators.h index 54946d07ab2..9fe0ac9265a 100644 --- a/include/error_estimation/fourth_error_estimators.h +++ b/include/error_estimation/fourth_error_estimators.h @@ -79,4 +79,3 @@ class LaplacianErrorEstimator : public JumpErrorEstimator } // namespace libMesh #endif // LIBMESH_FOURTH_ERROR_ESTIMATORS_H - diff --git a/include/error_estimation/hp_coarsentest.h b/include/error_estimation/hp_coarsentest.h index 6656f07f21e..80b6c72fb9b 100644 --- a/include/error_estimation/hp_coarsentest.h +++ b/include/error_estimation/hp_coarsentest.h @@ -159,4 +159,3 @@ class HPCoarsenTest : public HPSelector #endif // #ifdef LIBMESH_ENABLE_AMR #endif // LIBMESH_HP_COARSENTEST_H - diff --git a/include/error_estimation/hp_selector.h b/include/error_estimation/hp_selector.h index d34f6f1c309..82d76391834 100644 --- a/include/error_estimation/hp_selector.h +++ b/include/error_estimation/hp_selector.h @@ -82,4 +82,3 @@ class HPSelector #endif // #ifdef LIBMESH_ENABLE_AMR #endif // LIBMESH_HP_SELECTOR_H - diff --git a/include/error_estimation/hp_singular.h b/include/error_estimation/hp_singular.h index 82d1de0f092..3efc0397a86 100644 --- a/include/error_estimation/hp_singular.h +++ b/include/error_estimation/hp_singular.h @@ -83,4 +83,3 @@ class HPSingularity #endif // #ifdef LIBMESH_ENABLE_AMR #endif // LIBMESH_HP_SINGULAR_H - diff --git a/include/error_estimation/jump_error_estimator.h b/include/error_estimation/jump_error_estimator.h index 3e23896d142..61db490c700 100644 --- a/include/error_estimation/jump_error_estimator.h +++ b/include/error_estimation/jump_error_estimator.h @@ -161,4 +161,3 @@ class JumpErrorEstimator : public ErrorEstimator } // namespace libMesh #endif // LIBMESH_JUMP_ERROR_ESTIMATOR_H - diff --git a/include/error_estimation/kelly_error_estimator.h b/include/error_estimation/kelly_error_estimator.h index 94fc9ff340d..d816b727152 100644 --- a/include/error_estimation/kelly_error_estimator.h +++ b/include/error_estimation/kelly_error_estimator.h @@ -123,4 +123,3 @@ class KellyErrorEstimator : public JumpErrorEstimator } // namespace libMesh #endif // LIBMESH_KELLY_ERROR_ESTIMATOR_H - diff --git a/include/error_estimation/uniform_refinement_estimator.h b/include/error_estimation/uniform_refinement_estimator.h index faa2cee5093..66a89fcedf8 100644 --- a/include/error_estimation/uniform_refinement_estimator.h +++ b/include/error_estimation/uniform_refinement_estimator.h @@ -134,4 +134,3 @@ class UniformRefinementEstimator : public ErrorEstimator #endif // #ifdef LIBMESH_ENABLE_AMR #endif // LIBMESH_UNIFORM_REFINEMENT_ESTIMATOR_H - diff --git a/include/error_estimation/weighted_patch_recovery_error_estimator.h b/include/error_estimation/weighted_patch_recovery_error_estimator.h index 781c6950260..375f4c60b20 100644 --- a/include/error_estimation/weighted_patch_recovery_error_estimator.h +++ b/include/error_estimation/weighted_patch_recovery_error_estimator.h @@ -72,7 +72,7 @@ class WeightedPatchRecoveryErrorEstimator : public PatchRecoveryErrorEstimator ErrorVector& error_per_cell, const NumericVector* solution_vector = NULL, bool estimate_parent_error = false); - + /** Vector of fem function base pointers, the user will fill this in with pointers to the appropriate weight functions @@ -80,7 +80,7 @@ class WeightedPatchRecoveryErrorEstimator : public PatchRecoveryErrorEstimator std::vector*> weight_functions; private: - + /** * Class to compute the error contribution for a range * of elements. May be executed in parallel on separate threads. diff --git a/include/fe/fe.h b/include/fe/fe.h index 6551c4fb073..84f0d14d424 100644 --- a/include/fe/fe.h +++ b/include/fe/fe.h @@ -98,7 +98,7 @@ class FE : public FEGenericBase::type> explicit FE(const FEType& fet); - typedef typename + typedef typename FEGenericBase::type>::OutputShape OutputShape; diff --git a/include/fe/fe_abstract.h b/include/fe/fe_abstract.h index 7fb65a30606..139b8101a4d 100644 --- a/include/fe/fe_abstract.h +++ b/include/fe/fe_abstract.h @@ -457,7 +457,7 @@ class FEAbstract : public ReferenceCountedObject /** * Prints the value of each shape function's derivative - * at each quadrature point. Implement in derived class since this + * at each quadrature point. Implement in derived class since this * depends on whether the element is vector-valued or not. */ virtual void print_dphi(std::ostream& os) const =0; @@ -466,7 +466,7 @@ class FEAbstract : public ReferenceCountedObject /** * Prints the value of each shape function's second derivatives - * at each quadrature point. Implement in derived class since this + * at each quadrature point. Implement in derived class since this * depends on whether the element is vector-valued or not. */ virtual void print_d2phi(std::ostream& os) const =0; @@ -505,7 +505,7 @@ class FEAbstract : public ReferenceCountedObject * the shape functions are vector-valued or not. */ virtual void compute_shape_functions(const Elem*, const std::vector& ) =0; - + AutoPtr _fe_map; @@ -549,7 +549,7 @@ class FEAbstract : public ReferenceCountedObject * Should we calculate reference shape function gradients? */ mutable bool calculate_dphiref; - + /** * The finite element type for this object. Note that this diff --git a/include/fe/fe_base.h b/include/fe/fe_base.h index 73b3f612904..a48fd6ab097 100644 --- a/include/fe/fe_base.h +++ b/include/fe/fe_base.h @@ -75,7 +75,7 @@ class InfFE; struct TypesEqual { static const bool value = false; }; - + template struct TypesEqual { static const bool value = true; @@ -154,7 +154,7 @@ class FEGenericBase : public FEAbstract typedef typename TensorTools::IncrementRank::type OutputNumberTensor; typedef typename TensorTools::DecrementRank::type OutputNumberDivergence; - + #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS diff --git a/include/fe/fe_compute_data.h b/include/fe/fe_compute_data.h index 9160f827b63..ff90dae50e8 100644 --- a/include/fe/fe_compute_data.h +++ b/include/fe/fe_compute_data.h @@ -127,7 +127,3 @@ class FEComputeData } // namespace libMesh #endif // LIBMESH_FE_COMPUTE_DATA_H - - - - diff --git a/include/fe/fe_interface.h b/include/fe/fe_interface.h index 813c0cb927a..8e4b4ef90de 100644 --- a/include/fe/fe_interface.h +++ b/include/fe/fe_interface.h @@ -336,19 +336,19 @@ class FEInterface /** * Returns the number of components of a vector-valued element. - * Scalar-valued elements return 1. + * Scalar-valued elements return 1. */ static FEFieldType field_type( const FEType& fe_type ); /** * Returns the number of components of a vector-valued element. - * Scalar-valued elements return 1. + * Scalar-valued elements return 1. */ static FEFieldType field_type( const FEFamily& fe_family ); /** * Returns the number of components of a vector-valued element. - * Scalar-valued elements return 1. + * Scalar-valued elements return 1. */ static unsigned int n_vec_dim( const MeshBase& mesh, const FEType& fe_type ); diff --git a/include/fe/fe_map.h b/include/fe/fe_map.h index e5340ee7cf5..1b8d880a665 100644 --- a/include/fe/fe_map.h +++ b/include/fe/fe_map.h @@ -29,23 +29,23 @@ namespace libMesh { - + // forward declarations class Elem; class FEMap { public: - + FEMap(); virtual ~FEMap(){}; - + static AutoPtr build( FEType fe_type ); template void init_reference_to_physical_map( const std::vector& qp, const Elem* elem ); - + /** * Compute the jacobian and some other additional * data fields at the single point with index p. @@ -54,7 +54,7 @@ class Elem; const std::vector& qw, const Elem* elem, unsigned int p ); - + /** * Compute the jacobian and some other additional * data fields. Takes the integration weights @@ -64,7 +64,7 @@ class Elem; virtual void compute_affine_map( const unsigned int dim, const std::vector& qw, const Elem* elem ); - + /** * Compute the jacobian and some other additional * data fields. Takes the integration weights @@ -73,19 +73,19 @@ class Elem; virtual void compute_map( const unsigned int dim, const std::vector& qw, const Elem* elem ); - + /** * Same as compute_map, but for a side. Useful for boundary integration. */ virtual void compute_face_map(int dim, const std::vector& qw, const Elem* side); - + /** * Same as before, but for an edge. Useful for some projections. */ void compute_edge_map(int dim, const std::vector& qw, const Elem* side); - + /** * Initalizes the reference to physical element map for a side. * This is used for boundary integration. @@ -101,7 +101,7 @@ class Elem; template< unsigned int Dim> void init_edge_shape_functions(const std::vector& qp, const Elem* edge); - + /** * @returns the \p xyz spatial locations of the quadrature * points on the element. @@ -114,7 +114,7 @@ class Elem; */ const std::vector& get_jacobian() const { return jac; } - + /** * @returns the element Jacobian times the quadrature weight for * each quadrature point. @@ -128,57 +128,57 @@ class Elem; */ const std::vector& get_dxyzdxi() const { return dxyzdxi_map; } - + /** * @returns the element tangents in eta-direction at the quadrature * points. */ const std::vector& get_dxyzdeta() const { return dxyzdeta_map; } - + /** * @returns the element tangents in zeta-direction at the quadrature * points. */ const std::vector& get_dxyzdzeta() const { return dxyzdzeta_map; } - + /** * @returns the second partial derivatives in xi. */ const std::vector& get_d2xyzdxi2() const { return d2xyzdxi2_map; } - + /** * @returns the second partial derivatives in eta. */ const std::vector& get_d2xyzdeta2() const { return d2xyzdeta2_map; } - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES - + /** * @returns the second partial derivatives in zeta. */ const std::vector& get_d2xyzdzeta2() const { return d2xyzdzeta2_map; } - + #endif - + /** * @returns the second partial derivatives in xi-eta. */ const std::vector& get_d2xyzdxideta() const { return d2xyzdxideta_map; } - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES - + /** * @returns the second partial derivatives in xi-zeta. */ const std::vector& get_d2xyzdxidzeta() const { return d2xyzdxidzeta_map; } - + /** * @returns the second partial derivatives in eta-zeta. */ @@ -186,70 +186,70 @@ class Elem; { return d2xyzdetadzeta_map; } #endif - + /** * @returns the dxi/dx entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_dxidx() const { return dxidx_map; } - + /** * @returns the dxi/dy entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_dxidy() const { return dxidy_map; } - + /** * @returns the dxi/dz entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_dxidz() const { return dxidz_map; } - + /** * @returns the deta/dx entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_detadx() const { return detadx_map; } - + /** * @returns the deta/dy entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_detady() const { return detady_map; } - + /** * @returns the deta/dz entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_detadz() const { return detadz_map; } - + /** * @returns the dzeta/dx entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_dzetadx() const { return dzetadx_map; } - + /** * @returns the dzeta/dy entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_dzetady() const { return dzetady_map; } - + /** * @returns the dzeta/dz entry in the transformation * matrix from physical to local coordinates. */ const std::vector& get_dzetadz() const { return dzetadz_map; } - + /** * @returns the reference to physical map for the side/edge */ @@ -285,19 +285,19 @@ class Elem; */ const std::vector >& get_tangents() const { return tangents; } - + /** * @returns the normal vectors for face integration. */ const std::vector& get_normals() const { return normals; } - + /** * @returns the curvatures for use in face integration. */ const std::vector& get_curvatures() const { return curvatures;} - + /** * Prints the Jacobian times the weight for each quadrature point. */ @@ -372,7 +372,7 @@ class Elem; */ std::vector >& get_dphidzeta_map() { return dphidzeta_map; } - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES /** * @returns the reference to physical map 2nd derivative @@ -411,10 +411,10 @@ class Elem; { return d2phidzeta2_map; } #endif - /* FIXME: PB: This function breaks encapsulation! Needed in FE<>::reinit and + /* FIXME: PB: This function breaks encapsulation! Needed in FE<>::reinit and InfFE<>::reinit. Not sure yet if the algorithm can be redone to avoid this. */ /** - * @returns writable reference to the element Jacobian times + * @returns writable reference to the element Jacobian times * the quadrature weight for each quadrature point. */ std::vector& get_JxW() @@ -433,132 +433,132 @@ class Elem; * Returns the x value of the pth entry of the dxzydxi_map. */ Real dxdxi_map(const unsigned int p) const { return dxyzdxi_map[p](0); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the y value of the pth entry of the dxzydxi_map. */ Real dydxi_map(const unsigned int p) const { return dxyzdxi_map[p](1); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the z value of the pth entry of the dxzydxi_map. */ Real dzdxi_map(const unsigned int p) const { return dxyzdxi_map[p](2); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the x value of the pth entry of the dxzydeta_map. */ Real dxdeta_map(const unsigned int p) const { return dxyzdeta_map[p](0); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the y value of the pth entry of the dxzydeta_map. */ Real dydeta_map(const unsigned int p) const { return dxyzdeta_map[p](1); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the z value of the pth entry of the dxzydeta_map. */ Real dzdeta_map(const unsigned int p) const { return dxyzdeta_map[p](2); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the x value of the pth entry of the dxzydzeta_map. */ Real dxdzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](0); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the y value of the pth entry of the dxzydzeta_map. */ Real dydzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](1); } - + /** * Used in \p FEMap::compute_map(), which should be * be usable in derived classes, and therefore protected. * Returns the z value of the pth entry of the dxzydzeta_map. */ Real dzdzeta_map(const unsigned int p) const { return dxyzdzeta_map[p](2); } - + /** * The spatial locations of the quadrature points */ std::vector xyz; - + /** * Vector of parital derivatives: * d(x)/d(xi), d(y)/d(xi), d(z)/d(xi) */ std::vector dxyzdxi_map; - + /** * Vector of parital derivatives: * d(x)/d(eta), d(y)/d(eta), d(z)/d(eta) */ std::vector dxyzdeta_map; - + /** * Vector of parital derivatives: * d(x)/d(zeta), d(y)/d(zeta), d(z)/d(zeta) */ std::vector dxyzdzeta_map; - + /** * Vector of second partial derivatives in xi: * d^2(x)/d(xi)^2, d^2(y)/d(xi)^2, d^2(z)/d(xi)^2 */ std::vector d2xyzdxi2_map; - + /** * Vector of mixed second partial derivatives in xi-eta: * d^2(x)/d(xi)d(eta) d^2(y)/d(xi)d(eta) d^2(z)/d(xi)d(eta) */ std::vector d2xyzdxideta_map; - + /** * Vector of second partial derivatives in eta: * d^2(x)/d(eta)^2 */ std::vector d2xyzdeta2_map; - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES - + /** * Vector of second partial derivatives in xi-zeta: * d^2(x)/d(xi)d(zeta), d^2(y)/d(xi)d(zeta), d^2(z)/d(xi)d(zeta) */ std::vector d2xyzdxidzeta_map; - + /** * Vector of mixed second partial derivatives in eta-zeta: * d^2(x)/d(eta)d(zeta) d^2(y)/d(eta)d(zeta) d^2(z)/d(eta)d(zeta) */ std::vector d2xyzdetadzeta_map; - + /** * Vector of second partial derivatives in zeta: * d^2(x)/d(zeta)^2 */ std::vector d2xyzdzeta2_map; - + #endif - + /** * Map for partial derivatives: * d(xi)/d(x). Needed for the Jacobian. */ std::vector dxidx_map; - + /** * Map for partial derivatives: * d(xi)/d(y). Needed for the Jacobian. @@ -570,116 +570,116 @@ class Elem; * d(xi)/d(z). Needed for the Jacobian. */ std::vector dxidz_map; - - + + /** * Map for partial derivatives: * d(eta)/d(x). Needed for the Jacobian. */ std::vector detadx_map; - + /** * Map for partial derivatives: * d(eta)/d(y). Needed for the Jacobian. */ std::vector detady_map; - + /** * Map for partial derivatives: * d(eta)/d(z). Needed for the Jacobian. */ std::vector detadz_map; - - + + /** * Map for partial derivatives: * d(zeta)/d(x). Needed for the Jacobian. */ std::vector dzetadx_map; - + /** * Map for partial derivatives: * d(zeta)/d(y). Needed for the Jacobian. */ std::vector dzetady_map; - + /** * Map for partial derivatives: * d(zeta)/d(z). Needed for the Jacobian. */ std::vector dzetadz_map; - + /** * Map for the shape function phi. */ std::vector > phi_map; - + /** * Map for the derivative, d(phi)/d(xi). */ std::vector > dphidxi_map; - + /** * Map for the derivative, d(phi)/d(eta). */ std::vector > dphideta_map; - + /** * Map for the derivative, d(phi)/d(zeta). */ std::vector > dphidzeta_map; - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES - + /** * Map for the second derivative, d^2(phi)/d(xi)^2. */ std::vector > d2phidxi2_map; - + /** * Map for the second derivative, d^2(phi)/d(xi)d(eta). */ std::vector > d2phidxideta_map; - + /** * Map for the second derivative, d^2(phi)/d(xi)d(zeta). */ std::vector > d2phidxidzeta_map; - + /** * Map for the second derivative, d^2(phi)/d(eta)^2. */ std::vector > d2phideta2_map; - + /** * Map for the second derivative, d^2(phi)/d(eta)d(zeta). */ std::vector > d2phidetadzeta_map; - + /** * Map for the second derivative, d^2(phi)/d(zeta)^2. */ std::vector > d2phidzeta2_map; - + #endif - + /** * Map for the side shape functions, psi. */ std::vector > psi_map; - + /** * Map for the derivative of the side functions, * d(psi)/d(xi). */ std::vector > dpsidxi_map; - + /** * Map for the derivative of the side function, * d(psi)/d(eta). */ std::vector > dpsideta_map; - + /** * Map for the second derivatives (in xi) of the * side shape functions. Useful for computing @@ -693,36 +693,36 @@ class Elem; * computing the curvature at the quadrature points. */ std::vector > d2psidxideta_map; - + /** * Map for the second derivatives (in eta) of the * side shape functions. Useful for computing the * curvature at the quadrature points. */ std::vector > d2psideta2_map; - + /** * Tangent vectors on boundary at quadrature points. */ std::vector > tangents; - + /** * Normal vectors on boundary at quadrature points */ std::vector normals; - + /** * The mean curvature (= one half the sum of the principal * curvatures) on the boundary at the quadrature points. * The mean curvature is a scalar value. */ std::vector curvatures; - + /** * Jacobian values at quadrature points */ std::vector jac; - + /** * Jacobian*Weight values at quadrature points */ @@ -730,9 +730,9 @@ class Elem; private: - + }; - + // ------------------------------------------------------------ // FEMap class inline members inline @@ -782,7 +782,7 @@ class Elem; jac(), JxW() {} - + } #endif // LIBMESH_FE_MAP_H diff --git a/include/fe/fe_transformation_base.h b/include/fe/fe_transformation_base.h index 48345a1d6da..7c987d4cfb4 100644 --- a/include/fe/fe_transformation_base.h +++ b/include/fe/fe_transformation_base.h @@ -41,15 +41,15 @@ namespace libMesh class FETransformationBase { public: - + FETransformationBase(){}; virtual ~FETransformationBase(){}; - + /** * Builds an FETransformation object based on the finite element type */ static AutoPtr > build( const FEType& type ); - + /** * Evaluates shape functions in physical coordinates based on proper * finite element transformation. @@ -57,9 +57,9 @@ namespace libMesh virtual void map_phi( const unsigned int dim, const Elem* const elem, const std::vector& qp, - const FEGenericBase& fe, + const FEGenericBase& fe, std::vector >& phi ) const = 0; - + /** * Evaluates shape function gradients in physical coordinates based on proper * finite element transformation. @@ -70,7 +70,7 @@ namespace libMesh const FEGenericBase& fe, std::vector::OutputGradient> >& dphi, std::vector >& dphidx, - std::vector >& dphidy, + std::vector >& dphidy, std::vector >& dphidz ) const = 0; #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES @@ -84,10 +84,10 @@ namespace libMesh const FEGenericBase& fe, std::vector::OutputTensor> >& d2phi, std::vector >& d2phidx2, - std::vector >& d2phidxdy, + std::vector >& d2phidxdy, std::vector >& d2phidxdz, std::vector >& d2phidy2, - std::vector >& d2phidydz, + std::vector >& d2phidydz, std::vector >& d2phidz2 ) const = 0; #endif //LIBMESH_ENABLE_SECOND_DERIVATIVES @@ -113,7 +113,7 @@ namespace libMesh std::vector::OutputDivergence> >& div_phi ) const = 0; }; // class FETransformationBase - + } #endif // LIBMESH_FE_TRANSFORMATION_BASE_H diff --git a/include/fe/fe_type.h b/include/fe/fe_type.h index 8f8d9c32de5..e95f4bc57d8 100644 --- a/include/fe/fe_type.h +++ b/include/fe/fe_type.h @@ -206,7 +206,3 @@ Order FEType::default_quadrature_order () const #endif // LIBMESH_FE_TYPE_H - - - - diff --git a/include/fe/fe_xyz_map.h b/include/fe/fe_xyz_map.h index 6848eebbb36..8c8301e62cd 100644 --- a/include/fe/fe_xyz_map.h +++ b/include/fe/fe_xyz_map.h @@ -30,7 +30,7 @@ namespace libMesh class FEXYZMap : public FEMap { public: - + FEXYZMap() : FEMap(){}; diff --git a/include/fe/h1_fe_transformation.h b/include/fe/h1_fe_transformation.h index b70a4931853..1046c4c162d 100644 --- a/include/fe/h1_fe_transformation.h +++ b/include/fe/h1_fe_transformation.h @@ -26,7 +26,7 @@ namespace libMesh { /** * This class handles the computation of the shape functions in the physical domain - * for H1 conforming elements. This class assumes the \p FEGenericBase object has been + * for H1 conforming elements. This class assumes the \p FEGenericBase object has been * initialized in the reference domain (i.e. \p init_shape_functions has been called). * * @author Paul T. Bauman, 2012 @@ -50,9 +50,9 @@ namespace libMesh const std::vector&, const FEGenericBase&, std::vector >& ) const; - + /** - * Evaluates shape function gradients in physical coordinates for H1 conforming + * Evaluates shape function gradients in physical coordinates for H1 conforming * elements. dphi/dx = dphi/dxi * dxi/dx, etc. */ virtual void map_dphi( const unsigned int dim, @@ -61,14 +61,14 @@ namespace libMesh const FEGenericBase& fe, std::vector::OutputGradient> >& dphi, std::vector >& dphidx, - std::vector >& dphidy, + std::vector >& dphidy, std::vector >& dphidz) const; #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES /** * Evaluates shape function Hessians in physical coordinates based on H1 conforming * finite element transformation. - * FIXME: These are currently not calculated correctly for non-affine elements. + * FIXME: These are currently not calculated correctly for non-affine elements. * The second derivative terms of the FEMap are not implemented. */ virtual void map_d2phi( const unsigned int dim, @@ -77,10 +77,10 @@ namespace libMesh const FEGenericBase& fe, std::vector::OutputTensor> >& d2phi, std::vector >& d2phidx2, - std::vector >& d2phidxdy, + std::vector >& d2phidxdy, std::vector >& d2phidxdz, std::vector >& d2phidy2, - std::vector >& d2phidydz, + std::vector >& d2phidydz, std::vector >& d2phidz2 ) const; #endif //LIBMESH_ENABLE_SECOND_DERIVATIVES @@ -93,7 +93,7 @@ namespace libMesh const std::vector& qp, const FEGenericBase& fe, std::vector >& curl_phi ) const; - + /** * Evaluates the shape function divergence in physical coordinates based on H1 conforming * finite element transformation. diff --git a/include/fe/hcurl_fe_transformation.h b/include/fe/hcurl_fe_transformation.h index 96363fd3f91..4845811f145 100644 --- a/include/fe/hcurl_fe_transformation.h +++ b/include/fe/hcurl_fe_transformation.h @@ -25,7 +25,7 @@ namespace libMesh /** * This class handles the computation of the shape functions in the physical domain - * for HCurl conforming elements. This class assumes the \p FEGenericBase object has been + * for HCurl conforming elements. This class assumes the \p FEGenericBase object has been * initialized in the reference domain (i.e. \p init_shape_functions has been called). * * @author Paul T. Bauman, 2012 @@ -51,9 +51,9 @@ namespace libMesh const std::vector& qp, const FEGenericBase& fe, std::vector >& phi ) const; - + /** - * Evaluates shape function gradients in physical coordinates for HCurl conforming + * Evaluates shape function gradients in physical coordinates for HCurl conforming * elements. */ virtual void map_dphi( const unsigned int /*dim*/, @@ -62,12 +62,12 @@ namespace libMesh const FEGenericBase& /*fe*/, std::vector::OutputGradient> >& /*dphi*/, std::vector >& /*dphidx*/, - std::vector >& /*dphidy*/, + std::vector >& /*dphidy*/, std::vector >& /*dphidz*/) const { libmesh_do_once( libMesh::err << "WARNING: Shape function gradients for HCurl elements are not currently " << "being computed!" << std::endl; ); return; } -#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES +#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES /** * Evaluates shape function Hessians in physical coordinates based on HCurl conforming * finite element transformation. @@ -78,10 +78,10 @@ namespace libMesh const FEGenericBase& /*fe*/, std::vector::OutputTensor> >& /*d2phi*/, std::vector >& /*d2phidx2*/, - std::vector >& /*d2phidxdy*/, + std::vector >& /*d2phidxdy*/, std::vector >& /*d2phidxdz*/, std::vector >& /*d2phidy2*/, - std::vector >& /*d2phidydz*/, + std::vector >& /*d2phidydz*/, std::vector >& /*d2phidz2*/ ) const { libmesh_do_once( libMesh::err << "WARNING: Shape function Hessians for HCurl elements are not currently " << "being computed!" << std::endl; ); return; } @@ -92,7 +92,7 @@ namespace libMesh * finite element transformation. * In 2-D, the transformation is \f$ \nabla \times \phi = J^{-1} * \nabla \times \hat{\phi} \f$ where * \f$ J = \det( dx/d\xi ) \f$ - * In 3-D, the transformation is \f$ \nabla \times \phi = J^{-1} dx/d\xi \nabla \times \hat{\phi} \f$ + * In 3-D, the transformation is \f$ \nabla \times \phi = J^{-1} dx/d\xi \nabla \times \hat{\phi} \f$ */ virtual void map_curl( const unsigned int dim, const Elem* const elem, diff --git a/include/geom/cell_prism15.h b/include/geom/cell_prism15.h index a3c8b4c34bf..6ba0c78fc77 100644 --- a/include/geom/cell_prism15.h +++ b/include/geom/cell_prism15.h @@ -229,4 +229,3 @@ Prism15::Prism15(Elem* p) : } // namespace libMesh #endif // LIBMESH_CELL_PRISM15_H - diff --git a/include/geom/cell_prism18.h b/include/geom/cell_prism18.h index 4b61d5c9281..58f9cdff205 100644 --- a/include/geom/cell_prism18.h +++ b/include/geom/cell_prism18.h @@ -256,4 +256,3 @@ Prism18::Prism18(Elem* p) : } // namespace libMesh #endif // LIBMESH_CELL_PRISM18_H - diff --git a/include/geom/elem.h b/include/geom/elem.h index 00c738485c5..62f3225c297 100644 --- a/include/geom/elem.h +++ b/include/geom/elem.h @@ -168,8 +168,8 @@ class Elem : public ReferenceCountedObject, * @returns a pointer to the "reference element" associated * with this element. The reference element is the image of this * element in reference parametric space. Importantly, it is *not* - * an actual element in the mesh, but rather a Singleton-type - * object, so for example all \p Quad4 elements share the same + * an actual element in the mesh, but rather a Singleton-type + * object, so for example all \p Quad4 elements share the same * \p reference_elem(). */ const Elem* reference_elem () const; @@ -317,8 +317,8 @@ class Elem : public ReferenceCountedObject, * active element along the specified edge defined by the two points * \p p1 and \p p2 */ - void find_edge_neighbors(const Point& p1, - const Point& p2, + void find_edge_neighbors(const Point& p1, + const Point& p2, std::set &neighbor_set) const; /** @@ -2184,7 +2184,7 @@ class Elem::PackedElem } /** - * \p return the global index of the packed element's nth neighbor + * \p return the global index of the packed element's nth neighbor */ unsigned int neighbor (const unsigned int n) const { diff --git a/include/geom/elem_type.h b/include/geom/elem_type.h index 7672020c404..343126dd5e4 100644 --- a/include/geom/elem_type.h +++ b/include/geom/elem_type.h @@ -68,7 +68,3 @@ namespace ElementTypes } // namespace libMesh #endif // LIBMESH_ELEM_TYPE_H - - - - diff --git a/include/geom/face.h b/include/geom/face.h index 943c71fe311..4c1cf973ccc 100644 --- a/include/geom/face.h +++ b/include/geom/face.h @@ -99,7 +99,3 @@ class Face : public Elem } // namespace libMesh #endif // LIBMESH_FACE_H - - - - diff --git a/include/geom/face_inf_quad.h b/include/geom/face_inf_quad.h index cb978ebd611..1bbdbe59d58 100644 --- a/include/geom/face_inf_quad.h +++ b/include/geom/face_inf_quad.h @@ -213,7 +213,3 @@ Point InfQuad::origin () const #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS #endif // LIBMESH_FACE_INF_QUAD_H - - - - diff --git a/include/geom/face_tri.h b/include/geom/face_tri.h index 03af6d9a373..afdaafd155c 100644 --- a/include/geom/face_tri.h +++ b/include/geom/face_tri.h @@ -141,5 +141,3 @@ class Tri : public Face } // namespace libMesh #endif // LIBMESH_FACE_TRI_H - - diff --git a/include/geom/node.h b/include/geom/node.h index c699179ce88..ca941a74192 100644 --- a/include/geom/node.h +++ b/include/geom/node.h @@ -209,7 +209,7 @@ class Node : public Point, unsigned int packed_size() const { // use "(a+b-1)/b" trick to get a/b to round up - static const unsigned int ints_per_Real = + static const unsigned int ints_per_Real = (sizeof(Real) + sizeof(int) - 1) / sizeof(int); return PackedNode::header_size + LIBMESH_DIM*ints_per_Real + diff --git a/include/geom/reference_elem.h b/include/geom/reference_elem.h index d6d3152d81f..7c51f75244a 100644 --- a/include/geom/reference_elem.h +++ b/include/geom/reference_elem.h @@ -31,7 +31,7 @@ namespace libMesh // forward declarations class Elem; - + /** * This namespace implements singleton reference elements for each * fundamental element type supported by \p libMesh. diff --git a/include/geom/remote_elem.h b/include/geom/remote_elem.h index 3d320172cd8..f645388eef8 100644 --- a/include/geom/remote_elem.h +++ b/include/geom/remote_elem.h @@ -61,7 +61,7 @@ class RemoteElem : public Elem, * Constructor. Private to force use of the \p create() member. */ private: - RemoteElem () : Elem(0,0,NULL,_elemlinks_data,NULL) + RemoteElem () : Elem(0,0,NULL,_elemlinks_data,NULL) { this->set_id(remote_elem_id); } public: diff --git a/include/libmesh/Makefile.am b/include/libmesh/Makefile.am index d0add416e6b..90f7925f21c 100644 --- a/include/libmesh/Makefile.am +++ b/include/libmesh/Makefile.am @@ -1,4 +1,4 @@ -# Note - this file is automatically generated by ./rebuild_makefile.sh +# Note - this file is automatically generated by ./rebuild_makefile.sh # do not edit manually # @@ -1208,4 +1208,3 @@ xdr_cxx.h: $(top_srcdir)/include/utils/xdr_cxx.h parallel_communicator_specializations: $(top_srcdir)/include/parallel/parallel_communicator_specializations $(AM_V_GEN)rm -f $@ && $(LN_S) $< $@ - diff --git a/include/mesh/mesh_base.h b/include/mesh/mesh_base.h index d212ed1276b..4641127f50e 100644 --- a/include/mesh/mesh_base.h +++ b/include/mesh/mesh_base.h @@ -524,7 +524,7 @@ class MeshBase * mapping is independent from the parallel decomposition. */ void subdomain_ids (std::set &ids) const; - + /** * Returns the number of subdomains in the global mesh. Subdomains correspond * to separate subsets of the mesh which could correspond e.g. to different diff --git a/include/mesh/mesh_function.h b/include/mesh/mesh_function.h index b62d008b0dc..3623953d4d4 100644 --- a/include/mesh/mesh_function.h +++ b/include/mesh/mesh_function.h @@ -258,4 +258,3 @@ class MeshFunction : public FunctionBase #endif // LIBMESH_MESH_FUNCTION_H - diff --git a/include/mesh/mesh_inserter_iterator.h b/include/mesh/mesh_inserter_iterator.h index 91167eba860..acfe2dd1575 100644 --- a/include/mesh/mesh_inserter_iterator.h +++ b/include/mesh/mesh_inserter_iterator.h @@ -49,12 +49,12 @@ struct mesh_inserter_iterator void operator=(Point* p) { mesh.add_point(*p); } - mesh_inserter_iterator& operator++() { - return *this; + mesh_inserter_iterator& operator++() { + return *this; } - mesh_inserter_iterator operator++(int) { - return mesh_inserter_iterator(*this); + mesh_inserter_iterator operator++(int) { + return mesh_inserter_iterator(*this); } // We don't return a reference-to-T here because we don't want to diff --git a/include/mesh/mesh_output.h b/include/mesh/mesh_output.h index 6121cc35cbf..ec934effb72 100644 --- a/include/mesh/mesh_output.h +++ b/include/mesh/mesh_output.h @@ -181,7 +181,7 @@ MeshOutput::MeshOutput (const MT& obj, const bool is_parallel_format) : if (libMesh::processor_id() == 0) { libmesh_do_once(libMesh::out << - "Warning: This MeshOutput subclass only supports meshes which have been serialized!" + "Warning: This MeshOutput subclass only supports meshes which have been serialized!" << std::endl;); } // libmesh_error(); @@ -220,7 +220,7 @@ void MeshOutput::write_equation_systems (const std::string& fname, libmesh_assert(!my_mesh.allow_renumbering()); libmesh_do_once(libMesh::out << - "Warning: This MeshOutput subclass only supports meshes which are contiguously renumbered!" + "Warning: This MeshOutput subclass only supports meshes which are contiguously renumbered!" << std::endl;); my_mesh.allow_renumbering(true); diff --git a/include/mesh/mesh_refinement.h b/include/mesh/mesh_refinement.h index 13091bdd4ec..2a801b96d97 100644 --- a/include/mesh/mesh_refinement.h +++ b/include/mesh/mesh_refinement.h @@ -82,7 +82,7 @@ class MeshRefinement * element flagging. This can be used instead of or to * augment traditional error indicator based refinement. * This simply provides a base class that can be derived - * from and then passed to the + * from and then passed to the * \p flag_elements_by () method. */ class ElementFlagging @@ -201,8 +201,8 @@ class MeshRefinement * Flag elements based on a function object. The class \p ElementFlagging * defines a mechanism for implementing refinement strategies. */ - void flag_elements_by (ElementFlagging &element_flagging); - + void flag_elements_by (ElementFlagging &element_flagging); + /** * Takes a mesh whose elements are flagged for h refinement and coarsening, * and switches those flags to request p refinement and coarsening instead. diff --git a/include/mesh/mesh_triangle_wrapper.h b/include/mesh/mesh_triangle_wrapper.h index 1062fc58ad5..96985f07d11 100644 --- a/include/mesh/mesh_triangle_wrapper.h +++ b/include/mesh/mesh_triangle_wrapper.h @@ -92,4 +92,3 @@ namespace libMesh #endif // LIBMESH_HAVE_TRIANGLE #endif // LIBMESH_MESH_TRIANGLE_WRAPPER_H - diff --git a/include/mesh/tecplot_io.h b/include/mesh/tecplot_io.h index dc40e2cd3ba..c48ed31026f 100644 --- a/include/mesh/tecplot_io.h +++ b/include/mesh/tecplot_io.h @@ -83,7 +83,7 @@ class TecplotIO : public MeshOutput * Written to newer binary formats that are time-aware. */ double & time (); - + /** * Strand offset for this file. Each mesh block will * be written to (strand_id=block_id+1+strand_offset). @@ -96,7 +96,7 @@ class TecplotIO : public MeshOutput * The zone title to write. */ std::string & zone_title (); - + private: /** diff --git a/include/mesh/ucd_io.h b/include/mesh/ucd_io.h index a0a6f396852..67a25c18070 100644 --- a/include/mesh/ucd_io.h +++ b/include/mesh/ucd_io.h @@ -79,10 +79,10 @@ class UCDIO : public MeshInput, * This method implements writing a mesh and solution to a specified file * in UCD format. This is internally called by MeshOutput::write_equation_systems */ - virtual void write_nodal_data(const std::string& fname, - const std::vector&soln, + virtual void write_nodal_data(const std::string& fname, + const std::vector&soln, const std::vector& names); - + private: diff --git a/include/mesh/xdr_head.h b/include/mesh/xdr_head.h index b99f3263500..07b5ae07427 100644 --- a/include/mesh/xdr_head.h +++ b/include/mesh/xdr_head.h @@ -206,4 +206,3 @@ class XdrHEAD #endif // LIBMESH_XDR_HEAD_H - diff --git a/include/numerics/analytic_function.h b/include/numerics/analytic_function.h index de3ee08fefe..f413ee49b68 100644 --- a/include/numerics/analytic_function.h +++ b/include/numerics/analytic_function.h @@ -224,4 +224,3 @@ AnalyticFunction::clone () const #endif // LIBMESH_ANALYTIC_FUNCTION_H - diff --git a/include/numerics/const_function.h b/include/numerics/const_function.h index 1d7047bfcab..6e0ec39490a 100644 --- a/include/numerics/const_function.h +++ b/include/numerics/const_function.h @@ -50,7 +50,7 @@ class ConstFunction : public FunctionBase } virtual AutoPtr > clone() const { - return AutoPtr > + return AutoPtr > (new ConstFunction(_c)); } diff --git a/include/numerics/dense_matrix.h b/include/numerics/dense_matrix.h index 5399ef1e156..da4bda7656c 100644 --- a/include/numerics/dense_matrix.h +++ b/include/numerics/dense_matrix.h @@ -68,7 +68,7 @@ class DenseMatrix : public DenseMatrixBase */ virtual ~DenseMatrix() {} - + /** * Set every element in the matrix to 0. */ @@ -152,7 +152,7 @@ class DenseMatrix : public DenseMatrixBase */ template DenseMatrix& operator = (const DenseMatrix& other_matrix); - + /** * STL-like swap method */ @@ -170,7 +170,7 @@ class DenseMatrix : public DenseMatrixBase */ void scale (const T factor); - + /** * Multiplies every element in the column \p col matrix by \p factor. */ @@ -617,7 +617,7 @@ DenseMatrix::operator=(const DenseMatrix& mat) return *this; } - + template inline @@ -708,7 +708,7 @@ void DenseMatrix::scale (const T factor) _val[i] *= factor; } - + template inline void DenseMatrix::scale_column (const unsigned int col, const T factor) @@ -739,7 +739,7 @@ DenseMatrix::add (const T2 factor, { libmesh_assert_equal_to (this->m(), mat.m()); libmesh_assert_equal_to (this->n(), mat.n()); - + for (unsigned int i=0; im(); i++) for (unsigned int j=0; jn(); j++) (*this)(i,j) += factor * mat(i,j); @@ -943,4 +943,3 @@ T DenseMatrix::transpose (const unsigned int i, #endif // LIBMESH_DENSE_MATRIX_H - diff --git a/include/numerics/dense_matrix_base.h b/include/numerics/dense_matrix_base.h index 67b9ff1f8a9..42dd719fe68 100644 --- a/include/numerics/dense_matrix_base.h +++ b/include/numerics/dense_matrix_base.h @@ -196,4 +196,3 @@ DenseMatrixBase::add (const T2 factor, } // namespace libMesh #endif // LIBMESH_DENSE_MATRIX_BASE_H - diff --git a/include/numerics/dense_submatrix.h b/include/numerics/dense_submatrix.h index 1d365db1714..8692e3271f0 100644 --- a/include/numerics/dense_submatrix.h +++ b/include/numerics/dense_submatrix.h @@ -260,4 +260,3 @@ T & DenseSubMatrix::operator () (const unsigned int i, #endif // LIBMESH_DENSE_SUBMATRIX_H - diff --git a/include/numerics/dense_subvector.h b/include/numerics/dense_subvector.h index 0e0075a7329..f5b3019688a 100644 --- a/include/numerics/dense_subvector.h +++ b/include/numerics/dense_subvector.h @@ -304,4 +304,3 @@ Real DenseSubVector::linfty_norm () const #endif // LIBMESH_DENSE_SUBVECTOR_H - diff --git a/include/numerics/dense_vector.h b/include/numerics/dense_vector.h index 76fb309244c..20018e7d8ca 100644 --- a/include/numerics/dense_vector.h +++ b/include/numerics/dense_vector.h @@ -579,4 +579,3 @@ void DenseVector::get_principal_subvector (unsigned int sub_n, } // namespace libMesh #endif // LIBMESH_DENSE_VECTOR_H - diff --git a/include/numerics/dense_vector_base.h b/include/numerics/dense_vector_base.h index 1ee097f6229..c784c7e4645 100644 --- a/include/numerics/dense_vector_base.h +++ b/include/numerics/dense_vector_base.h @@ -115,4 +115,3 @@ class DenseVectorBase #endif // LIBMESH_DENSE_VECTOR_BASE_H - diff --git a/include/numerics/eigen_sparse_matrix.h b/include/numerics/eigen_sparse_matrix.h index 42cb8de6ebe..607daac513b 100644 --- a/include/numerics/eigen_sparse_matrix.h +++ b/include/numerics/eigen_sparse_matrix.h @@ -87,7 +87,7 @@ class EigenSparseMatrix : public SparseMatrix */ typedef EigenSM DataType; typedef Eigen::Triplet TripletType; - + /** * Initialize a Eigen matrix that is of global * dimension \f$ m \times n \f$ with local dimensions @@ -265,7 +265,7 @@ class EigenSparseMatrix : public SparseMatrix * Actual Eigen::SparseMatrix<> we are wrapping. */ DataType _mat; - + /** * Flag indicating if the matrix has been closed yet. */ diff --git a/include/numerics/eigen_sparse_vector.h b/include/numerics/eigen_sparse_vector.h index 28a0717d0ee..ade6413f12d 100644 --- a/include/numerics/eigen_sparse_vector.h +++ b/include/numerics/eigen_sparse_vector.h @@ -77,7 +77,7 @@ class EigenSparseVector : public NumericVector EigenSparseVector (const numeric_index_type n, const numeric_index_type n_local, const ParallelType = AUTOMATIC); - + /** * Constructor. Set local dimension to \p n_local, the global * dimension to \p n, but additionally reserve memory for the @@ -98,7 +98,7 @@ class EigenSparseVector : public NumericVector * Convenient typedefs */ typedef EigenSV DataType; - + /** * Call the assemble functions */ @@ -453,14 +453,14 @@ class EigenSparseVector : public NumericVector */ DataType & vec () { return _vec; } const DataType & vec () const { return _vec; } - + private: /** * Actual Eigen::SparseVector<> we are wrapping. */ DataType _vec; - + /** * Make other Eigen datatypes friends */ @@ -539,9 +539,9 @@ void EigenSparseVector::init (const numeric_index_type n, // Clear initialized vectors if (this->initialized()) this->clear(); - + _vec.resize(n); - + this->_is_initialized = true; #ifndef NDEBUG this->_is_closed = true; @@ -609,7 +609,7 @@ inline void EigenSparseVector::clear () { _vec.resize(0); - + this->_is_initialized = false; #ifndef NDEBUG this->_is_closed = false; @@ -662,7 +662,7 @@ inline numeric_index_type EigenSparseVector::size () const { libmesh_assert (this->initialized()); - + return static_cast(_vec.size()); } @@ -709,7 +709,7 @@ void EigenSparseVector::set (const numeric_index_type i, const T value) libmesh_assert_less (i, this->size()); _vec[static_cast(i)] = value; - + #ifndef NDEBUG this->_is_closed = false; #endif @@ -723,7 +723,7 @@ void EigenSparseVector::add (const numeric_index_type i, const T value) { libmesh_assert (this->initialized()); libmesh_assert_less (i, this->size()); - + _vec[static_cast(i)] += value; #ifndef NDEBUG @@ -753,7 +753,7 @@ void EigenSparseVector::swap (NumericVector &other) EigenSparseVector& v = libmesh_cast_ref&>(other); _vec.swap(v._vec); - + std::swap (this->_is_closed, v._is_closed); std::swap (this->_is_initialized, v._is_initialized); std::swap (this->_type, v._type); diff --git a/include/numerics/fem_function_base.h b/include/numerics/fem_function_base.h index ab3ffcc1984..cea5176e5b7 100644 --- a/include/numerics/fem_function_base.h +++ b/include/numerics/fem_function_base.h @@ -61,7 +61,7 @@ class FEMFunctionBase /** * Prepares a context object for use. - * + * * Most problems will want to reimplement this for efficiency, in * order to call FE::get_*() as their particular function requires. */ diff --git a/include/numerics/petsc_vector.h b/include/numerics/petsc_vector.h index b9c6c8c85f6..1f31e20e670 100644 --- a/include/numerics/petsc_vector.h +++ b/include/numerics/petsc_vector.h @@ -1333,11 +1333,3 @@ void PetscVector::_restore_array(void) const #endif // #ifdef LIBMESH_HAVE_PETSC #endif // LIBMESH_PETSC_VECTOR_H - - - - - - - - diff --git a/include/numerics/raw_accessor.h b/include/numerics/raw_accessor.h index c43d83042cb..068c89d7224 100644 --- a/include/numerics/raw_accessor.h +++ b/include/numerics/raw_accessor.h @@ -93,7 +93,7 @@ namespace libMesh class RawAccessor { public: - + RawAccessor( FieldType& data, const unsigned int dim ) : _data(data), _dim(dim) diff --git a/include/numerics/refinement_selector.h b/include/numerics/refinement_selector.h index a6585e90984..3f9db9a4554 100644 --- a/include/numerics/refinement_selector.h +++ b/include/numerics/refinement_selector.h @@ -80,4 +80,3 @@ class RefinementSelector #endif // LIBMESH_REFINEMENT_SELECTOR_H - diff --git a/include/numerics/tensor_tools.h b/include/numerics/tensor_tools.h index 4565a76f87e..8eb12e08e91 100644 --- a/include/numerics/tensor_tools.h +++ b/include/numerics/tensor_tools.h @@ -53,7 +53,7 @@ namespace libMesh typename CompareTypes::supertype inner_product(const TypeVector& a, const TypeVector& b) { return a * b; } - + template inline typename CompareTypes::supertype @@ -66,12 +66,12 @@ namespace libMesh inner_product(const TypeNTensor& a, const TypeNTensor& b) { return a.contract(b); } - template - inline + template + inline T norm_sq(T a) { return a*a; } template - inline + inline T norm_sq(std::complex a) { return std::norm(a); } template @@ -95,27 +95,27 @@ namespace libMesh { typedef VectorValue type; }; - + template struct IncrementRank > { typedef TensorValue type; }; - - + + template struct IncrementRank > { typedef TensorValue type; }; - + template struct IncrementRank > { typedef TypeNTensor<3,T> type; }; - - + + template struct IncrementRank > { @@ -128,7 +128,7 @@ namespace libMesh typedef TypeNTensor type; }; - + // Also need rank-decreasing case template struct DecrementRank @@ -138,25 +138,25 @@ namespace libMesh // operations... typedef T type; }; - + template struct DecrementRank > { typedef T type; }; - + template struct DecrementRank > { typedef T type; }; - + template struct DecrementRank > { typedef VectorValue type; }; - + template struct DecrementRank > { @@ -179,7 +179,7 @@ namespace libMesh typedef T type; #endif }; - + template struct MakeNumber > { @@ -187,8 +187,8 @@ namespace libMesh // numbers //typedef std::complex type; }; - - + + template struct MakeNumber > { @@ -230,13 +230,13 @@ namespace libMesh { typedef T type; }; - + template struct MakeReal > { typedef T type; }; - + template struct MakeReal > { @@ -269,20 +269,20 @@ namespace libMesh // Needed for ExactSolution to compile Number curl_from_grad( const VectorValue& ); - + //! Computes the curl of a vector given the gradient of that vector VectorValue curl_from_grad( const TensorValue& grad ); - + /*! Place holder needed for ExactSolution to compile. Will compute the curl of a tensor given the gradient of that tensor. */ TensorValue curl_from_grad( const TypeNTensor<3,Number>& grad ); - + //! Dummy. Divgerence of a scalar not defined, but is needed for ExactSolution to compile Number div_from_grad( const VectorValue& grad ); - + //! Computes the divergence of a vector given the gradient of that vector Number div_from_grad( const TensorValue& grad ); - + /*! Place holder needed for ExactSolution to compile. Will compute the divergence of a tensor given the gradient of that tensor. */ VectorValue div_from_grad( const TypeNTensor<3,Number>& grad ); diff --git a/include/numerics/trilinos_epetra_vector.h b/include/numerics/trilinos_epetra_vector.h index 3045278ee00..3887392c19e 100644 --- a/include/numerics/trilinos_epetra_vector.h +++ b/include/numerics/trilinos_epetra_vector.h @@ -1030,11 +1030,3 @@ void EpetraVector::swap (NumericVector &other) #endif // #ifdef HAVE_EPETRA #endif // LIBMESH_TRILINOS_EPETRA_VECTOR_H - - - - - - - - diff --git a/include/numerics/type_tensor.h b/include/numerics/type_tensor.h index 795b8e8bd4d..9913b74330b 100644 --- a/include/numerics/type_tensor.h +++ b/include/numerics/type_tensor.h @@ -377,7 +377,7 @@ class TypeTensorColumn * Assign values to this column of the tensor. */ TypeTensorColumn& operator = (const TypeVector& rhs) - { + { for (unsigned int i=0; i != LIBMESH_DIM; ++i) (*this)(i) = rhs(i); return *this; @@ -622,7 +622,7 @@ T & TypeTensor::operator () (const unsigned int i, template inline -ConstTypeTensorColumn +ConstTypeTensorColumn TypeTensor::slice (const unsigned int i) const { libmesh_assert_less (i, LIBMESH_DIM); @@ -632,7 +632,7 @@ TypeTensor::slice (const unsigned int i) const template inline -TypeTensorColumn +TypeTensorColumn TypeTensor::slice (const unsigned int i) { libmesh_assert_less (i, LIBMESH_DIM); diff --git a/include/numerics/type_vector.h b/include/numerics/type_vector.h index d852cdbc85d..8dc71d83d8f 100644 --- a/include/numerics/type_vector.h +++ b/include/numerics/type_vector.h @@ -362,11 +362,11 @@ TypeVector::TypeVector () #if LIBMESH_DIM > 1 _coords[1] = 0; -#endif +#endif #if LIBMESH_DIM > 2 _coords[2] = 0; -#endif +#endif } diff --git a/include/numerics/zero_function.h b/include/numerics/zero_function.h index 4aa4bd6a137..0d05032c732 100644 --- a/include/numerics/zero_function.h +++ b/include/numerics/zero_function.h @@ -32,7 +32,7 @@ class ZeroFunction : public ConstFunction ZeroFunction () : ConstFunction(0) {} virtual AutoPtr > clone() const { - return AutoPtr > + return AutoPtr > (new ZeroFunction()); } }; diff --git a/include/parallel/parallel.h b/include/parallel/parallel.h index ad8b5136ff4..24690084b12 100644 --- a/include/parallel/parallel.h +++ b/include/parallel/parallel.h @@ -650,7 +650,7 @@ namespace Parallel template void maxloc(T &r, unsigned int &max_id) const; - + /** * Take a vector of local variables and replace each entry with the maximum * of it's values on all processors. Set each \p min_id entry to @@ -808,7 +808,7 @@ namespace Parallel * objects whose contents match the objects pointed to by the * sender. * - * The objects will be of type + * The objects will be of type * T = iterator_traits::value_type. * * Using std::back_inserter as the output iterator allows receive to @@ -840,7 +840,7 @@ namespace Parallel * objects whose contents match the objects pointed to by the * sender. * - * The objects will be of type + * The objects will be of type * T = iterator_traits::value_type. * * Using std::back_inserter as the output iterator allows receive to @@ -886,12 +886,12 @@ namespace Parallel * new objects at each receiver whose contents match the objects * pointed to by the sender. * - * The objects being sent will be of type + * The objects being sent will be of type * T1 = iterator_traits::value_type, and the objects * being received will be of type * T2 = iterator_traits::value_type * - * void Parallel::pack(const T1*, vector& data, const Context1*) + * void Parallel::pack(const T1*, vector& data, const Context1*) * is used to serialize type T1 onto the end of a data vector. * * Using std::back_inserter as the output iterator allows @@ -1085,7 +1085,7 @@ namespace Parallel // output containers template struct PostWaitCopyBuffer : public PostWaitWork { - PostWaitCopyBuffer(const Container& buffer, const OutputIter out) + PostWaitCopyBuffer(const Container& buffer, const OutputIter out) : _buf(buffer), _out(out) {} virtual void run() { std::copy(_buf.begin(), _buf.end(), _out); } diff --git a/include/parallel/parallel_algebra.h b/include/parallel/parallel_algebra.h index 71d10adf0ba..88d66475f6e 100644 --- a/include/parallel/parallel_algebra.h +++ b/include/parallel/parallel_algebra.h @@ -262,4 +262,3 @@ namespace Parallel { } // namespace libMesh #endif // LIBMESH_PARALLEL_ALGEBRA_H - diff --git a/include/parallel/parallel_bin_sorter.h b/include/parallel/parallel_bin_sorter.h index 7ece63f6e3e..99157190845 100644 --- a/include/parallel/parallel_bin_sorter.h +++ b/include/parallel/parallel_bin_sorter.h @@ -88,4 +88,3 @@ IdxType BinSorter::sizeof_bin (const IdxType bin) const } // namespace libMesh #endif // LIBMESH_PARALLEL_BIN_SORTER_H - diff --git a/include/parallel/parallel_hilbert.h b/include/parallel/parallel_hilbert.h index c4527a83aba..90efd240c1d 100644 --- a/include/parallel/parallel_hilbert.h +++ b/include/parallel/parallel_hilbert.h @@ -64,4 +64,3 @@ namespace Parallel { #endif // LIBMESH_HAVE_LIBHILBERT && LIBMESH_HAVE_MPI #endif // LIBMESH_PARALLEL_HILBERT_H - diff --git a/include/parallel/parallel_histogram.h b/include/parallel/parallel_histogram.h index 3ee0bbfe174..8bb7d57cc21 100644 --- a/include/parallel/parallel_histogram.h +++ b/include/parallel/parallel_histogram.h @@ -168,4 +168,3 @@ double Histogram::upper_bound (const IdxType bin) const } // namespace libMesh #endif // LIBMESH_PARALLEL_HISTOGRAM_H - diff --git a/include/parallel/parallel_implementation.h b/include/parallel/parallel_implementation.h index a64d9f08256..92c354169fd 100644 --- a/include/parallel/parallel_implementation.h +++ b/include/parallel/parallel_implementation.h @@ -379,9 +379,9 @@ inline void pack_range (const Context *context, Parallel::pack(*range_begin, buffer, context); #ifndef NDEBUG - unsigned int my_packable_size = + unsigned int my_packable_size = Parallel::packable_size(*range_begin, context); - unsigned int my_packed_size = + unsigned int my_packed_size = Parallel::packed_size (*range_begin, buffer.begin() + old_size); libmesh_assert_equal_to (my_packable_size, my_packed_size); @@ -2247,7 +2247,7 @@ inline Status Communicator::receive (const unsigned int src_processor_id, std::set &buf, const MessageTag &tag) const { - return this->receive + return this->receive (src_processor_id, buf, StandardType(buf.empty() ? NULL : &buf.front()), tag); } @@ -3061,7 +3061,7 @@ inline bool Communicator::verify(const T &) const { return true; } template inline bool Communicator::semiverify(const T *) const { return true; } - + template inline void Communicator::min(T &) const {} @@ -3124,7 +3124,7 @@ inline void Communicator::send (const unsigned int, T&, const DataType&, Request { libmesh_error(); } template -inline void Communicator::send_packed_range +inline void Communicator::send_packed_range (const unsigned int, const Context*, Iter, const Iter, const MessageTag&) const { libmesh_error(); } diff --git a/include/parallel/threads.h b/include/parallel/threads.h index 7cabbef2c68..f9ad06d7584 100644 --- a/include/parallel/threads.h +++ b/include/parallel/threads.h @@ -91,7 +91,7 @@ namespace Threads * Fall back to tbb::tbb_thread when available. */ typedef tbb::tbb_thread Thread; - + #else //-------------------------------------------------------------------- /** @@ -119,7 +119,7 @@ namespace Threads */ bool joinable() const { return true; } }; - + #endif diff --git a/include/physics/diff_physics.h b/include/physics/diff_physics.h index c866f7f5d8b..2ad0e1e8e75 100644 --- a/include/physics/diff_physics.h +++ b/include/physics/diff_physics.h @@ -1,17 +1,17 @@ // The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -61,7 +61,7 @@ class DifferentiablePhysics * Constructor. Optionally initializes required * data structures. */ - DifferentiablePhysics () : + DifferentiablePhysics () : compute_internal_sides (false), _mesh_sys (NULL), _mesh_x_var (libMesh::invalid_uint), @@ -80,12 +80,12 @@ class DifferentiablePhysics virtual AutoPtr clone_physics() = 0; /** - * Clear any data structures associated with the physics. + * Clear any data structures associated with the physics. */ virtual void clear_physics (); /** - * Initialize any data structures associated with the physics. + * Initialize any data structures associated with the physics. */ virtual void init_physics (const System& sys); @@ -239,7 +239,7 @@ class DifferentiablePhysics * elem_jacobian has not been computed then the method should * return false. * - * For most problems, the default implementation of "do nothing" + * For most problems, the default implementation of "do nothing" * is correct; users with boundary conditions including time * derivatives may need to reimplement this themselves. */ @@ -250,12 +250,12 @@ class DifferentiablePhysics /* * Prepares the result of a build_context() call for use. - * + * * Most FEMSystem-based problems will need to reimplement this in order to * call FE::get_*() as their particular physics requires. */ virtual void init_context(DiffContext &) {} - + /** * Tells the DifferentiablePhysics that system \p sys contains the * isoparametric Lagrangian variables which correspond to the diff --git a/include/physics/diff_qoi.h b/include/physics/diff_qoi.h index a9eff6168ec..f5d6b263aaf 100644 --- a/include/physics/diff_qoi.h +++ b/include/physics/diff_qoi.h @@ -1,17 +1,17 @@ // The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -70,7 +70,7 @@ class DifferentiableQoI /** * Clear all the data structures associated with - * the QoI. + * the QoI. */ virtual void clear_qoi () {} @@ -81,7 +81,7 @@ class DifferentiableQoI * also set assemble_qoi_internal_sides to true. */ bool assemble_qoi_sides; - + /** * If \p assemble_qoi_internal_sides is true (it is false by * default), the assembly loop for a quantity of interest or its @@ -89,7 +89,7 @@ class DifferentiableQoI * domain boundaries. */ bool assemble_qoi_internal_sides; - + /** * If \p assemble_qoi_elements is false (it is true by default), the * assembly loop for a quantity of interest or its derivatives will @@ -105,10 +105,10 @@ class DifferentiableQoI * Only qois included in the supplied \p QoISet need to be * assembled. */ - virtual void element_qoi (DiffContext&, + virtual void element_qoi (DiffContext&, const QoISet&) {} - + /** * Does any work that needs to be done on \p elem in a quantity of * interest derivative assembly loop, outputting to @@ -120,7 +120,7 @@ class DifferentiableQoI virtual void element_qoi_derivative (DiffContext&, const QoISet&) {} - + /** * Does any work that needs to be done on \p side of \p elem in a * quantity of interest assembly loop, outputting to elem_qoi. @@ -131,7 +131,7 @@ class DifferentiableQoI virtual void side_qoi (DiffContext&, const QoISet&) {} - + /** * Does any work that needs to be done on \p side of \p elem in a * quantity of interest derivative assembly loop, outputting to @@ -143,10 +143,10 @@ class DifferentiableQoI virtual void side_qoi_derivative (DiffContext&, const QoISet&) {} - + /** * Prepares the result of a build_context() call for use. - * + * * Most FEMSystem-based problems will need to reimplement this in order to * call FE::get_*() as their particular QoI requires. */ diff --git a/include/physics/fem_physics.h b/include/physics/fem_physics.h index 4b4eccdd06f..8e782b36f8d 100644 --- a/include/physics/fem_physics.h +++ b/include/physics/fem_physics.h @@ -1,17 +1,17 @@ // The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/include/quadrature/quadrature_conical.h b/include/quadrature/quadrature_conical.h index e9eaabbf71f..e3bd7fc3d38 100644 --- a/include/quadrature/quadrature_conical.h +++ b/include/quadrature/quadrature_conical.h @@ -103,4 +103,3 @@ class QConical : public QBase } // namespace libMesh #endif // LIBMESH_QUADRATURE_CONICAL_H - diff --git a/include/quadrature/quadrature_rules.h b/include/quadrature/quadrature_rules.h index 72a902f9869..4bf0c1ddca8 100644 --- a/include/quadrature/quadrature_rules.h +++ b/include/quadrature/quadrature_rules.h @@ -71,7 +71,3 @@ namespace QuadratureRules } // namespace libMesh #endif // LIBMESH_QUADRATURE_RULES_H - - - - diff --git a/include/reduced_basis/rb_assembly_expansion.h b/include/reduced_basis/rb_assembly_expansion.h index fc731f831d4..9e5f16d5284 100644 --- a/include/reduced_basis/rb_assembly_expansion.h +++ b/include/reduced_basis/rb_assembly_expansion.h @@ -152,7 +152,7 @@ class RBAssemblyExpansion : public ReferenceCountedObject * do not need to use a vector in this case. */ virtual void attach_output_assembly(ElemAssembly* output_assembly); - + /** * Return a reference to the specified A_assembly object. */ @@ -162,7 +162,7 @@ class RBAssemblyExpansion : public ReferenceCountedObject * Return a reference to the specified F_assembly object. */ ElemAssembly& get_F_assembly(unsigned int q); - + /** * Return a reference to the specified output assembly object. */ diff --git a/include/reduced_basis/rb_construction.h b/include/reduced_basis/rb_construction.h index 1f0f51d80cc..a71ba7cbf6c 100644 --- a/include/reduced_basis/rb_construction.h +++ b/include/reduced_basis/rb_construction.h @@ -80,12 +80,12 @@ class RBConstruction : public RBConstructionBase * Set the RBEvaluation object. */ void set_rb_evaluation(RBEvaluation& rb_eval_in); - + /** * Get a reference to the RBEvaluation object. */ RBEvaluation& get_rb_evaluation(); - + /** * @return true if rb_eval is initialized. False, otherwise. */ @@ -457,7 +457,7 @@ class RBConstruction : public RBConstructionBase * a Reduced Basis. */ bool use_relative_bound_in_greedy; - + /** * Boolean flag to indicate whether we exit the greedy if * we select the same parameters twice in a row. In some diff --git a/include/reduced_basis/rb_construction_base.h b/include/reduced_basis/rb_construction_base.h index 2e598544011..f83dcf8502f 100644 --- a/include/reduced_basis/rb_construction_base.h +++ b/include/reduced_basis/rb_construction_base.h @@ -148,18 +148,18 @@ class RBConstructionBase : public Base, public RBParametrized * to all processors. */ void broadcast_parameters(unsigned int proc_id); - + /** * Set the seed that is used to randomly generate training parameters. */ void set_training_random_seed(unsigned int seed); - + /** * Set the name of the parameter that we will generate deterministic training parameters for. * Defaults to "NONE". */ void set_deterministic_training_parameter_name(const std::string name); - + /** * Get the name of the parameter that we will generate deterministic training parameters for. */ @@ -169,7 +169,7 @@ class RBConstructionBase : public Base, public RBParametrized * Set the number of times each sample of the deterministic training parameter is repeated. */ void set_deterministic_training_parameter_repeats(unsigned int repeats); - + /** * Get the number of times each sample of the deterministic training parameter is repeated. */ @@ -295,14 +295,14 @@ class RBConstructionBase : public Base, public RBParametrized * number generator seed. */ int training_parameters_random_seed; - + /** * The name of the parameter that we will generate a deterministic * training parameters for in the case of a "partially random" training * set. */ std::string _deterministic_training_parameter_name; - + /** * The number of times each sample of the deterministic training parameter * is repeated in generating the training set. diff --git a/include/reduced_basis/rb_eim_construction.h b/include/reduced_basis/rb_eim_construction.h index 7015ac91436..78e078a5020 100644 --- a/include/reduced_basis/rb_eim_construction.h +++ b/include/reduced_basis/rb_eim_construction.h @@ -144,12 +144,12 @@ class RBEIMConstruction : public RBConstruction * we want to use assembly functions based on this EIM approximation. */ virtual void initialize_eim_assembly_objects(); - + /** * @return the vector of assembly objects that point to this RBEIMConstruction. */ std::vector get_eim_assembly_objects(); - + /** * Build an element assembly object that will access basis function * \p bf_index. @@ -170,8 +170,8 @@ class RBEIMConstruction : public RBConstruction * norm induced by inner_product_matrix. */ BEST_FIT_TYPE best_fit_type_flag; - - + + /** * The matrix associated with this system should be block diagonal * hence we use a CouplingMatrix to "decouple" all variables to @@ -216,19 +216,19 @@ class RBEIMConstruction : public RBConstruction * basis training. Overload in subclasses to specialize. */ virtual bool greedy_termination_test(Real training_greedy_error, int count); - + /** * Loop over the training set and compute the parametrized function for each * training index. */ void initialize_parametrized_functions_in_training_set(); - + /** * Boolean flag to indicate whether or not we have called * compute_parametrized_functions_in_training_set() yet. */ bool _parametrized_functions_in_training_set_initialized; - + /** * The libMesh vectors storing the finite element coefficients * of the RB basis functions. @@ -261,7 +261,7 @@ class RBEIMConstruction : public RBConstruction * because this isn't used at all in the EIM. */ RBAssemblyExpansion _empty_rb_assembly_expansion; - + /** * The vector of assembly objects that are created to point to * this RBEIMConstruction. diff --git a/include/reduced_basis/rb_eim_evaluation.h b/include/reduced_basis/rb_eim_evaluation.h index 97e2c150737..fe388c390f7 100644 --- a/include/reduced_basis/rb_eim_evaluation.h +++ b/include/reduced_basis/rb_eim_evaluation.h @@ -29,7 +29,7 @@ namespace libMesh { - + class RBParameters; class RBParametrizedFunction; @@ -119,7 +119,7 @@ class RBEIMEvaluation : public RBEvaluation * Store these objects in the member vector rb_theta_objects. */ void initialize_eim_theta_objects(); - + /** * @return the vector of theta objects that point to this RBEIMEvaluation. */ @@ -206,13 +206,13 @@ class RBEIMEvaluation : public RBEvaluation * an unnecessary repeat solve). */ RBParameters _previous_parameters; - + /** * Store the number of basis functions used for the previous solve (so we can avoid * an unnecessary repeat solve). */ unsigned int _previous_N; - + /** * Store the previous error bound returned by rb_solve (so we can return it if we * are avoiding an unnecessary repeat solve). diff --git a/include/reduced_basis/rb_evaluation.h b/include/reduced_basis/rb_evaluation.h index 484212d9446..4b426031d28 100644 --- a/include/reduced_basis/rb_evaluation.h +++ b/include/reduced_basis/rb_evaluation.h @@ -68,17 +68,17 @@ class RBEvaluation : public RBParametrized * and clear and extra data in subclasses. */ virtual void clear(); - + /** * Set the RBThetaExpansion object. */ void set_rb_theta_expansion(RBThetaExpansion& rb_theta_expansion_in); - + /** * Get a reference to the rb_theta_expansion. */ RBThetaExpansion& get_rb_theta_expansion(); - + /** * @return true if the theta expansion has been initialized. */ diff --git a/include/reduced_basis/rb_parameters.h b/include/reduced_basis/rb_parameters.h index 2b5a7f9a729..d2dc11a73f7 100644 --- a/include/reduced_basis/rb_parameters.h +++ b/include/reduced_basis/rb_parameters.h @@ -30,7 +30,7 @@ namespace libMesh { - + /** * This class is part of the rbOOmit framework. * @@ -56,38 +56,38 @@ class RBParameters * Clear this object. */ void clear(); - + /** * Get the value of the specific parameter. */ Real get_value(const std::string& param_name) const; - + /** * Set the value of the specified parameter. If param_name * doesn't already exist, it is added to the RBParameters object. */ void set_value(const std::string& param_name, Real value); - + /** * Get the number of parameters that have been added. */ unsigned int n_parameters() const; - + /** * Fill \p param_names with the names of the parameters. */ void get_parameter_names(std::set& param_names) const; - + /** * Get a constant iterator to beginning of this RBParameters object. */ const_iterator begin() const; - + /** * Get a constant iterator to the end of this RBParameters object. */ const_iterator end() const; - + /** * Two RBParameters are equal if they have the same _parameters map. */ @@ -97,14 +97,14 @@ class RBParameters * @return !(*this == rhs). */ bool operator!= (const RBParameters& node) const; - + /** * Get a string that specifies the contents of this RBParameters object. * \p precision specifies the number of digits of precision we use * in scientific notation in the string. */ std::string get_string(unsigned int precision=6) const; - + /** * Print the parameters. */ diff --git a/include/reduced_basis/rb_parametrized.h b/include/reduced_basis/rb_parametrized.h index 0c4acf6cdac..c824088e400 100644 --- a/include/reduced_basis/rb_parametrized.h +++ b/include/reduced_basis/rb_parametrized.h @@ -31,7 +31,7 @@ namespace libMesh { - + /** * This class is part of the rbOOmit framework. * @@ -73,7 +73,7 @@ class RBParametrized : public ReferenceCountedObject * Initialize the parameter ranges and set current_parameters. */ void initialize_parameters(const RBParametrized& rb_parametrized); - + /** * Initialize the parameter ranges and set current_parameters by * reading in data from the file \p input_filename @@ -121,13 +121,13 @@ class RBParametrized : public ReferenceCountedObject * Print the current parameters. */ void print_parameters() const; - + /** * Write out the parameter ranges to file. */ void write_parameter_ranges_to_file(const std::string& file_name, const bool write_binary); - + /** * Read in the parameter ranges from file. Initialize parameters * to the "minimum" parameter values. diff --git a/include/reduced_basis/rb_parametrized_function.h b/include/reduced_basis/rb_parametrized_function.h index 2b3677a10e8..7a4f798c6d3 100644 --- a/include/reduced_basis/rb_parametrized_function.h +++ b/include/reduced_basis/rb_parametrized_function.h @@ -30,7 +30,7 @@ namespace libMesh class RBParameters; class Point; - + /** * A simple functor class that provides a RBParameter-dependent function. */ diff --git a/include/reduced_basis/rb_scm_construction.h b/include/reduced_basis/rb_scm_construction.h index 90cf5ff53a3..424a03179db 100644 --- a/include/reduced_basis/rb_scm_construction.h +++ b/include/reduced_basis/rb_scm_construction.h @@ -83,12 +83,12 @@ class RBSCMConstruction : public RBConstructionBase * the system. */ virtual void clear (); - + /** * Set the RBSCMEvaluation object. */ void set_rb_scm_evaluation(RBSCMEvaluation& rb_scm_eval_in); - + /** * Get a reference to the RBSCMEvaluation object. */ diff --git a/include/reduced_basis/rb_scm_evaluation.h b/include/reduced_basis/rb_scm_evaluation.h index 4ec67362cf0..cf62870042f 100644 --- a/include/reduced_basis/rb_scm_evaluation.h +++ b/include/reduced_basis/rb_scm_evaluation.h @@ -63,7 +63,7 @@ class RBSCMEvaluation : public RBParametrized * Set the RBThetaExpansion object. */ void set_rb_theta_expansion(RBThetaExpansion& rb_theta_expansion_in); - + /** * Get a reference to the rb_theta_expansion. */ diff --git a/include/reduced_basis/rb_temporal_discretization.h b/include/reduced_basis/rb_temporal_discretization.h index ae02d196eca..e5710f49331 100644 --- a/include/reduced_basis/rb_temporal_discretization.h +++ b/include/reduced_basis/rb_temporal_discretization.h @@ -69,7 +69,7 @@ class RBTemporalDiscretization * Read in and initialize parameters from \p parameters_filename. */ void process_temporal_parameters_file (const std::string& parameters_filename); - + /** * Pull the temporal discretization data from \p other. */ diff --git a/include/solution_transfer/direct_solution_transfer.h b/include/solution_transfer/direct_solution_transfer.h index d4d00634caa..39351a091d0 100644 --- a/include/solution_transfer/direct_solution_transfer.h +++ b/include/solution_transfer/direct_solution_transfer.h @@ -37,7 +37,7 @@ class DirectSolutionTransfer : public SolutionTransfer public: DirectSolutionTransfer(); virtual ~DirectSolutionTransfer(); - + /** * Transfer the values of a variable to another. */ diff --git a/include/solution_transfer/dtk_adapter.h b/include/solution_transfer/dtk_adapter.h index cbdc24d23bf..251d016a511 100644 --- a/include/solution_transfer/dtk_adapter.h +++ b/include/solution_transfer/dtk_adapter.h @@ -80,7 +80,7 @@ class DTKAdapter * nodes connected to local elements. */ void get_semi_local_nodes(std::set & semi_local_nodes); - + Teuchos::RCP > comm; EquationSystems & es; const MeshBase & mesh; @@ -88,7 +88,7 @@ class DTKAdapter unsigned int num_local_nodes; Teuchos::ArrayRCP vertices; - + Teuchos::RCP > mesh_manager; RCP_Evaluator field_evaluator; Teuchos::RCP > target_coords; diff --git a/include/solution_transfer/dtk_solution_transfer.h b/include/solution_transfer/dtk_solution_transfer.h index 0c7c3e324f3..d644c80a871 100644 --- a/include/solution_transfer/dtk_solution_transfer.h +++ b/include/solution_transfer/dtk_solution_transfer.h @@ -46,10 +46,10 @@ class DTKSolutionTransfer : public SolutionTransfer public: DTKSolutionTransfer(); virtual ~DTKSolutionTransfer(); - + /** * Transfer the values of a variable to another. - * + * * This is meant for transferring values from one EquationSystems to another * even in the case of having different meshes. * @@ -64,7 +64,7 @@ class DTKSolutionTransfer : public SolutionTransfer /// COMM_WORLD for now Teuchos::RCP > comm_default; - + /// The DTKAdapter associated with each EquationSystems std::map adapters; diff --git a/include/solution_transfer/meshfree_interpolation.h b/include/solution_transfer/meshfree_interpolation.h index 12bb50394a2..1db98a5f868 100644 --- a/include/solution_transfer/meshfree_interpolation.h +++ b/include/solution_transfer/meshfree_interpolation.h @@ -40,11 +40,11 @@ namespace libMesh /** * Base class to support various mesh-free interpolation methods. - * Such methods can be useful for example to pass data between + * Such methods can be useful for example to pass data between * two different domains which share a physical boundary, where * that boundary may be discretized differently in each domain. * This is the case for conjugate heat transfer applications where - * the common interface has overlapping but distinct boundary + * the common interface has overlapping but distinct boundary * discretizations. */ class MeshfreeInterpolation @@ -56,15 +56,15 @@ class MeshfreeInterpolation * * SYNC_SOURCES assumes that the data added on each processor are * independent and relatively small. Calling the \p prepare_for_use() - * method with this \p ParallelizationStrategy will copy remote data - * from other processors, so all interpolation can be performed + * method with this \p ParallelizationStrategy will copy remote data + * from other processors, so all interpolation can be performed * locally. * * Other \p ParallelizationStrategy techniques will be implemented * as needed. */ enum ParallelizationStrategy { SYNC_SOURCES = 0, - INVALID_STRATEGY}; + INVALID_STRATEGY}; /** * Constructor. */ @@ -81,7 +81,7 @@ class MeshfreeInterpolation /** * Same as above, but allows you to also use stream syntax. */ - friend std::ostream& operator << (std::ostream& os, + friend std::ostream& operator << (std::ostream& os, const MeshfreeInterpolation& mfi); /** @@ -93,9 +93,9 @@ class MeshfreeInterpolation /** * The number of field variables. */ - unsigned int n_field_variables () const + unsigned int n_field_variables () const { return libmesh_cast_int(_names.size()); } - + /** * Defines the field variable(s) we are responsible for, * and importantly their assumed ordering. @@ -108,13 +108,13 @@ class MeshfreeInterpolation */ const std::vector & field_variables() const { return _names; } - + /** * @returns a writeable reference to the point list. */ std::vector & get_source_points () { return _src_pts; } - + /** * @returns a writeable reference to the point list. */ @@ -123,13 +123,13 @@ class MeshfreeInterpolation /** * Sets source data at specified points. - */ + */ virtual void add_field_data (const std::vector &field_names, const std::vector &pts, const std::vector &vals); /** - * Prepares data structures for use. + * Prepares data structures for use. * * This method is virtual so that it can be overwritten or extended as required * in derived classes. @@ -155,7 +155,7 @@ class MeshfreeInterpolation * in derived classes. */ virtual void gather_remote_data (); - + ParallelizationStrategy _parallelization_strategy; std::vector _names; std::vector _src_pts; @@ -172,16 +172,16 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation { protected: -#ifdef LIBMESH_HAVE_NANOFLANN +#ifdef LIBMESH_HAVE_NANOFLANN /** * This class adapts list of libMesh \p Point types - * for use in a nanoflann KD-Tree. For more on the + * for use in a nanoflann KD-Tree. For more on the * basic idea see examples/pointcloud_adaptor_example.cpp * in the nanoflann source tree. */ template class PointListAdaptor - { + { private: const std::vector &_pts; @@ -199,9 +199,9 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation * Must return the number of data points */ inline size_t kdtree_get_point_count() const { return _pts.size(); } - + /** - * Returns the distance between the vector "p1[0:size-1]" + * Returns the distance between the vector "p1[0:size-1]" * and the data point with index "idx_p2" stored in the class */ inline coord_t kdtree_distance(const coord_t *p1, const size_t idx_p2, size_t size) const @@ -221,7 +221,7 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation return d0*d0 + d1*d1 + d2*d2; } - + case 2: { const coord_t d0=p1[0] - p2(0); @@ -229,14 +229,14 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation return d0*d0 + d1*d1; } - + case 1: { const coord_t d0=p1[0] - p2(0); return d0*d0; } - + default: libMesh::err << "ERROR: unknown size " << size << std::endl; libmesh_error(); @@ -244,7 +244,7 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation return -1.; } - + /** * Returns the dim'th component of the idx'th point in the class: * Since this is inlined and the "dim" argument is typically an immediate value, the @@ -262,11 +262,11 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation if (dim==1) return p(1); return p(2); } - + /** * Optional bounding-box computation: return false to default to a standard bbox computation loop. - * Return true if the BBOX was already computed by the class and returned in "bb" so it can be - * avoided to redo it again. Look at bb.size() to find out the expected dimensionality + * Return true if the BBOX was already computed by the class and returned in "bb" so it can be + * avoided to redo it again. Look at bb.size() to find out the expected dimensionality * (e.g. 2 or 3 for point clouds) */ template @@ -302,20 +302,20 @@ class InverseDistanceInterpolation : public MeshfreeInterpolation const std::vector &src_indices, const std::vector &src_dist_sqr, std::vector::iterator &out_it) const; - + const Real _half_power; const unsigned int _n_interp_pts; /** * Temporary work array. Object level scope to avoid cache thrashing. - */ + */ mutable std::vector _vals; - + public: /** - * Constructor. Takes the inverse distance power, - * which defaults to 2. + * Constructor. Takes the inverse distance power, + * which defaults to 2. */ InverseDistanceInterpolation (const unsigned int n_interp_pts = 8, const Real power = 2) : diff --git a/include/solution_transfer/meshfree_solution_transfer.h b/include/solution_transfer/meshfree_solution_transfer.h index 5f2bf7ff62f..7e09c3d5cd5 100644 --- a/include/solution_transfer/meshfree_solution_transfer.h +++ b/include/solution_transfer/meshfree_solution_transfer.h @@ -34,7 +34,7 @@ class MeshfreeSolutionTransfer : public SolutionTransfer public: MeshfreeSolutionTransfer() {} virtual ~MeshfreeSolutionTransfer() {} - + /** * Transfer the values of a variable to another. */ diff --git a/include/solution_transfer/meshfunction_solution_transfer.h b/include/solution_transfer/meshfunction_solution_transfer.h index 0bf5409bf8a..afa9cfe1aec 100644 --- a/include/solution_transfer/meshfunction_solution_transfer.h +++ b/include/solution_transfer/meshfunction_solution_transfer.h @@ -17,7 +17,7 @@ class MeshFunctionSolutionTransfer : public SolutionTransfer public: MeshFunctionSolutionTransfer(); virtual ~MeshFunctionSolutionTransfer(); - + /** * Transfer the values of a variable to another. */ diff --git a/include/solution_transfer/radial_basis_functions.h b/include/solution_transfer/radial_basis_functions.h index 1fc75632698..cdda6ad09e6 100644 --- a/include/solution_transfer/radial_basis_functions.h +++ b/include/solution_transfer/radial_basis_functions.h @@ -41,7 +41,7 @@ namespace libMesh // const Real _rcut; // public: - + // /** // * Constructor. // */ @@ -55,15 +55,15 @@ namespace libMesh // Real operator()(Real rad) const // { // if (rad > _rcut) return 0.; - + // rad /= _rcut; - + // return std::sqrt( 1+ rad*rad ); // } // }; - + /** * Wendland's compactly supported Radial Basis Functions. */ @@ -74,7 +74,7 @@ namespace libMesh const Real _rcut; public: - + /** * Constructor. */ @@ -89,7 +89,7 @@ namespace libMesh }; - + //------------------------------------------------------- // Explicit specializations template<> @@ -111,7 +111,7 @@ namespace libMesh rad /= _rcut; - return Utility::pow<4>(1.-rad)*(4.*rad + 1.); + return Utility::pow<4>(1.-rad)*(4.*rad + 1.); } template<> @@ -136,7 +136,7 @@ namespace libMesh return Utility::pow<8>(1.-rad)*(((32.*rad + 25.)*rad + 8.)*rad + 1.); } - + } // namespace libMesh diff --git a/include/solution_transfer/radial_basis_interpolation.h b/include/solution_transfer/radial_basis_interpolation.h index c182f6e1961..11d2be661f3 100644 --- a/include/solution_transfer/radial_basis_interpolation.h +++ b/include/solution_transfer/radial_basis_interpolation.h @@ -45,12 +45,12 @@ class RadialBasisInterpolation : public InverseDistanceInterpolation using InverseDistanceInterpolation::_names; protected: - + /** * Bounding box for our source points. */ MeshTools::BoundingBox _src_bbox; - + /** * basis coefficients. */ @@ -69,7 +69,7 @@ class RadialBasisInterpolation : public InverseDistanceInterpolation public: /** - * Constructor. + * Constructor. */ RadialBasisInterpolation (Real radius=-1) : InverseDistanceInterpolation (), @@ -84,10 +84,10 @@ class RadialBasisInterpolation : public InverseDistanceInterpolation virtual void clear(); /** - * Prepares data structures for use. + * Prepares data structures for use. */ virtual void prepare_for_use (); - + /** * Interpolate source data at target points. * Pure virtual, must be overriden in derived classes. diff --git a/include/solvers/memory_solution_history.h b/include/solvers/memory_solution_history.h index 79258a8b5cc..6a1d65989c2 100644 --- a/include/solvers/memory_solution_history.h +++ b/include/solvers/memory_solution_history.h @@ -33,9 +33,9 @@ namespace libMesh */ class MemorySolutionHistory : public SolutionHistory { - public: - - // Constructor, reference to system to be passed by user, set the + public: + + // Constructor, reference to system to be passed by user, set the // stored_sols iterator to some initial value MemorySolutionHistory(System & system_) : stored_sols(stored_solutions.end()), _system(system_) { libmesh_experimental(); } ; @@ -49,27 +49,27 @@ namespace libMesh // Virtual function retrieve which we will be overriding to retrieve timesteps virtual void retrieve(); - // Typedef for Stored Solutions iterator, a list of pairs of the current + // Typedef for Stored Solutions iterator, a list of pairs of the current // system time, map of strings and saved vectors typedef std::list*> > >::iterator stored_solutions_iterator; - // Definition of the clone function needed for the setter function + // Definition of the clone function needed for the setter function virtual AutoPtr clone() const { - return AutoPtr + return AutoPtr (new MemorySolutionHistory(_system));} - + private: - - // This list of pairs will hold the current time and stored vectors + + // This list of pairs will hold the current time and stored vectors // from each timestep - std::list*> > > stored_solutions; - + std::list*> > > stored_solutions; + // The stored solutions iterator stored_solutions_iterator stored_sols; // A helper function to locate entries at a given time void find_stored_entry(); - + // A system reference System & _system ; diff --git a/include/solvers/no_solution_history.h b/include/solvers/no_solution_history.h index f20a23b7ac0..5676fcb2039 100644 --- a/include/solvers/no_solution_history.h +++ b/include/solvers/no_solution_history.h @@ -30,7 +30,7 @@ namespace libMesh class NoSolutionHistory : public SolutionHistory { public: - + // Constructor NoSolutionHistory() : SolutionHistory() {}; @@ -43,11 +43,11 @@ namespace libMesh // Virtual function retrieve which we will be overriding virtual void retrieve(); - // Definition of the clone function needed for the setter function + // Definition of the clone function needed for the setter function virtual AutoPtr clone() const { - return AutoPtr + return AutoPtr (new NoSolutionHistory());} - + }; // end NoSolutionHistory class definition } // end namespace libMesh diff --git a/include/solvers/solution_history.h b/include/solvers/solution_history.h index 5525435e443..84a4565236e 100644 --- a/include/solvers/solution_history.h +++ b/include/solvers/solution_history.h @@ -31,11 +31,11 @@ namespace libMesh class SolutionHistory { public: - + // Constructor SolutionHistory() : overwrite_previously_stored(false) {}; - + // Destructor virtual ~SolutionHistory () {}; @@ -45,7 +45,7 @@ namespace libMesh // Function to retrieve a solution, pure virtual virtual void retrieve() = 0; - // Cloning function for an AutoPtr, pure virtual, used in the + // Cloning function for an AutoPtr, pure virtual, used in the // setter function in time_solver.C virtual AutoPtr clone() const = 0; @@ -56,10 +56,10 @@ namespace libMesh protected: - // Flag to specify whether we want to overwrite previously stored + // Flag to specify whether we want to overwrite previously stored // vectors at a given time or not bool overwrite_previously_stored; - + }; // end SolutionHistory class definition } // end namespace libMesh diff --git a/include/solvers/time_solver.h b/include/solvers/time_solver.h index 6a33cf0b602..c077d913aa5 100644 --- a/include/solvers/time_solver.h +++ b/include/solvers/time_solver.h @@ -205,7 +205,7 @@ class TimeSolver : public ReferenceCountedObject unsigned int reduce_deltat_on_diffsolver_failure; /** - * A setter function users will employ if they need to do something + * A setter function users will employ if they need to do something * other than save no solution history */ void set_solution_history(const SolutionHistory & _solution_history); @@ -223,7 +223,7 @@ class TimeSolver : public ReferenceCountedObject */ void set_is_adjoint(bool _is_adjoint_value) { _is_adjoint = _is_adjoint_value; } - + protected: /** diff --git a/include/systems/diff_context.h b/include/systems/diff_context.h index 158e5a6e35e..02617be20f7 100644 --- a/include/systems/diff_context.h +++ b/include/systems/diff_context.h @@ -92,7 +92,7 @@ class DiffContext /** * Number of variables in solution. */ - unsigned int n_vars() const + unsigned int n_vars() const { return libmesh_cast_int(dof_indices_var.size()); } /** @@ -241,7 +241,7 @@ class DiffContext */ Real get_time() const { return time; } - + /** * Set the time for which the current nonlinear_solution is defined. */ @@ -368,10 +368,10 @@ class DiffContext /** * Typedef for the localized_vectors iterator */ - typedef std::map*, std::pair, std::vector*> > >::iterator localized_vectors_iterator; + typedef std::map*, std::pair, std::vector*> > >::iterator localized_vectors_iterator; /** - * Return a reference to DenseVector localization of _localized_vector + * Return a reference to DenseVector localization of _localized_vector * contained in the localized_vectors map */ DenseVector & get_localized_vector (const NumericVector & _localized_vector); @@ -390,7 +390,7 @@ class DiffContext /** * const accessible version of get_localized_subvector function */ - const DenseSubVector & get_localized_subvector (const NumericVector & _localized_vector, unsigned int _var) const; + const DenseSubVector & get_localized_subvector (const NumericVector & _localized_vector, unsigned int _var) const; private: @@ -418,14 +418,14 @@ class DiffContext bool _is_adjoint; protected: - + /** * Contains pointers to vectors the user has asked to be localized, keyed with * pairs of element localized versions of that vector and per variable views */ - std::map*, std::pair, std::vector*> > > localized_vectors; - + std::map*, std::pair, std::vector*> > > localized_vectors; + }; } // namespace libMesh diff --git a/include/systems/diff_system.h b/include/systems/diff_system.h index 8edeaeda458..86e77baed3a 100644 --- a/include/systems/diff_system.h +++ b/include/systems/diff_system.h @@ -1,16 +1,16 @@ // The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -81,10 +81,10 @@ class DifferentiableSystem : public ImplicitSystem, * The type of the parent. */ typedef ImplicitSystem Parent; - + /** * Clear all the data structures associated with - * the system. + * the system. */ virtual void clear (); @@ -93,7 +93,7 @@ class DifferentiableSystem : public ImplicitSystem, * the system, so that, e.g., \p assemble() may be used. */ virtual void reinit (); - + /** * Prepares \p matrix and \p rhs for matrix assembly. * Users should not reimplement this @@ -115,7 +115,7 @@ class DifferentiableSystem : public ImplicitSystem, get_linear_solve_parameters() const; /** - * Releases a pointer to a linear solver acquired by + * Releases a pointer to a linear solver acquired by * \p this->get_linear_solver() */ virtual void release_linear_solver(LinearSolver *) const; @@ -143,7 +143,7 @@ class DifferentiableSystem : public ImplicitSystem, * We don't allow systems to be attached to each other */ virtual AutoPtr clone_physics() - { libmesh_error(); + { libmesh_error(); // dummy return AutoPtr(this); } @@ -151,7 +151,7 @@ class DifferentiableSystem : public ImplicitSystem, * We don't allow systems to be attached to each other */ virtual AutoPtr clone() - { libmesh_error(); + { libmesh_error(); // dummy return AutoPtr(this); } @@ -198,7 +198,7 @@ class DifferentiableSystem : public ImplicitSystem, { this->diff_qoi = (qoi_in->clone()).release(); // User needs to resize qoi system qoi accordingly this->diff_qoi->init_qoi( this->qoi );} - + /** * A pointer to the solver object we're going to use. * This must be instantiated by the user before solving! @@ -249,7 +249,7 @@ class DifferentiableSystem : public ImplicitSystem, * Does any work that needs to be done on \p elem in a postprocessing loop. */ virtual void element_postprocess (DiffContext &) {} - + /** * Does any work that needs to be done on \p side of \p elem in a * postprocessing loop. @@ -307,7 +307,7 @@ class DifferentiableSystem : public ImplicitSystem, * users should create separate physics objects. */ DifferentiablePhysics *_diff_physics; - + /** * Pointer to object to use for quantity of interest assembly * evaluations. Defaults to \p this for backwards compatibility; in @@ -325,7 +325,7 @@ class DifferentiableSystem : public ImplicitSystem, // -------------------------------------------------------------- // DifferentiableSystem inline methods inline - TimeSolver& DifferentiableSystem::get_time_solver() + TimeSolver& DifferentiableSystem::get_time_solver() { libmesh_assert(time_solver.get()); libmesh_assert_equal_to (&(time_solver->system()), this); diff --git a/include/systems/eigen_system.h b/include/systems/eigen_system.h index 07ab9024cf4..1c31c1ff800 100644 --- a/include/systems/eigen_system.h +++ b/include/systems/eigen_system.h @@ -228,8 +228,8 @@ unsigned int EigenSystem::n_matrices () const { if(_is_generalized_eigenproblem) return 2; - - return 1; + + return 1; } diff --git a/include/systems/fem_context.h b/include/systems/fem_context.h index 451e52894ce..4938d20fc7b 100644 --- a/include/systems/fem_context.h +++ b/include/systems/fem_context.h @@ -240,7 +240,7 @@ class FEMContext : public DiffContext * Returns the value of the solution variable \p var at the quadrature * point \p qp on the current element interior. This is the preferred API. */ - template + template void interior_value(unsigned int var, unsigned int qp, OutputType& u) const; @@ -248,7 +248,7 @@ class FEMContext : public DiffContext * Fills a vector of values of the _system_vector at the all the quadrature * points in the current element interior. */ - template + template void interior_values(unsigned int var, const NumericVector & _system_vector, std::vector& interior_values_vector) const; @@ -256,7 +256,7 @@ class FEMContext : public DiffContext * Returns the value of the solution variable \p var at the quadrature * point \p qp on the current element side. This is the preferred API. */ - template + template void side_value(unsigned int var, unsigned int qp, OutputType& u) const; @@ -264,7 +264,7 @@ class FEMContext : public DiffContext * Fills a vector of values of the _system_vector at the all the quadrature * points on the current element side. */ - template + template void side_values(unsigned int var, const NumericVector & _system_vector, std::vector& side_values_vector) const; @@ -281,7 +281,7 @@ class FEMContext : public DiffContext * point \p qp on the current element interior. This is the preferred API. */ template - void interior_gradient(unsigned int var, unsigned int qp, + void interior_gradient(unsigned int var, unsigned int qp, OutputType& du) const; /** @@ -289,7 +289,7 @@ class FEMContext : public DiffContext * points in the current element interior. This is the preferred API. */ template - void interior_gradients(unsigned int var, const NumericVector & _system_vector, + void interior_gradients(unsigned int var, const NumericVector & _system_vector, std::vector& interior_gradients_vector) const; /** @@ -297,7 +297,7 @@ class FEMContext : public DiffContext * point \p qp on the current element side. This is the preferred API. */ template - void side_gradient(unsigned int var, unsigned int qp, + void side_gradient(unsigned int var, unsigned int qp, OutputType & du) const; /** @@ -305,7 +305,7 @@ class FEMContext : public DiffContext * points on the current element side. This is the preferred API. */ template - void side_gradients(unsigned int var, const NumericVector & _system_vector, + void side_gradients(unsigned int var, const NumericVector & _system_vector, std::vector& side_gradients_vector) const; /** @@ -313,9 +313,9 @@ class FEMContext : public DiffContext * point \p p on the current element. This is the preferred API. */ template - void point_gradient(unsigned int var, const Point &p, + void point_gradient(unsigned int var, const Point &p, OutputType& grad_u) const; - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES /** * Returns the hessian of the solution variable \p var at the quadrature @@ -339,7 +339,7 @@ class FEMContext : public DiffContext * point \p qp on the current element side. This is the preferred API. */ template - void side_hessian(unsigned int var, unsigned int qp, + void side_hessian(unsigned int var, unsigned int qp, OutputType& d2u) const; /** @@ -348,7 +348,7 @@ class FEMContext : public DiffContext * preferred API. */ template - void side_hessians(unsigned int var, const NumericVector & _system_vector, + void side_hessians(unsigned int var, const NumericVector & _system_vector, std::vector& d2u_vals) const; /** @@ -356,7 +356,7 @@ class FEMContext : public DiffContext * point \p p on the current element. This is the preferred API. */ template - void point_hessian(unsigned int var, const Point &p, + void point_hessian(unsigned int var, const Point &p, OutputType& hess_u) const; #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES @@ -408,7 +408,7 @@ class FEMContext : public DiffContext template void fixed_point_gradient(unsigned int var, const Point &p, OutputType& grad_u) const; - + #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES /** * Returns the hessian of the fixed_solution variable \p var at the quadrature @@ -417,7 +417,7 @@ class FEMContext : public DiffContext template void fixed_interior_hessian(unsigned int var, unsigned int qp, OutputType& hess_u) const; - + /** * Returns the hessian of the fixed_solution variable \p var at the quadrature * point \p qp on the current element side. This is the preferred API. @@ -425,7 +425,7 @@ class FEMContext : public DiffContext template void fixed_side_hessian(unsigned int var, unsigned int qp, OutputType& hess_u) const; - + /** * Returns the hessian of the fixed_solution variable \p var at the physical * point \p p on the current element. This is the preferred API. @@ -449,7 +449,7 @@ class FEMContext : public DiffContext * point \p p on the current element. */ template - void point_curl(unsigned int var, const Point &p, + void point_curl(unsigned int var, const Point &p, OutputType& curl_u) const; /** @@ -525,7 +525,7 @@ class FEMContext : public DiffContext */ const QBase* get_edge_qrule() const { return this->edge_qrule; } - + /** * Tells the FEMContext that system \p sys contains the * isoparametric Lagrangian variables which correspond to the @@ -709,7 +709,7 @@ class FEMContext : public DiffContext std::map _element_fe; std::map _side_fe; std::map _edge_fe; - + /** * Pointers to the same finite element objects, but indexed @@ -775,7 +775,7 @@ void FEMContext::get_side_fe( unsigned int var, FEGenericBase *& fe template inline void FEMContext::get_edge_fe( unsigned int var, FEGenericBase *& fe ) const -{ +{ libmesh_assert_less ( var, _edge_fe_var.size() ); fe = libmesh_cast_ptr*>( _edge_fe_var[var] ); } diff --git a/include/systems/system_subset.h b/include/systems/system_subset.h index 309a35eb252..5cffb2aa51b 100644 --- a/include/systems/system_subset.h +++ b/include/systems/system_subset.h @@ -99,4 +99,3 @@ class SystemSubset : public ReferenceCountedObject } // namespace libMesh #endif // LIBMESH_SYSTEM_SUBSET_H - diff --git a/include/systems/system_subset_by_subdomain.h b/include/systems/system_subset_by_subdomain.h index ec765b527b1..f9ff5164ead 100644 --- a/include/systems/system_subset_by_subdomain.h +++ b/include/systems/system_subset_by_subdomain.h @@ -196,4 +196,3 @@ class SystemSubsetBySubdomain : public SystemSubset } // namespace libMesh #endif // LIBMESH_SYSTEM_SUBSET_BY_SUBDOMAIN_H - diff --git a/include/utils/error_vector.h b/include/utils/error_vector.h index 37433d72a72..2093f0c0dcd 100644 --- a/include/utils/error_vector.h +++ b/include/utils/error_vector.h @@ -168,4 +168,3 @@ class ErrorVector : public StatisticsVector } // namespace libMesh #endif // LIBMESH_ERROR_VECTOR_H - diff --git a/include/utils/ignore_warnings.h b/include/utils/ignore_warnings.h index 44dcda43d4c..8030a4aef19 100644 --- a/include/utils/ignore_warnings.h +++ b/include/utils/ignore_warnings.h @@ -26,7 +26,7 @@ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-parameter" -#endif +#endif #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) #if __GNUC__ > 3 && __GNUC_MINOR__ > 1 diff --git a/include/utils/null_output_iterator.h b/include/utils/null_output_iterator.h index b0fac01eca0..500061818cc 100644 --- a/include/utils/null_output_iterator.h +++ b/include/utils/null_output_iterator.h @@ -37,12 +37,12 @@ struct null_output_iterator template void operator=(const T2&) {} - null_output_iterator& operator++() { - return *this; + null_output_iterator& operator++() { + return *this; } - null_output_iterator operator++(int) { - return null_output_iterator(*this); + null_output_iterator operator++(int) { + return null_output_iterator(*this); } // We don't return a reference-to-T here because we don't want to diff --git a/include/utils/ostream_proxy.h b/include/utils/ostream_proxy.h index 008f36b5725..011039baf43 100644 --- a/include/utils/ostream_proxy.h +++ b/include/utils/ostream_proxy.h @@ -241,4 +241,3 @@ typedef BasicOStreamProxy<> OStreamProxy; } // namespace libMesh #endif // LIBMESH_OSTREAM_PROXY_H - diff --git a/include/utils/point_locator_base.h b/include/utils/point_locator_base.h index 5c28520fbd2..c45590ee73a 100644 --- a/include/utils/point_locator_base.h +++ b/include/utils/point_locator_base.h @@ -155,5 +155,3 @@ bool PointLocatorBase::initialized () const } // namespace libMesh #endif // LIBMESH_POINT_LOCATOR_BASE_H - - diff --git a/include/utils/point_locator_list.h b/include/utils/point_locator_list.h index 7d1fb6d6761..8dbe53657aa 100644 --- a/include/utils/point_locator_list.h +++ b/include/utils/point_locator_list.h @@ -143,5 +143,3 @@ class PointLocatorList : public PointLocatorBase } // namespace libMesh #endif // LIBMESH_POINT_LOCATOR_LIST_H - - diff --git a/include/utils/point_locator_tree.h b/include/utils/point_locator_tree.h index 64109620c48..e7170914755 100644 --- a/include/utils/point_locator_tree.h +++ b/include/utils/point_locator_tree.h @@ -162,5 +162,3 @@ class PointLocatorTree : public PointLocatorBase } // namespace libMesh #endif // LIBMESH_POINT_LOCATOR_TREE_H - - diff --git a/include/utils/restore_warnings.h b/include/utils/restore_warnings.h index 8f8bd10da99..6dfcd945b03 100644 --- a/include/utils/restore_warnings.h +++ b/include/utils/restore_warnings.h @@ -25,7 +25,7 @@ #ifdef __clang__ #pragma clang diagnostic pop -#endif +#endif #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) #if __GNUC__ > 3 && __GNUC_MINOR__ > 1 diff --git a/include/utils/string_to_enum.h b/include/utils/string_to_enum.h index 14947985771..36cf6aec1f0 100644 --- a/include/utils/string_to_enum.h +++ b/include/utils/string_to_enum.h @@ -58,7 +58,3 @@ namespace Utility { #endif // LIBMESH_STRING_TO_ENUM_H - - - - diff --git a/src/apps/getpot_parse.C b/src/apps/getpot_parse.C index 8bc4ec830a6..b78c831f0a3 100644 --- a/src/apps/getpot_parse.C +++ b/src/apps/getpot_parse.C @@ -23,7 +23,7 @@ int main(int argc, char** argv) std::ostream *my_out; std::ofstream fout; fout.exceptions ( std::ofstream::failbit | std::ofstream::badbit ); - + if (argc < 3) my_out = &std::cout; else diff --git a/src/apps/grid2grid.C b/src/apps/grid2grid.C index 3cc311c7f30..70f8a068604 100644 --- a/src/apps/grid2grid.C +++ b/src/apps/grid2grid.C @@ -287,4 +287,3 @@ int main (int argc, char** argv) return 0; } - diff --git a/src/apps/meshdiff.C b/src/apps/meshdiff.C index 44bdea71f14..a2b64123131 100644 --- a/src/apps/meshdiff.C +++ b/src/apps/meshdiff.C @@ -70,7 +70,7 @@ int main(int argc, char** argv) << " not found in coarse solution!" << std::endl; if (!es1.n_systems() && !es2.n_systems()) - std::cout << "No systems found in fine or coarse solution!" + std::cout << "No systems found in fine or coarse solution!" << std::endl; for (unsigned int i = 0; i != sysnames.size(); ++i) @@ -85,7 +85,7 @@ int main(int argc, char** argv) if (!sys2.has_variable(varname)) { - std::cout << "Fine solution system " << sysname + std::cout << "Fine solution system " << sysname << " variable " << varname << " not found in coarse solution!" << std::endl; continue; @@ -95,7 +95,7 @@ int main(int argc, char** argv) exact_sol.compute_error(sysname, varname); std::cout << "Errors in system " << sysname << ", variable " << varname << ":" << std::endl; - std::cout << "L2 error: " << exact_sol.l2_error(sysname, varname) + std::cout << "L2 error: " << exact_sol.l2_error(sysname, varname) << ", fine norm: " << sys1.calculate_norm(*sys1.solution, j, L2) << ", coarse norm: " << sys2.calculate_norm(*sys2.solution, j2, L2) << std::endl; std::cout << "H1 error: " << exact_sol.h1_error(sysname, varname) @@ -112,7 +112,7 @@ int main(int argc, char** argv) if (!sys1.has_variable(varname)) { - std::cout << "Coarse solution system " << sysname + std::cout << "Coarse solution system " << sysname << " variable " << varname << " not found in fine solution!" << std::endl; continue; diff --git a/src/apps/meshnorm.C b/src/apps/meshnorm.C index de1b3636ed6..1f139756f4a 100644 --- a/src/apps/meshnorm.C +++ b/src/apps/meshnorm.C @@ -12,11 +12,11 @@ void output_norms(const System &sys, const NumericVector&vec, const std: { for (unsigned int k = 0; k != sys.n_vars(); ++k) { - std::cout << "Norms in system " << sys.name() << + std::cout << "Norms in system " << sys.name() << ", vector " << vecname << ", variable " << sys.variable_name(k) << ":" << std::endl; Real l1_vecnorm = sys.calculate_norm(vec, k, DISCRETE_L1); - std::cout << "l1 norm: " << l1_vecnorm << std::endl; + std::cout << "l1 norm: " << l1_vecnorm << std::endl; if (l1_vecnorm) { std::cout << "l2 norm: " << sys.calculate_norm(vec, k, DISCRETE_L2) << std::endl; @@ -47,8 +47,8 @@ int main(int argc, char** argv) std::cout << "Loaded mesh " << argv[1] << std::endl; mesh.print_info(); - es.read(argv[2], EquationSystems::READ_HEADER | - EquationSystems::READ_DATA | + es.read(argv[2], EquationSystems::READ_HEADER | + EquationSystems::READ_DATA | EquationSystems::READ_ADDITIONAL_DATA | EquationSystems::READ_BASIC_ONLY); std::cout << "Loaded solution " << argv[2] << std::endl; diff --git a/src/apps/meshplot.C b/src/apps/meshplot.C index fb229033548..1888c27d8ef 100644 --- a/src/apps/meshplot.C +++ b/src/apps/meshplot.C @@ -62,7 +62,7 @@ int main(int argc, char** argv) ExodusII_IO(mesh).write_equation_systems (outputname, es); else if (outputname.find(".n") != std::string::npos) Nemesis_IO(mesh).write_equation_systems (outputname, es); - + STOP_LOG("write_equation_systems()", "main"); std::cout << "Wrote output " << argv[3] << std::endl; } diff --git a/src/apps/meshtool.C b/src/apps/meshtool.C index 89a8d195959..d2d8beb9b03 100644 --- a/src/apps/meshtool.C +++ b/src/apps/meshtool.C @@ -963,4 +963,3 @@ int main (int argc, char** argv) return 0; } - diff --git a/src/apps/solution_components.C b/src/apps/solution_components.C index 4f3fda728c2..60191143f6d 100644 --- a/src/apps/solution_components.C +++ b/src/apps/solution_components.C @@ -53,7 +53,7 @@ int main(int argc, char** argv) Mesh mesh2(mesh1); EquationSystems es2(mesh2); - es1.read(argv[2], + es1.read(argv[2], EquationSystems::READ_HEADER | EquationSystems::READ_DATA | EquationSystems::READ_ADDITIONAL_DATA | @@ -116,14 +116,14 @@ int main(int argc, char** argv) // Mesh::operator= hopefully preserved elem/node orderings... libmesh_assert (*old_node == *new_node); - + for (int argi = 4; argi < argc; argi += 2) { const unsigned int pairnum = (argi-4)/2; const System &old_sys = *old_system[pairnum]; System &new_sys = *new_system[pairnum]; - + const unsigned int n_comp = old_node->n_comp(old_sys_num[pairnum],old_var_num[pairnum]); libmesh_assert_equal_to(n_comp, @@ -155,14 +155,14 @@ int main(int argc, char** argv) // Mesh::operator= hopefully preserved elem/node orderings... libmesh_assert (*old_elem == *new_elem); - + for (int argi = 4; argi < argc; argi += 2) { const unsigned int pairnum = (argi-4)/2; const System &old_sys = *old_system[pairnum]; System &new_sys = *new_system[pairnum]; - + const unsigned int n_comp = old_elem->n_comp(old_sys_num[pairnum],old_var_num[pairnum]); libmesh_assert_equal_to(n_comp, diff --git a/src/base/dof_map.C b/src/base/dof_map.C index 3da9926f023..d0455700eb4 100644 --- a/src/base/dof_map.C +++ b/src/base/dof_map.C @@ -205,8 +205,8 @@ void DofMap::add_variable_group (const VariableGroup &var_group) _variable_groups.push_back(var_group); VariableGroup &new_var_group = _variable_groups.back(); - - for (unsigned int var=0; var& matrix) matrix.update_sparsity_pattern (_sp->sparsity_pattern); } - + if (matrix.need_full_sparsity_pattern()) need_full_sparsity_pattern = true; } @@ -432,10 +432,10 @@ void DofMap::reinit(MeshBase& mesh) // The DofObjects need to know how many variable groups we have, and // how many variables there are in each group. std::vector n_vars_per_group; /**/ n_vars_per_group.reserve (n_var_groups); - + for (unsigned int vg=0; vgvariable_group(vg).n_variables()); - + #ifdef LIBMESH_ENABLE_AMR //------------------------------------------------------------ @@ -525,7 +525,7 @@ void DofMap::reinit(MeshBase& mesh) for (unsigned int vg=0; vgvariable_group(vg); - + const unsigned int n_var_in_group = vg_description.n_variables(); const FEType& base_fe_type = vg_description.type(); @@ -558,7 +558,7 @@ void DofMap::reinit(MeshBase& mesh) const ElemType type = elem->type(); const unsigned int dim = elem->dim(); - + FEType fe_type = base_fe_type; #ifdef LIBMESH_ENABLE_AMR @@ -583,7 +583,7 @@ void DofMap::reinit(MeshBase& mesh) libmesh_error(); } - + libMesh::err << "WARNING: Finite element " << Utility::enum_to_string(base_fe_type.family) @@ -621,12 +621,12 @@ void DofMap::reinit(MeshBase& mesh) { node->set_n_comp_group(sys_num, vg, vertex_dofs); - + // Abusing dof_number to set a "this is a // vertex" flag node->set_vg_dof_base(sys_num, vg, vertex_dofs); - + // std::cout << "sys_num,vg,old_node_dofs,vertex_dofs=" // << sys_num << "," // << vg << "," @@ -687,7 +687,7 @@ void DofMap::reinit(MeshBase& mesh) // << vertex_dofs << "," // << new_node_dofs << '\n', // node->debug_buffer(); - + libmesh_assert_greater_equal (vertex_dofs, new_node_dofs); } // We need to allocate the rest @@ -715,7 +715,7 @@ void DofMap::reinit(MeshBase& mesh) { node->set_n_comp_group(sys_num, vg, new_node_dofs); - + node->set_vg_dof_base(sys_num, vg, vertex_dofs); } @@ -729,7 +729,7 @@ void DofMap::reinit(MeshBase& mesh) { node->set_n_comp_group(sys_num, vg, vertex_dofs + new_node_dofs); - + node->set_vg_dof_base(sys_num, vg, vertex_dofs); } @@ -743,7 +743,7 @@ void DofMap::reinit(MeshBase& mesh) { node->set_n_comp_group(sys_num, vg, new_node_dofs); - + node->set_vg_dof_base (sys_num, vg, vertex_dofs); } @@ -998,11 +998,11 @@ void DofMap::distribute_local_dofs_node_major(dof_id_type &next_free_dof, for (unsigned int n=0; nget_node(n); - + for (unsigned vg=0; vgvariable_group(vg)); - + if( (vg_description.type().family != SCALAR) && (vg_description.active_on_subdomain(elem->subdomain_id())) ) { @@ -1041,7 +1041,7 @@ void DofMap::distribute_local_dofs_node_major(dof_id_type &next_free_dof, next_free_dof); next_free_dof += (vg_description.n_variables()* - elem->n_comp(sys_num,vg)); + elem->n_comp(sys_num,vg)); } } } // done looping over elements @@ -1067,7 +1067,7 @@ void DofMap::distribute_local_dofs_node_major(dof_id_type &next_free_dof, for (unsigned vg=0; vgvariable_group(vg)); - + if (node->n_comp_group(sys_num,vg)) if (node->vg_dof_base(sys_num,vg) == DofObject::invalid_id) { @@ -1087,7 +1087,7 @@ void DofMap::distribute_local_dofs_node_major(dof_id_type &next_free_dof, for (unsigned vg=0; vgvariable_group(vg)); - + if( vg_description.type().family == SCALAR ) { this->_n_SCALAR_dofs += (vg_description.n_variables()* @@ -1136,7 +1136,7 @@ void DofMap::distribute_local_dofs_var_major(dof_id_type &next_free_dof, { const unsigned int sys_num = this->sys_number(); const unsigned int n_var_groups = this->n_variable_groups(); - + //------------------------------------------------------------------------- // First count and assign temporary numbers to local dofs for (unsigned vg=0; vgvariable_group(vg)); const unsigned int n_vars_in_group = vg_description.n_variables(); - + // Skip the SCALAR dofs if (vg_description.type().family == SCALAR) continue; @@ -1180,7 +1180,7 @@ void DofMap::distribute_local_dofs_var_major(dof_id_type &next_free_dof, node->set_vg_dof_base(sys_num, vg, next_free_dof); - + next_free_dof += (n_vars_in_group* node->n_comp_group(sys_num,vg)); } @@ -1237,7 +1237,7 @@ void DofMap::distribute_local_dofs_var_major(dof_id_type &next_free_dof, for (unsigned vg=0; vgvariable_group(vg)); - + if( vg_description.type().family == SCALAR ) { this->_n_SCALAR_dofs += (vg_description.n_variables()* @@ -1255,7 +1255,7 @@ void DofMap::distribute_local_dofs_var_major(dof_id_type &next_free_dof, { // Make sure we didn't miss any nodes MeshTools::libmesh_assert_valid_procids(mesh); - + MeshBase::node_iterator node_it = mesh.local_nodes_begin(); const MeshBase::node_iterator node_end = mesh.local_nodes_end(); for (; node_it != node_end; ++node_it) @@ -1547,7 +1547,7 @@ void DofMap::extract_local_vector (const NumericVector& Ug, libmesh_assert_equal_to (dof_indices_in.size(), Ue.size()); bool has_constrained_dofs = false; - for (unsigned int il=0; + for (unsigned int il=0; il != libmesh_cast_int(dof_indices_in.size()); il++) { const dof_id_type ig = dof_indices_in[il]; @@ -1569,7 +1569,7 @@ void DofMap::extract_local_vector (const NumericVector& Ug, DenseMatrix C; DenseVector H; - + this->build_constraint_matrix_and_vector (C, H, constrained_dof_indices); libmesh_assert_equal_to (dof_indices_in.size(), C.m()); @@ -1584,13 +1584,13 @@ void DofMap::extract_local_vector (const NumericVector& Ug, for (unsigned int i=0; i != n_original_dofs; i++) { Ue.el(i) = H(i); - + const unsigned int n_constrained = libmesh_cast_int(constrained_dof_indices.size()); for (unsigned int j=0; j= first_dof_on_proc) && (ig < end_dof_on_proc)) { @@ -2423,7 +2423,7 @@ void SparsityPattern::Build::operator()(const ConstElemRange &range) // We save non-local row components for now so we can // communicate them to other processors later. - + if ((ig >= first_dof_on_proc) && (ig < end_dof_on_proc)) { @@ -2749,7 +2749,7 @@ void SparsityPattern::Build::parallel_sync () const dof_id_type my_r = r - local_first_dof; std::vector &their_row = pushed_rows_to_me[i]; - + if (need_full_sparsity_pattern) { SparsityPattern::Row &my_row = diff --git a/src/base/dof_map_constraints.C b/src/base/dof_map_constraints.C index e1072875eb8..e33ac590e8d 100644 --- a/src/base/dof_map_constraints.C +++ b/src/base/dof_map_constraints.C @@ -193,10 +193,10 @@ using namespace libMesh; const DirichletBoundary dirichlet; template - void apply_dirichlet_impl( const ConstElemRange &range, FunctionBase *f, FunctionBase *g, - const std::set &b, DenseMatrix& Ke, - DenseVector& Fe, DenseVector& Ue, - const unsigned int var, const Variable&variable, + void apply_dirichlet_impl( const ConstElemRange &range, FunctionBase *f, FunctionBase *g, + const std::set &b, DenseMatrix& Ke, + DenseVector& Fe, DenseVector& Ue, + const unsigned int var, const Variable&variable, const FEType& fe_type ) const { typedef OutputType OutputShape; @@ -213,60 +213,60 @@ using namespace libMesh; const BoundaryInfo& boundary_info = *mesh.boundary_info; unsigned int n_vec_dim = FEInterface::n_vec_dim(mesh, fe_type); - + const unsigned int var_component = variable.first_scalar_number(); - + // Get FE objects of the appropriate type AutoPtr > fe = FEGenericBase::build(dim, fe_type); - + // Prepare variables for projection AutoPtr qedgerule (fe_type.default_quadrature_rule(1)); AutoPtr qsiderule (fe_type.default_quadrature_rule(dim-1)); - + // The values of the shape functions at the quadrature // points const std::vector >& phi = fe->get_phi(); - + // The gradients of the shape functions at the quadrature // points on the child element. const std::vector > *dphi = NULL; - + const FEContinuity cont = fe->get_continuity(); - + if (cont == C_ONE) { // We'll need gradient data for a C1 projection libmesh_assert(g); - + const std::vector >& ref_dphi = fe->get_dphi(); dphi = &ref_dphi; } - + // The Jacobian * quadrature weight at the quadrature points const std::vector& JxW = fe->get_JxW(); - + // The XYZ locations of the quadrature points const std::vector& xyz_values = fe->get_xyz(); - + // The global DOF indices std::vector dof_indices; // Side/edge local DOF indices std::vector side_dofs; - + // Iterate over all the elements in the range for (ConstElemRange::const_iterator elem_it=range.begin(); elem_it != range.end(); ++elem_it) { const Elem* elem = *elem_it; - + // Per-subdomain variables don't need to be projected on // elements where they're not active if (!variable.active_on_subdomain(elem->subdomain_id())) continue; - + // Find out which nodes, edges and sides are on a requested // boundary: std::vector is_boundary_node(elem->n_nodes(), false), @@ -286,9 +286,9 @@ using namespace libMesh; } if (!do_this_side) continue; - + is_boundary_side[s] = true; - + // Then see what nodes and what edges are on it for (unsigned int n=0; n != elem->n_nodes(); ++n) if (elem->is_node_on_side(n,s)) @@ -297,34 +297,34 @@ using namespace libMesh; if (elem->is_edge_on_side(e,s)) is_boundary_edge[e] = true; } - + // Update the DOF indices for this element based on // the current mesh dof_map.dof_indices (elem, dof_indices, var); - + // The number of DOFs on the element const unsigned int n_dofs = libmesh_cast_int(dof_indices.size()); - + // Fixed vs. free DoFs on edge/face projections std::vector dof_is_fixed(n_dofs, false); // bools std::vector free_dof(n_dofs, 0); - + // The element type const ElemType elem_type = elem->type(); - + // The number of nodes on the new element const unsigned int n_nodes = elem->n_nodes(); - + // Zero the interpolated values Ue.resize (n_dofs); Ue.zero(); - + // In general, we need a series of // projections to ensure a unique and continuous // solution. We start by interpolating boundary nodes, then // hold those fixed and project boundary edges, then hold // those fixed and project boundary faces, - + // Interpolate node values first unsigned int current_dof = 0; for (unsigned int n=0; n!= n_nodes; ++n) @@ -394,7 +394,7 @@ using namespace libMesh; / 2. / TOLERANCE; dof_is_fixed[current_dof] = true; current_dof++; - + if (dim > 2) { // z derivative @@ -483,33 +483,33 @@ using namespace libMesh; else libmesh_error(); } - + // In 3D, project any edge values next if (dim > 2 && cont != DISCONTINUOUS) for (unsigned int e=0; e != elem->n_edges(); ++e) { if (!is_boundary_edge[e]) continue; - + FEInterface::dofs_on_edge(elem, dim, fe_type, e, side_dofs); - + // Some edge dofs are on nodes and already // fixed, others are free to calculate unsigned int free_dofs = 0; for (unsigned int i=0; i != side_dofs.size(); ++i) if (!dof_is_fixed[side_dofs[i]]) free_dof[free_dofs++] = i; - + // There may be nothing to project if (!free_dofs) continue; - + Ke.resize (free_dofs, free_dofs); Ke.zero(); Fe.resize (free_dofs); Fe.zero(); // The new edge coefficients DenseVector Uedge(free_dofs); - + // Initialize FE data on the edge fe->attach_quadrature_rule (qedgerule.get()); fe->edge_reinit (elem, e); @@ -552,7 +552,7 @@ using namespace libMesh; g_accessor(c + d*dim ) = g->component(var_component, xyz_values[qp], time)(c); - + // Form edge projection matrix for (unsigned int sidei=0, freei=0; sidei != side_dofs.size(); ++sidei) @@ -590,9 +590,9 @@ using namespace libMesh; freei++; } } - + Ke.cholesky_solve(Fe, Uedge); - + // Transfer new edge solutions to element for (unsigned int i=0; i != free_dofs; ++i) { @@ -610,21 +610,21 @@ using namespace libMesh; { if (!is_boundary_side[s]) continue; - + FEInterface::dofs_on_side(elem, dim, fe_type, s, side_dofs); - + // Some side dofs are on nodes/edges and already // fixed, others are free to calculate unsigned int free_dofs = 0; for (unsigned int i=0; i != side_dofs.size(); ++i) if (!dof_is_fixed[side_dofs[i]]) free_dof[free_dofs++] = i; - + // There may be nothing to project if (!free_dofs) continue; - + Ke.resize (free_dofs, free_dofs); Ke.zero(); Fe.resize (free_dofs); Fe.zero(); // The new side coefficients @@ -634,7 +634,7 @@ using namespace libMesh; fe->attach_quadrature_rule (qsiderule.get()); fe->reinit (elem, s); const unsigned int n_qp = qsiderule->n_points(); - + // Loop over the quadrature points for (unsigned int qp=0; qpcomponent(var_component, xyz_values[qp], time)(c); - + // Form side projection matrix for (unsigned int sidei=0, freei=0; sidei != side_dofs.size(); ++sidei) @@ -710,9 +710,9 @@ using namespace libMesh; freei++; } } - + Ke.cholesky_solve(Fe, Uside); - + // Transfer new side solutions to element for (unsigned int i=0; i != free_dofs; ++i) { @@ -723,25 +723,25 @@ using namespace libMesh; dof_is_fixed[side_dofs[free_dof[i]]] = true; } } - + // Lock the DofConstraints since it is shared among threads. { Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); - + for (unsigned int i = 0; i < n_dofs; i++) { DofConstraintRow empty_row; if (dof_is_fixed[i] && !dof_map.is_constrained_dof(dof_indices[i])) dof_map.add_constraint_row - (dof_indices[i], empty_row, + (dof_indices[i], empty_row, Ue(i), /* forbid_constraint_overwrite = */ true); } } - } - + } + } // apply_dirichlet_impl - + public: ConstrainDirichlet (DofMap &dof_map_in, const MeshBase &mesh_in, @@ -786,11 +786,11 @@ using namespace libMesh; for (unsigned int v=0; v!=dirichlet.variables.size(); v++) { const unsigned int var = dirichlet.variables[v]; - + const Variable& variable = dof_map.variable(var); - + const FEType& fe_type = variable.type(); - + if (fe_type.family == SCALAR) continue; @@ -815,7 +815,7 @@ using namespace libMesh; }; // class ConstrainDirichlet - + #endif // LIBMESH_ENABLE_DIRICHLET @@ -867,7 +867,7 @@ void DofMap::create_dof_constraints(const MeshBase& mesh, Real time) // or from boundary conditions in any dimension const bool possible_local_constraints = false #ifdef LIBMESH_ENABLE_AMR - || dim > 1 + || dim > 1 #endif #ifdef LIBMESH_ENABLE_PERIODIC || !_periodic_boundaries->empty() @@ -961,7 +961,7 @@ void DofMap::create_dof_constraints(const MeshBase& mesh, Real time) variable_number)); #ifdef LIBMESH_ENABLE_DIRICHLET - for (DirichletBoundaries::iterator + for (DirichletBoundaries::iterator i = _dirichlet_boundaries->begin(); i != _dirichlet_boundaries->end(); ++i, range.reset()) { @@ -1256,7 +1256,7 @@ void DofMap::constrain_element_matrix_and_vector (DenseMatrix& matrix, -void DofMap::heterogenously_constrain_element_matrix_and_vector +void DofMap::heterogenously_constrain_element_matrix_and_vector (DenseMatrix& matrix, DenseVector& rhs, std::vector& elem_dofs, @@ -1460,7 +1460,7 @@ void DofMap::constrain_element_vector (DenseVector& rhs, // If the DOF is constrained DofConstraints::const_iterator pos = _dof_constraints.find(row_dofs[i]); - + libmesh_assert (pos != _dof_constraints.end()); rhs(i) = 0; @@ -1514,7 +1514,7 @@ void DofMap::constrain_element_dyad_matrix (DenseVector& v, // If the DOF is constrained DofConstraints::const_iterator pos = _dof_constraints.find(row_dofs[i]); - + libmesh_assert (pos != _dof_constraints.end()); v(i) = 0; @@ -2691,7 +2691,7 @@ void DofMap::scatter_constraints(MeshBase& mesh) it != pushed_node_ids[procup].end(); ++push_i, ++it) { const Node *constrained = mesh.node_ptr(*it); - + if (constrained->processor_id() != procdown) pushed_nodes.insert(constrained); @@ -2706,7 +2706,7 @@ void DofMap::scatter_constraints(MeshBase& mesh) pushed_node_keys[push_i].push_back(constraining->id()); pushed_node_vals[push_i].push_back(j->second); - + if (constraining->processor_id() != procup) pushed_nodes.insert(constraining); } @@ -2865,7 +2865,7 @@ void DofMap::scatter_constraints(MeshBase& mesh) mti != dcmi->second.end(); ++mti) { const dof_id_type constrained = *mti; - + dof_id_type the_constrained_proc_id = 0; while (constrained >= _end_df[the_constrained_proc_id]) the_constrained_proc_id++; @@ -3127,7 +3127,7 @@ void DofMap::add_periodic_boundary (const PeriodicBoundaryBase& periodic_boundar { // ...otherwise, merge this object's variable IDs with the existing boundary object's. existing_boundary->merge(periodic_boundary); - + // Do the same merging process for the inverse boundary. Note: the inverse better already exist! PeriodicBoundaryBase* inverse_boundary = _periodic_boundaries->boundary(periodic_boundary.pairedboundary); libmesh_assert(inverse_boundary); @@ -3156,7 +3156,7 @@ void DofMap::add_periodic_boundary (const PeriodicBoundaryBase& boundary, const PeriodicBoundaryBase* p_boundary = boundary.clone().release(); PeriodicBoundaryBase* p_inverse_boundary = inverse_boundary.clone().release(); - // Add the periodic boundary and its inverse to the PeriodicBoundaries data structure. The + // Add the periodic boundary and its inverse to the PeriodicBoundaries data structure. The // PeriodicBoundaries data structure takes ownership of the pointers. _periodic_boundaries->insert(std::make_pair(p_boundary->myboundary, p_boundary)); _periodic_boundaries->insert(std::make_pair(p_inverse_boundary->myboundary, p_inverse_boundary)); diff --git a/src/base/dof_object.C b/src/base/dof_object.C index a83323b459f..40878a2d756 100644 --- a/src/base/dof_object.C +++ b/src/base/dof_object.C @@ -60,7 +60,7 @@ DofObject::DofObject (const DofObject& dof_obj) : for (unsigned int vg=0; vgn_var_groups(s); vg++) libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg)); - + for (unsigned int v=0; vn_vars(s); v++) { libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v)); @@ -100,7 +100,7 @@ DofObject& DofObject::operator= (const DofObject& dof_obj) for (unsigned int vg=0; vgn_var_groups(s); vg++) libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg)); - + for (unsigned int v=0; vn_vars(s); v++) { libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v)); @@ -173,7 +173,7 @@ void DofObject::set_n_systems (const unsigned int ns) libmesh_assert_equal_to (this->n_vars(s), 0); libmesh_assert_equal_to (this->n_var_groups(s), 0); } - + #endif } @@ -214,12 +214,12 @@ void DofObject::add_system() void DofObject::set_n_vars_per_group(const unsigned int s, const std::vector &nvpg) { - + libmesh_assert_less (s, this->n_systems()); // number of varaible groups for this system - inferred const unsigned int nvg = libmesh_cast_int(nvpg.size()); - + // BSK - note that for compatibility with the previous implementation // calling this method when (nvars == this->n_vars()) requires that // we invalidate the DOF indices and set the number of components to 0. @@ -283,7 +283,7 @@ void DofObject::set_n_vars_per_group(const unsigned int s, // array to hold new indices DofObject::index_buffer_t var_idxs(2*nvg); for (unsigned int vg=0; vgn_var_groups(s)); - + #ifdef DEBUG // std::cout << " [ "; @@ -319,7 +319,7 @@ void DofObject::set_n_vars_per_group(const unsigned int s, for (unsigned int v=0; vn_vars(s); v++) libmesh_assert_equal_to (this->n_comp(s,v), 0); - + // again, all other system sizes shoudl be unchanged! for (unsigned int s_ctr=0; s_ctrn_systems(); s_ctr++) if (s_ctr != s) @@ -348,7 +348,7 @@ void DofObject::set_n_comp_group(const unsigned int s, { libmesh_assert_less (s, this->n_systems()); libmesh_assert_less (vg, this->n_var_groups(s)); - + // Check for trivial return if (ncomp == this->n_comp_group(s,vg)) return; @@ -362,7 +362,7 @@ void DofObject::set_n_comp_group(const unsigned int s, libmesh_error(); } #endif - + const unsigned int start_idx_sys = this->start_idx(s), n_vars_group = this->n_vars(s,vg), @@ -371,7 +371,7 @@ void DofObject::set_n_comp_group(const unsigned int s, libmesh_assert_less ((base_offset + 1), _idx_buf.size()); // if (ncomp) - // std::cout << "s,vg,ncomp=" + // std::cout << "s,vg,ncomp=" // << s << "," // << vg << "," // << ncomp << '\n'; @@ -383,7 +383,7 @@ void DofObject::set_n_comp_group(const unsigned int s, // We use (invalid_id - 1) to signify no // components for this object _idx_buf[base_offset + 1] = (ncomp == 0) ? invalid_id - 1 : invalid_id; - + // this->debug_buffer(); // std::cout << "s,vg = " << s << "," << vg << '\n' // << "base_offset=" << base_offset << '\n' @@ -420,7 +420,7 @@ void DofObject::set_dof_number(const unsigned int s, if (comp || vig) libmesh_assert ((dn == invalid_id && base_idx == invalid_id) || (dn == base_idx + vig*ncg + comp)); - + // only explicitly store the base index for vig==0, comp==0 else base_idx = dn; @@ -435,12 +435,12 @@ void DofObject::set_dof_number(const unsigned int s, libmesh_assert_equal_to (this->dof_number(s, var, comp), dn); } - + // FIXME: it'll be tricky getting this to work with 64-bit dof_id_type unsigned int DofObject::packed_indexing_size() const { - return + return #ifdef LIBMESH_ENABLE_AMR ((old_dof_object == NULL) ? 0 : old_dof_object->packed_indexing_size()) + 2 + #else @@ -450,7 +450,7 @@ unsigned int DofObject::packed_indexing_size() const } - + // FIXME: it'll be tricky getting this to work with 64-bit dof_id_type unsigned int DofObject::unpackable_indexing_size(std::vector::const_iterator begin) { diff --git a/src/base/libmesh.C b/src/base/libmesh.C index 61f993858f7..46082d25b5d 100644 --- a/src/base/libmesh.C +++ b/src/base/libmesh.C @@ -92,7 +92,7 @@ namespace { bool libmesh_initialized_slepc = false; #endif - + /** * Floating point exception handler -- courtesy of Cody Permann & MOOSE team @@ -114,19 +114,19 @@ namespace { default: std::cerr << "unrecognized"; break; } std::cout << ")!" << std::endl; - + std::cout << std::endl; std::cout << "To track this down, compile debug version, start debugger, set breakpoint for 'libmesh_handleFPE' and run" << std::endl; std::cout << "In gdb do:" << std::endl; std::cout << " break libmesh_handleFPE" << std::endl; std::cout << " run ..." << std::endl; std::cout << " bt" << std::endl; - + libmesh_error(); } - - + + /** * Toggle floating point exceptions -- courtesy of Cody Permann & MOOSE team */ @@ -135,26 +135,26 @@ namespace { #if !defined(LIBMESH_HAVE_FEENABLEEXCEPT) && defined(LIBMESH_HAVE_XMMINTRIN_H) static int flags = 0; #endif - + if (on) { struct sigaction new_action, old_action; - + #ifdef LIBMESH_HAVE_FEENABLEEXCEPT feenableexcept(FE_DIVBYZERO | FE_INVALID); #elif LIBMESH_HAVE_XMMINTRIN_H -# ifndef __SUNPRO_CC +# ifndef __SUNPRO_CC flags = _MM_GET_EXCEPTION_MASK(); // store the flags _MM_SET_EXCEPTION_MASK(flags & ~_MM_MASK_INVALID); # endif #endif - + // Set up the structure to specify the new action. new_action.sa_sigaction = libmesh_handleFPE; sigemptyset (&new_action.sa_mask); new_action.sa_flags = SA_SIGINFO; - + sigaction (SIGFPE, NULL, &old_action); if (old_action.sa_handler != SIG_IGN) sigaction (SIGFPE, &new_action, NULL); @@ -164,15 +164,15 @@ namespace { #ifdef LIBMESH_HAVE_FEDISABLEEXCEPT fedisableexcept(FE_DIVBYZERO | FE_INVALID); #elif LIBMESH_HAVE_XMMINTRIN_H -# ifndef __SUNPRO_CC +# ifndef __SUNPRO_CC _MM_SET_EXCEPTION_MASK(flags); -# endif +# endif #endif signal(SIGFPE, 0); } } - -} + +} @@ -512,7 +512,7 @@ void _init (int argc, const char* const* argv, if (libMesh::on_command_line("--enable-fpe")) enableFPE(true); - + // The library is now ready for use libMeshPrivateData::_is_initialized = true; @@ -659,7 +659,7 @@ int _close () if (libMesh::on_command_line("--enable-fpe")) enableFPE(false); - + // Return the number of outstanding objects. // This is equivalent to return 0 if all of diff --git a/src/base/libmesh_singleton.C b/src/base/libmesh_singleton.C index e1699ee2bd9..977c743291e 100644 --- a/src/base/libmesh_singleton.C +++ b/src/base/libmesh_singleton.C @@ -27,10 +27,10 @@ // -------------------------------------------------------- // Local anonymous namespace to hold miscelaneous bits -namespace +namespace { using namespace libMesh; - + // Mutex object for required locking typedef Threads::spin_mutex SingletonMutex; SingletonMutex singleton_mtx, setup_mtx; @@ -93,7 +93,7 @@ namespace libMesh { libmesh_assert (*it != NULL); delete *it; - *it = NULL; + *it = NULL; } singleton_cache.clear(); diff --git a/src/error_estimation/adjoint_refinement_estimator.C b/src/error_estimation/adjoint_refinement_estimator.C index 63bab6b574b..3033d0e6166 100644 --- a/src/error_estimation/adjoint_refinement_estimator.C +++ b/src/error_estimation/adjoint_refinement_estimator.C @@ -158,15 +158,15 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, system.solution->localize(*projected_solution, system.get_dof_map().get_send_list()); - // Rebuild the rhs with the projected primal solution + // Rebuild the rhs with the projected primal solution (dynamic_cast(system)).assembly(true, false); NumericVector & projected_residual = (dynamic_cast(system)).get_vector("RHS Vector"); projected_residual.close(); // Solve the adjoint problem on the refined FE space - system.adjoint_solve(); + system.adjoint_solve(); - // Now that we have the refined adjoint solution and the projected primal solution, + // Now that we have the refined adjoint solution and the projected primal solution, // we first compute the global QoI error estimate // Resize the computed_global_QoI_errors vector to hold the error estimates for each QoI @@ -176,10 +176,10 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // contributions from all of them for (unsigned int j=0; j != system.qoi.size(); j++) { - computed_global_QoI_errors[j] = projected_residual.dot(system.get_adjoint_solution(j)); + computed_global_QoI_errors[j] = projected_residual.dot(system.get_adjoint_solution(j)); } - - // Done with the global error estimates, now construct the element wise error indicators + + // Done with the global error estimates, now construct the element wise error indicators // We ought to account for 'spill-over' effects while computing the // element error indicators This happens because the same dof is @@ -189,7 +189,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // belongs to bool split_shared_dofs = false; - + if (split_shared_dofs) { // A map that relates a node id to an int that will tell us how many elements it is a node of @@ -198,8 +198,8 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // To fill this map, we will loop over elements, and then in each element, we will loop // over the nodes each element contains, and then query it for the number of coarse // grid elements it was a node of - - // We will be iterating over all the active elements in the fine mesh that live on + + // We will be iterating over all the active elements in the fine mesh that live on // this processor MeshBase::const_element_iterator elem_it = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator elem_end = mesh.active_local_elements_end(); @@ -212,7 +212,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, { // Pointer to this element const Elem* elem = *elem_it; - + // Loop over the nodes in the element for(unsigned int n=0; n != elem->n_nodes(); ++n) { @@ -225,7 +225,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // A processed node flag bool processed_node = false; - // Loop over existing processed nodes and see if + // Loop over existing processed nodes and see if // we have already done this one for(std::size_t i = 0; i != processed_node_ids.size(); i++) { @@ -234,38 +234,38 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, processed_node = true; } } - + // If we havent already processed this node, do so now if(!processed_node) - { + { // Declare a neighbor_set to be filled by the find_point_neighbors std::set fine_grid_neighbor_set; - + // Call find_point_neighbors to fill the neighbor_set elem->find_point_neighbors(*node, fine_grid_neighbor_set); - + // A vector to hold the coarse grid parents neighbors std::vector coarse_grid_neighbors; - + // Iterators over the fine grid neighbors set std::set::iterator fine_neighbor_it = fine_grid_neighbor_set.begin(); const std::set::iterator fine_neighbor_end = fine_grid_neighbor_set.end(); - + // Loop over all the fine neighbors of this node for(; fine_neighbor_it != fine_neighbor_end ; ++fine_neighbor_it) { // Pointer to the current fine neighbor element const Elem* fine_elem = *fine_neighbor_it; - + // Find the element id for the corresponding coarse grid element const Elem* coarse_elem = fine_elem; for (unsigned int j = 0; j != number_h_refinements; ++j) - { + { libmesh_assert (coarse_elem->parent()); coarse_elem = coarse_elem->parent(); } - + // Loop over the existing coarse neighbors and check if this one is // already in there const dof_id_type coarse_id = coarse_elem->id(); @@ -277,7 +277,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, { break; } - } + } // If we didn't leave the loop even at the last element, // this is a new neighbour, put in the coarse_grid_neighbor_set @@ -287,7 +287,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, } } // End loop over fine neighbors - + // Set the shared_neighbour index for this node to the // size of the coarse grid neighbor set shared_element_count[node_id] = @@ -295,22 +295,22 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // Add this node to processed_node_ids vector processed_node_ids.push_back(node_id); - + } // End if processed node - + } // End loop over nodes - + } // End loop over elems } // if (split_shared_dofs) // Get a DoF map, will be used to get the nodal dof_indices for each element DofMap &dof_map = system.get_dof_map(); - + // The global DOF indices, we will use these later on when we compute the element wise indicators std::vector dof_indices; - // Localize the global rhs and adjoint solution vectors (which might be shared on multiple processsors) onto a + // Localize the global rhs and adjoint solution vectors (which might be shared on multiple processsors) onto a // local ghosted vector, this ensures each processor has all the dof_indices to compute an error indicator for // an element it owns AutoPtr > localized_projected_residual = NumericVector::build(); @@ -330,9 +330,9 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, { // Get the weight for the current QoI Real error_weight = _qoi_set.weight(i); - + (system.get_adjoint_solution(i)).localize(*localized_adjoint_solution, system.get_dof_map().get_send_list()); - + // Loop over elements MeshBase::const_element_iterator elem_it = mesh.active_local_elements_begin(); const MeshBase::const_element_iterator elem_end = mesh.active_local_elements_end(); @@ -341,12 +341,12 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, { // Pointer to the element const Elem* elem = *elem_it; - + // Go up number_h_refinements levels up to find the coarse parent const Elem* coarse = elem; for (unsigned int j = 0; j != number_h_refinements; ++j) - { + { libmesh_assert (coarse->parent()); coarse = coarse->parent(); @@ -356,7 +356,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // Get the local to global degree of freedom maps for this element dof_map.dof_indices (elem, dof_indices); - + // We will have to manually do the dot products. Number local_contribution = 0.; @@ -365,7 +365,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // The contribution to the error indicator for this element from the current QoI local_contribution += (*localized_projected_residual)(dof_indices[j]) * (*localized_adjoint_solution)(dof_indices[j]); } - + // Multiply by the error weight for this QoI local_contribution *= error_weight; @@ -377,9 +377,9 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, } // End loop over elements } // End if belong to QoI set - + } // End loop over QoIs - + // Don't bother projecting the solution; we'll restore from backup // after coarsening system.project_solution_on_reinit() = false; @@ -403,16 +403,16 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, // We should be back where we started libmesh_assert_equal_to (n_coarse_elem, mesh.n_elem()); - // Restore old solutions and clean up the heap + // Restore old solutions and clean up the heap system.project_solution_on_reinit() = old_projection_setting; - + // Restore the coarse solution vectors and delete their copies *system.solution = *coarse_solution; delete coarse_solution; *system.current_local_solution = *coarse_local_solution; delete coarse_local_solution; delete projected_solution; - + for (System::vectors_iterator vec = system.vectors_begin(); vec != system.vectors_end(); ++vec) { @@ -420,7 +420,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, const std::string& var_name = vec->first; system.get_vector(var_name) = *coarse_vectors[var_name]; - + coarse_vectors[var_name]->clear(); delete coarse_vectors[var_name]; } @@ -430,7 +430,7 @@ void AdjointRefinementEstimator::estimate_error (const System& _system, mesh.allow_renumbering(old_renumbering_setting); } // end estimate_error function - + }// namespace libMesh #endif // #ifdef LIBMESH_ENABLE_AMR diff --git a/src/error_estimation/adjoint_residual_error_estimator.C b/src/error_estimation/adjoint_residual_error_estimator.C index 93b1095e680..e1ce9e236ca 100644 --- a/src/error_estimation/adjoint_residual_error_estimator.C +++ b/src/error_estimation/adjoint_residual_error_estimator.C @@ -37,7 +37,7 @@ namespace libMesh //----------------------------------------------------------------- // AdjointResidualErrorEstimator implementations -AdjointResidualErrorEstimator::AdjointResidualErrorEstimator () : +AdjointResidualErrorEstimator::AdjointResidualErrorEstimator () : error_plot_suffix(), _primal_error_estimator(new PatchRecoveryErrorEstimator()), _dual_error_estimator(new PatchRecoveryErrorEstimator()), @@ -178,7 +178,7 @@ void AdjointResidualErrorEstimator::estimate_error (const System& _system, // Now fill in total_dual_error ErrorMap with the weight (*total_dual_errors_per_cell[std::make_pair(&_system, v)])[e] += static_cast - (error_weight * + (error_weight * (*dual_errors_per_cell[std::make_pair(&_system, v)])[e]); } } diff --git a/src/error_estimation/exact_solution.C b/src/error_estimation/exact_solution.C index 49af68ae6b9..c929a0b0dc7 100644 --- a/src/error_estimation/exact_solution.C +++ b/src/error_estimation/exact_solution.C @@ -304,7 +304,7 @@ void ExactSolution::compute_error(const std::string& sys_name, libmesh_assert( _equation_systems.has_system(sys_name) ); const System& sys = _equation_systems.get_system( sys_name ); - + libmesh_assert( sys.has_variable( unknown_name ) ); switch( FEInterface::field_type(sys.variable_type( unknown_name )) ) { @@ -402,7 +402,7 @@ Real ExactSolution::error_norm(const std::string& sys_name, return error_vals[3]; case L_INF: return error_vals[4]; - + // Currently only Sobolev norms/seminorms are supported default: libmesh_error(); @@ -639,7 +639,7 @@ void ExactSolution::_compute_error(const std::string& sys_name, const std::vector >& phi_values = fe->get_phi(); // The value of the shape function gradients at the quadrature points - const std::vector::OutputGradient> >& + const std::vector::OutputGradient> >& dphi_values = fe->get_dphi(); // The value of the shape function curls at the quadrature points @@ -658,8 +658,8 @@ void ExactSolution::_compute_error(const std::string& sys_name, #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES // The value of the shape function second derivatives at the quadrature points - const std::vector::OutputTensor> >& - d2phi_values = fe->get_d2phi(); + const std::vector::OutputTensor> >& + d2phi_values = fe->get_d2phi(); #endif // The XYZ locations (in physical space) of the quadrature points @@ -696,7 +696,7 @@ void ExactSolution::_compute_error(const std::string& sys_name, const unsigned int n_qp = qrule->n_points(); // The number of shape functions - const unsigned int n_sf = + const unsigned int n_sf = libmesh_cast_int(dof_indices.size()); // @@ -780,7 +780,7 @@ void ExactSolution::_compute_error(const std::string& sys_name, } const typename FEGenericBase::OutputNumberGradient grad_error = grad_u_h - exact_grad; - + error_vals[1] += JxW[qp]*grad_error.size_sq(); @@ -800,7 +800,7 @@ void ExactSolution::_compute_error(const std::string& sys_name, } const typename FEGenericBase::OutputNumber curl_error = curl_u_h - exact_curl; - + error_vals[5] += JxW[qp]*TensorTools::norm_sq(curl_error); // Compute the value of the error in the divergence at this @@ -815,9 +815,9 @@ void ExactSolution::_compute_error(const std::string& sys_name, // FIXME: Need to implement div for MeshFunction and support reference // solution for vector-valued elements } - + const typename FEGenericBase::OutputNumberDivergence div_error = div_u_h - exact_div; - + error_vals[6] += JxW[qp]*TensorTools::norm_sq(div_error); } @@ -828,7 +828,7 @@ void ExactSolution::_compute_error(const std::string& sys_name, RawAccessor::OutputNumberTensor> exact_hess_accessor( exact_hess, dim ); if (_exact_hessians.size() > sys_num && _exact_hessians[sys_num]) { - //FIXME: This needs to be implemented to support rank 3 tensors + //FIXME: This needs to be implemented to support rank 3 tensors // which can't happen until type_n_tensor is fully implemented // and a RawAccessor is fully implemented if( FEInterface::field_type(fe_type) == TYPE_VECTOR ) @@ -846,9 +846,9 @@ void ExactSolution::_compute_error(const std::string& sys_name, // FIXME: Needs to be updated for vector-valued elements exact_hess = coarse_values->hessian(q_point[qp]); } - + const typename FEGenericBase::OutputNumberTensor grad2_error = grad2_u_h - exact_hess; - + // FIXME: PB: Is this what we want for rank 3 tensors? error_vals[2] += JxW[qp]*grad2_error.size_sq(); #endif diff --git a/src/error_estimation/fourth_error_estimators.C b/src/error_estimation/fourth_error_estimators.C index f3d55e37c7d..c27aaec856a 100644 --- a/src/error_estimation/fourth_error_estimators.C +++ b/src/error_estimation/fourth_error_estimators.C @@ -143,5 +143,3 @@ LaplacianErrorEstimator::internal_side_integration () } // namespace libMesh #endif // defined (LIBMESH_ENABLE_SECOND_DERIVATIVES) - - diff --git a/src/error_estimation/hp_coarsentest.C b/src/error_estimation/hp_coarsentest.C index a82a553689b..fc50ed55f99 100644 --- a/src/error_estimation/hp_coarsentest.C +++ b/src/error_estimation/hp_coarsentest.C @@ -291,7 +291,7 @@ void HPCoarsenTest::select_refinement (System &system) const unsigned int n_qp = qrule->n_points(); // The number of DOFS on the fine element - const unsigned int n_dofs = + const unsigned int n_dofs = libmesh_cast_int(dof_indices.size()); // The number of nodes on the fine element @@ -573,7 +573,7 @@ libMesh::err << "Cell " << e_id << ": h = " << elem->hmax() << " new_h_dofs = " << new_h_dofs << ", new_p_dofs = " << new_p_dofs << std::endl; */ - const Real p_value = + const Real p_value = std::sqrt(p_error_per_cell[e_id]) * p_weight / new_p_dofs; const Real h_value = std::sqrt(h_error_per_cell[e_id]) / diff --git a/src/error_estimation/hp_selector.C b/src/error_estimation/hp_selector.C index 2684008f97b..06a15e81045 100644 --- a/src/error_estimation/hp_selector.C +++ b/src/error_estimation/hp_selector.C @@ -23,4 +23,3 @@ //----------------------------------------------------------------- // No implementations necessary for abstract class HPSelector - diff --git a/src/error_estimation/jump_error_estimator.C b/src/error_estimation/jump_error_estimator.C index ca9a0be334a..02f841e7321 100644 --- a/src/error_estimation/jump_error_estimator.C +++ b/src/error_estimation/jump_error_estimator.C @@ -242,7 +242,7 @@ void JumpErrorEstimator::estimate_error (const System& system, error_per_cell[fine_elem->id()] += static_cast(fine_error); - error_per_cell[coarse_elem->id()] += + error_per_cell[coarse_elem->id()] += static_cast(coarse_error); // Keep track of the number of internal flux @@ -296,7 +296,7 @@ void JumpErrorEstimator::estimate_error (const System& system, dof_map.dof_indices (coarse_elem, dof_indices_coarse, var); // The number of DOFS on each element - const unsigned int n_dofs_fine = + const unsigned int n_dofs_fine = libmesh_cast_int(dof_indices_fine.size()); const unsigned int n_dofs_coarse = libmesh_cast_int(dof_indices_coarse.size()); diff --git a/src/error_estimation/patch_recovery_error_estimator.C b/src/error_estimation/patch_recovery_error_estimator.C index 50729eb94ad..96dab36992a 100644 --- a/src/error_estimation/patch_recovery_error_estimator.C +++ b/src/error_estimation/patch_recovery_error_estimator.C @@ -958,4 +958,3 @@ void PatchRecoveryErrorEstimator::EstimateError::operator()(const ConstElemRange } // End () operator definition } // namespace libMesh - diff --git a/src/error_estimation/weighted_patch_recovery_estimator.C b/src/error_estimation/weighted_patch_recovery_estimator.C index 1c26e04296c..60eab039326 100644 --- a/src/error_estimation/weighted_patch_recovery_estimator.C +++ b/src/error_estimation/weighted_patch_recovery_estimator.C @@ -47,7 +47,7 @@ void WeightedPatchRecoveryErrorEstimator::estimate_error (const System& system, bool) { START_LOG("estimate_error()", "WeightedPatchRecoveryErrorEstimator"); - + // The current mesh const MeshBase& mesh = system.get_mesh(); @@ -133,9 +133,9 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE // next element if(this->error_estimator.patch_reuse && error_per_cell[e_id] != 0) continue; - + // If we are not reusing patches or havent built one containing this element, we build one - + // Use user specified patch size and growth strategy patch.build_around_element (elem, error_estimator.target_patch_size, error_estimator.patch_growth_strategy); @@ -316,7 +316,7 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE // contribution to the patch gradient projection. Patch::const_iterator patch_it = patch.begin(); const Patch::const_iterator patch_end = patch.end(); - + for (; patch_it != patch_end; ++patch_it) { // The pth element in the patch @@ -324,7 +324,7 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE // Reinitialize the finite element data for this element fe->reinit (e_p); - + // Get the global DOF indices for the current variable // in the current element dof_map.dof_indices (e_p, dof_indices, var); @@ -333,7 +333,7 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE const unsigned int n_dofs = libmesh_cast_int(dof_indices.size()); const unsigned int n_qp = qrule->n_points(); - + // Compute the weighted projection components from this cell. // \int_{Omega_e} \psi_i \psi_j = \int_{Omega_e} w * du_h/dx_k \psi_i for (unsigned int qp=0; qpinit_context(femcontext); - + // Loop over every element in the patch for (unsigned int e = 0 ; patch_re_it != patch_re_end; patch_re_it++, ++e) { @@ -574,14 +574,14 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE // The pth element in the patch const Elem* e_p = *patch_re_it; - + // We'll need an index into the error vector for this element const dof_id_type e_p_id = e_p->id(); - + // Get a pointer to the element, we need it to initialize // the FEMContext Elem *e_p_cast = const_cast(*patch_re_it); - + // Initialize the FEMContext femcontext.pre_fe_reinit(system, e_p_cast); @@ -619,7 +619,7 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE fe->attach_quadrature_rule (&samprule); // The number of points we will sample over - const unsigned int n_sp = + const unsigned int n_sp = libmesh_cast_int(JxW.size()); // Loop over every sample point for the current element @@ -775,14 +775,14 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE libmesh_error(); #endif } - + // Get the weight from the user code - Number weight = (*error_estimator.weight_functions[var])(femcontext, q_point[sp], system.time); + Number weight = (*error_estimator.weight_functions[var])(femcontext, q_point[sp], system.time); // Add up relevant terms. We can easily optimize the // LIBMESH_DIM < 3 cases a little bit with the exception // of the W2 cases - + if (error_estimator.error_norm.type(var) == L_INF) element_error = std::max(element_error, std::abs(weight*temperr[0])); else if (error_estimator.error_norm.type(var) == W1_INF_SEMINORM) @@ -895,10 +895,9 @@ void WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(const ConstE } // End loop over every element in patch - + } // end element loop } // End () operator definition } // namespace libMesh - diff --git a/src/fe/fe.C b/src/fe/fe.C index e90cfc500ef..ad2f86d4c16 100644 --- a/src/fe/fe.C +++ b/src/fe/fe.C @@ -247,7 +247,7 @@ void FE::init_shape_functions(const std::vector& qp, // If the user forgot to request anything, we'll be safe and // calculate everything: #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES - if (!this->calculate_phi && !this->calculate_dphi && !this->calculate_d2phi + if (!this->calculate_phi && !this->calculate_dphi && !this->calculate_d2phi && !this->calculate_curl_phi && !this->calculate_div_phi) { this->calculate_phi = this->calculate_dphi = this->calculate_d2phi = this->calculate_dphiref = true; @@ -307,7 +307,7 @@ void FE::init_shape_functions(const std::vector& qp, if (Dim > 2) this->dphidzeta.resize (n_approx_shape_functions); } - + if( this->calculate_curl_phi && (FEInterface::field_type(T) == TYPE_VECTOR) ) this->curl_phi.resize(n_approx_shape_functions); @@ -353,7 +353,7 @@ void FE::init_shape_functions(const std::vector& qp, this->dphidy[i].resize (n_qp); this->dphidz[i].resize (n_qp); } - + if(this->calculate_dphiref) { if (Dim > 0) @@ -476,7 +476,7 @@ void FE::init_shape_functions(const std::vector& qp, } #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES - + break; } diff --git a/src/fe/fe_abstract.C b/src/fe/fe_abstract.C index 35f82661277..f9011196be1 100644 --- a/src/fe/fe_abstract.C +++ b/src/fe/fe_abstract.C @@ -334,7 +334,7 @@ AutoPtr FEAbstract::build( const unsigned int dim, AutoPtr ap(new FE<3,LAGRANGE>(fet)); return ap; } - + case LAGRANGE_VEC: { AutoPtr ap(new FE<3,LAGRANGE_VEC>(fet)); diff --git a/src/fe/fe_boundary.C b/src/fe/fe_boundary.C index 4b6807353e0..860c0024dcb 100644 --- a/src/fe/fe_boundary.C +++ b/src/fe/fe_boundary.C @@ -318,7 +318,7 @@ void FE::edge_reinit(const Elem* elem, // Find where the integration points are located on the // full element. - std::vector qp; + std::vector qp; this->inverse_map (elem, this->_fe_map->get_xyz(), qp, tolerance); // compute the shape function and derivative values diff --git a/src/fe/fe_hermite_shape_1D.C b/src/fe/fe_hermite_shape_1D.C index 5afca534247..d0bdde44a9e 100644 --- a/src/fe/fe_hermite_shape_1D.C +++ b/src/fe/fe_hermite_shape_1D.C @@ -65,7 +65,7 @@ namespace if(!old_elem_id_exists) old_elem_id = libMesh::invalid_uint; - + // Coefficients are cached from old elements // ... except that we can't be sure that a renumbering didn't // cause the first element id in a new assembly to match the @@ -257,7 +257,7 @@ Real FE<1,HERMITE>::shape(const Elem* elem, libmesh_assert(elem); hermite_compute_coefs(elem); - + #ifdef LIBMESH_HAVE_TBB_API Real & d1xd1x = d1xd1x_tls.local(); Real & d2xd2x = d2xd2x_tls.local(); @@ -338,7 +338,7 @@ Real FE<1,HERMITE>::shape_deriv(const Elem* elem, libmesh_assert(elem); hermite_compute_coefs(elem); - + #ifdef LIBMESH_HAVE_TBB_API Real & d1xd1x = d1xd1x_tls.local(); Real & d2xd2x = d2xd2x_tls.local(); @@ -400,7 +400,7 @@ Real FE<1,HERMITE>::shape_second_deriv(const Elem* elem, libmesh_assert(elem); hermite_compute_coefs(elem); - + #ifdef LIBMESH_HAVE_TBB_API Real & d1xd1x = d1xd1x_tls.local(); Real & d2xd2x = d2xd2x_tls.local(); diff --git a/src/fe/fe_hermite_shape_2D.C b/src/fe/fe_hermite_shape_2D.C index e52487bcb6c..a8455f5501e 100644 --- a/src/fe/fe_hermite_shape_2D.C +++ b/src/fe/fe_hermite_shape_2D.C @@ -63,7 +63,7 @@ namespace if(!old_elem_id_exists) old_elem_id = libMesh::invalid_uint; - + // Coefficients are cached from old elements // ... except that we can't be sure that a renumbering didn't // cause the first element id in a new assembly to match the @@ -264,7 +264,7 @@ Real FE<2,HERMITE>::shape(const Elem* elem, hermite_compute_coefs(elem); -#ifdef LIBMESH_HAVE_TBB_API +#ifdef LIBMESH_HAVE_TBB_API std::vector > & dxdxi = dxdxi_tls.local(); #endif // LIBMESH_HAVE_TBB_API @@ -328,7 +328,7 @@ Real FE<2,HERMITE>::shape_deriv(const Elem* elem, hermite_compute_coefs(elem); -#ifdef LIBMESH_HAVE_TBB_API +#ifdef LIBMESH_HAVE_TBB_API std::vector > & dxdxi = dxdxi_tls.local(); #endif // LIBMESH_HAVE_TBB_API @@ -386,7 +386,7 @@ Real FE<2,HERMITE>::shape_second_deriv(const Elem* elem, hermite_compute_coefs(elem); -#ifdef LIBMESH_HAVE_TBB_API +#ifdef LIBMESH_HAVE_TBB_API std::vector > & dxdxi = dxdxi_tls.local(); #endif // LIBMESH_HAVE_TBB_API diff --git a/src/fe/fe_hermite_shape_3D.C b/src/fe/fe_hermite_shape_3D.C index d91374c26bd..16d4fc49e9f 100644 --- a/src/fe/fe_hermite_shape_3D.C +++ b/src/fe/fe_hermite_shape_3D.C @@ -71,7 +71,7 @@ static tbb::enumerable_thread_specific< std::vector > dzdxi_tls, dxdeta_tl if(!old_elem_id_exists) old_elem_id = libMesh::invalid_uint; - + // Coefficients are cached from old elements // ... except that we can't be sure that a renumbering didn't // cause the first element id in a new assembly to match the @@ -91,14 +91,14 @@ static tbb::enumerable_thread_specific< std::vector > dzdxi_tls, dxdeta_tl for(unsigned int i=0; i<3; i++) dxdxi[i].resize(2); } - + #ifdef DEBUG // We will just reuse dxdxi_exists, because if it didn't exist then neither did these! std::vector & dydxi = dydxi_tls.local(); std::vector & dzdeta = dzdeta_tls.local(); std::vector & dxdzeta = dxdzeta_tls.local(); - + std::vector & dzdxi = dzdxi_tls.local(); std::vector & dxdeta = dxdeta_tls.local(); std::vector & dydzeta = dydzeta_tls.local(); @@ -472,7 +472,7 @@ Real FE<3,HERMITE>::shape(const Elem* elem, hermite_compute_coefs(elem); -#ifdef LIBMESH_HAVE_TBB_API +#ifdef LIBMESH_HAVE_TBB_API std::vector > & dxdxi = dxdxi_tls.local(); #endif // LIBMESH_HAVE_TBB_API diff --git a/src/fe/fe_interface.C b/src/fe/fe_interface.C index 3509ecc9c87..a5b91d24cff 100644 --- a/src/fe/fe_interface.C +++ b/src/fe/fe_interface.C @@ -754,7 +754,7 @@ void FEInterface::shape(const unsigned int dim, fe_vector_scalar_error_switch(3, shape(t,o,i,p), phi = , ; break;); break; } - + return; } @@ -882,7 +882,7 @@ void FEInterface::compute_constraints (DofConstraints &constraints, variable_number, elem); return; - + default: return; } diff --git a/src/fe/fe_interface_inf_fe.C b/src/fe/fe_interface_inf_fe.C index 590edd273d0..7cbd08fff81 100644 --- a/src/fe/fe_interface_inf_fe.C +++ b/src/fe/fe_interface_inf_fe.C @@ -990,4 +990,3 @@ void FEInterface::ifem_compute_data(const unsigned int dim, } // namespace libMesh #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/fe_lagrange_vec.C b/src/fe/fe_lagrange_vec.C index 08d90a07a97..003ed812ae0 100644 --- a/src/fe/fe_lagrange_vec.C +++ b/src/fe/fe_lagrange_vec.C @@ -247,7 +247,7 @@ namespace libMesh nodal_soln[21] = elem_soln[21]; nodal_soln[22] = elem_soln[22]; nodal_soln[23] = elem_soln[23]; - + // node 8 components nodal_soln[24] = .5*(elem_soln[0] + elem_soln[3]); nodal_soln[25] = .5*(elem_soln[1] + elem_soln[4]); @@ -481,17 +481,17 @@ namespace libMesh // By default the element solution _is_ nodal, // so just copy it. nodal_soln = elem_soln; - + return; } } } - + default: { } - + } // switch(totalorder) }// void lagrange_vec_nodal_soln @@ -515,7 +515,7 @@ namespace libMesh const std::vector& elem_soln, std::vector& nodal_soln) { FE<1,LAGRANGE>::nodal_soln(elem, order, elem_soln, nodal_soln); } - + template <> void FE<2,LAGRANGE_VEC>::nodal_soln(const Elem* elem, const Order order, @@ -537,7 +537,7 @@ namespace libMesh template <> RealGradient FE<0,LAGRANGE_VEC>::shape(const ElemType type, const Order order, const unsigned int i, const Point& p) { - Real value = FE<0,LAGRANGE>::shape( type, order, i, p ); + Real value = FE<0,LAGRANGE>::shape( type, order, i, p ); return libMesh::RealGradient( value ); } template <> RealGradient FE<0,LAGRANGE_VEC>::shape_deriv(const ElemType type, const Order order, @@ -554,12 +554,12 @@ namespace libMesh Real value = FE<0,LAGRANGE>::shape_second_deriv( type, order, i, j, p ); return libMesh::RealGradient( value ); } - + // 1-D template <> RealGradient FE<1,LAGRANGE_VEC>::shape(const ElemType type, const Order order, const unsigned int i, const Point& p) { - Real value = FE<1,LAGRANGE>::shape( type, order, i, p ); + Real value = FE<1,LAGRANGE>::shape( type, order, i, p ); return libMesh::RealGradient( value ); } template <> RealGradient FE<1,LAGRANGE_VEC>::shape_deriv(const ElemType type, const Order order, @@ -590,7 +590,7 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + default: libmesh_error(); } @@ -611,7 +611,7 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + default: libmesh_error(); } @@ -632,7 +632,7 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + default: libmesh_error(); } @@ -655,10 +655,10 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + case 2: return libMesh::RealGradient( Real(0), Real(0), value ); - + default: libmesh_error(); } @@ -679,10 +679,10 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + case 2: return libMesh::RealGradient( Real(0), Real(0), value ); - + default: libmesh_error(); } @@ -703,10 +703,10 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + case 2: return libMesh::RealGradient( Real(0), Real(0), value ); - + default: libmesh_error(); } @@ -718,47 +718,47 @@ namespace libMesh // 0-D - template <> RealGradient FE<0,LAGRANGE_VEC>::shape(const Elem* elem, const Order order, - const unsigned int i, const Point& p) - { - Real value = FE<0,LAGRANGE>::shape( elem->type(), static_cast(order + elem->p_level()), i, p); - return libMesh::RealGradient( value ); - } - template <> RealGradient FE<0,LAGRANGE_VEC>::shape_deriv(const Elem* elem, const Order order, - const unsigned int i, const unsigned int j, - const Point& p) - { - Real value = FE<0,LAGRANGE>::shape_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); - return libMesh::RealGradient( value ); - } - template <> RealGradient FE<0,LAGRANGE_VEC>::shape_second_deriv(const Elem* elem, const Order order, - const unsigned int i, const unsigned int j, - const Point& p) - { - Real value = FE<0,LAGRANGE>::shape_second_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); - return libMesh::RealGradient( value ); + template <> RealGradient FE<0,LAGRANGE_VEC>::shape(const Elem* elem, const Order order, + const unsigned int i, const Point& p) + { + Real value = FE<0,LAGRANGE>::shape( elem->type(), static_cast(order + elem->p_level()), i, p); + return libMesh::RealGradient( value ); } - + template <> RealGradient FE<0,LAGRANGE_VEC>::shape_deriv(const Elem* elem, const Order order, + const unsigned int i, const unsigned int j, + const Point& p) + { + Real value = FE<0,LAGRANGE>::shape_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); + return libMesh::RealGradient( value ); + } + template <> RealGradient FE<0,LAGRANGE_VEC>::shape_second_deriv(const Elem* elem, const Order order, + const unsigned int i, const unsigned int j, + const Point& p) + { + Real value = FE<0,LAGRANGE>::shape_second_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); + return libMesh::RealGradient( value ); + } + // 1-D - template <> RealGradient FE<1,LAGRANGE_VEC>::shape(const Elem* elem, const Order order, - const unsigned int i, const Point& p) - { - Real value = FE<1,LAGRANGE>::shape( elem->type(), static_cast(order + elem->p_level()), i, p); - return libMesh::RealGradient( value ); - } - template <> RealGradient FE<1,LAGRANGE_VEC>::shape_deriv(const Elem* elem, const Order order, - const unsigned int i, const unsigned int j, - const Point& p) - { - Real value = FE<1,LAGRANGE>::shape_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); - return libMesh::RealGradient( value ); - } - template <> RealGradient FE<1,LAGRANGE_VEC>::shape_second_deriv(const Elem* elem, const Order order, - const unsigned int i, const unsigned int j, - const Point& p) - { - Real value = FE<1,LAGRANGE>::shape_second_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); - return libMesh::RealGradient( value ); + template <> RealGradient FE<1,LAGRANGE_VEC>::shape(const Elem* elem, const Order order, + const unsigned int i, const Point& p) + { + Real value = FE<1,LAGRANGE>::shape( elem->type(), static_cast(order + elem->p_level()), i, p); + return libMesh::RealGradient( value ); + } + template <> RealGradient FE<1,LAGRANGE_VEC>::shape_deriv(const Elem* elem, const Order order, + const unsigned int i, const unsigned int j, + const Point& p) + { + Real value = FE<1,LAGRANGE>::shape_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); + return libMesh::RealGradient( value ); + } + template <> RealGradient FE<1,LAGRANGE_VEC>::shape_second_deriv(const Elem* elem, const Order order, + const unsigned int i, const unsigned int j, + const Point& p) + { + Real value = FE<1,LAGRANGE>::shape_second_deriv( elem->type(), static_cast(order + elem->p_level()), i, j, p); + return libMesh::RealGradient( value ); } // 2-D @@ -774,7 +774,7 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + default: libmesh_error(); } @@ -795,7 +795,7 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + default: libmesh_error(); } @@ -816,7 +816,7 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + default: libmesh_error(); } @@ -838,10 +838,10 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + case 2: return libMesh::RealGradient( Real(0), Real(0), value ); - + default: libmesh_error(); } @@ -862,10 +862,10 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + case 2: return libMesh::RealGradient( Real(0), Real(0), value ); - + default: libmesh_error(); } @@ -886,10 +886,10 @@ namespace libMesh case 1: return libMesh::RealGradient( Real(0), value ); - + case 2: return libMesh::RealGradient( Real(0), Real(0), value ); - + default: libmesh_error(); } @@ -951,7 +951,7 @@ namespace libMesh const unsigned int variable_number, const Elem* elem) { //libmesh_not_implemented(); - FEVectorBase::compute_proj_constraints(constraints, dof_map, variable_number, elem); + FEVectorBase::compute_proj_constraints(constraints, dof_map, variable_number, elem); } template <> @@ -960,7 +960,7 @@ namespace libMesh const unsigned int variable_number, const Elem* elem) { //libmesh_not_implemented(); - FEVectorBase::compute_proj_constraints(constraints, dof_map, variable_number, elem); + FEVectorBase::compute_proj_constraints(constraints, dof_map, variable_number, elem); } #endif // LIBMESH_ENABLE_AMR diff --git a/src/fe/fe_map.C b/src/fe/fe_map.C index 3d97a4018f8..e13d2b42e6b 100644 --- a/src/fe/fe_map.C +++ b/src/fe/fe_map.C @@ -41,7 +41,7 @@ AutoPtr FEMap::build( FEType fe_type ) { AutoPtr ap( new FEXYZMap ); return ap; - } + } default: { AutoPtr ap( new FEMap ); @@ -74,7 +74,7 @@ void FEMap::init_reference_to_physical_map( const std::vector& qp, const unsigned int n_mapping_shape_functions = FE::n_shape_functions (mapping_elem_type, mapping_order); - + this->phi_map.resize (n_mapping_shape_functions); if (Dim > 0) { @@ -292,10 +292,10 @@ void FEMap::init_reference_to_physical_map( const std::vector& qp, this->d2phidzeta2_map[i][p] = FE::shape_second_deriv (mapping_elem_type, mapping_order, i, 5, qp[p]); #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES } - + break; } - + default: libmesh_error(); } diff --git a/src/fe/fe_nedelec_one.C b/src/fe/fe_nedelec_one.C index 6b88d5799b0..cb59597dc8a 100644 --- a/src/fe/fe_nedelec_one.C +++ b/src/fe/fe_nedelec_one.C @@ -94,7 +94,7 @@ namespace libMesh libmesh_assert_equal_to (nodal_soln.size(), 27*3); libmesh_not_implemented(); - + break; } @@ -109,20 +109,20 @@ namespace libMesh const unsigned int n_sf = FEInterface::n_shape_functions(dim, fe_type, elem_type); - + std::vector refspace_nodes; FEVectorBase::get_refspace_nodes(elem_type,refspace_nodes); libmesh_assert_equal_to (refspace_nodes.size(), n_nodes); - - + + // Need to create new fe object so the shape function as the FETransformation // applied to it. AutoPtr vis_fe = FEVectorBase::build(dim,fe_type); - + const std::vector >& vis_phi = vis_fe->get_phi(); - + vis_fe->reinit(elem,&refspace_nodes); - + for( unsigned int n = 0; n < n_nodes; n++ ) { libmesh_assert_equal_to (elem_soln.size(), n_sf); @@ -130,14 +130,14 @@ namespace libMesh // Zero before summation nodal_soln[2*n] = 0; nodal_soln[2*n+1] = 0; - - // u = Sum (u_i phi_i) + + // u = Sum (u_i phi_i) for (unsigned int i=0; i void FE<3,NEDELEC_ONE>::compute_constraints (DofConstraints &constraints, DofMap &dof_map, diff --git a/src/fe/fe_nedelec_one_shape_2D.C b/src/fe/fe_nedelec_one_shape_2D.C index 901aebf6558..72b3ee9633e 100644 --- a/src/fe/fe_nedelec_one_shape_2D.C +++ b/src/fe/fe_nedelec_one_shape_2D.C @@ -109,7 +109,7 @@ RealGradient FE<2,NEDELEC_ONE>::shape(const Elem* elem, libmesh_error(); } - + return RealGradient(); } @@ -220,7 +220,7 @@ RealGradient FE<2,NEDELEC_ONE>::shape_deriv(const Elem* elem, case QUAD9: { libmesh_assert_less (i, 4); - + switch (j) { // d()/dxi @@ -287,7 +287,7 @@ RealGradient FE<2,NEDELEC_ONE>::shape_deriv(const Elem* elem, case TRI6: { libmesh_assert_less (i, 3); - + // Account for edge flipping Real f = 1.0; @@ -370,7 +370,7 @@ RealGradient FE<2,NEDELEC_ONE>::shape_second_deriv(const ElemType, << std::endl; libmesh_error(); #endif // LIBMESH_DIM > 1 - + libmesh_error(); return RealGradient(); } @@ -437,7 +437,7 @@ RealGradient FE<2,NEDELEC_ONE>::shape_second_deriv(const Elem* elem, } // end switch (order) #endif // LIBMESH_DIM > 1 - + libmesh_error(); return RealGradient(); } diff --git a/src/fe/fe_nedelec_one_shape_3D.C b/src/fe/fe_nedelec_one_shape_3D.C index e19cbe02d76..d5881a7d33a 100644 --- a/src/fe/fe_nedelec_one_shape_3D.C +++ b/src/fe/fe_nedelec_one_shape_3D.C @@ -232,7 +232,7 @@ RealGradient FE<3,NEDELEC_ONE>::shape_second_deriv(const Elem* elem, case HEX27: { libmesh_assert_less (i, 12); - + libmesh_not_implemented(); return RealGradient(); } diff --git a/src/fe/fe_szabab_shape_2D.C b/src/fe/fe_szabab_shape_2D.C index 58a9848fe30..4b9c124f6f9 100644 --- a/src/fe/fe_szabab_shape_2D.C +++ b/src/fe/fe_szabab_shape_2D.C @@ -1417,4 +1417,3 @@ Real FE<2,SZABAB>::shape_second_deriv(const Elem*, #endif // LIBMESH_ENABLE_HIGHER_ORDER_SHAPES - diff --git a/src/fe/fe_szabab_shape_3D.C b/src/fe/fe_szabab_shape_3D.C index 7ebbf1ca737..b84b77e1ffb 100644 --- a/src/fe/fe_szabab_shape_3D.C +++ b/src/fe/fe_szabab_shape_3D.C @@ -110,4 +110,3 @@ Real FE<3,SZABAB>::shape_second_deriv(const Elem*, } // namespace libMesh #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES - diff --git a/src/fe/fe_transformation_base.C b/src/fe/fe_transformation_base.C index e7c0ac7a6d3..b83c4bb331c 100644 --- a/src/fe/fe_transformation_base.C +++ b/src/fe/fe_transformation_base.C @@ -62,7 +62,7 @@ namespace libMesh AutoPtr > ap( new H1FETransformation ); return ap; } - + default: libmesh_error(); } diff --git a/src/fe/fe_xyz.C b/src/fe/fe_xyz.C index 03c3b4847e2..3887b120da0 100644 --- a/src/fe/fe_xyz.C +++ b/src/fe/fe_xyz.C @@ -693,7 +693,7 @@ void FEXYZ::init_shape_functions(const std::vector& qp, } #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - + // Stop logging the shape function initialization STOP_LOG("init_shape_functions()", "FE"); } diff --git a/src/fe/fe_xyz_map.C b/src/fe/fe_xyz_map.C index b9a7d2c0117..88d40c419f0 100644 --- a/src/fe/fe_xyz_map.C +++ b/src/fe/fe_xyz_map.C @@ -32,7 +32,7 @@ void FEXYZMap::compute_face_map(int dim, const std::vector& qw, const Elem { case 2: { - + // Resize the vectors to hold data at the quadrature points { this->xyz.resize(n_qp); @@ -103,7 +103,7 @@ void FEXYZMap::compute_face_map(int dim, const std::vector& qw, const Elem this->JxW[p] = the_jac*qw[p]; } - + break; } diff --git a/src/fe/h1_fe_transformation.C b/src/fe/h1_fe_transformation.C index 40bb2fee868..fcc65d62c8e 100644 --- a/src/fe/h1_fe_transformation.C +++ b/src/fe/h1_fe_transformation.C @@ -85,7 +85,7 @@ namespace libMesh const FEGenericBase& fe, std::vector::OutputGradient> >& dphi, std::vector >& dphidx, - std::vector >& dphidy, + std::vector >& dphidy, std::vector >& dphidz ) const { switch(dim) @@ -111,13 +111,13 @@ namespace libMesh #if LIBMESH_DIM>2 const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); #endif - + for (unsigned int i=0; i1 dphi[i][p].slice(1) = dphidy[i][p] = dphidxi[i][p]*dxidy_map[p]; #endif @@ -125,10 +125,10 @@ namespace libMesh dphi[i][p].slice(2) = dphidz[i][p] = dphidxi[i][p]*dxidz_map[p]; #endif } - + break; } - + case 2: { const std::vector >& dphidxi = fe.get_dphidxi(); @@ -152,7 +152,7 @@ namespace libMesh // dphi/dx = (dphi/dxi)*(dxi/dx) + (dphi/deta)*(deta/dx) dphi[i][p].slice(0) = dphidx[i][p] = (dphidxi[i][p]*dxidx_map[p] + dphideta[i][p]*detadx_map[p]); - + // dphi/dy = (dphi/dxi)*(dxi/dy) + (dphi/deta)*(deta/dy) dphi[i][p].slice(1) = dphidy[i][p] = (dphidxi[i][p]*dxidy_map[p] + dphideta[i][p]*detady_map[p]); @@ -167,7 +167,7 @@ namespace libMesh break; } - case 3: + case 3: { const std::vector >& dphidxi = fe.get_dphidxi(); const std::vector >& dphideta = fe.get_dphideta(); @@ -176,15 +176,15 @@ namespace libMesh const std::vector& dxidx_map = fe.get_fe_map().get_dxidx(); const std::vector& dxidy_map = fe.get_fe_map().get_dxidy(); const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); - + const std::vector& detadx_map = fe.get_fe_map().get_detadx(); const std::vector& detady_map = fe.get_fe_map().get_detady(); const std::vector& detadz_map = fe.get_fe_map().get_detadz(); - + const std::vector& dzetadx_map = fe.get_fe_map().get_dzetadx(); const std::vector& dzetady_map = fe.get_fe_map().get_dzetady(); const std::vector& dzetadz_map = fe.get_fe_map().get_dzetadz(); - + for (unsigned int i=0; i& fe, std::vector::OutputTensor> >& d2phi, std::vector >& d2phidx2, - std::vector >& d2phidxdy, + std::vector >& d2phidxdy, std::vector >& d2phidxdz, std::vector >& d2phidy2, - std::vector >& d2phidydz, + std::vector >& d2phidydz, std::vector >& d2phidz2 ) const { libmesh_do_once( @@ -236,7 +236,7 @@ namespace libMesh << std::endl; } ); - + switch(dim) { @@ -262,14 +262,14 @@ namespace libMesh #if LIBMESH_DIM>2 const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); #endif - + for (unsigned int i=0; i1 - d2phi[i][p].slice(0).slice(1) = + d2phi[i][p].slice(0).slice(1) = d2phi[i][p].slice(1).slice(0) = d2phidxdy[i][p] = d2phidxi2[i][p]*dxidx_map[p]*dxidy_map[p]; @@ -303,13 +303,13 @@ namespace libMesh #if LIBMESH_DIM > 2 const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); #endif - + const std::vector& detadx_map = fe.get_fe_map().get_detadx(); const std::vector& detady_map = fe.get_fe_map().get_detady(); #if LIBMESH_DIM > 2 const std::vector& detadz_map = fe.get_fe_map().get_detadz(); #endif - + for (unsigned int i=0; i& dxidx_map = fe.get_fe_map().get_dxidx(); const std::vector& dxidy_map = fe.get_fe_map().get_dxidy(); const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); - + const std::vector& detadx_map = fe.get_fe_map().get_detadx(); const std::vector& detady_map = fe.get_fe_map().get_detady(); const std::vector& detadz_map = fe.get_fe_map().get_detadz(); - + const std::vector& dzetadx_map = fe.get_fe_map().get_dzetadx(); const std::vector& dzetady_map = fe.get_fe_map().get_dzetady(); const std::vector& dzetadz_map = fe.get_fe_map().get_dzetadz(); - + for (unsigned int i=0; i& dxidx_map = fe.get_fe_map().get_dxidx(); const std::vector& dxidy_map = fe.get_fe_map().get_dxidy(); const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); - + const std::vector& detadx_map = fe.get_fe_map().get_detadx(); const std::vector& detady_map = fe.get_fe_map().get_detady(); const std::vector& detadz_map = fe.get_fe_map().get_detadz(); - + const std::vector& dzetadx_map = fe.get_fe_map().get_dzetadx(); const std::vector& dzetady_map = fe.get_fe_map().get_dzetady(); const std::vector& dzetadz_map = fe.get_fe_map().get_dzetadz(); @@ -566,7 +566,7 @@ namespace libMesh Real dphiz_dx = (dphidxi[i][p].slice(2))*dxidx_map[p] + (dphideta[i][p].slice(2))*detadx_map[p] + (dphidzeta[i][p].slice(2))*dzetadx_map[p]; - + Real dphiy_dx = (dphidxi[i][p].slice(1))*dxidx_map[p] + (dphideta[i][p].slice(1))*detadx_map[p] + (dphidzeta[i][p].slice(1))*dzetadx_map[p]; @@ -591,7 +591,7 @@ namespace libMesh return; } - + template< > void H1FETransformation::map_div (const unsigned int, @@ -604,7 +604,7 @@ namespace libMesh << "makes sense for vector-valued elements." << std::endl; libmesh_error(); } - + template<> void H1FETransformation::map_div @@ -617,7 +617,7 @@ namespace libMesh switch(dim) { // The divergence only make sense in 2D and 3D - case 0: + case 0: case 1: { libmesh_error(); @@ -626,7 +626,7 @@ namespace libMesh { const std::vector >& dphidxi = fe.get_dphidxi(); const std::vector >& dphideta = fe.get_dphideta(); - + const std::vector& dxidx_map = fe.get_fe_map().get_dxidx(); const std::vector& dxidy_map = fe.get_fe_map().get_dxidy(); @@ -659,11 +659,11 @@ namespace libMesh const std::vector& dxidx_map = fe.get_fe_map().get_dxidx(); const std::vector& dxidy_map = fe.get_fe_map().get_dxidy(); const std::vector& dxidz_map = fe.get_fe_map().get_dxidz(); - + const std::vector& detadx_map = fe.get_fe_map().get_detadx(); const std::vector& detady_map = fe.get_fe_map().get_detady(); const std::vector& detadz_map = fe.get_fe_map().get_detadz(); - + const std::vector& dzetadx_map = fe.get_fe_map().get_dzetadx(); const std::vector& dzetady_map = fe.get_fe_map().get_dzetady(); const std::vector& dzetadz_map = fe.get_fe_map().get_dzetadz(); diff --git a/src/fe/hcurl_fe_transformation.C b/src/fe/hcurl_fe_transformation.C index 78766ec31e6..7faf83e99d6 100644 --- a/src/fe/hcurl_fe_transformation.C +++ b/src/fe/hcurl_fe_transformation.C @@ -31,12 +31,12 @@ namespace libMesh switch(dim) { // These element transformations only make sense in 2D and 3D - case 0: + case 0: case 1: { libmesh_error(); } - + case 2: { const std::vector& dxidx_map = fe.get_fe_map().get_dxidx(); @@ -46,9 +46,9 @@ namespace libMesh const std::vector& detady_map = fe.get_fe_map().get_detady(); // FIXME: Need to update for 2D elements in 3D space - /* phi = (dx/dxi)^-T * \hat{phi} + /* phi = (dx/dxi)^-T * \hat{phi} In 2D: - (dx/dxi)^{-1} = [ dxi/dx dxi/dy + (dx/dxi)^{-1} = [ dxi/dx dxi/dy deta/dx deta/dy ] so: dxi/dx^{-T} * \hat{phi} = [ dxi/dx deta/dx [ \hat{phi}_xi @@ -87,14 +87,14 @@ namespace libMesh const std::vector& dzetady_map = fe.get_fe_map().get_dzetady(); const std::vector& dzetadz_map = fe.get_fe_map().get_dzetadz(); - /* phi = (dx/dxi)^-T * \hat{phi} + /* phi = (dx/dxi)^-T * \hat{phi} In 3D: dx/dxi^-1 = [ dxi/dx dxi/dy dxi/dz deta/dx deta/dy deta/dz dzeta/dx dzeta/dy dzeta/dz] so: dxi/dx^-T * \hat{phi} = [ dxi/dx deta/dx dzeta/dx [ \hat{phi}_xi - dxi/dy deta/dy dzeta/dy \hat{phi}_eta + dxi/dy deta/dy dzeta/dy \hat{phi}_eta dxi/dz deta/dz dzeta/dz ] \hat{phi}_zeta ] or in indicial notation: phi_j = xi_{i,j}*\hat{phi}_i */ @@ -119,7 +119,7 @@ namespace libMesh } break; } - + default: libmesh_error(); @@ -138,12 +138,12 @@ namespace libMesh switch(dim) { // These element transformations only make sense in 2D and 3D - case 0: + case 0: case 1: { libmesh_error(); } - + case 2: { const std::vector >& dphi_dxi = fe.get_dphidxi(); @@ -169,7 +169,7 @@ namespace libMesh const std::vector >& dphi_dxi = fe.get_dphidxi(); const std::vector >& dphi_deta = fe.get_dphideta(); const std::vector >& dphi_dzeta = fe.get_dphidzeta(); - + const std::vector& dxyz_dxi = fe.get_fe_map().get_dxyzdxi(); const std::vector& dxyz_deta = fe.get_fe_map().get_dxyzdeta(); const std::vector& dxyz_dzeta = fe.get_fe_map().get_dxyzdzeta(); @@ -193,7 +193,7 @@ namespace libMesh const Real inv_jac = 1.0/J[p]; - /* In 3D: curl(phi) = J^{-1} dx/dxi * curl(\hat{phi}) + /* In 3D: curl(phi) = J^{-1} dx/dxi * curl(\hat{phi}) dx/dxi = [ dx/dxi dx/deta dx/dzeta dy/dxi dy/deta dy/dzeta @@ -203,34 +203,34 @@ namespace libMesh du_x/dzeta - du_z/dxi du_y/dxi - du_x/deta ] */ - curl_phi[i][p].slice(0) = inv_jac*( dx_dxi*( dphi_deta[i][p].slice(2) - - dphi_dzeta[i][p].slice(1) ) + - dx_deta*( dphi_dzeta[i][p].slice(0) - + curl_phi[i][p].slice(0) = inv_jac*( dx_dxi*( dphi_deta[i][p].slice(2) - + dphi_dzeta[i][p].slice(1) ) + + dx_deta*( dphi_dzeta[i][p].slice(0) - dphi_dxi[i][p].slice(2) ) + - dx_dzeta*( dphi_dxi[i][p].slice(1) - + dx_dzeta*( dphi_dxi[i][p].slice(1) - dphi_deta[i][p].slice(0) ) ); - curl_phi[i][p].slice(1) = inv_jac*( dy_dxi*( dphi_deta[i][p].slice(2) - + curl_phi[i][p].slice(1) = inv_jac*( dy_dxi*( dphi_deta[i][p].slice(2) - dphi_dzeta[i][p].slice(1) ) + - dy_deta*( dphi_dzeta[i][p].slice(0)- + dy_deta*( dphi_dzeta[i][p].slice(0)- dphi_dxi[i][p].slice(2) ) + - dy_dzeta*( dphi_dxi[i][p].slice(1) - + dy_dzeta*( dphi_dxi[i][p].slice(1) - dphi_deta[i][p].slice(0) ) ); - curl_phi[i][p].slice(2) = inv_jac*( dz_dxi*( dphi_deta[i][p].slice(2) - + curl_phi[i][p].slice(2) = inv_jac*( dz_dxi*( dphi_deta[i][p].slice(2) - dphi_dzeta[i][p].slice(1) ) + dz_deta*( dphi_dzeta[i][p].slice(0) - dphi_dxi[i][p].slice(2) ) + - dz_dzeta*( dphi_dxi[i][p].slice(1) - + dz_dzeta*( dphi_dxi[i][p].slice(1) - dphi_deta[i][p].slice(0) ) ); } - + break; } - + default: libmesh_error(); - + } // switch(dim) return; diff --git a/src/fe/inf_fe.C b/src/fe/inf_fe.C index 9a7beabd43b..6d53d934527 100644 --- a/src/fe/inf_fe.C +++ b/src/fe/inf_fe.C @@ -569,7 +569,7 @@ void InfFE::init_shape_functions(const Elem* inf_elem) dphidzeta.resize (n_total_approx_shape_functions); - + std::vector >& phi_map = this->_fe_map->get_phi_map(); std::vector >& dphidxi_map = this->_fe_map->get_dphidxi_map(); @@ -940,11 +940,11 @@ void InfFE::compute_shape_functions(const Elem*, const std:: const std::vector& dxidx_map = this->_fe_map->get_dxidx(); const std::vector& dxidy_map = this->_fe_map->get_dxidy(); const std::vector& dxidz_map = this->_fe_map->get_dxidz(); - + const std::vector& detadx_map = this->_fe_map->get_detadx(); const std::vector& detady_map = this->_fe_map->get_detady(); const std::vector& detadz_map = this->_fe_map->get_detadz(); - + const std::vector& dzetadx_map = this->_fe_map->get_dzetadx(); const std::vector& dzetady_map = this->_fe_map->get_dzetady(); const std::vector& dzetadz_map = this->_fe_map->get_dzetadz(); @@ -1037,4 +1037,3 @@ bool InfFE::shapes_need_reinit() const #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_base_radial.C b/src/fe/inf_fe_base_radial.C index 54a43735ca7..dd4f1c9aa7a 100644 --- a/src/fe/inf_fe_base_radial.C +++ b/src/fe/inf_fe_base_radial.C @@ -167,4 +167,3 @@ INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,unsigned int,Radial::n_dofs_at_node (const O } // namespace libMesh #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_boundary.C b/src/fe/inf_fe_boundary.C index 2ede2b57ace..6eefe53a3d6 100644 --- a/src/fe/inf_fe_boundary.C +++ b/src/fe/inf_fe_boundary.C @@ -97,7 +97,7 @@ void InfFE::reinit(const Elem* inf_elem, // Find where the integration points are located on the // full element. - std::vector qp; this->inverse_map (inf_elem, this->_fe_map->get_xyz(), + std::vector qp; this->inverse_map (inf_elem, this->_fe_map->get_xyz(), qp, tolerance); // compute the shape function and derivative values @@ -327,4 +327,3 @@ INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,void,init_face_shape_functions(const std::ve } // namespace libMesh #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_jacobi_20_00_eval.C b/src/fe/inf_fe_jacobi_20_00_eval.C index 1788f52a010..1bb35a104fb 100644 --- a/src/fe/inf_fe_jacobi_20_00_eval.C +++ b/src/fe/inf_fe_jacobi_20_00_eval.C @@ -483,4 +483,3 @@ namespace libMesh } // namespace libMesh #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_jacobi_30_00_eval.C b/src/fe/inf_fe_jacobi_30_00_eval.C index aec5137bbaa..f0e191e4e61 100644 --- a/src/fe/inf_fe_jacobi_30_00_eval.C +++ b/src/fe/inf_fe_jacobi_30_00_eval.C @@ -477,4 +477,3 @@ namespace libMesh } // namespace libMesh #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_lagrange_eval.C b/src/fe/inf_fe_lagrange_eval.C index d0c9c68e48b..a6d5de51edc 100644 --- a/src/fe/inf_fe_lagrange_eval.C +++ b/src/fe/inf_fe_lagrange_eval.C @@ -2660,4 +2660,3 @@ namespace libMesh } // namespace libMesh #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_legendre_eval.C b/src/fe/inf_fe_legendre_eval.C index c530f7d7965..befe3384f9d 100644 --- a/src/fe/inf_fe_legendre_eval.C +++ b/src/fe/inf_fe_legendre_eval.C @@ -333,4 +333,3 @@ namespace libMesh #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_map.C b/src/fe/inf_fe_map.C index 029fd920b8f..0606ae7a257 100644 --- a/src/fe/inf_fe_map.C +++ b/src/fe/inf_fe_map.C @@ -679,4 +679,3 @@ INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,void,inverse_map(const Elem*,const std::vect #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_map_eval.C b/src/fe/inf_fe_map_eval.C index b11f9e3006b..899a3c55626 100644 --- a/src/fe/inf_fe_map_eval.C +++ b/src/fe/inf_fe_map_eval.C @@ -91,4 +91,3 @@ namespace libMesh } // namespace libMesh #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/fe/inf_fe_static.C b/src/fe/inf_fe_static.C index 0fd23f5650d..e8e049f3a4f 100644 --- a/src/fe/inf_fe_static.C +++ b/src/fe/inf_fe_static.C @@ -994,4 +994,3 @@ INSTANTIATE_INF_FE_MBRF(3,CARTESIAN,void,nodal_soln(const FEType&,const Elem*,co } // namespace libMesh #endif //ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/geom/cell_hex.C b/src/geom/cell_hex.C index 31d2b1fef12..55be99fd6f1 100644 --- a/src/geom/cell_hex.C +++ b/src/geom/cell_hex.C @@ -238,7 +238,7 @@ unsigned int Hex::opposite_node(const unsigned int node_in, {3, 2, 1, 0, 7, 6, 5, 4, 10, 255, 8, 255, 15, 14, 13, 12, 18, 255, 16, 255, 255, 23, 255, 21, 255, 255}; static const unsigned char side24_nodes_map[] = {1, 0, 3, 2, 5, 4, 7, 6, 255, 11, 255, 9, 13, 12, 15, 14, 255, 19, 255, 17, 255, 255, 24, 255, 22, 255}; - + switch (side_in) { case 0: diff --git a/src/geom/cell_inf_hex18.C b/src/geom/cell_inf_hex18.C index 7edc161d18e..c6c8253c31e 100644 --- a/src/geom/cell_inf_hex18.C +++ b/src/geom/cell_inf_hex18.C @@ -562,4 +562,3 @@ const float InfHex18::_embedding_matrix[4][18][18] = } // namespace libMesh #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - diff --git a/src/geom/cell_prism15.C b/src/geom/cell_prism15.C index 5f4fb05b589..4806d0ceabe 100644 --- a/src/geom/cell_prism15.C +++ b/src/geom/cell_prism15.C @@ -347,8 +347,3 @@ Prism15::second_order_child_vertex (const unsigned int n) const } } // namespace libMesh - - - - - diff --git a/src/geom/edge_inf_edge2.C b/src/geom/edge_inf_edge2.C index 2225b79c7e7..bc1c8feb47e 100644 --- a/src/geom/edge_inf_edge2.C +++ b/src/geom/edge_inf_edge2.C @@ -100,5 +100,3 @@ void InfEdge2::connectivity(const unsigned int libmesh_dbg_var(se), #endif - - diff --git a/src/geom/elem.C b/src/geom/elem.C index 27120a03c2c..04b94b29e23 100644 --- a/src/geom/elem.C +++ b/src/geom/elem.C @@ -994,7 +994,7 @@ void Elem::make_links_to_me_local(unsigned int n) // pointed to instead. libmesh_assert(neigh->level() == this->level() || neigh->active()); - + // If neigh is at our level, then its family might have // remote_elem neighbor links which need to point to us // instead, but if not, then we're done. @@ -1007,7 +1007,7 @@ void Elem::make_links_to_me_local(unsigned int n) // restriction/prolongation projections. if (neigh->subactive()) return; - + // What side of neigh are we on? We can't use the usual Elem // method because we're in the middle of restoring topology const AutoPtr my_side = this->side(n); @@ -2299,7 +2299,7 @@ Elem * Elem::PackedElem::unpack (MeshBase &mesh, Elem *parent) const // pointed to instead. libmesh_assert(neigh->level() == elem->level() || neigh->active()); - + elem->set_neighbor(n, neigh); // If neigh is at elem's level, then its family might have @@ -2307,7 +2307,7 @@ Elem * Elem::PackedElem::unpack (MeshBase &mesh, Elem *parent) const // instead, but if not, then we're done. if (neigh->level() != elem->level()) continue; - + // What side of neigh is elem on? We can't use the usual Elem // method because we haven't finished restoring topology const AutoPtr my_side = elem->side(n); diff --git a/src/geom/elem_refinement.C b/src/geom/elem_refinement.C index 9ea7d06478a..34d849be84e 100644 --- a/src/geom/elem_refinement.C +++ b/src/geom/elem_refinement.C @@ -231,4 +231,3 @@ void Elem::contract() } // namespace libMesh - diff --git a/src/geom/face.C b/src/geom/face.C index 8c6e6bbe95a..46abd87b033 100644 --- a/src/geom/face.C +++ b/src/geom/face.C @@ -21,7 +21,3 @@ // The Face class does not implement any functions. - - - - diff --git a/src/geom/face_inf_quad4.C b/src/geom/face_inf_quad4.C index f608f422ea0..5b733f1d71a 100644 --- a/src/geom/face_inf_quad4.C +++ b/src/geom/face_inf_quad4.C @@ -240,5 +240,3 @@ void InfQuad4::connectivity(const unsigned int libmesh_dbg_var(sf), #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS - - diff --git a/src/geom/face_quad.C b/src/geom/face_quad.C index c59814bf8c5..460b899e9a0 100644 --- a/src/geom/face_quad.C +++ b/src/geom/face_quad.C @@ -149,7 +149,7 @@ unsigned int Quad::opposite_node(const unsigned int node_in, libmesh_assert(this->is_node_on_side(node_in, side_in)); //unsigned int opposite; - + static const unsigned char side02_nodes_map[] = {3, 2, 1, 0, 6, 255, 4, 255}; static const unsigned char side13_nodes_map[] = diff --git a/src/geom/face_quad8.C b/src/geom/face_quad8.C index 4df91877547..48490ab225f 100644 --- a/src/geom/face_quad8.C +++ b/src/geom/face_quad8.C @@ -431,4 +431,3 @@ Quad8::second_order_child_vertex (const unsigned int n) const } } // namespace libMesh - diff --git a/src/geom/face_quad9.C b/src/geom/face_quad9.C index 7c9d8d486fd..5ee189f3231 100644 --- a/src/geom/face_quad9.C +++ b/src/geom/face_quad9.C @@ -452,5 +452,3 @@ Quad9::second_order_child_vertex (const unsigned int n) const } } // namespace libMesh - - diff --git a/src/geom/node.C b/src/geom/node.C index 9cd84386646..2740150990b 100644 --- a/src/geom/node.C +++ b/src/geom/node.C @@ -61,7 +61,7 @@ std::string Node::get_info () const else oss << "invalid"; - oss << ", processor_id()=" << this->processor_id() << + oss << ", processor_id()=" << this->processor_id() << ", Point=" << *static_cast(this) << '\n'; oss << " DoFs="; @@ -113,7 +113,7 @@ void Node::PackedNode::pack (std::vector &conn, const Node* node) conn.push_back (static_cast(node->id())); // use "(a+b-1)/b" trick to get a/b to round up - static const unsigned int ints_per_Real = + static const unsigned int ints_per_Real = (sizeof(Real) + sizeof(int) - 1) / sizeof(int); for (unsigned int i=0; i != LIBMESH_DIM; ++i) @@ -138,7 +138,7 @@ void Node::PackedNode::unpack (std::vector::const_iterator start, Node& nod unsigned int id = static_cast(*start++); // use "(a+b-1)/b" trick to get a/b to round up - static const unsigned int ints_per_Real = + static const unsigned int ints_per_Real = (sizeof(Real) + sizeof(int) - 1) / sizeof(int); std::vector xyz(3,0.); diff --git a/src/geom/point.C b/src/geom/point.C index ae641a2f00d..aa7ec37edb1 100644 --- a/src/geom/point.C +++ b/src/geom/point.C @@ -82,4 +82,3 @@ // return index[2]; // } - diff --git a/src/geom/remote_elem.C b/src/geom/remote_elem.C index 08a5081f431..348d2bf4e95 100644 --- a/src/geom/remote_elem.C +++ b/src/geom/remote_elem.C @@ -32,7 +32,7 @@ namespace RemoteElemMutex remote_elem_mtx; - // Class to be dispatched by Singleton::setup() + // Class to be dispatched by Singleton::setup() // to create the \p RemoteElem singleton. // While this actual object has file-level static // scope and will be initialized before main(), @@ -60,7 +60,7 @@ namespace libMesh RemoteElem::~RemoteElem() { RemoteElemMutex::scoped_lock lock(remote_elem_mtx); - + remote_elem = NULL; } @@ -72,13 +72,13 @@ namespace libMesh return *remote_elem; RemoteElemMutex::scoped_lock lock(remote_elem_mtx); - + // check again - object could have been created while waiting // for the lock to acquire! if (remote_elem == NULL) remote_elem = new RemoteElem; - return *remote_elem; + return *remote_elem; } diff --git a/src/mesh/abaqus_io.C b/src/mesh/abaqus_io.C index f2d41daf469..45b4ab0ac39 100644 --- a/src/mesh/abaqus_io.C +++ b/src/mesh/abaqus_io.C @@ -766,7 +766,7 @@ namespace libMesh std::vector >& id_storage = container[sideset_name]; // Variables for storing values read in from file - dof_id_type elem_id=0; + dof_id_type elem_id=0; unsigned side_id=0; char c; std::string dummy; diff --git a/src/mesh/gmsh_io.C b/src/mesh/gmsh_io.C index f3bad878165..c2b9fc3630e 100644 --- a/src/mesh/gmsh_io.C +++ b/src/mesh/gmsh_io.C @@ -970,4 +970,3 @@ void GmshIO::write_post (const std::string& fname, } } // namespace libMesh - diff --git a/src/mesh/medit_io.C b/src/mesh/medit_io.C index fc205403866..5b41c47a087 100644 --- a/src/mesh/medit_io.C +++ b/src/mesh/medit_io.C @@ -216,7 +216,3 @@ void MEDITIO::write_ascii (const std::string& fname, } } // namespace libMesh - - - - diff --git a/src/mesh/mesh_base.C b/src/mesh/mesh_base.C index afced8ad1fd..40a9889b2df 100644 --- a/src/mesh/mesh_base.C +++ b/src/mesh/mesh_base.C @@ -174,7 +174,7 @@ void MeshBase::subdomain_ids (std::set &ids) const parallel_only(); ids.clear(); - + const_element_iterator el = this->active_elements_begin(); const const_element_iterator end = this->active_elements_end(); @@ -200,7 +200,7 @@ subdomain_id_type MeshBase::n_subdomains() const } - + dof_id_type MeshBase::n_nodes_on_proc (const processor_id_type proc_id) const { @@ -309,8 +309,8 @@ void MeshBase::partition (const unsigned int n_parts) { // NULL partitioner means don't partition // Non-serial meshes aren't ready for partitioning yet. - if(!skip_partitioning() && - partitioner().get() && + if(!skip_partitioning() && + partitioner().get() && this->is_serial()) { partitioner()->partition (*this, n_parts); @@ -423,4 +423,3 @@ subdomain_id_type MeshBase::get_id_by_name(const std::string& name) const } // namespace libMesh - diff --git a/src/mesh/mesh_communication.C b/src/mesh/mesh_communication.C index bf272413b4d..15dae3c7fc3 100644 --- a/src/mesh/mesh_communication.C +++ b/src/mesh/mesh_communication.C @@ -432,7 +432,7 @@ void MeshCommunication::gather_neighboring_elements (ParallelMesh &mesh) const adjacent_processors.push_back (pid); - const processor_id_type n_adjacent_processors = + const processor_id_type n_adjacent_processors = libmesh_cast_int(adjacent_processors.size()); //------------------------------------------------------------------------- @@ -571,7 +571,7 @@ void MeshCommunication::gather_neighboring_elements (ParallelMesh &mesh) const // Now we need to see which of our elements touch the nodes in the list. // We will certainly send all the active elements which intersect source_pid_idx, // but we will also ship off the other elements in the same family tree - // as the active ones for data structure consistency. + // as the active ones for data structure consistency. // // FIXME - shipping full family trees is unnecessary and inefficient. // @@ -743,7 +743,7 @@ void MeshCommunication::broadcast (MeshBase& mesh) const // Explicitly clear the mesh on all but processor 0. if (libMesh::processor_id() != 0) mesh.clear(); - + // Broadcast nodes CommWorld.broadcast_packed_range(&mesh, mesh.nodes_begin(), diff --git a/src/mesh/mesh_data_unv_support.C b/src/mesh/mesh_data_unv_support.C index 9d2e215baa0..8c36e27c4d7 100644 --- a/src/mesh/mesh_data_unv_support.C +++ b/src/mesh/mesh_data_unv_support.C @@ -935,7 +935,3 @@ bool MeshDataUnvHeader::operator == (const MeshDataUnvHeader& omduh) const } } // namespace libMesh - - - - diff --git a/src/mesh/mesh_data_xdr_support.C b/src/mesh/mesh_data_xdr_support.C index bb27a04ac75..1e20e97597b 100644 --- a/src/mesh/mesh_data_xdr_support.C +++ b/src/mesh/mesh_data_xdr_support.C @@ -495,5 +495,3 @@ better_you_choke_this... } } // namespace libMesh - - diff --git a/src/mesh/mesh_function.C b/src/mesh/mesh_function.C index 6aa94f07802..f1813f9f832 100644 --- a/src/mesh/mesh_function.C +++ b/src/mesh/mesh_function.C @@ -243,7 +243,7 @@ void MeshFunction::operator() (const Point& p, // If we have an element, but it's not a local element, then we // either need to have a serialized vector or we need to find a // local element sharing the same point. - if (element && + if (element && (element->processor_id() != libMesh::processor_id()) && _vector.type() != SERIAL) { @@ -366,7 +366,7 @@ void MeshFunction::gradient (const Point& p, // If we have an element, but it's not a local element, then we // either need to have a serialized vector or we need to find a // local element sharing the same point. - if (element && + if (element && (element->processor_id() != libMesh::processor_id()) && _vector.type() != SERIAL) { @@ -479,7 +479,7 @@ void MeshFunction::hessian (const Point& p, // If we have an element, but it's not a local element, then we // either need to have a serialized vector or we need to find a // local element sharing the same point. - if (element && + if (element && (element->processor_id() != libMesh::processor_id()) && _vector.type() != SERIAL) { @@ -592,4 +592,3 @@ void MeshFunction::disable_out_of_mesh_mode(void) } } // namespace libMesh - diff --git a/src/mesh/mesh_modification.C b/src/mesh/mesh_modification.C index b71fca76031..16776369239 100644 --- a/src/mesh/mesh_modification.C +++ b/src/mesh/mesh_modification.C @@ -628,7 +628,7 @@ void UnstructuredMesh::all_second_order (const bool full_ordered) * should be transfered to the second-order element. The old * boundary conditions will be removed from the BoundaryInfo * data structure by insert_elem. - * + * * Also, prepare_for_use() will reconstruct most of our neighbor * links, but if we have any remote_elem links in a distributed * mesh, they need to be preserved. We do that in the same loop @@ -1505,7 +1505,3 @@ void MeshTools::Modification::change_subdomain_id (MeshBase& mesh, } // namespace libMesh - - - - diff --git a/src/mesh/mesh_smoother.C b/src/mesh/mesh_smoother.C index a020de4d181..757a25198b9 100644 --- a/src/mesh/mesh_smoother.C +++ b/src/mesh/mesh_smoother.C @@ -19,6 +19,3 @@ // C++ includes // The base class does not implement any functions - - - diff --git a/src/mesh/mesh_smoother_vsmoother.C b/src/mesh/mesh_smoother_vsmoother.C index ee8d08095e5..3fe6c8a2e4a 100644 --- a/src/mesh/mesh_smoother_vsmoother.C +++ b/src/mesh/mesh_smoother_vsmoother.C @@ -116,7 +116,7 @@ double VariationalMeshSmoother::smooth(unsigned int) } if(me>1) vms_err=readmetr(metr,H,ncells,n,sout); if(vms_err<0) - { + { fprintf(sout,"Error reading metric file\n"); fclose(sout); return _dist_norm; diff --git a/src/mesh/mesh_tools.C b/src/mesh/mesh_tools.C index 271a2fb58f2..97ccf700fc2 100644 --- a/src/mesh/mesh_tools.C +++ b/src/mesh/mesh_tools.C @@ -192,7 +192,7 @@ namespace { if (d) { const unsigned int n_sys = d->n_systems(); - + std::vector n_vars (n_sys, 0); for (unsigned int s = 0; s != n_sys; ++s) n_vars[s] = d->n_vars(s); @@ -202,7 +202,7 @@ namespace { std::vector n_comp (tot_n_vars, 0); std::vector first_dof (tot_n_vars, 0); - + for (unsigned int s = 0, i=0; s != n_sys; ++s) for (unsigned int v = 0; v != n_vars[s]; ++v, ++i) { diff --git a/src/mesh/mesh_triangle_interface.C b/src/mesh/mesh_triangle_interface.C index 927b97afa19..0291227e343 100644 --- a/src/mesh/mesh_triangle_interface.C +++ b/src/mesh/mesh_triangle_interface.C @@ -349,11 +349,3 @@ namespace libMesh #endif // LIBMESH_HAVE_TRIANGLE - - - - - - - - diff --git a/src/mesh/off_io.C b/src/mesh/off_io.C index 1beb0bfeaab..a0c2f1e9199 100644 --- a/src/mesh/off_io.C +++ b/src/mesh/off_io.C @@ -115,7 +115,7 @@ void OFFIO::read_stream(std::istream& in) case 3: elem = new Tri3 ; break; default: libmesh_error(); } - + elem->set_id(e); the_mesh.add_elem (elem); diff --git a/src/mesh/parallel_mesh.C b/src/mesh/parallel_mesh.C index a4d1d002139..510c9a5a8ec 100644 --- a/src/mesh/parallel_mesh.C +++ b/src/mesh/parallel_mesh.C @@ -65,13 +65,13 @@ ParallelMesh::ParallelMesh (const ParallelMesh &other_mesh) : _n_elem = other_mesh.n_elem(); _max_node_id = other_mesh.max_node_id(); _max_elem_id = other_mesh.max_elem_id(); - _next_free_local_node_id = + _next_free_local_node_id = other_mesh._next_free_local_node_id; - _next_free_local_elem_id = + _next_free_local_elem_id = other_mesh._next_free_local_elem_id; - _next_free_unpartitioned_node_id = + _next_free_unpartitioned_node_id = other_mesh._next_free_unpartitioned_node_id; - _next_free_unpartitioned_elem_id = + _next_free_unpartitioned_elem_id = other_mesh._next_free_unpartitioned_elem_id; *this->boundary_info = *other_mesh.boundary_info; diff --git a/src/mesh/serial_mesh.C b/src/mesh/serial_mesh.C index 8d171b34890..6e03e4deacf 100644 --- a/src/mesh/serial_mesh.C +++ b/src/mesh/serial_mesh.C @@ -516,21 +516,21 @@ void SerialMesh::renumber_nodes_and_elements () for (unsigned int n=0; nn_nodes(); n++) if (el->node(n) == next_free_node) // don't need to process next_free_node++; // [(src == dst) below] - + else if (el->node(n) > next_free_node) // need to process { // The source and destination indices // for this node const dof_id_type src_idx = el->node(n); const dof_id_type dst_idx = next_free_node++; - + // ensure we want to swap a valid nodes libmesh_assert(_nodes[src_idx]); - + // Swap the source and destination nodes std::swap(_nodes[src_idx], _nodes[dst_idx] ); - + // Set proper indices where that makes sense if (_nodes[src_idx] != NULL) _nodes[src_idx]->set_id (src_idx); @@ -544,7 +544,7 @@ void SerialMesh::renumber_nodes_and_elements () // thus repeated and unnecessary. _elements.erase (out_iter, end); } - + if(_skip_renumber_nodes_and_elements) { @@ -552,7 +552,7 @@ void SerialMesh::renumber_nodes_and_elements () // be NULLs in the _nodes vector from the coarsening // process. Pack the nodes in to a contiguous array // and then trim any excess. - + std::vector::iterator in = _nodes.begin(); std::vector::iterator out_iter = _nodes.begin(); const std::vector::iterator end = _nodes.end(); @@ -562,7 +562,7 @@ void SerialMesh::renumber_nodes_and_elements () { // This is a reference so that if we change the pointer it will change in the vector Node* & nd = *in; - + // If this node is still connected to an elem, put it in the list if(connected_nodes.find(nd) != connected_nodes.end()) { @@ -579,7 +579,7 @@ void SerialMesh::renumber_nodes_and_elements () // delete the node delete nd; nd = NULL; - } + } } // Erase any additional storage. Whatever was @@ -651,7 +651,7 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, { std::map node_to_node_map; std::map > node_to_elems_map; - + if( (this_mesh_boundary_id != BoundaryInfo::invalid_id) && (other_mesh_boundary_id != BoundaryInfo::invalid_id) ) { @@ -661,13 +661,13 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, for ( ; elem_it != elem_end; ++elem_it) { Elem *el = *elem_it; - + // Now check whether elem has a face on the specified boundary for (unsigned int side_id=0; side_idn_sides(); side_id++) if (el->neighbor(side_id) == NULL) { boundary_id_type bc_id = this->boundary_info->boundary_id (el, side_id); - + if(bc_id == this_mesh_boundary_id) { AutoPtr side (el->build_side(side_id)); @@ -685,13 +685,13 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, for ( ; elem_it != elem_end; ++elem_it) { Elem *el = *elem_it; - + // Now check whether elem has a face on the specified boundary for (unsigned int side_id=0; side_idn_sides(); side_id++) if (el->neighbor(side_id) == NULL) { boundary_id_type bc_id = other_mesh.boundary_info->boundary_id (el, side_id); - + if(bc_id == other_mesh_boundary_id) { AutoPtr side (el->build_side(side_id)); @@ -702,25 +702,25 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, } } } - + std::set::iterator set_it = this_boundary_node_ids.begin(); std::set::iterator set_it_end = this_boundary_node_ids.end(); for( ; set_it != set_it_end; ++set_it) { dof_id_type this_node_id = *set_it; Node& this_node = this->node(this_node_id); - + bool found_matching_nodes = false; - + std::set::iterator other_set_it = other_boundary_node_ids.begin(); std::set::iterator other_set_it_end = other_boundary_node_ids.end(); for( ; other_set_it != other_set_it_end; ++other_set_it) { dof_id_type other_node_id = *other_set_it; Node& other_node = other_mesh.node(other_node_id); - + Real node_distance = (this_node - other_node).size(); - + if(node_distance < tol) { // Make sure we didn't already find a matching node! @@ -729,9 +729,9 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, libMesh::out << "Error: Found multiple matching nodes in stitch_meshes" << std::endl; libmesh_error(); } - + node_to_node_map[this_node_id] = other_node_id; - + // Build a vector of all the elements in other_mesh that contain other_node std::vector other_elem_ids; MeshBase::element_iterator other_elem_it = other_mesh.elements_begin(); @@ -739,22 +739,22 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, for (; other_elem_it != other_elem_end; ++other_elem_it) { Elem *el = *other_elem_it; - + if(el->contains_point(other_node)) other_elem_ids.push_back(el->id()); } - + node_to_elems_map[this_node_id] = other_elem_ids; - + found_matching_nodes = true; } } } - + if(verbose) { libMesh::out << "In SerialMesh::stitch_meshes:" << std::endl - << "This mesh has " << this_boundary_node_ids.size() << " nodes on specified boundary" << std::endl + << "This mesh has " << this_boundary_node_ids.size() << " nodes on specified boundary" << std::endl << "Other mesh has " << other_boundary_node_ids.size() << " nodes on specified boundary" << std::endl << "Found " << node_to_node_map.size() << " matching nodes." << std::endl << std::endl; } @@ -766,12 +766,12 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, libMesh::out << "Skip node merging in SerialMesh::stitch_meshes:" << std::endl; } } - - + + dof_id_type node_delta = this->n_nodes(); dof_id_type elem_delta = this->n_elem(); - + // need to increment node and element IDs of other_mesh before copying to this mesh MeshBase::node_iterator node_it = other_mesh.nodes_begin(); MeshBase::node_iterator node_end = other_mesh.nodes_end(); @@ -781,7 +781,7 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, dof_id_type new_id = nd->id() + node_delta; nd->set_id(new_id); } - + MeshBase::element_iterator elem_it = other_mesh.elements_begin(); MeshBase::element_iterator elem_end = other_mesh.elements_end(); for (; elem_it != elem_end; ++elem_it) @@ -790,7 +790,7 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, dof_id_type new_id = el->id() + elem_delta; el->set_id(new_id); } - + // Also, increment the node_to_node_map and node_to_elems_map std::map::iterator node_map_it = node_to_node_map.begin(); std::map::iterator node_map_it_end = node_to_node_map.end(); @@ -808,10 +808,10 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, (elem_map_it->second)[i] += elem_delta; } } - + // Copy mesh data this->copy_nodes_and_elements(other_mesh); - + // then decrement node and element IDs of mesh_i to return to original state node_it = other_mesh.nodes_begin(); node_end = other_mesh.nodes_end(); @@ -821,30 +821,30 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, dof_id_type new_id = nd->id() - node_delta; nd->set_id(new_id); } - + elem_it = other_mesh.elements_begin(); elem_end = other_mesh.elements_end(); for (; elem_it != elem_end; ++elem_it) { Elem *el = *elem_it; - + // First copy boundary info to the stitched mesh for (unsigned int side_id=0; side_idn_sides(); side_id++) if (el->neighbor(side_id) == NULL) { boundary_id_type bc_id = other_mesh.boundary_info->boundary_id (el, side_id); - + if(bc_id != BoundaryInfo::invalid_id) { this->boundary_info->add_side(el->id(), side_id, bc_id); } } - + // Then decrement dof_id_type new_id = el->id() - elem_delta; el->set_id(new_id); } - + // Finally, we need to "merge" the overlapping nodes // We do this by iterating over node_to_elems_map and updating // the elements so that they "point" to the nodes that came @@ -858,20 +858,20 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, dof_id_type target_node_id = elem_map_it->first; dof_id_type other_node_id = node_to_node_map[target_node_id]; Node& target_node = this->node(target_node_id); - + dof_id_type n_elems = elem_map_it->second.size(); for(unsigned int i=0; isecond[i]; Elem* el = this->elem(elem_id); - + // find the local node index that we want to update unsigned int local_node_index = el->local_node(other_node_id); - + el->set_node(local_node_index) = &target_node; } } - + node_map_it = node_to_node_map.begin(); node_map_it_end = node_to_node_map.end(); for( ; node_map_it != node_map_it_end; ++node_map_it) @@ -879,7 +879,7 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, dof_id_type node_id = node_map_it->second; this->delete_node( this->node_ptr(node_id) ); } - + this->prepare_for_use( /*skip_renumber_nodes_and_elements= */ false); // After the stitching, we may want to clear boundary IDs from element @@ -891,13 +891,13 @@ void SerialMesh::stitch_meshes (SerialMesh& other_mesh, for (; elem_it != elem_end; ++elem_it) { Elem *el = *elem_it; - + for (unsigned int side_id=0; side_idn_sides(); side_id++) { if (el->neighbor(side_id) != NULL) { boundary_id_type bc_id = this->boundary_info->boundary_id (el, side_id); - + if( (bc_id == this_mesh_boundary_id) || (bc_id == other_mesh_boundary_id) ) { diff --git a/src/mesh/tecplot_io.C b/src/mesh/tecplot_io.C index 6cef3ca2ff0..12bf706f718 100644 --- a/src/mesh/tecplot_io.C +++ b/src/mesh/tecplot_io.C @@ -63,7 +63,7 @@ namespace //int* connData; void set_n_cells (const unsigned int nc); - + const unsigned int n_nodes; const unsigned int n_vars; unsigned int n_cells; @@ -287,20 +287,20 @@ void TecplotIO::write_binary (const std::string& fname, libMesh::err << "WARNING: Tecplot Binary files require the Tecplot API." << std::endl << "Continuing with ASCII output." << std::endl; - + if (libMesh::processor_id() == 0) this->write_ascii (fname, vec, solution_names); return; - + //------------------------------------------------------------ // New binary formats, time aware and whatnot #elif defined(LIBMESH_HAVE_TECPLOT_API_112) - + // Get a constant reference to the mesh. const MeshBase& the_mesh = MeshOutput::mesh(); - + // Required variables std::string tecplot_variable_names; int @@ -321,12 +321,12 @@ void TecplotIO::write_binary (const std::string& fname, cell_type = 1; // FELINESEG nn_per_elem = 2; break; - + case 2: cell_type = 3; // FEQUADRILATERAL nn_per_elem = 4; break; - + case 3: cell_type = 5; // FEBRICK nn_per_elem = 8; @@ -418,14 +418,14 @@ void TecplotIO::write_binary (const std::string& fname, &file_type, &tec_debug, &is_double); - + libmesh_assert_equal_to (ierr, 0); // A zone for each subdomain bool firstzone=true; for (std::set::const_iterator sbd_it=_subdomain_ids.begin(); sbd_it!=_subdomain_ids.end(); ++sbd_it) - { + { // Copy the connectivity for this subdomain { MeshBase::const_element_iterator it = the_mesh.active_subdomain_elements_begin (*sbd_it); @@ -435,12 +435,12 @@ void TecplotIO::write_binary (const std::string& fname, for (; it != end; ++it) n_subcells_in_subdomain += (*it)->n_sub_elem(); - + // update the connectivty array to include only the elements in this subdomain tm.set_n_cells (n_subcells_in_subdomain); unsigned int te = 0; - + for (it = the_mesh.active_subdomain_elements_begin (*sbd_it); it != end; ++it) { @@ -448,18 +448,18 @@ void TecplotIO::write_binary (const std::string& fname, for (unsigned int se=0; se<(*it)->n_sub_elem(); se++) { (*it)->connectivity(se, TECPLOT, conn); - + for (unsigned int node=0; node(the_mesh.n_nodes()), num_cells = static_cast(tm.n_cells), @@ -476,7 +476,7 @@ void TecplotIO::write_binary (const std::string& fname, num_connect_boundary_faces = 0, tot_num_boundary_connect = 0, share_connect_from_zone=0; - + std::vector passive_var_list (tm.n_vars, 0), share_var_from_zone (tm.n_vars, 1); // We only write data for the first zone, all other @@ -486,12 +486,12 @@ void TecplotIO::write_binary (const std::string& fname, std::string subdomain_name = the_mesh.subdomain_name(*sbd_it); std::ostringstream zone_name; zone_name << this->zone_title(); - + // We will title this // "{zone_title()}_{subdomain_name}", or // "{zone_title()}_{subdomain_id}", or // "{zone_title()}" - if (subdomain_name.size()) + if (subdomain_name.size()) { zone_name << "_"; zone_name << subdomain_name; @@ -501,7 +501,7 @@ void TecplotIO::write_binary (const std::string& fname, zone_name << "_"; zone_name << *sbd_it; } - + ierr = TECZNE112 ((char*) zone_name.str().c_str(), &cell_type, &num_nodes, @@ -523,9 +523,9 @@ void TecplotIO::write_binary (const std::string& fname, NULL, // = all are node centered (firstzone) ? NULL : &share_var_from_zone[0], &share_connect_from_zone); - + libmesh_assert_equal_to (ierr, 0); - + // Write *all* the data for the first zone, then share it with the others if (firstzone) { @@ -535,18 +535,18 @@ void TecplotIO::write_binary (const std::string& fname, #else ((3 + 3*((solution_names == NULL) ? 0 : solution_names->size()))*num_nodes); #endif - - + + ierr = TECDAT112 (&total, &tm.nodalData[0], &is_double); - + libmesh_assert_equal_to (ierr, 0); } // Write the connectivity ierr = TECNOD112 (&tm.connData[0]); - + libmesh_assert_equal_to (ierr, 0); } @@ -555,12 +555,12 @@ void TecplotIO::write_binary (const std::string& fname, // Done, close the file. ierr = TECEND112 (); - + libmesh_assert_equal_to (ierr, 0); - - + + //------------------------------------------------------------ // Legacy binary format #else @@ -732,4 +732,3 @@ void TecplotIO::write_binary (const std::string& fname, } } // namespace libMesh - diff --git a/src/mesh/tetgen_io.C b/src/mesh/tetgen_io.C index ccb25531353..c05e18a4582 100644 --- a/src/mesh/tetgen_io.C +++ b/src/mesh/tetgen_io.C @@ -329,4 +329,3 @@ void TetGenIO::write (const std::string& fname) } } // namespace libMesh - diff --git a/src/mesh/ucd_io.C b/src/mesh/ucd_io.C index 3ec7a1a2d56..3569a7e1b46 100644 --- a/src/mesh/ucd_io.C +++ b/src/mesh/ucd_io.C @@ -280,14 +280,14 @@ void UCDIO::write_nodes(std::ostream& out_stream, const MeshBase& mesh) { MeshBase::const_node_iterator it = mesh.nodes_begin(); const MeshBase::const_node_iterator end = mesh.nodes_end(); - + unsigned int n=1; // 1-based node number for UCD - + // Write the node coordinates for (; it != end; ++it) { libmesh_assert (out_stream.good()); - + out_stream << n++ << "\t"; (*it)->write_unformatted(out_stream); } @@ -308,14 +308,14 @@ void UCDIO::write_interior_elems(std::ostream& out_stream, const MeshBase& mesh) MeshBase::const_element_iterator it = mesh.elements_begin(); const MeshBase::const_element_iterator end = mesh.elements_end(); - + unsigned int e=1; // 1-based element number for UCD - + // Write element information for (; it != end; ++it) { libmesh_assert (out_stream.good()); - + // PB: I believe these are the only supported ElemTypes. const ElemType etype = (*it)->type(); if( (etype != TRI3) && (etype != QUAD4) && @@ -335,12 +335,12 @@ void UCDIO::write_interior_elems(std::ostream& out_stream, const MeshBase& mesh) return; } -void UCDIO::write_nodal_data(const std::string& fname, - const std::vector&soln, +void UCDIO::write_nodal_data(const std::string& fname, + const std::vector&soln, const std::vector& names) { std::ofstream out_stream(fname.c_str()); - + const MeshBase& mesh = MeshOutput::mesh(); // UCD doesn't work in 1D @@ -398,7 +398,7 @@ void UCDIO::write_soln(std::ostream& out_stream, const MeshBase& mesh, for( std::size_t var = 0; var != nv; var++ ) { std::size_t idx = nv*(n-1) + var; - + out_stream << " " << soln[idx]; } out_stream << std::endl; diff --git a/src/mesh/unstructured_mesh.C b/src/mesh/unstructured_mesh.C index ea01a01085f..58c1109ddd1 100644 --- a/src/mesh/unstructured_mesh.C +++ b/src/mesh/unstructured_mesh.C @@ -1128,6 +1128,3 @@ bool UnstructuredMesh::contract () #endif // #ifdef LIBMESH_ENABLE_AMR } // namespace libMesh - - - diff --git a/src/mesh/unv_io.C b/src/mesh/unv_io.C index 699cd8151d0..e890dc84304 100644 --- a/src/mesh/unv_io.C +++ b/src/mesh/unv_io.C @@ -1283,4 +1283,3 @@ void UNVIO::element_out(std::ostream& out_file) } } // namespace libMesh - diff --git a/src/mesh/vtk_io.C b/src/mesh/vtk_io.C index 01d188c35bf..1dca4ffba38 100644 --- a/src/mesh/vtk_io.C +++ b/src/mesh/vtk_io.C @@ -172,7 +172,7 @@ void VTKIO::nodes_to_vtk() vtkSmartPointer pcoords = vtkDoubleArray::New(); pcoords->SetNumberOfComponents(LIBMESH_DIM); points->SetNumberOfPoints(mesh.n_local_nodes()); // it seems that it needs this to prevent a segfault - + unsigned int local_node_counter = 0; MeshBase::const_node_iterator nd = mesh.local_nodes_begin(); @@ -574,7 +574,7 @@ void VTKIO::write_nodal_data (const std::string& fname, // Is this really important? If so, it should be more than an assert... // libmesh_assert(fname.substr(fname.rfind("."), fname.size()) == ".pvtu"); - + // we only use Unstructured grids _vtk_grid = vtkUnstructuredGrid::New(); vtkSmartPointer writer = vtkXMLPUnstructuredGridWriter::New(); @@ -608,7 +608,7 @@ void VTKIO::write_nodal_data (const std::string& fname, continue; // not a local node #ifdef LIBMESH_USE_COMPLEX_NUMBERS - libmesh_do_once (libMesh::err << "Only writing the real part for complex numbers!\n" + libmesh_do_once (libMesh::err << "Only writing the real part for complex numbers!\n" << "if you need this support contact " << LIBMESH_PACKAGE_BUGREPORT << std::endl); data->SetValue(_local_node_map[k], soln[k*num_vars + variable].real()); @@ -626,7 +626,7 @@ void VTKIO::write_nodal_data (const std::string& fname, writer->SetNumberOfPieces(libMesh::n_processors()); writer->SetStartPiece(libMesh::processor_id()); writer->SetEndPiece(libMesh::processor_id()); - + // partitions overlap by one node // FIXME: According to this document // http://paraview.org/Wiki/images/5/51/SC07_tut107_ParaView_Handouts.pdf diff --git a/src/mesh/xdr_io.C b/src/mesh/xdr_io.C index 93fe3de0b73..de5b5c6814a 100644 --- a/src/mesh/xdr_io.C +++ b/src/mesh/xdr_io.C @@ -684,7 +684,7 @@ void XdrIO::write_serialized_nodes (Xdr &io, const dof_id_type n_nodes) const tot_coord_size += recv_coords[pid].size(); } - libmesh_assert_less_equal + libmesh_assert_less_equal (tot_id_size, std::min(io_blksize, std::size_t(n_nodes))); libmesh_assert_equal_to (tot_coord_size, LIBMESH_DIM*tot_id_size); diff --git a/src/mesh/xdr_soln.C b/src/mesh/xdr_soln.C index 843b3ded3b9..a4392701002 100644 --- a/src/mesh/xdr_soln.C +++ b/src/mesh/xdr_soln.C @@ -203,5 +203,3 @@ int XdrSOLN::header(XdrSHEAD *hd) } } // namespace libMesh - - diff --git a/src/numerics/coupling_matrix.C b/src/numerics/coupling_matrix.C index b420546b52d..11b7fb9eb0c 100644 --- a/src/numerics/coupling_matrix.C +++ b/src/numerics/coupling_matrix.C @@ -17,4 +17,3 @@ // CouplingMatrix does not implement any non-inline functions. - diff --git a/src/numerics/dense_matrix_blas_lapack.C b/src/numerics/dense_matrix_blas_lapack.C index f233d9e7326..837f5e6bc22 100644 --- a/src/numerics/dense_matrix_blas_lapack.C +++ b/src/numerics/dense_matrix_blas_lapack.C @@ -788,4 +788,3 @@ template void DenseMatrix::_svd_helper (char, char, std::vector& #endif } // namespace libMesh - diff --git a/src/numerics/eigen_preconditioner.C b/src/numerics/eigen_preconditioner.C index 3c4cc489ef2..559ec1d176e 100644 --- a/src/numerics/eigen_preconditioner.C +++ b/src/numerics/eigen_preconditioner.C @@ -34,7 +34,7 @@ template void EigenPreconditioner::apply(const NumericVector & /* x */, NumericVector & /* y */) { libmesh_not_implemented(); - + // EigenSparseVector & x_pvec = libmesh_cast_ref&>(const_cast&>(x)); // EigenSparseVector & y_pvec = libmesh_cast_ref&>(const_cast&>(y)); @@ -52,7 +52,7 @@ template void EigenPreconditioner::init () { libmesh_not_implemented(); - + // if(!this->_matrix) // { // libMesh::err << "ERROR: No matrix set for EigenPreconditioner, but init() called" << std::endl; diff --git a/src/numerics/eigen_sparse_matrix.C b/src/numerics/eigen_sparse_matrix.C index 18eecd69f9e..cc5c6148eba 100644 --- a/src/numerics/eigen_sparse_matrix.C +++ b/src/numerics/eigen_sparse_matrix.C @@ -52,7 +52,7 @@ void EigenSparseMatrix::init (const numeric_index_type m_in, _mat.resize(m_in, n_in); _mat.reserve(Eigen::Matrix::Constant(m_in,nnz)); - + this->_is_initialized = true; } @@ -71,10 +71,10 @@ void EigenSparseMatrix::init () // Clear intialized matrices if (this->initialized()) this->clear(); - + const numeric_index_type n_rows = this->_dof_map->n_dofs(); const numeric_index_type n_cols = n_rows; - + #ifndef NDEBUG // The following variables are only used for assertions, // so avoid declaring them when asserts are inactive. @@ -86,9 +86,9 @@ void EigenSparseMatrix::init () libmesh_assert_equal_to (n_rows, n_cols); libmesh_assert_equal_to (m_l, n_rows); libmesh_assert_equal_to (n_l, n_cols); - + const std::vector& n_nz = this->_dof_map->get_n_nz(); - + #ifndef NDEBUG // The following variables are only used for assertions, // so avoid declaring them when asserts are inactive. @@ -107,7 +107,7 @@ void EigenSparseMatrix::init () _mat.resize(n_rows,n_cols); _mat.reserve(n_nz); - + this->_is_initialized = true; libmesh_assert_equal_to (n_rows, this->m()); @@ -176,7 +176,7 @@ template void EigenSparseMatrix::clear () { _mat.resize(0,0); - + _closed = false; this->_is_initialized = false; } diff --git a/src/numerics/eigen_sparse_vector.C b/src/numerics/eigen_sparse_vector.C index 1a4b1fb29b5..edaf688ba78 100644 --- a/src/numerics/eigen_sparse_vector.C +++ b/src/numerics/eigen_sparse_vector.C @@ -85,7 +85,7 @@ NumericVector& EigenSparseVector::operator += (const NumericVector& v_i const EigenSparseVector& v = libmesh_cast_ref&>(v_in); _vec += v._vec; - + return *this; } @@ -100,7 +100,7 @@ NumericVector& EigenSparseVector::operator -= (const NumericVector& v_i const EigenSparseVector& v = libmesh_cast_ref&>(v_in); _vec -= v._vec; - + return *this; } @@ -117,7 +117,7 @@ void EigenSparseVector::reciprocal() libmesh_assert_not_equal_to ((*this)(i), T(0)); #endif - _vec = _vec.cwiseInverse(); + _vec = _vec.cwiseInverse(); } @@ -256,8 +256,8 @@ void EigenSparseVector::add_vector (const NumericVector &vec_in, libmesh_assert(vec); libmesh_assert(mat); - - _vec += mat->_mat*vec->_vec; + + _vec += mat->_mat*vec->_vec; } @@ -272,8 +272,8 @@ void EigenSparseVector::add_vector_transpose (const NumericVector &vec_in, libmesh_assert(vec); libmesh_assert(mat); - - _vec += mat->_mat.transpose()*vec->_vec; + + _vec += mat->_mat.transpose()*vec->_vec; } @@ -287,7 +287,7 @@ void EigenSparseVector::scale (const T factor) } - + template void EigenSparseVector::abs() { @@ -300,7 +300,7 @@ void EigenSparseVector::abs() } - + template T EigenSparseVector::dot (const NumericVector& V) const { @@ -321,7 +321,7 @@ EigenSparseVector::operator = (const T s) { libmesh_assert (this->initialized()); libmesh_assert (this->closed()); - + _vec.fill(s); return *this; @@ -379,7 +379,7 @@ EigenSparseVector::operator = (const std::vector& v) else libmesh_error(); - + return *this; } @@ -436,7 +436,7 @@ void EigenSparseVector::localize (std::vector& v_local) const { v_local.resize(this->size()); - + for (numeric_index_type i=0; i PetscMatrix::PetscMatrix() : _destroy_mat_on_exit(true) @@ -213,7 +213,7 @@ void PetscMatrix::init () CHKERRABORT(libMesh::COMM_WORLD,ierr); ierr = MatSetFromOptions(_mat); CHKERRABORT(libMesh::COMM_WORLD,ierr); - + ierr = MatSeqAIJSetPreallocation(_mat, 0, (PetscInt*)(n_nz.empty()?NULL:&n_nz[0])); CHKERRABORT(libMesh::COMM_WORLD,ierr); ierr = MatMPIAIJSetPreallocation(_mat, 0, (PetscInt*)(n_nz.empty()?NULL:&n_nz[0]), diff --git a/src/numerics/petsc_vector.C b/src/numerics/petsc_vector.C index 7f9ca4027aa..4ace34f8652 100644 --- a/src/numerics/petsc_vector.C +++ b/src/numerics/petsc_vector.C @@ -275,7 +275,7 @@ template void PetscVector::add_vector_conjugate_transpose (const NumericVector&, const SparseMatrix&) { - + libMesh::out << "MatMultHermitianTranspose was introduced in PETSc 3.1.0," << "No one has made it backwards compatible with older " << "versions of PETSc so far." << std::endl; @@ -298,12 +298,12 @@ void PetscVector::add_vector_conjugate_transpose (const NumericVector& V_i // Store a temporary copy since MatMultHermitianTransposeAdd doesn't seem to work // TODO: Find out why MatMultHermitianTransposeAdd doesn't work, might be a PETSc bug? AutoPtr< NumericVector > this_clone = this->clone(); - + // The const_cast<> is not elegant, but it is required since PETSc // is not const-correct. PetscErrorCode ierr = MatMultHermitianTranspose(const_cast*>(A)->mat(), V->_vec, _vec); CHKERRABORT(libMesh::COMM_WORLD,ierr); - + // Add the temporary copy to the matvec result this->add(1., *this_clone); } diff --git a/src/numerics/preconditioner.C b/src/numerics/preconditioner.C index 6f7e1583ef6..df66659c330 100644 --- a/src/numerics/preconditioner.C +++ b/src/numerics/preconditioner.C @@ -85,6 +85,3 @@ Preconditioner::build(const SolverPackage solver_package) template class Preconditioner; } // namespace libMesh - - - diff --git a/src/numerics/sparse_shell_matrix.C b/src/numerics/sparse_shell_matrix.C index ac531936317..d1f492c33aa 100644 --- a/src/numerics/sparse_shell_matrix.C +++ b/src/numerics/sparse_shell_matrix.C @@ -46,4 +46,3 @@ void SparseShellMatrix::vector_mult_add (NumericVector& dest, template class SparseShellMatrix; } // namespace libMesh - diff --git a/src/numerics/sum_shell_matrix.C b/src/numerics/sum_shell_matrix.C index 5e866580688..32fd47f5811 100644 --- a/src/numerics/sum_shell_matrix.C +++ b/src/numerics/sum_shell_matrix.C @@ -93,4 +93,3 @@ void SumShellMatrix::get_diagonal (NumericVector& dest) const template class SumShellMatrix; } // namespace libMesh - diff --git a/src/numerics/tensor_shell_matrix.C b/src/numerics/tensor_shell_matrix.C index cacec713ec4..80f22c14304 100644 --- a/src/numerics/tensor_shell_matrix.C +++ b/src/numerics/tensor_shell_matrix.C @@ -55,4 +55,3 @@ void TensorShellMatrix::get_diagonal (NumericVector& dest) const template class TensorShellMatrix; } // namespace libMesh - diff --git a/src/numerics/tensor_tools.C b/src/numerics/tensor_tools.C index 6b300e9fd0e..8ce34d56d2c 100644 --- a/src/numerics/tensor_tools.C +++ b/src/numerics/tensor_tools.C @@ -39,7 +39,7 @@ namespace libMesh const Number duz_dx = grad(2,0); const Number duy_dx = grad(1,0); const Number dux_dy = grad(0,1); - + return VectorValue( duz_dy - duy_dz, dux_dz - duz_dx, duy_dx - dux_dy); } diff --git a/src/parallel/parallel_bin_sorter.C b/src/parallel/parallel_bin_sorter.C index 9d9bef20ab3..5a63e09cd60 100644 --- a/src/parallel/parallel_bin_sorter.C +++ b/src/parallel/parallel_bin_sorter.C @@ -146,4 +146,3 @@ template class Parallel::BinSorter; #endif } // namespace libMesh - diff --git a/src/parallel/parallel_elem.C b/src/parallel/parallel_elem.C index fac8c4e3c91..4afc0faba9c 100644 --- a/src/parallel/parallel_elem.C +++ b/src/parallel/parallel_elem.C @@ -65,16 +65,16 @@ unsigned int packed_size (const Elem*, const ElemType type = static_cast(typeint); - const unsigned int n_nodes = + const unsigned int n_nodes = Elem::type_to_n_nodes_map[type]; - const unsigned int n_sides = + const unsigned int n_sides = Elem::type_to_n_sides_map[type]; - const unsigned int pre_indexing_size = + const unsigned int pre_indexing_size = header_size + n_nodes + n_sides; - const unsigned int indexing_size = + const unsigned int indexing_size = DofObject::unpackable_indexing_size(in+pre_indexing_size); unsigned int total_packed_bc_data = 0; @@ -82,7 +82,7 @@ unsigned int packed_size (const Elem*, { for (unsigned int s = 0; s != n_sides; ++s) { - const int n_bcs = + const int n_bcs = *(in + pre_indexing_size + indexing_size + total_packed_bc_data++); libmesh_assert_greater_equal (n_bcs, 0); @@ -90,7 +90,7 @@ unsigned int packed_size (const Elem*, } } - return + return #ifndef NDEBUG 1 + // Account for magic header #endif @@ -194,7 +194,7 @@ void pack (const Elem* elem, // Add any DofObject indices elem->pack_indexing(std::back_inserter(data)); - libmesh_assert(elem->packed_indexing_size() == + libmesh_assert(elem->packed_indexing_size() == DofObject::unpackable_indexing_size(data.begin() + start_indices)); @@ -275,33 +275,33 @@ void unpack(std::vector::const_iterator in, const ElemType type = static_cast(typeint); - const unsigned int n_nodes = + const unsigned int n_nodes = Elem::type_to_n_nodes_map[type]; // int 5: processor id - const unsigned int processor_id = + const unsigned int processor_id = static_cast(*in++); libmesh_assert (processor_id < libMesh::n_processors() || processor_id == DofObject::invalid_processor_id); // int 6: subdomain id - const unsigned int subdomain_id = + const unsigned int subdomain_id = static_cast(*in++); // int 7: dof object id - const dof_id_type id = + const dof_id_type id = static_cast(*in++); libmesh_assert_not_equal_to (id, DofObject::invalid_id); #ifdef LIBMESH_ENABLE_AMR // int 8: parent dof object id - const dof_id_type parent_id = + const dof_id_type parent_id = static_cast(*in++); libmesh_assert (level == 0 || parent_id != DofObject::invalid_id); libmesh_assert (level != 0 || parent_id == DofObject::invalid_id); // int 9: local child id - const unsigned int which_child_am_i = + const unsigned int which_child_am_i = static_cast(*in++); #else in += 2; @@ -316,7 +316,7 @@ void unpack(std::vector::const_iterator in, // if we already have this element, make sure its // properties match, and update any missing neighbor // links, but then go on - if (elem) + if (elem) { libmesh_assert_equal_to (elem->level(), level); libmesh_assert_equal_to (elem->id(), id); @@ -328,7 +328,7 @@ void unpack(std::vector::const_iterator in, #ifndef NDEBUG // All our nodes should be correct for (unsigned int i=0; i != n_nodes; ++i) - libmesh_assert(elem->node(i) == + libmesh_assert(elem->node(i) == static_cast(*in++)); #else in += n_nodes; @@ -392,9 +392,9 @@ void unpack(std::vector::const_iterator in, // back to us. if (elem->neighbor(n) == remote_elem) { - elem->set_neighbor(n, neigh); + elem->set_neighbor(n, neigh); - elem->make_links_to_me_local(n); + elem->make_links_to_me_local(n); } } diff --git a/src/parallel/parallel_ghost_sync.C b/src/parallel/parallel_ghost_sync.C index ecb8e350e5a..78b41ddd5eb 100644 --- a/src/parallel/parallel_ghost_sync.C +++ b/src/parallel/parallel_ghost_sync.C @@ -49,5 +49,3 @@ void SyncNodalPositions::act_on_data (const std::vector& ids, std:: *node = data[i]; } // end for } // act_on_data() - - diff --git a/src/parallel/parallel_histogram.C b/src/parallel/parallel_histogram.C index 5deb9b86fdf..9e792bf39a5 100644 --- a/src/parallel/parallel_histogram.C +++ b/src/parallel/parallel_histogram.C @@ -113,4 +113,3 @@ template class Parallel::Histogram; #endif } // namespace libMesh - diff --git a/src/parallel/parallel_node.C b/src/parallel/parallel_node.C index 1ece053955e..5c71bb2dfb3 100644 --- a/src/parallel/parallel_node.C +++ b/src/parallel/parallel_node.C @@ -28,14 +28,14 @@ // Helper functions in anonymous namespace -namespace +namespace { using namespace libMesh; static const unsigned int header_size = 2; // use "(a+b-1)/b" trick to get a/b to round up - static const unsigned int ints_per_Real = + static const unsigned int ints_per_Real = (sizeof(Real) + sizeof(int) - 1) / sizeof(int); static const int node_magic_header = 1234567890; @@ -68,13 +68,13 @@ template <> unsigned int packed_size (const Node*, std::vector::const_iterator in) { - const unsigned int pre_indexing_size = + const unsigned int pre_indexing_size = #ifndef NDEBUG 1 + // add an int for the magic header when testing #endif header_size + LIBMESH_DIM*ints_per_Real; - const unsigned int indexing_size = + const unsigned int indexing_size = DofObject::unpackable_indexing_size(in+pre_indexing_size); const int n_bcs = @@ -112,7 +112,7 @@ void pack (const Node* node, data.push_back (static_cast(node->id())); // use "(a+b-1)/b" trick to get a/b to round up - static const unsigned int ints_per_Real = + static const unsigned int ints_per_Real = (sizeof(Real) + sizeof(int) - 1) / sizeof(int); for (unsigned int i=0; i != LIBMESH_DIM; ++i) @@ -130,7 +130,7 @@ void pack (const Node* node, // Add any DofObject indices node->pack_indexing(std::back_inserter(data)); - libmesh_assert(node->packed_indexing_size() == + libmesh_assert(node->packed_indexing_size() == DofObject::unpackable_indexing_size(data.begin() + start_indices)); @@ -246,7 +246,7 @@ void unpack (std::vector::const_iterator in, *out = node; #ifndef NDEBUG - libmesh_assert (in - original_in == + libmesh_assert (in - original_in == static_cast (Parallel::packed_size(node, original_in))); #endif @@ -261,7 +261,7 @@ void unpack (std::vector::const_iterator in, { unpack(in, out, static_cast(mesh)); } - + } // namespace Parallel #endif // #ifdef LIBMESH_HAVE_MPI diff --git a/src/partitioning/metis_partitioner.C b/src/partitioning/metis_partitioner.C index fc189a2a4eb..41a18e04a6e 100644 --- a/src/partitioning/metis_partitioner.C +++ b/src/partitioning/metis_partitioner.C @@ -305,5 +305,3 @@ void MetisPartitioner::_do_partition (MeshBase& mesh, } } // namespace libMesh - - diff --git a/src/physics/diff_physics.C b/src/physics/diff_physics.C index de117ead761..db840b0fe6f 100644 --- a/src/physics/diff_physics.C +++ b/src/physics/diff_physics.C @@ -1,16 +1,16 @@ // The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/src/physics/diff_qoi.C b/src/physics/diff_qoi.C index 6e5ab9aaae1..d21e6ff5558 100644 --- a/src/physics/diff_qoi.C +++ b/src/physics/diff_qoi.C @@ -1,16 +1,16 @@ // The libMesh Finite Element Library. // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner - + // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. - + // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. - + // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/src/quadrature/quadrature_build.C b/src/quadrature/quadrature_build.C index c61d9df411a..96cc633bbf2 100644 --- a/src/quadrature/quadrature_build.C +++ b/src/quadrature/quadrature_build.C @@ -168,4 +168,3 @@ AutoPtr QBase::build(const QuadratureType _qt, } } // namespace libMesh - diff --git a/src/quadrature/quadrature_clough.C b/src/quadrature/quadrature_clough.C index 137902c02fa..a5a8fdd9021 100644 --- a/src/quadrature/quadrature_clough.C +++ b/src/quadrature/quadrature_clough.C @@ -23,6 +23,3 @@ // quadrature_clough_3D.C // for implementation. - - - diff --git a/src/quadrature/quadrature_clough_1D.C b/src/quadrature/quadrature_clough_1D.C index a511afdd315..889a0c7550e 100644 --- a/src/quadrature/quadrature_clough_1D.C +++ b/src/quadrature/quadrature_clough_1D.C @@ -41,5 +41,3 @@ void QClough::init_1D(const ElemType _elemtype, } } // namespace libMesh - - diff --git a/src/quadrature/quadrature_gauss.C b/src/quadrature/quadrature_gauss.C index 5e356d43e35..29a9c7826f4 100644 --- a/src/quadrature/quadrature_gauss.C +++ b/src/quadrature/quadrature_gauss.C @@ -364,5 +364,3 @@ void QGauss::dunavant_rule(const Real rule_data[][4], } } // namespace libMesh - - diff --git a/src/quadrature/quadrature_gauss_1D.C b/src/quadrature/quadrature_gauss_1D.C index a4e1f43e4d7..e4e6b6a7827 100644 --- a/src/quadrature/quadrature_gauss_1D.C +++ b/src/quadrature/quadrature_gauss_1D.C @@ -789,5 +789,3 @@ void QGauss::init_1D(const ElemType, } } // namespace libMesh - - diff --git a/src/quadrature/quadrature_grid.C b/src/quadrature/quadrature_grid.C index 89f71ba1bc3..c2fa52eca4f 100644 --- a/src/quadrature/quadrature_grid.C +++ b/src/quadrature/quadrature_grid.C @@ -23,6 +23,3 @@ // quadrature_grid_3D.C // for implementation. - - - diff --git a/src/quadrature/quadrature_grid_1D.C b/src/quadrature/quadrature_grid_1D.C index 4f8842cefa1..488d826972c 100644 --- a/src/quadrature/quadrature_grid_1D.C +++ b/src/quadrature/quadrature_grid_1D.C @@ -46,5 +46,3 @@ void QGrid::init_1D(const ElemType, } } // namespace libMesh - - diff --git a/src/quadrature/quadrature_jacobi.C b/src/quadrature/quadrature_jacobi.C index d6abe6264d4..1af2c2b0ccd 100644 --- a/src/quadrature/quadrature_jacobi.C +++ b/src/quadrature/quadrature_jacobi.C @@ -21,6 +21,3 @@ // quadrature_jacobi_1D.C // for implementation. - - - diff --git a/src/quadrature/quadrature_jacobi_1D.C b/src/quadrature/quadrature_jacobi_1D.C index 05b60ed72fd..9a4bc82769f 100644 --- a/src/quadrature/quadrature_jacobi_1D.C +++ b/src/quadrature/quadrature_jacobi_1D.C @@ -1023,5 +1023,3 @@ void QJacobi::init_1D(const ElemType, } } // namespace libMesh - - diff --git a/src/quadrature/quadrature_rules.C b/src/quadrature/quadrature_rules.C index 0d32f8e773c..862933de73e 100644 --- a/src/quadrature/quadrature_rules.C +++ b/src/quadrature/quadrature_rules.C @@ -67,8 +67,3 @@ std::string QuadratureRules::name (const QuadratureType q) } } // namespace libMesh - - - - - diff --git a/src/reduced_basis/rb_assembly_expansion.C b/src/reduced_basis/rb_assembly_expansion.C index c0a9726fe62..bf346ce568d 100644 --- a/src/reduced_basis/rb_assembly_expansion.C +++ b/src/reduced_basis/rb_assembly_expansion.C @@ -103,7 +103,7 @@ void RBAssemblyExpansion::perform_output_interior_assembly(unsigned int output_i } libmesh_assert(_output_assembly_vector[output_index][q_l]); - + return _output_assembly_vector[output_index][q_l]->interior_assembly(context); } @@ -120,7 +120,7 @@ void RBAssemblyExpansion::perform_output_boundary_assembly(unsigned int output_i } libmesh_assert(_output_assembly_vector[output_index][q_l]); - + return _output_assembly_vector[output_index][q_l]->boundary_assembly(context); } @@ -200,7 +200,7 @@ ElemAssembly& RBAssemblyExpansion::get_A_assembly(unsigned int q) << std::endl; libmesh_error(); } - + return *_A_assembly_vector[q]; } @@ -212,7 +212,7 @@ ElemAssembly& RBAssemblyExpansion::get_F_assembly(unsigned int q) << std::endl; libmesh_error(); } - + return *_F_assembly_vector[q]; } @@ -226,7 +226,7 @@ ElemAssembly& RBAssemblyExpansion::get_output_assembly(unsigned int output_index << std::endl; libmesh_error(); } - + return *_output_assembly_vector[output_index][q_l]; } diff --git a/src/reduced_basis/rb_construction.C b/src/reduced_basis/rb_construction.C index 802b73ed1d7..017afabcd39 100644 --- a/src/reduced_basis/rb_construction.C +++ b/src/reduced_basis/rb_construction.C @@ -186,7 +186,7 @@ RBEvaluation& RBConstruction::get_rb_evaluation() libMesh::out << "Error: RBEvaluation object hasn't been initialized yet" << std::endl; libmesh_error(); } - + return *rb_eval; } @@ -207,11 +207,11 @@ void RBConstruction::process_parameters_file (const std::string& parameters_file const unsigned int n_training_samples = infile("n_training_samples",0); const bool deterministic_training = infile("deterministic_training",false); - + // Also, even if deterministic_training==false, we may specify one deterministic parameter std::string deterministic_training_parameter_name_in = infile("deterministic_training_parameter_name","NONE"); set_deterministic_training_parameter_name(deterministic_training_parameter_name_in); - + // We also need to specify how many times each sample of the deterministic parameter is "repeated" const unsigned int deterministic_training_parameter_repeats_in = infile("deterministic_training_parameter_repeats",1); set_deterministic_training_parameter_repeats(deterministic_training_parameter_repeats_in); @@ -281,7 +281,7 @@ void RBConstruction::process_parameters_file (const std::string& parameters_file // Read vector-based log scaling values. Note the intermediate conversion to // int... this implies log_scaling = '1 1 1...' in the input file. // log_scaling[i] = static_cast(infile("log_scaling", static_cast(log_scaling[i]), i)); - + std::string param_name = it->first; log_scaling[param_name] = static_cast(infile("log_scaling", 0, i)); i++; @@ -323,7 +323,7 @@ void RBConstruction::print_info() std::string param_name = it->first; libMesh::out << "Parameter " << param_name << ": Min = " << get_parameter_min(param_name) - << ", Max = " << get_parameter_max(param_name) + << ", Max = " << get_parameter_max(param_name) << ", value = " << get_parameters().get_value(param_name) << std::endl; } libMesh::out << "n_training_samples: " << get_n_training_samples() << std::endl; @@ -390,7 +390,7 @@ ElemAssembly& RBConstruction::get_constraint_assembly() void RBConstruction::zero_constrained_dofs_on_vector(NumericVector& vector) { const DofMap& dof_map = get_dof_map(); - + for(dof_id_type i=dof_map.first_dof(); iadd_matrix (context.get_elem_jacobian(), - context.dof_indices); + context.dof_indices); } else { @@ -658,7 +658,7 @@ void RBConstruction::add_scaled_matrix_and_vector(Number scalar, } } - + if(assemble_vector) input_vector->add_vector (context.get_elem_residual(), context.dof_indices); @@ -1081,7 +1081,7 @@ Real RBConstruction::train_reduced_basis(const std::string& directory_name, START_LOG("train_reduced_basis()", "RBConstruction"); int count = 0; - + // initialize rb_eval's parameters get_rb_evaluation().initialize_parameters(*this); @@ -1186,7 +1186,7 @@ bool RBConstruction::greedy_termination_test(Real training_greedy_error, int) << get_Nmax() << std::endl; return true; } - + if(exit_on_repeated_greedy_parameters) { for(unsigned int i=0; i::max(); } - + STOP_LOG("compute_max_error_bound()", "RBConstruction"); // Make sure we do at least one solve, but otherwise return a zero error bound @@ -2271,10 +2271,10 @@ NumericVector* RBConstruction::get_non_dirichlet_output_vector(unsigned AutoPtr RBConstruction::build_zero_dirichlet_boundary_object() { ZeroFunction<> zf; - + std::set dirichlet_ids; std::vector variables; - + // The DirichletBoundary constructor clones zf, so it's OK that zf is only in local scope return AutoPtr (new DirichletBoundary(dirichlet_ids, variables, &zf)); } @@ -2501,6 +2501,3 @@ void RBConstruction::read_riesz_representors_from_files(const std::string& riesz } // namespace libMesh - - - diff --git a/src/reduced_basis/rb_construction_base.C b/src/reduced_basis/rb_construction_base.C index ea9b58c7c51..bfc66ccbb51 100644 --- a/src/reduced_basis/rb_construction_base.C +++ b/src/reduced_basis/rb_construction_base.C @@ -112,10 +112,10 @@ template numeric_index_type RBConstructionBase::get_n_training_samples() const { libmesh_assert(training_parameters_initialized); - + if(training_parameters.empty()) return 0; - + return training_parameters.begin()->second->size(); } @@ -153,7 +153,7 @@ RBParameters RBConstructionBase::get_params_from_training_set(unsigned int libmesh_assert( (this->get_first_local_training_index() <= index) && (index < this->get_last_local_training_index()) ); - + RBParameters params; std::map< std::string, NumericVector* >::const_iterator it = training_parameters.begin(); std::map< std::string, NumericVector* >::const_iterator it_end = training_parameters.end(); @@ -161,10 +161,10 @@ RBParameters RBConstructionBase::get_params_from_training_set(unsigned int { std::string param_name = it->first; Real param_value = libmesh_real( ( *(it->second) )(index) ); - + params.set_value(param_name, param_value); } - + return params; } @@ -179,11 +179,11 @@ void RBConstructionBase::set_params_from_training_set_and_broadcast(unsign { // Set parameters on only one processor set_params_from_training_set(index); - + // set root_id, only non-zero on one processor root_id = libMesh::processor_id(); } - + // broadcast CommWorld.max(root_id); broadcast_parameters(root_id); @@ -200,7 +200,7 @@ void RBConstructionBase::initialize_training_parameters(const RBParameters libMesh::out << "Initializing training parameters with " << (deterministic ? "deterministic " : "random " ) << "training set..." << std::endl; - + std::map::iterator it = log_param_scale.begin(); std::map::const_iterator it_end = log_param_scale.end(); for(; it != it_end; ++it) @@ -302,7 +302,7 @@ void RBConstructionBase::load_training_set(std::map< std::string, std::vec { std::string param_name = it->first; NumericVector* training_vector = it->second; - + numeric_index_type first_index = training_vector->first_local_index(); for(numeric_index_type i=0; i::generate_training_parameters_random(std::mapfirst; training_parameters_in[param_name] = NumericVector::build().release(); - + if(!serial_training_set) { // Calculate the number of training parameters local to this processor @@ -518,7 +518,7 @@ void RBConstructionBase::generate_training_parameters_partially_random(con { std::string param_name = it->first; training_parameters_in[param_name] = NumericVector::build().release(); - + if(!serial_training_set) { // Calculate the number of training parameters local to this processor @@ -549,16 +549,16 @@ void RBConstructionBase::generate_training_parameters_partially_random(con { std::string param_name = it->first; NumericVector* training_vector = it->second; - + if(param_name == deterministic_training_parameter_name) { found_deterministic_parameter = true; - + // Copy code from deterministic training bool use_log_scaling = log_param_scale[param_name]; Real min_param = min_parameters.get_value(param_name); Real max_param = max_parameters.get_value(param_name); - + numeric_index_type first_index = training_vector->first_local_index(); for(numeric_index_type i=0; ilocal_size(); i++) { @@ -590,7 +590,7 @@ void RBConstructionBase::generate_training_parameters_partially_random(con training_vector->set(index, (index % n_deterministic_training_samples_in)*step_size + min_param); } } - + } else // Otherwise, generate random parameters { @@ -619,7 +619,7 @@ void RBConstructionBase::generate_training_parameters_partially_random(con } } - + if(!found_deterministic_parameter) { libMesh::out << "Error: The deterministic parameter " << deterministic_training_parameter_name @@ -673,7 +673,7 @@ void RBConstructionBase::generate_training_parameters_deterministic(std::m { std::string param_name = it->first; training_parameters_in[param_name] = NumericVector::build().release(); - + if(!serial_training_set) { // Calculate the number of training parameters local to this processor @@ -700,7 +700,7 @@ void RBConstructionBase::generate_training_parameters_deterministic(std::m bool use_log_scaling = log_param_scale.begin()->second; Real min_param = min_parameters.begin()->second; Real max_param = max_parameters.begin()->second; - + numeric_index_type first_index = training_vector->first_local_index(); for(numeric_index_type i=0; ilocal_size(); i++) { @@ -799,7 +799,7 @@ void RBConstructionBase::generate_training_parameters_deterministic(std::m // now load into training_samples_in: std::map*>::iterator new_it = training_parameters_in.begin(); - + NumericVector* training_vector_0 = new_it->second; new_it++; NumericVector* training_vector_1 = new_it->second; @@ -969,21 +969,21 @@ void RBConstructionBase::broadcast_parameters(unsigned int proc_id) // create a copy of the current parameters RBParameters current_parameters = get_parameters(); - + // copy current_parameters to current_parameters_vector in order to broadcast std::vector current_parameters_vector; - + RBParameters::const_iterator it = current_parameters.begin(); RBParameters::const_iterator it_end = current_parameters.end(); - + for( ; it != it_end; ++it) { current_parameters_vector.push_back(it->second); } - + // do the broadcast CommWorld.broadcast(current_parameters_vector, proc_id); - + // update the copy of the RBParameters object it = current_parameters.begin(); unsigned int count = 0; @@ -993,7 +993,7 @@ void RBConstructionBase::broadcast_parameters(unsigned int proc_id) current_parameters.set_value(param_name, current_parameters_vector[count]); count++; } - + // set the parameters globally set_parameters(current_parameters); } diff --git a/src/reduced_basis/rb_eim_assembly.C b/src/reduced_basis/rb_eim_assembly.C index 7ff2219f465..19735bca301 100644 --- a/src/reduced_basis/rb_eim_assembly.C +++ b/src/reduced_basis/rb_eim_assembly.C @@ -58,7 +58,7 @@ void RBEIMAssembly::evaluate_basis_function(unsigned int var, std::vector& values) { DofMap& dof_map = _rb_eim_con.get_dof_map(); - + // Get local coordinates to feed these into compute_data(). // Note that the fe_type can safely be used from the 0-variable, // since the inverse mapping is the same for all FEFamilies diff --git a/src/reduced_basis/rb_eim_construction.C b/src/reduced_basis/rb_eim_construction.C index 52c6a6023a3..a78c956a475 100644 --- a/src/reduced_basis/rb_eim_construction.C +++ b/src/reduced_basis/rb_eim_construction.C @@ -78,7 +78,7 @@ RBEIMConstruction::~RBEIMConstruction () void RBEIMConstruction::clear() { Parent::clear(); - + // clear the mesh function delete _mesh_function; _mesh_function = NULL; @@ -155,9 +155,9 @@ void RBEIMConstruction::init_data() unsigned char value = (var1==var2) ? 1 : 0; _coupling_matrix(var1,var2) = value; } - + this->get_dof_map()._dof_coupling = &_coupling_matrix; - + Parent::init_data(); } @@ -202,7 +202,7 @@ Real RBEIMConstruction::train_reduced_basis(const std::string& directory_name, { // precompute all the parametrized functions that we'll use in the greedy initialize_parametrized_functions_in_training_set(); - + return Parent::train_reduced_basis(directory_name, resize_rb_eval_data); } @@ -224,11 +224,11 @@ Number RBEIMConstruction::evaluate_mesh_function(unsigned int var_number, root_id = libMesh::processor_id(); value = values(var_number); } - + // root_id may be non-zero on more than one processor due to ghost elements // so use CommWorld.max to get just one proc id CommWorld.max(root_id); - + // Then broadcast the result CommWorld.broadcast(value, root_id); @@ -383,14 +383,14 @@ void RBEIMConstruction::initialize_parametrized_functions_in_training_set() { set_params_from_training_set(i); truth_solve(-1); - + _parametrized_functions_in_training_set[i] = solution->clone().release(); - + libMesh::out << "Completed solve for training sample " << (i+1) << " of " << get_n_training_samples() << std::endl; } - + _parametrized_functions_in_training_set_initialized = true; - + libMesh::out << "Parametrized functions in training set initialized" << std::endl << std::endl; } @@ -400,7 +400,7 @@ Real RBEIMConstruction::compute_best_fit_error() START_LOG("compute_best_fit_error()", "RBEIMConstruction"); const unsigned int RB_size = get_rb_evaluation().get_n_basis_functions(); - + // load up the parametrized function for the current parameters truth_solve(-1); @@ -483,7 +483,7 @@ Real RBEIMConstruction::truth_solve(int plot_solution) { // Check if parameters are in the training set. If so, we can just load the // solution from _parametrized_functions_in_training_set - + for(unsigned int i=0; i= 0) { @@ -505,7 +505,7 @@ Real RBEIMConstruction::truth_solve(int plot_solution) { RBEIMEvaluation& eim_eval = libmesh_cast_ref(get_rb_evaluation()); eim_eval.set_parameters( get_parameters() ); - + // Compute truth representation via projection const MeshBase& mesh = this->get_mesh(); @@ -556,7 +556,7 @@ Real RBEIMConstruction::truth_solve(int plot_solution) // Solve to find the best fit, then solution stores the truth representation // of the function to be approximated solve(); - + // Make sure we didn't max out the number of iterations if( (this->n_linear_iterations() >= this->get_equation_systems().parameters.get("linear solver maximum iterations")) && @@ -679,4 +679,3 @@ bool RBEIMConstruction::greedy_termination_test(Real training_greedy_error, int) } } // namespace libMesh - diff --git a/src/reduced_basis/rb_eim_evaluation.C b/src/reduced_basis/rb_eim_evaluation.C index 53bfede6fb4..c500eb3e08d 100644 --- a/src/reduced_basis/rb_eim_evaluation.C +++ b/src/reduced_basis/rb_eim_evaluation.C @@ -105,16 +105,16 @@ Number RBEIMEvaluation::evaluate_parametrized_function(unsigned int var_index, c Real RBEIMEvaluation::rb_solve(unsigned int N) { // Short-circuit if we are using the same parameters and value of N - if( (_previous_parameters == get_parameters()) && + if( (_previous_parameters == get_parameters()) && (_previous_N == N) ) { return _previous_error_bound; } - + // Otherwise, update _previous parameters, _previous_N _previous_parameters = get_parameters(); _previous_N = N; - + START_LOG("rb_solve()", "RBEIMEvaluation"); if(N > get_n_basis_functions()) @@ -249,12 +249,12 @@ void RBEIMEvaluation::write_offline_data_to_files(const std::string& directory_n if(libMesh::processor_id() == 0) { std::ostringstream file_name; - + // Next write out the interpolation_matrix file_name.str(""); file_name << directory_name << "/interpolation_matrix" << suffix; Xdr interpolation_matrix_out(file_name.str(), mode); - + for(unsigned int i=0; i= 2) @@ -321,7 +321,7 @@ void RBEIMEvaluation::write_offline_data_to_files(const std::string& directory_n file_name.str(""); file_name << directory_name << "/extra_interpolation_point_var" << suffix; Xdr extra_interpolation_point_var_out(file_name.str(), mode); - + extra_interpolation_point_var_out << extra_interpolation_point_var; extra_interpolation_point_var_out.close(); } @@ -370,7 +370,7 @@ void RBEIMEvaluation::read_offline_data_from_files(const std::string& directory_ file_name.str(""); file_name << directory_name << "/extra_interpolation_matrix_row" << suffix; Xdr extra_interpolation_matrix_row_in(file_name.str(), mode); - + for(unsigned int j=0; j> x_val; - + if(LIBMESH_DIM >= 2) interpolation_points_in >> y_val; @@ -404,7 +404,7 @@ void RBEIMEvaluation::read_offline_data_from_files(const std::string& directory_ file_name.str(""); file_name << directory_name << "/extra_interpolation_point" << suffix; Xdr extra_interpolation_point_in(file_name.str(), mode); - + for(unsigned int i=0; iget_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2; Aq_Aq_representor_innerprods.resize(Q_a_hat); for(unsigned int i=0; iget_n_outputs(), 0.); // Resize the output dual norm vectors @@ -193,7 +193,7 @@ void RBEvaluation::resize_data_structures(const unsigned int Nmax, unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2; output_dual_innerprods[n].resize(Q_l_hat); } - + // Clear and resize the vector of Aq_representors clear_riesz_representors(); @@ -446,10 +446,10 @@ void RBEvaluation::write_offline_data_to_files(const std::string& directory_name // Get the number of basis functions unsigned int n_bfs = get_n_basis_functions(); - + // The writing mode: ENCODE for binary, WRITE for ASCII XdrMODE mode = write_binary_data ? ENCODE : WRITE; - + // The suffix to use for all the files that are written out const std::string suffix = write_binary_data ? ".xdr" : ".dat"; @@ -472,7 +472,7 @@ void RBEvaluation::write_offline_data_to_files(const std::string& directory_name n_bfs_out << n_bfs; n_bfs_out.close(); } - + // Write out the parameter ranges file_name.str(""); file_name << directory_name << "/parameter_ranges" << suffix; @@ -604,7 +604,7 @@ void RBEvaluation::write_offline_data_to_files(const std::string& directory_name file_name.str(""); file_name << directory_name << "/Fq_Aq_innerprods" << suffix; Xdr RB_Fq_Aq_innerprods_out(file_name.str(), mode); - + for(unsigned int q_f=0; q_fget_n_F_terms(); q_f++) { for(unsigned int q_a=0; q_aget_n_A_terms(); q_a++) @@ -621,7 +621,7 @@ void RBEvaluation::write_offline_data_to_files(const std::string& directory_name file_name.str(""); file_name << directory_name << "/Aq_Aq_innerprods" << suffix; Xdr RB_Aq_Aq_innerprods_out(file_name.str(), mode); - + unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2; for(unsigned int i=0; iget_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2; for(unsigned int i=0; iget_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2; for(unsigned int q=0; qget_n_F_terms(); q_f++) { for(unsigned int q_a=0; q_aget_n_A_terms(); q_a++) @@ -848,7 +848,7 @@ void RBEvaluation::read_offline_data_from_files(const std::string& directory_nam file_name.str(""); file_name << directory_name << "/Aq_Aq_innerprods" << suffix; Xdr RB_Aq_Aq_innerprods_in(file_name.str(), mode); - + unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2; for(unsigned int i=0; i> ver_major >> dot >> ver_minor >> dot >> ver_patch; header_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch)); - + // We need to call sys.read_header (e.g. to set _written_var_indices properly), // but by setting the read_header argument to false, it doesn't reinitialize the system sys.read_header(header_data, io_version_string, /*read_header=*/false, /*read_additional_data=*/false); @@ -1043,27 +1043,27 @@ void RBEvaluation::read_in_vectors(System& sys, { file_name.str(""); // reset the string file_name << directory_name << "/" << data_name << i << basis_function_suffix; - + // On processor zero check to be sure the file exists if (libMesh::processor_id() == 0) { int stat_result = stat(file_name.str().c_str(), &stat_info); - + if (stat_result != 0) { libMesh::out << "File does not exist: " << file_name.str() << std::endl; libmesh_error(); } } - + Xdr vector_data(file_name.str(), read_binary_vectors ? DECODE : READ); - + // The bf_data needs to know which version to read. vector_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch)); - + sys.read_serialized_data(vector_data, false); - + vectors[i] = NumericVector::build().release(); vectors[i]->init (sys.n_dofs(), sys.n_local_dofs(), false, libMeshEnums::PARALLEL); @@ -1091,7 +1091,7 @@ void RBEvaluation::read_in_vectors(System& sys, if (libMesh::processor_id() == 0) { int stat_result = stat(file_name.str().c_str(), &stat_info); - + if (stat_result != 0) { libMesh::out << "File does not exist: " << file_name.str() << std::endl; @@ -1103,7 +1103,7 @@ void RBEvaluation::read_in_vectors(System& sys, read_binary_vectors ? DECODE : READ); // The vector_data needs to know which version to read. - vector_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch)); + vector_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch)); sys.read_serialized_vectors (vector_data, vectors); } @@ -1113,7 +1113,7 @@ void RBEvaluation::read_in_vectors(System& sys, sys.get_mesh().fix_broken_node_and_element_numbering(); //libMesh::out << "Finished reading in the basis functions..." << std::endl; - + STOP_LOG("read_in_vectors()", "RBEvaluation"); } diff --git a/src/reduced_basis/rb_parameters.C b/src/reduced_basis/rb_parameters.C index ecdc92913ac..1a5e95ac888 100644 --- a/src/reduced_basis/rb_parameters.C +++ b/src/reduced_basis/rb_parameters.C @@ -41,7 +41,7 @@ Real RBParameters::get_value(const std::string& param_name) const { // find the parameter value const_iterator it = _parameters.find(param_name); - + // throw and error if the parameter doesn't exist if( it == _parameters.end() ) { @@ -49,7 +49,7 @@ Real RBParameters::get_value(const std::string& param_name) const << std::endl; libmesh_error(); } - + return it->second; } @@ -67,7 +67,7 @@ unsigned int RBParameters::n_parameters() const void RBParameters::get_parameter_names(std::set& param_names) const { param_names.clear(); - + const_iterator it = _parameters.begin(); const_iterator it_end = _parameters.end(); for( ; it != it_end; ++it) @@ -100,7 +100,7 @@ std::string RBParameters::get_string(unsigned int precision) const { std::stringstream param_stringstream; param_stringstream.precision(precision); - + const_iterator it = _parameters.begin(); const_iterator it_end = _parameters.end(); for( ; it != it_end; ++it) diff --git a/src/reduced_basis/rb_parametrized.C b/src/reduced_basis/rb_parametrized.C index 587226e4bac..2f5ff00375b 100644 --- a/src/reduced_basis/rb_parametrized.C +++ b/src/reduced_basis/rb_parametrized.C @@ -39,7 +39,7 @@ RBParametrized::RBParametrized() parameters_initialized(false) { libmesh_experimental(); - + parameters.clear(); parameters_min.clear(); parameters_max.clear(); @@ -84,7 +84,7 @@ void RBParametrized::initialize_parameters(const RBParameters& mu_min_in, } } } - + parameters_min = mu_min_in; parameters_max = mu_max_in; @@ -111,7 +111,7 @@ void RBParametrized::initialize_parameters (const std::string& parameters_filena { // Read in the parameter names std::string param_name = infile("parameter_names", "NONE", i); - + for(unsigned int j=0; j<3; j++) { if(j==0) @@ -143,7 +143,7 @@ unsigned int RBParametrized::get_n_params() const libMesh::err << "Error: parameters not initialized in RBParametrized::get_n_params" << std::endl; libmesh_error(); } - + libmesh_assert_equal_to ( parameters_min.n_parameters(), parameters_max.n_parameters() ); return parameters_min.n_parameters(); @@ -225,7 +225,7 @@ void RBParametrized::print_parameters() const libMesh::err << "Error: parameters not initialized in RBParametrized::print_current_parameters" << std::endl; libmesh_error(); } - + get_parameters().print(); } @@ -234,12 +234,12 @@ void RBParametrized::write_parameter_ranges_to_file(const std::string& file_name { // The writing mode: ENCODE for binary, WRITE for ASCII XdrMODE mode = write_binary_data ? ENCODE : WRITE; - + // Write out the parameter ranges Xdr parameter_ranges_out(file_name, mode); unsigned int n_params = get_n_params(); parameter_ranges_out << n_params; - + RBParameters::const_iterator it; RBParameters::const_iterator it_end; it = get_parameters_min().begin(); @@ -248,7 +248,7 @@ void RBParametrized::write_parameter_ranges_to_file(const std::string& file_name { std::string param_name = it->first; Real param_value = it->second; - + parameter_ranges_out << param_name << param_value; } it = get_parameters_max().begin(); @@ -257,7 +257,7 @@ void RBParametrized::write_parameter_ranges_to_file(const std::string& file_name { std::string param_name = it->first; Real param_value = it->second; - + parameter_ranges_out << param_name << param_value; } parameter_ranges_out.close(); @@ -268,7 +268,7 @@ void RBParametrized::read_parameter_ranges_from_file(const std::string& file_nam { // The reading mode: DECODE for binary, READ for ASCII XdrMODE mode = read_binary_data ? DECODE : READ; - + // Read in the parameter ranges Xdr parameter_ranges_in(file_name, mode); unsigned int n_params; @@ -278,10 +278,10 @@ void RBParametrized::read_parameter_ranges_from_file(const std::string& file_nam { std::string param_name; Real param_value; - + parameter_ranges_in >> param_name; parameter_ranges_in >> param_value; - + param_min.set_value(param_name, param_value); } RBParameters param_max; @@ -289,14 +289,14 @@ void RBParametrized::read_parameter_ranges_from_file(const std::string& file_nam { std::string param_name; Real param_value; - + parameter_ranges_in >> param_name; parameter_ranges_in >> param_value; - + param_max.set_value(param_name, param_value); } parameter_ranges_in.close(); - + initialize_parameters(param_min, param_max, param_min); } @@ -319,10 +319,10 @@ bool RBParametrized::valid_params(const RBParameters& params) valid = valid && ( (get_parameter_min(param_name) <= params.get_value(param_name)) && (params.get_value(param_name) <= get_parameter_max(param_name)) ); } - + if(!valid && verbose_mode) { - libMesh::out << "Warning: parameter is outside parameter range" << std::endl; + libMesh::out << "Warning: parameter is outside parameter range" << std::endl; } return valid; diff --git a/src/reduced_basis/rb_scm_construction.C b/src/reduced_basis/rb_scm_construction.C index 2e9b415713c..5dd1dac02af 100644 --- a/src/reduced_basis/rb_scm_construction.C +++ b/src/reduced_basis/rb_scm_construction.C @@ -83,7 +83,7 @@ RBSCMEvaluation& RBSCMConstruction::get_rb_scm_evaluation() libMesh::out << "Error: RBSCMEvaluation object hasn't been initialized yet" << std::endl; libmesh_error(); } - + return *rb_scm_eval; } @@ -124,7 +124,7 @@ void RBSCMConstruction::process_parameters_file(const std::string& parameters_fi // Read vector-based log scaling values. Note the intermediate conversion to // int... this implies log_scaling = '1 1 1...' in the input file. // log_scaling[i] = static_cast(infile("log_scaling", static_cast(log_scaling[i]), i)); - + std::string param_name = it->first; log_scaling[param_name] = static_cast(infile("log_scaling", 0, i)); i++; @@ -159,7 +159,7 @@ void RBSCMConstruction::print_info() std::string param_name = it->first; libMesh::out << "Parameter " << param_name << ": Min = " << get_parameter_min(param_name) - << ", Max = " << get_parameter_max(param_name) + << ", Max = " << get_parameter_max(param_name) << ", value = " << get_parameters().get_value(param_name) << std::endl; } libMesh::out << "n_training_samples: " << get_n_training_samples() << std::endl; @@ -214,7 +214,7 @@ void RBSCMConstruction::perform_SCM_greedy() std::set constrained_dofs_set; EquationSystems& es = this->get_equation_systems(); RBConstruction& rb_system = es.get_system(RB_system_name); - + for(unsigned int i=0; iget_n_A_terms(); j++) @@ -490,13 +490,13 @@ void RBSCMEvaluation::read_offline_data_from_files(const std::string& directory_ // The reading mode: DECODE for binary, READ for ASCII XdrMODE mode = read_binary_data ? DECODE : READ; - + // The suffix to use for all the files that are written out const std::string suffix = read_binary_data ? ".xdr" : ".dat"; // The string stream we'll use to make the file names std::ostringstream file_name; - + // Read in the parameter ranges file_name.str(""); file_name << directory_name << "/parameter_ranges" << suffix; @@ -507,7 +507,7 @@ void RBSCMEvaluation::read_offline_data_from_files(const std::string& directory_ file_name.str(""); file_name << directory_name << "/B_min" << suffix; Xdr B_min_in(file_name.str(), mode); - + B_min.clear(); for(unsigned int i=0; iget_n_A_terms(); i++) { @@ -523,7 +523,7 @@ void RBSCMEvaluation::read_offline_data_from_files(const std::string& directory_ file_name.str(""); file_name << directory_name << "/B_max" << suffix; Xdr B_max_in(file_name.str(), mode); - + B_max.clear(); for(unsigned int i=0; iget_n_A_terms(); i++) { @@ -536,7 +536,7 @@ void RBSCMEvaluation::read_offline_data_from_files(const std::string& directory_ file_name.str(""); file_name << directory_name << "/C_J_length" << suffix; Xdr C_J_length_in(file_name.str(), mode); - + unsigned int C_J_length; C_J_length_in >> C_J_length; C_J_length_in.close(); @@ -545,7 +545,7 @@ void RBSCMEvaluation::read_offline_data_from_files(const std::string& directory_ file_name.str(""); file_name << directory_name << "/C_J_stability_vector" << suffix; Xdr C_J_stability_vector_in(file_name.str(), mode); - + C_J_stability_vector.clear(); for(unsigned int i=0; i(get_rb_evaluation()); trans_rb_eval.pull_temporal_discretization_data( *this ); @@ -246,7 +246,7 @@ void TransientRBConstruction::allocate_data_structures() dof_map.attach_matrix(*non_dirichlet_L2_matrix); non_dirichlet_L2_matrix->init(); non_dirichlet_L2_matrix->zero(); - + non_dirichlet_M_q_vector.resize(Q_m); for(unsigned int q=0; qget_n_basis_functions(); - + // The reading mode: DECODE for binary, READ for ASCII XdrMODE mode = read_binary_data ? DECODE : READ; - + // The suffix to use for all the files that are written out const std::string suffix = read_binary_data ? ".xdr" : ".dat"; // The string stream we'll use to make the file names std::ostringstream file_name; - + // Write out the temporal discretization data file_name.str(""); file_name << directory_name << "/temporal_discretization_data" << suffix; Xdr temporal_discretization_data_in(file_name.str(), mode); - + Real real_value; unsigned int int_value; temporal_discretization_data_in >> real_value; set_delta_t(real_value); temporal_discretization_data_in >> real_value; set_euler_theta(real_value); temporal_discretization_data_in >> int_value; set_n_time_steps(int_value); temporal_discretization_data_in >> int_value; set_time_step(int_value); temporal_discretization_data_in.close(); - + file_name.str(""); file_name << directory_name << "/RB_L2_matrix" << suffix; Xdr RB_L2_matrix_in(file_name.str(), mode); - + for(unsigned int i=0; iget_equation_systems().get_mesh().n_nodes() == from_sys->get_equation_systems().get_mesh().n_nodes()); libmesh_assert(from_var.type() == to_var.type()); - + // get dof indices for source variable unsigned int from_vn = from_var.number(); std::set from_var_indices; @@ -52,14 +52,14 @@ DirectSolutionTransfer::transfer(const Variable & from_var, const Variable & to_ unsigned int to_vn = to_var.number(); std::set to_var_indices; to_sys->local_dof_indices(to_vn, to_var_indices); - + // copy the values from from solution vector to to solution vector std::set::iterator from_it = from_var_indices.begin(); std::set::iterator from_it_end = from_var_indices.end(); std::set::iterator to_it = to_var_indices.begin(); NumericVector & from_solution = *from_sys->solution; - + for (; from_it != from_it_end; ++from_it, ++to_it) to_sys->solution->set(*to_it, from_solution(*from_it)); diff --git a/src/solution_transfer/dtk_evaluator.C b/src/solution_transfer/dtk_evaluator.C index 98b752e70f3..bbfcf51fe02 100644 --- a/src/solution_transfer/dtk_evaluator.C +++ b/src/solution_transfer/dtk_evaluator.C @@ -35,12 +35,12 @@ DTKEvaluator::evaluate(const Teuchos::ArrayRCP& elements, const Teuchos::Ar for(unsigned int i=0; i& elements, const Teuchos::Ar for (unsigned int j=0; jn_field_variables()); } - + void MeshfreeInterpolation::prepare_for_use () { switch (_parallelization_strategy) @@ -137,7 +137,7 @@ namespace libMesh void MeshfreeInterpolation::gather_remote_data () { #ifndef LIBMESH_HAVE_MPI - + // no MPI -- no-op return; @@ -149,17 +149,17 @@ namespace libMesh START_LOG ("gather_remote_data()", "MeshfreeInterpolation"); std::vector send_buf, recv_buf; - + libmesh_assert_equal_to (_src_vals.size(), _src_pts.size()*this->n_field_variables()); - + send_buf.reserve (_src_pts.size()*(3 + this->n_field_variables())); // Everyone packs their data at the same time for (unsigned int p_idx=0, v_idx=0; p_idx<_src_pts.size(); p_idx++) { const Point &pt(_src_pts[p_idx]); - + send_buf.push_back(pt(0)); send_buf.push_back(pt(1)); send_buf.push_back(pt(2)); @@ -168,21 +168,21 @@ namespace libMesh { libmesh_assert_less (v_idx, _src_vals.size()); #ifdef LIBMESH_USE_COMPLEX_NUMBERS - send_buf.push_back (_src_vals[v_idx].real()); - send_buf.push_back (_src_vals[v_idx].imag()); + send_buf.push_back (_src_vals[v_idx].real()); + send_buf.push_back (_src_vals[v_idx].imag()); v_idx++; - + #else - send_buf.push_back (_src_vals[v_idx++]); + send_buf.push_back (_src_vals[v_idx++]); #endif } } - // Send our data to everyone else. Note that MPI-1 said you could not - // use the same buffer in nonblocking sends, but that restriction has + // Send our data to everyone else. Note that MPI-1 said you could not + // use the same buffer in nonblocking sends, but that restriction has // recently been removed. std::vector send_request(libMesh::n_processors()-1); - + // Use a tag for best practices. In debug mode parallel_only() blocks above // so we can be sure there is no other shenanigarry going on, but in optimized // mode there is no such guarantee - other prcoessors could be somewhere else @@ -192,7 +192,7 @@ namespace libMesh for (unsigned int proc=0, cnt=0; procn_field_variables(); var++) { #ifdef LIBMESH_USE_COMPLEX_NUMBERS @@ -249,9 +249,9 @@ namespace libMesh _kd_tree.reset (new kd_tree_t (KDDim, _point_list_adaptor, nanoflann::KDTreeSingleIndexAdaptorParams(10 /* max leaf */))); - + libmesh_assert (_kd_tree.get() != NULL); - + _kd_tree->buildIndex(); STOP_LOG ("construct_kd_tree()", "InverseDistanceInterpolation<>"); @@ -268,7 +268,7 @@ namespace libMesh if (_kd_tree.get()) _kd_tree.reset (NULL); #endif - + // Call base class clear method MeshfreeInterpolation::clear(); } @@ -298,18 +298,18 @@ namespace libMesh { libMesh::err << "ERROR: when adding field data to an existing list the\n" << "varaible list must be the same!\n"; - libmesh_error(); + libmesh_error(); } for (unsigned int v=0; v<_names.size(); v++) if (_names[v] != field_names[v]) { libMesh::err << "ERROR: when adding field data to an existing list the\n" << "varaible list must be the same!\n"; - libmesh_error(); - } - + libmesh_error(); + } + tgt_vals.resize (tgt_pts.size()*this->n_field_variables()); - + std::vector::iterator out_it = tgt_vals.begin(); #ifdef LIBMESH_HAVE_NANOFLANN @@ -319,7 +319,7 @@ namespace libMesh std::vector ret_index(num_results); std::vector ret_dist_sqr(num_results); - for (std::vector::const_iterator tgt_it=tgt_pts.begin(); + for (std::vector::const_iterator tgt_it=tgt_pts.begin(); tgt_it != tgt_pts.end(); ++tgt_it) { const Point &tgt(*tgt_it); @@ -331,18 +331,18 @@ namespace libMesh // std::cout << "knnSearch(): num_results=" << num_results << "\n"; // for (size_t i=0;in_field_variables(); _vals.resize(n_fv); /**/ std::fill (_vals.begin(), _vals.end(), Number(0.)); - + Real tot_weight = 0.; std::vector::const_iterator src_dist_sqr_it=src_dist_sqr.begin(); @@ -393,7 +393,7 @@ namespace libMesh (src_idx_it != src_indices.end())) { libmesh_assert_greater_equal (*src_dist_sqr_it, 0.); - + const Real dist_sq = std::max(*src_dist_sqr_it, std::numeric_limits::epsilon()), weight = 1./std::pow(dist_sq, _half_power); @@ -415,15 +415,15 @@ namespace libMesh // don't forget normalizing term & set the output buffer! for (unsigned int v=0; v; @@ -431,4 +431,3 @@ namespace libMesh template class InverseDistanceInterpolation<3>; } // namespace libMesh - diff --git a/src/solution_transfer/meshfree_solution_transfer.C b/src/solution_transfer/meshfree_solution_transfer.C index 27122031ab1..d362f82ecc7 100644 --- a/src/solution_transfer/meshfree_solution_transfer.C +++ b/src/solution_transfer/meshfree_solution_transfer.C @@ -37,7 +37,7 @@ class DenseVector; // Helper function for doing the projection class MeshlessInterpolationFunction : public FunctionBase -{ +{ public: MeshlessInterpolationFunction (const MeshfreeInterpolation &mfi, Threads::spin_mutex &mutex) : @@ -49,7 +49,7 @@ public: void clear () {} virtual AutoPtr > clone () const - { + { return AutoPtr > (new MeshlessInterpolationFunction (_mfi, _mutex) ); } @@ -61,7 +61,7 @@ public: _vals.resize(1); Threads::spin_mutex::scoped_lock lock(_mutex); - + _mfi.interpolate_field_data(_mfi.field_variables(), _pts, _vals); return _vals.front(); @@ -86,7 +86,7 @@ private: void MeshfreeSolutionTransfer::transfer(const Variable & from_var, const Variable & to_var) -{ +{ libmesh_experimental(); System * from_sys = from_var.system(); @@ -95,13 +95,13 @@ MeshfreeSolutionTransfer::transfer(const Variable & from_var, const Variable & t EquationSystems & from_es = from_sys->get_equation_systems(); MeshBase & from_mesh = from_es.get_mesh(); - + InverseDistanceInterpolation idi (4, 2); std::vector &src_pts (idi.get_source_points()); std::vector &src_vals (idi.get_source_vals()); - - std::vector field_vars; + + std::vector field_vars; field_vars.push_back(from_var.name()); idi.set_field_variables(field_vars); @@ -116,7 +116,7 @@ MeshfreeSolutionTransfer::transfer(const Variable & from_var, const Variable & t const Node *node(*nd); src_pts.push_back(*node); src_vals.push_back((*from_sys->solution)(node->dof_number(from_sys->number(),from_var.number(),0))); - } + } } // We have only set local values - prepare for use by gathering remote gata @@ -129,7 +129,7 @@ MeshfreeSolutionTransfer::transfer(const Variable & from_var, const Variable & t MeshlessInterpolationFunction mif(idi, mutex); // project the solution - to_sys->project_solution(&mif); + to_sys->project_solution(&mif); } } // namespace libMesh diff --git a/src/solution_transfer/meshfunction_solution_transfer.C b/src/solution_transfer/meshfunction_solution_transfer.C index fcc61f416e5..cac810bb154 100644 --- a/src/solution_transfer/meshfunction_solution_transfer.C +++ b/src/solution_transfer/meshfunction_solution_transfer.C @@ -58,10 +58,10 @@ MeshFunctionSolutionTransfer::transfer(const Variable & from_var, const Variable MeshFunction from_func(from_es, *serialized_solution, from_sys->get_dof_map(), to_var_num); from_func.init(); - + MeshBase::const_node_iterator nd = to_sys->get_mesh().local_nodes_begin(); MeshBase::const_node_iterator nd_end = to_sys->get_mesh().local_nodes_end(); - + // Now loop over the nodes of the 'To' mesh setting values for each variable. for(;nd != nd_end; ++nd) // 0 is for the value component diff --git a/src/solution_transfer/radial_basis_interpolation.C b/src/solution_transfer/radial_basis_interpolation.C index a9f0fbfe2c7..687ee0a1f1b 100644 --- a/src/solution_transfer/radial_basis_interpolation.C +++ b/src/solution_transfer/radial_basis_interpolation.C @@ -50,10 +50,10 @@ namespace libMesh InverseDistanceInterpolation::construct_kd_tree(); #ifndef LIBMESH_HAVE_EIGEN - + libMesh::err << "ERROR: this functionality presently requires Eigen!\n"; libmesh_error(); - + #else START_LOG ("prepare_for_use()", "RadialBasisInterpolation<>"); @@ -63,12 +63,12 @@ namespace libMesh const unsigned int n_src_pts = this->_src_pts.size(); const unsigned int n_vars = this->n_field_variables(); libmesh_assert_equal_to (this->_src_vals.size(), n_src_pts*this->n_field_variables()); - + { - Point + Point &p_min(_src_bbox.min()), &p_max(_src_bbox.max()); - + for (unsigned int p=0; p"); #endif - + } @@ -157,12 +157,12 @@ namespace libMesh libmesh_experimental(); - const unsigned int + const unsigned int n_vars = this->n_field_variables(), n_src_pts = this->_src_pts.size(), n_tgt_pts = tgt_pts.size(); - - libmesh_assert_equal_to (_weights.size(), this->_src_vals.size()); + + libmesh_assert_equal_to (_weights.size(), this->_src_vals.size()); libmesh_assert_equal_to (field_names.size(), this->n_field_variables()); // If we already have field variables, we assume we are appending. @@ -171,21 +171,21 @@ namespace libMesh { libMesh::err << "ERROR: when adding field data to an existing list the\n" << "varaible list must be the same!\n"; - libmesh_error(); + libmesh_error(); } for (unsigned int v=0; v_names.size(); v++) if (_names[v] != field_names[v]) { libMesh::err << "ERROR: when adding field data to an existing list the\n" << "varaible list must be the same!\n"; - libmesh_error(); - } - + libmesh_error(); + } + RBF rbf(_r_bbox); - + tgt_vals.resize (n_tgt_pts*n_vars); /**/ std::fill (tgt_vals.begin(), tgt_vals.end(), Number(0.)); - + for (unsigned int tgt=0; tgt"); + STOP_LOG ("interpolate_field_data()", "RadialBasisInterpolation<>"); } - + // ------------------------------------------------------------ // Explicit Instantiations template class RadialBasisInterpolation<3, WendlandRBF<3,0> >; @@ -215,4 +215,3 @@ namespace libMesh template class RadialBasisInterpolation<3, WendlandRBF<3,8> >; } // namespace libMesh - diff --git a/src/solvers/eigen_sparse_linear_solver.C b/src/solvers/eigen_sparse_linear_solver.C index 05b7516330f..57fbe26310f 100644 --- a/src/solvers/eigen_sparse_linear_solver.C +++ b/src/solvers/eigen_sparse_linear_solver.C @@ -73,14 +73,14 @@ EigenSparseLinearSolver::solve (SparseMatrix &matrix_in, EigenSparseMatrix& matrix = libmesh_cast_ref&>(matrix_in); EigenSparseVector& solution = libmesh_cast_ref&>(solution_in); EigenSparseVector& rhs = libmesh_cast_ref&>(rhs_in); - + // Close the matrix and vectors in case this wasn't already done. matrix.close(); solution.close(); rhs.close(); std::pair retval(0,0.); - + // Solve the linear system switch (this->_solver_type) { @@ -127,7 +127,7 @@ EigenSparseLinearSolver::solve (SparseMatrix &matrix_in, this->_solver_type = BICGSTAB; STOP_LOG("solve()", "EigenSparseLinearSolver"); - + return this->solve (matrix, solution, rhs, @@ -135,7 +135,7 @@ EigenSparseLinearSolver::solve (SparseMatrix &matrix_in, m_its); } } - + STOP_LOG("solve()", "EigenSparseLinearSolver"); return retval; } @@ -150,19 +150,19 @@ EigenSparseLinearSolver::adjoint_solve (SparseMatrix &matrix_in, const double tol, const unsigned int m_its) { - + START_LOG("adjoint_solve()", "EigenSparseLinearSolver"); libmesh_experimental(); EigenSparseMatrix mat_trans; matrix_in.get_transpose(mat_trans); - + std::pair retval = this->solve (mat_trans, solution_in, rhs_in, tol, m_its); - + STOP_LOG("adjoint_solve()", "EigenSparseLinearSolver"); return retval; @@ -204,7 +204,7 @@ template void EigenSparseLinearSolver::set_eigen_preconditioner_type () { libmesh_not_implemented(); - + // switch (this->_preconditioner_type) // { // case IDENTITY_PRECOND: @@ -230,7 +230,7 @@ void EigenSparseLinearSolver::set_eigen_preconditioner_type () } - + template void EigenSparseLinearSolver::print_converged_reason() { diff --git a/src/solvers/linear_solver.C b/src/solvers/linear_solver.C index 9fe4be34102..ea00a0c8e57 100644 --- a/src/solvers/linear_solver.C +++ b/src/solvers/linear_solver.C @@ -180,6 +180,3 @@ template class LinearSolver; } // namespace libMesh - - - diff --git a/src/solvers/memory_solution_history.C b/src/solvers/memory_solution_history.C index ab87f5f4711..3fc35967692 100644 --- a/src/solvers/memory_solution_history.C +++ b/src/solvers/memory_solution_history.C @@ -23,9 +23,9 @@ namespace libMesh // Loop over all the saved vectors for (; vec != vec_end; ++vec) - { + { // Delete this saved vector - delete vec->second; + delete vec->second; } } } @@ -68,7 +68,7 @@ namespace libMesh // This functions saves all the 'projection-worthy' system vectors for // future use void MemorySolutionHistory::store() - { + { this->find_stored_entry(); // In an empty history we create the first entry @@ -109,10 +109,10 @@ namespace libMesh // Map of stored vectors for this solution step std::map *>& saved_vectors = stored_sols->second; - + // Loop over all the system vectors for (System::vectors_iterator vec = _system.vectors_begin(); vec != _system.vectors_end(); ++vec) - { + { // The name of this vector const std::string& vec_name = vec->first; @@ -127,9 +127,9 @@ namespace libMesh saved_vectors[vec_name] = vec->second->clone().release(); } } - + // Of course, we will usually save the actual solution - std::string _solution("_solution"); + std::string _solution("_solution"); if ((overwrite_previously_stored || !saved_vectors.count(_solution)) && // and if we think it's worth preserving @@ -138,7 +138,7 @@ namespace libMesh } void MemorySolutionHistory::retrieve() - { + { this->find_stored_entry(); // Get the time at which we are recovering the solution vectors @@ -148,7 +148,7 @@ namespace libMesh // std::cout << "Recovering solution vectors at time: " << // recovery_time << std::endl; - // Do we not have a solution for this time? Then + // Do we not have a solution for this time? Then // there's nothing to do. if(stored_sols == stored_solutions.end() || std::abs(recovery_time - _system.time) > TOLERANCE) @@ -166,10 +166,10 @@ namespace libMesh // Loop over all the saved vectors for (; vec != vec_end; ++vec) - { + { // The name of this vector const std::string& vec_name = vec->first; - + // Get the vec_name entry in the saved vectors map and set the // current system vec[vec_name] entry to it if (vec_name != "_solution") diff --git a/src/solvers/nonlinear_solver.C b/src/solvers/nonlinear_solver.C index 81968a03972..5cd905773c9 100644 --- a/src/solvers/nonlinear_solver.C +++ b/src/solvers/nonlinear_solver.C @@ -105,6 +105,3 @@ NonlinearSolver::attach_preconditioner(Preconditioner * preconditioner) template class NonlinearSolver; } // namespace libMesh - - - diff --git a/src/solvers/petscdmlibmesh.C b/src/solvers/petscdmlibmesh.C index 5d92ec3343c..7ad92c47487 100644 --- a/src/solvers/petscdmlibmesh.C +++ b/src/solvers/petscdmlibmesh.C @@ -34,7 +34,7 @@ struct DM_libMesh std::map *varnames; std::map *blockids; std::map *blocknames; - unsigned int decomposition_type; + unsigned int decomposition_type; std::vector > *decomposition; unsigned int embedding_type; IS embedding; @@ -147,11 +147,11 @@ PetscErrorCode DMLibMeshSetSystem(DM dm, NonlinearImplicitSystem& sys) PetscBool islibmesh; ierr = PetscObjectTypeCompare((PetscObject)dm, DMLIBMESH,&islibmesh); if(!islibmesh) SETERRQ2(((PetscObject)dm)->comm, PETSC_ERR_ARG_WRONG, "Got DM oftype %s, not of type %s", ((PetscObject)dm)->type_name, DMLIBMESH); - + if(dm->setupcalled) SETERRQ(((PetscObject)dm)->comm, PETSC_ERR_ARG_WRONGSTATE, "Cannot reset the libMesh system after DM has been set up."); DM_libMesh *dlm = (DM_libMesh *)(dm->data); dlm->sys =&sys; - /* Initially populate the sets of active blockids and varids using all of the + /* Initially populate the sets of active blockids and varids using all of the existing blocks/variables (only variables are supported at the moment). */ DofMap& dofmap = dlm->sys->get_dof_map(); dlm->varids->clear(); @@ -183,9 +183,9 @@ PetscErrorCode DMLibMeshSetSystem(DM dm, NonlinearImplicitSystem& sys) subdomain_id_type bid = *bit; std::string bname = mesh.subdomain_name(bid); if(!bname.length()) { - /* Block names are currently implemented for Exodus II meshes - only, so we might have to make up our own block names and - maintain our own mapping of block ids to names. + /* Block names are currently implemented for Exodus II meshes + only, so we might have to make up our own block names and + maintain our own mapping of block ids to names. */ std::ostringstream ss; ss << "dm" << bid; @@ -254,7 +254,7 @@ static PetscErrorCode DMCreateFieldDecomposition_libMesh(DM dm, PetscInt *len, const Elem* elem = *el; //unsigned int e_subdomain = elem->subdomain_id(); std::vector evindices; - // Get the degree of freedom indices for the given variable off the current element. + // Get the degree of freedom indices for the given variable off the current element. dofmap.dof_indices(elem, evindices, v); for(unsigned int i = 0; i < evindices.size(); ++i) { unsigned int dof = evindices[i]; @@ -303,11 +303,11 @@ static PetscErrorCode DMCreateFieldDecomposition_libMesh(DM dm, PetscInt *len, DM_libMesh *ddlm = (DM_libMesh*)(ddm->data); ddlm->sys = dlm->sys; /* copy over the block ids and names */ - *ddlm->blockids = *dlm->blockids; + *ddlm->blockids = *dlm->blockids; *ddlm->blocknames = *dlm->blocknames; /* set the vars from the d-th part of the decomposition. */ - *ddlm->varids = dvarids; - *ddlm->varnames = dvarnames; + *ddlm->varids = dvarids; + *ddlm->varnames = dvarnames; ierr = PetscObjectReference((PetscObject)emb); CHKERRQ(ierr); ddlm->embedding = emb; ddlm->embedding_type = DMLIBMESH_FIELD_EMBEDDING; @@ -358,7 +358,7 @@ static PetscErrorCode DMCreateDomainDecomposition_libMesh(DM dm, PetscInt *len, /* Iterate only over this DM's variables. */ for(std::map::const_iterator vit = dlm->varids->begin(); vit != dlm->varids->end(); ++vit) { unsigned int v = vit->second; - // Get the degree of freedom indices for the given variable off the current element. + // Get the degree of freedom indices for the given variable off the current element. sys->get_dof_map().dof_indices(elem, evindices, v); for(unsigned int i = 0; i < evindices.size(); ++i) { unsigned int dof = evindices[i]; @@ -411,11 +411,11 @@ static PetscErrorCode DMCreateDomainDecomposition_libMesh(DM dm, PetscInt *len, DM_libMesh *ddlm = (DM_libMesh*)(ddm->data); ddlm->sys = dlm->sys; /* copy over the varids and varnames */ - *ddlm->varids = *dlm->varids; - *ddlm->varnames = *dlm->varnames; + *ddlm->varids = *dlm->varids; + *ddlm->varnames = *dlm->varnames; /* set the blocks from the d-th part of the decomposition. */ - *ddlm->blockids = dblockids; - *ddlm->blocknames = dblocknames; + *ddlm->blockids = dblockids; + *ddlm->blocknames = dblocknames; ierr = PetscObjectReference((PetscObject)emb); CHKERRQ(ierr); ddlm->embedding = emb; ddlm->embedding_type = DMLIBMESH_DOMAIN_EMBEDDING; @@ -446,8 +446,8 @@ PetscErrorCode DMLibMeshCreateFieldDecompositionDM(DM dm, PetscInt dnumber, Pets ierr = DMSetType(*ddm, DMLIBMESH); CHKERRQ(ierr); DM_libMesh *ddlm = (DM_libMesh *)((*ddm)->data); ddlm->sys = dlm->sys; - ddlm->varids = dlm->varids; - ddlm->varnames = dlm->varnames; + ddlm->varids = dlm->varids; + ddlm->varnames = dlm->varnames; ddlm->blockids = dlm->blockids; ddlm->blocknames = dlm->blocknames; ddlm->decomposition = new(std::vector >); @@ -459,7 +459,7 @@ PetscErrorCode DMLibMeshCreateFieldDecompositionDM(DM dm, PetscInt dnumber, Pets for(PetscInt v = 0; v < dsizes[d]; ++v) { std::string vname(dvarlists[d][v]); std::map::const_iterator vit = dlm->varids->find(vname); - if(vit == dlm->varids->end()) + if(vit == dlm->varids->end()) SETERRQ3(((PetscObject)dm)->comm, PETSC_ERR_ARG_WRONG, "Variable %D on the %D-th list with name %s is not owned by this DM", v, d, dvarlists[d][v]); unsigned int vid = vit->second; (*ddlm->decomposition)[d].insert(vid); @@ -499,10 +499,10 @@ PetscErrorCode DMLibMeshCreateDomainDecompositionDM(DM dm, PetscInt dnumber, Pet ierr = DMSetType(*ddm, DMLIBMESH); CHKERRQ(ierr); DM_libMesh *ddlm = (DM_libMesh *)((*ddm)->data); ddlm->sys = dlm->sys; - ddlm->varids = dlm->varids; - ddlm->varnames = dlm->varnames; - ddlm->blockids = dlm->blockids; - ddlm->blocknames = dlm->blocknames; + ddlm->varids = dlm->varids; + ddlm->varnames = dlm->varnames; + ddlm->blockids = dlm->blockids; + ddlm->blocknames = dlm->blocknames; ddlm->decomposition = new(std::vector >); ddlm->decomposition_type = DMLIBMESH_DOMAIN_DECOMPOSITION; if(dnumber) { @@ -512,7 +512,7 @@ PetscErrorCode DMLibMeshCreateDomainDecompositionDM(DM dm, PetscInt dnumber, Pet for(PetscInt b = 0; b < dsizes[d]; ++b) { std::string bname(dblocklists[d][b]); std::map::const_iterator bit = dlm->blockids->find(bname); - if(bit == dlm->blockids->end()) + if(bit == dlm->blockids->end()) SETERRQ3(((PetscObject)dm)->comm, PETSC_ERR_ARG_WRONG, "Block %D on the %D-th list with name %s is not owned by this DM", b, d, dblocklists[d][b]); unsigned int bid = bit->second; (*ddlm->decomposition)[d].insert(bid); @@ -550,13 +550,13 @@ static PetscErrorCode DMLibMeshParseDecompositionDescriptor_Private(DM dm, cons struct token *llfirst = PETSC_NULL, *lllast = PETSC_NULL, *tok; PetscInt stcount = 0, brcount = 0, d, i; size_t len0, count; - - /* - Parse the decomposition descriptor. + + /* + Parse the decomposition descriptor. Decomposition names could be of one of two forms: var:v1,v2;v3,v4;v4,v5; block:b1,b2;b3,b4;b4,b5; - resulting in an overlapping decomposition that groups + resulting in an overlapping decomposition that groups variables (v1,v2), (v3,v4), (v4,v5) or blocks (b1,b2), (b3,b4), (b4,b5). */ @@ -576,24 +576,24 @@ static PetscErrorCode DMLibMeshParseDecompositionDescriptor_Private(DM dm, cons } else { ierr = PetscStrcmp(s0,"block",&eq);CHKERRQ(ierr); - if(!eq) + if(!eq) SETERRQ1(((PetscObject)dm)->comm, PETSC_ERR_ARG_WRONG, "Could not determine decomposition type from descriptor: %s\n", ddesc); CHKERRQ(ierr); *dtype=DMLIBMESH_DOMAIN_DECOMPOSITION; } ierr = PetscStrlen(s0,&count); CHKERRQ(ierr); while(count < len0) { struct token *st, *br; - ++ss; ++count; + ++ss; ++count; s=ss; while(*ss && *ss != ',' && *ss != ';') { ++ss; ++count; } st = PETSC_NULL; br = PETSC_NULL; if(*ss) { - /* + /* Found a separator, or a break. Add an appropriate token to the list. - A token separator ',' produces no token. + A token separator ',' produces no token. */ if(*ss == ';') { /* Create a break token: a token with a null string. */ @@ -623,14 +623,14 @@ static PetscErrorCode DMLibMeshParseDecompositionDescriptor_Private(DM dm, cons } } } - } + } /* The result of parsing is in the linked list ll. */ /* Count up the strings and the breaks. */ tok = llfirst; while(tok) { - if(tok->s) + if(tok->s) ++stcount; - else + else ++brcount; tok = tok->next; } @@ -641,9 +641,9 @@ static PetscErrorCode DMLibMeshParseDecompositionDescriptor_Private(DM dm, cons for(d = 0; d < *dcount; ++d) (*dsizes)[d] = 0; tok = llfirst; d = 0; while(tok) { - if(tok->s) + if(tok->s) ++(*dsizes)[d]; - else + else ++d; tok = tok->next; } @@ -681,7 +681,7 @@ static PetscErrorCode DMCreateFieldDecompositionDM_libMesh(DM dm, const char* d PetscFunctionBegin; *ddm = PETSC_NULL; ierr = DMLibMeshParseDecompositionDescriptor_Private(dm,ddesc,&dtype,&dcount,&dsizes,&dlists); CHKERRQ(ierr); - if(dtype == DMLIBMESH_FIELD_DECOMPOSITION){ + if(dtype == DMLIBMESH_FIELD_DECOMPOSITION){ ierr = DMLibMeshCreateFieldDecompositionDM(dm,dcount,dsizes,dlists,ddm); CHKERRQ(ierr); } else SETERRQ1(((PetscObject)dm)->comm, PETSC_ERR_PLIB, "Uexpected unknown decomposition type for field decomposition descriptor %s", ddesc); @@ -996,7 +996,7 @@ static PetscErrorCode DMView_libMesh(DM dm, PetscViewer viewer) for(unsigned int d = 0; d < dlm->decomposition->size(); ++d) { std::set::iterator dbegin = (*dlm->decomposition)[d].begin(); std::set::iterator dit = (*dlm->decomposition)[d].begin(); - std::set::iterator dend = (*dlm->decomposition)[d].end(); + std::set::iterator dend = (*dlm->decomposition)[d].end(); for(; dit != dend; ++dit) { if(dit != dbegin) { ierr = PetscViewerASCIIPrintf(viewer, ","); CHKERRQ(ierr); @@ -1028,8 +1028,8 @@ static PetscErrorCode DMSetUp_libMesh(DM dm) if (!dlm->sys) SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONGSTATE, "No libMesh system set for DM_libMesh"); - /* - Do not evaluate function, Jacobian or bounds for an embedded DM -- the subproblem might not have enough information for that. + /* + Do not evaluate function, Jacobian or bounds for an embedded DM -- the subproblem might not have enough information for that. */ if(!dlm->embedding) { #if PETSC_VERSION_LE(3,3,0) && PETSC_VERSION_RELEASE @@ -1043,7 +1043,7 @@ static PetscErrorCode DMSetUp_libMesh(DM dm) ierr = DMSetVariableBounds(dm, DMVariableBounds_libMesh); CHKERRQ(ierr); } else { - /* + /* Fow now we don't implement even these, although a linear "Dirichlet" subproblem is well-defined. Creating the submatrix, however, might require extracting the submatrix preallocation from an unassembled matrix. */ @@ -1067,7 +1067,7 @@ static PetscErrorCode DMDestroy_libMesh(DM dm) delete dlm->varnames; delete dlm->blockids; delete dlm->blocknames; - if(dlm->decomposition) + if(dlm->decomposition) delete dlm->decomposition; ierr = ISDestroy(&dlm->embedding); CHKERRQ(ierr); ierr = PetscFree(dm->data); CHKERRQ(ierr); @@ -1118,7 +1118,7 @@ PetscErrorCode DMCreate_libMesh(DM dm) dm->ops->coarsen = 0; // DMCoarsen_libMesh; dm->ops->getinjection = 0; // DMGetInjection_libMesh; dm->ops->getaggregates = 0; // DMGetAggregates_libMesh; - + #if PETSC_VERSION_LE(3,3,0) && PETSC_VERSION_RELEASE dm->ops->createfielddecompositiondm = DMCreateFieldDecompositionDM_libMesh; dm->ops->createdomaindecompositiondm = DMCreateDomainDecompositionDM_libMesh; diff --git a/src/solvers/steady_solver.C b/src/solvers/steady_solver.C index 82d11167101..b5e068da078 100644 --- a/src/solvers/steady_solver.C +++ b/src/solvers/steady_solver.C @@ -86,4 +86,3 @@ bool SteadySolver::side_residual(bool request_jacobian, } } // namespace libMesh - diff --git a/src/solvers/unsteady_solver.C b/src/solvers/unsteady_solver.C index 348e40db7e2..5da8b42c4e5 100644 --- a/src/solvers/unsteady_solver.C +++ b/src/solvers/unsteady_solver.C @@ -80,7 +80,7 @@ void UnsteadySolver::reinit () // localize the old solution NumericVector &old_nonlinear_soln = _system.get_vector("_old_nonlinear_solution"); - + old_nonlinear_soln.localize (*old_local_nonlinear_solution, _system.get_dof_map().get_send_list()); diff --git a/src/systems/diff_context.C b/src/systems/diff_context.C index 4d9fbbd01e1..29cbcae83f3 100644 --- a/src/systems/diff_context.C +++ b/src/systems/diff_context.C @@ -130,7 +130,7 @@ void DiffContext::add_localized_vector (NumericVector & _localized_vecto unsigned int nv = _sys.n_vars(); localized_vectors[&_localized_vector].second.reserve(nv); - + // Fill the DenseSubVector with nv copies of DenseVector for(unsigned int i=0; i != nv; ++i) localized_vectors[&_localized_vector].second.push_back(new DenseSubVector(localized_vectors[&_localized_vector].first)); @@ -167,6 +167,3 @@ const DenseSubVector& DiffContext::get_localized_subvector (const Numeri } } // namespace libMesh - - - diff --git a/src/systems/equation_systems.C b/src/systems/equation_systems.C index 88e39d0da98..f5f71708636 100644 --- a/src/systems/equation_systems.C +++ b/src/systems/equation_systems.C @@ -499,7 +499,7 @@ void EquationSystems::build_variable_names (std::vector& var_names, { continue; } - + for (unsigned int vn=0; vnsecond->n_vars(); vn++) { if( FEInterface::field_type(pos->second->variable_type(vn)) == @@ -714,7 +714,7 @@ void EquationSystems::build_solution_vector (std::vector& soln, { continue; } - + for (unsigned int vn=0; vnsecond->n_vars(); vn++) { if( FEInterface::field_type(pos->second->variable_type(vn)) == @@ -778,7 +778,7 @@ void EquationSystems::build_solution_vector (std::vector& soln, { continue; } - + const System& system = *(pos->second); const unsigned int nv_sys = system.n_vars(); diff --git a/src/systems/equation_systems_io.C b/src/systems/equation_systems_io.C index 19d22c75d8e..ea955cc29e2 100644 --- a/src/systems/equation_systems_io.C +++ b/src/systems/equation_systems_io.C @@ -85,7 +85,7 @@ void EquationSystems::read (const std::string& name, } - + template void EquationSystems::read (const std::string& name, const libMeshEnums::XdrMODE mode, @@ -489,7 +489,7 @@ void EquationSystems::write(const std::string& name, io.set_version(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION)); - + // Only write the header information // if we are processor 0. if (proc_id == 0) @@ -571,7 +571,7 @@ void EquationSystems::write(const std::string& name, } - + // template specialization template void EquationSystems::read (const std::string& name, const unsigned int read_flags); diff --git a/src/systems/fem_context.C b/src/systems/fem_context.C index 3cd38967444..61c6900a2fb 100644 --- a/src/systems/fem_context.C +++ b/src/systems/fem_context.C @@ -101,7 +101,7 @@ FEMContext::FEMContext (const System &sys) element_fe[fe_type]->attach_quadrature_rule(element_qrule); side_fe[fe_type] = FEBase::build(dim, fe_type).release(); side_fe[fe_type]->attach_quadrature_rule(side_qrule); - + if (dim == 3) { edge_fe[fe_type] = FEBase::build(dim, fe_type).release(); @@ -131,7 +131,7 @@ FEMContext::FEMContext (const System &sys) _side_fe_var[i] = _side_fe[fe_type]; if (dim == 3) _edge_fe_var[i] = _edge_fe[fe_type]; - + } } @@ -162,7 +162,7 @@ FEMContext::~FEMContext() i != _element_fe.end(); ++i) delete i->second; _element_fe.clear(); - + for (std::map::iterator i = _side_fe.begin(); i != _side_fe.end(); ++i) delete i->second; @@ -209,7 +209,7 @@ Number FEMContext::interior_value(unsigned int var, unsigned int qp) const return u; } -template +template void FEMContext::interior_value(unsigned int var, unsigned int qp, OutputType& u) const { @@ -242,7 +242,7 @@ void FEMContext::interior_value(unsigned int var, unsigned int qp, } -template +template void FEMContext::interior_values (unsigned int var, const NumericVector & _system_vector, std::vector& u_vals) const @@ -253,29 +253,29 @@ void FEMContext::interior_values (unsigned int var, libmesh_assert_greater (dof_indices.size(), var); const unsigned int n_dofs = libmesh_cast_int (dof_indices_var[var].size()); - - // Get current local coefficients + + // Get current local coefficients const DenseSubVector &coef = get_localized_subvector(_system_vector, var); - + // Get the finite element object FEGenericBase* fe = NULL; this->get_element_fe( var, fe ); // Get shape function values at quadrature point const std::vector > &phi = fe->get_phi(); - + // Loop over all the q_points on this element for (unsigned int qp=0; qp != u_vals.size(); qp++) - { + { OutputType &u = u_vals[qp]; - + // Compute the value at this q_point u = 0.; for (unsigned int l=0; l != n_dofs; l++) u += phi[l][qp] * coef(l); } - + return; } @@ -341,7 +341,7 @@ void FEMContext::interior_gradients const unsigned int n_dofs = libmesh_cast_int (dof_indices_var[var].size()); - // Get current local coefficients + // Get current local coefficients const DenseSubVector &coef = get_localized_subvector(_system_vector, var); // Get finite element object @@ -350,10 +350,10 @@ void FEMContext::interior_gradients // Get shape function values at quadrature point const std::vector::OutputGradient> > &dphi = fe->get_dphi(); - + // Loop over all the q_points in this finite element for (unsigned int qp=0; qp != du_vals.size(); qp++) - { + { OutputType &du = du_vals[qp]; // Compute the gradient at this q_point @@ -430,7 +430,7 @@ void FEMContext::interior_hessians const unsigned int n_dofs = libmesh_cast_int (dof_indices_var[var].size()); - // Get current local coefficients + // Get current local coefficients const DenseSubVector &coef = get_localized_subvector(_system_vector, var); // Get finite element object @@ -439,10 +439,10 @@ void FEMContext::interior_hessians // Get shape function values at quadrature point const std::vector::OutputTensor> > &d2phi = fe->get_d2phi(); - + // Loop over all the q_points in this finite element for (unsigned int qp=0; qp != d2u_vals.size(); qp++) - { + { OutputType &d2u = d2u_vals[qp]; // Compute the gradient at this q_point @@ -496,7 +496,7 @@ template void FEMContext::interior_div(unsigned int var, unsigned int qp, OutputType& div_u) const { - typedef typename + typedef typename TensorTools::IncrementRank ::type>::type OutputShape; @@ -537,7 +537,7 @@ Number FEMContext::side_value(unsigned int var, unsigned int qp) const } -template +template void FEMContext::side_value(unsigned int var, unsigned int qp, OutputType& u) const { @@ -570,41 +570,41 @@ void FEMContext::side_value(unsigned int var, unsigned int qp, } -template +template void FEMContext::side_values (unsigned int var, const NumericVector & _system_vector, std::vector& u_vals) const -{ +{ typedef typename TensorTools::MakeReal::type OutputShape; // Get local-to-global dof index lookup libmesh_assert_greater (dof_indices.size(), var); const unsigned int n_dofs = libmesh_cast_int (dof_indices_var[var].size()); - - // Get current local coefficients + + // Get current local coefficients const DenseSubVector &coef = get_localized_subvector(_system_vector, var); - + // Get the finite element object FEGenericBase* the_side_fe = NULL; this->get_side_fe( var, the_side_fe ); // Get shape function values at quadrature point const std::vector > &phi = the_side_fe->get_phi(); - + // Loop over all the q_points on this element for (unsigned int qp=0; qp != u_vals.size(); qp++) - { + { OutputType &u = u_vals[qp]; // Compute the value at this q_point u = 0.; - + for (unsigned int l=0; l != n_dofs; l++) u += phi[l][qp] * coef(l); } - + return; } @@ -618,8 +618,8 @@ Gradient FEMContext::side_gradient(unsigned int var, unsigned int qp) const } -template -void FEMContext::side_gradient(unsigned int var, unsigned int qp, +template +void FEMContext::side_gradient(unsigned int var, unsigned int qp, OutputType& du) const { typedef typename TensorTools::MakeReal @@ -669,7 +669,7 @@ void FEMContext::side_gradients const unsigned int n_dofs = libmesh_cast_int (dof_indices_var[var].size()); - // Get current local coefficients + // Get current local coefficients const DenseSubVector &coef = get_localized_subvector(_system_vector, var); // Get finite element object @@ -678,10 +678,10 @@ void FEMContext::side_gradients // Get shape function values at quadrature point const std::vector::OutputGradient> > &dphi = the_side_fe->get_dphi(); - + // Loop over all the q_points in this finite element for (unsigned int qp=0; qp != du_vals.size(); qp++) - { + { OutputType &du = du_vals[qp]; du = 0; @@ -705,7 +705,7 @@ Tensor FEMContext::side_hessian(unsigned int var, unsigned int qp) const } template -void FEMContext::side_hessian(unsigned int var, unsigned int qp, +void FEMContext::side_hessian(unsigned int var, unsigned int qp, OutputType& d2u) const { typedef typename TensorTools::MakeReal< @@ -758,7 +758,7 @@ void FEMContext::side_hessians const unsigned int n_dofs = libmesh_cast_int (dof_indices_var[var].size()); - // Get current local coefficients + // Get current local coefficients const DenseSubVector &coef = get_localized_subvector(_system_vector, var); // Get finite element object @@ -767,10 +767,10 @@ void FEMContext::side_hessians // Get shape function values at quadrature point const std::vector::OutputTensor> > &d2phi = the_side_fe->get_d2phi(); - + // Loop over all the q_points in this finite element for (unsigned int qp=0; qp != d2u_vals.size(); qp++) - { + { OutputType &d2u = d2u_vals[qp]; // Compute the gradient at this q_point @@ -823,7 +823,7 @@ void FEMContext::point_value(unsigned int var, const Point &p, // Get the values of the shape function derivatives const std::vector >& phi = fe_new->get_phi(); - + u = 0.; for (unsigned int l=0; l != n_dofs; l++) @@ -918,7 +918,7 @@ void FEMContext::point_hessian(unsigned int var, const Point &p, // Get finite element object FEGenericBase* fe = NULL; this->get_element_fe( var, fe ); - + // Build a FE for calculating u(p) AutoPtr > fe_new = this->build_new_fe( fe, p ); @@ -1123,7 +1123,7 @@ Number FEMContext::fixed_side_value(unsigned int var, unsigned int qp) const } -template +template void FEMContext::fixed_side_value(unsigned int var, unsigned int qp, OutputType& u) const { @@ -1167,8 +1167,8 @@ Gradient FEMContext::fixed_side_gradient(unsigned int var, unsigned int qp) cons } -template -void FEMContext::fixed_side_gradient(unsigned int var, unsigned int qp, +template +void FEMContext::fixed_side_gradient(unsigned int var, unsigned int qp, OutputType& du) const { typedef typename TensorTools::MakeReal @@ -1213,8 +1213,8 @@ Tensor FEMContext::fixed_side_hessian(unsigned int var, unsigned int qp) const return d2u; } -template -void FEMContext::fixed_side_hessian(unsigned int var, unsigned int qp, +template +void FEMContext::fixed_side_hessian(unsigned int var, unsigned int qp, OutputType& d2u) const { typedef typename TensorTools::MakeReal< @@ -1286,7 +1286,7 @@ void FEMContext::fixed_point_value(unsigned int var, const Point &p, // Get the values of the shape function derivatives const std::vector >& phi = fe_new->get_phi(); - + u = 0.; for (unsigned int l=0; l != n_dofs; l++) @@ -1381,7 +1381,7 @@ void FEMContext::fixed_point_hessian(unsigned int var, const Point &p, // Get finite element object FEGenericBase* fe = NULL; this->get_element_fe( var, fe ); - + // Build a FE for calculating u(p) AutoPtr > fe_new = this->build_new_fe( fe, p ); @@ -1723,14 +1723,14 @@ void FEMContext::pre_fe_reinit(const System &sys, const Elem *e) // Now do the localization for the user requested vectors DiffContext::localized_vectors_iterator localized_vec_it = localized_vectors.begin(); const DiffContext::localized_vectors_iterator localized_vec_end = localized_vectors.end(); - + for(; localized_vec_it != localized_vec_end; ++localized_vec_it) { const NumericVector& current_localized_vector = *localized_vec_it->first; DenseVector& target_vector = localized_vec_it->second.first; - + current_localized_vector.get(dof_indices, target_vector.get_values()); - + // Initialize the per-variable data for elem. unsigned int sub_dofs = 0; for (unsigned int i=0; i != sys.n_vars(); ++i) @@ -1742,9 +1742,9 @@ void FEMContext::pre_fe_reinit(const System &sys, const Elem *e) localized_vec_it->second.second[i]->reposition (sub_dofs, n_dofs_var); - sub_dofs += n_dofs_var; + sub_dofs += n_dofs_var; } - libmesh_assert_equal_to (sub_dofs, n_dofs); + libmesh_assert_equal_to (sub_dofs, n_dofs); } } @@ -1764,7 +1764,7 @@ void FEMContext::_update_time_from_system(Real theta) template -AutoPtr > FEMContext::build_new_fe( const FEGenericBase* fe, +AutoPtr > FEMContext::build_new_fe( const FEGenericBase* fe, const Point &p ) const { FEType fe_type = fe->get_fe_type(); diff --git a/src/systems/fem_system.C b/src/systems/fem_system.C index f48c4fff564..955f672fb24 100644 --- a/src/systems/fem_system.C +++ b/src/systems/fem_system.C @@ -395,7 +395,7 @@ namespace { _diff_qoi.side_qoi(_femcontext, _qoi_indices); } } - + this->_diff_qoi.thread_join( this->qoi, _femcontext.elem_qoi, _qoi_indices ); } diff --git a/src/systems/implicit_system.C b/src/systems/implicit_system.C index e4ada41a1d4..1025e05ecab 100644 --- a/src/systems/implicit_system.C +++ b/src/systems/implicit_system.C @@ -1370,4 +1370,3 @@ void ImplicitSystem::release_linear_solver(LinearSolver* s) const } } // namespace libMesh - diff --git a/src/systems/steady_system.C b/src/systems/steady_system.C index 1afc096ab3b..ee5d8ba9dff 100644 --- a/src/systems/steady_system.C +++ b/src/systems/steady_system.C @@ -25,4 +25,3 @@ // ------------------------------------------------------------ // SteadySystem implementation - diff --git a/src/systems/system_io.C b/src/systems/system_io.C index 41f155f79c2..84c6fea95fd 100644 --- a/src/systems/system_io.C +++ b/src/systems/system_io.C @@ -41,7 +41,7 @@ namespace { using libMesh::DofObject; using libMesh::Number; - + // Comments: // --------- // - The max_io_blksize governs how many nodes or elements will be @@ -89,18 +89,18 @@ namespace { private: libMesh::Xdr &_io; std::vector &_data; - + public: ThreadedIO (libMesh::Xdr &io, std::vector &data) : _io(io), - _data(data) + _data(data) {} - + void operator()() { if (_data.empty()) return; _io.data_stream (&_data[0], _data.size()); - } + } }; } @@ -518,7 +518,7 @@ void System::read_parallel_data (Xdr &io, // PerfLog pl("IO Performance",false); // pl.push("read_parallel_data"); dof_id_type total_read_size = 0; - + libmesh_assert (io.reading()); libmesh_assert (io.is_open()); @@ -694,9 +694,9 @@ void System::read_parallel_data (Xdr &io, } } - // const Real + // const Real // dt = pl.get_elapsed_time(), - // rate = total_read_size*sizeof(Number)/dt; + // rate = total_read_size*sizeof(Number)/dt; // std::cerr << "Read " << total_read_size << " \"Number\" values\n" // << " Elapsed time = " << dt << '\n' @@ -757,10 +757,10 @@ void System::read_serialized_data (Xdr& io, } } - - // const Real + + // const Real // dt = pl.get_elapsed_time(), - // rate = total_read_size*sizeof(Number)/dt; + // rate = total_read_size*sizeof(Number)/dt; // std::cout << "Read " << total_read_size << " \"Number\" values\n" // << " Elapsed time = " << dt << '\n' @@ -794,9 +794,9 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj // coefficient vectors, vars are one or more variables // to write, and comps are all the components for said // vars on the object. - + typedef std::vector*>::const_iterator vec_iterator_type; - + // variables to read. Unless specified otherwise, defaults to _written_var_indices. std::vector vars_to_read (_written_var_indices); @@ -805,11 +805,11 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj vars_to_read.clear(); vars_to_read.push_back(var_to_read); } - + const unsigned int sys_num = this->number(), num_vecs = libmesh_cast_int(vecs.size()), - num_vars = _written_var_indices.size(); // must be <= current number of variables! + num_vars = _written_var_indices.size(); // must be <= current number of variables! const dof_id_type io_blksize = std::min(max_io_blksize, n_objs), num_blks = std::ceil(static_cast(n_objs)/static_cast(io_blksize)); @@ -817,10 +817,10 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj libmesh_assert_less_equal (num_vars, this->n_vars()); unsigned int n_read_values=0; - + std::vector > xfer_ids(num_blks); // The global IDs and # of components for the local objects in all blocks std::vector > recv_vals(num_blks); // The raw values for the local objects in all blocks - std::vector + std::vector id_requests(num_blks), val_requests(num_blks); // ------------------------------------------------------ @@ -830,16 +830,16 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj std::vector xfer_ids_size (num_blks,0), recv_vals_size (num_blks,0); - - + + for (iterator_type it=begin; it!=end; ++it) { const dof_id_type id = (*it)->id(), block = id/io_blksize; - + libmesh_assert_less (block, num_blks); - + xfer_ids_size[block] += 2; // for each object, we send its id, as well as the total number of components for all variables dof_id_type n_comp_tot=0; @@ -858,13 +858,13 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj //------------------------------------------ // Collect the ids & number of values needed - // for all local objects, binning them into + // for all local objects, binning them into // 'blocks' that will be sent to processor 0 for (dof_id_type blk=0; blk((blk+1)*io_blksize), n_objs); @@ -884,23 +884,23 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj ((*it)->id() < last_object)) { ids.push_back((*it)->id()); - + unsigned int n_comp_tot=0; - + for (std::vector::const_iterator var_it=vars_to_read.begin(); var_it!=vars_to_read.end(); ++var_it) n_comp_tot += (*it)->n_comp(sys_num,*var_it); - + ids.push_back (n_comp_tot*num_vecs); } - + #ifdef LIBMESH_HAVE_MPI Parallel::MessageTag id_tag = Parallel::Communicator_World.get_unique_tag(100*num_blks + blk); Parallel::MessageTag val_tag = Parallel::Communicator_World.get_unique_tag(200*num_blks + blk); - + // nonblocking send the data for this block CommWorld.send (0, ids, id_requests[blk], id_tag); - + // Go ahead and post the receive too CommWorld.receive (0, vals, val_requests[blk], val_tag); #endif @@ -908,9 +908,9 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj //--------------------------------------------------- // Here processor 0 will read and distribute the data. - // We have to do this block-wise to ensure that we + // We have to do this block-wise to ensure that we // do not exhaust memory on processor 0. - + // give these variables scope outside the block to avoid reallocation std::vector > recv_ids (libMesh::n_processors()); std::vector > send_vals (libMesh::n_processors()); @@ -918,12 +918,12 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj std::vector obj_val_offsets; // map to traverse entry-wise rather than processor-wise std::vector input_vals; // The input buffer for the current block std::vector input_vals_tmp; // The input buffer for the current block - + for (dof_id_type blk=0; blk((blk+1)*io_blksize), n_objs), @@ -931,17 +931,17 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj // Processor 0 has a special job. It needs to gather the requested indices // in [first_object,last_object) from all processors, read the data from - // disk, and reply + // disk, and reply if (libMesh::processor_id() == 0) { // we know the input buffer size for this block and can begin reading it now input_vals.resize(tot_vals_size[blk]); input_vals_tmp.resize(tot_vals_size[blk]); - + // a ThreadedIO object to perform asychronous file IO ThreadedIO threaded_io(io, input_vals_tmp); Threads::Thread async_io(threaded_io); - + Parallel::MessageTag id_tag = Parallel::Communicator_World.get_unique_tag(100*num_blks + blk); Parallel::MessageTag val_tag = Parallel::Communicator_World.get_unique_tag(200*num_blks + blk); @@ -952,7 +952,7 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj recv_vals_size.resize(libMesh::n_processors()); // reuse this to count how many values are going to each processor unsigned int n_vals_blk = 0; - + // loop over all processors and process their index request for (unsigned int comm_step=0; comm_step(input_vals.size()); - + // pack data replies for each processor for (processor_id_type proc=0; proc &ids (recv_ids[proc]); std::vector &vals (send_vals[proc]); const std::size_t &n_vals_proc (recv_vals_size[proc]); - + vals.clear(); /**/ vals.reserve(n_vals_proc); for (std::size_t idx=0; idx &vals (recv_vals[blk]); std::vector::const_iterator val_it(vals.begin()); - + if (!recv_vals[blk].empty()) // nonzero values to receive for (iterator_type it=begin; it!=end; ++it) if (((*it)->id() >= first_object) && // object in [first_object,last_object) @@ -1057,12 +1057,12 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj for (vec_iterator_type vec_it=vecs.begin(); vec_it!=vecs.end(); ++vec_it) { NumericVector &vec(**vec_it); - + for (std::vector::const_iterator var_it=vars_to_read.begin(); var_it!=vars_to_read.end(); ++var_it) { const unsigned int n_comp = (*it)->n_comp(sys_num,*var_it); - + for (unsigned int comp=0; compdof_number (sys_num, *var_it, comp); @@ -1078,7 +1078,7 @@ dof_id_type System::read_serialized_blocked_dof_objects (const dof_id_type n_obj // processor 0 needs to make sure all replies have been handed off if (libMesh::processor_id () == 0) - Parallel::wait(reply_requests); + Parallel::wait(reply_requests); } return n_read_values; @@ -1163,9 +1163,9 @@ numeric_index_type System::read_serialized_vector (Xdr& io, NumericVectorget_mesh().n_nodes(), n_elem = this->get_mesh().n_elem(); - + libmesh_assert_less_equal (nv, this->n_vars()); - + // for newer versions, read variables node/elem major if (io.version() >= LIBMESH_VERSION_ID(0,7,4)) { @@ -1190,7 +1190,7 @@ numeric_index_type System::read_serialized_vector (Xdr& io, NumericVector*> (1,&vec)); } - + // for older versions, read variables var-major else { @@ -1210,8 +1210,8 @@ numeric_index_type System::read_serialized_vector (Xdr& io, NumericVector*> (1,&vec), var); - - + + //------------------------------------ // Collect the values for all elements n_assigned_vals += @@ -1483,7 +1483,7 @@ void System::write_parallel_data (Xdr &io, // PerfLog pl("IO Performance",false); // pl.push("write_parallel_data"); std::size_t total_written_size = 0; - + std::string comment; libmesh_assert (io.writing()); @@ -1656,14 +1656,14 @@ void System::write_parallel_data (Xdr &io, } } - // const Real + // const Real // dt = pl.get_elapsed_time(), - // rate = total_written_size*sizeof(Number)/dt; + // rate = total_written_size*sizeof(Number)/dt; // std::cerr << "Write " << total_written_size << " \"Number\" values\n" // << " Elapsed time = " << dt << '\n' // << " Rate = " << rate/1.e6 << "(MB/sec)\n\n"; - + // pl.pop("write_parallel_data"); } @@ -1691,7 +1691,7 @@ void System::write_serialized_data (Xdr& io, // PerfLog pl("IO Performance",false); // pl.push("write_serialized_data"); std::size_t total_written_size = 0; - + total_written_size += this->write_serialized_vector(io, *this->solution); @@ -1729,19 +1729,19 @@ void System::write_serialized_data (Xdr& io, } } - // const Real + // const Real // dt = pl.get_elapsed_time(), - // rate = total_written_size*sizeof(Number)/dt; + // rate = total_written_size*sizeof(Number)/dt; // std::cout << "Write " << total_written_size << " \"Number\" values\n" // << " Elapsed time = " << dt << '\n' // << " Rate = " << rate/1.e6 << "(MB/sec)\n\n"; - + // pl.pop("write_serialized_data"); - - + + // // test the new method // { // std::vector names; @@ -1749,13 +1749,13 @@ void System::write_serialized_data (Xdr& io, // names.push_back("Solution Vector"); // vectors_to_write.push_back(this->solution.get()); - + // // Only write additional vectors if wanted // if (write_additional_data) // { // std::map* >::const_iterator // pos = _vectors.begin(); - + // for(; pos != this->_vectors.end(); ++pos) // { // names.push_back("Additional Vector " + pos->first); @@ -1766,10 +1766,10 @@ void System::write_serialized_data (Xdr& io, // total_written_size = // this->write_serialized_vectors (io, names, vectors_to_write); - // const Real + // const Real // dt2 = pl.get_elapsed_time(), // rate2 = total_written_size*sizeof(Number)/(dt2-dt); - + // std::cout << "Write (new) " << total_written_size << " \"Number\" values\n" // << " Elapsed time = " << (dt2-dt) << '\n' // << " Rate = " << rate2/1.e6 << "(MB/sec)\n\n"; @@ -1801,7 +1801,7 @@ dof_id_type System::write_serialized_blocked_dof_objects (const std::vector*>::const_iterator vec_iterator_type; // We will write all variables unless requested otherwise. @@ -1813,7 +1813,7 @@ dof_id_type System::write_serialized_blocked_dof_objects (const std::vectorn_vars(); var++) vars_to_write.push_back(var); } - + const dof_id_type io_blksize = std::min(max_io_blksize, n_objs); @@ -1826,13 +1826,13 @@ dof_id_type System::write_serialized_blocked_dof_objects (const std::vectorget_mesh().local_elements_begin(), this->get_mesh().local_elements_end(), io); - + //------------------------------------------- // Finally loop over all the SCALAR variables for (unsigned int var=0; varn_vars(); var++) @@ -2196,7 +2196,7 @@ dof_id_type System::read_serialized_vectors (Xdr &io, unsigned int num_vecs=0; dof_id_type vector_length=0; - if (libMesh::processor_id() == 0) + if (libMesh::processor_id() == 0) { // Get the number of vectors io.data(num_vecs); @@ -2204,7 +2204,7 @@ dof_id_type System::read_serialized_vectors (Xdr &io, io.data(vector_length); libmesh_assert_equal_to (num_vecs, vectors.size()); - + if (num_vecs != 0) { libmesh_assert_not_equal_to (vectors[0], 0); @@ -2215,14 +2215,14 @@ dof_id_type System::read_serialized_vectors (Xdr &io, // no need to actually communicate these. // CommWorld.broadcast(num_vecs); // CommWorld.broadcast(vector_length); - + // Cache these - they are not free! const dof_id_type n_nodes = this->get_mesh().n_nodes(), - n_elem = this->get_mesh().n_elem(); + n_elem = this->get_mesh().n_elem(); dof_id_type read_length = 0.; - + //--------------------------------- // Collect the values for all nodes read_length += @@ -2250,7 +2250,7 @@ dof_id_type System::read_serialized_vectors (Xdr &io, if(this->variable(var).type().family == SCALAR) { libmesh_assert_not_equal_to (vectors[vec], 0); - + read_length += this->read_SCALAR_dofs (var, io, *vectors[vec]); } @@ -2259,10 +2259,10 @@ dof_id_type System::read_serialized_vectors (Xdr &io, // last step - must close all the vectors for (unsigned int vec=0; vecclose(); } - + return read_length; } @@ -2278,11 +2278,11 @@ dof_id_type System::write_serialized_vectors (Xdr &io, // Cache these - they are not free! const dof_id_type n_nodes = this->get_mesh().n_nodes(), - n_elem = this->get_mesh().n_elem(); + n_elem = this->get_mesh().n_elem(); dof_id_type written_length = 0.; - - if (libMesh::processor_id() == 0) + + if (libMesh::processor_id() == 0) { unsigned int n_vec = libmesh_cast_int(vectors.size()); @@ -2319,11 +2319,11 @@ dof_id_type System::write_serialized_vectors (Xdr &io, if(this->variable(var).type().family == SCALAR) { libmesh_assert_not_equal_to (vectors[vec], 0); - + written_length += this->write_SCALAR_dofs (*vectors[vec], var, io); } - + return written_length; } @@ -2341,4 +2341,3 @@ template void System::read_serialized_data (Xdr& io, const bool read_addit template numeric_index_type System::read_serialized_vector (Xdr& io, NumericVector& vec); template dof_id_type System::read_serialized_vectors (Xdr &io, const std::vector*> &vectors) const; #endif - diff --git a/src/systems/system_projection.C b/src/systems/system_projection.C index 3446fafecfc..7044e4abf40 100644 --- a/src/systems/system_projection.C +++ b/src/systems/system_projection.C @@ -384,7 +384,7 @@ void System::project_vector (const NumericVector& old_v, std::vector new_SCALAR_indices, old_SCALAR_indices; dof_map.SCALAR_dof_indices (new_SCALAR_indices, var, false); dof_map.SCALAR_dof_indices (old_SCALAR_indices, var, true); - const unsigned int new_n_dofs = + const unsigned int new_n_dofs = libmesh_cast_int(new_SCALAR_indices.size()); for (unsigned int i=0; i& new_vector, std::vector SCALAR_indices; dof_map.SCALAR_dof_indices (SCALAR_indices, var); - const unsigned int n_SCALAR_dofs = + const unsigned int n_SCALAR_dofs = libmesh_cast_int(SCALAR_indices.size()); for (unsigned int i=0; i& new_vector, const dof_id_type global_index = SCALAR_indices[i]; const unsigned int component_index = this->variable_scalar_number(var,i); - + new_vector.set(global_index, f->component(context, component_index, Point(), this->time)); } } @@ -703,7 +703,7 @@ void System::boundary_project_vector * This method projects an arbitrary function via L2 projections and * nodal interpolations on each element. */ -void System::boundary_project_vector +void System::boundary_project_vector (const std::set &b, const std::vector &variables, NumericVector& new_vector, @@ -1347,7 +1347,7 @@ void ProjectSolution::operator()(const ConstElemRange &range) const dof_map.dof_indices (elem, dof_indices, var); // The number of DOFs on the element - const unsigned int n_dofs = + const unsigned int n_dofs = libmesh_cast_int(dof_indices.size()); // Fixed vs. free DoFs on edge/face projections @@ -1859,7 +1859,7 @@ void ProjectFEMSolution::operator()(const ConstElemRange &range) const DenseVector Fe; // The new element coefficients DenseVector Ue; - + // FIXME: Need to generalize this to vector-valued elements. [PB] FEBase* fe = NULL; FEBase* side_fe = NULL; @@ -1929,7 +1929,7 @@ void ProjectFEMSolution::operator()(const ConstElemRange &range) const const unsigned int var_component = system.variable_scalar_number(var, 0); - const std::vector& dof_indices = + const std::vector& dof_indices = context.get_dof_indices(var); // The number of DOFs on the element @@ -2137,7 +2137,7 @@ void ProjectFEMSolution::operator()(const ConstElemRange &range) const const std::vector >* dphi = NULL; if (cont == C_ONE) dphi = &(edge_fe->get_dphi()); - + for (unsigned int e=0; e != elem->n_edges(); ++e) { context.edge = e; diff --git a/src/systems/system_subset.C b/src/systems/system_subset.C index b12996df974..f7166c0cce9 100644 --- a/src/systems/system_subset.C +++ b/src/systems/system_subset.C @@ -47,4 +47,3 @@ namespace libMesh } // namespace libMesh - diff --git a/src/systems/system_subset_by_subdomain.C b/src/systems/system_subset_by_subdomain.C index af2574cd1af..63fd9dfe61b 100644 --- a/src/systems/system_subset_by_subdomain.C +++ b/src/systems/system_subset_by_subdomain.C @@ -200,4 +200,3 @@ namespace libMesh } } // namespace libMesh - diff --git a/src/utils/error_vector.C b/src/utils/error_vector.C index 258f2483fba..1c144c63107 100644 --- a/src/utils/error_vector.C +++ b/src/utils/error_vector.C @@ -293,4 +293,3 @@ void ErrorVector::plot_error(const std::string& filename, } } // namespace libMesh - diff --git a/src/utils/libmesh_version.C b/src/utils/libmesh_version.C index a94b4caa4f8..d9d9f7be6c2 100644 --- a/src/utils/libmesh_version.C +++ b/src/utils/libmesh_version.C @@ -43,11 +43,11 @@ void libMesh::libmesh_version_stdout() int libMesh::get_libmesh_version() { /* Note: return format follows the versioning convention xx.yy.zz where - + xx = major version number yy = minor version number zz = micro version number - + For example: v. 0.23 -> 002300 = 2300 v 0.23.1 -> 002301 = 2301 diff --git a/src/utils/point_locator_base.C b/src/utils/point_locator_base.C index 765b4cfab2f..a1303083f07 100644 --- a/src/utils/point_locator_base.C +++ b/src/utils/point_locator_base.C @@ -86,4 +86,3 @@ AutoPtr PointLocatorBase::build (const PointLocatorType t, } } // namespace libMesh - diff --git a/src/utils/point_locator_list.C b/src/utils/point_locator_list.C index ef9f23c6a9f..a5fddf81127 100644 --- a/src/utils/point_locator_list.C +++ b/src/utils/point_locator_list.C @@ -222,4 +222,3 @@ void PointLocatorList::disable_out_of_mesh_mode (void) } } // namespace libMesh - diff --git a/src/utils/point_locator_tree.C b/src/utils/point_locator_tree.C index 6be5791094e..cd219be0196 100644 --- a/src/utils/point_locator_tree.C +++ b/src/utils/point_locator_tree.C @@ -273,4 +273,3 @@ void PointLocatorTree::disable_out_of_mesh_mode (void) } } // namespace libMesh - diff --git a/src/utils/string_to_enum.C b/src/utils/string_to_enum.C index d061a2ca7f6..09dd95a90fb 100644 --- a/src/utils/string_to_enum.C +++ b/src/utils/string_to_enum.C @@ -679,6 +679,3 @@ namespace Utility { } // namespace Utility } // namespace libMesh - - - diff --git a/src/utils/tree.C b/src/utils/tree.C index d314a944d61..f9c60f452a4 100644 --- a/src/utils/tree.C +++ b/src/utils/tree.C @@ -94,12 +94,3 @@ template class Tree<4>; template class Tree<8>; } // namespace libMesh - - - - - - - - - diff --git a/src/utils/tree_node.C b/src/utils/tree_node.C index 0d24f0538d2..eb9b7c2bda2 100644 --- a/src/utils/tree_node.C +++ b/src/utils/tree_node.C @@ -643,10 +643,3 @@ template class TreeNode<4>; template class TreeNode<8>; } // namespace libMesh - - - - - - -