| 9582 | |
| 9583 | |
| 9584 | int |
| 9585 | defaultUnits(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv) |
| 9586 | { |
| 9587 | if (argc < 7) { |
| 9588 | opserr << "defaultUnits - missing a unit type want: defaultUnits -Force type? -Length type? -Time type?\n"; |
| 9589 | return -1; |
| 9590 | } |
| 9591 | |
| 9592 | const char *force = 0; |
| 9593 | const char *length = 0; |
| 9594 | const char *time = 0; |
| 9595 | const char *temperature = "N/A"; |
| 9596 | |
| 9597 | int count = 1; |
| 9598 | while (count < argc) { |
| 9599 | if ((strcmp(argv[count], "-force") == 0) || (strcmp(argv[count], "-Force") == 0) |
| 9600 | || (strcmp(argv[count], "-FORCE") == 0)) { |
| 9601 | force = argv[count + 1]; |
| 9602 | } |
| 9603 | else if ((strcmp(argv[count], "-length") == 0) || (strcmp(argv[count], "-Length") == 0) |
| 9604 | || (strcmp(argv[count], "-LENGTH") == 0)) { |
| 9605 | length = argv[count + 1]; |
| 9606 | } |
| 9607 | else if ((strcmp(argv[count], "-time") == 0) || (strcmp(argv[count], "-Time") == 0) |
| 9608 | || (strcmp(argv[count], "-TIME") == 0)) { |
| 9609 | time = argv[count + 1]; |
| 9610 | } |
| 9611 | else if ((strcmp(argv[count], "-temperature") == 0) || (strcmp(argv[count], "-Temperature") == 0) |
| 9612 | || (strcmp(argv[count], "-TEMPERATURE") == 0) || (strcmp(argv[count], "-temp") == 0) |
| 9613 | || (strcmp(argv[count], "-Temp") == 0) || (strcmp(argv[count], "-TEMP") == 0)) { |
| 9614 | temperature = argv[count + 1]; |
| 9615 | } |
| 9616 | else { |
| 9617 | opserr << "defaultUnits - unrecognized unit: " << argv[count] << " want: defaultUnits -Force type? -Length type? -Time type?\n"; |
| 9618 | return -1; |
| 9619 | } |
| 9620 | count += 2; |
| 9621 | } |
| 9622 | |
| 9623 | if (length == 0 || force == 0 || time == 0) { |
| 9624 | opserr << "defaultUnits - missing a unit type want: defaultUnits -Force type? -Length type? -Time type?\n"; |
| 9625 | return -1; |
| 9626 | } |
| 9627 | |
| 9628 | double lb, kip, n, kn, mn, kgf, tonf; |
| 9629 | double in, ft, mm, cm, m; |
| 9630 | double sec, msec; |
| 9631 | |
| 9632 | if ((strcmp(force, "lb") == 0) || (strcmp(force, "lbs") == 0)) { |
| 9633 | lb = 1.0; |
| 9634 | } |
| 9635 | else if ((strcmp(force, "kip") == 0) || (strcmp(force, "kips") == 0)) { |
| 9636 | lb = 0.001; |
| 9637 | } |
| 9638 | else if ((strcmp(force, "N") == 0)) { |
| 9639 | lb = 4.4482216152605; |
| 9640 | } |
| 9641 | else if ((strcmp(force, "kN") == 0) || (strcmp(force, "KN") == 0) || (strcmp(force, "kn") == 0)) { |
no test coverage detected