PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
Functions
al_io.c File Reference

Miscellaneous functions for IO operations. More...

#include "al_hidden.h"
#include <string.h>

Functions

int AL_File_open (char *filename, int sz_ptr)
 
int AL_File_close (int sz_ptr)
 
int AL_Write_array (void *va, int sz_ptr, int istag)
 
int AL_Read_array (void *va, int sz_ptr, int istag)
 

Detailed Description

Author
A. Malagoli (University of Chicago)
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
G. Muscianisi (g.mus.nosp@m.cian.nosp@m.isi@c.nosp@m.inec.nosp@m.a.it)
Date
Aug 26, 2012

Function Documentation

int AL_File_close ( int  sz_ptr)

Close a file associate with and array

Parameters
[in]sz_ptrinteger pointer to array descriptor
int AL_File_open ( char *  filename,
int  sz_ptr 
)

Open a file associated with a distributed array

Parameters
[in]filenamename of the file
[in]sz_ptrinteger pointer to the distributed array descriptor
Returns
ifp pointer to integer file pointer
int AL_Read_array ( void *  va,
int  sz_ptr,
int  istag 
)

Read a distributed array to a file in parallel using synchronous and collective IO operations

Parameters
[in]bufferpointer to the buffer to write
[in]sz_ptrinteger pointer to a distributed array descriptor
[in]istagset it to -1 for centred variables, set to 0,1,2 for staggered field in the x,y,z direction

Bugs fixed on Aug 26, 2012:

  • nelem has been declared long long in order to manage dbl and flt output 'single_file' in which each PLUTO variable is >= 4GB
  • the updating of nelem after the writing of a variable has been modified from ''nelem *= (long long)(s->arrdim[i] +(istag == i));'' to ''nelem *= (long long)(s->arrdim[i]);'' because when a staggered variable is written, in the sz_ptr descriptor there is the information about the really number of element of this variable. This appens because the function AL_Set_staggered_dim is called for a staggered array.
int AL_Write_array ( void *  va,
int  sz_ptr,
int  istag 
)

Write a distributed array to a file in parallel using synchronous and collective IO operations

Parameters
[in]bufferpointer to the buffer to write
[in]sz_ptrinteger pointer to the distributed array descriptor
[in]istagset it to -1 for centred variables, set to 0,1,2 for staggered field in the x,y,z direction

Bugs fixed on Aug 26, 2012:

  • nelem has been declared long long in order to manage dbl and flt output 'single_file' in which each PLUTO variable is >= 4GB
  • the updating of nelem after the writing of a variable has been modified from ''nelem *= (long long)(s->arrdim[i] +(istag == i));'' to ''nelem *= (long long)(s->arrdim[i]);'' because when a staggered variable is written, in the sz_ptr descriptor there is the information about the really number of element of this variable. This appens because the function AL_Set_staggered_dim is called for a staggered array.