From: hartmann Date: Tue, 6 Mar 2007 09:45:39 +0000 (+0000) Subject: Bug fix in GridIn::parse_tecplot_header: Replace reference to unsigned int array... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f09895a51ef20744c15b1250667e3d807d1503e;p=dealii-svn.git Bug fix in GridIn::parse_tecplot_header: Replace reference to unsigned int array[dim] by reference to vector array as the previous implementation caused wrong data access. git-svn-id: https://svn.dealii.org/trunk@14523 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/grid_in.h b/deal.II/deal.II/include/grid/grid_in.h index 4c90207c41..b585b7dc8e 100644 --- a/deal.II/deal.II/include/grid/grid_in.h +++ b/deal.II/deal.II/include/grid/grid_in.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -409,11 +409,11 @@ class GridIn * influence on the function execution.. */ static void parse_tecplot_header(std::string &header, - unsigned int (&tecplot2deal)[dim], + std::vector &tecplot2deal, unsigned int &n_vars, unsigned int &n_vertices, unsigned int &n_cells, - unsigned int (&IJK)[dim], + std::vector &IJK, bool &structured, bool &blocked); diff --git a/deal.II/deal.II/source/grid/grid_in.cc b/deal.II/deal.II/source/grid/grid_in.cc index 839256c987..4ad36aa2db 100644 --- a/deal.II/deal.II/source/grid/grid_in.cc +++ b/deal.II/deal.II/source/grid/grid_in.cc @@ -1244,14 +1244,16 @@ void GridIn<3>::read_netcdf (const std::string &filename) template void GridIn::parse_tecplot_header(std::string &header, - unsigned int (&tecplot2deal)[dim], + std::vector &tecplot2deal, unsigned int &n_vars, unsigned int &n_vertices, unsigned int &n_cells, - unsigned int (&IJK)[dim], + std::vector &IJK, bool &structured, bool &blocked) { + Assert(tecplot2deal.size()==dim, ExcInternalError()); + Assert(IJK.size()==dim, ExcInternalError()); // initialize the output variables n_vars=0; n_vertices=0; @@ -1431,7 +1433,7 @@ void GridIn::parse_tecplot_header(std::string &header, // tecplot itself accepts entries like // 'J=20' instead of 'E=20'. therefore, // take the max of IJK - n_cells=*std::max_element(IJK,IJK+dim); + n_cells=*std::max_element(IJK.begin(),IJK.end()); AssertThrow(n_cells>0, ExcMessage("Tecplot file does not contain a complete and consistent set of parameters")); } @@ -1471,11 +1473,11 @@ void GridIn<2>::read_tecplot (std::istream &in) // now create some variables holding // important information on the mesh, get // this information from the header string - unsigned int tecplot2deal[dim], - n_vars, + std::vector tecplot2deal(dim); + std::vector IJK(dim); + unsigned int n_vars, n_vertices, - n_cells, - IJK[dim]; + n_cells; bool structured, blocked;