TclShellCommand.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.5 $
00022 // $Date: 2003/02/25 23:33:02 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/element/shell/TclShellCommand.cpp,v $
00024                                                                         
00025 // Written: fmk 
00026 // Created: 03/01
00027 //
00028 // What: "@(#) TclShellCommand.C, revA"
00029 
00030 #include <stdlib.h>
00031 #include <string.h>
00032 #include <Domain.h>
00033 
00034 #include <ShellMITC4.h>
00035 #include <TclModelBuilder.h>
00036 
00037 extern void printCommand(int argc, TCL_Char **argv);
00038 
00039 int
00040 TclModelBuilder_addShellMITC4(ClientData clientData, Tcl_Interp *interp,  int argc, 
00041                          TCL_Char **argv, Domain*theTclDomain,
00042                          TclModelBuilder *theTclBuilder, int eleArgStart)
00043 {
00044   // ensure the destructor has not been called - 
00045   if (theTclBuilder == 0) {
00046     opserr << "WARNING builder has been destroyed\n";    
00047     return TCL_ERROR;
00048   }
00049 
00050   // check the number of arguments is correct
00051   if ((argc-eleArgStart) < 7) {
00052     opserr << "WARNING insufficient arguments\n";
00053     printCommand(argc, argv);
00054     opserr << "Want: element ShellMITC4 eleTag? iNode? jNode? kNode? lNode? secTag?\n";
00055     return TCL_ERROR;
00056   }    
00057 
00058   // get the id and end nodes 
00059   int ShellMITC4Id, iNode, jNode, kNode, lNode, matID;
00060   if (Tcl_GetInt(interp, argv[1+eleArgStart], &ShellMITC4Id) != TCL_OK) {
00061     opserr << "WARNING invalid ShellMITC4 eleTag" << endln;
00062     return TCL_ERROR;
00063   }
00064   if (Tcl_GetInt(interp, argv[2+eleArgStart], &iNode) != TCL_OK) {
00065     opserr << "WARNING invalid iNode\n";
00066     opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00067     return TCL_ERROR;
00068   }
00069   if (Tcl_GetInt(interp, argv[3+eleArgStart], &jNode) != TCL_OK) {
00070      opserr << "WARNING invalid jNode\n";
00071      opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00072      return TCL_ERROR;
00073   }
00074   if (Tcl_GetInt(interp, argv[4+eleArgStart], &kNode) != TCL_OK) {
00075      opserr << "WARNING invalid jNode\n";
00076      opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00077      return TCL_ERROR;
00078   }
00079   if (Tcl_GetInt(interp, argv[5+eleArgStart], &lNode) != TCL_OK) {
00080      opserr << "WARNING invalid jNode\n";
00081      opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00082      return TCL_ERROR;
00083   }
00084 
00085   if (Tcl_GetInt(interp, argv[6+eleArgStart], &matID) != TCL_OK) {
00086     opserr << "WARNING invalid matTag\n";
00087     opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00088     return TCL_ERROR;
00089   }
00090 
00091   SectionForceDeformation *theSection = theTclBuilder->getSection(matID);      
00092 
00093   if (theSection == 0) {
00094     opserr << "WARNING section not found\n";
00095     opserr << "section tag: " << matID;
00096     opserr << "\nShellMITC4 element: " << ShellMITC4Id << endln;
00097     return TCL_ERROR;
00098   }
00099   
00100   // now create the ShellMITC4 and add it to the Domain
00101   ShellMITC4 *theShellMITC4 = new ShellMITC4(ShellMITC4Id,iNode,jNode,kNode,lNode,*theSection);
00102   if (theShellMITC4 == 0) {
00103     opserr << "WARNING ran out of memory creating element\n";
00104     opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00105     return TCL_ERROR;
00106   }
00107 
00108   if (theTclDomain->addElement(theShellMITC4) == false) {
00109     opserr << "WARNING could not add element to the domain\n";
00110     opserr << "ShellMITC4 element: " << ShellMITC4Id << endln;
00111     delete theShellMITC4;
00112     return TCL_ERROR;
00113   }
00114 
00115   // if get here we have sucessfully created the node and added it to the domain
00116   return TCL_OK;
00117 }
00118 

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