MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / OPS_GetDoubleListInput

Function OPS_GetDoubleListInput

SRC/api/elementAPI_TCL.cpp:332–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330
331extern "C"
332int OPS_GetDoubleListInput(int* size, Vector* data)
333{
334 int mySize = 0;
335 double val;
336
337 if ((currentArg < maxArg) &&
338 (Tcl_GetDouble(theInterp, currentArgv[currentArg], &val) == TCL_OK)) {
339
340 // its a seriues of double values .. go get values till last arg or not a double
341 (*data)[mySize] = val;
342 mySize++;
343 currentArg++;
344 while ((currentArg < maxArg) &&
345 (Tcl_GetDouble(theInterp, currentArgv[currentArg], &val) == TCL_OK)) {
346
347 currentArg++;
348 (*data)[mySize] = val;
349 mySize++;
350 }
351 *size = mySize;
352
353 return 0;
354
355 } else {
356
357 // it's a list
358 TCL_Char** strings;
359
360 if (Tcl_SplitList(theInterp, currentArgv[currentArg],
361 size, &strings) != TCL_OK) {
362
363 opserr << "ERROR problem splitting list " << currentArgv[currentArg] << " \n";
364 return -1;
365 }
366
367 data->resize(*size);
368 for (int i = 0; i < *size; i++) {
369 double value;
370 if (Tcl_GetDouble(theInterp, strings[i], &value) != TCL_OK) {
371 opserr << "ERROR problem reading data value " << strings[i] << " \n";
372 // free up the array of strings .. see tcl man pages as to why
373 Tcl_Free((char*)strings);
374 return -1;
375 }
376 (*data)(i) = value;
377 }
378 // free up the array of strings .. see tcl man pages as to why
379 Tcl_Free((char*)strings);
380
381 currentArg++;
382
383 }
384
385 return 0;
386}
387
388extern "C"
389int OPS_EvalDoubleStringExpression(const char* theExpression, double& current_val) {

Callers 2

OPS_PathSeriesFunction · 0.50
OPS_ASDCoupledHinge3DFunction · 0.50

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected