Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

system.c File Reference

contains miscellaneous routines, e.g. elapsed time measurements More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <signal.h>
#include <gsl/gsl_rng.h>
#include <mpi.h>
#include "allvars.h"
#include "proto.h"

Go to the source code of this file.

Functions

double get_random_number (int id)
void set_random_numbers (void)
double second (void)
double timediff (double t0, double t1)
double dmax (double x, double y)
double dmin (double x, double y)
int imax (int x, int y)
int imin (int x, int y)


Detailed Description

contains miscellaneous routines, e.g. elapsed time measurements

Definition in file system.c.


Function Documentation

double dmax double  x,
double  y
 

returns the maximum of two double

Definition at line 95 of file system.c.

Referenced by density(), domain_findSplit(), domain_shiftSplit(), fill_write_buffer(), and read_ic().

double dmin double  x,
double  y
 

returns the minimum of two double

Definition at line 105 of file system.c.

Referenced by hydro_evaluate().

double get_random_number int  id  ) 
 

This routine returns a random number taken from a table of random numbers, which is refilled every timestep. This method is used to allow random number application to particles independent of the number of processors used, and independent of the particular order the particles have. In order to work properly, the particle IDs should be set properly to unique integer values.

< gives the length of a table with random numbers, refreshed at every timestep. This is used to allow application of random numbers to a specific particle in a way that is independent of the number of processors used.

Definition at line 29 of file system.c.

References RndTable.

Referenced by advance_and_find_timesteps(), force_treebuild_single(), and gravity_forcetest().

int imax int  x,
int  y
 

returns the maximum of two integers

Definition at line 115 of file system.c.

Referenced by hydro_evaluate(), and pm_init_periodic_allocate().

int imin int  x,
int  y
 

returns the minimum of two integers

Definition at line 125 of file system.c.

Referenced by domain_findExchangeNumbers().

double second void   ) 
 

returns the number of cpu-ticks in seconds that have elapsed, or the wall-clock time obtained with MPI_Wtime().

Definition at line 53 of file system.c.

Referenced by advance_and_find_timesteps(), compute_accelerations(), compute_potential(), density(), domain_Decomposition(), gravity_forcetest(), gravity_tree(), hydro_force(), main(), move_particles(), run(), and savepositions().

void set_random_numbers void   ) 
 

This routine fills the random number table.

< gives the length of a table with random numbers, refreshed at every timestep. This is used to allow application of random numbers to a specific particle in a way that is independent of the number of processors used.

Definition at line 39 of file system.c.

References RndTable.

Referenced by begrun().

double timediff double  t0,
double  t1
 

returns the time difference between two measurements obtained with second(). The routine takes care of the possible overflow of the tick counter on 32bit systems, but depending on the system, this may not always work properly. Similarly, in some MPI implementations, the MPI_Wtime() function may also overflow, in which case a negative time difference would be returned. The routine returns instead a time difference equal to 0.

Definition at line 74 of file system.c.

References pow().

Referenced by advance_and_find_timesteps(), compute_accelerations(), compute_potential(), density(), domain_Decomposition(), gravity_forcetest(), gravity_tree(), hydro_force(), main(), move_particles(), run(), and savepositions().


Generated on Sun May 22 17:33:30 2005 for GADGET-2 by  doxygen 1.3.9.1