| 53 | #include <elementAPI.h> |
| 54 | |
| 55 | void* OPS_LoadPattern() |
| 56 | { |
| 57 | if(OPS_GetNumRemainingInputArgs() < 2) { |
| 58 | opserr<<"insufficient number of args\n"; |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | LoadPattern *thePattern = 0; |
| 63 | |
| 64 | // get tags |
| 65 | int tags[2]; |
| 66 | int numData = 2; |
| 67 | if(OPS_GetIntInput(&numData, &tags[0]) < 0) { |
| 68 | opserr << "WARNING failed to get load pattern tag\n"; |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | // get factor |
| 73 | double fact = 1.0; |
| 74 | if(OPS_GetNumRemainingInputArgs() > 1) { |
| 75 | std::string type = OPS_GetString(); |
| 76 | if(type=="-fact" || type=="-factor") { |
| 77 | numData = 1; |
| 78 | if(OPS_GetDoubleInput(&numData,&fact) < 0) { |
| 79 | opserr << "WARNING failed to get load pattern factor\n"; |
| 80 | return 0; |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | // create pattern |
| 86 | thePattern = new LoadPattern(tags[0], fact); |
| 87 | TimeSeries *theSeries = OPS_getTimeSeries(tags[1]); |
| 88 | |
| 89 | // check |
| 90 | if(thePattern == 0 || theSeries == 0) { |
| 91 | |
| 92 | if(thePattern == 0) { |
| 93 | opserr << "WARNING - out of memory creating LoadPattern \n"; |
| 94 | } else { |
| 95 | opserr << "WARNING - problem creating TimeSeries for LoadPattern \n"; |
| 96 | } |
| 97 | |
| 98 | // clean up the memory and return an error |
| 99 | if(thePattern != 0) |
| 100 | delete thePattern; |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | thePattern->setTimeSeries(theSeries); |
| 105 | |
| 106 | return thePattern; |
| 107 | } |
| 108 | |
| 109 | LoadPattern::LoadPattern(int tag, int clasTag, double fact) |
| 110 | :DomainComponent(tag,clasTag), |
no test coverage detected