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
00035 extern "C" {
00036 #include <tcl.h>
00037 EXTERN int Tcl_SetObjCmd _ANSI_ARGS_((ClientData clientData,
00038 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
00039
00040 }
00041
00042 #include <OPS_Globals.h>
00043 #include <SimulationInformation.h>
00044 extern SimulationInformation simulationInfo;
00045
00046
00047 #ifdef _USING_STL_STREAMS
00048
00049 #include <iomanip>
00050 using std::ios;
00051 #include <iostream>
00052 using std::ofstream;
00053
00054 #else
00055
00056 #include <StandardStream.h>
00057 #include <FileStream.h>
00058 StandardStream sserr;
00059
00060 OPS_Stream *opserrPtr = &sserr;
00061
00062 #endif
00063
00064 #include <stdio.h>
00065 #include <stdlib.h>
00066 #include <string.h>
00067
00068 #include <packages.h>
00069
00070 #include <FEM_ObjectBroker.h>
00071 #include <RigidRod.h>
00072 #include <RigidBeam.h>
00073 #include <RigidDiaphragm.h>
00074
00075 #include <Timer.h>
00076 #include <ModelBuilder.h>
00077 #include "commands.h"
00078
00079
00080 #ifdef _PARALLEL_PROCESSING
00081 #include <PartitionedDomain.h>
00082 #else
00083 #include <Domain.h>
00084 #endif
00085
00086 #include <Element.h>
00087 #include <Node.h>
00088 #include <ElementIter.h>
00089 #include <NodeIter.h>
00090 #include <LoadPattern.h>
00091 #include <LoadPatternIter.h>
00092 #include <ElementalLoad.h>
00093 #include <ElementalLoadIter.h>
00094 #include <SP_Constraint.h>
00095 #include <SP_ConstraintIter.h>
00096
00097
00098
00099 #include <AnalysisModel.h>
00100
00101
00102 #include <CTestNormUnbalance.h>
00103 #include <CTestNormDispIncr.h>
00104 #include <CTestEnergyIncr.h>
00105 #include <CTestRelativeNormUnbalance.h>
00106 #include <CTestRelativeNormDispIncr.h>
00107 #include <CTestRelativeEnergyIncr.h>
00108 #include <CTestRelativeTotalNormDispIncr.h>
00109 #include <CTestFixedNumIter.h>
00110
00111
00112 #include <Linear.h>
00113 #include <NewtonRaphson.h>
00114 #include <NewtonLineSearch.h>
00115 #include <ModifiedNewton.h>
00116 #include <FrequencyAlgo.h>
00117 #include <StandardEigenAlgo.h>
00118 #include <Broyden.h>
00119 #include <BFGS.h>
00120 #include <KrylovNewton.h>
00121 #include <PeriodicNewton.h>
00122
00123
00124
00125 #include <BisectionLineSearch.h>
00126 #include <InitialInterpolatedLineSearch.h>
00127 #include <RegulaFalsiLineSearch.h>
00128 #include <SecantLineSearch.h>
00129
00130
00131 #include <PlainHandler.h>
00132 #include <PenaltyConstraintHandler.h>
00133
00134 #include <LagrangeConstraintHandler.h>
00135 #include <TransformationConstraintHandler.h>
00136
00137
00138 #include <PlainNumberer.h>
00139 #include <DOF_Numberer.h>
00140
00141
00142 #include <LoadControl.h>
00143 #include <ArcLength.h>
00144 #include <ArcLength1.h>
00145
00146 #include <HSConstraint.h>
00147
00148 #include <MinUnbalDispNorm.h>
00149 #include <DisplacementControl.h>
00150 #include <Newmark.h>
00151 #include <WilsonTheta.h>
00152 #include <HHT.h>
00153 #include <HHT1.h>
00154 #include <Newmark1.h>
00155 #include <EigenIntegrator.h>
00156 #include <CentralDifferenceAlternative.h>
00157 #include <CentralDifferenceNoDamping.h>
00158 #include <CentralDifference.h>
00159 #include <NewmarkExplicit.h>
00160 #include <NewmarkHybridSimulation.h>
00161 #include <HHTExplicit.h>
00162 #include <HHTGeneralized.h>
00163 #include <HHTGeneralizedExplicit.h>
00164 #include <HHTHybridSimulation.h>
00165 #include <AlphaOS.h>
00166 #include <AlphaOSGeneralized.h>
00167 #include <Collocation.h>
00168 #include <CollocationHybridSimulation.h>
00169
00170
00171
00172 #include <StaticAnalysis.h>
00173 #include <DirectIntegrationAnalysis.h>
00174 #include <VariableTimeStepDirectIntegrationAnalysis.h>
00175 #include <EigenAnalysis.h>
00176
00177
00178 #include <BandSPDLinSOE.h>
00179 #include <BandSPDLinLapackSolver.h>
00180
00181 #include <BandGenLinSOE.h>
00182 #include <BandGenLinLapackSolver.h>
00183
00184 #include <ConjugateGradientSolver.h>
00185
00186 #include <FullGenLinSOE.h>
00187 #include <FullGenLinLapackSolver.h>
00188
00189 #include <ProfileSPDLinSOE.h>
00190 #include <ProfileSPDLinDirectSolver.h>
00191 #include <DiagonalSOE.h>
00192 #include <DiagonalDirectSolver.h>
00193
00194
00195
00196
00197
00198
00199 #include <SparseGenColLinSOE.h>
00200 #ifdef _THREADS
00201 #include <ThreadedSuperLU.h>
00202 #else
00203 #include <SuperLU.h>
00204 #endif
00205
00206
00207 #ifdef _MUMPS
00208 #ifdef _PARALLEL_PROCESSING
00209 #include <MumpsParallelSOE.h>
00210 #include <MumpsParallelSolver.h>
00211 #else
00212 #include <MumpsSOE.h>
00213 #include <MumpsSolver.h>
00214 #endif
00215 #endif
00216
00217 #ifdef _PETSC
00218 #include <PetscSOE.h>
00219 #include <PetscSolver.h>
00220 #include <SparseGenRowLinSOE.h>
00221 #include <PetscSparseSeqSolver.h>
00222 #endif
00223
00224 #include <SymSparseLinSOE.h>
00225 #include <SymSparseLinSolver.h>
00226 #include <UmfpackGenLinSOE.h>
00227 #include <UmfpackGenLinSolver.h>
00228
00229 #include <EigenSOE.h>
00230 #include <EigenSolver.h>
00231 #include <SymArpackSOE.h>
00232 #include <SymArpackSolver.h>
00233 #include <BandArpackSOE.h>
00234 #include <BandArpackSolver.h>
00235 #include <SymBandEigenSOE.h>
00236 #include <SymBandEigenSolver.h>
00237
00238
00239
00240 #include <RCM.h>
00241
00242 #include <ErrorHandler.h>
00243 #include <ConsoleErrorHandler.h>
00244
00245 #ifdef _NOGRAPHICS
00246
00247 #else
00248 #include <TclVideoPlayer.h>
00249 #endif
00250
00251 #include <FE_Datastore.h>
00252
00253 #ifdef _RELIABILITY
00254
00255 #include <ReliabilityDomain.h>
00256 #include <SensitivityAlgorithm.h>
00257 #include <SensitivityIntegrator.h>
00258 #include <StaticSensitivityIntegrator.h>
00259
00260 #include <NewmarkSensitivityIntegrator.h>
00261 #include <RandomVariablePositioner.h>
00262
00263 #include <TclReliabilityBuilder.h>
00264 static TclReliabilityBuilder *theReliabilityBuilder = 0;
00265 int reliability(ClientData, Tcl_Interp *, int, TCL_Char **);
00266 int wipeReliability(ClientData, Tcl_Interp *, int, TCL_Char **);
00267 #endif
00268
00269 ModelBuilder *theBuilder =0;
00270
00271
00272 #ifdef _PARALLEL_PROCESSING
00273 #include <DistributedDisplacementControl.h>
00274 #include <ShadowSubdomain.h>
00275 #include <Metis.h>
00276 #include <ShedHeaviest.h>
00277 #include <DomainPartitioner.h>
00278 #include <GraphPartitioner.h>
00279 #include <FEM_ObjectBroker.h>
00280 #include <Subdomain.h>
00281 #include <SubdomainIter.h>
00282 #include <MachineBroker.h>
00283
00284
00285 #include <StaticDomainDecompositionAnalysis.h>
00286 #include <TransientDomainDecompositionAnalysis.h>
00287 #include <ParallelNumberer.h>
00288
00289
00290 #include <DistributedBandSPDLinSOE.h>
00291 #include <DistributedSparseGenColLinSOE.h>
00292 #include <DistributedSparseGenRowLinSOE.h>
00293 #include <DistributedBandGenLinSOE.h>
00294 #include <DistributedDiagonalSOE.h>
00295 #include <DistributedDiagonalSolver.h>
00296
00297 #define MPIPP_H
00298 #include <DistributedSuperLU.h>
00299 #include <DistributedProfileSPDLinSOE.h>
00300
00301 PartitionedDomain theDomain;
00302 int OPS_PARALLEL_PROCESSING =0;
00303 int OPS_NUM_SUBDOMAINS =0;
00304 bool OPS_PARTITIONED =false;
00305 bool OPS_USING_MAIN_DOMAIN = false;
00306 int OPS_MAIN_DOMAIN_PARTITION_ID =0;
00307
00308 DomainPartitioner *OPS_DOMAIN_PARTITIONER =0;
00309 GraphPartitioner *OPS_GRAPH_PARTITIONER =0;
00310 LoadBalancer *OPS_BALANCER = 0;
00311 FEM_ObjectBroker *OPS_OBJECT_BROKER;
00312 MachineBroker *OPS_MACHINE;
00313 Channel **OPS_theChannels = 0;
00314
00315 #else
00316
00317 Domain theDomain;
00318
00319 #endif
00320
00321
00322 #ifdef _PARALLEL_INTERPRETERS
00323 #include <MachineBroker.h>
00324 extern MachineBroker *theMachineBroker;
00325 #endif
00326
00327
00328 #ifdef _PARALLEL_PROCESSING
00329 #include <MachineBroker.h>
00330 extern MachineBroker *theMachineBroker;
00331 #endif
00332
00333
00334
00335 static AnalysisModel *theAnalysisModel =0;
00336 static EquiSolnAlgo *theAlgorithm =0;
00337 static ConstraintHandler *theHandler =0;
00338 static DOF_Numberer *theNumberer =0;
00339 static LinearSOE *theSOE =0;
00340 static StaticAnalysis *theStaticAnalysis = 0;
00341 static DirectIntegrationAnalysis *theTransientAnalysis = 0;
00342 static VariableTimeStepDirectIntegrationAnalysis *theVariableTimeStepTransientAnalysis = 0;
00343
00344
00345 #ifdef _RELIABILITY
00346 SensitivityAlgorithm *theSensitivityAlgorithm = 0;
00347 static SensitivityIntegrator *theSensitivityIntegrator = 0;
00348 static NewmarkSensitivityIntegrator *theNSI = 0;
00349 #endif
00350
00351
00352 static StaticIntegrator *theStaticIntegrator =0;
00353 static TransientIntegrator *theTransientIntegrator =0;
00354 static ConvergenceTest *theTest =0;
00355 static bool builtModel = false;
00356
00357 static EigenAnalysis *theEigenAnalysis = 0;
00358
00359 static char *resDataPtr = 0;
00360 static int resDataSize = 0;
00361 static Timer *theTimer = 0;
00362
00363 FE_Datastore *theDatabase =0;
00364 FEM_ObjectBroker theBroker;
00365
00366
00367 double ops_Dt = 1.0;
00368 Domain *ops_TheActiveDomain = 0;
00369 Element *ops_TheActiveElement = 0;
00370
00371 #ifdef _NOGRAPHICS
00372
00373 #else
00374 TclVideoPlayer *theTclVideoPlayer =0;
00375 #endif
00376
00377
00378
00379
00380
00381 int
00382 logFile(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv);
00383
00384 int
00385 getPID(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv);
00386
00387 int
00388 getNP(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv);
00389
00390 extern int OpenSeesExit(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv);
00391
00392 extern int myCommands(Tcl_Interp *interp);
00393
00394 int g3AppInit(Tcl_Interp *interp) {
00395
00396 #ifndef _LINUX
00397 opserr.setFloatField(SCIENTIFIC);
00398 opserr.setFloatField(FIXEDD);
00399 #endif
00400 Tcl_CreateObjCommand(interp, "pset", &OPS_SetObjCmd,
00401 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00402 Tcl_CreateCommand(interp, "source", &OPS_SourceCmd,
00403 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00404 Tcl_CreateCommand(interp, "wipe", &wipeModel,
00405 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00406 Tcl_CreateCommand(interp, "wipeAnalysis", &wipeAnalysis,
00407 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00408 Tcl_CreateCommand(interp, "reset", &resetModel,
00409 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00410 Tcl_CreateCommand(interp, "initialize", &initializeAnalysis,
00411 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00412 Tcl_CreateCommand(interp, "loadConst", &setLoadConst,
00413 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00414 Tcl_CreateCommand(interp, "setTime", &setTime,
00415 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00416 Tcl_CreateCommand(interp, "getTime", &getTime,
00417 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00418 Tcl_CreateCommand(interp, "build", &buildModel,
00419 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00420 Tcl_CreateCommand(interp, "analyze", &analyzeModel,
00421 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00422 Tcl_CreateCommand(interp, "print", &printModel,
00423 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00424 Tcl_CreateCommand(interp, "analysis", &specifyAnalysis,
00425 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00426 Tcl_CreateCommand(interp, "system", &specifySOE,
00427 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00428 Tcl_CreateCommand(interp, "numberer", &specifyNumberer,
00429 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00430 Tcl_CreateCommand(interp, "constraints", &specifyConstraintHandler,
00431 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00432 Tcl_CreateCommand(interp, "algorithm", &specifyAlgorithm,
00433 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00434 Tcl_CreateCommand(interp, "test", &specifyCTest,
00435 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00436 Tcl_CreateCommand(interp, "integrator", &specifyIntegrator,
00437 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00438 Tcl_CreateCommand(interp, "recorder", &addRecorder,
00439 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00440 Tcl_CreateCommand(interp, "algorithmRecorder", &addAlgoRecorder,
00441 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00442 Tcl_CreateCommand(interp, "database", &addDatabase,
00443 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00444 Tcl_CreateCommand(interp, "rigidLink", &rigidLink,
00445 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00446 Tcl_CreateCommand(interp, "rigidDiaphragm", &rigidDiaphragm,
00447 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00448 Tcl_CreateCommand(interp, "eigen", &eigenAnalysis,
00449 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00450 Tcl_CreateCommand(interp, "video", &videoPlayer,
00451 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00452 Tcl_CreateCommand(interp, "remove", &removeObject,
00453 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00454 Tcl_CreateCommand(interp, "nodeDisp", &nodeDisp,
00455 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00456 Tcl_CreateCommand(interp, "nodeVel", &nodeVel,
00457 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00458 Tcl_CreateCommand(interp, "nodeCoord", &nodeCoord,
00459 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00460 Tcl_CreateCommand(interp, "nodeBounds", &nodeBounds,
00461 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00462 Tcl_CreateCommand(interp, "start", &startTimer,
00463 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00464 Tcl_CreateCommand(interp, "stop", &stopTimer,
00465 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00466 Tcl_CreateCommand(interp, "rayleigh", &rayleighDamping,
00467 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00468 Tcl_CreateCommand(interp, "region", &addRegion,
00469 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00470 Tcl_CreateCommand(interp, "logFile", &logFile,
00471 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00472 Tcl_CreateCommand(interp, "exit", &OpenSeesExit,
00473 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00474 Tcl_CreateCommand(interp, "getNP", &getNP,
00475 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00476 Tcl_CreateCommand(interp, "getPID", &getPID,
00477 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00478
00479 #ifdef _RELIABILITY
00480 Tcl_CreateCommand(interp, "wipeReliability", wipeReliability,
00481 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00482 Tcl_CreateCommand(interp, "reliability", reliability,
00483 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00484 theReliabilityBuilder = 0;
00485
00486 Tcl_CreateCommand(interp, "computeGradients", &computeGradients,
00487 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00488 Tcl_CreateCommand(interp, "sensitivityAlgorithm", &sensitivityAlgorithm,
00489 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00490 Tcl_CreateCommand(interp, "sensitivityIntegrator", &sensitivityIntegrator,
00491 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00492 Tcl_CreateCommand(interp, "sensNodeDisp", &sensNodeDisp,
00493 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00494 Tcl_CreateCommand(interp, "sensNodeVel", &sensNodeVel,
00495 (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
00496
00497 theSensitivityAlgorithm =0;
00498 theSensitivityIntegrator =0;
00499
00500
00501 #endif
00502
00503 theAlgorithm =0;
00504 theHandler =0;
00505 theNumberer =0;
00506 theAnalysisModel =0;
00507 theSOE =0;
00508 theStaticIntegrator =0;
00509 theTransientIntegrator =0;
00510 theStaticAnalysis =0;
00511 theTransientAnalysis =0;
00512 theVariableTimeStepTransientAnalysis =0;
00513 theTest = 0;
00514
00515
00516
00517 #ifdef _NOGRAPHICS
00518
00519 #else
00520 theTclVideoPlayer = 0;
00521 #endif
00522
00523 return myCommands(interp);
00524 }
00525
00526 int
00527 OPS_SetObjCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj * const *argv)
00528 {
00529
00530 if (argc > 2)
00531 simulationInfo.addParameter(Tcl_GetString(argv[1]), Tcl_GetString(argv[2]));
00532
00533
00534 Tcl_SetObjCmd(clientData, interp, argc, argv);
00535 return 0;
00536 }
00537
00538 int
00539 OPS_SourceCmd(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00540 {
00541 int ok = TCL_OK;
00542 if (argc > 1) {
00543 simulationInfo.addReadFile(argv[1]);
00544
00545 ok = Tcl_EvalFile(interp, argv[1]);
00546 }
00547 return ok;
00548 }
00549
00550
00551
00552 #ifdef _RELIABILITY
00553
00554 int
00555 reliability(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00556 {
00557 if (theReliabilityBuilder == 0) {
00558
00559 theReliabilityBuilder = new TclReliabilityBuilder(theDomain,interp);
00560 return TCL_OK;
00561 }
00562 else
00563 return TCL_ERROR;
00564 }
00565
00566 int
00567 wipeReliability(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00568 {
00569 if (theReliabilityBuilder != 0) {
00570 delete theReliabilityBuilder;
00571 theReliabilityBuilder = 0;
00572 }
00573 return TCL_OK;
00574
00575 }
00576
00577 int
00578 sensitivityAlgorithm(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00579 {
00580 bool withRespectToRVs = true;
00581 int analysisTypeTag;
00582
00583
00584
00585
00586 if (argc < 2) {
00587 opserr << "ERROR: Wrong number of parameters to sensitivity algorithm." << endln;
00588 return TCL_ERROR;
00589 }
00590 if (theReliabilityBuilder == 0) {
00591 opserr << "The command 'reliability' needs to be issued before " << endln
00592 << " the sensitivity algorithm can be created." << endln;
00593 return TCL_ERROR;
00594 }
00595 else if (theSensitivityIntegrator == 0) {
00596 opserr << "The sensitivity integrator needs to be instantiated before " << endln
00597 << " the sensitivity algorithm can be created." << endln;
00598 return TCL_ERROR;
00599 }
00600 else {
00601 if (argc == 3) {
00602 if (strcmp(argv[2],"-parameters") == 0) {
00603 withRespectToRVs = false;
00604 }
00605 else if (strcmp(argv[2],"-randomVariables") == 0) {
00606 withRespectToRVs = true;
00607 }
00608 else {
00609 opserr << "ERROR: Invalid argument in sensitivity algorithm command." << endln;
00610 return TCL_ERROR;
00611 }
00612 }
00613 if (strcmp(argv[1],"-computeAtEachStep") == 0) {
00614 if (withRespectToRVs) {
00615 analysisTypeTag = 1;
00616 }
00617 else {
00618 analysisTypeTag = 2;
00619 }
00620 }
00621 else if (strcmp(argv[1],"-computeByCommand") == 0) {
00622 if (withRespectToRVs) {
00623 analysisTypeTag = 3;
00624 }
00625 else {
00626 analysisTypeTag = 4;
00627 }
00628 }
00629 else {
00630 opserr << "WARNING: Invalid type of sensitivity algorithm." << endln;
00631 return TCL_ERROR;
00632 }
00633 ReliabilityDomain *theReliabilityDomain;
00634 theReliabilityDomain = theReliabilityBuilder->getReliabilityDomain();
00635 theSensitivityAlgorithm = new SensitivityAlgorithm(theReliabilityDomain,
00636 theAlgorithm,
00637 theSensitivityIntegrator,
00638 analysisTypeTag);
00639 if (theSensitivityAlgorithm == 0) {
00640 opserr << "ERROR: Could not create theSensitivityAlgorithm. " << endln;
00641 return TCL_ERROR;
00642 }
00643 }
00644 return TCL_OK;
00645 }
00646 int
00647 sensitivityIntegrator(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00648 {
00649 if (strcmp(argv[1],"-static") == 0) {
00650
00651 if (theAnalysisModel == 0) {
00652 theAnalysisModel = new AnalysisModel();
00653 }
00654 theSensitivityIntegrator = new StaticSensitivityIntegrator(theAnalysisModel, theSOE);
00655 return TCL_OK;
00656 }
00657 else if (strcmp(argv[1],"-definedAbove") == 0) {
00658
00659 if (theNSI == 0) {
00660 opserr << "ERROR: No sensitivity integrator has been specified. " << endln;
00661 return TCL_ERROR;
00662 }
00663 else {
00664 theSensitivityIntegrator = theNSI;
00665 return TCL_OK;
00666 }
00667 }
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677 else {
00678 opserr << "WARNING: Invalid type of sensitivity integrator." << endln;
00679 return TCL_ERROR;
00680 }
00681 }
00682
00683
00684 #endif
00685
00686
00687
00688
00689
00690 int
00691 wipeModel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00692 {
00693
00694
00695 if (theBuilder != 0) {
00696 delete theBuilder;
00697 builtModel = false;
00698 theBuilder = 0;
00699 }
00700
00701 if (theStaticAnalysis != 0) {
00702 theStaticAnalysis->clearAll();
00703 delete theStaticAnalysis;
00704 }
00705
00706 if (theTransientAnalysis != 0) {
00707 theTransientAnalysis->clearAll();
00708 delete theTransientAnalysis;
00709 }
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 if (theDatabase != 0)
00723 delete theDatabase;
00724
00725 theDomain.clearAll();
00726
00727 #ifdef _NOGRAPHICS
00728
00729 #else
00730
00731 if (theTclVideoPlayer != 0) {
00732 delete theTclVideoPlayer;
00733 theTclVideoPlayer = 0;
00734 }
00735 #endif
00736
00737 theAlgorithm =0;
00738 theHandler =0;
00739 theNumberer =0;
00740 theAnalysisModel =0;
00741 theSOE =0;
00742 theStaticIntegrator =0;
00743 theTransientIntegrator =0;
00744 theStaticAnalysis =0;
00745 theTransientAnalysis =0;
00746 theVariableTimeStepTransientAnalysis =0;
00747
00748 theTest = 0;
00749 theDatabase = 0;
00750
00751
00752 #ifdef _RELIABILITY
00753 theSensitivityAlgorithm =0;
00754 theSensitivityIntegrator =0;
00755 #endif
00756
00757
00758
00759
00760
00761 return TCL_OK;
00762 }
00763
00764 int
00765 wipeAnalysis(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00766 {
00767
00768 #ifdef _PARALLEL_PROCESSING
00769 if (OPS_PARTITIONED == true && OPS_NUM_SUBDOMAINS > 1) {
00770 SubdomainIter &theSubdomains = theDomain.getSubdomains();
00771 Subdomain *theSub =0;
00772
00773
00774 while ((theSub = theSubdomains()) != 0)
00775 theSub->wipeAnalysis();
00776 }
00777 #endif
00778
00779 if (theStaticAnalysis != 0) {
00780 theStaticAnalysis->clearAll();
00781 delete theStaticAnalysis;
00782 }
00783
00784 if (theTransientAnalysis != 0) {
00785 theTransientAnalysis->clearAll();
00786 delete theTransientAnalysis;
00787 }
00788
00789
00790
00791
00792 theAlgorithm =0;
00793 theHandler =0;
00794 theNumberer =0;
00795 theAnalysisModel =0;
00796 theSOE =0;
00797 theStaticIntegrator =0;
00798 theTransientIntegrator =0;
00799 theStaticAnalysis =0;
00800 theTransientAnalysis =0;
00801 theVariableTimeStepTransientAnalysis =0;
00802 theTest = 0;
00803
00804
00805 #ifdef _RELIABILITY
00806 theSensitivityAlgorithm =0;
00807 theSensitivityIntegrator =0;
00808 #endif
00809
00810
00811
00812
00813 return TCL_OK;
00814 }
00815
00816
00817 int
00818 resetModel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00819 {
00820 theDomain.revertToStart();
00821
00822
00823
00824
00825
00826
00827 if (theTransientIntegrator != 0) {
00828 theTransientIntegrator->revertToStart();
00829 }
00830
00831
00832
00833 return TCL_OK;
00834 }
00835
00836 int
00837 initializeAnalysis(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00838 {
00839 if (theTransientAnalysis != 0)
00840 theTransientAnalysis->initialize();
00841 else if (theStaticAnalysis != 0)
00842 theStaticAnalysis->initialize();
00843
00844 theDomain.initialize();
00845
00846 return TCL_OK;
00847 }
00848
00849
00850 int
00851 setLoadConst(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00852 {
00853 theDomain.setLoadConstant();
00854 if (argc == 3) {
00855 if( strcmp(argv[1],"-time") == 0) {
00856 double newTime;
00857 if (Tcl_GetDouble(interp, argv[2], &newTime) != TCL_OK) {
00858 opserr << "WARNING readingvalue - loadConst -time value \n";
00859 return TCL_ERROR;
00860 } else {
00861 theDomain.setCurrentTime(newTime);
00862 theDomain.setCommittedTime(newTime);
00863 }
00864 }
00865 }
00866
00867 return TCL_OK;
00868 }
00869
00870
00871 int
00872 setTime(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00873 {
00874 if (argc < 2) {
00875 opserr << "WARNING illegal command - time pseudoTime? \n";
00876 return TCL_ERROR;
00877 }
00878 double newTime;
00879 if (Tcl_GetDouble(interp, argv[1], &newTime) != TCL_OK) {
00880 opserr << "WARNING reading time value - time pseudoTime? \n";
00881 return TCL_ERROR;
00882 } else {
00883 theDomain.setCurrentTime(newTime);
00884 theDomain.setCommittedTime(newTime);
00885 }
00886 return TCL_OK;
00887 }
00888
00889 int
00890 getTime(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00891 {
00892 double time = theDomain.getCurrentTime();
00893
00894 sprintf(interp->result,"%f",time);
00895 return TCL_OK;
00896 }
00897
00898
00899
00900
00901 int
00902 buildModel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00903 {
00904
00905
00906 if (theBuilder != 0 && builtModel == false) {
00907 builtModel = true;
00908 return theBuilder->buildFE_Model();
00909 } else if (theBuilder != 0 && builtModel == true) {
00910 opserr << "WARNING Model has already been built - not built again \n";
00911 return TCL_ERROR;
00912 }
00913 else {
00914 opserr << "WARNING No ModelBuilder type has been specified \n";
00915 return TCL_ERROR;
00916 }
00917 }
00918
00919
00920 #ifdef _PARALLEL_PROCESSING
00921
00922 int
00923 partitionModel(void)
00924 {
00925 int result = 0;
00926
00927 if (OPS_theChannels != 0)
00928 delete [] OPS_theChannels;
00929
00930 OPS_theChannels = new Channel *[OPS_NUM_SUBDOMAINS];
00931
00932
00933 for (int i=1; i<=OPS_NUM_SUBDOMAINS; i++) {
00934 if (i != OPS_MAIN_DOMAIN_PARTITION_ID) {
00935 opserr << "Creating SUBDOMAIN: " << i << endln;
00936 ShadowSubdomain *theSubdomain = new ShadowSubdomain(i, *OPS_MACHINE, *OPS_OBJECT_BROKER);
00937 theDomain.addSubdomain(theSubdomain);
00938 OPS_theChannels[i-1] = theSubdomain->getChannelPtr();
00939 }
00940 }
00941
00942
00943 if (OPS_DOMAIN_PARTITIONER == 0) {
00944
00945 OPS_GRAPH_PARTITIONER = new Metis;
00946
00947 OPS_DOMAIN_PARTITIONER = new DomainPartitioner(*OPS_GRAPH_PARTITIONER);
00948 theDomain.setPartitioner(OPS_DOMAIN_PARTITIONER);
00949 }
00950
00951 theDomain.partition(OPS_NUM_SUBDOMAINS, OPS_USING_MAIN_DOMAIN, OPS_MAIN_DOMAIN_PARTITION_ID);
00952
00953 OPS_PARTITIONED = true;
00954
00955 DomainDecompositionAnalysis *theSubAnalysis;
00956 SubdomainIter &theSubdomains = theDomain.getSubdomains();
00957 Subdomain *theSub =0;
00958
00959
00960 while ((theSub = theSubdomains()) != 0) {
00961 if (theStaticAnalysis != 0) {
00962 theSubAnalysis = new StaticDomainDecompositionAnalysis(*theSub,
00963 *theHandler,
00964 *theNumberer,
00965 *theAnalysisModel,
00966 *theAlgorithm,
00967 *theSOE,
00968 *theStaticIntegrator,
00969 theTest,
00970 false);
00971
00972 } else {
00973 theSubAnalysis = new TransientDomainDecompositionAnalysis(*theSub,
00974 *theHandler,
00975 *theNumberer,
00976 *theAnalysisModel,
00977 *theAlgorithm,
00978 *theSOE,
00979 *theTransientIntegrator,
00980 theTest,
00981 false);
00982 }
00983 theSub->setDomainDecompAnalysis(*theSubAnalysis);
00984
00985 }
00986 return result;
00987 }
00988
00989 #endif
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000 int
01001 analyzeModel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
01002 {
01003 int result = 0;
01004
01005 #ifdef _PARALLEL_PROCESSING
01006 if (OPS_PARTITIONED == false && OPS_NUM_SUBDOMAINS > 1)
01007 if (partitionModel() < 0) {
01008 opserr << "WARNING before analysis; partition failed\n";
01009 return TCL_ERROR;
01010 }
01011 #endif
01012
01013 if (theStaticAnalysis != 0) {
01014 if (argc < 2) {
01015 opserr << "WARNING static analysis: analysis numIncr?\n";
01016 return TCL_ERROR;
01017 }
01018 int numIncr;
01019
01020 if (Tcl_GetInt(interp, argv[1], &numIncr) != TCL_OK)
01021 return TCL_ERROR;
01022 result = theStaticAnalysis->analyze(numIncr);
01023
01024 } else if (theTransientAnalysis != 0) {
01025 if (argc < 3) {
01026 opserr << "WARNING transient analysis: analysis numIncr? deltaT?\n";
01027 return TCL_ERROR;
01028 }
01029 int numIncr;
01030 if (Tcl_GetInt(interp, argv[1], &numIncr) != TCL_OK)
01031 return TCL_ERROR;
01032 double dT;
01033 if (Tcl_GetDouble(interp, argv[2], &dT) != TCL_OK)
01034 return TCL_ERROR;
01035
01036
01037 ops_Dt = dT;
01038
01039 if (argc == 6) {
01040 int Jd;
01041 double dtMin, dtMax;
01042 if (Tcl_GetDouble(interp, argv[3], &dtMin) != TCL_OK)
01043 return TCL_ERROR;
01044 if (Tcl_GetDouble(interp, argv[4], &dtMax) != TCL_OK)
01045 return TCL_ERROR;
01046 if (Tcl_GetInt(interp, argv[5], &Jd) != TCL_OK)
01047 return TCL_ERROR;
01048
01049 if (theVariableTimeStepTransientAnalysis != 0)
01050 result = theVariableTimeStepTransientAnalysis->analyze(numIncr, dT, dtMin, dtMax, Jd);
01051 else {
01052 opserr << "WARNING analyze - no variable time step transient analysis object constructed\n";
01053 return TCL_ERROR;
01054 }
01055
01056 } else {
01057 result = theTransientAnalysis->analyze(numIncr, dT);
01058 }
01059
01060 } else {
01061 opserr << "WARNING No Analysis type has been specified \n";
01062 return TCL_ERROR;
01063 }
01064
01065 if (result < 0) {
01066 opserr << "OpenSees > analyze failed, returned: " << result << " error flag\n";
01067 }
01068
01069 sprintf(interp->result,"%d",result);
01070
01071 return TCL_OK;
01072
01073 }
01074
01075 int
01076 printElement(ClientData clientData, Tcl_Interp *interp, int argc,
01077 TCL_Char **argv, int nodeArg, OPS_Stream &output);
01078
01079
01080 int
01081 printNode(ClientData clientData, Tcl_Interp *interp, int argc,
01082 TCL_Char **argv, int nodeArg, OPS_Stream &output);
01083
01084 int
01085 printIntegrator(ClientData clientData, Tcl_Interp *interp, int argc,
01086 TCL_Char **argv, int nodeArg, OPS_Stream &output);
01087
01088 int
01089 printAlgorithm(ClientData clientData, Tcl_Interp *interp, int argc,
01090 TCL_Char **argv, int nodeArg, OPS_Stream &output);
01091
01092
01093 int
01094 printModel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
01095 {
01096
01097 if (argc == 1) {
01098 opserr << theDomain;
01099 return TCL_OK;
01100 }
01101
01102
01103 if ((strcmp(argv[1],"-ele") == 0) || (strcmp(argv[1],"ele") == 0))
01104 return printElement(clientData, interp, argc, argv, 3, opserr);
01105
01106
01107 else if ((strcmp(argv[1],"-node") == 0) || (strcmp(argv[1],"node") == 0))
01108 return printNode(clientData, interp, argc, argv, 3, opserr);
01109
01110
01111 else if ((strcmp(argv[1],"integrator") == 0) ||
01112 (strcmp(argv[1],"-integrator") == 0))
01113 return printIntegrator(clientData, interp, argc, argv, 3, opserr);
01114
01115
01116 else if ((strcmp(argv[1],"algorithm") == 0) ||
01117 (strcmp(argv[1],"-algorithm") == 0))
01118 return printAlgorithm(clientData, interp, argc, argv, 3, opserr);
01119
01120 else {
01121
01122 #ifdef _USING_OpenSees_STREAMS
01123 FileStream output;
01124 if (output.setFile(argv[1], APPEND) != 0) {
01125 opserr << "print <filename> .. - failed to open file: " << argv[1] << endln;
01126 return TCL_ERROR;
01127 }
01128 #else
01129 ofstream output(argv[1],ios::app);
01130 if (!output) {
01131 opserr << "print <filename> .. - failed to open file: " << argv[1] << endln;
01132 return TCL_ERROR;
01133 }
01134 #endif
01135
01136
01137 if (argc == 2) {
01138 output << theDomain;
01139 return TCL_OK;
01140 }
01141
01142 int pos = 2;
01143 if ((strcmp(argv[pos],"string") == 0) ||
01144 (strcmp(argv[pos],"-string") == 0)) {
01145 output << argv[3] << endln;
01146 pos +=2;
01147 }
01148 int res = TCL_OK;
01149
01150
01151 if ((strcmp(argv[pos],"ele") == 0) ||
01152 (strcmp(argv[pos],"-ele") == 0))
01153 res = printElement(clientData, interp, argc, argv, pos+2, output);
01154
01155
01156 else if ((strcmp(argv[pos],"node") == 0) || (strcmp(argv[pos],"-node") == 0))
01157 res = printNode(clientData, interp, argc, argv, pos+2, output);
01158
01159
01160 else if ((strcmp(argv[pos],"integrator") == 0)
01161 || (strcmp(argv[pos],"-integrator") == 0))
01162 return printIntegrator(clientData, interp, argc, argv, pos+2, opserr);
01163
01164
01165 else if ((strcmp(argv[pos],"-algorithm") == 0)||
01166 (strcmp(argv[pos],"algorithm") == 0))
01167 return printAlgorithm(clientData, interp, argc, argv, pos+2, opserr);
01168
01169
01170
01171 output.close();
01172 return res;
01173 }
01174
01175 }
01176
01177
01178
01179
01180
01181
01182
01183
01184 int
01185 printNode(ClientData clientData, Tcl_Interp *interp, int argc,
01186 TCL_Char **argv, int nodeArg, OPS_Stream &output)
01187 {
01188 int flag = 0;
01189
01190
01191 if (argc < nodeArg) {
01192 NodeIter &theNodes = theDomain.getNodes();
01193 Node *theNode;
01194 while ((theNode = theNodes()) != 0)
01195 theNode->Print(output);
01196 return TCL_OK;
01197 }
01198
01199
01200 if ((strcmp(argv[nodeArg-1],"flag") == 0) ||
01201 (strcmp(argv[nodeArg-1],"-flag") == 0)) {
01202
01203 if (argc <= nodeArg) {
01204 opserr << "WARNING print <filename> node <flag int> no int specified \n";
01205 return TCL_ERROR;
01206 }
01207 if (Tcl_GetInt(interp, argv[nodeArg], &flag) != TCL_OK) {
01208 opserr << "WARNING print node failed to get integer flag: \n";
01209 opserr << argv[nodeArg] << endln;
01210 return TCL_ERROR;
01211 }
01212 nodeArg += 2;
01213 }
01214
01215
01216
01217
01218
01219 if (argc < nodeArg) {
01220 NodeIter &theNodes = theDomain.getNodes();
01221 Node *theNode;
01222 while ((theNode = theNodes()) != 0)
01223 theNode->Print(output, flag);
01224 return TCL_OK;
01225 } else {
01226
01227 for (int i= nodeArg-1; i<argc; i++) {
01228 int nodeTag;
01229 if (Tcl_GetInt(interp, argv[i], &nodeTag) != TCL_OK) {
01230 opserr << "WARNING print node failed to get integer: " << argv[i] << endln;
01231 return TCL_ERROR;
01232 }
01233 Node *theNode = theDomain.getNode(nodeTag);
01234 if (theNode != 0)
01235 theNode->Print(output,flag);
01236 }
01237 return TCL_OK;
01238 }
01239 }
01240
01241
01242 int
01243 printElement(ClientData clientData, Tcl_Interp *interp, int argc,
01244 TCL_Char **argv, int eleArg, OPS_Stream &output)
01245 {
01246 int flag = 0;
01247
01248
01249 if (argc < eleArg) {
01250 ElementIter &theElements = theDomain.getElements();
01251 Element *theElement;
01252 while ((theElement = theElements()) != 0)
01253 theElement->Print(output);
01254 return TCL_OK;
01255 }
01256
01257
01258 if ((strcmp(argv[eleArg-1],"flag") == 0) ||
01259 (strcmp(argv[eleArg-1],"-flag")) == 0) {
01260 if (argc <= eleArg) {
01261 opserr << "WARNING print <filename> ele <flag int> no int specified \n";
01262 return TCL_ERROR;
01263 }
01264 if (Tcl_GetInt(interp, argv[eleArg], &flag) != TCL_OK) {
01265 opserr << "WARNING print ele failed to get integer flag: \n";
01266 opserr << argv[eleArg] << endln;
01267 return TCL_ERROR;
01268 }
01269 eleArg += 2;
01270 }
01271
01272
01273
01274
01275
01276 if (flag == 2)
01277 output << "#FRAME\n";
01278
01279 if (argc < eleArg) {
01280 ElementIter &theElements = theDomain.getElements();
01281 Element *theElement;
01282 while ((theElement = theElements()) != 0)
01283 theElement->Print(output, flag);
01284 return TCL_OK;
01285 } else {
01286
01287 for (int i= eleArg-1; i<argc; i++) {
01288 int ElementTag;
01289 if (Tcl_GetInt(interp, argv[i], &ElementTag) != TCL_OK) {
01290 opserr << "WARNING print ele failed to get integer: " << argv[i] << endln;
01291 return TCL_ERROR;
01292 }
01293 Element *theElement = theDomain.getElement(ElementTag);
01294 if (theElement != 0)
01295 theElement->Print(output,flag);
01296 }
01297 return TCL_OK;
01298 }
01299 }
01300
01301
01302 int
01303 printAlgorithm(ClientData clientData, Tcl_Interp *interp, int argc,
01304 TCL_Char **argv, int eleArg, OPS_Stream &output)
01305 {
01306
01307 if (theAlgorithm == 0)
01308 return TCL_OK;
01309
01310
01311 if (argc < eleArg) {
01312 theAlgorithm->Print(output);
01313 return TCL_OK;
01314 }
01315
01316
01317 int flag;
01318 if (Tcl_GetInt(interp, argv[eleArg-1], &flag) != TCL_OK) {
01319 opserr << "WARNING print algorithm failed to get integer flag: \n";
01320 opserr << argv[eleArg] << endln;
01321 return TCL_ERROR;
01322 }
01323 theAlgorithm->Print(output,flag);
01324 return TCL_OK;
01325 }
01326
01327
01328 int
01329 printIntegrator(ClientData clientData, Tcl_Interp *interp, int argc,
01330 TCL_Char **argv, int eleArg, OPS_Stream &output)
01331 {
01332
01333 if (theStaticIntegrator == 0 && theTransientIntegrator == 0)
01334 return TCL_OK;
01335
01336 IncrementalIntegrator *theIntegrator;
01337 if (theStaticIntegrator != 0)
01338 theIntegrator = theStaticIntegrator;
01339 else
01340 theIntegrator = theTransientIntegrator;
01341
01342
01343 if (argc < eleArg) {
01344 theIntegrator->Print(output);
01345 return TCL_OK;
01346 }
01347
01348
01349 int flag;
01350 if (Tcl_GetInt(interp, argv[eleArg-1], &flag) != TCL_OK) {
01351 opserr << "WARNING print algorithm failed to get integer flag: \n";
01352 opserr << argv[eleArg] << endln;
01353 return TCL_ERROR;
01354 }
01355 theIntegrator->Print(output,flag);
01356 return TCL_OK;
01357 }
01358
01359
01360
01361
01362
01363 int
01364 specifyAnalysis(ClientData clientData, Tcl_Interp *interp, int argc,
01365 TCL_Char **argv)
01366 {
01367
01368 if (argc < 2) {
01369 opserr << "WARNING need to specify an analysis type (Static, Transient)\n";
01370 return TCL_ERROR;
01371 }
01372
01373
01374 if (theStaticAnalysis != 0) {
01375 delete theStaticAnalysis;
01376 theStaticAnalysis = 0;
01377 }
01378 if (theTransientAnalysis != 0) {
01379 delete theTransientAnalysis;
01380 theTransientAnalysis = 0;
01381 theVariableTimeStepTransientAnalysis = 0;
01382 }
01383
01384
01385 if (strcmp(argv[1],"Static") == 0) {
01386
01387
01388 if (theAnalysisModel == 0)
01389 theAnalysisModel = new AnalysisModel();
01390
01391 if (theTest == 0)
01392 theTest = new CTestNormUnbalance(1.0e-6,25,0);
01393
01394 if (theAlgorithm == 0) {
01395 opserr << "WARNING analysis Static - no Algorithm yet specified, \n";
01396 opserr << " NewtonRaphson default will be used\n";
01397
01398 theAlgorithm = new NewtonRaphson(*theTest);
01399 }
01400 if (theHandler == 0) {
01401 opserr << "WARNING analysis Static - no ConstraintHandler yet specified, \n";
01402 opserr << " PlainHandler default will be used\n";
01403 theHandler = new PlainHandler();
01404 }
01405 if (theNumberer == 0) {
01406 opserr << "WARNING analysis Static - no Numberer specified, \n";
01407 opserr << " RCM default will be used\n";
01408 RCM *theRCM = new RCM(false);
01409 theNumberer = new DOF_Numberer(*theRCM);
01410 }
01411 if (theStaticIntegrator == 0) {
01412 opserr << "WARNING analysis Static - no Integrator specified, \n";
01413 opserr << " StaticIntegrator default will be used\n";
01414 theStaticIntegrator = new LoadControl(1, 1, 1, 1);
01415 }
01416 if (theSOE == 0) {
01417 opserr << "WARNING analysis Static - no LinearSOE specified, \n";
01418 opserr << " ProfileSPDLinSOE default will be used\n";
01419 ProfileSPDLinSolver *theSolver;
01420 theSolver = new ProfileSPDLinDirectSolver();
01421 theSOE = new ProfileSPDLinSOE(*theSolver);
01422 }
01423
01424 theStaticAnalysis = new StaticAnalysis(theDomain,
01425 *theHandler,
01426 *theNumberer,
01427 *theAnalysisModel,
01428 *theAlgorithm,
01429 *theSOE,
01430 *theStaticIntegrator,
01431 theTest);
01432
01433
01434 #ifdef _RELIABILITY
01435 if (theSensitivityAlgorithm != 0 && theSensitivityAlgorithm->shouldComputeAtEachStep()) {
01436 theStaticAnalysis->setSensitivityAlgorithm(theSensitivityAlgorithm);
01437 }
01438 #endif
01439
01440
01441 } else if (strcmp(argv[1],"Transient") == 0) {
01442
01443
01444 if (theAnalysisModel == 0)
01445 theAnalysisModel = new AnalysisModel();
01446
01447 if (theTest == 0)
01448 theTest = new CTestNormUnbalance(1.0e-6,25,0);
01449
01450 if (theAlgorithm == 0) {
01451 opserr << "WARNING analysis Transient - no Algorithm yet specified, \n";
01452 opserr << " NewtonRaphson default will be used\n";
01453
01454 theAlgorithm = new NewtonRaphson(*theTest);
01455 }
01456 if (theHandler == 0) {
01457 opserr << "WARNING analysis Transient dt tFinal - no ConstraintHandler\n";
01458 opserr << " yet specified, PlainHandler default will be used\n";
01459 theHandler = new PlainHandler();
01460 }
01461 if (theNumberer == 0) {
01462 opserr << "WARNING analysis Transient dt tFinal - no Numberer specified, \n";
01463 opserr << " RCM default will be used\n";
01464 RCM *theRCM = new RCM(false);
01465 theNumberer = new DOF_Numberer(*theRCM);
01466 }
01467 if (theTransientIntegrator == 0) {
01468 opserr << "WARNING analysis Transient dt tFinal - no Integrator specified, \n";
01469 opserr << " Newmark(.5,.25) default will be used\n";
01470 theTransientIntegrator = new Newmark(0.5,0.25);
01471 }
01472 if (theSOE == 0) {
01473 opserr << "WARNING analysis Transient dt tFinal - no LinearSOE specified, \n";
01474 opserr << " ProfileSPDLinSOE default will be used\n";
01475 ProfileSPDLinSolver *theSolver;
01476 theSolver = new ProfileSPDLinDirectSolver();
01477 theSOE = new ProfileSPDLinSOE(*theSolver);
01478 }
01479
01480 theTransientAnalysis = new DirectIntegrationAnalysis(theDomain,
01481 *theHandler,
01482 *theNumberer,
01483 *theAnalysisModel,
01484 *theAlgorithm,
01485 *theSOE,
01486 *theTransientIntegrator,
01487 theTest);
01488
01489
01490
01491 #ifdef _RELIABILITY
01492 if (theSensitivityAlgorithm != 0 && theSensitivityAlgorithm->shouldComputeAtEachStep()) {
01493 theTransientAnalysis->setSensitivityAlgorithm(theSensitivityAlgorithm);
01494 }
01495 #endif
01496
01497
01498 } else if ((strcmp(argv[1],"VariableTimeStepTransient") == 0) ||
01499 (strcmp(argv[1],"TransientWithVariableTimeStep") == 0) ||
01500 (strcmp(argv[1],"VariableTransient") == 0)) {
01501
01502
01503 if (theAnalysisModel == 0)
01504 theAnalysisModel = new AnalysisModel();
01505
01506 if (theTest == 0)
01507 theTest = new CTestNormUnbalance(1.0e-6,25,0);
01508
01509 if (theAlgorithm == 0) {
01510 opserr << "WARNING analysis Transient - no Algorithm yet specified, \n";
01511 opserr << " NewtonRaphson default will be used\n";
01512 theAlgorithm = new NewtonRaphson(*theTest);
01513 }
01514
01515 if (theHandler == 0) {
01516 opserr << "WARNING analysis Transient dt tFinal - no ConstraintHandler\n";
01517 opserr << " yet specified, PlainHandler default will be used\n";
01518 theHandler = new PlainHandler();
01519 }
01520
01521 if (theNumberer == 0) {
01522 opserr << "WARNING analysis Transient dt tFinal - no Numberer specified, \n";
01523 opserr << " RCM default will be used\n";
01524 RCM *theRCM = new RCM(false);
01525 theNumberer = new DOF_Numberer(*theRCM);
01526 }
01527
01528 if (theTransientIntegrator == 0) {
01529 opserr << "WARNING analysis Transient dt tFinal - no Integrator specified, \n";
01530 opserr << " Newmark(.5,.25) default will be used\n";
01531 theTransientIntegrator = new Newmark(0.5,0.25);
01532 }
01533
01534 if (theSOE == 0) {
01535 opserr << "WARNING analysis Transient dt tFinal - no LinearSOE specified, \n";
01536 opserr << " ProfileSPDLinSOE default will be used\n";
01537 ProfileSPDLinSolver *theSolver;
01538 theSolver = new ProfileSPDLinDirectSolver();
01539 theSOE = new ProfileSPDLinSOE(*theSolver);
01540 }
01541
01542 theVariableTimeStepTransientAnalysis = new VariableTimeStepDirectIntegrationAnalysis
01543 (theDomain,
01544 *theHandler,
01545 *theNumberer,
01546 *theAnalysisModel,
01547 *theAlgorithm,
01548 *theSOE,
01549 *theTransientIntegrator,
01550 theTest);
01551
01552
01553 theTransientAnalysis = theVariableTimeStepTransientAnalysis;
01554
01555 } else {
01556 opserr << "WARNING No Analysis type exists (Static Transient only) \n";
01557 return TCL_ERROR;
01558 }
01559
01560 #ifdef _PARALLEL_PROCESSING
01561 if (OPS_PARTITIONED == true && OPS_NUM_SUBDOMAINS > 1) {
01562 DomainDecompositionAnalysis *theSubAnalysis;
01563 SubdomainIter &theSubdomains = theDomain.getSubdomains();
01564 Subdomain *theSub =0;
01565
01566 while ((theSub = theSubdomains()) != 0) {
01567 if (theStaticAnalysis != 0) {
01568 theSubAnalysis = new StaticDomainDecompositionAnalysis(*theSub,
01569 *theHandler,
01570 *theNumberer,
01571 *theAnalysisModel,
01572 *theAlgorithm,
01573 *theSOE,
01574 *theStaticIntegrator,
01575 theTest,
01576 false);
01577
01578 } else {
01579 theSubAnalysis = new TransientDomainDecompositionAnalysis(*theSub,
01580 *theHandler,
01581 *theNumberer,
01582 *theAnalysisModel,
01583 *theAlgorithm,
01584 *theSOE,
01585 *theTransientIntegrator,
01586 theTest,
01587 false);
01588 }
01589
01590 theSub->setDomainDecompAnalysis(*theSubAnalysis);
01591
01592 }
01593 }
01594 #endif
01595 return TCL_OK;
01596 }
01597
01598
01599
01600
01601
01602
01603
01604 typedef struct linearSOE_PackageCommand {
01605 char *funcName;
01606 int (*funcPtr)(ClientData clientData,
01607 Tcl_Interp *interp,
01608 int argc,
01609 TCL_Char **argv,
01610 FEM_ObjectBroker *,
01611 LinearSOE **);
01612 struct linearSOE_PackageCommand *next;
01613 } LinearSOE_PackageCommand;
01614
01615
01616
01617 static LinearSOE_PackageCommand *theLinearSOE_PackageCommands = NULL;
01618
01619 int
01620 specifySOE(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
01621 {
01622
01623 if (argc < 2) {
01624 opserr << "WARNING need to specify a model type \n";
01625 return TCL_ERROR;
01626 }
01627
01628
01629
01630
01631
01632 if ((strcmp(argv[1],"BandGeneral") == 0) || (strcmp(argv[1],"BandGEN") == 0)
01633 || (strcmp(argv[1],"BandGen") == 0)){
01634 BandGenLinSolver *theSolver = new BandGenLinLapackSolver();
01635 #ifdef _PARALLEL_PROCESSING
01636 theSOE = new DistributedBandGenLinSOE(*theSolver);
01637 #else
01638 theSOE = new BandGenLinSOE(*theSolver);
01639 #endif
01640 }
01641
01642
01643
01644
01645 else if (strcmp(argv[1],"BandSPD") == 0) {
01646 BandSPDLinSolver *theSolver = new BandSPDLinLapackSolver();
01647 #ifdef _PARALLEL_PROCESSING
01648 theSOE = new DistributedBandSPDLinSOE(*theSolver);
01649 #else
01650 theSOE = new BandSPDLinSOE(*theSolver);
01651 #endif
01652
01653 }
01654
01655
01656 else if (strcmp(argv[1],"Diagonal") == 0) {
01657 #ifdef _PARALLEL_PROCESSING
01658 DistributedDiagonalSolver *theSolver = new DistributedDiagonalSolver();
01659 theSOE = new DistributedDiagonalSOE(*theSolver);
01660 #else
01661 DiagonalSolver *theSolver = new DiagonalDirectSolver();
01662 theSOE = new DiagonalSOE(*theSolver);
01663 #endif
01664
01665
01666 }
01667
01668
01669 else if (strcmp(argv[1],"ProfileSPD") == 0) {
01670
01671 ProfileSPDLinSolver *theSolver = new ProfileSPDLinDirectSolver();
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723 #ifdef _PARALLEL_PROCESSING
01724 theSOE = new DistributedProfileSPDLinSOE(*theSolver);
01725 #else
01726 theSOE = new ProfileSPDLinSOE(*theSolver);
01727 #endif
01728 }
01729
01730
01731 else if ((strcmp(argv[1],"SparseGeneral") == 0) || (strcmp(argv[1],"SuperLU") == 0) ||
01732 (strcmp(argv[1],"SparseGEN") == 0)) {
01733
01734 SparseGenColLinSolver *theSolver =0;
01735
01736 double thresh = 0.0;
01737 int npRow = 1;
01738 int npCol = 1;
01739 int np = 1;
01740
01741
01742 int count = 2;
01743 int permSpec = 0;
01744 int panelSize = 6;
01745 int relax = 6;
01746
01747
01748
01749
01750 while (count < argc) {
01751
01752 if ((strcmp(argv[count],"p") == 0) || (strcmp(argv[count],"piv") == 0)||
01753 (strcmp(argv[count],"-piv") == 0)) {
01754 thresh = 1.0;
01755 }
01756 else if ((strcmp(argv[count],"-np") == 0) || (strcmp(argv[count],"np") == 0)) {
01757 count++;
01758 if (count < argc)
01759 if (Tcl_GetInt(interp, argv[count], &np) != TCL_OK)
01760 return TCL_ERROR;
01761 }
01762 else if ((strcmp(argv[count],"npRow") == 0) || (strcmp(argv[count],"-npRow") ==0)) {
01763 count++;
01764 if (count < argc)
01765 if (Tcl_GetInt(interp, argv[count], &npRow) != TCL_OK)
01766 return TCL_ERROR;
01767 } else if ((strcmp(argv[count],"npCol") == 0) || (strcmp(argv[count],"-npCol") ==0)) {
01768 count++;
01769 if (count < argc)
01770 if (Tcl_GetInt(interp, argv[count], &npCol) != TCL_OK)
01771 return TCL_ERROR;
01772 }
01773 count++;
01774 }
01775
01776
01777 #ifdef _THREADS
01778 if (np != 0)
01779 theSolver = new ThreadedSuperLU(np, permSpec, panelSize, relax, thresh);
01780 #endif
01781
01782 #ifdef _PARALLEL_PROCESSING
01783 if (theSolver != 0)
01784 delete theSolver;
01785 theSolver = 0;
01786
01787 if (npRow != 0 && npCol != 0) {
01788 theSolver = new DistributedSuperLU(npRow, npCol);
01789 }
01790 #else
01791
01792 char symmetric = 'N';
01793 double drop_tol = 0.0;
01794
01795 while (count < argc) {
01796 if (strcmp(argv[count],"s") == 0 || strcmp(argv[count],"symmetric") ||
01797 strcmp(argv[count],"-symm")) {
01798 symmetric = 'Y';
01799 }
01800 count++;
01801 }
01802 theSolver = new SuperLU(permSpec, drop_tol, panelSize, relax, symmetric);
01803
01804 #endif
01805
01806 #ifdef _PARALLEL_PROCESSING
01807 theSOE = new DistributedSparseGenColLinSOE(*theSolver);
01808 #else
01809 theSOE = new SparseGenColLinSOE(*theSolver);
01810 #endif
01811 }
01812
01813
01814 else if (strcmp(argv[1],"SparseSPD") == 0) {
01815
01816
01817
01818
01819
01820
01821 int lSparse = 1;
01822 if (argc == 3) {
01823 if (Tcl_GetInt(interp, argv[3], &lSparse) != TCL_OK)
01824 return TCL_ERROR;
01825 }
01826
01827 SymSparseLinSolver *theSolver = new SymSparseLinSolver();
01828 theSOE = new SymSparseLinSOE(*theSolver, lSparse);
01829 }
01830
01831 else if (strcmp(argv[1],"UmfPack") == 0) {
01832
01833 UmfpackGenLinSolver *theSolver = new UmfpackGenLinSolver();
01834 theSOE = new UmfpackGenLinSOE(*theSolver);
01835 }
01836
01837 else if (strcmp(argv[1],"FullGeneral") == 0) {
01838
01839 FullGenLinLapackSolver *theSolver = new FullGenLinLapackSolver();
01840 theSOE = new FullGenLinSOE(*theSolver);
01841 }
01842
01843 #ifdef _PETSC
01844
01845 else if (strcmp(argv[1],"Petsc") == 0) {
01846
01847 KSPType method = KSPCG;
01848 PCType preconditioner = PCJACOBI;
01849 int matType = 0;
01850
01851 double rTol = 1.0e-5;
01852 double aTol = 1.0e-50;
01853 double dTol = 1.0e5;
01854 int maxIts = 100000;
01855 int count = 2;
01856 while (count < argc-1) {
01857 if (strcmp(argv[count],"-matrixType") == 0 || strcmp(argv[count],"-matrix")){
01858 if (strcmp(argv[count+1],"sparse") == 0)
01859 matType = 1;
01860 }
01861 else if (strcmp(argv[count],"-rTol") == 0 || strcmp(argv[count],"-relTol") ||
01862 strcmp(argv[count],"-relativeTolerance")) {
01863 if (Tcl_GetDouble(interp, argv[count+1], &rTol) != TCL_OK)
01864 return TCL_ERROR;
01865 } else if (strcmp(argv[count],"-aTol") == 0 || strcmp(argv[count],"-absTol") ||
01866 strcmp(argv[count],"-absoluteTolerance")) {
01867 if (Tcl_GetDouble(interp, argv[count+1], &aTol) != TCL_OK)
01868 return TCL_ERROR;
01869 } else if (strcmp(argv[count],"-dTol") == 0 || strcmp(argv[count],"-divTol") ||
01870 strcmp(argv[count],"-divergenceTolerance")) {
01871 if (Tcl_GetDouble(interp, argv[count+1], &dTol) != TCL_OK)
01872 return TCL_ERROR;
01873 } else if (strcmp(argv[count],"-mIts") == 0 || strcmp(argv[count],"-maxIts") ||
01874 strcmp(argv[count],"-maxIterations")) {
01875 if (Tcl_GetInt(interp, argv[count+1], &maxIts) != TCL_OK)
01876 return TCL_ERROR;
01877 } else if (strcmp(argv[count],"-KSP") == 0 || strcmp(argv[count],"-KSPType")){
01878 if (strcmp(argv[count+1],"KSPCG") == 0)
01879 method = KSPCG;
01880 else if (strcmp(argv[count+1],"KSPBICG") == 0)
01881 method = KSPBICG;
01882 else if (strcmp(argv[count+1],"KSPRICHARDSON") == 0)
01883 method = KSPRICHARDSON;
01884 else if (strcmp(argv[count+1],"KSPCHEBYCHEV") == 0)
01885 method = KSPCHEBYCHEV;
01886 else if (strcmp(argv[count+1],"KSPGMRES") == 0)
01887 method = KSPGMRES;
01888 } else if (strcmp(argv[count],"-PC") == 0 || strcmp(argv[count],"-PCType")){
01889 if ((strcmp(argv[count+1],"PCJACOBI") == 0) || (strcmp(argv[count+1],"JACOBI") == 0))
01890 preconditioner = PCJACOBI;
01891 else if ((strcmp(argv[count+1],"PCILU") == 0) || (strcmp(argv[count+1],"ILU") == 0))
01892 preconditioner = PCILU;
01893 else if ((strcmp(argv[count+1],"PCICC") == 0) || (strcmp(argv[count+1],"ICC") == 0))
01894 preconditioner = PCICC;
01895 else if ((strcmp(argv[count+1],"PCBJACOBI") == 0) || (strcmp(argv[count+1],"BIJACOBI") == 0))
01896 preconditioner = PCBJACOBI;
01897 else if ((strcmp(argv[count+1],"PCNONE") == 0) || (strcmp(argv[count+1],"NONE") == 0))
01898 preconditioner = PCNONE;
01899 }
01900 count+=2;
01901 }
01902
01903 if (matType == 0) {
01904 PetscSolver *theSolver = new PetscSolver(method, preconditioner, rTol, aTol, dTol, maxIts);
01905 theSOE = new PetscSOE(*theSolver);
01906 } else {
01907 PetscSparseSeqSolver *theSolver = new PetscSparseSeqSolver(method, preconditioner, rTol, aTol, dTol, maxIts);
01908 theSOE = new SparseGenRowLinSOE(*theSolver);
01909 }
01910 }
01911
01912
01913 #endif
01914
01915
01916 #ifdef _MUMPS
01917
01918 else if (strcmp(argv[1],"Mumps") == 0) {
01919
01920 #ifdef _PARALLEL_PROCESSING
01921 MumpsParallelSolver *theSolver = new MumpsParallelSolver();
01922 theSOE = new MumpsParallelSOE(*theSolver);
01923 #else
01924 MumpsSolver *theSolver = new MumpsSolver();
01925 theSOE = new MumpsSOE(*theSolver);
01926
01927 #endif
01928
01929 }
01930
01931 #endif
01932
01933
01934 else {
01935
01936
01937
01938
01939
01940
01941
01942 LinearSOE_PackageCommand *soeCommands = theLinearSOE_PackageCommands;
01943 bool found = false;
01944 while (soeCommands != NULL && found == false) {
01945 if (strcmp(argv[1], soeCommands->funcName) == 0) {
01946 int result = (*(soeCommands->funcPtr))(clientData, interp, argc, argv, &theBroker, &theSOE);
01947 found = true;
01948 } else
01949 soeCommands = soeCommands->next;
01950 }
01951
01952 if (found == false) {
01953
01954
01955 void *libHandle;
01956 int (*funcPtr)(ClientData clientData, Tcl_Interp *interp, int argc,
01957 TCL_Char **argv, FEM_ObjectBroker *, LinearSOE **);
01958 int linearSOE_NameLength = strlen(argv[1]);
01959 char *tclFuncName = new char[linearSOE_NameLength+12];
01960 strcpy(tclFuncName, "TclCommand_");
01961 strcpy(&tclFuncName[11], argv[1]);
01962
01963 int res = getLibraryFunction(argv[1], tclFuncName, &libHandle, (void **)&funcPtr);
01964
01965 if (res == 0) {
01966 char *linearSOE_Name = new char[linearSOE_NameLength+1];
01967 strcpy(linearSOE_Name, argv[1]);
01968 LinearSOE_PackageCommand *theSOE_Command = new LinearSOE_PackageCommand;
01969 theSOE_Command->funcPtr = funcPtr;
01970 theSOE_Command->funcName = linearSOE_Name;
01971 theSOE_Command->next = theLinearSOE_PackageCommands;
01972 theLinearSOE_PackageCommands = theSOE_Command;
01973
01974 int result = (*funcPtr)(clientData, interp,
01975 argc,
01976 argv,
01977 &theBroker,
01978 &theSOE);
01979 }
01980 }
01981 }
01982
01983
01984
01985 if (theSOE != 0) {
01986 if (theStaticAnalysis != 0)
01987 theStaticAnalysis->setLinearSOE(*theSOE);
01988 if (theTransientAnalysis != 0)
01989 theTransientAnalysis->setLinearSOE(*theSOE);
01990
01991 return TCL_OK;
01992 }
01993
01994
01995
01996 if (theStaticAnalysis != 0)
01997 theStaticAnalysis->setLinearSOE(*theSOE);
01998 else if (theTransientAnalysis != 0)
01999 theTransientAnalysis->setLinearSOE(*theSOE);
02000
02001 #ifdef _PARALLEL_PROCESSING
02002 if (theStaticAnalysis != 0 || theTransientAnalysis != 0) {
02003 SubdomainIter &theSubdomains = theDomain.getSubdomains();
02004 Subdomain *theSub;
02005 while ((theSub = theSubdomains()) != 0) {
02006 theSub->setAnalysisLinearSOE(*theSOE);
02007 }
02008 }
02009 #endif
02010
02011 return TCL_ERROR;
02012 }
02013
02014
02015
02016
02017
02018
02019 int
02020 specifyNumberer(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
02021 {
02022
02023 if (argc < 2) {
02024 opserr << "WARNING need to specify a Nemberer type \n";
02025 return TCL_ERROR;
02026 }
02027
02028 #ifdef _PARALLEL_PROCESSING
02029
02030
02031 if (strcmp(argv[1],"Plain") == 0) {
02032 theNumberer = new ParallelNumberer();
02033 } else if (strcmp(argv[1],"RCM") == 0) {
02034 RCM *theRCM = new RCM(false);
02035 theNumberer = new ParallelNumberer(*theRCM);
02036 } else {
02037 opserr << "WARNING No Numberer type exists (Plain, RCM only) \n";
02038 return TCL_ERROR;
02039 }
02040
02041 #else
02042
02043
02044 if (strcmp(argv[1],"Plain") == 0) {
02045 theNumberer = new PlainNumberer();
02046 } else if (strcmp(argv[1],"RCM") == 0) {
02047 RCM *theRCM = new RCM(false);
02048 theNumberer = new DOF_Numberer(*theRCM);
02049 } else {
02050 opserr << "WARNING No Numberer type exists (Plain, RCM only) \n";
02051 return TCL_ERROR;
02052 }
02053 #endif
02054
02055 return TCL_OK;
02056 }
02057
02058
02059
02060
02061
02062
02063
02064 int
02065 specifyConstraintHandler(ClientData clientData, Tcl_Interp *interp, int argc,
02066 TCL_Char **argv)
02067 {
02068
02069 if (argc < 2) {
02070 opserr << "WARNING need to specify a Nemberer type \n";
02071 return TCL_ERROR;
02072 }
02073
02074
02075 if (strcmp(argv[1],"Plain") == 0)
02076 theHandler = new PlainHandler();
02077
02078 else if (strcmp(argv[1],"Penalty") == 0) {
02079 if (argc < 4) {
02080 opserr << "WARNING: need to specify alpha: handler Penalty alpha \n";
02081 return TCL_ERROR;
02082 }
02083 double alpha1, alpha2;
02084 if (Tcl_GetDouble(interp, argv[2], &alpha1) != TCL_OK)
02085 return TCL_ERROR;
02086 if (Tcl_GetDouble(interp, argv[3], &alpha2) != TCL_OK)
02087 return TCL_ERROR;
02088 theHandler = new PenaltyConstraintHandler(alpha1, alpha2);
02089 }
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105 else if (strcmp(argv[1],"Lagrange") == 0) {
02106 double alpha1 = 1.0;
02107 double alpha2 = 1.0;
02108 if (argc == 4) {
02109 if (Tcl_GetDouble(interp, argv[2], &alpha1) != TCL_OK)
02110 return TCL_ERROR;
02111 if (Tcl_GetDouble(interp, argv[3], &alpha2) != TCL_OK)
02112 return TCL_ERROR;
02113 }
02114 theHandler = new LagrangeConstraintHandler(alpha1, alpha2);
02115 }
02116
02117 else if (strcmp(argv[1],"Transformation") == 0) {
02118 theHandler = new TransformationConstraintHandler();
02119 }
02120
02121 else {
02122 opserr << "WARNING No ConstraintHandler type exists (Plain, Penalty,\n";
02123 opserr << " Lagrange, Transformation) only\n";
02124 return TCL_ERROR;
02125 }
02126 return TCL_OK;
02127 }
02128
02129
02130
02131
02132
02133
02134 int
02135 specifyAlgorithm(ClientData clientData, Tcl_Interp *interp, int argc,
02136 TCL_Char **argv)
02137 {
02138
02139 if (argc < 2) {
02140 opserr << "WARNING need to specify an Algorithm type \n";
02141 return TCL_ERROR;
02142 }
02143 EquiSolnAlgo *theNewAlgo = 0;
02144
02145
02146 if (strcmp(argv[1],"Linear") == 0)
02147 theNewAlgo = new Linear();
02148
02149 else if (strcmp(argv[1],"Newton") == 0) {
02150 int formTangent = CURRENT_TANGENT;
02151 if (argc > 2) {
02152 if (strcmp(argv[2],"-secant") == 0) {
02153 formTangent = CURRENT_SECANT;
02154 } else if (strcmp(argv[2],"-initial") == 0) {
02155 formTangent = INITIAL_TANGENT;
02156 } else if ((strcmp(argv[2],"-initialThenCurrent") == 0) ||
02157 (strcmp(argv[2],"-initialCurrent") == 0)) {
02158 formTangent = INITIAL_THEN_CURRENT_TANGENT;
02159 }
02160 }
02161
02162 if (theTest == 0) {
02163 opserr << "ERROR: No ConvergenceTest yet specified\n";
02164 return TCL_ERROR;
02165 }
02166 theNewAlgo = new NewtonRaphson(*theTest, formTangent);
02167 }
02168
02169 else if (strcmp(argv[1],"KrylovNewton") == 0) {
02170 int formTangent = CURRENT_TANGENT;
02171 int maxDim = -1;
02172 for (int i = 2; i < argc; i++) {
02173 if (strcmp(argv[i],"-secant") == 0) {
02174 formTangent = CURRENT_SECANT;
02175 } else if (strcmp(argv[i],"-initial") == 0) {
02176 formTangent = INITIAL_TANGENT;
02177 } else if (strcmp(argv[i++],"-maxDim") == 0 && i < argc) {
02178 maxDim = atoi(argv[i]);
02179 }
02180 }
02181
02182 if (theTest == 0) {
02183 opserr << "ERROR: No ConvergenceTest yet specified\n";
02184 return TCL_ERROR;
02185 }
02186 if (maxDim == -1)
02187 theNewAlgo = new KrylovNewton(*theTest, formTangent);
02188 else
02189 theNewAlgo = new KrylovNewton(*theTest, formTangent, maxDim);
02190 }
02191
02192 else if (strcmp(argv[1],"PeriodicNewton") == 0) {
02193 int formTangent = CURRENT_TANGENT;
02194 int maxDim = -1;
02195 for (int i = 2; i < argc; i++) {
02196 if (strcmp(argv[i],"-secant") == 0) {
02197 formTangent = CURRENT_SECANT;
02198 } else if (strcmp(argv[i],"-initial") == 0) {
02199 formTangent = INITIAL_TANGENT;
02200 } else if (strcmp(argv[i++],"-maxCount") == 0 && i < argc) {
02201 maxDim = atoi(argv[i]);
02202 }
02203 }
02204
02205 if (theTest == 0) {
02206 opserr << "ERROR: No ConvergenceTest yet specified\n";
02207 return TCL_ERROR;
02208 }
02209 if (maxDim == -1)
02210 theNewAlgo = new PeriodicNewton(*theTest, formTangent);
02211 else
02212 theNewAlgo = new PeriodicNewton(*theTest, formTangent, maxDim);
02213 }
02214
02215 else if (strcmp(argv[1],"Broyden") == 0) {
02216 int formTangent = CURRENT_TANGENT;
02217 int count = -1;
02218
02219 if (theTest == 0) {
02220 opserr << "ERROR: No ConvergenceTest yet specified\n";
02221 return TCL_ERROR;
02222 }
02223 for (int i = 2; i < argc; i++) {
02224 if (strcmp(argv[i],"-secant") == 0) {
02225 formTangent = CURRENT_SECANT;
02226 } else if (strcmp(argv[i],"-initial") == 0) {
02227 formTangent = INITIAL_TANGENT;
02228 } else if (strcmp(argv[i++],"-count") == 0 && i < argc) {
02229 count = atoi(argv[i]);
02230 }
02231 }
02232
02233 if (count == -1)
02234 theNewAlgo = new Broyden(*theTest, formTangent);
02235 else
02236 theNewAlgo = new Broyden(*theTest, formTangent, count);
02237 }
02238
02239 else if (strcmp(argv[1],"BFGS") == 0) {
02240 int formTangent = CURRENT_TANGENT;
02241 int count = -1;
02242 for (int i = 2; i < argc; i++) {
02243 if (strcmp(argv[i],"-secant") == 0) {
02244 formTangent = CURRENT_SECANT;
02245 } else if (strcmp(argv[i],"-initial") == 0) {
02246 formTangent = INITIAL_TANGENT;
02247 } else if (strcmp(argv[i++],"-count") == 0 && i < argc) {
02248 count = atoi(argv[i]);
02249 }
02250 }
02251
02252 if (theTest == 0) {
02253 opserr << "ERROR: No ConvergenceTest yet specified\n";
02254 return TCL_ERROR;
02255 }
02256
02257 if (count == -1)
02258 theNewAlgo = new BFGS(*theTest, formTangent);
02259 else
02260 theNewAlgo = new BFGS(*theTest, formTangent, count);
02261 }
02262
02263 else if (strcmp(argv[1],"ModifiedNewton") == 0) {
02264 int formTangent = CURRENT_TANGENT;
02265 if (argc > 2) {
02266 if (strcmp(argv[2],"-secant") == 0) {
02267 formTangent = CURRENT_SECANT;
02268 } else if (strcmp(argv[2],"-initial") == 0) {
02269 formTangent = INITIAL_TANGENT;
02270 }
02271 }
02272 if (theTest == 0) {
02273 opserr << "ERROR: No ConvergenceTest yet specified\n";
02274 return TCL_ERROR;
02275 }
02276
02277 theNewAlgo = new ModifiedNewton(*theTest, formTangent);
02278 }
02279
02280 else if (strcmp(argv[1],"NewtonLineSearch") == 0) {
02281 if (theTest == 0) {
02282 opserr << "ERROR: No ConvergenceTest yet specified\n";
02283 return TCL_ERROR;
02284 }
02285
02286 int count = 2;
02287
02288
02289 double tol = 0.8;
02290 int maxIter = 10;
02291 double maxEta = 10.0;
02292 double minEta = 0.1;
02293 int pFlag = 1;
02294 int typeSearch = 0;
02295
02296 while (count < argc) {
02297 if (strcmp(argv[count], "-tol") == 0) {
02298 count++;
02299 if (Tcl_GetDouble(interp, argv[count], &tol) != TCL_OK)
02300 return TCL_ERROR;
02301 count++;
02302 } else if (strcmp(argv[count], "-maxIter") == 0) {
02303 count++;
02304 if (Tcl_GetInt(interp, argv[count], &maxIter) != TCL_OK)
02305 return TCL_ERROR;
02306 count++;
02307 } else if (strcmp(argv[count], "-pFlag") == 0) {
02308 count++;
02309 if (Tcl_GetInt(interp, argv[count], &pFlag) != TCL_OK)
02310 return TCL_ERROR;
02311 count++;
02312 } else if (strcmp(argv[count], "-minEta") == 0) {
02313 count++;
02314 if (Tcl_GetDouble(interp, argv[count], &minEta) != TCL_OK)
02315 return TCL_ERROR;
02316 count++;
02317 } else if (strcmp(argv[count], "-maxEta") == 0) {
02318 count++;
02319 if (Tcl_GetDouble(interp, argv[count], &maxEta) != TCL_OK)
02320 return TCL_ERROR;
02321 count++;
02322 } else if (strcmp(argv[count], "-type") == 0) {
02323 count++;
02324 if (strcmp(argv[count], "Bisection") == 0)
02325 typeSearch = 1;
02326 else if (strcmp(argv[count], "Secant") == 0)
02327 typeSearch = 2;
02328 else if (strcmp(argv[count], "RegulaFalsi") == 0)
02329 typeSearch = 3;
02330 else if (strcmp(argv[count], "LinearInterpolated") == 0)
02331 typeSearch = 3;
02332 else if (strcmp(argv[count], "InitialInterpolated") == 0)
02333 typeSearch = 0;
02334 count++;
02335 } else
02336 count++;
02337 }
02338
02339 LineSearch *theLineSearch = 0;
02340 if (typeSearch == 0)
02341 theLineSearch = new InitialInterpolatedLineSearch(tol, maxIter, minEta, maxEta, pFlag);
02342
02343 else if (typeSearch == 1)
02344 theLineSearch = new BisectionLineSearch(tol, maxIter, minEta, maxEta, pFlag);
02345 else if (typeSearch == 2)
02346 theLineSearch = new SecantLineSearch(tol, maxIter, minEta, maxEta, pFlag);
02347 else if (typeSearch == 3)
02348 theLineSearch = new RegulaFalsiLineSearch(tol, maxIter, minEta, maxEta, pFlag);
02349
02350 theNewAlgo = new NewtonLineSearch(*theTest, theLineSearch);
02351 }
02352
02353 else {
02354 opserr << "WARNING No EquiSolnAlgo type exists (Linear, Newton only) \n";
02355 return TCL_ERROR;
02356 }
02357
02358
02359 if (theNewAlgo != 0) {
02360 theAlgorithm = theNewAlgo;
02361
02362
02363 if (theStaticAnalysis != 0)
02364 theStaticAnalysis->setAlgorithm(*theAlgorithm);
02365 else if (theTransientAnalysis != 0)
02366 theTransientAnalysis->setAlgorithm(*theAlgorithm);
02367
02368 #ifdef _PARALLEL_PROCESSING
02369 if (theStaticAnalysis != 0 || theTransientAnalysis != 0) {
02370 SubdomainIter &theSubdomains = theDomain.getSubdomains();
02371 Subdomain *theSub;
02372 while ((theSub = theSubdomains()) != 0) {
02373 theSub->setAnalysisAlgorithm(*theAlgorithm);
02374 }
02375 }
02376 #endif
02377 }
02378
02379 return TCL_OK;
02380 }
02381
02382
02383
02384
02385
02386 int
02387 specifyCTest(ClientData clientData, Tcl_Interp *interp, int argc,
02388 TCL_Char **argv)
02389 {
02390
02391 if (argc < 2) {
02392 opserr << "WARNING need to specify a ConvergenceTest Type type \n";
02393 return TCL_ERROR;
02394 }
02395
02396
02397 double tol = 0.0;
02398 int numIter = 0;
02399 int printIt = 0;
02400 int normType = 2;
02401
02402 if (strcmp(argv[1],"FixedNumIter") != 0) {
02403 if (argc == 4) {
02404 if (Tcl_GetDouble(interp, argv[2], &tol) != TCL_OK)
02405 return TCL_ERROR;
02406 if (Tcl_GetInt(interp, argv[3], &numIter) != TCL_OK)
02407 return TCL_ERROR;
02408 } else if (argc == 5) {
02409 if (Tcl_GetDouble(interp, argv[2], &tol) != TCL_OK)
02410 return TCL_ERROR;
02411 if (Tcl_GetInt(interp, argv[3], &numIter) != TCL_OK)
02412 return TCL_ERROR;
02413 if (Tcl_GetInt(interp, argv[4], &printIt) != TCL_OK)
02414 return TCL_ERROR;
02415 } else if (argc == 6) {
02416 if (Tcl_GetDouble(interp, argv[2], &tol) != TCL_OK)
02417 return TCL_ERROR;
02418 if (Tcl_GetInt(interp, argv[3], &numIter) != TCL_OK)
02419 return TCL_ERROR;
02420 if (Tcl_GetInt(interp, argv[4], &printIt) != TCL_OK)
02421 return TCL_ERROR;
02422 if (Tcl_GetInt(interp, argv[5], &normType) != TCL_OK)
02423 return TCL_ERROR;
02424 }
02425 } else {
02426 if (argc == 3) {
02427 if (Tcl_GetInt(interp, argv[2], &numIter) != TCL_OK)
02428 return TCL_ERROR;
02429 } else if (argc == 4) {
02430 if (Tcl_GetInt(interp, argv[2], &numIter) != TCL_OK)
02431 return TCL_ERROR;
02432 if (Tcl_GetInt(interp, argv[3], &printIt) != TCL_OK)
02433 return TCL_ERROR;
02434 } else if (argc == 5) {
02435 if (Tcl_GetInt(interp, argv[2], &numIter) != TCL_OK)
02436 return TCL_ERROR;
02437 if (Tcl_GetInt(interp, argv[3], &printIt) != TCL_OK)
02438 return TCL_ERROR;
02439 if (Tcl_GetInt(interp, argv[4], &normType) != TCL_OK)
02440 return TCL_ERROR;
02441 }
02442 }
02443
02444 ConvergenceTest *theNewTest = 0;
02445
02446 if (numIter == 0) {
02447 opserr << "ERROR: no numIter specified in test command\n";
02448 return TCL_ERROR;
02449 }
02450
02451 if (strcmp(argv[1],"FixedNumIter") == 0)
02452 theNewTest = new CTestFixedNumIter(numIter,printIt,normType);
02453 else {
02454 if (tol == 0.0) {
02455 opserr << "ERROR: no tolerance specified in test command\n";
02456 return TCL_ERROR;
02457 }
02458 if (strcmp(argv[1],"NormUnbalance") == 0)
02459 theNewTest = new CTestNormUnbalance(tol,numIter,printIt,normType);
02460 else if (strcmp(argv[1],"NormDispIncr") == 0)
02461 theNewTest = new CTestNormDispIncr(tol,numIter,printIt,normType);
02462 else if (strcmp(argv[1],"EnergyIncr") == 0)
02463 theNewTest = new CTestEnergyIncr(tol,numIter,printIt,normType);
02464 else if (strcmp(argv[1],"RelativeNormUnbalance") == 0)
02465 theNewTest = new CTestRelativeNormUnbalance(tol,numIter,printIt,normType);
02466 else if (strcmp(argv[1],"RelativeNormDispIncr") == 0)
02467 theNewTest = new CTestRelativeNormDispIncr(tol,numIter,printIt,normType);
02468 else if (strcmp(argv[1],"RelativeEnergyIncr") == 0)
02469 theNewTest = new CTestRelativeEnergyIncr(tol,numIter,printIt,normType);
02470 else if (strcmp(argv[1],"RelativeTotalNormDispIncr") == 0)
02471 theNewTest = new CTestRelativeTotalNormDispIncr(tol,numIter,printIt,normType);
02472 else {
02473 opserr << "WARNING No ConvergenceTest type (NormUnbalance, NormDispIncr, EnergyIncr, \n";
02474 opserr << "RelativeNormUnbalance, RelativeNormDispIncr, RelativeEnergyIncr, \n";
02475 opserr << "RelativeTotalNormDispIncr, FixedNumIter)\n";
02476 return TCL_ERROR;
02477 }
02478 }
02479
02480 if (theNewTest != 0) {
02481 theTest = theNewTest;
02482
02483
02484
02485 if (theStaticAnalysis != 0)
02486 theStaticAnalysis->setConvergenceTest(*theTest);
02487
02488 else if (theTransientAnalysis != 0)
02489 theTransientAnalysis->setConvergenceTest(*theTest);
02490
02491 #ifdef _PARALLEL_PROCESSING
02492 if (theStaticAnalysis != 0 || theTransientAnalysis != 0) {
02493 SubdomainIter &theSubdomains = theDomain.getSubdomains();
02494 Subdomain *theSub;
02495 while ((theSub = theSubdomains()) != 0) {
02496 theSub->setAnalysisConvergenceTest(*theTest);;
02497 }
02498 }
02499 #endif
02500 }
02501
02502 return TCL_OK;
02503 }
02504
02505
02506
02507
02508
02509
02510
02511
02512 int
02513 specifyIntegrator(ClientData clientData, Tcl_Interp *interp, int argc,
02514 TCL_Char **argv)
02515 {
02516
02517 if (argc < 2) {
02518 opserr << "WARNING need to specify an Integrator type \n";
02519 return TCL_ERROR;
02520 }
02521
02522
02523 if (strcmp(argv[1],"LoadControl") == 0) {
02524 double dLambda;
02525 double minIncr, maxIncr;
02526 int numIter;
02527 if (argc < 3) {
02528 opserr << "WARNING incorrect # args - integrator LoadControl dlam <Jd dlamMin dlamMax>\n";
02529 return TCL_ERROR;
02530 }
02531 if (Tcl_GetDouble(interp, argv[2], &dLambda) != TCL_OK)
02532 return TCL_ERROR;
02533 if (argc > 5) {
02534 if (Tcl_GetInt(interp, argv[3], &numIter) != TCL_OK)
02535 return TCL_ERROR;
02536 if (Tcl_GetDouble(interp, argv[4], &minIncr) != TCL_OK)
02537 return TCL_ERROR;
02538 if (Tcl_GetDouble(interp, argv[5], &maxIncr) != TCL_OK)
02539 return TCL_ERROR;
02540 }
02541 else {
02542 minIncr = dLambda;
02543 maxIncr = dLambda;
02544 numIter = 1;
02545 }
02546 theStaticIntegrator = new LoadControl(dLambda, numIter, minIncr, maxIncr);
02547
02548
02549 if (theStaticAnalysis != 0)
02550 theStaticAnalysis->setIntegrator(*theStaticIntegrator);
02551 }
02552
02553
02554 else if (strcmp(argv[1],"ArcLength") == 0) {
02555 double arcLength;
02556 double alpha;
02557 if (argc != 4) {
02558 opserr << "WARNING integrator ArcLength arcLength alpha \n";
02559 return TCL_ERROR;
02560 }
02561 if (Tcl_GetDouble(interp, argv[2], &arcLength) != TCL_OK)
02562 return TCL_ERROR;
02563 if (Tcl_GetDouble(interp, argv[3], &alpha) != TCL_OK)
02564 return TCL_ERROR;
02565 theStaticIntegrator = new ArcLength(arcLength,alpha);
02566
02567
02568 if (theStaticAnalysis != 0)
02569 theStaticAnalysis->setIntegrator(*theStaticIntegrator);
02570 }
02571
02572 else if (strcmp(argv[1],"ArcLength1") == 0) {
02573 double arcLength;
02574 double alpha;
02575 if (argc != 4) {
02576 opserr << "WARNING integrator ArcLength1 arcLength alpha \n";
02577 return TCL_ERROR;
02578 }
02579 if (Tcl_GetDouble(interp, argv[2], &arcLength) != TCL_OK)
02580 return TCL_ERROR;
02581 if (Tcl_GetDouble(interp, argv[3], &alpha) != TCL_OK)
02582 return TCL_ERROR;
02583 theStaticIntegrator = new ArcLength1(arcLength,alpha);
02584
02585
02586 if (theStaticAnalysis != 0)
02587 theStaticAnalysis->setIntegrator(*theStaticIntegrator);
02588 }
02589
02590
02591 else if (strcmp(argv[1],"HSConstraint") == 0) {
02592 double arcLength;
02593 double psi_u;
02594 double psi_f;
02595 double u_ref;
02596 if (argc < 3) {
02597 opserr << "WARNING integrator HSConstraint <arcLength> <psi_u> <psi_f> <u_ref> \n";
02598 return TCL_ERROR;
02599 }
02600 if (argc >= 3 && Tcl_GetDouble(interp, argv[2], &arcLength) != TCL_OK)
02601 return TCL_ERROR;
02602 if (argc>=4 && Tcl_GetDouble(interp, argv[3], &psi_u) != TCL_OK)
02603 return TCL_ERROR;
02604 if (argc>=5 && Tcl_GetDouble(interp, argv[4], &psi_f) != TCL_OK)
02605 return TCL_ERROR;
02606 if (argc==6 && Tcl_GetDouble(interp, argv[5], &u_ref) != TCL_OK)
02607 return TCL_ERROR;
02608 switch(argc)
02609 {
02610 case 3:
02611 theStaticIntegrator = new HSConstraint(arcLength);
02612 case 4:
02613 theStaticIntegrator = new HSConstraint(arcLength, psi_u);
02614 case 5:
02615 theStaticIntegrator = new HSConstraint(arcLength, psi_u, psi_f);
02616 case 6:
02617 theStaticIntegrator = new HSConstraint(arcLength, psi_u, psi_f, u_ref);
02618 }
02619
02620 if (theStaticAnalysis != 0)
02621 theStaticAnalysis->setIntegrator(*theStaticIntegrator);
02622 }
02623
02624
02625 else if (strcmp(argv[1],"MinUnbalDispNorm") == 0) {
02626 double lambda11, minlambda, maxlambda;
02627 int numIter;
02628 if (argc < 3) {
02629 opserr << "WARNING integrator MinUnbalDispNorm lambda11 <Jd minLambda1j maxLambda1j>\n";
02630 return TCL_ERROR;
02631 }
02632 if (Tcl_GetDouble(interp, argv[2], &lambda11) != TCL_OK)
02633 return TCL_ERROR;
02634 if (argc > 5) {
02635 if (Tcl_GetInt(interp, argv[3], &numIter) != TCL_OK)
02636 return TCL_ERROR;
02637 if (Tcl_GetDouble(interp, argv[4], &minlambda) != TCL_OK)
02638 return TCL_ERROR;
02639 if (Tcl_GetDouble(interp, argv[5], &maxlambda) != TCL_OK)
02640 return TCL_ERROR;
02641 }
02642 else {
02643 minlambda = lambda11;
02644 maxlambda = lambda11;
02645 numIter = 1;
02646 argc += 3;
02647 }
02648
02649 int signFirstStepMethod = SIGN_LAST_STEP;
02650 if (argc == 7)
02651 if ((strcmp(argv[argc-1],"-determinant") == 0) ||
02652 (strcmp(argv[argc-1],"-det") == 0))
02653 signFirstStepMethod = CHANGE_DETERMINANT;
02654
02655 theStaticIntegrator = new MinUnbalDispNorm(lambda11,numIter,minlambda,maxlambda,signFirstStepMethod);
02656
02657
02658 if (theStaticAnalysis != 0)
02659 theStaticAnalysis->setIntegrator(*theStaticIntegrator);
02660 }
02661
02662 else if (strcmp(argv[1],"DisplacementControl") == 0) {
02663 int node;
02664 int dof;
02665 double increment, minIncr, maxIncr;
02666 int numIter;
02667 if (argc < 5) {
02668 opserr << "WARNING integrator DisplacementControl node dof dU \n";
02669 opserr << "<Jd minIncrement maxIncrement>\n";
02670 return TCL_ERROR;
02671 }
02672 if (Tcl_GetInt(interp, argv[2], &node) != TCL_OK)
02673 return TCL_ERROR;
02674 if (Tcl_GetInt(interp, argv[3], &dof) != TCL_OK)
02675 return TCL_ERROR;
02676 if (Tcl_GetDouble(interp, argv[4], &increment) != TCL_OK)
02677 return TCL_ERROR;
02678 if (argc > 7) {
02679 if (Tcl_GetInt(interp, argv[5], &numIter) != TCL_OK)
02680 return TCL_ERROR;
02681 if (Tcl_GetDouble(interp, argv[6], &minIncr) != TCL_OK)
02682 return TCL_ERROR;
02683 if (Tcl_GetDouble(interp, argv[7], &maxIncr) != TCL_OK)
02684 return TCL_ERROR;
02685 }
02686 else {
02687 minIncr = increment;
02688 maxIncr = increment;
02689 numIter = 1;
02690 }
02691
02692 Node *theNode = theDomain.getNode(node);
02693 if (theNode == 0) {
02694 opserr << "WARNING integrator DisplacementControl node dof dU : Node does not exist\n";
02695 return TCL_ERROR;
02696 }
02697
02698
02699 #ifdef _PARALLEL_PROCESSING
02700 theStaticIntegrator = new DistributedDisplacementControl(node,dof-1,increment,
02701 numIter, minIncr, maxIncr);
02702 #else
02703 int numDOF = theNode->getNumberDOF();
02704 if (dof <= 0 || dof > numDOF) {
02705 opserr << "WARNING integrator DisplacementControl node dof dU : invalid dof given\n";
02706 return TCL_ERROR;
02707 }
02708
02709 theStaticIntegrator = new DisplacementControl(node, dof-1, increment, &theDomain,
02710 numIter, minIncr, maxIncr);
02711 #endif
02712
02713
02714 if (theStaticAnalysis != 0)
02715 theStaticAnalysis->setIntegrator(*theStaticIntegrator);
02716 }
02717
02718 else if (strcmp(argv[1],"Newmark") == 0) {
02719 double gamma;
02720 double beta;
02721 double alphaM = 0.0;
02722 double betaK = 0.0;
02723 double betaKi = 0.0;
02724 double betaKc = 0.0;
02725 if (argc != 4 && argc != 8) {
02726 opserr << "WARNING integrator Newmark gamma beta <alphaM betaK betaK0 betaKc>\n";
02727 return TCL_ERROR;
02728 }
02729 if (Tcl_GetDouble(interp, argv[2], &gamma) != TCL_OK) {
02730 opserr << "WARNING integrator Newmark gamma beta - undefined gamma\n";
02731 return TCL_ERROR;
02732 }
02733 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
02734 opserr << "WARNING integrator Newmark gamma beta - undefined beta\n";
02735 return TCL_ERROR;
02736 }
02737 if (argc == 7 || argc == 8) {
02738 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
02739 opserr << "WARNING integrator Newmark gamma beta alphaM betaK betaKi betaKc - alphaM\n";
02740 return TCL_ERROR;
02741 }
02742 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
02743 opserr << "WARNING integrator Newmark gamma beta alphaM betaK betaKi betaKc - betaK\n";
02744 return TCL_ERROR;
02745 }
02746 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
02747 opserr << "WARNING integrator Newmark gamma beta alphaM betaK betaKi betaKc - betaKi\n";
02748 return TCL_ERROR;
02749 }
02750 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
02751 opserr << "WARNING integrator Newmark gamma beta alphaM betaK betaKi betaKc - betaKc\n";
02752 return TCL_ERROR;
02753 }
02754 }
02755 if (argc == 4)
02756 theTransientIntegrator = new Newmark(gamma,beta);
02757 else
02758 theTransientIntegrator = new Newmark(gamma,beta,alphaM,betaK,betaKi,betaKc);
02759
02760
02761 if (theTransientAnalysis != 0)
02762 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
02763 }
02764
02765 else if (strcmp(argv[1],"NewmarkExplicit") == 0) {
02766 double gamma;
02767 double alphaM, betaK, betaKi, betaKc;
02768 if (argc != 3 && argc != 7) {
02769 opserr << "WARNING integrator NewmarkExplicit gamma <alphaM betaK betaKi betaKc>\n";
02770 return TCL_ERROR;
02771 }
02772 if (Tcl_GetDouble(interp, argv[2], &gamma) != TCL_OK) {
02773 opserr << "WARNING integrator NewmarkExplicit gamma - undefined gamma\n";
02774 return TCL_ERROR;
02775 }
02776 if (argc == 7) {
02777 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
02778 opserr << "WARNING integrator NewmarkExplicit gamma alphaM betaK betaKi betaKc - alphaM\n";
02779 return TCL_ERROR;
02780 }
02781 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
02782 opserr << "WARNING integrator NewmarkExplicit gamma alphaM betaK betaKi betaKc - betaK\n";
02783 return TCL_ERROR;
02784 }
02785 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
02786 opserr << "WARNING integrator NewmarkExplicit gamma alphaM betaK betaKi betaKc - betaKi\n";
02787 return TCL_ERROR;
02788 }
02789 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
02790 opserr << "WARNING integrator NewmarkExplicit gamma alphaM betaK betaKi betaKc - betaKc\n";
02791 return TCL_ERROR;
02792 }
02793 }
02794 if (argc == 3)
02795 theTransientIntegrator = new NewmarkExplicit(gamma);
02796 else
02797 theTransientIntegrator = new NewmarkExplicit(gamma, alphaM, betaK, betaKi, betaKc);
02798
02799
02800 if (theTransientAnalysis != 0)
02801 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
02802 }
02803
02804 else if (strcmp(argv[1],"NewmarkHybridSimulation") == 0) {
02805 double beta, gamma;
02806 double alphaM, betaK, betaKi, betaKc;
02807 if (argc != 4 && argc != 8) {
02808 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta <alphaM betaK betaKi betaKc>\n";
02809 return TCL_ERROR;
02810 }
02811 if (Tcl_GetDouble(interp, argv[2], &gamma) != TCL_OK) {
02812 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta - undefined gamma\n";
02813 return TCL_ERROR;
02814 }
02815 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
02816 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta - undefined beta\n";
02817 return TCL_ERROR;
02818 }
02819 if (argc == 8) {
02820 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
02821 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta alphaM betaK betaKi betaKc - alphaM\n";
02822 return TCL_ERROR;
02823 }
02824 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
02825 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta alphaM betaK betaKi betaKc - betaK\n";
02826 return TCL_ERROR;
02827 }
02828 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
02829 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta alphaM betaK betaKi betaKc - betaKi\n";
02830 return TCL_ERROR;
02831 }
02832 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
02833 opserr << "WARNING integrator NewmarkHybridSimulation gamma beta alphaM betaK betaKi betaKc - betaKc\n";
02834 return TCL_ERROR;
02835 }
02836 }
02837 if (theTest == 0) {
02838 opserr << "WARNING no ConvergenceTest specified yet\n";
02839 return TCL_ERROR;
02840 }
02841 if (argc == 4)
02842 theTransientIntegrator = new NewmarkHybridSimulation(gamma, beta, *theTest);
02843 else
02844 theTransientIntegrator = new NewmarkHybridSimulation(gamma, beta, *theTest, alphaM, betaK, betaKi, betaKc);
02845
02846
02847 if (theTransientAnalysis != 0)
02848 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
02849 }
02850
02851 #ifdef _RELIABILITY
02852 else if (strcmp(argv[1],"NewmarkWithSensitivity") == 0) {
02853 int assemblyFlag = 0;
02854 double gamma;
02855 double beta;
02856 double alphaM, betaK, betaKi, betaKc;
02857 if (argc != 4 && argc != 6 && argc != 8 && argc != 10) {
02858 interp->result = "WARNING integrator Newmark gamma beta <alphaM? betaKcurrent? betaKi? betaKlastCommitted?> <-assemble tag?> ";
02859 return TCL_ERROR;
02860 }
02861
02862
02863 if (Tcl_GetDouble(interp, argv[2], &gamma) != TCL_OK) {
02864 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02865 return TCL_ERROR;
02866 }
02867 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
02868 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02869 return TCL_ERROR;
02870 }
02871
02872
02873 if (argc == 6) {
02874 if (strcmp(argv[4],"-assemble") != 0) {
02875 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02876 }
02877 if (Tcl_GetInt(interp, argv[5], &assemblyFlag) != TCL_OK) {
02878 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02879 return TCL_ERROR;
02880 }
02881 }
02882
02883 if (argc == 8) {
02884 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
02885 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02886 return TCL_ERROR;
02887 }
02888 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
02889 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02890 return TCL_ERROR;
02891 }
02892 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
02893 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02894 return TCL_ERROR;
02895 }
02896 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
02897 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02898 return TCL_ERROR;
02899 }
02900 }
02901
02902 if (argc == 10) {
02903 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
02904 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02905 return TCL_ERROR;
02906 }
02907 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
02908 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02909 return TCL_ERROR;
02910 }
02911 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
02912 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02913 return TCL_ERROR;
02914 }
02915 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
02916 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02917 return TCL_ERROR;
02918 }
02919 if (strcmp(argv[8],"-assemble") != 0) {
02920 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02921 }
02922 if (Tcl_GetInt(interp, argv[9], &assemblyFlag) != TCL_OK) {
02923 opserr << "WARNING: Error in input to Newmark sensitivity integrator" << endln;
02924 return TCL_ERROR;
02925 }
02926 }
02927
02928 if (argc == 4 || argc == 6) {
02929 theNSI = new NewmarkSensitivityIntegrator(assemblyFlag, gamma,beta);
02930 }
02931 else {
02932 theNSI = new NewmarkSensitivityIntegrator(assemblyFlag, gamma,beta,alphaM,betaK,betaKi,betaKc);
02933 }
02934 theTransientIntegrator = theNSI;
02935
02936
02937
02938 if (theTransientAnalysis != 0)
02939 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
02940 }
02941
02942 #endif
02943
02944 else if (strcmp(argv[1],"HHT") == 0) {
02945 double alpha, beta, gamma;
02946 double alphaM, betaK, betaKi, betaKc;
02947 if (argc != 3 && argc != 5 && argc != 7 && argc != 9) {
02948 opserr << "WARNING integrator HHT alpha <alphaM betaK betaKi betaKc>\n";
02949 opserr << " or integrator HHT alpha beta gamma <alphaM betaK betaKi betaKc>\n";
02950 return TCL_ERROR;
02951 }
02952 if (Tcl_GetDouble(interp, argv[2], &alpha) != TCL_OK) {
02953 opserr << "WARNING integrator HHT alpha - undefined alpha\n";
02954 return TCL_ERROR;
02955 }
02956 if (argc == 5 || argc == 9) {
02957 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
02958 opserr << "WARNING integrator HHT alpha beta gamma - undefined beta\n";
02959 return TCL_ERROR;
02960 }
02961 if (Tcl_GetDouble(interp, argv[4], &gamma) != TCL_OK) {
02962 opserr << "WARNING integrator HHT alpha beta gamma - undefined gamma\n";
02963 return TCL_ERROR;
02964 }
02965 }
02966 if (argc == 7) {
02967 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
02968 opserr << "WARNING integrator HHT alpha alphaM betaK betaKi betaKc - alphaM\n";
02969 return TCL_ERROR;
02970 }
02971 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
02972 opserr << "WARNING integrator HHT alpha alphaM betaK betaKi betaKc - betaK\n";
02973 return TCL_ERROR;
02974 }
02975 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
02976 opserr << "WARNING integrator HHT alpha alphaM betaK betaKi betaKc - betaKi\n";
02977 return TCL_ERROR;
02978 }
02979 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
02980 opserr << "WARNING integrator HHT alpha alphaM betaK betaKi betaKc - betaKi\n";
02981 return TCL_ERROR;
02982 }
02983 }
02984 if (argc == 9) {
02985 if (Tcl_GetDouble(interp, argv[5], &alphaM) != TCL_OK) {
02986 opserr << "WARNING integrator HHT alpha beta gamma alphaM betaK betaKi betaKc - alphaM\n";
02987 return TCL_ERROR;
02988 }
02989 if (Tcl_GetDouble(interp, argv[6], &betaK) != TCL_OK) {
02990 opserr << "WARNING integrator HHT alpha beta gamma alphaM betaK betaKi betaKc - betaK\n";
02991 return TCL_ERROR;
02992 }
02993 if (Tcl_GetDouble(interp, argv[7], &betaKi) != TCL_OK) {
02994 opserr << "WARNING integrator HHT alpha beta gamma alphaM betaK betaKi betaKc - betaKi\n";
02995 return TCL_ERROR;
02996 }
02997 if (Tcl_GetDouble(interp, argv[8], &betaKc) != TCL_OK) {
02998 opserr << "WARNING integrator HHT alpha beta gamma alphaM betaK betaKi betaKc - betaKc\n";
02999 return TCL_ERROR;
03000 }
03001 }
03002 if (argc == 3)
03003 theTransientIntegrator = new HHT(alpha);
03004 else if (argc == 5)
03005 theTransientIntegrator = new HHT(alpha, beta, gamma);
03006 else if (argc == 7)
03007 theTransientIntegrator = new HHT(alpha, alphaM, betaK, betaKi, betaKc);
03008 else if (argc == 9)
03009 theTransientIntegrator = new HHT(alpha, beta, gamma, alphaM, betaK, betaKi, betaKc);
03010
03011
03012 if (theTransientAnalysis != 0)
03013 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03014 }
03015
03016 else if (strcmp(argv[1],"HHTGeneralized") == 0) {
03017 double rhoInf, alphaI, alphaF, beta, gamma;
03018 double alphaM, betaK, betaKi, betaKc;
03019 if (argc != 3 && argc != 6 && argc != 7 && argc != 10) {
03020 opserr << "WARNING integrator HHTGeneralized rhoInf <alphaM betaK betaKi betaKc>\n";
03021 opserr << " or integrator HHTGeneralized alphaI alphaF beta gamma <alphaM betaK betaKi betaKc>\n";
03022 return TCL_ERROR;
03023 }
03024 if (argc == 3 || argc == 7) {
03025 if (Tcl_GetDouble(interp, argv[2], &rhoInf) != TCL_OK) {
03026 opserr << "WARNING integrator HHTGeneralized rhoInf - undefined rhoInf\n";
03027 return TCL_ERROR;
03028 }
03029 }
03030 if (argc == 6 || argc == 10) {
03031 if (Tcl_GetDouble(interp, argv[2], &alphaI) != TCL_OK) {
03032 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma - undefined alphaI\n";
03033 return TCL_ERROR;
03034 }
03035 if (Tcl_GetDouble(interp, argv[3], &alphaF) != TCL_OK) {
03036 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma - undefined alphaF\n";
03037 return TCL_ERROR;
03038 }
03039 if (Tcl_GetDouble(interp, argv[4], &beta) != TCL_OK) {
03040 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma - undefined beta\n";
03041 return TCL_ERROR;
03042 }
03043 if (Tcl_GetDouble(interp, argv[5], &gamma) != TCL_OK) {
03044 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma - undefined gamma\n";
03045 return TCL_ERROR;
03046 }
03047 }
03048 if (argc == 7) {
03049 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03050 opserr << "WARNING integrator HHTGeneralized rhoInf alphaM betaK betaKi betaKc - alphaM\n";
03051 return TCL_ERROR;
03052 }
03053 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03054 opserr << "WARNING integrator HHTGeneralized rhoInf alphaM betaK betaKi betaKc - betaK\n";
03055 return TCL_ERROR;
03056 }
03057 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03058 opserr << "WARNING integrator HHTGeneralized rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03059 return TCL_ERROR;
03060 }
03061 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03062 opserr << "WARNING integrator HHTGeneralized rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03063 return TCL_ERROR;
03064 }
03065 }
03066 if (argc == 10) {
03067 if (Tcl_GetDouble(interp, argv[6], &alphaM) != TCL_OK) {
03068 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03069 return TCL_ERROR;
03070 }
03071 if (Tcl_GetDouble(interp, argv[7], &betaK) != TCL_OK) {
03072 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaK\n";
03073 return TCL_ERROR;
03074 }
03075 if (Tcl_GetDouble(interp, argv[8], &betaKi) != TCL_OK) {
03076 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03077 return TCL_ERROR;
03078 }
03079 if (Tcl_GetDouble(interp, argv[9], &betaKc) != TCL_OK) {
03080 opserr << "WARNING integrator HHTGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKc\n";
03081 return TCL_ERROR;
03082 }
03083 }
03084 if (argc == 3)
03085 theTransientIntegrator = new HHTGeneralized(rhoInf);
03086 else if (argc == 6)
03087 theTransientIntegrator = new HHTGeneralized(alphaI, alphaF, beta, gamma);
03088 else if (argc == 7)
03089 theTransientIntegrator = new HHTGeneralized(rhoInf, alphaM, betaK, betaKi, betaKc);
03090 else if (argc == 10)
03091 theTransientIntegrator = new HHTGeneralized(alphaI, alphaF, beta, gamma, alphaM, betaK, betaKi, betaKc);
03092
03093
03094 if (theTransientAnalysis != 0)
03095 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03096 }
03097
03098 else if (strcmp(argv[1],"HHTExplicit") == 0) {
03099 double alpha, gamma;
03100 double alphaM, betaK, betaKi, betaKc;
03101 if (argc != 3 && argc != 4 && argc != 7 && argc != 8) {
03102 opserr << "WARNING integrator HHTExplicit alpha <alphaM betaK betaKi betaKc>\n";
03103 opserr << " or integrator HHTExplicit alpha gamma <alphaM betaK betaKi betaKc>\n";
03104 return TCL_ERROR;
03105 }
03106 if (Tcl_GetDouble(interp, argv[2], &alpha) != TCL_OK) {
03107 opserr << "WARNING integrator HHTExplicit alpha - undefined alpha\n";
03108 return TCL_ERROR;
03109 }
03110 if (argc == 4 || argc == 8) {
03111 if (Tcl_GetDouble(interp, argv[3], &gamma) != TCL_OK) {
03112 opserr << "WARNING integrator HHTExplicit alpha gamma - undefined gamma\n";
03113 return TCL_ERROR;
03114 }
03115 }
03116 if (argc == 7) {
03117 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03118 opserr << "WARNING integrator HHTExplicit alpha alphaM betaK betaKi betaKc - alphaM\n";
03119 return TCL_ERROR;
03120 }
03121 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03122 opserr << "WARNING integrator HHTExplicit alpha alphaM betaK betaKi betaKc - betaK\n";
03123 return TCL_ERROR;
03124 }
03125 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03126 opserr << "WARNING integrator HHTExplicit alpha alphaM betaK betaKi betaKc - betaKi\n";
03127 return TCL_ERROR;
03128 }
03129 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03130 opserr << "WARNING integrator HHTExplicit alpha alphaM betaK betaKi betaKc - betaKi\n";
03131 return TCL_ERROR;
03132 }
03133 }
03134 if (argc == 8) {
03135 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
03136 opserr << "WARNING integrator HHTExplicit alpha gamma alphaM betaK betaKi betaKc - alphaM\n";
03137 return TCL_ERROR;
03138 }
03139 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
03140 opserr << "WARNING integrator HHTExplicit alpha gamma alphaM betaK betaKi betaKc - betaK\n";
03141 return TCL_ERROR;
03142 }
03143 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
03144 opserr << "WARNING integrator HHTExplicit alpha gamma alphaM betaK betaKi betaKc - betaKi\n";
03145 return TCL_ERROR;
03146 }
03147 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
03148 opserr << "WARNING integrator HHTExplicit alpha gamma alphaM betaK betaKi betaKc - betaKi\n";
03149 return TCL_ERROR;
03150 }
03151 }
03152 if (argc == 3)
03153 theTransientIntegrator = new HHTExplicit(alpha);
03154 else if (argc == 4)
03155 theTransientIntegrator = new HHTExplicit(alpha, gamma);
03156 else if (argc == 7)
03157 theTransientIntegrator = new HHTExplicit(alpha, alphaM, betaK, betaKi, betaKc);
03158 else if (argc == 8)
03159 theTransientIntegrator = new HHTExplicit(alpha, gamma, alphaM, betaK, betaKi, betaKc);
03160
03161
03162 if (theTransientAnalysis != 0)
03163 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03164 }
03165
03166 else if (strcmp(argv[1],"HHTGeneralizedExplicit") == 0) {
03167 double rhoB, alphaI, alphaF, beta, gamma;
03168 double alphaM, betaK, betaKi, betaKc;
03169 if (argc != 4 && argc != 6 && argc != 8 && argc != 10) {
03170 opserr << "WARNING integrator HHTGeneralizedExplicit rhoB alphaF <alphaM betaK betaKi betaKc>\n";
03171 opserr << " or integrator HHTGeneralizedExplicit alphaI alphaF beta gamma <alphaM betaK betaKi betaKc>\n";
03172 return TCL_ERROR;
03173 }
03174 if (argc == 4 || argc == 8) {
03175 if (Tcl_GetDouble(interp, argv[2], &rhoB) != TCL_OK) {
03176 opserr << "WARNING integrator HHTGeneralizedExplicit rhoB alphaF - undefined rhoB\n";
03177 return TCL_ERROR;
03178 }
03179 if (Tcl_GetDouble(interp, argv[3], &alphaF) != TCL_OK) {
03180 opserr << "WARNING integrator HHTGeneralizedExplicit rhoB alphaF - undefined alphaF\n";
03181 return TCL_ERROR;
03182 }
03183 }
03184 if (argc == 6 || argc == 10) {
03185 if (Tcl_GetDouble(interp, argv[2], &alphaI) != TCL_OK) {
03186 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma - undefined alphaI\n";
03187 return TCL_ERROR;
03188 }
03189 if (Tcl_GetDouble(interp, argv[3], &alphaF) != TCL_OK) {
03190 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma - undefined alphaF\n";
03191 return TCL_ERROR;
03192 }
03193 if (Tcl_GetDouble(interp, argv[4], &beta) != TCL_OK) {
03194 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma - undefined beta\n";
03195 return TCL_ERROR;
03196 }
03197 if (Tcl_GetDouble(interp, argv[5], &gamma) != TCL_OK) {
03198 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma - undefined gamma\n";
03199 return TCL_ERROR;
03200 }
03201 }
03202 if (argc == 8) {
03203 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
03204 opserr << "WARNING integrator HHTGeneralizedExplicit rhoInf alphaM betaK betaKi betaKc - alphaM\n";
03205 return TCL_ERROR;
03206 }
03207 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
03208 opserr << "WARNING integrator HHTGeneralizedExplicit rhoInf alphaM betaK betaKi betaKc - betaK\n";
03209 return TCL_ERROR;
03210 }
03211 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
03212 opserr << "WARNING integrator HHTGeneralizedExplicit rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03213 return TCL_ERROR;
03214 }
03215 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
03216 opserr << "WARNING integrator HHTGeneralizedExplicit rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03217 return TCL_ERROR;
03218 }
03219 }
03220 if (argc == 10) {
03221 if (Tcl_GetDouble(interp, argv[6], &alphaM) != TCL_OK) {
03222 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03223 return TCL_ERROR;
03224 }
03225 if (Tcl_GetDouble(interp, argv[7], &betaK) != TCL_OK) {
03226 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaK\n";
03227 return TCL_ERROR;
03228 }
03229 if (Tcl_GetDouble(interp, argv[8], &betaKi) != TCL_OK) {
03230 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03231 return TCL_ERROR;
03232 }
03233 if (Tcl_GetDouble(interp, argv[9], &betaKc) != TCL_OK) {
03234 opserr << "WARNING integrator HHTGeneralizedExplicit alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKc\n";
03235 return TCL_ERROR;
03236 }
03237 }
03238 if (argc == 4)
03239 theTransientIntegrator = new HHTGeneralizedExplicit(rhoB, alphaF);
03240 else if (argc == 6)
03241 theTransientIntegrator = new HHTGeneralizedExplicit(alphaI, alphaF, beta, gamma);
03242 else if (argc == 8)
03243 theTransientIntegrator = new HHTGeneralizedExplicit(rhoB, alphaF, alphaM, betaK, betaKi, betaKc);
03244 else if (argc == 10)
03245 theTransientIntegrator = new HHTGeneralizedExplicit(alphaI, alphaF, beta, gamma, alphaM, betaK, betaKi, betaKc);
03246
03247
03248 if (theTransientAnalysis != 0)
03249 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03250 }
03251
03252 else if (strcmp(argv[1],"HHTHybridSimulation") == 0) {
03253 double rhoInf, alphaI, alphaF, beta, gamma;
03254 double alphaM, betaK, betaKi, betaKc;
03255 if (argc != 3 && argc != 6 && argc != 7 && argc != 10) {
03256 opserr << "WARNING integrator HHTHybridSimulation rhoInf <alphaM betaK betaKi betaKc>\n";
03257 opserr << " or integrator HHTHybridSimulation alphaI alphaF beta gamma <alphaM betaK betaKi betaKc>\n";
03258 return TCL_ERROR;
03259 }
03260 if (argc == 3 || argc == 7) {
03261 if (Tcl_GetDouble(interp, argv[2], &rhoInf) != TCL_OK) {
03262 opserr << "WARNING integrator HHTHybridSimulation rhoInf - undefined rhoInf\n";
03263 return TCL_ERROR;
03264 }
03265 }
03266 if (argc == 6 || argc == 10) {
03267 if (Tcl_GetDouble(interp, argv[2], &alphaI) != TCL_OK) {
03268 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma - undefined alphaI\n";
03269 return TCL_ERROR;
03270 }
03271 if (Tcl_GetDouble(interp, argv[3], &alphaF) != TCL_OK) {
03272 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma - undefined alphaF\n";
03273 return TCL_ERROR;
03274 }
03275 if (Tcl_GetDouble(interp, argv[4], &beta) != TCL_OK) {
03276 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma - undefined beta\n";
03277 return TCL_ERROR;
03278 }
03279 if (Tcl_GetDouble(interp, argv[5], &gamma) != TCL_OK) {
03280 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma - undefined gamma\n";
03281 return TCL_ERROR;
03282 }
03283 }
03284 if (argc == 7) {
03285 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03286 opserr << "WARNING integrator HHTHybridSimulation rhoInf alphaM betaK betaKi betaKc - alphaM\n";
03287 return TCL_ERROR;
03288 }
03289 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03290 opserr << "WARNING integrator HHTHybridSimulation rhoInf alphaM betaK betaKi betaKc - betaK\n";
03291 return TCL_ERROR;
03292 }
03293 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03294 opserr << "WARNING integrator HHTHybridSimulation rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03295 return TCL_ERROR;
03296 }
03297 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03298 opserr << "WARNING integrator HHTHybridSimulation rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03299 return TCL_ERROR;
03300 }
03301 }
03302 if (argc == 10) {
03303 if (Tcl_GetDouble(interp, argv[6], &alphaM) != TCL_OK) {
03304 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03305 return TCL_ERROR;
03306 }
03307 if (Tcl_GetDouble(interp, argv[7], &betaK) != TCL_OK) {
03308 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaK\n";
03309 return TCL_ERROR;
03310 }
03311 if (Tcl_GetDouble(interp, argv[8], &betaKi) != TCL_OK) {
03312 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03313 return TCL_ERROR;
03314 }
03315 if (Tcl_GetDouble(interp, argv[9], &betaKc) != TCL_OK) {
03316 opserr << "WARNING integrator HHTHybridSimulation alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKc\n";
03317 return TCL_ERROR;
03318 }
03319 }
03320 if (theTest == 0) {
03321 opserr << "WARNING no ConvergenceTest specified yet\n";
03322 return TCL_ERROR;
03323 }
03324 if (argc == 3)
03325 theTransientIntegrator = new HHTHybridSimulation(rhoInf, *theTest);
03326 else if (argc == 6)
03327 theTransientIntegrator = new HHTHybridSimulation(alphaI, alphaF, beta, gamma, *theTest);
03328 else if (argc == 7)
03329 theTransientIntegrator = new HHTHybridSimulation(rhoInf, *theTest, alphaM, betaK, betaKi, betaKc);
03330 else if (argc == 10)
03331 theTransientIntegrator = new HHTHybridSimulation(alphaI, alphaF, beta, gamma, *theTest, alphaM, betaK, betaKi, betaKc);
03332
03333
03334 if (theTransientAnalysis != 0)
03335 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03336 }
03337
03338 else if (strcmp(argv[1],"AlphaOS") == 0) {
03339 double alpha, beta, gamma;
03340 double alphaM, betaK, betaKi, betaKc;
03341 if (argc != 3 && argc != 5 && argc != 7 && argc != 9) {
03342 opserr << "WARNING integrator AlphaOS alpha <alphaM betaK betaKi betaKc>\n";
03343 opserr << " or integrator AlphaOS alpha beta gamma <alphaM betaK betaKi betaKc>\n";
03344 return TCL_ERROR;
03345 }
03346 if (Tcl_GetDouble(interp, argv[2], &alpha) != TCL_OK) {
03347 opserr << "WARNING integrator AlphaOS alpha - undefined alpha\n";
03348 return TCL_ERROR;
03349 }
03350 if (argc == 5 || argc == 9) {
03351 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
03352 opserr << "WARNING integrator AlphaOS alpha beta gamma - undefined beta\n";
03353 return TCL_ERROR;
03354 }
03355 if (Tcl_GetDouble(interp, argv[4], &gamma) != TCL_OK) {
03356 opserr << "WARNING integrator AlphaOS alpha beta gamma - undefined gamma\n";
03357 return TCL_ERROR;
03358 }
03359 }
03360 if (argc == 7) {
03361 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03362 opserr << "WARNING integrator AlphaOS alpha alphaM betaK betaKi betaKc - alphaM\n";
03363 return TCL_ERROR;
03364 }
03365 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03366 opserr << "WARNING integrator AlphaOS alpha alphaM betaK betaKi betaKc - betaK\n";
03367 return TCL_ERROR;
03368 }
03369 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03370 opserr << "WARNING integrator AlphaOS alpha alphaM betaK betaKi betaKc - betaKi\n";
03371 return TCL_ERROR;
03372 }
03373 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03374 opserr << "WARNING integrator AlphaOS alpha alphaM betaK betaKi betaKc - betaKi\n";
03375 return TCL_ERROR;
03376 }
03377 }
03378 if (argc == 9) {
03379 if (Tcl_GetDouble(interp, argv[5], &alphaM) != TCL_OK) {
03380 opserr << "WARNING integrator AlphaOS alpha beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03381 return TCL_ERROR;
03382 }
03383 if (Tcl_GetDouble(interp, argv[6], &betaK) != TCL_OK) {
03384 opserr << "WARNING integrator AlphaOS alpha beta gamma alphaM betaK betaKi betaKc - betaK\n";
03385 return TCL_ERROR;
03386 }
03387 if (Tcl_GetDouble(interp, argv[7], &betaKi) != TCL_OK) {
03388 opserr << "WARNING integrator AlphaOS alpha beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03389 return TCL_ERROR;
03390 }
03391 if (Tcl_GetDouble(interp, argv[8], &betaKc) != TCL_OK) {
03392 opserr << "WARNING integrator AlphaOS alpha beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03393 return TCL_ERROR;
03394 }
03395 }
03396 if (argc == 3)
03397 theTransientIntegrator = new AlphaOS(alpha);
03398 else if (argc == 5)
03399 theTransientIntegrator = new AlphaOS(alpha, beta, gamma);
03400 else if (argc == 7)
03401 theTransientIntegrator = new AlphaOS(alpha, alphaM, betaK, betaKi, betaKc);
03402 else if (argc == 9)
03403 theTransientIntegrator = new AlphaOS(alpha, beta, gamma, alphaM, betaK, betaKi, betaKc);
03404
03405
03406 if (theTransientAnalysis != 0)
03407 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03408 }
03409
03410 else if (strcmp(argv[1],"AlphaOSGeneralized") == 0) {
03411 double rhoInf, alphaI, alphaF, beta, gamma;
03412 double alphaM, betaK, betaKi, betaKc;
03413 if (argc != 3 && argc != 6 && argc != 7 && argc != 10) {
03414 opserr << "WARNING integrator AlphaOSGeneralized rhoInf <alphaM betaK betaKi betaKc>\n";
03415 opserr << " or integrator AlphaOSGeneralized alphaI alphaF beta gamma <alphaM betaK betaKi betaKc>\n";
03416 return TCL_ERROR;
03417 }
03418 if (argc == 3 || argc == 7) {
03419 if (Tcl_GetDouble(interp, argv[2], &rhoInf) != TCL_OK) {
03420 opserr << "WARNING integrator AlphaOSGeneralized rhoInf - undefined rhoInf\n";
03421 return TCL_ERROR;
03422 }
03423 }
03424 if (argc == 6 || argc == 10) {
03425 if (Tcl_GetDouble(interp, argv[2], &alphaI) != TCL_OK) {
03426 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma - undefined alphaI\n";
03427 return TCL_ERROR;
03428 }
03429 if (Tcl_GetDouble(interp, argv[3], &alphaF) != TCL_OK) {
03430 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma - undefined alphaF\n";
03431 return TCL_ERROR;
03432 }
03433 if (Tcl_GetDouble(interp, argv[4], &beta) != TCL_OK) {
03434 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma - undefined beta\n";
03435 return TCL_ERROR;
03436 }
03437 if (Tcl_GetDouble(interp, argv[5], &gamma) != TCL_OK) {
03438 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma - undefined gamma\n";
03439 return TCL_ERROR;
03440 }
03441 }
03442 if (argc == 7) {
03443 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03444 opserr << "WARNING integrator AlphaOSGeneralized rhoInf alphaM betaK betaKi betaKc - alphaM\n";
03445 return TCL_ERROR;
03446 }
03447 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03448 opserr << "WARNING integrator AlphaOSGeneralized rhoInf alphaM betaK betaKi betaKc - betaK\n";
03449 return TCL_ERROR;
03450 }
03451 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03452 opserr << "WARNING integrator AlphaOSGeneralized rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03453 return TCL_ERROR;
03454 }
03455 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03456 opserr << "WARNING integrator AlphaOSGeneralized rhoInf alphaM betaK betaKi betaKc - betaKi\n";
03457 return TCL_ERROR;
03458 }
03459 }
03460 if (argc == 10) {
03461 if (Tcl_GetDouble(interp, argv[6], &alphaM) != TCL_OK) {
03462 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03463 return TCL_ERROR;
03464 }
03465 if (Tcl_GetDouble(interp, argv[7], &betaK) != TCL_OK) {
03466 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaK\n";
03467 return TCL_ERROR;
03468 }
03469 if (Tcl_GetDouble(interp, argv[8], &betaKi) != TCL_OK) {
03470 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03471 return TCL_ERROR;
03472 }
03473 if (Tcl_GetDouble(interp, argv[9], &betaKc) != TCL_OK) {
03474 opserr << "WARNING integrator AlphaOSGeneralized alphaI alphaF beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03475 return TCL_ERROR;
03476 }
03477 }
03478 if (argc == 3)
03479 theTransientIntegrator = new AlphaOSGeneralized(rhoInf);
03480 else if (argc == 6)
03481 theTransientIntegrator = new AlphaOSGeneralized(alphaI, alphaF, beta, gamma);
03482 else if (argc == 7)
03483 theTransientIntegrator = new AlphaOSGeneralized(rhoInf, alphaM, betaK, betaKi, betaKc);
03484 else if (argc == 10)
03485 theTransientIntegrator = new AlphaOSGeneralized(alphaI, alphaF, beta, gamma, alphaM, betaK, betaKi, betaKc);
03486
03487
03488 if (theTransientAnalysis != 0)
03489 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03490 }
03491
03492 else if (strcmp(argv[1],"Collocation") == 0) {
03493 double theta, beta, gamma;
03494 double alphaM, betaK, betaKi, betaKc;
03495 if (argc != 3 && argc != 5 && argc != 7 && argc != 9) {
03496 opserr << "WARNING integrator Collocation theta <alphaM betaK betaKi betaKc>\n";
03497 opserr << " or integrator Collocation theta beta gamma <alphaM betaK betaKi betaKc>\n";
03498 return TCL_ERROR;
03499 }
03500 if (Tcl_GetDouble(interp, argv[2], &theta) != TCL_OK) {
03501 opserr << "WARNING integrator Collocation theta - undefined theta\n";
03502 return TCL_ERROR;
03503 }
03504 if (argc == 5 || argc == 9) {
03505 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
03506 opserr << "WARNING integrator Collocation theta beta gamma - undefined beta\n";
03507 return TCL_ERROR;
03508 }
03509 if (Tcl_GetDouble(interp, argv[4], &gamma) != TCL_OK) {
03510 opserr << "WARNING integrator Collocation theta beta gamma - undefined gamma\n";
03511 return TCL_ERROR;
03512 }
03513 }
03514 if (argc == 7) {
03515 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03516 opserr << "WARNING integrator Collocation theta alphaM betaK betaKi betaKc - alphaM\n";
03517 return TCL_ERROR;
03518 }
03519 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03520 opserr << "WARNING integrator Collocation theta alphaM betaK betaKi betaKc - betaK\n";
03521 return TCL_ERROR;
03522 }
03523 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03524 opserr << "WARNING integrator Collocation theta alphaM betaK betaKi betaKc - betaKi\n";
03525 return TCL_ERROR;
03526 }
03527 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03528 opserr << "WARNING integrator Collocation theta alphaM betaK betaKi betaKc - betaKi\n";
03529 return TCL_ERROR;
03530 }
03531 }
03532 if (argc == 9) {
03533 if (Tcl_GetDouble(interp, argv[5], &alphaM) != TCL_OK) {
03534 opserr << "WARNING integrator Collocation theta beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03535 return TCL_ERROR;
03536 }
03537 if (Tcl_GetDouble(interp, argv[6], &betaK) != TCL_OK) {
03538 opserr << "WARNING integrator Collocation theta beta gamma alphaM betaK betaKi betaKc - betaK\n";
03539 return TCL_ERROR;
03540 }
03541 if (Tcl_GetDouble(interp, argv[7], &betaKi) != TCL_OK) {
03542 opserr << "WARNING integrator Collocation theta beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03543 return TCL_ERROR;
03544 }
03545 if (Tcl_GetDouble(interp, argv[8], &betaKc) != TCL_OK) {
03546 opserr << "WARNING integrator Collocation theta beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03547 return TCL_ERROR;
03548 }
03549 }
03550 if (argc == 3)
03551 theTransientIntegrator = new Collocation(theta);
03552 else if (argc == 5)
03553 theTransientIntegrator = new Collocation(theta, beta, gamma);
03554 else if (argc == 7)
03555 theTransientIntegrator = new Collocation(theta, alphaM, betaK, betaKi, betaKc);
03556 else if (argc == 9)
03557 theTransientIntegrator = new Collocation(theta, beta, gamma, alphaM, betaK, betaKi, betaKc);
03558
03559
03560 if (theTransientAnalysis != 0)
03561 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03562 }
03563
03564 else if (strcmp(argv[1],"CollocationHybridSimulation") == 0) {
03565 double theta, beta, gamma;
03566 double alphaM, betaK, betaKi, betaKc;
03567 if (argc != 3 && argc != 5 && argc != 7 && argc != 9) {
03568 opserr << "WARNING integrator CollocationHybridSimulation theta <alphaM betaK betaKi betaKc>\n";
03569 opserr << " or integrator CollocationHybridSimulation theta beta gamma <alphaM betaK betaKi betaKc>\n";
03570 return TCL_ERROR;
03571 }
03572 if (Tcl_GetDouble(interp, argv[2], &theta) != TCL_OK) {
03573 opserr << "WARNING integrator CollocationHybridSimulation theta - undefined theta\n";
03574 return TCL_ERROR;
03575 }
03576 if (argc == 5 || argc == 9) {
03577 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
03578 opserr << "WARNING integrator CollocationHybridSimulation theta beta gamma - undefined beta\n";
03579 return TCL_ERROR;
03580 }
03581 if (Tcl_GetDouble(interp, argv[4], &gamma) != TCL_OK) {
03582 opserr << "WARNING integrator CollocationHybridSimulation theta beta gamma - undefined gamma\n";
03583 return TCL_ERROR;
03584 }
03585 }
03586 if (argc == 7) {
03587 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03588 opserr << "WARNING integrator CollocationHybridSimulation theta alphaM betaK betaKi betaKc - alphaM\n";
03589 return TCL_ERROR;
03590 }
03591 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03592 opserr << "WARNING integrator CollocationHybridSimulation theta alphaM betaK betaKi betaKc - betaK\n";
03593 return TCL_ERROR;
03594 }
03595 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03596 opserr << "WARNING integrator CollocationHybridSimulation theta alphaM betaK betaKi betaKc - betaKi\n";
03597 return TCL_ERROR;
03598 }
03599 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03600 opserr << "WARNING integrator CollocationHybridSimulation theta alphaM betaK betaKi betaKc - betaKi\n";
03601 return TCL_ERROR;
03602 }
03603 }
03604 if (argc == 9) {
03605 if (Tcl_GetDouble(interp, argv[5], &alphaM) != TCL_OK) {
03606 opserr << "WARNING integrator CollocationHybridSimulation theta beta gamma alphaM betaK betaKi betaKc - alphaM\n";
03607 return TCL_ERROR;
03608 }
03609 if (Tcl_GetDouble(interp, argv[6], &betaK) != TCL_OK) {
03610 opserr << "WARNING integrator CollocationHybridSimulation theta beta gamma alphaM betaK betaKi betaKc - betaK\n";
03611 return TCL_ERROR;
03612 }
03613 if (Tcl_GetDouble(interp, argv[7], &betaKi) != TCL_OK) {
03614 opserr << "WARNING integrator CollocationHybridSimulation theta beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03615 return TCL_ERROR;
03616 }
03617 if (Tcl_GetDouble(interp, argv[8], &betaKc) != TCL_OK) {
03618 opserr << "WARNING integrator CollocationHybridSimulation theta beta gamma alphaM betaK betaKi betaKc - betaKi\n";
03619 return TCL_ERROR;
03620 }
03621 }
03622 if (theTest == 0) {
03623 opserr << "WARNING no ConvergenceTest specified yet\n";
03624 return TCL_ERROR;
03625 }
03626 if (argc == 3)
03627 theTransientIntegrator = new CollocationHybridSimulation(theta, *theTest);
03628 else if (argc == 5)
03629 theTransientIntegrator = new CollocationHybridSimulation(theta, beta, gamma, *theTest);
03630 else if (argc == 7)
03631 theTransientIntegrator = new CollocationHybridSimulation(theta, *theTest, alphaM, betaK, betaKi, betaKc);
03632 else if (argc == 9)
03633 theTransientIntegrator = new CollocationHybridSimulation(theta, beta, gamma, *theTest, alphaM, betaK, betaKi, betaKc);
03634
03635
03636 if (theTransientAnalysis != 0)
03637 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03638 }
03639
03640 else if (strcmp(argv[1],"Newmark1") == 0) {
03641 double gamma;
03642 double beta;
03643 double alphaM, betaK, betaKi, betaKc;
03644 if (argc != 4 && argc != 8) {
03645 opserr << "WARNING integrator Newmark1 gamma beta <alphaM> <betaKcurrent> <betaKi> <betaKlastCommitted>\n";
03646 return TCL_ERROR;
03647 }
03648 if (Tcl_GetDouble(interp, argv[2], &gamma) != TCL_OK) {
03649 opserr << "WARNING integrator Newmark1 gamma beta - undefined gamma\n";
03650 return TCL_ERROR;
03651 }
03652 if (Tcl_GetDouble(interp, argv[3], &beta) != TCL_OK) {
03653 opserr << "WARNING integrator Newmark1 gamma beta - undefined beta\n";
03654 return TCL_ERROR;
03655 }
03656
03657 if (argc == 8 || argc == 7) {
03658 if (Tcl_GetDouble(interp, argv[4], &alphaM) != TCL_OK) {
03659 opserr << "WARNING integrator Newmark1 gamma beta alphaM betaK betaKi betaKc - alphaM\n";
03660 return TCL_ERROR;
03661 }
03662 if (Tcl_GetDouble(interp, argv[5], &betaK) != TCL_OK) {
03663 opserr << "WARNING integrator Newmark1 gamma beta alphaM betaK betaKi betaKc - betaK\n";
03664 return TCL_ERROR;
03665 }
03666 if (Tcl_GetDouble(interp, argv[6], &betaKi) != TCL_OK) {
03667 opserr << "WARNING integrator Newmark1 gamma beta alphaM betaK betaKi betaKc - betaKi\n";
03668 return TCL_ERROR;
03669 }
03670 if (Tcl_GetDouble(interp, argv[7], &betaKc) != TCL_OK) {
03671 opserr << "WARNING integrator Newmark1 gamma beta alphaM betaK betaKi betaKc - betaKc\n";
03672 return TCL_ERROR;
03673 }
03674 }
03675 if (argc == 4)
03676 theTransientIntegrator = new Newmark1(gamma,beta);
03677 else
03678 theTransientIntegrator = new Newmark1(gamma,beta,alphaM,betaK,betaKi, betaKc);
03679
03680
03681 if (theTransientAnalysis != 0)
03682 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03683 }
03684
03685 else if (strcmp(argv[1],"HHT1") == 0) {
03686 double alpha;
03687 double alphaM, betaK, betaKi, betaKc;
03688 if (argc != 3 && argc != 7) {
03689 opserr << "WARNING integrator HHT1 alpha <alphaM> <betaKcurrent> <betaKi> <betaKlastCommitted>\n";
03690 return TCL_ERROR;
03691 }
03692 if (Tcl_GetDouble(interp, argv[2], &alpha) != TCL_OK) {
03693 opserr << "WARNING integrator HHT alpha - undefined alpha\n";
03694 return TCL_ERROR;
03695 }
03696 if (argc == 7 || argc == 6) {
03697 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03698 opserr << "WARNING integrator HHT1 alpha alphaM betaK betaKi betaKc - alphaM\n";
03699 return TCL_ERROR;
03700 }
03701 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03702 opserr << "WARNING integrator HHT1 alpha alphaM betaK betaKi betaKc - betaK\n";
03703 return TCL_ERROR;
03704 }
03705 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03706 opserr << "WARNING integrator HHT1 alpha alphaM betaK betaKi betaKc - betaKi\n";
03707 return TCL_ERROR;
03708 }
03709 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03710 opserr << "WARNING integrator HHT1 alpha alphaM betaK betaKi betaKc - betaKc\n";
03711 return TCL_ERROR;
03712 }
03713 }
03714 if (argc == 3)
03715 theTransientIntegrator = new HHT1(alpha);
03716 else
03717 theTransientIntegrator = new HHT1(alpha,alphaM,betaK, betaKi, betaKc);
03718
03719
03720 if (theTransientAnalysis != 0)
03721 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03722 }
03723
03724
03725 else if (strcmp(argv[1],"WilsonTheta") == 0) {
03726 double theta, alphaM,betaK, betaKi, betaKc;
03727 if (argc != 3 && argc != 7) {
03728 opserr << "WARNING integrator WilsonTheta theta <alphaM> <betaK> <betaK0> <betaKc>\n";
03729 return TCL_ERROR;
03730 }
03731 if (Tcl_GetDouble(interp, argv[2], &theta) != TCL_OK) {
03732 opserr << "WARNING integrator WilsonTheta theta - undefined theta\n";
03733 return TCL_ERROR;
03734 }
03735 if (argc == 7) {
03736 if (Tcl_GetDouble(interp, argv[3], &alphaM) != TCL_OK) {
03737 opserr << "WARNING integrator WilsonTheta gamma beta alphaM betaK betaK0 betaKc- alphaM\n";
03738 return TCL_ERROR;
03739 }
03740 if (Tcl_GetDouble(interp, argv[4], &betaK) != TCL_OK) {
03741 opserr << "WARNING integrator WilsonTheta gamma beta alphaM betaK betaK0 betaKc - betaK\n";
03742 return TCL_ERROR;
03743 }
03744 if (Tcl_GetDouble(interp, argv[5], &betaKi) != TCL_OK) {
03745 opserr << "WARNING integrator WilsonTheta gamma beta alphaM betaK betaK0 betaKc - betaKi\n";
03746 return TCL_ERROR;
03747 }
03748 if (Tcl_GetDouble(interp, argv[6], &betaKc) != TCL_OK) {
03749 opserr << "WARNING integrator WilsonTheta gamma beta alphaM betaK betaK0 betaKc - betaKc\n";
03750 return TCL_ERROR;
03751 }
03752 }
03753 if (argc == 3)
03754 theTransientIntegrator = new WilsonTheta(theta);
03755 else
03756 theTransientIntegrator = new WilsonTheta(theta, alphaM, betaK, betaKi, betaKc);
03757
03758
03759 if (theTransientAnalysis != 0)
03760 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03761 }
03762
03763 else if (strcmp(argv[1],"CentralDifference") == 0) {
03764 theTransientIntegrator = new CentralDifference();
03765
03766
03767 if (theTransientAnalysis != 0)
03768 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03769 }
03770
03771 else if (strcmp(argv[1],"CentralDifferenceAlternative") == 0) {
03772 theTransientIntegrator = new CentralDifferenceAlternative();
03773
03774
03775 if (theTransientAnalysis != 0)
03776 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03777 }
03778
03779 else if (strcmp(argv[1],"CentralDifferenceNoDamping") == 0) {
03780 theTransientIntegrator = new CentralDifferenceNoDamping();
03781
03782
03783 if (theTransientAnalysis != 0)
03784 theTransientAnalysis->setIntegrator(*theTransientIntegrator);
03785 }
03786
03787 else {
03788 opserr << "WARNING No Integrator type exists \n";
03789 return TCL_ERROR;
03790 }
03791
03792 #ifdef _PARALLEL_PROCESSING
03793 if (theStaticAnalysis != 0 && theStaticIntegrator != 0) {
03794 IncrementalIntegrator *theIntegrator;
03795 theIntegrator = theStaticIntegrator;
03796
03797 SubdomainIter &theSubdomains = theDomain.getSubdomains();
03798 Subdomain *theSub;
03799 while ((theSub = theSubdomains()) != 0) {
03800 theSub->setAnalysisIntegrator(*theIntegrator);
03801 }
03802 } else if (theTransientAnalysis != 0 && theTransientIntegrator != 0) {
03803 IncrementalIntegrator *theIntegrator;
03804 theIntegrator = theStaticIntegrator;
03805
03806 SubdomainIter &theSubdomains = theDomain.getSubdomains();
03807 Subdomain *theSub;
03808 while ((theSub = theSubdomains()) != 0) {
03809 theSub->setAnalysisIntegrator(*theIntegrator);
03810 }
03811 }
03812 #endif
03813
03814 return TCL_OK;
03815 }
03816
03817
03818 extern int
03819 TclAddRecorder(ClientData clientData, Tcl_Interp *interp, int argc,
03820 TCL_Char **argv, Domain &theDomain);
03821
03822 int
03823 addRecorder(ClientData clientData, Tcl_Interp *interp, int argc,
03824 TCL_Char **argv)
03825 {
03826 return TclAddRecorder(clientData, interp, argc, argv, theDomain);
03827 }
03828
03829 extern int
03830 TclAddAlgorithmRecorder(ClientData clientData, Tcl_Interp *interp, int argc,
03831 TCL_Char **argv, Domain &theDomain, EquiSolnAlgo *theAlgorithm);
03832
03833 int
03834 addAlgoRecorder(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
03835 {
03836 if (theAlgorithm != 0)
03837 return TclAddAlgorithmRecorder(clientData, interp, argc, argv,
03838 theDomain, theAlgorithm);
03839
03840 else
03841 return 0;
03842 }
03843
03844 extern int
03845 TclAddDatabase(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv,
03846 Domain &theDomain,
03847 FEM_ObjectBroker &theBroker);
03848
03849 int
03850 addDatabase(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
03851 {
03852 return TclAddDatabase(clientData, interp, argc, argv, theDomain, theBroker);
03853 }
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868
03869
03870
03871
03872
03873
03874
03875
03876
03877
03878
03879
03880
03881
03882
03883
03884
03885
03886
03887
03888
03889
03890
03891
03892
03893
03894
03895
03896
03897
03898
03899
03900
03901
03902
03903 int
03904 rigidLink(ClientData clientData, Tcl_Interp *interp, int argc,
03905 TCL_Char **argv)
03906 {
03907 if (argc < 4) {
03908 opserr << "WARNING rigidLink linkType? rNode? cNode?\n";
03909 return TCL_ERROR;
03910 }
03911
03912 int numMPs = theDomain.getNumMPs();
03913 int rNode, cNode;
03914 if (Tcl_GetInt(interp, argv[2], &rNode) != TCL_OK) {
03915 opserr << "WARNING rigidLink linkType? rNode? cNode? - could not read rNode \n";
03916 return TCL_ERROR;
03917 }
03918 if (Tcl_GetInt(interp, argv[3], &cNode) != TCL_OK) {
03919 opserr << "WARNING rigidLink linkType? rNode? cNode? - could not read CNode \n";
03920 return TCL_ERROR;
03921 }
03922
03923
03924 if ((strcmp(argv[1],"-bar") == 0) || (strcmp(argv[1],"bar") == 0)) {
03925 RigidRod theLink(theDomain, rNode, cNode, numMPs);
03926 } else if ((strcmp(argv[1],"-beam") == 0) || (strcmp(argv[1],"beam") == 0)) {
03927 RigidBeam theLink(theDomain, rNode, cNode, numMPs);
03928 } else {
03929 opserr << "WARNING rigidLink linkType? rNode? cNode? - unrecognised link type (-bar, -beam) \n";
03930 return TCL_ERROR;
03931 }
03932
03933 return TCL_OK;
03934 }
03935
03936
03937
03938 int
03939 rigidDiaphragm(ClientData clientData, Tcl_Interp *interp, int argc,
03940 TCL_Char **argv)
03941 {
03942 if (argc < 3) {
03943 opserr << "WARNING rigidLink perpDirn? rNode? <cNodes?>\n";
03944 return TCL_ERROR;
03945 }
03946
03947 int rNode, perpDirn;
03948 if (Tcl_GetInt(interp, argv[1], &perpDirn) != TCL_OK) {
03949 opserr << "WARNING rigidLink perpDirn rNode cNodes - could not read perpDirn? \n";
03950 return TCL_ERROR;
03951 }
03952
03953 if (Tcl_GetInt(interp, argv[2], &rNode) != TCL_OK) {
03954 opserr << "WARNING rigidLink perpDirn rNode cNodes - could not read rNode \n";
03955 return TCL_ERROR;
03956 }
03957
03958
03959 int numConstrainedNodes = argc - 3;
03960 ID constrainedNodes(numConstrainedNodes);
03961 for (int i=0; i<numConstrainedNodes; i++) {
03962 int cNode;
03963 if (Tcl_GetInt(interp, argv[3+i], &cNode) != TCL_OK) {
03964 opserr << "WARNING rigidLink perpDirn rNode cNodes - could not read a cNode\n";
03965 return TCL_ERROR;
03966 }
03967 constrainedNodes(i) = cNode;
03968 }
03969 int numMPs = theDomain.getNumMPs();
03970 RigidDiaphragm theLink(theDomain, rNode, constrainedNodes,
03971 perpDirn-1, numMPs);
03972
03973 return TCL_OK;
03974 }
03975
03976
03977 int
03978 eigenAnalysis(ClientData clientData, Tcl_Interp *interp, int argc,
03979 TCL_Char **argv)
03980 {
03981
03982 if (argc < 2) {
03983 opserr << "WARNING want - eigen <type> numModes?\n";
03984 return TCL_ERROR;
03985 }
03986
03987 int typeAlgo = 0;
03988 int typeSolver = 2;
03989 int loc = 1;
03990
03991
03992 while (loc < (argc-1)) {
03993
03994 if ((strcmp(argv[loc],"frequency") == 0) ||
03995 (strcmp(argv[loc],"-frequency") == 0) ||
03996 (strcmp(argv[loc],"generalized") == 0) ||
03997 (strcmp(argv[loc],"-generalized") == 0))
03998 typeAlgo = 0;
03999
04000 else if ((strcmp(argv[loc],"standard") == 0) ||
04001 (strcmp(argv[loc],"-standard") == 0))
04002 typeAlgo = 1;
04003
04004 else if ((strcmp(argv[loc],"symmBandLapack") == 0) ||
04005 (strcmp(argv[loc],"-symmBandLapack") == 0))
04006 typeSolver = 0;
04007
04008 else if ((strcmp(argv[loc],"symmSparseArpack") == 0) ||
04009 (strcmp(argv[loc],"-symmSparseArpack") == 0))
04010 typeSolver = 1;
04011
04012 else if ((strcmp(argv[loc],"genBandArpack") == 0) ||
04013 (strcmp(argv[loc],"-genBandArpack") == 0))
04014 typeSolver = 2;
04015
04016 else {
04017 opserr << "eigen - unknown option specified " << argv[loc] << endln;
04018 return TCL_ERROR;
04019 }
04020
04021 loc++;
04022 }
04023
04024
04025
04026 int numEigen;
04027 if ((Tcl_GetInt(interp, argv[loc], &numEigen) != TCL_OK) || numEigen < 0) {
04028 opserr << "WARNING eigen numModes? - illegal numModes\n";
04029 return TCL_ERROR;
04030 }
04031
04032 EigenAlgorithm *theEigenAlgo = 0;
04033 EigenSOE *theEigenSOE = 0;
04034 AnalysisModel *theEigenModel = new AnalysisModel();
04035
04036
04037 if (typeAlgo == 0)
04038 theEigenAlgo = new FrequencyAlgo();
04039 else if (typeAlgo == 1) {
04040 theEigenAlgo = new StandardEigenAlgo();
04041
04042
04043 SymBandEigenSolver *theEigenSolver = new SymBandEigenSolver();
04044 theEigenSOE = new SymBandEigenSOE(*theEigenSolver, *theEigenModel);
04045
04046 }
04047
04048
04049 if (typeAlgo == 0) {
04050
04051
04052 if (typeSolver == 0) {
04053 SymBandEigenSolver *theEigenSolver = new SymBandEigenSolver();
04054 theEigenSOE = new SymBandEigenSOE(*theEigenSolver, *theEigenModel);
04055 } else if (typeSolver == 1) {
04056 SymArpackSolver *theEigenSolver = new SymArpackSolver(numEigen);
04057 theEigenSOE = new SymArpackSOE(*theEigenSolver, *theEigenModel);
04058 } else if (typeSolver == 2) {
04059 BandArpackSolver *theEigenSolver = new BandArpackSolver(numEigen);
04060 theEigenSOE = new BandArpackSOE(*theEigenSolver, *theEigenModel);
04061 }
04062 }
04063
04064 EigenIntegrator *theEigenIntegrator = new EigenIntegrator();
04065 RCM *theRCM = new RCM(false);
04066 DOF_Numberer *theEigenNumberer = new DOF_Numberer(*theRCM);
04067 ConstraintHandler *theEigenHandler = new TransformationConstraintHandler();
04068
04069
04070
04071 theEigenAnalysis = new EigenAnalysis(theDomain,
04072 *theEigenHandler,
04073 *theEigenNumberer,
04074 *theEigenModel,
04075 *theEigenAlgo,
04076 *theEigenSOE,
04077 *theEigenIntegrator);
04078
04079 int requiredDataSize = 20*numEigen;
04080 if (requiredDataSize > resDataSize) {
04081 if (resDataPtr != 0) {
04082 delete [] resDataPtr;
04083 }
04084 resDataPtr = new char[requiredDataSize];
04085 resDataSize = requiredDataSize;
04086 }
04087
04088 for (int i=0; i<requiredDataSize; i++)
04089 resDataPtr[i] = '\n';
04090
04091
04092
04093 if (theEigenAnalysis->analyze(numEigen) == 0) {
04094
04095 const Vector &eigenvalues = theDomain.getEigenvalues();
04096 int cnt = 0;
04097
04098 for (int i=0; i<numEigen; i++) {
04099 cnt += sprintf(&resDataPtr[cnt], "%.6e ", eigenvalues[i]);
04100 }
04101
04102 Tcl_SetResult(interp, resDataPtr, TCL_STATIC);
04103 }
04104
04105
04106 delete theEigenAnalysis;
04107
04108 theEigenAnalysis = 0;
04109
04110 return TCL_OK;
04111 }
04112
04113
04114
04115
04116
04117
04118
04119
04120 int
04121 videoPlayer(ClientData clientData, Tcl_Interp *interp, int argc,
04122 TCL_Char **argv)
04123 {
04124
04125 if (argc < 5) {
04126 opserr << "WARNING want - video -window windowTitle? -file fileName?\n";
04127 return TCL_ERROR;
04128 }
04129
04130 TCL_Char *wTitle =0;
04131 TCL_Char *fName = 0;
04132 TCL_Char *imageName = 0;
04133 TCL_Char *offsetName = 0;
04134
04135 int endMarker = 1;
04136 while (endMarker < (argc-1)) {
04137 if (strcmp(argv[endMarker],"-window") == 0) {
04138 wTitle = argv[endMarker+1];
04139 endMarker+=2;
04140 } else if (strcmp(argv[endMarker],"-file") == 0) {
04141 fName = argv[endMarker+1];
04142 endMarker+=2;
04143 } else if (strcmp(argv[endMarker],"-image") == 0) {
04144 imageName = argv[endMarker+1];
04145 endMarker += 2;
04146 } else if (strcmp(argv[endMarker],"-offset") == 0) {
04147 offsetName = argv[endMarker+1];
04148 endMarker += 2;
04149 }
04150 else {
04151 opserr << "WARNING unknown " << argv[endMarker] <<
04152 " want - video -window windowTitle? -file fileName?\n";
04153
04154 return TCL_ERROR;
04155 }
04156 }
04157
04158
04159 #ifdef _NOGRAPHICS
04160
04161 #else
04162 if (wTitle != 0 && fName != 0) {
04163
04164 if (theTclVideoPlayer != 0)
04165 delete theTclVideoPlayer;
04166
04167
04168 theTclVideoPlayer = new TclVideoPlayer(wTitle, fName, imageName, interp, offsetName);
04169 }
04170 else
04171 return TCL_ERROR;
04172 #endif
04173 return TCL_OK;
04174 }
04175
04176
04177
04178 int
04179 removeObject(ClientData clientData, Tcl_Interp *interp, int argc,
04180 TCL_Char **argv)
04181 {
04182
04183
04184 if (argc < 2) {
04185 opserr << "WARNING want - remove objectType?\n";
04186 return TCL_ERROR;
04187 }
04188
04189 int tag;
04190 if ((strcmp(argv[1],"element") == 0) || (strcmp(argv[1],"ele") == 0)) {
04191 if (argc < 3) {
04192 opserr << "WARNING want - remove element eleTag?\n";
04193 return TCL_ERROR;
04194 }
04195
04196 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
04197 opserr << "WARNING remove element tag? failed to read tag: " << argv[2] << endln;
04198 return TCL_ERROR;
04199 }
04200 Element *theEle = theDomain.removeElement(tag);
04201 if (theEle != 0) {
04202
04203 LoadPatternIter &theLoadPatterns = theDomain.getLoadPatterns();
04204 LoadPattern *thePattern;
04205
04206
04207 while ((thePattern = theLoadPatterns()) != 0) {
04208 ElementalLoadIter theEleLoads = thePattern->getElementalLoads();
04209 ElementalLoad *theLoad;
04210
04211
04212 while ((theLoad = theEleLoads()) != 0) {
04213
04214
04215
04216
04217
04218
04219
04220
04221
04222
04223
04224 }
04225 }
04226
04227
04228 delete theEle;
04229 }
04230 }
04231
04232 else if (strcmp(argv[1],"loadPattern") == 0) {
04233 if (argc < 3) {
04234 opserr << "WARNING want - remove loadPattern patternTag?\n";
04235 return TCL_ERROR;
04236 }
04237 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
04238 opserr << "WARNING remove loadPattern tag? failed to read tag: " << argv[2] << endln;
04239 return TCL_ERROR;
04240 }
04241 LoadPattern *thePattern = theDomain.removeLoadPattern(tag);
04242 if (thePattern != 0) {
04243 delete thePattern;
04244 }
04245 }
04246
04247
04248 else if (strcmp(argv[1],"node") == 0) {
04249 if (argc < 3) {
04250 opserr << "WARNING want - remove node nodeTag?\n";
04251 return TCL_ERROR;
04252 }
04253 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
04254 opserr << "WARNING remove node tag? failed to read tag: " << argv[2] << endln;
04255 return TCL_ERROR;
04256 }
04257 Node *theNode = theDomain.removeNode(tag);
04258 if (theNode != 0) {
04259 delete theNode;
04260 }
04261 }
04262
04263
04264 else if (strcmp(argv[1],"recorders") == 0) {
04265 theDomain.removeRecorders();
04266 }
04267
04268
04269 else if ((strcmp(argv[1],"SPconstraint") == 0) || (strcmp(argv[1],"sp") == 0)) {
04270 if (argc < 3) {
04271 opserr << "WARNING want - remove SPconstraint spTag?\n";
04272 return TCL_ERROR;
04273 }
04274 if (argc == 3) {
04275 if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
04276 opserr << "WARNING remove loadPattern tag? failed to read tag: " << argv[2] << endln;
04277 return TCL_ERROR;
04278 }
04279
04280 SP_Constraint *theSPconstraint = theDomain.removeSP_Constraint(tag);
04281 if (theSPconstraint != 0) {
04282 delete theSPconstraint;
04283 }
04284 } else {
04285 int nodeTag, dofTag;
04286 if (Tcl_GetInt(interp, argv[2], &nodeTag) != TCL_OK) {
04287 opserr << "WARNING remove loadPattern tag? failed to read node tag: " << argv[2] << endln;
04288 return TCL_ERROR;
04289 }
04290 if (Tcl_GetInt(interp, argv[3], &dofTag) != TCL_OK) {
04291 opserr << "WARNING remove loadPattern tag? failed to read node tag: " << argv[2] << endln;
04292 return TCL_ERROR;
04293 }
04294 dofTag--;
04295
04296 SP_ConstraintIter &theSPs = theDomain.getSPs();
04297 SP_Constraint *theSP;
04298
04299 ID theSPTags(0,12); int cnt=0;
04300 while ((theSP = theSPs()) != 0) {
04301
04302 int spNode = theSP->getNodeTag();
04303 if (spNode == nodeTag) {
04304 int spDofTag = theSP->getDOF_Number();
04305 if (spDofTag == dofTag) {
04306 theSPTags(cnt) = theSP->getTag();
04307 cnt++;
04308 }
04309 }
04310 }
04311
04312 for (int i=0; i<cnt; i++) {
04313 SP_Constraint *theSPconstraint = theDomain.removeSP_Constraint(theSPTags(i));
04314 if (theSPconstraint != 0) {
04315 delete theSPconstraint;
04316 }
04317 }
04318 }
04319 }
04320
04321 #ifdef _RELIABILITY
04322
04323 else if (strcmp(argv[1],"randomVariablePositioner") == 0) {
04324 int rvPosTag;
04325 if (Tcl_GetInt(interp, argv[2], &rvPosTag) != TCL_OK) {
04326 opserr << "WARNING invalid input: rvPositionerTag \n";
04327 return TCL_ERROR;
04328 }
04329 ReliabilityDomain *theReliabilityDomain = theReliabilityBuilder->getReliabilityDomain();
04330 theReliabilityDomain->removeRandomVariablePositioner(rvPosTag);
04331 }
04332 else if (strcmp(argv[1],"performanceFunction") == 0) {
04333 int lsfTag;
04334 if (Tcl_GetInt(interp, argv[2], &lsfTag) != TCL_OK) {
04335 opserr << "WARNING invalid input: lsfTag \n";
04336 return TCL_ERROR;
04337 }
04338 ReliabilityDomain *theReliabilityDomain = theReliabilityBuilder->getReliabilityDomain();
04339 theReliabilityDomain->removePerformanceFunction(lsfTag);
04340 }
04341 else if (strcmp(argv[1],"sensitivityAlgorithm") == 0) {
04342 if (theSensitivityAlgorithm != 0) {
04343 theStaticAnalysis->setSensitivityAlgorithm(0);
04344 theSensitivityAlgorithm = 0;
04345 }
04346 }
04347
04348 #endif
04349
04350 else
04351 opserr << "WARNING remove element, loadPattern - only commands available at the moment: " << endln;
04352
04353 return TCL_OK;
04354 }
04355
04356
04357 int
04358 nodeDisp(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04359 {
04360
04361
04362 if (argc < 3) {
04363 opserr << "WARNING want - nodeDisp nodeTag? dof?\n";
04364 return TCL_ERROR;
04365 }
04366
04367 int tag, dof;
04368
04369 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
04370 opserr << "WARNING nodeDisp nodeTag? dof? - could not read nodeTag? \n";
04371 return TCL_ERROR;
04372 }
04373 if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) {
04374 opserr << "WARNING nodeDisp nodeTag? dof? - could not read dof? \n";
04375 return TCL_ERROR;
04376 }
04377
04378 Node *theNode = theDomain.getNode(tag);
04379 double value = 0.0;
04380 if (theNode != 0) {
04381 const Vector &disp = theNode->getTrialDisp();
04382 if (disp.Size() >= dof && dof > 0) {
04383 value = disp(dof-1);
04384 }
04385 }
04386
04387
04388 sprintf(interp->result,"%35.20f",value);
04389
04390
04391 return TCL_OK;
04392 }
04393
04394 int
04395 nodeCoord(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04396 {
04397
04398 if (argc < 3) {
04399 opserr << "WARNING want - nodeCoord nodeTag? dim?\n";
04400 return TCL_ERROR;
04401 }
04402
04403 int tag, dim;
04404
04405 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
04406 opserr << "WARNING nodeCoord nodeTag? dim? - could not read nodeTag? \n";
04407 return TCL_ERROR;
04408 }
04409 if (strcmp(argv[2],"X") == 0 || strcmp(argv[2],"x") == 0 ||
04410 strcmp(argv[2],"1") == 0)
04411 dim = 1;
04412 else if (strcmp(argv[2],"Y") == 0 || strcmp(argv[2],"y") == 0 ||
04413 strcmp(argv[2],"2") == 0)
04414 dim = 2;
04415 else if (strcmp(argv[2],"Z") == 0 || strcmp(argv[2],"z") == 0 ||
04416 strcmp(argv[2],"3") == 0)
04417 dim = 3;
04418 else {
04419 opserr << "WARNING nodeCoord nodeTag? dim? - could not read dim? \n";
04420 return TCL_ERROR;
04421 }
04422
04423 Node *theNode = theDomain.getNode(tag);
04424 double value = 0.0;
04425 if (theNode != 0) {
04426 const Vector &coords = theNode->getCrds();
04427 if (coords.Size() >= dim && dim > 0) {
04428 value = coords(dim-1);
04429 }
04430 }
04431
04432
04433 sprintf(interp->result,"%35.20f",value);
04434
04435 return TCL_OK;
04436 }
04437
04438 int
04439 nodeBounds(ClientData clientData, Tcl_Interp *interp, int argc,
04440 TCL_Char **argv)
04441 {
04442 int requiredDataSize = 20*6;
04443 if (requiredDataSize > resDataSize) {
04444 if (resDataPtr != 0) {
04445 delete [] resDataPtr;
04446 }
04447 resDataPtr = new char[requiredDataSize];
04448 resDataSize = requiredDataSize;
04449 }
04450
04451 for (int i=0; i<requiredDataSize; i++)
04452 resDataPtr[i] = '\n';
04453
04454 const Vector &bounds = theDomain.getPhysicalBounds();
04455
04456 int cnt = 0;
04457 for (int j=0; j<6; j++) {
04458 cnt += sprintf(&resDataPtr[cnt], "%.6e ", bounds(j));
04459 }
04460
04461 Tcl_SetResult(interp, resDataPtr, TCL_STATIC);
04462
04463 return TCL_OK;
04464 }
04465
04466
04467
04468 int
04469 nodeVel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04470 {
04471
04472
04473 if (argc < 3) {
04474 interp->result = "WARNING want - nodeVel nodeTag? dof?\n";
04475 return TCL_ERROR;
04476 }
04477
04478 int tag, dof;
04479
04480 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
04481 opserr << "WARNING nodeDisp nodeTag? dof? - could not read nodeTag? ";
04482 return TCL_ERROR;
04483 }
04484 if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) {
04485 opserr << "WARNING nodeDisp nodeTag? dof? - could not read dof? ";
04486 return TCL_ERROR;
04487 }
04488
04489 Node *theNode = theDomain.getNode(tag);
04490 double value = 0.0;
04491 if (theNode != 0) {
04492 const Vector &vel = theNode->getTrialVel();
04493 if (vel.Size() >= dof && dof > 0) {
04494 value = vel(dof-1);
04495 }
04496 }
04497
04498
04499 sprintf(interp->result,"%35.20f",value);
04500
04501
04502 return TCL_OK;
04503 }
04504
04505
04506 int
04507 sensNodeDisp(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04508 {
04509
04510
04511 if (argc < 4) {
04512 interp->result = "WARNING want - sensNodeDisp nodeTag? dof?\n";
04513 return TCL_ERROR;
04514 }
04515
04516 int tag, dof, gradNum;
04517
04518 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
04519 opserr << "WARNING nodeDisp nodeTag? dof? gradNum?- could not read nodeTag? ";
04520 return TCL_ERROR;
04521 }
04522 if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) {
04523 opserr << "WARNING nodeDisp nodeTag? dof? gradNum?- could not read dof? ";
04524 return TCL_ERROR;
04525 }
04526 if (Tcl_GetInt(interp, argv[3], &gradNum) != TCL_OK) {
04527 opserr << "WARNING nodeDisp nodeTag? dof? gradNum?- could not read dof? ";
04528 return TCL_ERROR;
04529 }
04530
04531 Node *theNode = theDomain.getNode(tag);
04532 double value = theNode->getDispSensitivity(dof,gradNum);
04533
04534
04535 sprintf(interp->result,"%35.20f",value);
04536
04537 return TCL_OK;
04538 }
04539 int
04540 sensNodeVel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04541 {
04542
04543
04544 if (argc < 4) {
04545 interp->result = "WARNING want - sensNodeDisp nodeTag? dof?\n";
04546 return TCL_ERROR;
04547 }
04548
04549 int tag, dof, gradNum;
04550
04551 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
04552 opserr << "WARNING nodeDisp nodeTag? dof? gradNum?- could not read nodeTag? \n";
04553 return TCL_ERROR;
04554 }
04555 if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) {
04556 opserr << "WARNING nodeDisp nodeTag? dof? gradNum?- could not read dof? \n";
04557 return TCL_ERROR;
04558 }
04559 if (Tcl_GetInt(interp, argv[3], &gradNum) != TCL_OK) {
04560 opserr << "WARNING nodeDisp nodeTag? dof? gradNum?- could not read dof? \n";
04561 return TCL_ERROR;
04562 }
04563
04564 Node *theNode = theDomain.getNode(tag);
04565 double value = theNode->getVelSensitivity(dof,gradNum);
04566
04567
04568 sprintf(interp->result,"%35.20f",value);
04569
04570 return TCL_OK;
04571 }
04572
04573
04574
04575 int
04576 computeGradients(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04577 {
04578
04579
04580
04581
04582
04583
04584
04585
04586
04587 #ifdef _RELIABILITY
04588 if (theSensitivityAlgorithm->shouldComputeAtEachStep()) {
04589 }
04590 else {
04591
04592 theSensitivityAlgorithm->computeSensitivities();
04593 }
04594 #endif
04595 return TCL_OK;
04596 }
04597
04598
04599
04600 int
04601 startTimer(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04602 {
04603 if (theTimer == 0)
04604 theTimer = new Timer();
04605
04606 theTimer->start();
04607 return TCL_OK;
04608 }
04609
04610 int
04611 stopTimer(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04612 {
04613 if (theTimer == 0)
04614 return TCL_OK;
04615
04616 theTimer->pause();
04617 opserr << *theTimer;
04618 return TCL_OK;
04619 }
04620
04621 int
04622 rayleighDamping(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04623 {
04624 if (argc < 5) {
04625 opserr << "WARNING rayleigh alphaM? betaK? betaK0? betaKc? - not enough arguments to command\n";
04626 return TCL_ERROR;
04627 }
04628 double alphaM, betaK, betaK0, betaKc;
04629 if (Tcl_GetDouble(interp, argv[1], &alphaM) != TCL_OK) {
04630 opserr << "WARNING rayleigh alphaM? betaK? betaK0? betaKc? - could not read alphaM? \n";
04631 return TCL_ERROR;
04632 }
04633 if (Tcl_GetDouble(interp, argv[2], &betaK) != TCL_OK) {
04634 opserr << "WARNING rayleigh alphaM? betaK? betaK0? betaKc? - could not read betaK? \n";
04635 return TCL_ERROR;
04636 }
04637 if (Tcl_GetDouble(interp, argv[3], &betaK0) != TCL_OK) {
04638 opserr << "WARNING rayleigh alphaM? betaK? betaK0? betaKc? - could not read betaK0? \n";
04639 return TCL_ERROR;
04640 }
04641 if (Tcl_GetDouble(interp, argv[4], &betaKc) != TCL_OK) {
04642 opserr << "WARNING rayleigh alphaM? betaK? betaK0? betaKc? - could not read betaKc? \n";
04643 return TCL_ERROR;
04644 }
04645
04646 theDomain.setRayleighDampingFactors(alphaM, betaK, betaK0, betaKc);
04647 return TCL_OK;
04648 }
04649
04650
04651 extern int
04652 TclAddMeshRegion(ClientData clientData, Tcl_Interp *interp, int argc,
04653 TCL_Char **argv, Domain &theDomain);
04654
04655 int
04656 addRegion(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04657 {
04658 return TclAddMeshRegion(clientData, interp, argc, argv, theDomain);
04659 }
04660
04661 int
04662 logFile(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04663 {
04664
04665 if (argc < 2) {
04666 opserr << "WARNING logFile fileName? - no filename supplied\n";
04667 return TCL_ERROR;
04668 }
04669 openMode mode = OVERWRITE;
04670 if (argc >= 3)
04671 if (strcmp(argv[2],"-append") == 0)
04672 mode = APPEND;
04673
04674 if (opserr.setFile(argv[1], mode) < 0)
04675 opserr << "WARNING logFile " << argv[1] << " failed to set the file\n";
04676
04677
04678 simulationInfo.addWriteFile(argv[1]);
04679
04680 return TCL_OK;
04681 }
04682
04683 int
04684 exit(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04685 {
04686 Tcl_Finalize();
04687 return TCL_OK;
04688 }
04689
04690
04691
04692 int
04693 getPID(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04694 {
04695 int pid = 0;
04696 #ifdef _PARALLEL_INTERPRETERS
04697 if (theMachineBroker != 0)
04698 pid = theMachineBroker->getPID();
04699 #endif
04700
04701 #ifdef _PARALLEL_PROCESSING
04702 if (theMachineBroker != 0)
04703 pid = theMachineBroker->getPID();
04704 #endif
04705
04706
04707 sprintf(interp->result,"%d",pid);
04708 return TCL_OK;
04709 }
04710
04711
04712 int
04713 getNP(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
04714 {
04715 int np = 1;
04716 #ifdef _PARALLEL_INTERPRETERS
04717 if (theMachineBroker != 0)
04718 np = theMachineBroker->getNP();
04719 #endif
04720
04721 #ifdef _PARALLEL_PROCESSING
04722 if (theMachineBroker != 0)
04723 np = theMachineBroker->getNP();
04724 #endif
04725
04726
04727 sprintf(interp->result,"%d",np);
04728 return TCL_OK;
04729 }
04730
04731