NMD
|
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
int main | ( | int | argc, |
char ** | argv | ||
) |
Test creation of components
Definition at line 5 of file u4.c.
References NMDCategoryAllocateNewComponent(), NMDCreateObject(), NMDDestroyObject(), NMDInt, NMDIntarray, NMDObjectAllocateNewCategory(), NMDObjectTryGetCategory(), NMDReal, NMDRealarray, and NMDString.
{ NMD_metadata nmd; NMDErrorCode ierr; PetscFunctionBegin; PetscInitialize(&argc,&argv,0,0); ierr = NMDCreateObject(&nmd); NMD_ERR_RETURN(ierr); { NMD_metadata_category cat; NMDTruth flg; ierr = NMDObjectAllocateNewCategory (nmd,"catone",NULL); NMD_ERR_RETURN(ierr); ierr = NMDObjectAllocateNewCategory (nmd,"cat2",&cat); NMD_ERR_RETURN(ierr); ierr = NMDObjectTryGetCategory (nmd,"cat2",&cat,&flg); NMD_ERR_RETURN(ierr); if (!flg) NMD_ERR_REPORT("category 2 missing"); ierr = NMDCategoryAllocateNewComponent (cat,"p1",NMDInt,NULL); NMD_ERR_RETURN(ierr); ierr = NMDCategoryAllocateNewComponent (cat,"ptwo",NMDReal,NULL); NMD_ERR_RETURN(ierr); ierr = NMDCategoryAllocateNewComponent (cat,"p3",NMDIntarray,NULL); NMD_ERR_RETURN(ierr); ierr = NMDObjectTryGetCategory (nmd,"catone",&cat,&flg); NMD_ERR_RETURN(ierr); if (!flg) NMD_ERR_REPORT("category 1 missing") ierr = NMDCategoryAllocateNewComponent (cat,"pone",NMDString,NULL); NMD_ERR_RETURN(ierr); ierr = NMDCategoryAllocateNewComponent (cat,"ptwo",NMDRealarray,NULL); NMD_ERR_RETURN(ierr); } ierr = NMDDestroyObject(nmd); NMD_ERR_RETURN(ierr); PetscFinalize(); PetscFunctionReturn(0); }