]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
How can this have worked in the presence of cell data???
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Mar 2000 16:12:40 +0000 (16:12 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Mar 2000 16:12:40 +0000 (16:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@2589 0785d39b-7218-0410-832d-ea1e28bc413d

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

index f40801d10a7514cdac45133c8c5461868017549f..388a06245322d2dfdb2b7f232b2be9d9d079104f 100644 (file)
@@ -35,17 +35,23 @@ DataOut_DoFData<dim>::DataEntry::DataEntry (const Vector<double> *data,
                names(names)
 {};
 
+
+
 template <int dim>
 DataOut_DoFData<dim>::DataOut_DoFData () :
                dofs(0)
 {};
 
+
+
 template <int dim>
 DataOut_DoFData<dim>::~DataOut_DoFData ()
 {
   clear ();
 };
 
+
+
 template <int dim>
 void DataOut_DoFData<dim>::attach_dof_handler (const DoFHandler<dim> &d)
 {
@@ -60,6 +66,8 @@ void DataOut_DoFData<dim>::attach_dof_handler (const DoFHandler<dim> &d)
     dofs->subscribe ();
 };
 
+
+
 template <int dim>
 void DataOut_DoFData<dim>::add_data_vector (const Vector<double> &vec,
                                            const vector<string> &names)
@@ -97,21 +105,29 @@ template <int dim>
 void DataOut_DoFData<dim>::add_data_vector (const Vector<double> &vec,
                                            const string         &name)
 {
-  unsigned int n = dofs->get_fe().n_components ();
+  unsigned int n_components = dofs->get_fe().n_components ();
 
-  vector<string> names (1);
-  if (n > 1)
+  vector<string> names;
+                                  // if only one component or vector
+                                  // is cell vector: we only need one
+                                  // name
+  if ((n_components == 1) ||
+      (vec.size() == dofs->get_tria().n_active_cells()))
     {
-      names.resize(dofs->get_fe().n_components ());
-      for (unsigned int i=0;i<n;++i)
+      names.resize (1, name);
+    }
+  else
+                                    // otherwise append _i to the
+                                    // given name
+    {
+      names.resize (n_components);
+      for (unsigned int i=0; i<n_components; ++i)
        {
          ostrstream namebuf;
          namebuf << name << '_' << i << ends;
          names[i] = namebuf.str();
-       }
-    } else {
-      names[0] = name;
-    }
+       };
+    };
   
   add_data_vector (vec, names);
 }

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.