| 147 | |
| 148 | template <int ndm, typename Transform, typename Section> |
| 149 | static Element* |
| 150 | CreateFrame(BasicModelBuilder& builder, |
| 151 | const char* name, |
| 152 | int tag, |
| 153 | std::vector<int>& nodev, |
| 154 | int transfTag, |
| 155 | const std::vector<int>& section_tags, |
| 156 | BeamIntegration& beamIntegr, |
| 157 | double mass, int max_iter, double tol, |
| 158 | Options& options) |
| 159 | { |
| 160 | |
| 161 | std::vector<Section*> sections; |
| 162 | |
| 163 | // Finalize sections |
| 164 | assert(section_tags.size() != 0); |
| 165 | for (int tag : section_tags) { |
| 166 | Section *section = builder.getTypedObject<Section>(tag); |
| 167 | if (section == nullptr) |
| 168 | return nullptr; |
| 169 | sections.push_back(section); |
| 170 | } |
| 171 | int nIP = sections.size(); |
| 172 | |
| 173 | SectionForceDeformation** secptrs = (SectionForceDeformation**)(sections.data()); |
| 174 | |
| 175 | if (options.shear_flag == -1) { |
| 176 | options.shear_flag = 0; |
| 177 | const ID& resultants = sections[0]->getType(); |
| 178 | for (int i=0; i< sections[0]->getOrder(); i++) |
| 179 | if (resultants(i) == FrameStress::Vy) |
| 180 | options.shear_flag = 1; |
| 181 | } |
| 182 | |
| 183 | // Finalize the coordinate transform |
| 184 | CrdTransf* theTransf = builder.getTypedObject<CrdTransf>(transfTag); |
| 185 | if (theTransf == nullptr) { |
| 186 | opserr << OpenSees::PromptValueError << "transformation not found with tag " << transfTag << "\n"; |
| 187 | return nullptr; |
| 188 | } |
| 189 | |
| 190 | // |
| 191 | // Create the element |
| 192 | // |
| 193 | Element *theElement = nullptr; |
| 194 | |
| 195 | int iNode = nodev[0], |
| 196 | jNode = nodev[1]; |
| 197 | bool use_mass = options.use_mass; |
| 198 | |
| 199 | if constexpr (ndm == 2) { |
| 200 | |
| 201 | if (strcmp(name, "elasticForceBeamColumn") == 0) |
| 202 | theElement = new ElasticForceBeamColumn2d(tag, iNode, jNode, nIP, secptrs, beamIntegr, *theTransf, mass); |
| 203 | else if (strcmp(name, "timoshenkoBeamColumn") == 0) |
| 204 | theElement = |
| 205 | new TimoshenkoBeamColumn2d(tag, iNode, jNode, nIP, secptrs, beamIntegr, *theTransf, mass); |
| 206 | else if (strcmp(name, "dispBeamColumn") == 0) |