From e976fc38d5681054f3432699e6ed97cf4ccd934f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 26 May 1998 12:58:41 +0000 Subject: [PATCH] Add a bit of error checking. git-svn-id: https://svn.dealii.org/trunk@367 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/Todo | 3 +++ deal.II/deal.II/include/numerics/data_io.h | 9 +++++++++ deal.II/deal.II/source/numerics/data_io.cc | 3 +++ 3 files changed, 15 insertions(+) diff --git a/deal.II/deal.II/Todo b/deal.II/deal.II/Todo index 7d41e06ac6..79ea4e7166 100644 --- a/deal.II/deal.II/Todo +++ b/deal.II/deal.II/Todo @@ -103,6 +103,9 @@ Remove the this-> coding in tria_iterator.templates.h. These were egcs snapshot. +Re-enable printing of a preamble to ucd files in data_io.cc. + + DEAL: diff --git a/deal.II/deal.II/include/numerics/data_io.h b/deal.II/deal.II/include/numerics/data_io.h index d781afaaf3..ccdfe0204a 100644 --- a/deal.II/deal.II/include/numerics/data_io.h +++ b/deal.II/deal.II/include/numerics/data_io.h @@ -425,6 +425,15 @@ class DataOut { * Exception */ DeclException0 (ExcNoDoFHandlerSelected); + /** + * Exception + */ + DeclException2 (ExcInvalidVectorSize, + int, int, + << "The vector has size " << arg1 + << " but the DoFHandler objects says there are " << arg2 + << " degrees of freedom."); + private: /** diff --git a/deal.II/deal.II/source/numerics/data_io.cc b/deal.II/deal.II/source/numerics/data_io.cc index 44eb3a8700..b3d2d57135 100644 --- a/deal.II/deal.II/source/numerics/data_io.cc +++ b/deal.II/deal.II/source/numerics/data_io.cc @@ -212,6 +212,9 @@ template void DataOut::add_data_vector (const dVector &vec, const string &name, const string &units) { + Assert (dofs != 0, ExcNoDoFHandlerSelected ()); + Assert (vec.size() == dofs->n_dofs(), + ExcInvalidVectorSize (vec.size(), dofs->n_dofs())); DataEntry new_entry (&vec, name, units); data.push_back (new_entry); }; -- 2.39.5