From: Wolfgang Bangerth Date: Tue, 9 Mar 2010 16:09:24 +0000 (+0000) Subject: Use .empty() instead of .size()==0. X-Git-Tag: v8.0.0~6356 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f88513ece2157dcc513236476cbdede0fdd8abb;p=dealii.git Use .empty() instead of .size()==0. git-svn-id: https://svn.dealii.org/trunk@20764 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/histogram.cc b/deal.II/deal.II/source/numerics/histogram.cc index b510fd8a23..e0aab40a28 100644 --- a/deal.II/deal.II/source/numerics/histogram.cc +++ b/deal.II/deal.II/source/numerics/histogram.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -65,7 +65,7 @@ void Histogram::evaluate (const std::vector > &values, // store y_values y_values = y_values_; - + // first find minimum and maximum value // in the indicators number min_value=0, max_value=0; @@ -77,7 +77,7 @@ void Histogram::evaluate (const std::vector > &values, values[0].end()); max_value = *std::max_element(values[0].begin(), values[0].end()); - + for (unsigned int i=1; i > &values, *std::max_element(values[i].begin(), values[i].end())); }; - + break; }; - + case logarithmic: { typedef bool (*comparator) (const number, const number); const comparator logarithmic_less_function = &Histogram::template logarithmic_less; - + min_value = *std::min_element(values[0].begin(), values[0].end(), logarithmic_less_function); - + max_value = *std::max_element(values[0].begin(), values[0].end(), logarithmic_less_function); - + for (unsigned int i=1; i > &values, values[i].end(), logarithmic_less_function), logarithmic_less_function); - + max_value = std::max (max_value, *std::max_element(values[i].begin(), values[i].end(), logarithmic_less_function), logarithmic_less_function); }; - + break; }; - + default: Assert (false, ExcInternalError()); }; @@ -145,7 +145,7 @@ void Histogram::evaluate (const std::vector > &values, // for the other data vectors by // copying intervals.push_back (std::vector()); - + switch (interval_spacing) { case linear: @@ -166,7 +166,7 @@ void Histogram::evaluate (const std::vector > &values, for (unsigned int n=0; n > &values, template void Histogram::evaluate (const Vector &values, const unsigned int n_intervals, - const IntervalSpacing interval_spacing) + const IntervalSpacing interval_spacing) { std::vector > values_list (1, values); @@ -216,7 +216,7 @@ void Histogram::evaluate (const Vector &values, void Histogram::write_gnuplot (std::ostream &out) const { AssertThrow (out, ExcIO()); - Assert (intervals.size() > 0, ExcEmptyData()); + Assert (!intervals.empty(), ExcEmptyData()); // do a simple 2d plot, if only // one data set is available @@ -275,9 +275,9 @@ void Histogram::write_gnuplot (std::ostream &out) const << ' ' << intervals[i][n].content << std::endl; - + out << std::endl; - + }; AssertThrow (out, ExcIO()); @@ -285,7 +285,7 @@ void Histogram::write_gnuplot (std::ostream &out) const -std::string Histogram::get_interval_spacing_names () +std::string Histogram::get_interval_spacing_names () { return "linear|logarithmic"; } @@ -322,7 +322,7 @@ Histogram::memory_consumption () const // explicit instantiations for float template void Histogram::evaluate (const std::vector > &values, - const std::vector &y_values, + const std::vector &y_values, const unsigned int n_intervals, const IntervalSpacing interval_spacing); template @@ -334,7 +334,7 @@ void Histogram::evaluate (const Vector &values, // explicit instantiations for double template void Histogram::evaluate (const std::vector > &values, - const std::vector &y_values, + const std::vector &y_values, const unsigned int n_intervals, const IntervalSpacing interval_spacing); template