updating get demand name and write demands

Everything passing locally
This commit is contained in:
michaeltryby
2019-04-22 12:14:33 -04:00
parent 97f70e445d
commit d34ac67172
2 changed files with 31 additions and 29 deletions

View File

@@ -2873,6 +2873,8 @@ int DLLEXPORT EN_getdemandname(EN_Project p, int nodeIndex, int demandIndex,
free(temp);
}
}
else return 253;
return 0;
}

View File

@@ -123,43 +123,43 @@ void saveauxdata(Project *pr, FILE *f)
void write_demands(Project *pr, FILE *f) {
int i, j;
int i, j;
Snode *node = NULL;
list_node_t *lnode = NULL;
char *temp = NULL;
Snode *node = NULL;
list_node_t *lnode = NULL;
char *temp = NULL;
char s[MAXLINE + 1],
s1[MAXLINE + 1];
char s[MAXLINE + 1],
s1[MAXLINE + 1];
double ucf = pr->Ucf[DEMAND];
Network *net = &pr->network;
double ucf = pr->Ucf[DEMAND];
Network *net = &pr->network;
fprintf(f, "\n\n");
fprintf(f, s_DEMANDS);
fprintf(f, "\n\n");
fprintf(f, s_DEMANDS);
for (i = 1; i <= net->Njuncs; i++) {
node = &net->Node[i];
if (node->D) {
for (lnode = first_list(node->D); done_list(lnode); lnode = next_list(lnode)) {
if (lnode) {
sprintf(s, " %-31s %14.6f", node->ID, ucf * get_base_demand(lnode));
for (i = 1; i <= net->Njuncs; i++) {
node = &net->Node[i];
if (node->D) {
for (lnode = first_list(node->D); done_list(lnode); lnode = next_list(lnode)) {
if (lnode) {
sprintf(s, " %-31s %14.6f", node->ID, ucf * get_base_demand(lnode));
if
((j = get_pattern_index(lnode)) > 0) sprintf(s1, " %-31s", net->Pattern[j].ID);
else
strcpy(s1, " ");
if
((j = get_pattern_index(lnode)) > 0) sprintf(s1, " %-31s", net->Pattern[j].ID);
else
strcpy(s1, " ");
fprintf(f, "\n%s %-31s", s, s1);
fprintf(f, "\n%s %-31s", s, s1);
//if (temp = get_category_name(lnode)) {
// fprintf(f, " ;%s", temp);
// free(temp);
//}
}
}
}
}
if (temp = get_category_name(lnode)) {
fprintf(f, " ;%s", temp);
free(temp);
}
}
}
}
}
}