]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Improve on the type of exception that is generated when a vector has
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 13 Jun 2000 11:38:57 +0000 (11:38 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 13 Jun 2000 11:38:57 +0000 (11:38 +0000)
wrong size. Previously we got the null-information exception
--------------------------------------------------------
An error occurred in line <83> of file <source/numerics/data_out.cc> in function
    void DataOut_DoFData<2>::add_data_vector(const Vector<double> &, const vector<basic_string<char,string_char_traits<char>,__malloc_alloc_template<0> >,allocator<basic_string<char,string_char_traits<char>,__malloc_alloc_template<0> > > > &)
The violated condition was:
    ((vec.size() == dofs->get_tria().n_active_cells()) && (names.size() == 1)) || ((vec.size() == dofs->n_dofs()) && (names.size() == dofs->get_fe().n_components()))
The name and call sequence of the exception was:
    ExcInvalidNumberOfNames (names.size(), dofs->get_fe().n_components())
Additional Information:
You have to give one name per component in your data vector. The number you gave was 1, but the number of components is 1
--------------------------------------------------------
which does not shed much light on what the problem is (number of
components seems to be ok, not?)

Now we get
1--------------------------------------------------------
An error occurred in line <81> of file <source/numerics/data_out.cc> in function
    void DataOut_DoFData<2>::add_data_vector(const Vector<double> &, const vector<basic_string<char,string_char_traits<char>,__malloc_alloc_template<0> >,allocator<basic_string<char,string_char_traits<char>,__malloc_alloc_template<0> > > > &)
The violated condition was:
    (vec.size() == dofs->get_tria().n_active_cells()) || (vec.size() == dofs->n_dofs())
The name and call sequence of the exception was:
    ExcInvalidVectorSize(vec.size(), dofs->get_tria().n_active_cells(), dofs->n_dofs())
Additional Information:
The vector has size 0 but the DoFHandler objects says there are 2560 degrees of freedom and there are 2641 active cells.
--------------------------------------------------------

git-svn-id: https://svn.dealii.org/trunk@3008 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/data_out.cc

index aef1a228909dd4c3d9da3a070e1d78f08eb99b5b..baeb073f28f2a21e4402e472ba5ddf92a74eb036 100644 (file)
@@ -73,14 +73,21 @@ void DataOut_DoFData<dim>::add_data_vector (const Vector<double> &vec,
                                            const vector<string> &names)
 {
   Assert (dofs != 0, ExcNoDoFHandlerSelected ());
+
+                                  // check for allowed sizes of
+                                  // vectors
+  Assert ((vec.size() == dofs->get_tria().n_active_cells()) ||
+         (vec.size() == dofs->n_dofs()),
+         ExcInvalidVectorSize(vec.size(), dofs->get_tria().n_active_cells(), dofs->n_dofs()));
+  
                                   // either cell data and one name,
                                   // or dof data and n_components names
-  Assert (((vec.size() == dofs->get_tria().n_active_cells()) &&
-          (names.size() == 1))
-         ||
-         ((vec.size() == dofs->n_dofs()) &&
-          (names.size() == dofs->get_fe().n_components())),
-         ExcInvalidNumberOfNames (names.size(), dofs->get_fe().n_components()));
+  if (vec.size() == dofs->get_tria().n_active_cells())
+    Assert (names.size() == 1,
+           ExcInvalidNumberOfNames (names.size(), 1));
+  if (vec.size() == dofs->n_dofs())
+    Assert (names.size() == dofs->get_fe().n_components(),
+           ExcInvalidNumberOfNames (names.size(), dofs->get_fe().n_components()));
   for (unsigned int i=0; i<names.size(); ++i)
     Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
                                       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.