| 6946 | } |
| 6947 | |
| 6948 | int |
| 6949 | constrainedDOFs(ClientData clientData, Tcl_Interp* interp, int argc, TCL_Char** argv) |
| 6950 | { |
| 6951 | if (argc < 2) { |
| 6952 | opserr << "WARNING want - constrainedDOFs cNode? <rNode?> <rDOF?>\n"; |
| 6953 | return TCL_ERROR; |
| 6954 | } |
| 6955 | |
| 6956 | int cNode; |
| 6957 | if (Tcl_GetInt(interp, argv[1], &cNode) != TCL_OK) { |
| 6958 | opserr << "WARNING constrainedDOFs cNode? <rNode?> <rDOF?> - could not read cNode? \n"; |
| 6959 | return TCL_ERROR; |
| 6960 | } |
| 6961 | |
| 6962 | int rNode; |
| 6963 | bool allNodes = 1; |
| 6964 | if (argc > 2) { |
| 6965 | if (Tcl_GetInt(interp, argv[2], &rNode) != TCL_OK) { |
| 6966 | opserr << "WARNING constrainedDOFs cNode? <rNode?> <rDOF?> - could not read rNode? \n"; |
| 6967 | return TCL_ERROR; |
| 6968 | } |
| 6969 | allNodes = 0; |
| 6970 | } |
| 6971 | |
| 6972 | int rDOF; |
| 6973 | bool allDOFs = 1; |
| 6974 | if (argc > 3) { |
| 6975 | if (Tcl_GetInt(interp, argv[3], &rDOF) != TCL_OK) { |
| 6976 | opserr << "WARNING constrainedDOFs cNode? <rNode?> <rDOF?> - could not read rDOF? \n"; |
| 6977 | return TCL_ERROR; |
| 6978 | } |
| 6979 | rDOF--; |
| 6980 | allDOFs = 0; |
| 6981 | } |
| 6982 | |
| 6983 | MP_Constraint* theMP; |
| 6984 | MP_ConstraintIter& mpIter = theDomain.getMPs(); |
| 6985 | |
| 6986 | int tag; |
| 6987 | int i; |
| 6988 | int n; |
| 6989 | Vector constrained(6); |
| 6990 | while ((theMP = mpIter()) != 0) { |
| 6991 | tag = theMP->getNodeConstrained(); |
| 6992 | if (tag == cNode) { |
| 6993 | if (allNodes || rNode == theMP->getNodeRetained()) { |
| 6994 | const ID &cDOFs = theMP->getConstrainedDOFs(); |
| 6995 | n = cDOFs.Size(); |
| 6996 | if (allDOFs) { |
| 6997 | for (i = 0; i < n; i++) { |
| 6998 | constrained(cDOFs(i)) = 1; |
| 6999 | } |
| 7000 | } |
| 7001 | else { |
| 7002 | const ID &rDOFs = theMP->getRetainedDOFs(); |
| 7003 | for (i = 0; i < n; i++) { |
| 7004 | if (rDOF == rDOFs(i)) |
| 7005 | constrained(cDOFs(i)) = 1; |
no test coverage detected