49 "Writes a VTU file.");
62 if(!
m_f->m_exp.size())
70 cout <<
"OutputVtk: Writing file..." << endl;
74 string filename =
m_config[
"outfile"].as<
string>();
77 if(
m_f->m_session->GetComm()->GetSize() != 1)
79 int dot = filename.find_last_of(
'.');
80 string ext = filename.substr(dot,filename.length()-dot);
81 string procId =
"_P" + boost::lexical_cast<std::string>(
m_f->m_session->GetComm()->GetRank());
82 string start = filename.substr(0,dot);
83 filename = start + procId + ext;
87 ofstream outfile(filename.c_str());
88 m_f->m_exp[0]->WriteVtkHeader(outfile);
91 for (i = 0; i <
m_f->m_exp[0]->GetNumElmts(); ++i)
93 m_f->m_exp[0]->WriteVtkPieceHeader(outfile,i);
95 for (j = 0; j <
m_f->m_fielddef[0]->m_fields.size(); ++j)
97 m_f->m_exp[j]->WriteVtkPieceData(outfile, i,
98 m_f->m_fielddef[0]->m_fields[j]);
100 m_f->m_exp[0]->WriteVtkPieceFooter(outfile, i);
102 m_f->m_exp[0]->WriteVtkFooter(outfile);
103 cout <<
"Written file: " << filename << endl;