mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
47 lines
892 B
C++
47 lines
892 B
C++
#include <iostream>
|
|
#include <cstdlib>
|
|
#include <CosmoTool/fortran.hpp>
|
|
|
|
using namespace CosmoTool;
|
|
using namespace std;
|
|
|
|
#define LX 1.0
|
|
#define LY 1.0
|
|
#define LZ 1.0
|
|
|
|
#define NUMPART (16*16*16)
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
UnformattedWrite f("particles.bin");
|
|
|
|
f.beginCheckpoint();
|
|
f.writeInt32(NUMPART);
|
|
f.endCheckpoint();
|
|
|
|
cout << "Writing X components..." << endl;
|
|
f.beginCheckpoint();
|
|
for (uint32_t i = 0; i < NUMPART; i++)
|
|
{
|
|
f.writeReal32(drand48()*LX);
|
|
}
|
|
f.endCheckpoint();
|
|
|
|
cout << "Writing Y components..." << endl;
|
|
f.beginCheckpoint();
|
|
for (uint32_t i = 0; i < NUMPART; i++)
|
|
{
|
|
f.writeReal32(drand48()*LY);
|
|
}
|
|
f.endCheckpoint();
|
|
|
|
cout << "Writing Z components..." << endl;
|
|
f.beginCheckpoint();
|
|
for (uint32_t i = 0; i < NUMPART; i++)
|
|
{
|
|
f.writeReal32(drand48()*LZ);
|
|
}
|
|
f.endCheckpoint();
|
|
|
|
return 0;
|
|
}
|