Local Updates

This commit is contained in:
Guilhem Lavaux 2010-09-22 15:19:18 -05:00
parent bb7ec14282
commit 3088bb5733
4 changed files with 115 additions and 97 deletions

View file

@ -1,5 +1,5 @@
/*
File autogenerated by gengetopt version 2.22.2
File autogenerated by gengetopt version 2.22
generated with the following command:
gengetopt -i buildObservedVoids.ggo -f buildObservedVoids_conf -a buildObservedVoids_info -F buildObservedVoids_conf -C
@ -17,10 +17,6 @@
#include <stdlib.h>
#include <string.h>
#ifndef FIX_UNUSED
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
#endif
#include "getopt.h"
#include "buildObservedVoids_conf.h"
@ -39,12 +35,13 @@ const char *buildObservedVoids_info_help[] = {
" -v, --zonevoid=STRING Void/zone bind file (jozov generated)",
" -m, --minProba=DOUBLE Minimal probability to accept (default=`0.0')",
" --densityThreshold=DOUBLE Density threshold to consider a stable void \n (default=`-0.8')",
" -b, --ramsesDir=STRING Ramses base output directory",
" -r, --ramsesId=INT Ramses output id",
" -f, --configFile=STRING Configuration file",
" -o, --output=STRING Output file (default=`void_info.txt')",
" -g, --gridOutput=STRING 3d grid output of voids \n (default=`all_voids.nc')",
" -q, --quiet Quiet output (default=off)",
" --dumpVoids=STRING Dump the particles in void in a file",
" --ramsesBase=STRING Base directory for ramses",
" --ramsesId=INT Ramses snapshot id",
0
};
@ -104,18 +101,18 @@ void clear_given (struct buildObservedVoids_info *args_info)
args_info->zonevoid_given = 0 ;
args_info->minProba_given = 0 ;
args_info->densityThreshold_given = 0 ;
args_info->ramsesDir_given = 0 ;
args_info->ramsesId_given = 0 ;
args_info->configFile_given = 0 ;
args_info->output_given = 0 ;
args_info->gridOutput_given = 0 ;
args_info->quiet_given = 0 ;
args_info->dumpVoids_given = 0 ;
args_info->ramsesBase_given = 0 ;
args_info->ramsesId_given = 0 ;
}
static
void clear_args (struct buildObservedVoids_info *args_info)
{
FIX_UNUSED (args_info);
args_info->desc_arg = NULL;
args_info->desc_orig = NULL;
args_info->partzone_arg = NULL;
@ -126,9 +123,6 @@ void clear_args (struct buildObservedVoids_info *args_info)
args_info->minProba_orig = NULL;
args_info->densityThreshold_arg = -0.8;
args_info->densityThreshold_orig = NULL;
args_info->ramsesDir_arg = NULL;
args_info->ramsesDir_orig = NULL;
args_info->ramsesId_orig = NULL;
args_info->configFile_arg = NULL;
args_info->configFile_orig = NULL;
args_info->output_arg = gengetopt_strdup ("void_info.txt");
@ -136,6 +130,11 @@ void clear_args (struct buildObservedVoids_info *args_info)
args_info->gridOutput_arg = gengetopt_strdup ("all_voids.nc");
args_info->gridOutput_orig = NULL;
args_info->quiet_flag = 0;
args_info->dumpVoids_arg = NULL;
args_info->dumpVoids_orig = NULL;
args_info->ramsesBase_arg = NULL;
args_info->ramsesBase_orig = NULL;
args_info->ramsesId_orig = NULL;
}
@ -151,21 +150,20 @@ void init_args_info(struct buildObservedVoids_info *args_info)
args_info->zonevoid_help = buildObservedVoids_info_help[4] ;
args_info->minProba_help = buildObservedVoids_info_help[5] ;
args_info->densityThreshold_help = buildObservedVoids_info_help[6] ;
args_info->ramsesDir_help = buildObservedVoids_info_help[7] ;
args_info->ramsesId_help = buildObservedVoids_info_help[8] ;
args_info->configFile_help = buildObservedVoids_info_help[9] ;
args_info->output_help = buildObservedVoids_info_help[10] ;
args_info->gridOutput_help = buildObservedVoids_info_help[11] ;
args_info->quiet_help = buildObservedVoids_info_help[12] ;
args_info->configFile_help = buildObservedVoids_info_help[7] ;
args_info->output_help = buildObservedVoids_info_help[8] ;
args_info->gridOutput_help = buildObservedVoids_info_help[9] ;
args_info->quiet_help = buildObservedVoids_info_help[10] ;
args_info->dumpVoids_help = buildObservedVoids_info_help[11] ;
args_info->ramsesBase_help = buildObservedVoids_info_help[12] ;
args_info->ramsesId_help = buildObservedVoids_info_help[13] ;
}
void
buildObservedVoids_conf_print_version (void)
{
printf ("%s %s\n",
(strlen(BUILDOBSERVEDVOIDS_CONF_PACKAGE_NAME) ? BUILDOBSERVEDVOIDS_CONF_PACKAGE_NAME : BUILDOBSERVEDVOIDS_CONF_PACKAGE),
BUILDOBSERVEDVOIDS_CONF_VERSION);
printf ("%s %s\n", BUILDOBSERVEDVOIDS_CONF_PACKAGE, BUILDOBSERVEDVOIDS_CONF_VERSION);
}
static void print_help_common(void) {
@ -180,7 +178,7 @@ static void print_help_common(void) {
printf("\n");
if (strlen(buildObservedVoids_info_description) > 0)
printf("%s\n\n", buildObservedVoids_info_description);
printf("%s\n", buildObservedVoids_info_description);
}
void
@ -245,15 +243,17 @@ buildObservedVoids_conf_release (struct buildObservedVoids_info *args_info)
free_string_field (&(args_info->zonevoid_orig));
free_string_field (&(args_info->minProba_orig));
free_string_field (&(args_info->densityThreshold_orig));
free_string_field (&(args_info->ramsesDir_arg));
free_string_field (&(args_info->ramsesDir_orig));
free_string_field (&(args_info->ramsesId_orig));
free_string_field (&(args_info->configFile_arg));
free_string_field (&(args_info->configFile_orig));
free_string_field (&(args_info->output_arg));
free_string_field (&(args_info->output_orig));
free_string_field (&(args_info->gridOutput_arg));
free_string_field (&(args_info->gridOutput_orig));
free_string_field (&(args_info->dumpVoids_arg));
free_string_field (&(args_info->dumpVoids_orig));
free_string_field (&(args_info->ramsesBase_arg));
free_string_field (&(args_info->ramsesBase_orig));
free_string_field (&(args_info->ramsesId_orig));
@ -262,9 +262,8 @@ buildObservedVoids_conf_release (struct buildObservedVoids_info *args_info)
static void
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
{
FIX_UNUSED (values);
if (arg) {
fprintf(outfile, "%s=\"%s\"\n", opt, arg);
} else {
@ -298,10 +297,6 @@ buildObservedVoids_conf_dump(FILE *outfile, struct buildObservedVoids_info *args
write_into_file(outfile, "minProba", args_info->minProba_orig, 0);
if (args_info->densityThreshold_given)
write_into_file(outfile, "densityThreshold", args_info->densityThreshold_orig, 0);
if (args_info->ramsesDir_given)
write_into_file(outfile, "ramsesDir", args_info->ramsesDir_orig, 0);
if (args_info->ramsesId_given)
write_into_file(outfile, "ramsesId", args_info->ramsesId_orig, 0);
if (args_info->configFile_given)
write_into_file(outfile, "configFile", args_info->configFile_orig, 0);
if (args_info->output_given)
@ -310,6 +305,12 @@ buildObservedVoids_conf_dump(FILE *outfile, struct buildObservedVoids_info *args
write_into_file(outfile, "gridOutput", args_info->gridOutput_orig, 0);
if (args_info->quiet_given)
write_into_file(outfile, "quiet", 0, 0 );
if (args_info->dumpVoids_given)
write_into_file(outfile, "dumpVoids", args_info->dumpVoids_orig, 0);
if (args_info->ramsesBase_given)
write_into_file(outfile, "ramsesBase", args_info->ramsesBase_orig, 0);
if (args_info->ramsesId_given)
write_into_file(outfile, "ramsesId", args_info->ramsesId_orig, 0);
i = EXIT_SUCCESS;
@ -346,7 +347,7 @@ buildObservedVoids_conf_free (struct buildObservedVoids_info *args_info)
char *
gengetopt_strdup (const char *s)
{
char *result = 0;
char *result = NULL;
if (!s)
return result;
@ -368,7 +369,7 @@ buildObservedVoids_conf_ext (int argc, char * const *argv, struct buildObservedV
struct buildObservedVoids_conf_params *params)
{
int result;
result = buildObservedVoids_conf_internal (argc, argv, args_info, params, 0);
result = buildObservedVoids_conf_internal (argc, argv, args_info, params, NULL);
if (result == EXIT_FAILURE)
{
@ -391,7 +392,7 @@ buildObservedVoids_conf2 (int argc, char * const *argv, struct buildObservedVoid
params.check_ambiguity = 0;
params.print_errors = 1;
result = buildObservedVoids_conf_internal (argc, argv, args_info, &params, 0);
result = buildObservedVoids_conf_internal (argc, argv, args_info, &params, NULL);
if (result == EXIT_FAILURE)
{
@ -407,7 +408,7 @@ buildObservedVoids_conf_required (struct buildObservedVoids_info *args_info, con
{
int result = EXIT_SUCCESS;
if (buildObservedVoids_conf_required2(args_info, prog_name, 0) > 0)
if (buildObservedVoids_conf_required2(args_info, prog_name, NULL) > 0)
result = EXIT_FAILURE;
if (result == EXIT_FAILURE)
@ -422,7 +423,6 @@ buildObservedVoids_conf_required (struct buildObservedVoids_info *args_info, con
int
buildObservedVoids_conf_required2 (struct buildObservedVoids_info *args_info, const char *prog_name, const char *additional_error)
{
FIX_UNUSED (additional_error);
int error = 0;
/* checks for required options */
@ -474,15 +474,13 @@ static char *package_name = 0;
static
int update_arg(void *field, char **orig_field,
unsigned int *field_given, unsigned int *prev_given,
char *value, const char *possible_values[],
const char *default_value,
char *value, char *possible_values[], const char *default_value,
buildObservedVoids_conf_arg_type arg_type,
int check_ambiguity, int override,
int no_free, int multiple_option,
const char *long_opt, char short_opt,
const char *additional_error)
{
FIX_UNUSED (field);
char *stop_char = 0;
const char *val = value;
int found;
@ -504,7 +502,6 @@ int update_arg(void *field, char **orig_field,
return 1; /* failure */
}
FIX_UNUSED (default_value);
if (field_given && *field_given && ! override)
return 0;
@ -572,8 +569,7 @@ int update_arg(void *field, char **orig_field,
int
buildObservedVoids_conf_internal (
int argc, char * const *argv, struct buildObservedVoids_info *args_info,
buildObservedVoids_conf_internal (int argc, char * const *argv, struct buildObservedVoids_info *args_info,
struct buildObservedVoids_conf_params *params, const char *additional_error)
{
int c; /* Character of the parsed option. */
@ -615,16 +611,17 @@ buildObservedVoids_conf_internal (
{ "zonevoid", 1, NULL, 'v' },
{ "minProba", 1, NULL, 'm' },
{ "densityThreshold", 1, NULL, 0 },
{ "ramsesDir", 1, NULL, 'b' },
{ "ramsesId", 1, NULL, 'r' },
{ "configFile", 1, NULL, 'f' },
{ "output", 1, NULL, 'o' },
{ "gridOutput", 1, NULL, 'g' },
{ "quiet", 0, NULL, 'q' },
{ 0, 0, 0, 0 }
{ "dumpVoids", 1, NULL, 0 },
{ "ramsesBase", 1, NULL, 0 },
{ "ramsesId", 1, NULL, 0 },
{ NULL, 0, NULL, 0 }
};
c = getopt_long (argc, argv, "hVd:p:v:m:b:r:f:o:g:q", long_options, &option_index);
c = getopt_long (argc, argv, "hVd:p:v:m:f:o:g:q", long_options, &option_index);
if (c == -1) break; /* Exit from `while (1)' loop. */
@ -687,30 +684,6 @@ buildObservedVoids_conf_internal (
additional_error))
goto failure;
break;
case 'b': /* Ramses base output directory. */
if (update_arg( (void *)&(args_info->ramsesDir_arg),
&(args_info->ramsesDir_orig), &(args_info->ramsesDir_given),
&(local_args_info.ramsesDir_given), optarg, 0, 0, ARG_STRING,
check_ambiguity, override, 0, 0,
"ramsesDir", 'b',
additional_error))
goto failure;
break;
case 'r': /* Ramses output id. */
if (update_arg( (void *)&(args_info->ramsesId_arg),
&(args_info->ramsesId_orig), &(args_info->ramsesId_given),
&(local_args_info.ramsesId_given), optarg, 0, 0, ARG_INT,
check_ambiguity, override, 0, 0,
"ramsesId", 'r',
additional_error))
goto failure;
break;
case 'f': /* Configuration file. */
@ -773,6 +746,48 @@ buildObservedVoids_conf_internal (
additional_error))
goto failure;
}
/* Dump the particles in void in a file. */
else if (strcmp (long_options[option_index].name, "dumpVoids") == 0)
{
if (update_arg( (void *)&(args_info->dumpVoids_arg),
&(args_info->dumpVoids_orig), &(args_info->dumpVoids_given),
&(local_args_info.dumpVoids_given), optarg, 0, 0, ARG_STRING,
check_ambiguity, override, 0, 0,
"dumpVoids", '-',
additional_error))
goto failure;
}
/* Base directory for ramses. */
else if (strcmp (long_options[option_index].name, "ramsesBase") == 0)
{
if (update_arg( (void *)&(args_info->ramsesBase_arg),
&(args_info->ramsesBase_orig), &(args_info->ramsesBase_given),
&(local_args_info.ramsesBase_given), optarg, 0, 0, ARG_STRING,
check_ambiguity, override, 0, 0,
"ramsesBase", '-',
additional_error))
goto failure;
}
/* Ramses snapshot id. */
else if (strcmp (long_options[option_index].name, "ramsesId") == 0)
{
if (update_arg( (void *)&(args_info->ramsesId_arg),
&(args_info->ramsesId_orig), &(args_info->ramsesId_given),
&(local_args_info.ramsesId_given), optarg, 0, 0, ARG_INT,
check_ambiguity, override, 0, 0,
"ramsesId", '-',
additional_error))
goto failure;
}
break;
@ -815,7 +830,7 @@ failure:
/* 3 is for "--" and "=" */
static int
_buildObservedVoids_conf_configfile (const char *filename, int *my_argc)
_buildObservedVoids_conf_configfile (char * const filename, int *my_argc)
{
FILE* file;
char my_argv[CONFIG_FILE_LINE_BUFFER_SIZE+1];
@ -827,14 +842,14 @@ _buildObservedVoids_conf_configfile (const char *filename, int *my_argc)
size_t len, next_token;
char delimiter;
if ((file = fopen(filename, "r")) == 0)
if ((file = fopen(filename, "r")) == NULL)
{
fprintf (stderr, "%s: Error opening configuration file '%s'\n",
BUILDOBSERVEDVOIDS_CONF_PACKAGE, filename);
return EXIT_FAILURE;
}
while ((fgets(linebuf, CONFIG_FILE_LINE_SIZE, file)) != 0)
while ((fgets(linebuf, CONFIG_FILE_LINE_SIZE, file)) != NULL)
{
++line_num;
my_argv[0] = '\0';
@ -861,7 +876,7 @@ _buildObservedVoids_conf_configfile (const char *filename, int *my_argc)
if (fopt[next_token] == '\0') /* the line is over */
{
farg = 0;
farg = NULL;
equal = 0;
goto noarg;
}
@ -952,8 +967,7 @@ _buildObservedVoids_conf_configfile (const char *filename, int *my_argc)
}
int
buildObservedVoids_conf_configfile (
const char *filename,
buildObservedVoids_conf_configfile (char * const filename,
struct buildObservedVoids_info *args_info,
int override, int initialize, int check_required)
{
@ -969,7 +983,7 @@ buildObservedVoids_conf_configfile (
}
int
buildObservedVoids_conf_config_file (const char *filename,
buildObservedVoids_conf_config_file (char * const filename,
struct buildObservedVoids_info *args_info,
struct buildObservedVoids_conf_params *params)
{

View file

@ -1,6 +1,6 @@
/** @file buildObservedVoids_conf.h
* @brief The header file for the command line option parser
* generated by GNU Gengetopt version 2.22.2
* generated by GNU Gengetopt version 2.22
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
@ -20,15 +20,10 @@ extern "C" {
#endif /* __cplusplus */
#ifndef BUILDOBSERVEDVOIDS_CONF_PACKAGE
/** @brief the program name (used for printing errors) */
/** @brief the program name */
#define BUILDOBSERVEDVOIDS_CONF_PACKAGE "buildObservedVoids"
#endif
#ifndef BUILDOBSERVEDVOIDS_CONF_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
#define BUILDOBSERVEDVOIDS_CONF_PACKAGE_NAME "buildObservedVoids"
#endif
#ifndef BUILDOBSERVEDVOIDS_CONF_VERSION
/** @brief the program version */
#define BUILDOBSERVEDVOIDS_CONF_VERSION "0"
@ -54,12 +49,6 @@ struct buildObservedVoids_info
double densityThreshold_arg; /**< @brief Density threshold to consider a stable void (default='-0.8'). */
char * densityThreshold_orig; /**< @brief Density threshold to consider a stable void original value given at command line. */
const char *densityThreshold_help; /**< @brief Density threshold to consider a stable void help description. */
char * ramsesDir_arg; /**< @brief Ramses base output directory. */
char * ramsesDir_orig; /**< @brief Ramses base output directory original value given at command line. */
const char *ramsesDir_help; /**< @brief Ramses base output directory help description. */
int ramsesId_arg; /**< @brief Ramses output id. */
char * ramsesId_orig; /**< @brief Ramses output id original value given at command line. */
const char *ramsesId_help; /**< @brief Ramses output id help description. */
char * configFile_arg; /**< @brief Configuration file. */
char * configFile_orig; /**< @brief Configuration file original value given at command line. */
const char *configFile_help; /**< @brief Configuration file help description. */
@ -71,6 +60,15 @@ struct buildObservedVoids_info
const char *gridOutput_help; /**< @brief 3d grid output of voids help description. */
int quiet_flag; /**< @brief Quiet output (default=off). */
const char *quiet_help; /**< @brief Quiet output help description. */
char * dumpVoids_arg; /**< @brief Dump the particles in void in a file. */
char * dumpVoids_orig; /**< @brief Dump the particles in void in a file original value given at command line. */
const char *dumpVoids_help; /**< @brief Dump the particles in void in a file help description. */
char * ramsesBase_arg; /**< @brief Base directory for ramses. */
char * ramsesBase_orig; /**< @brief Base directory for ramses original value given at command line. */
const char *ramsesBase_help; /**< @brief Base directory for ramses help description. */
int ramsesId_arg; /**< @brief Ramses snapshot id. */
char * ramsesId_orig; /**< @brief Ramses snapshot id original value given at command line. */
const char *ramsesId_help; /**< @brief Ramses snapshot id help description. */
unsigned int help_given ; /**< @brief Whether help was given. */
unsigned int version_given ; /**< @brief Whether version was given. */
@ -79,12 +77,13 @@ struct buildObservedVoids_info
unsigned int zonevoid_given ; /**< @brief Whether zonevoid was given. */
unsigned int minProba_given ; /**< @brief Whether minProba was given. */
unsigned int densityThreshold_given ; /**< @brief Whether densityThreshold was given. */
unsigned int ramsesDir_given ; /**< @brief Whether ramsesDir was given. */
unsigned int ramsesId_given ; /**< @brief Whether ramsesId was given. */
unsigned int configFile_given ; /**< @brief Whether configFile was given. */
unsigned int output_given ; /**< @brief Whether output was given. */
unsigned int gridOutput_given ; /**< @brief Whether gridOutput was given. */
unsigned int quiet_given ; /**< @brief Whether quiet was given. */
unsigned int dumpVoids_given ; /**< @brief Whether dumpVoids was given. */
unsigned int ramsesBase_given ; /**< @brief Whether ramsesBase was given. */
unsigned int ramsesId_given ; /**< @brief Whether ramsesId was given. */
} ;
@ -207,7 +206,7 @@ void buildObservedVoids_conf_free (struct buildObservedVoids_info *args_info);
* @return 0 if everything went fine, NON 0 if an error took place
* @deprecated use buildObservedVoids_conf_config_file() instead
*/
int buildObservedVoids_conf_configfile (const char *filename,
int buildObservedVoids_conf_configfile (char * const filename,
struct buildObservedVoids_info *args_info,
int override, int initialize, int check_required);
@ -218,7 +217,7 @@ int buildObservedVoids_conf_configfile (const char *filename,
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
int buildObservedVoids_conf_config_file (const char *filename,
int buildObservedVoids_conf_config_file (char * const filename,
struct buildObservedVoids_info *args_info,
struct buildObservedVoids_conf_params *params);

View file

@ -1,6 +1,6 @@
CC= gcc
CXX= g++
CPPFLAGS=
LDFLAGS= -lCosmoTool
LDFLAGS= -L/usr/local/lib -lCosmoTool -lgsl -lgslcblas
CXXFLAGS= $(CPPFLAGS) -ggdb -O3 -ffast-math
CFLAGS= $(CPPFLAGS) -ggdb -O3 -ffast-math

View file

@ -1,6 +1,7 @@
#include "qhull_a.h"
#include "voz.h"
#define NUMCPU 2
#define DL for (d=0;d<3;d++)
#define BF 1e30
@ -16,6 +17,7 @@ int main(int argc, char *argv[]) {
int isitinbuf;
char isitinmain, d;
int numdiv;
int p;
int nvp, nvpall, nvpbuf, nvpmin, nvpmax, nvpbufmin, nvpbufmax; /* yes, the insurance */
float width, width2, totwidth, totwidth2, bf, s, g;
float border, boxsize;
@ -135,11 +137,14 @@ int main(int argc, char *argv[]) {
exit(0);
}
fprintf(scr,"#!/bin/bash -f\n");
p = 0;
for (b[0]=0;b[0]<numdiv; b[0]++) {
for (b[1] = 0; b[1] < numdiv; b[1]++) {
for (b[2] = 0; b[2] < numdiv; b[2]++) {
fprintf(scr,"./voz1b1 %s %f %f %s %d %d %d %d\n",
fprintf(scr,"./voz1b1 %s %f %f %s %d %d %d %d &\n",
posfile,border,boxsize,suffix,numdiv,b[0],b[1],b[2]);
p++;
if ((p == NUMCPU)) { fprintf(scr, "wait\n"); p = 0; }
}
}
}