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

Function GetDoubleParam

SRC/runtime/parsing/InterpreterAPI.cpp:445–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443 namespace Parsing {
444
445 int
446 GetDoubleParam(Tcl_Interp *interp, Domain& domain, const char* arg, double* value, Parameter* &param)
447 {
448 if (Tcl_GetDouble(interp, arg, value) == TCL_OK)
449 return TCL_OK;
450
451 // something like "parameter tag value"
452 int tag, argc;
453 const char **argv;
454 if (Tcl_SplitList(interp, arg, &argc, &argv) != TCL_OK)
455 return TCL_ERROR;
456
457 if (argc != 3) {
458 Tcl_Free((char*)argv);
459 return TCL_ERROR;
460 }
461
462 if (strcmp(argv[0], "Parameter") != 0) {
463 Tcl_Free((char*)argv);
464 return TCL_ERROR;
465 }
466
467 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
468 Tcl_Free((char*)argv);
469 return TCL_ERROR;
470 }
471
472 if (Tcl_GetDouble(interp, argv[2], value) != TCL_OK) {
473 Tcl_Free((char*)argv);
474 return TCL_ERROR;
475 }
476
477 Tcl_Free((char*)argv);
478
479 param = domain.getParameter(tag);
480
481 if (param == nullptr) {
482 opserr << OpenSees::PromptValueError << "parameter with tag " << tag << " not found\n";
483 return TCL_ERROR;
484 }
485
486 return TCL_OK;
487 }
488 }
489}

Callers 2

TclCommand_addNodeFunction · 0.85

Calls 1

getParameterMethod · 0.45

Tested by

no test coverage detected