Commit aa8ee3be authored by COULAUD Olivier's avatar COULAUD Olivier

add binary option to save data

parent cc54215f
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
//! \param -help (-h) to see the parameters available in this driver //! \param -help (-h) to see the parameters available in this driver
//! \param -N The number of points in the distribution (default 20000) //! \param -N The number of points in the distribution (default 20000)
//! \param -filename name: generic name for files (without extension) and save data //! \param -filename name: generic name for files (without extension) and save data
//! with following format in name.xxx or name.bin in -bin (not yet implemented) is set //! with following format in name.fma or name.bfma in -bin is set"
//! \param -visufmt format for the visu file (vtk, vtp, cvs or cosmo). vtp is the default //! \param -visufmt format for the visu file (vtk, vtp, cvs or cosmo). vtp is the default
//! \param -extraLength value extra length to add to the boxWidth //! \param -extraLength value extra length to add to the boxWidth
//! //!
...@@ -96,11 +96,12 @@ void genDistusage() { ...@@ -96,11 +96,12 @@ void genDistusage() {
<< " -zeromean the average of the physical values is zero " <<std::endl<<std::endl << " -zeromean the average of the physical values is zero " <<std::endl<<std::endl
<< " Output " << std::endl << " Output " << std::endl
<< " -filename name: generic name for files (without extension) and save data" <<std::endl << " -filename name: generic name for files (without extension) and save data" <<std::endl
<< " with following format in name.xxx or name.bin in -bin is set" <<std::endl << " with following format in name.fma or name.bfma in -bin is set" <<std::endl
// << " -visu save output in name.txt" <<std::endl << " -bin save output in binary file name.txt" <<std::endl
<< " -visufmt vtk, vtp, cosmo or cvs format " <<std::endl; << " -visufmt vtk, vtp, cosmo or cvs format " <<std::endl;
} }
int main(int argc, char ** argv){ int main(int argc, char ** argv){
// //
if(FParameters::existParameter(argc, argv, "-h")||FParameters::existParameter(argc, argv, "-help")|| (argc < 3 )){ if(FParameters::existParameter(argc, argv, "-h")||FParameters::existParameter(argc, argv, "-help")|| (argc < 3 )){
...@@ -210,45 +211,7 @@ int main(int argc, char ** argv){ ...@@ -210,45 +211,7 @@ int main(int argc, char ** argv){
// Save data // Save data
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
if(FParameters::existParameter(argc, argv, "-visufmt")){
std::string visufile(""), fmt(FParameters::getStr(argc,argv,"-visufmt", "vtp"));
if( fmt == "vtp" ){
visufile = genericFileName + ".vtp" ;
}
else if( fmt == "vtk" ){
visufile = genericFileName + ".vtk" ;
}
else if( fmt == "cosmo" ){
visufile = genericFileName + ".cosmo" ;
}
else {
visufile = genericFileName + ".csv" ;
}
std::ofstream file( visufile, std::ofstream::out);
if(!file) {
std::cout << "Cannot open file."<< std::endl;
exit(-1) ;
} //
//
// Export data in cvs format
//
if( fmt == "vtp" ){
std::cout << "Writes in XML VTP format (visualization) in file "<< visufile <<std::endl ;
exportVTKxml( file, NbPoints, particles) ;
}
else if( fmt == "vtk" ){
std::cout << "Writes in VTK format (visualization) in file "<< visufile <<std::endl ;
exportVTK( file, NbPoints, particles) ;
}
else if( fmt == "cosmo" ){
std::cout << "Writes in COSMO format (visualization) in file "<< visufile <<std::endl ;
exportCOSMOS( file, NbPoints, particles) ;
}
else {
std::cout << "Writes in CVS format (visualization) in file "<<visufile<<std::endl ;
exportCVS( file, NbPoints, particles) ;
}
}
// //
// Generate file for ScalFMM Loader // Generate file for ScalFMM Loader
// //
...@@ -289,6 +252,48 @@ int main(int argc, char ** argv){ ...@@ -289,6 +252,48 @@ int main(int argc, char ** argv){
// //
} }
// //
//
//
if(FParameters::existParameter(argc, argv, "-visufmt")){
std::string visufile(""), fmt(FParameters::getStr(argc,argv,"-visufmt", "vtp"));
if( fmt == "vtp" ){
visufile = genericFileName + ".vtp" ;
}
else if( fmt == "vtk" ){
visufile = genericFileName + ".vtk" ;
}
else if( fmt == "cosmo" ){
visufile = genericFileName + ".cosmo" ;
}
else {
visufile = genericFileName + ".csv" ;
}
std::ofstream file( visufile, std::ofstream::out);
if(!file) {
std::cout << "Cannot open file."<< std::endl;
exit(-1) ;
} //
//
// Export data in cvs format
//
if( fmt == "vtp" ){
std::cout << "Writes in XML VTP format (visualization) in file "<< visufile <<std::endl ;
exportVTKxml( file, NbPoints, particles) ;
}
else if( fmt == "vtk" ){
std::cout << "Writes in VTK format (visualization) in file "<< visufile <<std::endl ;
exportVTK( file, NbPoints, particles) ;
}
else if( fmt == "cosmo" ){
std::cout << "Writes in COSMO format (visualization) in file "<< visufile <<std::endl ;
exportCOSMOS( file, NbPoints, particles) ;
}
else {
std::cout << "Writes in CVS format (visualization) in file "<<visufile<<std::endl ;
exportCVS( file, NbPoints, particles) ;
}
}
//
delete particles ; delete particles ;
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment