50 "Writes a VTU file.");
63 if(!
m_f->m_exp.size())
71 cout <<
"OutputVtk: Writing file..." << endl;
75 string filename =
m_config[
"outfile"].as<
string>();
78 if(
m_f->m_session->GetComm()->GetSize() != 1)
80 int dot = filename.find_last_of(
'.');
81 string ext = filename.substr(dot,filename.length()-dot);
82 string procId =
"_P" + boost::lexical_cast<std::string>(
83 m_f->m_session->GetComm()->GetRank());
84 string start = filename.substr(0,dot);
85 filename = start + procId + ext;
89 ofstream outfile(filename.c_str());
90 m_f->m_exp[0]->WriteVtkHeader(outfile);
93 if (
m_f->m_fielddef.size() == 0)
99 nfields =
m_f->m_fielddef[0]->m_fields.size();
101 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
104 for(
int s = 0; s < nstrips; ++s)
107 for (i = 0; i <
m_f->m_exp[0]->GetNumElmts(); ++i)
109 m_f->m_exp[0]->WriteVtkPieceHeader(outfile,i,s);
112 for (j = 0; j < nfields; ++j)
114 m_f->m_exp[s*nfields+j]->WriteVtkPieceData(
115 outfile, i,
m_f->m_fielddef[0]->m_fields[j]);
117 m_f->m_exp[0]->WriteVtkPieceFooter(outfile, i);
120 m_f->m_exp[0]->WriteVtkFooter(outfile);
121 cout <<
"Written file: " << filename << endl;
pair< ModuleType, string > ModuleKey
Abstract base class for output modules.
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
virtual void Process()
Write mesh to output file.
boost::shared_ptr< Field > FieldSharedPtr
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.