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

ImposedMotionSP1.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.2 $
00022 // $Date: 2001/01/11 06:46:01 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/constraints/ImposedMotionSP1.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/domain/constraints/ImposedMotionSP1.C
00027 //
00028 // Written: fmk 
00029 // Created: 11/00
00030 // Revision: A
00031 //
00032 // Purpose: This file contains the implementation of class ImposedMotionSP1.
00033 
00034 #include <ImposedMotionSP1.h>
00035 #include <classTags.h>
00036 #include <Vector.h>
00037 #include <Channel.h>
00038 #include <FEM_ObjectBroker.h>
00039 #include <GroundMotion.h>
00040 #include <Node.h>
00041 #include <Domain.h>
00042 
00043 // constructor for FEM_ObjectBroker
00044 ImposedMotionSP1::ImposedMotionSP1()
00045 :SP_Constraint(CNSTRNT_TAG_ImposedMotionSP1),
00046  theGroundMotion(0), theNode(0), theGroundMotionResponse(3), destroyMotion(0)
00047 {
00048     // does nothing else
00049 }
00050 
00051 // constructor for a subclass to use
00052 ImposedMotionSP1::ImposedMotionSP1(int tag, int node, int ndof, 
00053      GroundMotion &theMotion, bool killMotion)
00054 :SP_Constraint(tag, node, ndof, CNSTRNT_TAG_ImposedMotionSP1),
00055  theNode(0), theGroundMotionResponse(3), destroyMotion(0)
00056 {
00057   theGroundMotion = &theMotion;
00058   
00059   if (killMotion == true)
00060     destroyMotion = 1;
00061 }
00062 
00063 
00064 ImposedMotionSP1::~ImposedMotionSP1()
00065 {
00066   if (destroyMotion == 1)
00067     delete theGroundMotion;
00068 }
00069 
00070 
00071 
00072 double
00073 ImposedMotionSP1::getValue(void)
00074 {
00075   // always return 0.0 - applyConstraint() sets the values at Node 
00076     return theGroundMotionResponse(0);
00077 }
00078 
00079 
00080 int
00081 ImposedMotionSP1::applyConstraint(double time)
00082 {
00083     // on first 
00084     if (theNode == 0) {
00085  Domain *theDomain = this->getDomain();
00086 
00087  theNode = theDomain->getNode(nodeTag);
00088  if (theNode == 0) {
00089      
00090      return -1;
00091  }
00092     }
00093 
00094     // now get the response from the ground motion
00095     theGroundMotionResponse = theGroundMotion->getDispVelAccel(time);
00096 
00097     return 0;
00098 }
00099 
00100 
00101 bool
00102 ImposedMotionSP1::isHomogeneous(void) const
00103 {
00104   return false;
00105 }
00106 
00107 
00108 int 
00109 ImposedMotionSP1::sendSelf(int cTag, Channel &theChannel)
00110 {
00111   return -1;
00112 }
00113 
00114 int 
00115 ImposedMotionSP1::recvSelf(int cTag, Channel &theChannel, 
00116    FEM_ObjectBroker &theBroker)
00117 {
00118   return -1;
00119 }
00120 
00121 void
00122 ImposedMotionSP1::Print(ostream &s, int flag) 
00123 {
00124     s << "ImposedMotionSP1: " << this->getTag();
00125     s << "\t Node: " << this->getNodeTag();
00126     s << " DOF: " << this->getDOF_Number() << endl;    
00127 }
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
Copyright Contact Us