| 41 | #include <elementAPI.h> |
| 42 | |
| 43 | void *OPS_PulseSeries(void) |
| 44 | { |
| 45 | // Pointer to a uniaxial material that will be returned |
| 46 | TimeSeries *theSeries = 0; |
| 47 | |
| 48 | int numRemainingArgs = OPS_GetNumRemainingInputArgs(); |
| 49 | |
| 50 | if (numRemainingArgs < 3) { |
| 51 | opserr << " Pulse <tag?> tStart tFinish period <-width pulseWidth> <-phaseShift shift> <-factor cFactor> <-zeroShift shift>\n"; |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | int tag = 0; // default tag = 0 |
| 56 | double dData[7]; |
| 57 | dData[3] = 0.5; // default width = 0.5 |
| 58 | dData[4] = 0.0; // default phaseShift = 0.0 |
| 59 | dData[5] = 1.0; // default factor = 1.0 |
| 60 | dData[6] = 0.0; // default zeroShift = 0.0 |
| 61 | int numData = 0; |
| 62 | |
| 63 | // get tag if provided |
| 64 | if (numRemainingArgs == 4 || numRemainingArgs == 6 || numRemainingArgs == 8 || numRemainingArgs == 10 || numRemainingArgs == 12) { |
| 65 | numData = 1; |
| 66 | if (OPS_GetIntInput(&numData, &tag) != 0) { |
| 67 | opserr << "WARNING invalid series tag in Pulse tag?" << endln; |
| 68 | return 0; |
| 69 | } |
| 70 | numRemainingArgs -= 1; |
| 71 | } |
| 72 | |
| 73 | numData = 3; |
| 74 | if (OPS_GetDouble(&numData, dData) != 0) { |
| 75 | opserr << "WARNING invalid double data in Pulse Series with tag: " << tag << endln; |
| 76 | return 0; |
| 77 | } |
| 78 | numRemainingArgs -= 2; |
| 79 | |
| 80 | // parse the optional args |
| 81 | while (numRemainingArgs > 1) { |
| 82 | const char *argvS = OPS_GetString(); |
| 83 | |
| 84 | if (strcmp(argvS,"-width") == 0) { |
| 85 | numData = 1; |
| 86 | if (OPS_GetDouble(&numData, &dData[3]) != 0) { |
| 87 | opserr << "WARNING invalid width in Pulse Series with tag?" << tag << endln; |
| 88 | return 0; |
| 89 | } |
| 90 | } else if (strcmp(argvS,"-shift") == 0 || strcmp(argvS,"-phaseShift") == 0) { |
| 91 | numData = 1; |
| 92 | if (OPS_GetDouble(&numData, &dData[4]) != 0) { |
| 93 | opserr << "WARNING invalid phase shift in Pulse Series with tag?" << tag << endln; |
| 94 | return 0; |
| 95 | } |
| 96 | } else if (strcmp(argvS,"-factor") == 0) { |
| 97 | numData = 1; |
| 98 | if (OPS_GetDouble(&numData, &dData[5]) != 0) { |
| 99 | opserr << "WARNING invalid factor in Pulse Series with tag?" << tag << endln; |
| 100 | return 0; |
no test coverage detected