From: bangerth Date: Thu, 9 Jan 2014 00:18:50 +0000 (+0000) Subject: Fix the same bug in one more place. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcb42ced3f4219e123b752b67ebb9db681f9e17b;p=dealii-svn.git Fix the same bug in one more place. git-svn-id: https://svn.dealii.org/trunk@32182 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index c7a95ede57..aaf9fe0a0a 100644 --- a/deal.II/source/fe/fe_values.cc +++ b/deal.II/source/fe/fe_values.cc @@ -2385,8 +2385,7 @@ namespace internal return; - const unsigned int n_quadrature_points = dofs_per_cell > 0 ? - shape_derivatives[0].size() : 0; + const unsigned int n_quadrature_points = shape_derivatives[0].size(); const unsigned int n_components = fe.n_components(); // Assert that we can write all components into the result vectors @@ -2495,9 +2494,19 @@ namespace internal const bool quadrature_points_fastest = false, const unsigned int component_multiple = 1) { + // initialize with zero + for (unsigned int i=0; i 0 ? - shape_hessians[0].size() : 0; + if (dofs_per_cell == 0) + return; + + + const unsigned int n_quadrature_points = shape_hessians[0].size(); const unsigned int n_components = fe.n_components(); // Assert that we can write all components into the result vectors @@ -2515,11 +2524,6 @@ namespace internal AssertDimension (laplacians[i].size(), result_components); } - // initialize with zero - for (unsigned int i=0; i +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include + +using namespace dealii; + +int main() +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + Triangulation<2> triangulation; + GridGenerator::hyper_cube (triangulation); + triangulation.refine_global (1); + + + hp::FECollection<2> fe_collection; + + fe_collection.push_back(FESystem<2>(FE_Q<2>(1), 1, FE_Q<2>(1), 1)); + fe_collection.push_back(FESystem<2>(FE_Nothing<2>(), 1, FE_Nothing<2>(), 1)); + + hp::DoFHandler<2> dof_handler(triangulation); + + // Assign FE to cells + hp::DoFHandler<2>::active_cell_iterator cell; + hp::DoFHandler<2>::active_cell_iterator endc = dof_handler.end(); + + + cell = dof_handler.begin_active(); + cell->set_active_fe_index(1); + cell++; + cell->set_active_fe_index(1); + cell++; + cell->set_active_fe_index(0); + cell++; + cell->set_active_fe_index(0); + + + dof_handler.distribute_dofs (fe_collection); + + // Init solution + Vector solution(dof_handler.n_dofs()); + solution = 1.0; + + + SolutionTransfer<2, Vector, hp::DoFHandler<2> > solultion_trans(dof_handler); + solultion_trans.prepare_for_coarsening_and_refinement(solution); + + triangulation.execute_coarsening_and_refinement (); + dof_handler.distribute_dofs (fe_collection); + + Vector new_solution(dof_handler.n_dofs()); + solultion_trans.interpolate(solution, new_solution); + + hp::QCollection<2> q; + q.push_back(QMidpoint<2>()); + q.push_back(QMidpoint<2>()); + hp::FEValues<2> x_fe_values (fe_collection, q, update_hessians); + for (typename hp::DoFHandler<2>::active_cell_iterator cell = dof_handler.begin_active(); + cell != dof_handler.end(); ++cell) + { + x_fe_values.reinit (cell); + std::vector > + derivatives (q[0].size(), Vector(cell->get_fe().n_components())); + + x_fe_values.get_present_fe_values().get_function_laplacians (new_solution, + derivatives); + } + + // we are good if we made it to here + deallog << "OK" << std::endl; +} + + + diff --git a/tests/hp/do_function_laplacians_01.output b/tests/hp/do_function_laplacians_01.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/hp/do_function_laplacians_01.output @@ -0,0 +1,2 @@ + +DEAL::OK