Skip to content

Commit f7ebc15

Browse files
authored
Merge pull request OpenSees#1603 from mhscott/ops-path-series
Making Python interpreter read list or sequence of doubles for Path time series
2 parents 33e91a4 + 8245ba6 commit f7ebc15

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

SRC/domain/pattern/PathSeries.cpp

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void *OPS_PathSeries() {
7171
// check inputs
7272
TimeSeries *theSeries = 0;
7373
int loc = 2;
74+
OPS_ResetCurrentInputArg(loc);
7475
while (OPS_GetNumRemainingInputArgs() > 0) {
7576
// next arg
7677
const char *arg = OPS_GetString();
@@ -105,21 +106,25 @@ void *OPS_PathSeries() {
105106
} else if (strcmp(arg, "-values") == 0) {
106107

107108
int size; Vector dataValues;
108-
OPS_GetDoubleListInput(&size, &dataValues);
109-
for (int i=0; i<size; i++)
110-
values.push_back(dataValues[i]);
111-
/*
109+
int ok = OPS_GetDoubleListInput(&size, &dataValues);
110+
if (ok >= 0) {
111+
for (int i=0; i<size; i++)
112+
values.push_back(dataValues[i]);
113+
loc++;
114+
}
115+
else{
116+
OPS_ResetCurrentInputArg(loc);
112117
while (OPS_GetNumRemainingInputArgs() > 0) {
113-
double val;
114-
numData = 1;
115-
if (OPS_GetDoubleInput(&numData, &val) < 0) {
116-
OPS_ResetCurrentInputArg(loc);
117-
break;
118-
}
119-
values.push_back(val);
120-
loc++;
121-
}
122-
*/
118+
double val;
119+
numData = 1;
120+
if (OPS_GetDoubleInput(&numData, &val) < 0) {
121+
OPS_ResetCurrentInputArg(loc);
122+
break;
123+
}
124+
values.push_back(val);
125+
loc++;
126+
}
127+
}
123128
} else if (strcmp(arg, "-factor") == 0) {
124129
if (OPS_GetNumRemainingInputArgs() < 1) {
125130
opserr << "WARNING no factor is given\n";
@@ -180,10 +185,14 @@ void *OPS_PathSeries() {
180185
} else if (strcmp(arg, "-time") == 0) {
181186

182187
int size; Vector dataValues;
183-
OPS_GetDoubleListInput(&size, &dataValues);
184-
for (int i=0; i<size; i++)
185-
times.push_back(dataValues[i]);
186-
/*
188+
int ok = OPS_GetDoubleListInput(&size, &dataValues);
189+
if (ok >= 0) {
190+
for (int i=0; i<size; i++)
191+
times.push_back(dataValues[i]);
192+
loc++;
193+
}
194+
else{
195+
OPS_ResetCurrentInputArg(loc);
187196
while (OPS_GetNumRemainingInputArgs() > 0) {
188197
double val;
189198
numData = 1;
@@ -193,9 +202,8 @@ void *OPS_PathSeries() {
193202
}
194203
times.push_back(val);
195204
loc++;
196-
opserr << " -time " << val << " " << loc++ << "\n";
197205
}
198-
*/
206+
}
199207
}
200208
}
201209

SRC/interpreter/PythonModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ int PythonModule::getDoubleList(int* size, Vector* data)
221221
}
222222
}
223223
else {
224-
opserr << "PythonModule::getDoubleList error: input is neither a list nor a tuple\n";
224+
// Removing this error message for Path series list inputs -- MHS
225+
//opserr << "PythonModule::getDoubleList error: input is neither a list nor a tuple\n";
225226
return -1;
226227
}
227228

0 commit comments

Comments
 (0)