Commit 8eb68b68 authored by COULAUD Olivier's avatar COULAUD Olivier

Add output file for Lagrange interpolation

Bug fixed in changeFormat and in stamp2Fma
parent 483333ad
......@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
FHelpDescribeAndExit(argc, argv,
"Driver for Lagrange interpolation kernel (1/r kernel).",
FParameterDefinitions::InputFile, FParameterDefinitions::OctreeHeight,
FParameterDefinitions::OctreeSubHeight, FParameterDefinitions::InputFile,
FParameterDefinitions::OctreeSubHeight, FParameterDefinitions::InputFile,FParameterDefinitions::OutputFile,
FParameterDefinitions::NbThreads);
......@@ -151,9 +151,9 @@ int main(int argc, char* argv[])
time.tic();
//
KernelClass kernels(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(),&MatrixKernel);
KernelClass *kernels = new KernelClass(TreeHeight, loader.getBoxWidth(), loader.getCenterOfBox(),&MatrixKernel);
//
FmmClass algo(&tree, &kernels);
FmmClass algo(&tree, kernels);
//
algo.execute(); // Here the call of the FMM algorithm
//
......@@ -213,7 +213,47 @@ int main(int argc, char* argv[])
}
// -----------------------------------------------------
if(FParameters::existParameter(argc, argv, FParameterDefinitions::OutputFile.options)){
std::string name(FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "output.fma"));
FFmaGenericWriter writer(name) ;
//
int NbPoints = loader.getNumberOfParticles();
FReal * particles ;
particles = new FReal[8*NbPoints] ;
memset(particles,0,8*NbPoints*sizeof(FReal));
int j = 0 ;
tree.forEachLeaf([&](LeafClass* leaf){
//
// Input
const FReal*const posX = leaf->getTargets()->getPositions()[0];
const FReal*const posY = leaf->getTargets()->getPositions()[1];
const FReal*const posZ = leaf->getTargets()->getPositions()[2];
const FReal*const physicalValues = leaf->getTargets()->getPhysicalValues();
const FVector<int>& indexes = leaf->getTargets()->getIndexes();
//
// Computed data
const FReal*const potentials = leaf->getTargets()->getPotentials();
const FReal*const forcesX = leaf->getTargets()->getForcesX();
const FReal*const forcesY = leaf->getTargets()->getForcesY();
const FReal*const forcesZ = leaf->getTargets()->getForcesZ();
//
const int nbParticlesInLeaf = leaf->getTargets()->getNbParticles();
for(int idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
j = 8*indexes[idxPart];
particles[j] = posX[idxPart] ;
particles[j+1] = posY[idxPart] ;
particles[j+2] = posZ[idxPart] ;
particles[j+3] = physicalValues[idxPart] ;
particles[j+4] = potentials[idxPart] ;
particles[j+5] = forcesX[idxPart] ;
particles[j+6] = forcesY[idxPart] ;
particles[j+7] = forcesZ[idxPart] ;
}
});
writer.writeHeader( loader.getCenterOfBox(), loader.getBoxWidth() , NbPoints, sizeof(FReal), 8) ;
writer.writeArrayOfReal(particles, 8 , NbPoints);
}
return 0;
}
......@@ -97,7 +97,7 @@ int main(int argc, char ** argv){
//
if(FParameters::existParameter(argc, argv, FParameterDefinitions::OutputVisuFile.options)){
std::string outfilename(FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "output.vtp"));
driverExportData(outfilename, particles , NbPoints);
driverExportData(outfilename, particles , NbPoints,loader->getNbRecordPerline() );
}
//
delete particles ;
......
......@@ -55,7 +55,7 @@ void genDistusage() {
<< " -help to see the parameters " << std::endl
<< " Input: only one option is allowed" << std::endl
<< " -fin name: file name to convert (with extension .fma (ascii) or bfma (binary) " <<std::endl
<< " -fdlpoly name: file name to convert with extension (.bin if binary file) " <<<<std::endl;
<< " -fdlpoly name: file name to convert with extension (.bin if binary file) " <<std::endl;
}
int main(int argc, char ** argv){
......
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