]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
automatic component names
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 14 Mar 2000 18:08:57 +0000 (18:08 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 14 Mar 2000 18:08:57 +0000 (18:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@2581 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 8ad26a03d8e95fd9097f6be65cbe8afc395561e5..ac04fc9077113160841e0f1e850561c2e894940d 100644 (file)
@@ -1,2 +1,3 @@
 config.log
 config.status
+TODO
index ab3431a6d8e0d20a56a7ad1779702fb3396f9a28..f40801d10a7514cdac45133c8c5461868017549f 100644 (file)
@@ -26,6 +26,8 @@
 #include <base/thread_manager.h>
 #endif
 
+#include <strstream>
+
 template <int dim>
 DataOut_DoFData<dim>::DataEntry::DataEntry (const Vector<double> *data,
                                            const vector<string> &names) :
@@ -95,20 +97,24 @@ template <int dim>
 void DataOut_DoFData<dim>::add_data_vector (const Vector<double> &vec,
                                            const string         &name)
 {
-//TODO: Guido fixes the following when string operators work properly
-// There was a problem with stringstreams (Linux, egcs1.2)
-//  unsigned int n = dofs->get_fe().n_components ();
-//    if (n > 1)
-//      {
-//        vector<string> names (dofs->get_fe().n_components ());
-//        for (unsigned int i=0;i<n;++i)
-//     {
-//       names[i] = name + string("_");
-//     }
-//    }
-  add_data_vector (vec, vector<string>(1,name));
-}
+  unsigned int n = dofs->get_fe().n_components ();
 
+  vector<string> names (1);
+  if (n > 1)
+    {
+      names.resize(dofs->get_fe().n_components ());
+      for (unsigned int i=0;i<n;++i)
+       {
+         ostrstream namebuf;
+         namebuf << name << '_' << i << ends;
+         names[i] = namebuf.str();
+       }
+    } else {
+      names[0] = name;
+    }
+  
+  add_data_vector (vec, names);
+}
 
 
 
@@ -127,7 +133,7 @@ void DataOut_DoFData<dim>::clear ()
                                   // delete patches
   vector<DataOutBase::Patch<dim> > dummy;
   patches.swap (dummy);
-};
+}
 
 
 template <int dim>

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.