|
STARS-H
Software for Testing Accuracy, Reliability and Scalability of Hierarchical computations
|
Template for particle-to-particle interactions. More...
Data Structures | |
| struct | starsh_particles |
| Structure for general N-body problems. More... | |
Typedefs | |
| typedef struct starsh_particles | STARSH_particles |
| Structure for general N-body problems. | |
Enumerations | |
| enum | STARSH_PARTICLES_PLACEMENT { STARSH_PARTICLES_RAND = 1, STARSH_PARTICLES_UNIFORM = 3, STARSH_PARTICLES_RANDGRID = 4, STARSH_PARTICLES_QUASIUNIFORM1 = 6, STARSH_PARTICLES_QUASIUNIFORM2 = 7, STARSH_PARTICLES_OBSOLETE1 = -1, STARSH_PARTICLES_OBSOLETE2 = -2, STARSH_PARTICLES_OBSOLETE3 = -3, STARSH_PARTICLES_OBSOLETE4 = -4 } |
| Distribution of particles for starsh_particles_generate(). More... | |
Functions | |
| int | starsh_particles_new (STARSH_particles **data, STARSH_int count, int ndim) |
| Allocate memory for STARSH_particles object. More... | |
| int | starsh_particles_init (STARSH_particles **data, STARSH_int count, int ndim, double *point) |
| Initialize STARSH_particles object by given data. More... | |
| void | starsh_particles_free (STARSH_particles *data) |
| Free memory of STARSH_particles object. More... | |
| int | starsh_particles_generate (STARSH_particles **data, STARSH_int count, int ndim, enum STARSH_PARTICLES_PLACEMENT ptype) |
| Generate STARSH_particles with required distribution. More... | |
| int | starsh_particles_generate_rand (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate particles with [0,1] uniform random distribution. More... | |
| int | starsh_particles_generate_randgrid (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a grid on randomly distributed grid coordinates. More... | |
| int | starsh_particles_generate_uniform (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles. More... | |
| int | starsh_particles_generate_quasiuniform1 (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles with random shift of each particle. More... | |
| int | starsh_particles_generate_quasiuniform2 (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles with random shift of grid coordinates. More... | |
| int | starsh_particles_generate_obsolete1 (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles with random shift of each particle. More... | |
| int | starsh_particles_generate_obsolete2 (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles with random shift of grid coordinates. More... | |
| int | starsh_particles_generate_obsolete3 (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles with random shift of each particle. More... | |
| int | starsh_particles_generate_obsolete4 (STARSH_particles **data, STARSH_int count, int ndim) |
| Generate a uniform grid of particles with random shift of each particle. More... | |
| int | starsh_particles_read_from_file (STARSH_particles **data, const char *fname, const enum STARSH_FILE_TYPE ftype) |
| Read STARSH_particles object from file. More... | |
| int | starsh_particles_read_from_file_pointer (STARSH_particles **data, FILE *fp, const enum STARSH_FILE_TYPE ftype) |
| Read STARSH_particles object from file pointer. More... | |
| int | starsh_particles_read_from_file_pointer_ascii (STARSH_particles **data, FILE *fp) |
| Read STARSH_particles object from file pointer in ASCII format. More... | |
| int | starsh_particles_read_from_file_pointer_binary (STARSH_particles **data, FILE *fp) |
| Read STARSH_particles object from file pointer in binary format. More... | |
| int | starsh_particles_write_to_file (const STARSH_particles *data, const char *fname, const enum STARSH_FILE_TYPE ftype) |
| Write STARSH_particles object to file. More... | |
| int | starsh_particles_write_to_file_pointer (const STARSH_particles *data, FILE *fp, const enum STARSH_FILE_TYPE ftype) |
| Write STARSH_particles object to file pointer. More... | |
| int | starsh_particles_write_to_file_pointer_ascii (const STARSH_particles *data, FILE *fp) |
| Write STARSH_particles object to file pointer in ASCII format. More... | |
| int | starsh_particles_write_to_file_pointer_binary (const STARSH_particles *data, FILE *fp) |
| Write STARSH_particles object to file pointer in binary format. More... | |
| int | starsh_particles_zsort_inplace (STARSH_particles *data) |
| Sort particles in Z-order (Morton order). More... | |
Template for particle-to-particle interactions.
STARSH_particles holds all the necessary data, which can be generated in different ways by starsh_particles_generate(), read from file by starsh_particles_read_from_file(), set as needed after allocating memory by starsh_particles_new() or set by given coordinates by starsh_particles_init().
Distribution of particles for starsh_particles_generate().
| void starsh_particles_free | ( | STARSH_particles * | data | ) |
Free memory of STARSH_particles object.
| int starsh_particles_generate | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim, | ||
| enum STARSH_PARTICLES_PLACEMENT | ptype | ||
| ) |
Generate STARSH_particles with required distribution.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| [in] | ptype | How to place particles. For more info look at STARSH_PARTICLES_PLACEMENT. |
| int starsh_particles_generate_obsolete1 | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles with random shift of each particle.
Similar to starsh_particles_generate_quasiuniform1(), but works only for 1D, 2D and 3D. Parameter count must be square of integer if ndim=2 and cube if integer if ndim=3.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_obsolete2 | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles with random shift of grid coordinates.
Similar to starsh_particles_generate_quasiuniform2(), but works only for 1D, 2D and 3D. Parameter count must be square of integer if ndim=2 and cube if integer if ndim=3.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_obsolete3 | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles with random shift of each particle.
Similar to starsh_particles_generate_quasiuniform1(), but works only for 1D, 2D and 3D. Number of locations count/2 must be square of integer if ndim=2 and cube if integer ifndim`=3.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_obsolete4 | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles with random shift of each particle.
Similar to starsh_particles_generate_quasiuniform1(), but works only for 1D, 2D and 3D. Number of locations count/2 must be square of integer if ndim=2 and cube if integer if ndim=3.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_quasiuniform1 | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles with random shift of each particle.
Minimal grid, containing all of count particles, is selected.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_quasiuniform2 | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles with random shift of grid coordinates.
Minimal grid, containing all of count particles, is selected.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_rand | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate particles with [0,1] uniform random distribution.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_randgrid | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a grid on randomly distributed grid coordinates.
Minimal grid, containing all count particles, is selected.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_generate_uniform | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Generate a uniform grid of particles.
Minimal grid, containing all of count particles, is selected.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Amount of particles to generate. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_init | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim, | ||
| double * | point | ||
| ) |
Initialize STARSH_particles object by given data.
Array point should be stored in a special way: x_1 x_2 ... x_count y_1 y_2 ... y_count z_1 z_2 .... This function does not allocate memory for coordinates and uses provided pointer point. Do not free memory of point until you finish using returned STARSH_particles object. Do not forget to sort particles by starsh_particles_zsort_inplace() to take advantage of low-rank submatrices.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Number of particles. |
| [in] | ndim | Dimensionality of space. |
| [in] | point | Pointer to array of coordinates of particles. |
| int starsh_particles_new | ( | STARSH_particles ** | data, |
| STARSH_int | count, | ||
| int | ndim | ||
| ) |
Allocate memory for STARSH_particles object.
Array (*data)->point is stored in a special way: x_1 x_2 ... x_count y_1 y_2 ... y_count z_1 z_2 .... This functions only allocates memory for particles without setting coordinates to any value. Do not forget to sort particles by starsh_particles_zsort_inplace() to take advantage of low-rank submatrices.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | count | Number of particles. |
| [in] | ndim | Dimensionality of space. |
| int starsh_particles_read_from_file | ( | STARSH_particles ** | data, |
| const char * | fname, | ||
| const enum STARSH_FILE_TYPE | ftype | ||
| ) |
Read STARSH_particles object from file.
| [out] | data | Address to pointer to STARSH_particles object. |
| [in] | fname | Name of file to read from. |
| [in] | ftype | File type. Look at STARSH_FILE_TYPE for more info. |
| int starsh_particles_read_from_file_pointer | ( | STARSH_particles ** | data, |
| FILE * | fp, | ||
| const enum STARSH_FILE_TYPE | ftype | ||
| ) |
Read STARSH_particles object from file pointer.
After finishing, file pointer fp will still be open.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | fp | File pointer to read from, must be open before reading. |
| [in] | ftype | File type. Look at STARSH_FILE_TYPE for more info. |
| int starsh_particles_read_from_file_pointer_ascii | ( | STARSH_particles ** | data, |
| FILE * | fp | ||
| ) |
Read STARSH_particles object from file pointer in ASCII format.
After finishing, file pointer fp will still be open.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | fp | File pointer to read from, must be open before reading. |
| int starsh_particles_read_from_file_pointer_binary | ( | STARSH_particles ** | data, |
| FILE * | fp | ||
| ) |
Read STARSH_particles object from file pointer in binary format.
After finishing, file pointer fp will still be open.
| [out] | data | Address of pointer to STARSH_particles object. |
| [in] | fp | File pointer to read from, must be open before reading. |
| int starsh_particles_write_to_file | ( | const STARSH_particles * | data, |
| const char * | fname, | ||
| const enum STARSH_FILE_TYPE | ftype | ||
| ) |
Write STARSH_particles object to file.
| [out] | data | Pointer to STARSH_particles object. |
| [in] | fname | Name of file to write to. |
| [in] | ftype | File type. Look at STARSH_FILE_TYPE for more info. |
| int starsh_particles_write_to_file_pointer | ( | const STARSH_particles * | data, |
| FILE * | fp, | ||
| const enum STARSH_FILE_TYPE | ftype | ||
| ) |
Write STARSH_particles object to file pointer.
After finishing, file pointer fp will still be open.
| [out] | data | Pointer to STARSH_particles object. |
| [in] | fp | File pointer to write to, must be open before writing. |
| [in] | ftype | File type. Look at STARSH_FILE_TYPE for more info. |
| int starsh_particles_write_to_file_pointer_ascii | ( | const STARSH_particles * | data, |
| FILE * | fp | ||
| ) |
Write STARSH_particles object to file pointer in ASCII format.
After finishing, file pointer fp will still be open.
| [out] | data | Pointer to STARSH_particles object. |
| [in] | fp | File pointer to write to, must be open before writing. |
| int starsh_particles_write_to_file_pointer_binary | ( | const STARSH_particles * | data, |
| FILE * | fp | ||
| ) |
Write STARSH_particles object to file pointer in binary format.
After finishing, file pointer fp will still be open.
| [out] | data | Pointer to STARSH_particles object. |
| [in] | fp | File pointer to write to, must be open before writing. |
| int starsh_particles_zsort_inplace | ( | STARSH_particles * | data | ) |
Sort particles in Z-order (Morton order).
This function must be used after initializing STARSH_particles with your own data by starsh_particles_init() or starsh_particles_new().