<commit_before>/*
 * io.c
 *
 *  Created on: Aug 3, 2008
 *      Author: dcoates
 */

// Shared input and output routines

#include "io.h"
#include "tiff.h"

#include <assert.h>
#include <float.h>	// FLT_MAX/MIN
#include <math.h>
#include <string.h>     // memcpy

static int pv_getopt_int(int argc, char * argv[], char * opt, int *   iVal);
static int pv_getopt_str(int argc, char * argv[], char * opt, char ** sVal);
static int pv_getopt_unsigned_long(int argc, char * argv[], char * opt, unsigned long * ulVal);

void usage()
{
   printf("\nUsage:\n");
   printf(" -p <parameters filename>\n");
   printf(" [-n <number of timesteps>]\n");
   printf(" [-o <output directory>\n");
   printf(" [-i <input image filename>]\n");
}

/**
 * @argc
 * @argv
 * @input_file
 * @param_file
 * @n_time_steps
 * @device
 */
int parse_options(int argc, char * argv[], char ** output_path, char ** input_file,
                  char ** param_file, int * n_time_steps, int * opencl_device, unsigned long * random_seed)
{
   if (argc < 2) {
      usage();
      return -1;
   }

   *n_time_steps = 1;

   pv_getopt_int(argc, argv, "-n", n_time_steps);
   pv_getopt_int(argc, argv, "-d", opencl_device);
   pv_getopt_str(argc, argv, "-i", input_file);
   pv_getopt_str(argc, argv, "-o", output_path);<commit_msg>Added -s and -d options to message output by usage()<commit_after>/*
 * io.c
 *
 *  Created on: Aug 3, 2008
 *      Author: dcoates
 */

// Shared input and output routines

#include "io.h"
#include "tiff.h"

#include <assert.h>
#include <float.h>	// FLT_MAX/MIN
#include <math.h>
#include <string.h>     // memcpy

static int pv_getopt_int(int argc, char * argv[], char * opt, int *   iVal);
static int pv_getopt_str(int argc, char * argv[], char * opt, char ** sVal);
static int pv_getopt_unsigned_long(int argc, char * argv[], char * opt, unsigned long * ulVal);

void usage()
{
   printf("\nUsage:\n");
   printf(" -p <parameters filename>\n");
   printf(" [-n <number of timesteps>]\n");
   printf(" [-o <output directory>\n");
   printf(" [-i <input image filename>]\n");
   printf(" [-s <random number generator seed>]\n");
   printf(" [-d <OpenCL device>]\n");
}

/**
 * @argc
 * @argv
 * @input_file
 * @param_file
 * @n_time_steps
 * @device
 */
int parse_options(int argc, char * argv[], char ** output_path, char ** input_file,
                  char ** param_file, int * n_time_steps, int * opencl_device, unsigned long * random_seed)
{
   if (argc < 2) {
      usage();
      return -1;
   }

   *n_time_steps = 1;

   pv_getopt_int(argc, argv, "-n", n_time_steps);
   pv_getopt_int(argc, argv, "-d", opencl_device);
   pv_getopt_str(argc, argv, "-i", input_file);
   pv_getopt_str(argc, argv, "-o", output_path);
{'fraction_non_alphanumeric': 0.17180616740088106, 'fraction_numerical': 0.005873715124816446, 'mean_word_length': 3.353035143769968, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3974447', 'n_tokens_mistral': 1022, 'n_tokens_neox': 1011, 'n_words': 274}