inp.c, copy deck for internal re-sourcing with 'mc_source' to enable Monte-Carlo simulation with commercial model deck
This commit is contained in:
parent
1fae736baf
commit
fb6bb8b1a6
|
|
@ -52,6 +52,7 @@ Author: 1985 Wayne A. Christopher
|
||||||
static char *upper(register char *string);
|
static char *upper(register char *string);
|
||||||
static bool doedit(char *filename);
|
static bool doedit(char *filename);
|
||||||
static struct line *com_options = NULL;
|
static struct line *com_options = NULL;
|
||||||
|
static struct line *mc_deck = NULL;
|
||||||
static void cktislinear(CKTcircuit *ckt, struct line *deck);
|
static void cktislinear(CKTcircuit *ckt, struct line *deck);
|
||||||
static void dotifeval(struct line *deck);
|
static void dotifeval(struct line *deck);
|
||||||
static int inp_parse_temper(struct line *deck);
|
static int inp_parse_temper(struct line *deck);
|
||||||
|
|
@ -309,7 +310,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
* intfile = whether input is from internal array. Values are TRUE/FALSE
|
* intfile = whether input is from internal array. Values are TRUE/FALSE
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
struct line *deck, *dd, *ld, *prev_param = NULL, *prev_card = NULL;
|
struct line *deck = NULL, *dd, *ld, *prev_param = NULL, *prev_card = NULL;
|
||||||
struct line *realdeck = NULL, *options = NULL, *curr_meas = NULL;
|
struct line *realdeck = NULL, *options = NULL, *curr_meas = NULL;
|
||||||
char *tt = NULL, name[BSIZE_SP], *s, *t, *temperature = NULL;
|
char *tt = NULL, name[BSIZE_SP], *s, *t, *temperature = NULL;
|
||||||
double testemp = 0.0;
|
double testemp = 0.0;
|
||||||
|
|
@ -330,7 +331,30 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
char *dir_name = ngdirname(filename ? filename : ".");
|
char *dir_name = ngdirname(filename ? filename : ".");
|
||||||
|
|
||||||
startTime = seconds();
|
startTime = seconds();
|
||||||
deck = inp_readall(fp, dir_name, comfile, intfile);
|
/* inp_source() called with fp: load from file */
|
||||||
|
if (fp) {
|
||||||
|
if (mc_deck) {
|
||||||
|
line_free_x(mc_deck, TRUE);
|
||||||
|
mc_deck = NULL;
|
||||||
|
}
|
||||||
|
deck = inp_readall(fp, dir_name, comfile, intfile);
|
||||||
|
|
||||||
|
/* files starting with *ng_script are user supplied command files */
|
||||||
|
if (deck && ciprefix("*ng_script", deck->li_line))
|
||||||
|
comfile = TRUE;
|
||||||
|
/* save a copy of the deck for later reloading with 'mc_source' */
|
||||||
|
if (!comfile)
|
||||||
|
mc_deck = inp_deckcopy(deck);
|
||||||
|
}
|
||||||
|
/* inp_spsource() called with *fp == NULL: we want to reload circuit for MC simulation */
|
||||||
|
else {
|
||||||
|
if (mc_deck)
|
||||||
|
deck = inp_deckcopy(mc_deck);
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "Error: No circuit loaded, cannot copy internally\n");
|
||||||
|
controlled_exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
endTime = seconds();
|
endTime = seconds();
|
||||||
tfree(dir_name);
|
tfree(dir_name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue