Commit 5153e55a authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Fixes in changeFmaFormat. No DlPoly available

parent fa84e589
......@@ -68,15 +68,18 @@ int main(int argc, char ** argv){
}
FSize NbPoints;
FReal * particles = nullptr ;
FFmaGenericLoader * loader;
unsigned int nbData;
if (FParameters::existParameter(argc, argv, "-fin")) {
const std::string filename(FParameters::getStr(argc,argv,"-fin", "data.fma"));
FFmaGenericLoader loader(filename);
loader = new FFmaGenericLoader(filename);
//
// Allocation
//
NbPoints = loader.getNumberOfParticles();
const unsigned int nbData = loader.getNbRecordPerline() ;
NbPoints = loader->getNumberOfParticles();
nbData = loader->getNbRecordPerline() ;
const unsigned int arraySize =nbData*NbPoints;
//
particles = new FReal[arraySize] ;
......@@ -86,38 +89,39 @@ int main(int argc, char ** argv){
int j = 0 ;
for(int idxPart = 0 ; idxPart < NbPoints ;++idxPart, j+=nbData){
// //
loader.fillParticle(&particles[j],nbData);
loader->fillParticle(&particles[j],nbData);
// std::cout << "idxPart "<< idxPart << " ";
// for (int jj= 0 ; jj<nbData ; ++jj, ++k){
// std::cout << particles[k] << " ";
// }
// std::cout << std::endl;
}
else if(FParameters::existParameter(argc, argv, "-fdlpoly")){
FDlpolyLoader *loader = nullptr ;
// if(FParameters::existParameter(argc, argv, "-bin")){
// loader = new FDlpolyBinLoader(filenameEwaldIn.c_str());
// }
// else {
// loader = new FDlpolyAsciiLoader(filenameEwaldIn.c_str());
// }
// NbPoints = loader->getNumberOfParticles() ;
// particles = new FReal[arraySize] ;
// std::memset(particles,0,arraySize*sizeof(FReal));
// for(int idxPart = 0 ; idxPart < NbPoints ; ++idxPart){
//
// int index ;
// FPoint P ; FReal t[3];
/// / loader->fillParticle(&P, t, &physicalValue,&index);
// particles[(index-1)*]
//
// totalCharge += physicalValue ;
}
// if(FParameters::existParameter(argc, argv, "-fdlpoly")){
// FDlpolyLoader *loader = nullptr ;
// // if(FParameters::existParameter(argc, argv, "-bin")){
// // loader = new FDlpolyBinLoader(filenameEwaldIn.c_str());
// // }
// // else {
// // loader = new FDlpolyAsciiLoader(filenameEwaldIn.c_str());
// // }
// // NbPoints = loader->getNumberOfParticles() ;
// // particles = new FReal[arraySize] ;
// // std::memset(particles,0,arraySize*sizeof(FReal));
// // for(int idxPart = 0 ; idxPart < NbPoints ; ++idxPart){
// //
// // int index ;
// // FPoint P ; FReal t[3];
// /// / loader->fillParticle(&P, t, &physicalValue,&index);
// // particles[(index-1)*]
// //
// // totalCharge += physicalValue ;
// }
}
else {
genDistusage() ;
return 0;
}
FReal totalPhysical Value ;
//
/////////////////////////////////////////////////////////////////////////
......@@ -140,7 +144,7 @@ int main(int argc, char ** argv){
name += ".fma";
}
FFmaGenericWriter writer(name) ;
writer.writeHeader( loader.getCenterOfBox(), loader.getBoxWidth() , NbPoints, sizeof(FReal), nbData) ;
writer.writeHeader( loader->getCenterOfBox(), loader->getBoxWidth() , NbPoints, sizeof(FReal), nbData) ;
writer.writeArrayOfReal(particles, nbData, NbPoints);
}
//
......@@ -200,4 +204,4 @@ int main(int argc, char ** argv){
//
return 1;
}
}
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