00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <stdlib.h>
00035 #include <string.h>
00036
00037 #include <BeamColumnJoint2d.h>
00038 #include <BeamColumnJoint3d.h>
00039 #include <Information.h>
00040 #include <ElementResponse.h>
00041
00042 #include <Domain.h>
00043 #include <Node.h>
00044 #include <Channel.h>
00045 #include <FEM_ObjectBroker.h>
00046 #include <Renderer.h>
00047 #include <UniaxialMaterial.h>
00048 #include <TclModelBuilder.h>
00049
00050 extern void printCommand(int argc, TCL_Char **argv);
00051 static Domain *theTclModelBuilderDomain = 0;
00052 static TclModelBuilder *theTclModelBuilder =0;
00053
00054 int TclModelBuilder_addBeamColumnJoint(ClientData clientData, Tcl_Interp *interp, int argc,
00055 TCL_Char **argv, Domain* theTclDomain,
00056 TclModelBuilder *theTclBuilder, int eleArgStart)
00057 {
00058
00059 if (theTclBuilder == 0) {
00060 opserr << "Warning builder has been destroyed \n";
00061 return TCL_ERROR;
00062 }
00063
00064 theTclModelBuilderDomain = theTclDomain;
00065 theTclModelBuilder = theTclBuilder;
00066
00067 int NDM, NDF;
00068
00069 NDM = theTclModelBuilder->getNDM();
00070 NDF = theTclModelBuilder->getNDF();
00071
00072
00073 if ((NDM == 2 && NDF == 3) || (NDM == 3 && NDF == 6)) {
00074
00075
00076 if ((argc-eleArgStart) != 19 && (argc-eleArgStart) != 21)
00077 {
00078 opserr << "WARNING insufficient arguments\n";
00079 printCommand(argc,argv);
00080 opserr << "Want: element beamColumnJoint eleTag? node1? node2? node3? node4? matTag1? matTag2? matTag3?\n";
00081 opserr << "matTag4? matTag5? matTag6? matTag7? matTag8? matTag9? matTag10? matTag11? matTag12? matTag13?\n";
00082 opserr << "<ElementHeightFactor? ElementWidthFactor?>\n";
00083
00084 return TCL_ERROR;
00085 }
00086
00087 int id, nd1, nd2, nd3, nd4, matId1, matId2, matId3, matId4, matId5, matId6, matId7, matId8, matId9, matId10;
00088 int matId11, matId12, matId13;
00089 double hgtfac, wdtfac;
00090
00091 UniaxialMaterial *theMaterial1 = 0;
00092 UniaxialMaterial *theMaterial2 = 0;
00093 UniaxialMaterial *theMaterial3 = 0;
00094 UniaxialMaterial *theMaterial4 = 0;
00095 UniaxialMaterial *theMaterial5 = 0;
00096 UniaxialMaterial *theMaterial6 = 0;
00097 UniaxialMaterial *theMaterial7 = 0;
00098 UniaxialMaterial *theMaterial8 = 0;
00099 UniaxialMaterial *theMaterial9 = 0;
00100 UniaxialMaterial *theMaterial10 = 0;
00101 UniaxialMaterial *theMaterial11 = 0;
00102 UniaxialMaterial *theMaterial12 = 0;
00103 UniaxialMaterial *theMaterial13 = 0;
00104
00105 if (Tcl_GetInt(interp, argv[1+eleArgStart], &id) != TCL_OK)
00106 {
00107 opserr << "WARNING invalid beamColumnJoint eleTag" << endln;
00108 return TCL_ERROR;
00109 }
00110 if (Tcl_GetInt(interp, argv[2+eleArgStart], &nd1) != TCL_OK)
00111 {
00112 opserr << "WARNING invalid Node 1\n";
00113 opserr << "beamColumnJoint Element: " << id <<endln;
00114 return TCL_ERROR;
00115 }
00116 if (Tcl_GetInt(interp, argv[3+eleArgStart], &nd2) != TCL_OK)
00117 {
00118 opserr << "WARNING invalid Node 2\n";
00119 opserr << "beamColumnJoint Element: " << id <<endln;
00120 return TCL_ERROR;
00121 }
00122 if (Tcl_GetInt(interp, argv[4+eleArgStart], &nd3) != TCL_OK)
00123 {
00124 opserr << "WARNING invalid Node 3\n";
00125 opserr << "beamColumnJoint Element: " << id <<endln;
00126 return TCL_ERROR;
00127 }
00128 if (Tcl_GetInt(interp, argv[5+eleArgStart], &nd4) != TCL_OK)
00129 {
00130 opserr << "WARNING invalid Node 4\n";
00131 opserr << "beamColumnJoint Element: " << id <<endln;
00132 return TCL_ERROR;
00133 }
00134 if (Tcl_GetInt(interp, argv[6+eleArgStart], &matId1) != TCL_OK)
00135 {
00136 opserr << "WARNING invalid Material Tag 1\n";
00137 opserr << "beamColumnJoint Element: " << id <<endln;
00138 return TCL_ERROR;
00139 }
00140 if (Tcl_GetInt(interp, argv[7+eleArgStart], &matId2) != TCL_OK)
00141 {
00142 opserr << "WARNING invalid Material Tag 2\n";
00143 opserr << "beamColumnJoint Element: " << id <<endln;
00144 return TCL_ERROR;
00145 }
00146 if (Tcl_GetInt(interp, argv[8+eleArgStart], &matId3) != TCL_OK)
00147 {
00148 opserr << "WARNING invalid Material Tag 3\n";
00149 opserr << "beamColumnJoint Element: " << id <<endln;
00150 return TCL_ERROR;
00151 }
00152 if (Tcl_GetInt(interp, argv[9+eleArgStart], &matId4) != TCL_OK)
00153 {
00154 opserr << "WARNING invalid Material Tag 4\n";
00155 opserr << "beamColumnJoint Element: " << id <<endln;
00156 return TCL_ERROR;
00157 }
00158 if (Tcl_GetInt(interp, argv[10+eleArgStart], &matId5) != TCL_OK)
00159 {
00160 opserr << "WARNING invalid Material Tag 5\n";
00161 opserr << "beamColumnJoint Element: " << id <<endln;
00162 return TCL_ERROR;
00163 }
00164 if (Tcl_GetInt(interp, argv[11+eleArgStart], &matId6) != TCL_OK)
00165 {
00166 opserr << "WARNING invalid Material Tag 6\n";
00167 opserr << "beamColumnJoint Element: " << id <<endln;
00168 return TCL_ERROR;
00169 }
00170 if (Tcl_GetInt(interp, argv[12+eleArgStart], &matId7) != TCL_OK)
00171 {
00172 opserr << "WARNING invalid Material Tag 7\n";
00173 opserr << "beamColumnJoint Element: " << id <<endln;
00174 return TCL_ERROR;
00175 }
00176 if (Tcl_GetInt(interp, argv[13+eleArgStart], &matId8) != TCL_OK)
00177 {
00178 opserr << "WARNING invalid Material Tag 8\n";
00179 opserr << "beamColumnJoint Element: " << id <<endln;
00180 return TCL_ERROR;
00181 }
00182 if (Tcl_GetInt(interp, argv[14+eleArgStart], &matId9) != TCL_OK)
00183 {
00184 opserr << "WARNING invalid Material Tag 9\n";
00185 opserr << "beamColumnJoint Element: " << id <<endln;
00186 return TCL_ERROR;
00187 }
00188 if (Tcl_GetInt(interp, argv[15+eleArgStart], &matId10) != TCL_OK)
00189 {
00190 opserr << "WARNING invalid Material Tag 10\n";
00191 opserr << "beamColumnJoint Element: " << id <<endln;
00192 return TCL_ERROR;
00193 }
00194 if (Tcl_GetInt(interp, argv[16+eleArgStart], &matId11) != TCL_OK)
00195 {
00196 opserr << "WARNING invalid Material Tag 11\n";
00197 opserr << "beamColumnJoint Element: " << id <<endln;
00198 return TCL_ERROR;
00199 }
00200 if (Tcl_GetInt(interp, argv[17+eleArgStart], &matId12) != TCL_OK)
00201 {
00202 opserr << "WARNING invalid Material Tag 12\n";
00203 opserr << "beamColumnJoint Element: " << id <<endln;
00204 return TCL_ERROR;
00205 }
00206 if (Tcl_GetInt(interp, argv[18+eleArgStart], &matId13) != TCL_OK)
00207 {
00208 opserr << "WARNING invalid Material Tag 13\n";
00209 opserr << "beamColumnJoint Element: " << id <<endln;
00210 return TCL_ERROR;
00211 }
00212
00213
00214 if ((argc-eleArgStart) == 21)
00215 {
00216 if (Tcl_GetDouble(interp, argv[19+eleArgStart], &hgtfac) != TCL_OK)
00217 {
00218 opserr << "WARNING invalid factor for height\n";
00219 opserr << "beamColumnJoint Element: " << id <<endln;
00220 return TCL_ERROR;
00221 }
00222 if (Tcl_GetDouble(interp, argv[20+eleArgStart], &wdtfac) != TCL_OK)
00223 {
00224 opserr << "WARNING invalid factor for width\n";
00225 opserr << "beamColumnJoint Element: " << id <<endln;
00226 return TCL_ERROR;
00227 }
00228 }
00229
00230 if (matId1 != 0)
00231 {
00232 theMaterial1 = theTclBuilder->getUniaxialMaterial(matId1);
00233
00234 if (theMaterial1 == 0) {
00235 opserr << "WARNING material not found\n";
00236 opserr << "Material: " << matId1;
00237 opserr << "\nbeamColumnJoint element: " << id << endln;
00238 return TCL_ERROR;
00239 }
00240 } else theMaterial1 = 0;
00241
00242 if (matId2 != 0)
00243 {
00244 theMaterial2 = theTclBuilder->getUniaxialMaterial(matId2);
00245
00246 if (theMaterial2 == 0) {
00247 opserr << "WARNING material not found\n";
00248 opserr << "Material: " << matId2;
00249 opserr << "\nbeamColumnJoint element: " << id << endln;
00250 return TCL_ERROR;
00251 }
00252 } else theMaterial2 = 0;
00253
00254 if (matId3 != 0)
00255 {
00256 theMaterial3 = theTclBuilder->getUniaxialMaterial(matId3);
00257
00258 if (theMaterial3 == 0) {
00259 opserr << "WARNING material not found\n";
00260 opserr << "Material: " << matId3;
00261 opserr << "\nbeamColumnJoint element: " << id << endln;
00262 return TCL_ERROR;
00263 }
00264 } else theMaterial3 = 0;
00265
00266 if (matId4 != 0)
00267 {
00268 theMaterial4 = theTclBuilder->getUniaxialMaterial(matId4);
00269
00270 if (theMaterial4 == 0) {
00271 opserr << "WARNING material not found\n";
00272 opserr << "Material: " << matId4;
00273 opserr << "\nbeamColumnJoint element: " << id << endln;
00274 return TCL_ERROR;
00275 }
00276 } else theMaterial4 = 0;
00277
00278 if (matId5 != 0)
00279 {
00280 theMaterial5 = theTclBuilder->getUniaxialMaterial(matId5);
00281
00282 if (theMaterial5 == 0) {
00283 opserr << "WARNING material not found\n";
00284 opserr << "Material: " << matId5;
00285 opserr << "\nbeamColumnJoint element: " << id << endln;
00286 return TCL_ERROR;
00287 }
00288 } else theMaterial5 = 0;
00289
00290 if (matId6 != 0)
00291 {
00292 theMaterial6 = theTclBuilder->getUniaxialMaterial(matId6);
00293
00294 if (theMaterial6 == 0) {
00295 opserr << "WARNING material not found\n";
00296 opserr << "Material: " << matId6;
00297 opserr << "\nbeamColumnJoint element: " << id << endln;
00298 return TCL_ERROR;
00299 }
00300 } else theMaterial6 = 0;
00301
00302 if (matId7 != 0)
00303 {
00304 theMaterial7 = theTclBuilder->getUniaxialMaterial(matId7);
00305
00306 if (theMaterial7 == 0) {
00307 opserr << "WARNING material not found\n";
00308 opserr << "Material: " << matId7;
00309 opserr << "\nbeamColumnJoint element: " << id << endln;
00310 return TCL_ERROR;
00311 }
00312 } else theMaterial7 = 0;
00313
00314 if (matId8 != 0)
00315 {
00316 theMaterial8 = theTclBuilder->getUniaxialMaterial(matId8);
00317
00318 if (theMaterial8 == 0) {
00319 opserr << "WARNING material not found\n";
00320 opserr << "Material: " << matId8;
00321 opserr << "\nbeamColumnJoint element: " << id << endln;
00322 return TCL_ERROR;
00323 }
00324 } else theMaterial8 = 0;
00325
00326 if (matId9 != 0)
00327 {
00328 theMaterial9 = theTclBuilder->getUniaxialMaterial(matId9);
00329
00330 if (theMaterial9 == 0) {
00331 opserr << "WARNING material not found\n";
00332 opserr << "Material: " << matId9;
00333 opserr << "\nbeamColumnJoint element: " << id << endln;
00334 return TCL_ERROR;
00335 }
00336 } else theMaterial9 = 0;
00337
00338
00339 if (matId10 != 0)
00340 {
00341 theMaterial10 = theTclBuilder->getUniaxialMaterial(matId10);
00342
00343 if (theMaterial10 == 0) {
00344 opserr << "WARNING material not found\n";
00345 opserr << "Material: " << matId10;
00346 opserr << "\nbeamColumnJoint element: " << id << endln;
00347 return TCL_ERROR;
00348 }
00349 } else theMaterial10 = 0;
00350
00351 if (matId11 != 0)
00352 {
00353 theMaterial11 = theTclBuilder->getUniaxialMaterial(matId11);
00354
00355 if (theMaterial11 == 0) {
00356 opserr << "WARNING material not found\n";
00357 opserr << "Material: " << matId11;
00358 opserr << "\nbeamColumnJoint element: " << id << endln;
00359 return TCL_ERROR;
00360 }
00361 } else theMaterial11 = 0;
00362
00363 if (matId12 != 0)
00364 {
00365 theMaterial12 = theTclBuilder->getUniaxialMaterial(matId12);
00366
00367 if (theMaterial12 == 0) {
00368 opserr << "WARNING material not found\n";
00369 opserr << "Material: " << matId12;
00370 opserr << "\nbeamColumnJoint element: " << id << endln;
00371 return TCL_ERROR;
00372 }
00373 } else theMaterial12 = 0;
00374
00375 if (matId13 != 0)
00376 {
00377 theMaterial13 = theTclBuilder->getUniaxialMaterial(matId13);
00378
00379 if (theMaterial13 == 0) {
00380 opserr << "WARNING material not found\n";
00381 opserr << "Material: " << matId13;
00382 opserr << "\nbeamColumnJoint element: " << id << endln;
00383 return TCL_ERROR;
00384 }
00385 } else theMaterial13 = 0;
00386
00387
00388 Element *theBeamColumnJoint = 0;
00389
00390 if (NDM == 2)
00391 {
00392 if ((argc-eleArgStart) == 19) {
00393 theBeamColumnJoint = new BeamColumnJoint2d(id,nd1,nd2,nd3,nd4,*theMaterial1,*theMaterial2,
00394 *theMaterial3,*theMaterial4,*theMaterial5,*theMaterial6,*theMaterial7,*theMaterial8,
00395 *theMaterial9,*theMaterial10,*theMaterial11,*theMaterial12,*theMaterial13);
00396 } else if ((argc-eleArgStart) == 21) {
00397 theBeamColumnJoint = new BeamColumnJoint2d(id,nd1,nd2,nd3,nd4,*theMaterial1,*theMaterial2,
00398 *theMaterial3,*theMaterial4,*theMaterial5,*theMaterial6,*theMaterial7,*theMaterial8,
00399 *theMaterial9,*theMaterial10,*theMaterial11,*theMaterial12,*theMaterial13, hgtfac, wdtfac);
00400 }
00401 }
00402 else if (NDM == 3)
00403 {
00404 if ((argc-eleArgStart) == 19) {
00405 theBeamColumnJoint = new BeamColumnJoint3d(id,nd1,nd2,nd3,nd4,*theMaterial1,*theMaterial2,
00406 *theMaterial3,*theMaterial4,*theMaterial5,*theMaterial6,*theMaterial7,*theMaterial8,
00407 *theMaterial9,*theMaterial10,*theMaterial11,*theMaterial12,*theMaterial13);
00408 } else if ((argc-eleArgStart) == 21) {
00409 theBeamColumnJoint = new BeamColumnJoint3d(id,nd1,nd2,nd3,nd4,*theMaterial1,*theMaterial2,
00410 *theMaterial3,*theMaterial4,*theMaterial5,*theMaterial6,*theMaterial7,*theMaterial8,
00411 *theMaterial9,*theMaterial10,*theMaterial11,*theMaterial12,*theMaterial13, hgtfac, wdtfac);
00412 }
00413 }
00414
00415 if (theBeamColumnJoint == 0)
00416 {
00417 opserr << "WARNING ran out of memory creating elements\n";
00418 opserr << "beamColumnJoint element: " << id <<endln;
00419 return TCL_ERROR;
00420 }
00421
00422 if (theTclDomain->addElement(theBeamColumnJoint) == false)
00423 {
00424 opserr << "WARNING could not add element to the domain\n";
00425 opserr << "beamColumnJoint element: " << id << endln;
00426 delete theBeamColumnJoint;
00427 return TCL_ERROR;
00428 }
00429
00430 }
00431 else {
00432 opserr << "WARNING NDM = " << NDM << " and NDF = " << NDF << "is imcompatible with available frame elements";
00433 return TCL_ERROR;
00434 }
00435
00436
00437 return TCL_OK;
00438 }