/*

g++ -o ga-example-001 -Wall -ansi -pedantic -std=c++11 -O3 ga-example-001.cc

./ga-example-001

 */



#include <iostream>
#include <fstream>

#include "ga.hpp"

int main(int argc, char* argv[]) {
  double width = 3;
  double height = 2;
  
  // This builds a block, and reads its dimensions.
  ga::Block block(width,height);
  width = block.first; 
  height = block.second;
  
  // Let us define the set of blocks that we will have to put in the
  // container.
  ga::Blocks blocks;   // This is a vector.
  ga::make(30,blocks); // This sets up 30 random blocks.
  
  std::ofstream output_file;
  output_file.open("test.blk");
  if(!output_file)
    std::cerr << "Cannot open \"test.blk\"." << std::endl;
  output_file << blocks; // We save the blocks.
  output_file.close();
  
  std::ifstream input_file;
  input_file.open("test.blk");
  if(!input_file)
    std::cerr << "Cannot open \"test.blk\"." << std::endl;
  input_file >> blocks; // We load the blocks.
  input_file.close();

  return 0;
}