]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement DataOutReader::merge
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 20 Apr 2005 22:19:35 +0000 (22:19 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 20 Apr 2005 22:19:35 +0000 (22:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@10551 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/data_out_base.cc

index ef9d553b639632d870ba59963721c7437d5f1396..d7666f4e39065282e3b200e379c8f82b100280be 100644 (file)
@@ -4640,6 +4640,50 @@ DataOutReader<dim,spacedim>::read (std::istream &in)
 
 
 
+template <int dim, int spacedim>
+void
+DataOutReader<dim,spacedim>::
+merge (const DataOutReader<dim,spacedim> &source) 
+{
+  typedef typename ::DataOutBase::Patch<dim,spacedim> Patch;
+  
+  const std::vector<Patch> source_patches = source.get_patches ();
+  Assert (patches.size () != 0,        ExcNoPatches ());
+  Assert (source_patches.size () != 0, ExcNoPatches ());
+                                   // check equality of component
+                                   // names
+  Assert (get_dataset_names() == source.get_dataset_names(),
+          ExcIncompatibleDatasetNames());
+                                   // make sure patches are compatible
+  Assert (patches[0].n_subdivisions == source_patches[0].n_subdivisions,
+          ExcIncompatiblePatchLists());
+  Assert (patches[0].data.n_rows() == source_patches[0].data.n_rows(),
+          ExcIncompatiblePatchLists());
+  Assert (patches[0].data.n_cols() == source_patches[0].data.n_cols(),
+          ExcIncompatiblePatchLists());
+
+                                   // merge patches. store old number
+                                   // of elements, since we need to
+                                   // adjust patch numbers, etc
+                                   // afterwards
+  const unsigned int old_n_patches = patches.size();
+  patches.insert (patches.end(),
+                  source_patches.begin(),
+                  source_patches.end());
+
+                                   // adjust patch numbers
+  for (unsigned int i=old_n_patches; i<patches.size(); ++i)
+    patches[i].patch_index += old_n_patches;
+  
+                                   // adjust patch neighbors
+  for (unsigned int i=old_n_patches; i<patches.size(); ++i)
+    for (unsigned int n=0; n<GeometryInfo<dim>::faces_per_cell; ++n)
+      if (patches[i].neighbors[n] != Patch::no_neighbor)
+        patches[i].neighbors[n] += old_n_patches;
+}
+
+
+
 template <int dim, int spacedim>
 const std::vector<typename ::DataOutBase::Patch<dim,spacedim> > &
 DataOutReader<dim,spacedim>::get_patches () const

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.