/***************************************/ /* Fortran bindings for the NDAS C API */ /* Copyright: Peter J. Laughton, AECL */ /***************************************/ #include #include #include #include "xsdbops.h" #include "sdbm.h" #include "xsdb-defs.h" static char AbortString[132]; static int packIndex; typedef enum {Int, Float, Char8} PackType; static char *packedBurnupData=0; static char AbortString[132]; typedef struct { int ib1, ib2; float rb1, rb2; } BurnQuad; typedef struct { /* From subinx.inc: NBURN, ISOID, AW, IAN, NFISS, NTEMP, NR, NSUBNK, NNA, NP1, NFSPEC, IENDFB */ /* nomenclature of crnl-2866, page 3 */ int nburn; int numericId; float aw; int iz; int nf; int nt; int nr; int ndat2; /* not in xs block on unf-seq file */ int ndat3; /* not in xs block on unf-seq file */ int np1; int ns; int iendfb; /* not in xs block on unf-seq file */ char name[9]; int installed; /* flagged true when all of this block has been loaded */ BurnQuad *burnQuad; } Nuclide; Nuclide *nuclide; /* array of all nuclides */ static int nLoadedNuclides=0; /* number actually available */ static int lastNuclideAccessed=0; /* library index (1,...,nel) of last nuclide accessed */ typedef struct { int code; char *name; } CodeNamePair; static CodeNamePair itemMap[]={ {BickleyFunctionTablesKi3, "BickleyFunctionTablesKi3"}, {BickleyFunctionTablesKi35, "BickleyFunctionTablesKi35"}, {BurnCount, "BurnCount"}, {BurnInteger, "BurnInteger"}, {BurnReal, "BurnReal"}, {Absorption, "Absorption"}, {Transport, "Transport"}, {Fission, "Fission"}, {NuFission, "NuFission"}, {N2n, "N2n"}, {FissionSpectrum, "FissionSpectrum"}, {PotScatSlowingDown, "PotScatSlowingDown"}, {LengthsThermalP0, "LengthsThermalP0"}, {GCLambda, "GCLambda"}, {Header, "Header"}, {ResHeader, "ResHeader"}, {LengthsScatP1, "LengthsScatP1"}, {ScatP0, "ScatP0"}, {ScatP1, "ScatP1"}, {ThermalXSTemp, "ThermalXSTemp"}, {ThermalP1Temp, "ThermalP1Temp"}, {GroupBoundaries, "GroupBoundaries"}, {PotScat, "PotScat"}, {NJOYFlux, "NJOYFlux"}, {Hequivalence, "Hequivalence"}, {HeqHeader, "HeqHeader"}, {TransportCorrection, "TransportCorrection"} }; static char *unknownMessage="--unknown--"; #define NITEMS (sizeof(itemMap)/sizeof(CodeNamePair)) char *itemName(int code) { int i; for (i=0; i%s<--\n",nomC); fflush(logFile); } flist=strchr(nomC,':'); if(!flist) { fprintf(logFile,"index file missing; namfil=%s\n",nomC); *status=OPEN_FAILURE; return; } flist++; xsdbReadInit(flist,status); if (*status) /* non-zero means something is wrong */ return; idxfn=strtok(nomC,":\n"); indexFile=fopen(idxfn,"r"); if (!indexFile) { perror(idxfn); fprintf(logFile,"open failure for index file %s\n",idxfn); *status=OPEN_FAILURE; return; } if(fscanf(indexFile,"%d",&nel) == EOF) goto L10; if(fscanf(indexFile,"%d",&ng) == EOF) goto L10; if(fscanf(indexFile,"%d",&ng0) == EOF) goto L10; if(fscanf(indexFile,"%d",&ng1) == EOF) goto L10; if(fscanf(indexFile,"%d",&ng2) == EOF) goto L10; if(fscanf(indexFile,"%d",&ng3) == EOF) goto L10; if(fscanf(indexFile,"%d",&fissileNuclideCount) == EOF) goto L10; if(fscanf(indexFile,"%d",&nnfpd) == EOF) goto L10; if(fscanf(indexFile,"%d",&p1NuclideCount) == EOF) goto L10; if(fscanf(indexFile,"%d",&nresmc) == EOF) goto L10; if(fscanf(indexFile,"%d",&n1rc) == EOF) goto L10; if(fscanf(indexFile,"%d",&m1rc) == EOF) goto L10; if(fscanf(indexFile,"%d",&n1m1rc) == EOF) goto L10; if(fscanf(indexFile,"%d",&lsctfl) == EOF) goto L10; if(fscanf(indexFile,"%d",&jp0max) == EOF) goto L10; if(fscanf(indexFile,"%d",&jp1max) == EOF) goto L10; nuclide=MAKE_ARRAY(Nuclide,nel); if (!nuclide) { fprintf(logFile,"error: memory allocation failure\n"); exit(1); } for (i=0; i nel) { sprintf(AbortString,"%s: Insufficent allocation to hold isotope names",nomsub); *status=RECORD_INDEX_OVERFLOW; return; } if (verbose) { fprintf(logFile,"%10s %d\n",nuclide[*iset-1].name,nuclide[*iset-1].numericId); fflush(logFile); } *numericId=nuclide[*iset-1].numericId; len=strlen(nuclide[*iset-1].name); cp=isonam; for (j=0; j