From: Wolfgang Bangerth Date: Mon, 18 Aug 2014 22:44:55 +0000 (-0500) Subject: Silence a warning. X-Git-Tag: v8.2.0-rc1~199^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5769cb8760f05e77a37511d7781381a28dfaa209;p=dealii.git Silence a warning. Some newer compilers kept warning about an out-of-bounds array access in Point<1>::operator() but didn't indicate where exactly it came from. This turned out to be in DataOutBase::write_eps(), a function that is implemented only for dim==2 but was compiled also for dim==1 and dim==3 and contained this statement: 'points[vertex](1)'. The patch reorganizes the code so that the function is only compiled for dim==2 and a more general specialization that does nothing but abort is used for all other dimensions. --- diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index 885577d9de..4899c5f074 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -1474,9 +1474,11 @@ namespace DataOutBase * parameters which determine the direction of sight, the mode of * colorization, the scaling of the height axis, etc. (Of course, * all these parameters have reasonable default values, which you - * may want to change from time to time.) At present, this format - * only supports output for two-dimensional data, with values in the - * third direction taken from a data vector. + * may want to change.) + * + * This function only supports output for two-dimensional + * domains (i.e., with dim==2), with values in the vertical + * direction taken from a data vector. * * Basically, output consists of the mesh and the cells in between * them. You can draw either of these, or both, or none if you are @@ -1509,6 +1511,19 @@ namespace DataOutBase * documentation of the EpsFlags member class of this * class. See there for more and detailed information. */ + template + void write_eps (const std::vector > &patches, + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const EpsFlags &flags, + std::ostream &out); + + /** + * This is the same function as above except for domains that are + * not two-dimensional. This function is not implemented (and will + * throw an error if called) but is declared to allow for + * dimension-independent programs. + */ template void write_eps (const std::vector > &patches, const std::vector &data_names, @@ -1516,6 +1531,7 @@ namespace DataOutBase const EpsFlags &flags, std::ostream &out); + /** * Write the given list of patches to the output stream in * GMV format. diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index b0ee12eb5c..ec20c421af 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -3951,6 +3951,18 @@ namespace DataOutBase const std::vector > &, const EpsFlags &flags, std::ostream &out) + { + // not implemented, see the documentation of the function + AssertThrow (dim==2, ExcNotImplemented()); + } + + + template + void write_eps (const std::vector > &patches, + const std::vector &/*data_names*/, + const std::vector > &, + const EpsFlags &flags, + std::ostream &out) { Assert (out, ExcIO()); @@ -3974,9 +3986,6 @@ namespace DataOutBase return; #endif - // Do not allow volume rendering - AssertThrow (dim==2, ExcNotImplemented()); - const unsigned int old_precision = out.precision(); // set up an array of cells to be @@ -4011,7 +4020,7 @@ namespace DataOutBase // note that since dim==2, we // have exactly four vertices per // patch and per cell - for (typename std::vector >::const_iterator patch=patches.begin(); + for (typename std::vector >::const_iterator patch=patches.begin(); patch!=patches.end(); ++patch) { const unsigned int n_subdivisions = patch->n_subdivisions;