Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SectionForceDeformation.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: 2001/06/16 04:45:33 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/section/SectionForceDeformation.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/material/SectionForceDeformation.C
00027 //
00028 // Written: MHS 
00029 // Created: Feb 2000
00030 // Revision: A
00031 //
00032 // Description: This file contains the class implementation for SectionForceDeformation.
00033 //
00034 // What: "@(#) SectionForceDeformation.C, revA"
00035 
00036 #include <SectionForceDeformation.h>
00037 #include <Information.h>
00038 #include <Matrix.h>
00039 #include <Vector.h>
00040 #include <MaterialResponse.h>
00041 
00042 #include <string.h>
00043 
00044 double invert2by2Matrix(const Matrix &a, Matrix &b);
00045 double invert3by3Matrix(const Matrix &a, Matrix &b);
00046 void invertMatrix(int n, const Matrix &a, Matrix &b);
00047 
00048 SectionForceDeformation::SectionForceDeformation(int tag, int classTag)
00049 :Material(tag,classTag), fDefault(0)
00050 {
00051 
00052 }
00053 
00054 SectionForceDeformation::~SectionForceDeformation()
00055 {
00056  if (fDefault != 0)
00057   delete fDefault;
00058 }
00059 
00060 const Matrix&
00061 SectionForceDeformation::getSectionFlexibility ()
00062 {
00063  int order = this->getOrder();
00064 
00065  if (fDefault == 0) {  
00066   fDefault = new Matrix(order,order);
00067   if (fDefault == 0)
00068    g3ErrorHandler->fatal("%s -- failed to allocate flexibility matrix",
00069     "SectionForceDeformation::getSectionFlexibility");
00070  }
00071 
00072  const Matrix &k = this->getSectionTangent();
00073 
00074  switch(order) {
00075  case 1:
00076   if (k(0,0) != 0.0)
00077    (*fDefault)(0,0) = 1.0/k(0,0);
00078   break;
00079   /********
00080  case 2:
00081   invert2by2Matrix(k,*fDefault);
00082   break;
00083  case 3:
00084   invert3by3Matrix(k,*fDefault);
00085   break;
00086   **********/
00087  default:
00088   invertMatrix(order,k,*fDefault);
00089   break;
00090  }
00091 
00092  return *fDefault;
00093 }
00094 
00095 double 
00096 SectionForceDeformation::getRho(void) 
00097 {
00098   return 0.0 ;
00099 }
00100 
00101 
00102 /*
00103 int 
00104 SectionForceDeformation::setResponse(char **argv, int argc, Information &sectInfo)
00105 {
00106     // deformations
00107     if ((strcmp(argv[0],"deformations") ==0) || 
00108  (strcmp(argv[0],"deformation") ==0)) {
00109 
00110  Vector *theVector = new Vector(this->getOrder());
00111  if (theVector == 0) {
00112      cerr << "WARNING SectionForceDeformation::setResponse() - out of memory\n";
00113      return -1;
00114  } 
00115  sectInfo.theVector = theVector;
00116  sectInfo.theType = VectorType; 
00117  return 1;
00118     } 
00119 
00120     // stress resultants
00121     else if ((strcmp(argv[0],"forces") ==0) ||
00122       (strcmp(argv[0],"force") ==0)) {
00123 
00124  Vector *theVector = new Vector(this->getOrder());
00125  if (theVector == 0) {
00126      cerr << "WARNING SectionForceDeformation::setResponse() - out of memory\n";
00127      return -1;
00128  } 
00129  sectInfo.theVector = theVector;
00130  sectInfo.theType = VectorType; 
00131  return 2;
00132     } 
00133 
00134  // tangent stiffness
00135  else if (strcmp(argv[0],"stiff") == 0 ||
00136   strcmp(argv[0],"stiffness") == 0) {
00137   int order = this->getOrder();
00138   Matrix *newMatrix = new Matrix(order,order);
00139   if (newMatrix == 0) {
00140    cerr << "WARNING SectionForceDeformation::setResponse() - out of memory\n";
00141    return -1;
00142   } 
00143   sectInfo.theMatrix = newMatrix;
00144   sectInfo.theType = MatrixType; 
00145   return 3;
00146  }
00147 
00148     // otherwise response quantity is unknown for the Section class
00149     else
00150  return -1;    
00151 }
00152 */
00153 
00154 Response*
00155 SectionForceDeformation::setResponse(char **argv, int argc, Information &sectInfo)
00156 {
00157     // deformations
00158     if (strcmp(argv[0],"deformations") == 0 || strcmp(argv[0],"deformation") == 0)
00159   return new MaterialResponse(this, 1, this->getSectionDeformation());
00160     
00161  // forces
00162  else if (strcmp(argv[0],"forces") == 0 || strcmp(argv[0],"force") == 0)
00163   return new MaterialResponse(this, 2, this->getStressResultant());
00164 
00165  // tangent
00166  else if (strcmp(argv[0],"stiff") == 0 || strcmp(argv[0],"stiffness") == 0)
00167   return new MaterialResponse(this, 3, this->getSectionTangent());
00168 
00169  else
00170   return 0;
00171 }
00172 
00173 int 
00174 SectionForceDeformation::getResponse(int responseID, Information &secInfo)
00175 {
00176   switch (responseID) {
00177     case 1:
00178   return secInfo.setVector(this->getSectionDeformation());
00179 
00180     case 2:
00181   return secInfo.setVector(this->getStressResultant());
00182 
00183  case 3:
00184   return secInfo.setMatrix(this->getSectionTangent());
00185 
00186     default:
00187       return -1;
00188   }
00189 }
Copyright Contact Us