From 16f8c0be86523b9b75e2b9f8c9143b7bacf1208e Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 1 Nov 2010 21:36:23 +0000 Subject: [PATCH] Add one more test and fix it in fe_values.cc. git-svn-id: https://svn.dealii.org/trunk@22580 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/fe/fe_values.cc | 14 ++-- tests/codim_one/fe_values_extractor_01.cc | 79 +++++++++++++++++++ .../fe_values_extractor_01/cmp/generic | 5 ++ .../fe_values_extractor_01/square.msh | 17 ++++ 4 files changed, 108 insertions(+), 7 deletions(-) create mode 100644 tests/codim_one/fe_values_extractor_01.cc create mode 100644 tests/codim_one/fe_values_extractor_01/cmp/generic create mode 100644 tests/codim_one/fe_values_extractor_01/square.msh diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index 1dd877aeeb..e89b8a4911 100644 --- a/deal.II/source/fe/fe_values.cc +++ b/deal.II/source/fe/fe_values.cc @@ -131,14 +131,14 @@ namespace FEValuesViews first_vector_component (first_vector_component), shape_function_data (fe_values.fe->dofs_per_cell) { - Assert (first_vector_component+dim-1 < fe_values.fe->n_components(), - ExcIndexRange(first_vector_component+dim-1, 0, + Assert (first_vector_component+spacedim-1 < fe_values.fe->n_components(), + ExcIndexRange(first_vector_component+spacedim-1, 0, fe_values.fe->n_components())); const std::vector shape_function_to_row_table = make_shape_function_to_row_table (*fe_values.fe); - for (unsigned int d=0; ddofs_per_cell; ++i) { unsigned int n_nonzero_components = 0; - for (unsigned int d=0; d= dim ? - fe.n_components()-dim+1 : + const unsigned int n_vectors = (fe.n_components() >= spacedim ? + fe.n_components()-spacedim+1 : 0); vectors.resize (n_vectors); for (unsigned int component=0; component +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +std::ofstream logfile("fe_values_extractor_01/output"); + + +int main () +{ + deallog.attach(logfile); + deallog.depth_console(0); + + const unsigned int dim = 1; + + Triangulation triangulation; + FESystem fe (FE_Q (1), dim+1); + DoFHandler dof_handler(triangulation); + + Vector soln; + + GridIn grid_in; + grid_in.attach_triangulation (triangulation); + std::ifstream fname("data_out_02/square.msh"); + grid_in.read_msh (fname); + + dof_handler.distribute_dofs (fe); + soln.reinit (dof_handler.n_dofs()); + soln = 1; + + std::vector > local_velocity_values (1); + const FEValuesExtractors::Vector velocities (0); + QGauss quadrature_formula(1); + DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + FEValues fe_v (fe, quadrature_formula, update_values); + + for (; cell!=endc; ++cell) { + fe_v.reinit (cell); + + fe_v[velocities].get_function_values (soln, local_velocity_values); + + deallog << local_velocity_values.at(0) << std::endl; + } +} diff --git a/tests/codim_one/fe_values_extractor_01/cmp/generic b/tests/codim_one/fe_values_extractor_01/cmp/generic new file mode 100644 index 0000000000..1a437e95ea --- /dev/null +++ b/tests/codim_one/fe_values_extractor_01/cmp/generic @@ -0,0 +1,5 @@ + +DEAL::1.00000 1.00000 +DEAL::1.00000 1.00000 +DEAL::1.00000 1.00000 +DEAL::1.00000 1.00000 diff --git a/tests/codim_one/fe_values_extractor_01/square.msh b/tests/codim_one/fe_values_extractor_01/square.msh new file mode 100644 index 0000000000..997b625492 --- /dev/null +++ b/tests/codim_one/fe_values_extractor_01/square.msh @@ -0,0 +1,17 @@ +$MeshFormat +2.1 0 8 +$EndMeshFormat +$Nodes +4 +1 0 0 0 +2 1 0 0 +3 1 1 0 +4 0 1 0 +$EndNodes +$Elements +4 +1 1 3 0 1 0 1 2 +2 1 3 0 1 0 2 3 +3 1 3 0 1 0 3 4 +4 1 3 0 1 0 4 1 +$EndElements -- 2.39.5