From 86c19abf3742f8fdd495fb1ae92f018b9ee7e33e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 8 Jul 2013 02:47:56 +0000 Subject: [PATCH] Another version which, sadly, shows yet another problem: the fact that Vector::l1_norm() produces different results every time... git-svn-id: https://svn.dealii.org/trunk@29946 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/work_stream_03.cc | 63 ++++++++---------------------------- 1 file changed, 13 insertions(+), 50 deletions(-) diff --git a/tests/base/work_stream_03.cc b/tests/base/work_stream_03.cc index 123f21f9f5..054ae23433 100644 --- a/tests/base/work_stream_03.cc +++ b/tests/base/work_stream_03.cc @@ -111,26 +111,14 @@ namespace { Scratch (const ::dealii::hp::FECollection &fe, const UpdateFlags update_flags, - const Function *coefficient, - const Function *rhs_function, - const ::dealii::hp::QCollection &quadrature, - const ::dealii::hp::MappingCollection &mapping) + const ::dealii::hp::QCollection &quadrature) : fe_collection (fe), quadrature_collection (quadrature), - mapping_collection (mapping), - x_fe_values (mapping_collection, - fe_collection, + x_fe_values (fe_collection, quadrature_collection, update_flags), - coefficient_values(quadrature_collection.max_n_quadrature_points()), - coefficient_vector_values (quadrature_collection.max_n_quadrature_points(), - dealii::Vector (fe_collection.n_components())), rhs_values(quadrature_collection.max_n_quadrature_points()), - rhs_vector_values(quadrature_collection.max_n_quadrature_points(), - dealii::Vector (fe_collection.n_components())), - coefficient (coefficient), - rhs_function (rhs_function), update_flags (update_flags) {} @@ -138,35 +126,19 @@ namespace : fe_collection (data.fe_collection), quadrature_collection (data.quadrature_collection), - mapping_collection (data.mapping_collection), - x_fe_values (mapping_collection, - fe_collection, + x_fe_values (fe_collection, quadrature_collection, data.update_flags), - coefficient_values (data.coefficient_values), - coefficient_vector_values (data.coefficient_vector_values), rhs_values (data.rhs_values), - rhs_vector_values (data.rhs_vector_values), - coefficient (data.coefficient), - rhs_function (data.rhs_function), update_flags (data.update_flags) {} const ::dealii::hp::FECollection &fe_collection; const ::dealii::hp::QCollection &quadrature_collection; - const ::dealii::hp::MappingCollection &mapping_collection; ::dealii::hp::FEValues x_fe_values; - std::vector coefficient_values; - std::vector > coefficient_vector_values; std::vector rhs_values; - std::vector > rhs_vector_values; - - std::vector old_JxW; - - const Function *coefficient; - const Function *rhs_function; const UpdateFlags update_flags; }; @@ -206,7 +178,7 @@ template cell->get_dof_indices(copy_data.dof_indices); data.rhs_values.resize(n_q_points); - data.rhs_function->value_list(fe_values.get_quadrature_points(), + F().value_list(fe_values.get_quadrature_points(), data.rhs_values); for (unsigned int i = 0; i < dofs_per_cell; ++i) @@ -230,28 +202,19 @@ void copy_local_to_global (const CopyData &data, VectorType *right_hand_side) { const unsigned int dofs_per_cell = data.dof_indices.size(); - Assert (data.cell_matrix.frobenius_norm() == 0, ExcInternalError()); - - Assert (matrix->frobenius_norm() == 0, ExcInternalError()); data.constraints->distribute_local_to_global(data.cell_matrix, data.cell_rhs, data.dof_indices, *matrix, *right_hand_side); - Assert (matrix->frobenius_norm() == 0, ExcInternalError()); -//Q: why does this write anything into the matrix??? } template -void create_mass_matrix (const Mapping &mapping, - const DoFHandler &dof, +void create_mass_matrix (const DoFHandler &dof, const Quadrature &q, SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function *const coefficient, - const ConstraintMatrix &constraints) + Vector &rhs_vector) { Assert (matrix.m() == dof.n_dofs(), ExcDimensionMismatch (matrix.m(), dof.n_dofs())); @@ -260,13 +223,11 @@ void create_mass_matrix (const Mapping &mapping, hp::FECollection fe_collection (dof.get_fe()); hp::QCollection q_collection (q); - hp::MappingCollection mapping_collection (mapping); Scratch assembler_data (fe_collection, update_values | update_JxW_values | update_quadrature_points, - coefficient, &rhs, - q_collection, mapping_collection); + q_collection); CopyData copy_data; copy_data.cell_matrix.reinit (assembler_data.fe_collection.max_dofs_per_cell(), assembler_data.fe_collection.max_dofs_per_cell()); @@ -303,12 +264,14 @@ void do_project (const unsigned int p) Vector tmp (mass_matrix.n()); const Function<2>* dummy = 0; - create_mass_matrix(StaticMappingQ1 < dim > ::mapping, - dof_handler, QGauss < dim > (5), mass_matrix, F(), tmp, dummy, - constraints); + create_mass_matrix(dof_handler, QGauss < dim > (5), mass_matrix, tmp); + + double l1 = 0; + for (unsigned int i=0; i