Skip to content

Commit

Permalink
Show non-LZ4 saving in example
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Nov 3, 2023
1 parent 3511ac8 commit 23f130d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions examples/cpp/fill-grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cstddef>
#include <iostream>
#include <random>
#include <string>

double int_photo(double s, double t, double u) {
double alpha0 = 1.0 / 137.03599911;
Expand Down Expand Up @@ -212,15 +213,21 @@ int main() {
// Fill the grid with phase-space points
fill_grid(grid, 10000000);

// ---
// Write the grid to disk - with `.lz4` suffix the grid is automatically LZ4 compressed
char const* filename =
std::string filename =
#ifdef USE_CUSTOM_GRID_PARAMETERS
"drell-yan-rap-ll-custom-grid.pineappl.lz4";
"drell-yan-rap-ll-custom-grid.pineappl";
#else
"drell-yan-rap-ll.pineappl.lz4";
"drell-yan-rap-ll.pineappl";
#endif
pineappl_grid_write(grid, filename);

// ---
// Write the grid to disk - the filename can be anything ...
pineappl_grid_write(grid, filename.c_str());

// but if it has an `.lz4` suffix ...
filename.append(".lz4");
// the grid is automatically LZ4 compressed
pineappl_grid_write(grid, filename.c_str());

// destroy the object
pineappl_grid_delete(grid);
Expand Down

0 comments on commit 23f130d

Please sign in to comment.