Commit 0144695a authored by BRAMAS Berenger's avatar BRAMAS Berenger

Use fsize when asking the number of particules from the command line

parent 1b55a9ff
......@@ -114,7 +114,7 @@ int main(int argc, char ** argv){
typedef double FReal;
FReal extraRadius = 0.000 ;
const int NbPoints = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20000);
const FSize NbPoints = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20000));
const std::string genericFileName(FParameters::getStr(argc,argv,FParameterDefinitions::InputFile.options, "unifPointDist"));
FReal BoxWith = 0.0;
FPoint<FReal> Centre(0.0, 0.0,0.0);
......@@ -145,14 +145,14 @@ int main(int argc, char ** argv){
particles[j] = phyVal ;
}
if(FParameters::existParameter(argc, argv, "-zeromean")){
FReal rm = sum/NbPoints ; sum = 0.0 ;
FReal rm = FReal(sum)/FReal(NbPoints) ; sum = 0.0 ;
j = 3 ;
for(int i = 0 ; i< NbPoints; ++i, j+=4){
particles[j] -= rm ;
sum += particles[j] ;
}
}
std::cout << "Sum physical value "<< sum << " Mean Value " << sum/NbPoints<<std::endl ;
std::cout << "Sum physical value "<< sum << " Mean Value " << sum/FReal(NbPoints)<<std::endl ;
//
// Point generation
//
......@@ -194,7 +194,7 @@ int main(int argc, char ** argv){
std::cout << "A: "<<A<<" B "<< B << " C: " << C<<std::endl;
unifRandonPointsOnProlate(NbPoints,A,C,particles);
BoxWith = 2.0*C;
} //const int NbPoints = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20000);
} //const FSize NbPoints = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20000));
else if(FParameters::existParameter(argc, argv, "-ellipsoid")){
// else if(FParameters::existParameter(argc, argv, "-ellipsoid")){
std::string dd(":"),aspectRatio = FParameters::getStr(argc,argv,"-ar", "1:1:2");
......
......@@ -79,8 +79,8 @@ int main(int argc, char** argv){
const int MinLevelAbove = FParameters::getValue(argc, argv, LocalOptionMinPer.options,-1);
const int MaxLevelAbove = FParameters::getValue(argc, argv, LocalOptionMaxPer.options,3);
const int IncLevelAbove = 1;
const int NbParticles = FParameters::getValue(argc, argv, FParameterDefinitions::NbParticles.options,6);
const int NbParticlesPrint = FParameters::getValue(argc, argv, LocalOptionNbPrint.options, FMath::Min(6, NbParticles));
const FSize NbParticles = FParameters::getValue(argc, argv, FParameterDefinitions::NbParticles.options,FSize(6));
const int NbParticlesPrint = FParameters::getValue(argc, argv, LocalOptionNbPrint.options, 6);
FAssertLF(NbParticlesPrint <= NbParticles , "The number of printer particles cannot be higer than the number of particles.");
std::cout << "The application will use " << NbParticles << " but studies only " << NbParticlesPrint << " of them." << std::endl;
......
......@@ -69,7 +69,7 @@ typedef FSphericalKernel< FReal, CellClass, ContainerClass > KernelClass;
typedef FFmmAlgorithm<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
void doATest(const int NbParticles, const int minP, const int maxP, const int minH, const int maxH,
void doATest(const FSize NbParticles, const int minP, const int maxP, const int minH, const int maxH,
const FReal physicalValue, const bool neutral ,
FMath::FAccurater<FReal>* allPotentialDiff, FReal* allAbsoluteDiff, FReal* timing,
const int SizeSubLevels = 3, FReal* timeForDirect = nullptr){
......@@ -221,7 +221,7 @@ int main(int argc, char ** argv){
FHelpDescribeAndExit(argc, argv, "Please read the code to know more, sorry");
}
const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 60000);
const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(60000));
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 6);
const int DevP = FParameters::getValue(argc,argv,FParameterDefinitions::SHDevelopment.options, 30);
const FReal physicalValue = FParameters::getValue(argc,argv,"-pv", 1.0);
......@@ -259,7 +259,7 @@ int main(int argc, char ** argv){
fprintf(fplot, "# H and P test\n");
fprintf(fplot, "set terminal svg\n");
fprintf(fplot, "set output \"test-hp.svg\"\n");
fprintf(fplot, "set title \"Precision for different H and P (NbParticles = %d)\n", NbParticles);
fprintf(fplot, "set title \"Precision for different H and P (NbParticles = %lld)\n", NbParticles);
fprintf(fplot, "set xlabel \"H\"\n");
fprintf(fplot, "set ylabel \"P\"\n");
fprintf(fplot, "set zlabel \"Accuracy\"\n");
......@@ -281,7 +281,7 @@ int main(int argc, char ** argv){
const FReal stepValue = FParameters::getValue(argc,argv,"-sep", 0.1);
const int nbStep = int((endPosition-startPosition)/stepValue);
const FReal boxWidth = FParameters::getValue(argc,argv,"-bw", 10.0);
const FReal boxWidth = FParameters::getValue(argc,argv,"-bw", FReal(10.0));
const FPoint<FReal> boxCenter(0,0,0);
......@@ -399,7 +399,7 @@ int main(int argc, char ** argv){
fprintf(fplot, "# several height test\n");
fprintf(fplot, "set terminal svg\n");
fprintf(fplot, "set output \"test-h.svg\"\n");
fprintf(fplot, "set title \"Time for 3 different P and different H (NbParticles = %d)\"\n", NbParticles);
fprintf(fplot, "set title \"Time for 3 different P and different H (NbParticles = %lld)\"\n", NbParticles);
fprintf(fplot, "set xlabel \"Height of the tree\"\n");
fprintf(fplot, "set ylabel \"Time\"\n");
fprintf(fplot, "set size ratio 0.5\n");
......@@ -492,7 +492,7 @@ int main(int argc, char ** argv){
fprintf(fplot, "# several height test\n");
fprintf(fplot, "set terminal svg\n");
fprintf(fplot, "set output \"test-p.svg\"\n");
fprintf(fplot, "set title \"Accuracy for different P (NbParticles = %d)\"\n", NbParticles);
fprintf(fplot, "set title \"Accuracy for different P (NbParticles = %lld)\"\n", NbParticles);
fprintf(fplot, "set xlabel \"P\"\n");
fprintf(fplot, "set ylabel \"Accuracy\"\n");
fprintf(fplot, "set y2label \"Absolute Error\"\n");
......
......@@ -70,7 +70,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 7);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
FTic counter;
//////////////////////////////////////////////////////////////////////////////////
......
......@@ -74,7 +74,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
FTic counter;
//////////////////////////////////////////////////////////////////////////////////
......
......@@ -93,7 +93,7 @@ template< class CellClass, class ContainerClass>
class MyKernel : public FAbstractKernels<CellClass,ContainerClass>{
MortonIndex* indexForEachParticle;
public:
MyKernel(const int inNbParticles): indexForEachParticle(new MortonIndex[inNbParticles]) {
MyKernel(const FSize inNbParticles): indexForEachParticle(new MortonIndex[inNbParticles]) {
memset(indexForEachParticle,0,sizeof(MortonIndex)*inNbParticles);
}
......@@ -161,7 +161,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
FTic counter;
//////////////////////////////////////////////////////////////////////////////////
......
......@@ -71,7 +71,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
const int DevP = FParameters::getValue(argc,argv,FParameterDefinitions::SHDevelopment.options, 5);
const FPoint<FReal> centerOfBox = FPoint<FReal>(0.5,0.5,0.5);
FTic counter;
......
......@@ -55,7 +55,7 @@ int main(int argc, char ** argv){
std::cout << ">> It is only interesting to wath the code to understand\n";
std::cout << ">> how to use the Octree\n";
//////////////////////////////////////////////////////////////
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
FTic counter;
FRandomLoader<FReal> loader(NbPart, 1, FPoint<FReal>(0.5,0.5,0.5), 1);
......
......@@ -56,7 +56,7 @@ int main(int argc, char ** argv){
std::cout << ">> It is only interesting to wath the code to understand\n";
std::cout << ">> how to use the Octree\n";
//////////////////////////////////////////////////////////////
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000));
FTic counter;
FRandomLoader<FReal> loader(NbPart, 1, FPoint<FReal>(0.5,0.5,0.5), 1);
......
......@@ -60,7 +60,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 9);
const int NbSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
FTic counterTime;
......
......@@ -58,7 +58,7 @@ int main(int argc, char ** argv){
std::cout << ">> It is only interesting to wath the code to understand\n";
std::cout << ">> how to use the Octree\n";
//////////////////////////////////////////////////////////////
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000));
FTic counter;
FRandomLoader<FReal> loader(NbPart, 1, FPoint<FReal>(0.5,0.5,0.5), 1);
......
......@@ -64,7 +64,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 7);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
FTic counter;
......
......@@ -66,7 +66,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 7);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 2000000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(2000000));
FTic counter;
......
......@@ -99,7 +99,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 7);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20000);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20000));
FTic counter;
......
......@@ -67,7 +67,7 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 7);
const int SizeSubLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart_Source = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 200000);
const FSize NbPart_Source = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(200000));
const int NbPart_Target = 10000;
FTic counter;
......
......@@ -91,7 +91,7 @@ int main(int argc, char* argv[]){
//#define LOAD_FILE
#ifndef LOAD_FILE
const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
FRandomLoader<FReal> loader(NbParticles, 1.0, FPoint<FReal>(0,0,0), 0);
#else
// Load the particles
......
......@@ -72,7 +72,7 @@ int main(int argc, char* argv[]){
FMpi mpiComm(argc, argv);
// Get params
const int NbLevels = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
const int groupSize = FParameters::getValue(argc,argv,LocalOptionBlocSize.options, 250);
const int totalNbParticles = (NbParticles*mpiComm.global().processCount());
......
......@@ -106,7 +106,7 @@ int main(int argc, char* argv[]){
//#define LOAD_FILE
#ifndef LOAD_FILE
const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
FRandomLoader<FReal> loader(NbParticles, 1.0, FPoint<FReal>(0,0,0), 0);
#else
// Load the particles
......
......@@ -96,7 +96,7 @@ int main(int argc, char* argv[]){
//#define LOAD_FILE
#ifndef LOAD_FILE
const int NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const FSize NbParticles = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
FRandomLoader<FReal> loader(NbParticles, 1.0, FPoint<FReal>(0,0,0), 0);
#else
// Load the particles
......
......@@ -105,7 +105,7 @@ struct TempMainStruct{
const int TreeHeight = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeHeight.options, 5);
const int SubTreeHeight = FParameters::getValue(argc,argv,FParameterDefinitions::OctreeSubHeight.options, 3);
const int NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, 20);
const FSize NbPart = FParameters::getValue(argc,argv,FParameterDefinitions::NbParticles.options, FSize(20));
const std::string filename = FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "output");
const int nbTargets = FParameters::getValue(argc,argv,LocalOptionPoints.options, 100);
......
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