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

Function TclCommand_addNode

SRC/runtime/commands/modeling/nodes.cpp:39–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37#define G3_NUM_DOF_BUFFER 20
38
39int
40TclCommand_addNode(ClientData clientData, Tcl_Interp *interp, int argc,
41 TCL_Char ** const argv)
42{
43 assert(clientData != nullptr);
44
45 BasicModelBuilder *builder = static_cast<BasicModelBuilder*>(clientData);
46
47 Domain *theTclDomain = builder->getDomain();
48
49 int ndm = builder->getNDM();
50 int ndf = builder->getNDF();
51
52 // make sure corect number of arguments on command line
53 if (argc < 2 + 1) { // ndm) {
54 opserr << OpenSees::PromptValueError
55 << "insufficient arguments"
56 << OpenSees::SignalMessageEnd;
57 return TCL_ERROR;
58 }
59
60 Node *theNode = nullptr;
61
62 // read the node id
63 int nodeId;
64 if (Tcl_GetInt(interp, argv[1], &nodeId) != TCL_OK) {
65 opserr << OpenSees::PromptValueError << "invalid nodeTag\n";
66 opserr << " Want: node nodeTag? [ndm coordinates?] <-mass [ndf values?]>\n";
67 return TCL_ERROR;
68 }
69
70
71 Parameter* coord_params[3] = {nullptr, nullptr, nullptr};
72 using namespace OpenSees::Parsing;
73
74 // read in the coordinates and create the node
75 double xLoc=0, yLoc=0, zLoc=0;
76 if (ndm >= 1 && argc >= 3) {
77 // create a node in 1d space
78 if (GetDoubleParam(interp, *theTclDomain, argv[2], &xLoc, coord_params[0]) != TCL_OK) {
79 opserr << OpenSees::PromptValueError
80 << "invalid coordinate " << argv[2]
81 << OpenSees::SignalMessageEnd;
82 return TCL_ERROR;
83 }
84 }
85
86 if (ndm >= 2 && argc >= 4) {
87 if (Tcl_GetDouble(interp, argv[3], &yLoc) != TCL_OK) {
88 opserr << OpenSees::PromptValueError
89 << "invalid 2nd coordinate " << argv[3]
90 << OpenSees::SignalMessageEnd;
91 return TCL_ERROR;
92 }
93 }
94
95 if (ndm >= 3 && argc >= 5) {
96 if (Tcl_GetDouble(interp, argv[4], &zLoc) != TCL_OK) {

Callers

nothing calls this directly

Calls 12

GetDoubleParamFunction · 0.85
to_stringFunction · 0.85
getDomainMethod · 0.45
getNDMMethod · 0.45
getNDFMethod · 0.45
setMassMethod · 0.45
setDisplayCrdsMethod · 0.45
setTrialDispMethod · 0.45
commitStateMethod · 0.45
setTrialVelMethod · 0.45
addComponentMethod · 0.45
addNodeMethod · 0.45

Tested by

no test coverage detected