static void gfs_refine_read (GtsObject ** o, GtsFile * fp) { GfsRefine * refine = GFS_REFINE (*o); GtsObjectClass * klass; gboolean class_changed = FALSE; if (fp->type != GTS_STRING) { gts_file_error (fp, "expecting a string (GfsRefineClass)"); return; } klass = gfs_object_class_from_name (fp->token->str); if (klass == NULL) { gts_file_error (fp, "unknown class `%s'", fp->token->str); return; } if (!gts_object_class_is_from_class (klass, gfs_refine_class ())) { gts_file_error (fp, "`%s' is not a GfsRefine", fp->token->str); return; } if (klass != (*o)->klass) { *o = gts_object_new (klass); gts_object_destroy (GTS_OBJECT (refine)); refine = GFS_REFINE (*o); class_changed = TRUE; } gts_file_next_token (fp); gfs_function_read (refine->maxlevel, gfs_object_simulation (refine), fp); if (fp->type == GTS_ERROR) return; if (class_changed && fp->type != '\n' && klass->read) (* klass->read) (o, fp); }
static void gfs_source_darcy_read (GtsObject ** o, GtsFile * fp) { (* GTS_OBJECT_CLASS (gfs_source_darcy_class ())->parent_class->read) (o, fp); if (fp->type == GTS_ERROR) return; printf("\ntesting1\n"); /*Check if source darcy has already been added or not*/ FttComponent c; for (c = 0; c < FTT_DIMENSION; c++) { GfsVariable * v = GFS_SOURCE_VELOCITY (*o)->v[c]; if (v->sources) { GSList * i = GTS_SLIST_CONTAINER (v->sources)->items; while (i) { if (i->data != *o && GFS_IS_SOURCE_DARCY (i->data)) { gts_file_error (fp, "variable '%s' cannot have multiple Darcy source terms", v->name); return; } i = i->next; } } } printf("\ntesting2\n"); GfsDomain * domain = GFS_DOMAIN (gfs_object_simulation (*o)); GfsSourceDarcy * s = GFS_SOURCE_DARCY (*o); printf("\ntesting3\n"); s->darcycoeff = gfs_function_new (gfs_function_class (), 0.); gfs_function_read (s->darcycoeff, gfs_object_simulation (s), fp); printf("\ntesting4\n"); if (fp->type != '\n') { s->forchhicoeff = gfs_function_new (gfs_function_class (), 0.); gfs_function_read (s->forchhicoeff, gfs_object_simulation (s), fp); } if (s->beta < 1.) for (c = 0; c < FTT_DIMENSION; c++) s->u[c] = gfs_temporary_variable (domain); else { GFS_SOURCE_GENERIC (s)->centered_value = NULL; GFS_SOURCE_GENERIC (s)->mac_value = NULL; } printf("\ntesting5\n"); }
static void gfs_init_wave_read (GtsObject ** o, GtsFile * fp) { (* GTS_OBJECT_CLASS (gfs_init_wave_class ())->parent_class->read) (o, fp); if (fp->type == GTS_ERROR) return; GfsDomain * domain = GFS_DOMAIN (gfs_object_simulation (*o)); if (!GFS_IS_WAVE (domain)) { gts_file_error (fp, "GfsInitWave can only be used within a GfsWave simulation"); return; } gfs_function_read (GFS_INIT_WAVE (*o)->d, domain, fp); if (fp->type == GTS_ERROR) return; gfs_function_read (GFS_INIT_WAVE (*o)->hs, domain, fp); }
static void gfs_porous_read (GtsObject ** o, GtsFile * fp) { /* call read method of parent */ (* GTS_OBJECT_CLASS (gfs_porous_class ())->parent_class->read) (o, fp); if (fp->type == GTS_ERROR) return; GfsPorous * por = GFS_POROUS (*o); GfsSimulation * sim = GFS_SIMULATION (por); /* do object-specific read here */ if (fp->type != '{') { gts_file_error (fp, "expecting an opening brace"); return; } fp->scope_max++; gts_file_next_token (fp); while (fp->type != GTS_ERROR && fp->type != '}') { if (fp->type == '\n') { gts_file_next_token (fp); continue; } if (fp->type != GTS_STRING) { gts_file_error (fp, "expecting a keyword"); return; } if (!strcmp (fp->token->str, "porosity")) { gts_file_next_token (fp); if (fp->type != '=') gts_file_error (fp, "expecting `='"); else{ gts_file_next_token (fp); gfs_function_read (por->porosity, sim, fp); } } if (!strcmp (fp->token->str, "K")) { gts_file_next_token (fp); if (fp->type != '=') gts_file_error (fp, "expecting `='"); else{ gts_file_next_token (fp); gfs_function_read (por-> K, sim , fp); } } } if (fp->type == GTS_ERROR) return; if (fp->type != '}') { gts_file_error (fp, "expecting a closing brace"); return; fp->scope_max--; gts_file_next_token (fp); /* do not forget to prepare for next read */ } }