From: heister Date: Fri, 2 Mar 2012 21:06:32 +0000 (+0000) Subject: Fix vtu data output with 0 own cells. Before we wrote an empty file, but then the... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbd0fba2687886953b2446e3242b3628a49629f0;p=dealii-svn.git Fix vtu data output with 0 own cells. Before we wrote an empty file, but then the collection can not be read in with visit or paraview. git-svn-id: https://svn.dealii.org/trunk@25198 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/base/data_out_base.cc b/deal.II/source/base/data_out_base.cc index ebbf91020f..52fc8725fe 100644 --- a/deal.II/source/base/data_out_base.cc +++ b/deal.II/source/base/data_out_base.cc @@ -4791,7 +4791,61 @@ void DataOutBase::write_vtu_main (const std::vector > &patch Assert (patches.size() > 0, ExcNoPatches()); #else if (patches.size() == 0) - return; + { + // we still need to output a valid vtu file, because other CPUs + // might output data. This is the minimal file that is accepted by paraview and visit. + // if we remove the field definitions, visit is complaining. + out << "\n" + << "\n" + << "\n" + << "\n" + << " \n"; + std::vector data_set_written (data_names.size(), false); + for (unsigned int n_th_vector=0; n_th_vector(vector_data_ranges[n_th_vector]); + i<=std_cxx1x::get<1>(vector_data_ranges[n_th_vector]); + ++i) + data_set_written[i] = true; + + // write the + // header. concatenate all the + // component names with double + // underscores unless a vector + // name has been specified + out << " (vector_data_ranges[n_th_vector]) != "") + out << std_cxx1x::get<2>(vector_data_ranges[n_th_vector]); + else + { + for (unsigned int i=std_cxx1x::get<0>(vector_data_ranges[n_th_vector]); + i(vector_data_ranges[n_th_vector]); + ++i) + out << data_names[i] << "__"; + out << data_names[std_cxx1x::get<1>(vector_data_ranges[n_th_vector])]; + } + + out << "\" NumberOfComponents=\"3\">\n"; + } + + for (unsigned int data_set=0; data_set\n"; + } + + out << "\n"; + + out + << "" << std::endl; + + return; + } #endif VtuStream vtu_out(out, flags);