From 3ed6375e64e2f4241cdb6a4800e87b8cffc7f45c Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 3 Apr 2006 22:47:06 +0000 Subject: [PATCH] Fix a problem with vertex numbering Guido introduced when re-ordering vertices and quadrature points git-svn-id: https://svn.dealii.org/trunk@12807 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/source/numerics/data_out_stack.cc | 14 +++- tests/bits/data_out_stack_03.cc | 76 +++++++++++++++++++ tests/bits/data_out_stack_03/cmp/generic | 1 + 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 tests/bits/data_out_stack_03.cc create mode 100644 tests/bits/data_out_stack_03/cmp/generic diff --git a/deal.II/deal.II/source/numerics/data_out_stack.cc b/deal.II/deal.II/source/numerics/data_out_stack.cc index 4a800adc67..88443f0144 100644 --- a/deal.II/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/deal.II/source/numerics/data_out_stack.cc @@ -298,11 +298,21 @@ void DataOutStack::build_patches (const unsigned int n_subdivisions) switch (dim) { case 1: + // use the following + // vertices. it + // probably just + // requires some + // playing around + // with the order of + // vertices to make + // sure the resulting + // output is as + // expected patch->vertices[0] = Point(cell->vertex(0)(0), parameter-parameter_step); - patch->vertices[2] = Point(cell->vertex(0)(0), + patch->vertices[1] = Point(cell->vertex(0)(0), parameter); - patch->vertices[1] = Point(cell->vertex(1)(0), + patch->vertices[2] = Point(cell->vertex(1)(0), parameter-parameter_step); patch->vertices[3] = Point(cell->vertex(1)(0), parameter); diff --git a/tests/bits/data_out_stack_03.cc b/tests/bits/data_out_stack_03.cc new file mode 100644 index 0000000000..3e8e270e1d --- /dev/null +++ b/tests/bits/data_out_stack_03.cc @@ -0,0 +1,76 @@ +//---------------------------- data_out_stack_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- data_out_stack_03.cc --------------------------- + +// the order of vertices on 1d cells was confused somewhere somewhen. fix this + +#include "../tests.h" +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + + + + +template +void run () +{ + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation, -1, 1); + triangulation.refine_global (1); + + FE_Q fe(1); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs (fe); + + // create a continuous field over + // this DoFHandler + Vector v(dof_handler.n_dofs()); + v(v.size()/2) = 1; + + // output this field using + // DataOutStack. the result should + // be a continuous field again + DataOutStack data_out_stack; + data_out_stack.declare_data_vector ("solution", + DataOutStack::dof_vector); + data_out_stack.new_parameter_value (1,1); + data_out_stack.attach_dof_handler (dof_handler); + data_out_stack.add_data_vector (v, "solution"); + data_out_stack.build_patches (1); + data_out_stack.finish_parameter_value (); + + std::ofstream out ("out.gpl"); + data_out_stack.write_gnuplot (out); +} + + + +int main () +{ + std::ofstream logfile("data_out_stack_03/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + run<1> (); + + return 0; +} diff --git a/tests/bits/data_out_stack_03/cmp/generic b/tests/bits/data_out_stack_03/cmp/generic new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/tests/bits/data_out_stack_03/cmp/generic @@ -0,0 +1 @@ + -- 2.39.5