Commit 12566236 authored by berenger-bramas's avatar berenger-bramas

Add basic particules file generator and correct comments.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@5 2616d619-271b-44dc-8df4-d4a8f33a7222
parent fd0ce4e5
......@@ -9,7 +9,7 @@
* @class
* Please read the license
*
* Propose basic math function or indirection
* Propose basic math functions or indirections
*/
struct FMath{
/** To get absolute value */
......
......@@ -36,6 +36,7 @@ class TestCell{
int main(int , char ** ){
// we store all particules to be able to dealloc
FList<FBasicParticule*> particules;
// Use testLoaderCreate.exe to create this file
const char* const filename = "testLoader.basic.temp";
// open basic particules loader
......
// /!\ Please, you must read the license at the bottom of this page
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// This file can generate basic particules files to load with basic loader
// g++ testLoaderCreate.cpp -o testLoaderCreate.exe
int main(int , char ** ){
// Nb of particules
const long NbParticules = 200000;
// Center of the box
const double XCenter = 0.5;
const double YCenter = 0.5;
const double ZCenter = 0.5;
// Box width
const double BoxWidth = 1.0;
// Output file please let .temp extension
const char * const Output = "testLoader.basic.temp";
// Create file
std::ofstream myfile;
myfile.open (Output);
if(!myfile.is_open()){
std::cout << "Cannot create " << Output << "\n";
return 1;
}
std::cout << "Working...\n";
// System properties
myfile << NbParticules << " " << BoxWidth << " " << XCenter << " " << YCenter << " " << ZCenter;
// Generate particules
for( long idx = 0 ; idx < NbParticules ; ++idx ){
const double px = ((double(rand())/RAND_MAX) * BoxWidth) + XCenter - (BoxWidth/2);
const double py = ((double(rand())/RAND_MAX) * BoxWidth) + YCenter - (BoxWidth/2);
const double pz = ((double(rand())/RAND_MAX) * BoxWidth) + ZCenter - (BoxWidth/2);
myfile << " \n" << px << " " << py << " " << pz;
}
myfile.close();
std::cout << "Done\n";
return 0;
}
// [--LICENSE--]
......@@ -23,7 +23,7 @@ int main(void){\
* This class is used to make simple unit test cases
*
* Please refer to testUTest.cpp to see an example
* @warning Create a derived that implement SetTests() and use TestClass() macro
* @warning Create a derived class that implement SetTests() and use TestClass() macro
*/
template <class TestClass>
class FUTester{
......
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