]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
added write_visit_record that allows for multiple blocks and more than one time step
authorfahad.alrashed <fahad.alrashed@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 21 Sep 2013 15:52:05 +0000 (15:52 +0000)
committerfahad.alrashed <fahad.alrashed@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 21 Sep 2013 15:52:05 +0000 (15:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@30886 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/data_out_base.h
deal.II/source/base/data_out_base.cc

index 082e98bb390d272a2e9a788fd2a77a08bf408e37..9693e21c6f369815f69e442e91111d130c6365fa 100644 (file)
@@ -2314,8 +2314,8 @@ public:
 
   /**
    * This function is the exact equivalent of the write_pvtu_record()
-   * function but for the VisIt visualization program. See there for
-   * the purpose of this function.
+   * function but for the VisIt visualization program and for one visualization graph
+   * (or one time step only). See there for the purpose of this function.
    *
    * This function is documented in the "Creating a master file for
    * parallel" section (section 5.7) of the "Getting data into VisIt"
@@ -2325,6 +2325,37 @@ public:
   void write_visit_record (std::ostream &out,
                            const std::vector<std::string> &piece_names) const;
 
+  /**
+   * This function is equivalent to the write_visit_record() above but for multiple
+   * time steps. Here is an example of how the function would be used:
+   * @code
+   *  DataOut<dim> data_out;
+   *
+   *  const unsigned int number_of_time_steps = 3;
+   *  std::vector<std::vector<std::string > > piece_names(number_of_time_steps);
+   *
+   *  piece_names[0].push_back("subdomain_01.time_step_0.vtk");
+   *  piece_names[0].push_back("subdomain_02.time_step_0.vtk");
+   *
+   *  piece_names[1].push_back("subdomain_01.time_step_1.vtk");
+   *  piece_names[1].push_back("subdomain_02.time_step_1.vtk");
+   *
+   *  piece_names[2].push_back("subdomain_01.time_step_2.vtk");
+   *  piece_names[2].push_back("subdomain_02.time_step_2.vtk");
+   *
+   *  std::ofstream visit_output ("master_file.visit");
+   *
+   *  data_out.write_visit_record(visit_output, piece_names);
+   * @endcode
+   *
+   * This function is documented in the "Creating a master file for
+   * parallel" section (section 5.7) of the "Getting data into VisIt"
+   * report that can be found here:
+   * https://wci.llnl.gov/codes/visit/2.0.0/GettingDataIntoVisIt2.0.0.pdf
+   */
+  void write_visit_record (std::ostream &out,
+                           const std::vector<std::vector<std::string> > &piece_names) const;
+
   /**
    * Obtain data through get_patches() and write it to <tt>out</tt> in
    * SVG format. See DataOutBase::write_svg.
index e1238da38b4da992988358aef20a1c6b2d232ae9..edb10d95e5ba436f012d162f7f3a57ddb9f32136 100644 (file)
@@ -6698,6 +6698,32 @@ DataOutInterface<dim,spacedim>::write_visit_record (std::ostream &out,
 
 
 
+template <int dim, int spacedim>
+void
+DataOutInterface<dim,spacedim>::write_visit_record (std::ostream &out,
+                                                    const std::vector<std::vector<std::string> > &piece_names) const
+{
+  AssertThrow (out, ExcIO());
+
+  if (piece_names.size() == 0)
+    return;
+
+  const double nblocks = piece_names[0].size();
+  Assert(nblocks > 0, ExcMessage("piece_names should be a vector of nonempty vectors.") )
+
+  out << "!NBLOCKS " << nblocks << '\n';
+  for (std::vector<std::vector<std::string> >::const_iterator domain = piece_names.begin(); domain != piece_names.end(); ++domain)
+  {
+    Assert(domain->size() == nblocks, ExcMessage("piece_names should be a vector of equal sized vectors.") )
+    for (std::vector<std::string>::const_iterator subdomain = domain->begin(); subdomain != domain->end(); ++subdomain)
+      out << *subdomain << '\n';
+  }
+
+  out << std::flush;
+}
+
+
+
 template <int dim, int spacedim>
 void DataOutInterface<dim,spacedim>::
 write_deal_II_intermediate (std::ostream &out) 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.