PLUTO  4.4-patch2
Functions
tools.c File Reference

Collection of general-purpose functions. More...

#include "pluto.h"

Functions

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)
 

Detailed Description

Author
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
Date
Jan 27, 2020

Function Documentation

◆ 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]gridpointer to an array of grid structures.
[out]nranksan 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]legendan array of strings describing the fields
[in]nfieldsthe number of fields (also the dimensions of legend)
[in]fpa 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_arrthe array of strings
[in]sizethe size of the array
[in]strthe string to search for

◆ SwapEndian()

void SwapEndian ( void *  x,
const int  nbytes 
)

Swap the byte order of x.

Parameters
[in]xpointer to the variable being swapped
[in]nbytesdata 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