+ MCAuto<DataArrayByte> byteArr;
+ if(isBinary)
+ { byteArr=DataArrayByte::New(); byteArr->alloc(0,1); }
+ writeVTKAdvanced(ret,cda,pda,byteArr);
+ return ret;
+}
+
+/*!
+ * This method takes in input a file name \a fileName and considering the VTK extension of \a this (depending on the type of \a this)
+ * returns a right file name. If the input \a fileName has a valid extension the returned string is equal to \a fileName.
+ *
+ * \sa getVTKFileExtension
+ */
+std::string MEDCouplingMesh::getVTKFileNameOf(const std::string& fileName) const
+{
+ std::string ret;
+ std::string part0,part1;
+ SplitExtension(fileName,part0,part1);
+ std::string ext("."); ext+=getVTKFileExtension();
+ if(part1==ext)
+ ret=fileName;
+ else
+ ret=fileName+ext;
+ return ret;
+}
+
+/// @cond INTERNAL
+void MEDCouplingMesh::writeVTKAdvanced(const std::string& fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const
+{
+ std::ofstream ofs(fileName.c_str());
+ ofs << "<VTKFile type=\"" << getVTKDataSetType() << "\" version=\"0.1\" byte_order=\"" << MEDCouplingByteOrderStr() << "\">\n";
+ writeVTKLL(ofs,cda,pda,byteData);
+ if(byteData)
+ {
+ ofs << "<AppendedData encoding=\"raw\">\n_1234";
+ ofs << std::flush; ofs.close();
+ std::ofstream ofs2(fileName.c_str(),std::ios_base::binary | std::ios_base::app);
+ ofs2.write(byteData->begin(),byteData->getNbOfElems()); ofs2 << std::flush; ofs2.close();
+ std::ofstream ofs3(fileName.c_str(),std::ios_base::app); ofs3 << "\n</AppendedData>\n</VTKFile>\n"; ofs3.close();
+ }
+ else
+ {
+ ofs << "</VTKFile>\n";
+ ofs.close();
+ }