From 31b3cfc721d19fa97f49e7f8cf406f3c54508002 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 11 Jan 2000 15:26:08 +0000 Subject: [PATCH] Add exception if there are no patches. git-svn-id: https://svn.dealii.org/trunk@2188 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/data_out_base.h | 4 ++++ deal.II/base/source/data_out_base.cc | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/deal.II/base/include/base/data_out_base.h b/deal.II/base/include/base/data_out_base.h index d91f7c0470..ae78bcb3f3 100644 --- a/deal.II/base/include/base/data_out_base.h +++ b/deal.II/base/include/base/data_out_base.h @@ -960,6 +960,10 @@ class DataOutBase /** * Exception */ + DeclException0 (ExcNoPatches); + /** + * Exception + */ DeclException0 (ExcIO); private: diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index f2f12611c1..e8d936b142 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -27,6 +27,8 @@ void DataOutBase::write_ucd (const vector > &patches, { AssertThrow (out, ExcIO()); + Assert (patches.size() > 0, ExcNoPatches()); + const unsigned int n_data_sets = data_names.size(); // first count the number of cells @@ -403,6 +405,8 @@ void DataOutBase::write_gnuplot (const vector > &patches, { AssertThrow (out, ExcIO()); + Assert (patches.size() > 0, ExcNoPatches()); + const unsigned int n_data_sets = data_names.size(); // write preamble @@ -687,8 +691,9 @@ void DataOutBase::write_povray (const vector > &patches, const PovrayFlags &flags, ostream &out) { - AssertThrow (out, ExcIO()); + + Assert (patches.size() > 0, ExcNoPatches()); Assert (dim==2, ExcNotImplemented()); // only for 2-D const unsigned int n_data_sets = data_names.size(); @@ -988,6 +993,10 @@ void DataOutBase::write_eps (const vector > &patches, const EpsFlags &flags, ostream &out) { + Assert (out, ExcIO()); + + Assert (patches.size() > 0, ExcNoPatches()); + switch (dim) { case 2: @@ -1324,6 +1333,8 @@ void DataOutBase::write_gmv (const vector > &patches, { AssertThrow (out, ExcIO()); + Assert (patches.size() > 0, ExcNoPatches()); + const unsigned int n_data_sets = data_names.size(); /////////////////////// -- 2.39.5