63static int init_gsds(
void);
64static int check_numsets(
void);
65static dataset *get_dataset(
int);
71static int Numsets = 0;
73static int Cur_id =
LUCKY;
75static size_t Tot_mem = 0;
80static int init_gsds(
void)
84 for (i = 0; i <
MAX_DS; i++) {
99static int check_numsets(
void)
101 if (Numsets < Cur_max) {
119static dataset *get_dataset(
int id)
123 for (i = 0; i < Numsets; i++) {
124 if (Data[i]->data_id ==
id) {
140static int get_type(
dataset *ds)
189 start =
begin ? 0 : i + 1;
191 for (i = start; i < Numsets; i++) {
193 if ((Data[i]->changed & *
changes) || !(Data[i]->changed)) {
194 if (get_type(Data[i]) & *
types) {
196 *
types = get_type(Data[i]);
198 return (Data[i]->data_id);
218 static int first = 1;
222 if (0 > init_gsds()) {
228 else if (0 > check_numsets()) {
240 new->data_id = Cur_id++;
242 for (i = 0; i <
MAXDIMS; i++) {
247 new->databuff.fb =
NULL;
248 new->databuff.ib =
NULL;
249 new->databuff.sb =
NULL;
250 new->databuff.cb =
NULL;
251 new->databuff.bm =
NULL;
252 new->databuff.nm =
NULL;
253 new->databuff.k = 0.0;
256 new->need_reload = 1;
258 return (new->data_id);
281 if ((ds = get_dataset(
id))) {
305 for (i = 0; i < Numsets; i++) {
306 if (Data[i]->data_id ==
id) {
332 for (i = 0; i < Numsets; i++) {
333 if (Data[i]->data_id ==
id) {
341 for (
j = i;
j < (Numsets - 1);
j++) {
342 Data[
j] = Data[
j + 1];
370 for (i = 0; i < Numsets; i++) {
371 if (Data[i]->data_id ==
id) {
394 for (i = 0; i < ds->
ndims; i++) {
456 G_debug(5,
"free_data_buffs(): freed data from id no. %d", ds->
data_id);
457 G_debug(5,
"free_data_buffs(): %.3f Kbytes freed, current total = %.3f",
458 freed / 1000., Tot_mem / 1000.);
482 if ((ds = get_dataset(
id))) {
490 for (i = 0; i < ndims; i++) {
491 ds->
dims[i] = dims[i];
592 "gsds_alloc_typbuff(): %f Kbytes allocated, current total = %f",
593 siz / 1000., Tot_mem / 1000.);
613 if ((ds = get_dataset(
id))) {
633 if ((ds = get_dataset(
id))) {
651 ds = get_dataset(
id);
653 return (get_type(ds));
int BM_destroy(struct BM *)
Destroy bitmap and free all associated memory.
size_t BM_get_map_size(struct BM *)
Returns size in bytes that bitmap is taking up.
struct BM * BM_create(int, int)
Create bitmap of dimension x/y and return structure token.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
char * gsds_get_name(int id)
Get name.
int gsds_findh(const char *name, unsigned int *changes, unsigned int *types, int begin)
Get handle to gsds.
int gsds_get_type(int id)
ADD.
int gsds_newh(const char *name)
Get handle to gsds.
typbuff * gsds_get_typbuff(int id, unsigned int change_flag)
Get data buffer.
int gsds_set_changed(int id, unsigned int reason)
ADD.
size_t free_data_buffs(dataset *ds, int typ)
Free data buffer.
int gsds_free_datah(int id)
Free allocated dataset.
size_t gsds_alloc_typbuff(int id, int *dims, int ndims, int type)
Allocates correct buffer according to type, keeps track of total mem.
int gsds_free_data_buff(int id, int typ)
Free allocated buffer.
int gsds_get_changed(int id)
ADD.
OGSF header file (structures)