|
mdcore
0.1.5
|
#include <stdlib.h>#include <stdio.h>#include <pthread.h>#include <string.h>#include <math.h>#include "errs.h"#include "fptype.h"#include "part.h"#include "cell.h"Defines | |
| #define | align_ceil(v) (((v) + (cell_partalign-1) ) & ~(cell_partalign-1)) |
| #define | error(id) ( cell_err = errs_register( id , cell_err_msg[-(id)] , __LINE__ , __FUNCTION__ , __FILE__ ) ) |
Functions | |
| int | cell_flush (struct cell *c, struct part **partlist, struct cell **celllist) |
| Flush all the parts from a cell. | |
| int | cell_load (struct cell *c, struct part *parts, int nr_parts, struct part **partlist, struct cell **celllist) |
| Load a block of particles to the cell. | |
| int | cell_welcome (struct cell *c, struct part **partlist) |
| Move particles from the incomming buffer to the cell. | |
| struct part * | cell_add_incomming (struct cell *c, struct part *p) |
| Add a particle to the incomming array of a cell. | |
| int | cell_add_incomming_multiple (struct cell *c, struct part *p, int count) |
| Add one or more particles to the incomming array of a cell. | |
| struct part * | cell_add (struct cell *c, struct part *p, struct part **partlist) |
| Add a particle to a cell. | |
| int | cell_init (struct cell *c, int *loc, double *origin, double *dim) |
| Initialize the given cell. | |
Variables | |
| char * | cell_err_msg [] |
| const char | cell_sortlistID [27] |
| const FPTYPE | cell_shift [13 *3] |
| const char | cell_flip [27] |
| int | cell_err = cell_err_ok |
| #define align_ceil | ( | v | ) | (((v) + (cell_partalign-1) ) & ~(cell_partalign-1)) |
| #define error | ( | id | ) | ( cell_err = errs_register( id , cell_err_msg[-(id)] , __LINE__ , __FUNCTION__ , __FILE__ ) ) |
Add a particle to a cell.
| c | The cell to which the particle should be added. |
| p | The #particle to add to the cell |
This routine assumes the particle position has already been adjusted to the cell c.
| struct part* cell_add_incomming | ( | struct cell * | c, |
| struct part * | p | ||
| ) | [read] |
Add a particle to the incomming array of a cell.
| c | The cell to which the particle should be added. |
| p | The #particle to add to the cell |
This routine assumes the particle position has already been adjusted to the cell c.
| int cell_add_incomming_multiple | ( | struct cell * | c, |
| struct part * | p, | ||
| int | count | ||
| ) |
Add one or more particles to the incomming array of a cell.
| c | The cell to which the particle should be added. |
| p | The #particle to add to the cell |
This routine assumes the particle position have already been adjusted to the cell c.
| int cell_flush | ( | struct cell * | c, |
| struct part ** | partlist, | ||
| struct cell ** | celllist | ||
| ) |
Flush all the parts from a cell.
| c | The cell to flush. |
| partlist | A pointer to the partlist to set the part indices. |
| celllist | A pointer to the celllist to set the part indices. |
Initialize the given cell.
| c | The cell to initialize. |
| loc | Array containing the location of this cell in the space. |
| origin | The origin of the cell in global coordinates |
| dim | The cell dimensions. |
| int cell_load | ( | struct cell * | c, |
| struct part * | parts, | ||
| int | nr_parts, | ||
| struct part ** | partlist, | ||
| struct cell ** | celllist | ||
| ) |
Load a block of particles to the cell.
| c | The cell. |
| parts | Pointer to a block of part. |
| nr_parts | The number of parts to load. |
| partlist | A pointer to the partlist to set the part indices. |
| celllist | A pointer to the celllist to set the part indices. |
| int cell_welcome | ( | struct cell * | c, |
| struct part ** | partlist | ||
| ) |
Move particles from the incomming buffer to the cell.
| c | The cell. |
| partlist | A pointer to the partlist to set the part indices. |
| int cell_err = cell_err_ok |
| char* cell_err_msg[] |
{
"Nothing bad happened.",
"An unexpected NULL pointer was encountered.",
"A call to malloc failed, probably due to insufficient memory.",
"A call to a pthread routine failed."
}
| const char cell_flip[27] |
{ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
| const FPTYPE cell_shift[13 *3] |
{
5.773502691896258e-01 , 5.773502691896258e-01 , 5.773502691896258e-01 ,
7.071067811865475e-01 , 7.071067811865475e-01 , 0.0 ,
5.773502691896258e-01 , 5.773502691896258e-01 , -5.773502691896258e-01 ,
7.071067811865475e-01 , 0.0 , 7.071067811865475e-01 ,
1.0 , 0.0 , 0.0 ,
7.071067811865475e-01 , 0.0 , -7.071067811865475e-01 ,
5.773502691896258e-01 , -5.773502691896258e-01 , 5.773502691896258e-01 ,
7.071067811865475e-01 , -7.071067811865475e-01 , 0.0 ,
5.773502691896258e-01 , -5.773502691896258e-01 , -5.773502691896258e-01 ,
0.0 , 7.071067811865475e-01 , 7.071067811865475e-01 ,
0.0 , 1.0 , 0.0 ,
0.0 , 7.071067811865475e-01 , -7.071067811865475e-01 ,
0.0 , 0.0 , 1.0 ,
}
| const char cell_sortlistID[27] |
{
0 ,
1 ,
2 ,
3 ,
4 ,
5 ,
6 ,
7 ,
8 ,
9 ,
10 ,
11 ,
12 ,
0 ,
12 ,
11 ,
10 ,
9 ,
8 ,
7 ,
6 ,
5 ,
4 ,
3 ,
2 ,
1 ,
0
}
1.7.6.1