Collection of general-purpose functions.
More...
|
void | GetNeighbourRanks (Grid *grid, int **nranks) |
|
int | IsLittleEndian (void) |
|
void | MakeState (Sweep *sweep) |
|
void | PlutoError (int condition, char *str) |
|
void | PrintColumnLegend (char *legend[], int nfields, FILE *fp) |
|
void | StateStructAllocate (State *p) |
|
int | StringArrayIndex (char *str_arr[], int size, char *str) |
|
void | SymmetryCheck (Data_Arr V, int where, RBox *box) |
|
void | SwapEndian (void *x, const int nbytes) |
|
void | WriteAsciiFile (char *fname, double *q, int nvar) |
|
◆ GetNeighbourRanks()
void GetNeighbourRanks |
( |
Grid * |
grid, |
|
|
int ** |
nranks |
|
) |
| |
Find the ranks of neighbour processors direction by direction. Store them in the array nrank
[dir][s] where dir
is the direction and s = 0,1
stands for the left (0) or right (1) processor. If a processor touches the physical boundary that is not periodic, the corresponding neighbour rank will be set to -1.
- Parameters
-
[in] | grid | pointer to an array of grid structures. |
[out] | nranks | an array of integers containing the ranks of the neighbouring processors |
◆ IsLittleEndian()
int IsLittleEndian |
( |
void |
| ) |
|
Return 1 if the current architecture has little endian order
◆ MakeState()
void MakeState |
( |
Sweep * |
sweep | ) |
|
Allocate memory areas for arrays inside the sweep structure.
◆ PlutoError()
void PlutoError |
( |
int |
condition, |
|
|
char * |
str |
|
) |
| |
If condition is true, issue an error and quit the code.
◆ PrintColumnLegend()
void PrintColumnLegend |
( |
char * |
legend[], |
|
|
int |
nfields, |
|
|
FILE * |
fp |
|
) |
| |
Print nicely formatted legend to an ASCII datfile header.
- Parameters
-
[in] | legend | an array of strings describing the fields |
[in] | nfields | the number of fields (also the dimensions of legend) |
[in] | fp | a valid file descriptor. |
◆ StateStructAllocate()
void StateStructAllocate |
( |
State * |
p | ) |
|
Allocate memory areas for arrays inside the State structure.
◆ StringArrayIndex()
int StringArrayIndex |
( |
char * |
str_arr[], |
|
|
int |
size, |
|
|
char * |
str |
|
) |
| |
Find the index of an array of strings whose value matches the input string *str
.
- Parameters
-
[in] | str_arr | the array of strings |
[in] | size | the size of the array |
[in] | str | the string to search for |
◆ SwapEndian()
void SwapEndian |
( |
void * |
x, |
|
|
const int |
nbytes |
|
) |
| |
Swap the byte order of x.
- Parameters
-
[in] | x | pointer to the variable being swapped |
[in] | nbytes | data type size |
- Returns
- This function has no return value.
◆ SymmetryCheck()
void SymmetryCheck |
( |
Data_Arr |
V, |
|
|
int |
where, |
|
|
RBox * |
box |
|
) |
| |
Check if vectors preserve symmetry / antisymmetry properties at a symmetry axis (r = 0 for cylindrical or theta = 0 for spherical) Vectors can only be cell-centered (meaning that all components must be cell-centered) or face-centered (meaning that all components must be face-centered). Staggered fields are not allowed.
◆ WriteAsciiFile()
void WriteAsciiFile |
( |
char * |
fname, |
|
|
double * |
q, |
|
|
int |
nvar |
|
) |
| |
Write one row a multi-column ascii file