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

Function nodeDOFs

SRC/runtime/commands/domain/nodes.cpp:859–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

857
858
859int
860nodeDOFs(ClientData clientData, Tcl_Interp *interp, Tcl_Size argc, TCL_Char ** const argv)
861{
862 assert(clientData != nullptr);
863 Domain *the_domain = (Domain*)clientData;
864
865 if (argc != 2) {
866 opserr << OpenSees::PromptValueError
867 << "Missing required arguments"
868 << OpenSees::SignalMessageEnd;
869 return TCL_ERROR;
870 }
871
872 int tag;
873 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
874 opserr << OpenSees::PromptValueError << "nodeDOFs nodeTag?\n";
875 return TCL_ERROR;
876 }
877
878
879 Node *theNode = the_domain->getNode(tag);
880 if (theNode == nullptr) {
881 opserr << OpenSees::PromptValueError
882 << "node with tag " << tag << " not found"
883 << OpenSees::SignalMessageEnd;
884 return TCL_ERROR;
885 }
886
887 int numDOF = theNode->getNumberDOF();
888 DOF_Group *theDOFgroup = theNode->getDOF_GroupPtr();
889 if (theDOFgroup == nullptr) {
890 opserr << OpenSees::PromptValueError
891 << "nodeDOFs DOF group null"
892 << OpenSees::SignalMessageEnd;
893 return -1;
894 }
895
896 char buffer[40];
897 const ID &eqnNumbers = theDOFgroup->getID();
898 for (int i = 0; i < numDOF; ++i) {
899 sprintf(buffer, "%d ", eqnNumbers(i));
900 Tcl_AppendResult(interp, buffer, NULL);
901 }
902
903 return TCL_OK;
904}
905

Callers

nothing calls this directly

Calls 4

getIDMethod · 0.80
getNodeMethod · 0.45
getNumberDOFMethod · 0.45
getDOF_GroupPtrMethod · 0.45

Tested by

no test coverage detected