TclFeapMaterialCommand.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020 
00021 // $Revision: 1.3 $
00022 // $Date: 2003/02/25 23:33:25 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/nD/feap/TclFeapMaterialCommand.cpp,v $
00024 
00025 #include <FeapMaterial01.h>
00026 #include <FeapMaterial02.h>
00027 #include <FeapMaterial03.h>
00028 
00029 #include <TclModelBuilder.h>
00030 #include <Vector.h>
00031 #include <string.h>
00032 
00033 static void printCommand(int argc, TCL_Char **argv)
00034 {
00035     opserr << "Input command: ";
00036     for (int i=0; i<argc; i++)
00037         opserr << argv[i] << " ";
00038     opserr << endln;
00039 } 
00040 
00041 NDMaterial *
00042 TclModelBuilder_addFeapMaterial(ClientData clientData, Tcl_Interp *interp,
00043                                 int argc, TCL_Char **argv,
00044                                 TclModelBuilder *theTclBuilder)
00045 {
00046   if (argc < 3) {
00047     opserr << "WARNING insufficient number of arguments\n";
00048     printCommand(argc, argv);
00049     return 0;
00050   }
00051   
00052   int tag;
00053   if (Tcl_GetInt(interp, argv[2], &tag) != TCL_OK) {
00054     opserr << "WARNING invalid uniaxialMaterial tag\n";
00055     printCommand(argc, argv);
00056     return 0;
00057   }
00058   
00059   NDMaterial *theMaterial = 0;
00060 
00061   if (strcmp(argv[1],"ElasticFeap") == 0 || strcmp(argv[1],"FeapElastic") == 0) {
00062     if (argc < 5) {
00063       opserr << "WARNING invalid number of arguments\n";
00064       printCommand(argc,argv);
00065       opserr << "Want: nDMaterial ElasticFeap tag? E? nu?" << endln;
00066       return 0;
00067     }
00068     
00069     double E, nu;
00070 
00071     if (Tcl_GetDouble(interp, argv[3], &E) != TCL_OK) {
00072       opserr << "WARNING invalid E\n";
00073       printCommand(argc, argv);
00074       return 0;       
00075     }
00076     if (Tcl_GetDouble(interp, argv[4], &nu) != TCL_OK) {
00077       opserr << "WARNING invalid nu\n";
00078       printCommand(argc, argv);
00079       return 0;       
00080     }
00081 
00082     theMaterial = new FeapMaterial01(tag, E, nu);
00083   }
00084 
00085   else if (strcmp(argv[1],"J2Feap") == 0 || strcmp(argv[1],"FeapJ2") == 0) {
00086     if (argc < 7) {
00087       opserr << "WARNING invalid number of arguments\n";
00088       printCommand(argc,argv);
00089       opserr << "Want: nDMaterial J2Feap tag? K? G? sigY? Hiso?" << endln;
00090       return 0;
00091     }
00092 
00093     double K, G, sigY, Hiso;
00094 
00095     if (Tcl_GetDouble(interp, argv[3], &K) != TCL_OK) {
00096       opserr << "WARNING invalid K\n";
00097       printCommand(argc, argv);
00098       return 0;       
00099     }
00100     if (Tcl_GetDouble(interp, argv[4], &G) != TCL_OK) {
00101       opserr << "WARNING invalid G\n";
00102       printCommand(argc, argv);
00103       return 0;       
00104     }
00105     if (Tcl_GetDouble(interp, argv[5], &sigY) != TCL_OK) {
00106       opserr << "WARNING invalid sigY\n";
00107       printCommand(argc, argv);
00108       return 0;       
00109     }
00110     if (Tcl_GetDouble(interp, argv[6], &Hiso) != TCL_OK) {
00111       opserr << "WARNING invalid Hiso\n";
00112       printCommand(argc, argv);
00113       return 0;       
00114     }
00115 
00116     theMaterial = new FeapMaterial03(tag, K, G, sigY, Hiso);
00117   }
00118 
00119   else if (strcmp(argv[1],"ViscousFeap") == 0 || strcmp(argv[1],"FeapViscous") == 0) {
00120     if (argc < 10) {
00121       opserr << "WARNING invalid number of arguments\n";
00122       printCommand(argc,argv);
00123       opserr << "Want: nDMaterial ViscousFeap tag? K? G? muK? muG? lamK? lamG? theta?" << endln;
00124       return 0;
00125     }
00126 
00127     double K, G, muK, muG, lamK, lamG, theta;
00128 
00129     if (Tcl_GetDouble(interp, argv[3], &K) != TCL_OK) {
00130       opserr << "WARNING invalid K\n";
00131       printCommand(argc, argv);
00132       return 0;       
00133     }
00134     if (Tcl_GetDouble(interp, argv[4], &G) != TCL_OK) {
00135       opserr << "WARNING invalid G\n";
00136       printCommand(argc, argv);
00137       return 0;
00138     }
00139     if (Tcl_GetDouble(interp, argv[5], &muK) != TCL_OK) {
00140       opserr << "WARNING invalid muK\n";
00141       printCommand(argc, argv);
00142       return 0;       
00143     }
00144     if (Tcl_GetDouble(interp, argv[6], &muG) != TCL_OK) {
00145       opserr << "WARNING invalid muG\n";
00146       printCommand(argc, argv);
00147       return 0;
00148     }
00149     if (Tcl_GetDouble(interp, argv[7], &lamK) != TCL_OK) {
00150       opserr << "WARNING invalid lamK\n";
00151       printCommand(argc, argv);
00152       return 0;       
00153     }
00154     if (Tcl_GetDouble(interp, argv[8], &lamG) != TCL_OK) {
00155       opserr << "WARNING invalid lamG\n";
00156       printCommand(argc, argv);
00157       return 0;
00158     }
00159     if (Tcl_GetDouble(interp, argv[9], &theta) != TCL_OK) {
00160       opserr << "WARNING invalid theta\n";
00161       printCommand(argc, argv);
00162       return 0;
00163     }
00164 
00165     theMaterial = new FeapMaterial02(tag, K, G, muK, muG, lamK, lamG, theta);
00166   }
00167   
00168   return theMaterial;
00169 }

Generated on Mon Oct 23 15:05:13 2006 for OpenSees by doxygen 1.5.0