u11.c File Reference

#include <stdlib.h>
#include "nmd.h"

Include dependency graph for u11.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main ( int  argc,
char **  argv 
)

Test setting and getting of array values with internal copy

Definition at line 5 of file u11.c.

References NMD_FREE, NMD_MALLOC, NMDCopyArrayValue(), NMDCreateObject(), NMDDestroyObject(), NMDGetArrayValue(), and NMDIntarray.

00005                                {
00006   NMD_metadata nmd; NMDErrorCode ierr; 
00007   NMDTruth flg; NMDDataType t;
00008   int *ii,*iir;
00009   PetscFunctionBegin;
00010   PetscInitialize(&argc,&argv,0,0);
00011 
00012   ierr = NMDCreateObject(&nmd); NMD_ERR_RETURN(ierr);
00013 
00014   NMD_MALLOC(ii,5,int,"int array");
00015   ii[2] = 15;
00016 
00017   ierr = NMDCopyArrayValue
00018     (nmd,"ctg","i array",NMDIntarray,&ii,5); NMD_ERR_RETURN(ierr);
00019 
00020   NMD_FREE(ii);
00021 
00022   ierr = NMDGetArrayValue
00023     (nmd,"ctg","i array",&t,(void*)&iir,NULL,&flg); NMD_ERR_RETURN(ierr);
00024   if (!flg) NMD_ERR_REPORT("Could not get i array");
00025   if (t!=NMDIntarray) NMD_ERR_REPORTi("i array type mismatch",(int)t);
00026   if (iir[2]!=15) NMD_ERR_REPORTi("i array value problem",iir[2]);
00027 
00028   ierr = NMDDestroyObject(nmd); NMD_ERR_RETURN(ierr);
00029 
00030   PetscFinalize();
00031   PetscFunctionReturn(0);
00032 }

Here is the call graph for this function:


Generated on Sun Oct 4 03:59:30 2009 for NMD by  doxygen 1.5.9