Nous avons procédé ce jeudi matin 08 avril 2021 à une MAJ de sécurité urgente. Nous sommes passé de la version 13.9.3 à la version 13.9.5 les releases notes correspondantes sont ici:
https://about.gitlab.com/releases/2021/03/17/security-release-gitlab-13-9-4-released/
https://about.gitlab.com/releases/2021/03/31/security-release-gitlab-13-10-1-released/

testLoaderFMACreate.cpp 2.53 KB
Newer Older
1 2 3 4 5 6 7 8 9
// /!\ 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>

10
#include "../Src/Utils/FGlobal.hpp"
berenger-bramas's avatar
berenger-bramas committed
11

12
// This file can generate basic particles files in the FMA format
13 14
// g++ testLoaderFMACreate.cpp -o testLoaderFMACreate.exe

15 16
int main(int argc, char ** argv){
    ///////////////////////What we do/////////////////////////////
17
    std::cout << ">> This executable can create a FMA particles files\n";
18 19 20
    std::cout << ">> You can pass a filename in parameter else the program will use\n";
    std::cout << ">> a default filename.\n";
    std::cout << ">> The format of the file is : \n";
21
    std::cout << ">> [number of particles] \n";
22 23 24 25
    std::cout << ">> [boxe width] [boxe x center] [boxe y center] [boxe z center]\n";
    std::cout << ">> [x] [y] [z] [physical value]...\n";
    //////////////////////////////////////////////////////////////

26
    // Nb of particles
27
    const long NbParticles = 50000;
28 29

    // Center of the box
berenger-bramas's avatar
berenger-bramas committed
30 31 32 33
    const FReal XCenter = 0.5;
    const FReal YCenter = 0.5;
    const FReal ZCenter = 0.5;

34
    // Box width
berenger-bramas's avatar
berenger-bramas committed
35
    const FReal BoxWidth = 1.0/2;
36
    // Output file please let .temp extension
37 38 39 40 41 42 43 44 45 46 47 48 49
    const char * const defaultFilename = "testLoaderFMA.fma";

    const char* Output;

    if(argc == 1){
        std::cout << "You have to give a filename in argument.\n";
        std::cout << "The program will create one with a default name : " << defaultFilename << "\n";
        Output = defaultFilename;
    }
    else{
        Output = argv[1];
        std::cout << "Creating : " << Output << "\n";
    }
50 51 52 53 54 55 56 57 58

    // Create file
    std::ofstream myfile;
    myfile.open (Output);

    if(!myfile.is_open()){
        std::cout << "Cannot create " << Output << "\n";
        return 1;
    }
berenger-bramas's avatar
berenger-bramas committed
59

60
    std::cout << "Generating " << NbParticles << " in " << Output << "\n";
61 62 63
    std::cout << "Working...\n";

    // System properties
64
    myfile << NbParticles << "\n";
65 66
    myfile << BoxWidth << "\t" << XCenter << "\t" << YCenter << "\t" << ZCenter;

67 68
    // Generate particles
    for( long idx = 0 ; idx < NbParticles ; ++idx ){
berenger-bramas's avatar
berenger-bramas committed
69 70 71
        const FReal px = ((FReal(rand())/RAND_MAX) * BoxWidth * 2) + XCenter - BoxWidth;
        const FReal py = ((FReal(rand())/RAND_MAX) * BoxWidth * 2) + YCenter - BoxWidth;
        const FReal pz = ((FReal(rand())/RAND_MAX) * BoxWidth * 2) + ZCenter - BoxWidth;
72 73 74 75 76 77 78 79 80 81 82 83 84

        myfile << "\n" << px << "\t" << py << "\t" <<  pz << "\t" << (0.01);
    }

    myfile.close();

    std::cout << "Done\n";

    return 0;
}


// [--LICENSE--]