| 2091 | } |
| 2092 | |
| 2093 | int OPS_classType() |
| 2094 | { |
| 2095 | if (OPS_GetNumRemainingInputArgs() < 2) { |
| 2096 | opserr << "ERROR want - classType objectType tag?\n"; |
| 2097 | return -1; |
| 2098 | } |
| 2099 | |
| 2100 | std::string type = OPS_GetString(); |
| 2101 | int tag; |
| 2102 | int numdata = 1; |
| 2103 | |
| 2104 | if (OPS_GetIntInput(&numdata, &tag) < 0) { |
| 2105 | opserr << "ERROR classType objectType tag? - unable to read tag" << endln; |
| 2106 | return -1; |
| 2107 | } |
| 2108 | |
| 2109 | if (type == "uniaxialMaterial") { |
| 2110 | UniaxialMaterial *theMaterial = OPS_GetUniaxialMaterial(tag); |
| 2111 | if (theMaterial == 0) { |
| 2112 | opserr << "ERROR classType - uniaxialMaterial with tag " << tag << " not found" << endln; |
| 2113 | return -1; |
| 2114 | } |
| 2115 | |
| 2116 | std::string classType = theMaterial->getClassType(); |
| 2117 | if (OPS_SetString(classType.c_str()) < 0) { |
| 2118 | opserr << "ERROR failed to set classType" << endln; |
| 2119 | return -1; |
| 2120 | } |
| 2121 | } |
| 2122 | |
| 2123 | else if (type == "section") { |
| 2124 | SectionForceDeformation *theSection = OPS_getSectionForceDeformation(tag); |
| 2125 | if (theSection == 0) { |
| 2126 | opserr << "ERROR classType - section with tag " << tag << " not found" << endln; |
| 2127 | return -1; |
| 2128 | } |
| 2129 | |
| 2130 | std::string classType = theSection->getClassType(); |
| 2131 | if (OPS_SetString(classType.c_str()) < 0) { |
| 2132 | opserr << "ERROR failed to set classType" << endln; |
| 2133 | return -1; |
| 2134 | } |
| 2135 | } |
| 2136 | |
| 2137 | else if (type == "damping") { |
| 2138 | Damping *theDamping = OPS_getDamping(tag); |
| 2139 | if (theDamping == 0) { |
| 2140 | opserr << "ERROR classType - damping with tag " << tag << " not found" << endln; |
| 2141 | return -1; |
| 2142 | } |
| 2143 | |
| 2144 | std::string classType = theDamping->getClassType(); |
| 2145 | if (OPS_SetString(classType.c_str()) < 0) { |
| 2146 | opserr << "ERROR failed to set classType" << endln; |
| 2147 | return -1; |
| 2148 | } |
| 2149 | } |
| 2150 |
no test coverage detected