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