| 29 | namespace DomainCommands { |
| 30 | |
| 31 | int |
| 32 | modalProperties(ClientData clientData, |
| 33 | Tcl_Interp *interp, Tcl_Size argc, TCL_Char ** const argv) |
| 34 | { |
| 35 | // modalProperties <-print> <-file $fileName> <-unorm> |
| 36 | |
| 37 | // some kudos |
| 38 | static bool first_done = false; |
| 39 | if (!first_done) { |
| 40 | opserr << "Using DomainModalProperties - Developed by: Massimo Petracca, Guido Camata, ASDEA Software Technology\n"; |
| 41 | first_done = true; |
| 42 | } |
| 43 | |
| 44 | // init default values |
| 45 | bool unorm = false; // by default do not displacement-normalize eigenvectors |
| 46 | bool print_on_console = false; // by default do not print on console |
| 47 | bool print_on_file = false; // by default do no print on file |
| 48 | std::string fname; |
| 49 | |
| 50 | // check options |
| 51 | int loc = 1; |
| 52 | while (loc < argc) { |
| 53 | if (strcmp(argv[loc], "-unorm") == 0) { |
| 54 | unorm = true; |
| 55 | } |
| 56 | else if (strcmp(argv[loc], "-print") == 0) { |
| 57 | print_on_console = true; |
| 58 | } |
| 59 | else if (strcmp(argv[loc], "-file") == 0) { |
| 60 | print_on_file = true; |
| 61 | if (loc < argc - 1) { |
| 62 | ++loc; |
| 63 | fname = argv[loc]; |
| 64 | } |
| 65 | else { |
| 66 | opserr << "Error in modalProperties; " |
| 67 | "After the keyword -file you should specify the file name.\n"; |
| 68 | return TCL_ERROR; |
| 69 | } |
| 70 | } |
| 71 | ++loc; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | Domain* domain = static_cast<Domain*>(clientData); |
| 76 | |
| 77 | // create the modal properties, compute them, |
| 78 | // and add them to the domain |
| 79 | DomainModalProperties *modal_props = new DomainModalProperties(domain, unorm); |
| 80 | if (!modal_props->compute()) |
| 81 | return TCL_ERROR; |
| 82 | // domain->setModalProperties(modal_props); |
| 83 | |
| 84 | // report |
| 85 | if (print_on_console) |
| 86 | modal_props->print(); |
| 87 | |
| 88 | if (print_on_file) |