37 #define DBLOCK_FREADERROR 1 38 #define DBLOCK_FCLOSEERROR 2 39 #define DBLOCK_NOMEM 3 40 #define DBLOCK_NRECMISMATCH 4 41 #define DBLOCK_BADYEARS 5 For the application, basic dimensions: number of countries and bounding years.
int writedb2delim(struct datablock dblock, char *fname, char delim, struct appdata ad)
Convenience function to dump a datablock to a file.
int y_start
The start year.
int allocdata(struct datablock *dblock, struct appdata ad)
Create a datablock in memory, using application-specific dimensions.
void data2ff(struct datablock dblock, struct fixedfactor ff, int year, struct appdata ad)
Get all values for a particular year from a datablock.
int maxyear
Final year for the dataset.
void clearff(struct fixedfactor ff)
Free the memory taken up by a fixedfactor.
double getval(struct datablock db, int ctry, int year, struct appdata ad)
Get the data value from the datablock for specified row & year.
A one-dimensional array that contains information on countries that is the same for all years...
int numrecs
Number of records (i.e., number of countries)
void setffval(struct fixedfactor ff, double val, int row, struct appdata ad)
Set a value for a specified row (country) for a fixedfactor.
int allocts(struct timeseries *ts, struct appdata ad)
Create a timeseries in memory, of length = y_start - y_end + 1.
double * data
The array, dimensioned (y_start - y_end + 1) * ad.numrecs when created.
int writeff2delim(struct fixedfactor ff, char *fname, char delim, struct appdata ad)
Convenience function to dump a fixedfactor to a file.
void setval(struct datablock db, double val, int row, int year, struct appdata ad)
Set a specific value in a datablock, specified by row and year.
void ff2data(struct fixedfactor ff, struct datablock dblock, int year, struct appdata ad)
Put the values for a particular year into a datablock.
A one-dimensional array that contains global information that is the same for all countries...
datablockp * datablockpp
Pointer to a datablock pointer: for building arrays of datablock pointers.
int minyear
Earliest year for the dataset.
int writets2delim(struct timeseries ts, char *fname, char delim, struct appdata ad)
Convenience function to dump a timeseries to a file.
double * data
The array, length = ad.numrecs when created.
int getff(char *fname, struct fixedfactor *ff, char **name, int datacol, struct appdata ad)
Read a fixedfactor from a formatted file.
double * data
The data, length = y_start - y_end + 1 when created.
void settsval(struct timeseries ts, double val, int year, struct appdata ad)
Set the value for a particular year in a timeseries.
int getts(char *fname, struct timeseries *ts, struct appdata ad)
Read a timeseries from a formatted file.
int allocff(struct fixedfactor *ff, struct appdata ad)
Create a fixedfactor in memory, of length = number of countries.
int getdata(char *fname, struct datablock *dblock, struct appdata ad)
Read a datablock from a formatted file.
double gettsval(struct timeseries ts, int year, struct appdata ad)
Get the value for a particular year from a timeseries.
int y_start
The start year.
struct datablock * datablockp
Pointer to a datablock.
A two-dimensional array that contains information for country/year combinations.
double getffval(struct fixedfactor ff, int row, struct appdata ad)
Get a value for a specified row (country) from a fixedfactor.
void cleardata(struct datablock dblock)
Free the memory taken up by a datablock.
void clearts(struct timeseries ts)
Free the memory taken up by a timeseries.