StraightReinfLayer.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/14 23:01:37 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/section/repres/reinfLayer/StraightReinfLayer.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: StraightReinfLayer.C 
00027 // Written by Remo M. de Souza 
00028 // December 1998
00029 
00030 #include <math.h>
00031 #include <Matrix.h>
00032 #include <Vector.h>
00033 
00034 #include <ReinfBar.h>
00035 #include <StraightReinfLayer.h>
00036 
00037 
00038 StraightReinfLayer::StraightReinfLayer(void):
00039                         nReinfBars(0), matID(0), barDiam(0.0),
00040                         area(0.0), initPosit(2), finalPosit(2)          
00041 {
00042 
00043 }
00044 
00045 StraightReinfLayer::StraightReinfLayer(int materialID, int numReinfBars, 
00046                                        double reinfBarArea,
00047                                        const Vector &InitialPosition,
00048                                        const Vector &FinalPosition):
00049                                          nReinfBars(numReinfBars),
00050                                          matID(materialID),
00051                                          area(reinfBarArea),
00052                                          barDiam(0.0),
00053                                          initPosit(InitialPosition),
00054                                          finalPosit(FinalPosition)
00055 {
00056 }
00057 
00058 
00059 StraightReinfLayer::~StraightReinfLayer()
00060 {
00061 
00062 }
00063 
00064 
00065 void StraightReinfLayer::setNumReinfBars(int numReinfBars)
00066 {
00067    nReinfBars = numReinfBars;
00068 }
00069 
00070 void StraightReinfLayer::setMaterialID (int materialID)
00071 {
00072    matID = materialID;
00073 }
00074 
00075 void StraightReinfLayer::setReinfBarDiameter (double reinfBarDiameter)
00076 {
00077    barDiam = reinfBarDiameter;
00078    double pi = acos(-1.0);
00079    area = pi * barDiam*barDiam/4.0;
00080 }
00081 
00082 void StraightReinfLayer::setReinfBarArea(double reinfBarArea)
00083 {
00084    area = reinfBarArea;
00085 }
00086 
00087 void StraightReinfLayer::setInitialPosition (const Vector &initialPosition)
00088 {
00089    initPosit = initialPosition;
00090 }
00091 
00092 void StraightReinfLayer::setFinalPosition (const Vector &finalPosition)
00093 {
00094    finalPosit = finalPosition;
00095 }
00096 
00097 
00098 int StraightReinfLayer::getNumReinfBars (void) const
00099 {
00100    return nReinfBars;
00101 }
00102 
00103 int StraightReinfLayer::getMaterialID (void) const
00104 {
00105    return matID;
00106 }
00107 
00108 double StraightReinfLayer::getReinfBarDiameter (void) const
00109 {
00110    return barDiam;
00111 }
00112 
00113 double StraightReinfLayer::getReinfBarArea (void) const
00114 {
00115    return area;
00116 }
00117 
00118 ReinfBar * 
00119 StraightReinfLayer::getReinfBars (void) const
00120 {
00121    double dy, dz;
00122    Vector barPosit(2);
00123    int i;
00124    ReinfBar *reinfBars;
00125 
00126    if (nReinfBars == 1)
00127    {
00128       barPosit(0) = (initPosit(0) + finalPosit(0)) / 2;
00129       barPosit(1) = (initPosit(1) + finalPosit(1)) / 2;
00130     
00131       reinfBars = new ReinfBar [1];
00132 
00133       reinfBars[0].setPosition(barPosit);
00134       reinfBars[0].setArea(this->area);
00135    }
00136 
00137    else if (nReinfBars > 1)
00138    {
00139       dy = (finalPosit(0) - initPosit(0))/(nReinfBars - 1);
00140       dz = (finalPosit(1) - initPosit(1))/(nReinfBars - 1);
00141 
00142       reinfBars = new ReinfBar [nReinfBars];
00143 
00144       for (i = 0; i < nReinfBars; i++)
00145       {
00146          barPosit(0) = initPosit(0) + dy * i;
00147          barPosit(1) = initPosit(1) + dz * i;
00148 
00149          reinfBars[i].setPosition(barPosit);
00150          reinfBars[i].setArea(this->area);
00151       }
00152    }
00153    else
00154      return 0;
00155 
00156    return reinfBars;         
00157 }
00158 
00159 const Vector & 
00160 StraightReinfLayer::getInitialPosition (void) const
00161 {
00162    return initPosit;
00163 }
00164 
00165 const Vector & 
00166 StraightReinfLayer::getFinalPosition   (void) const
00167 {
00168    return finalPosit;
00169 }
00170 
00171 
00172 ReinfLayer * 
00173 StraightReinfLayer::getCopy (void) const
00174 {
00175    StraightReinfLayer *theCopy = new StraightReinfLayer (matID,
00176                                                  nReinfBars, area,
00177                                                  initPosit, finalPosit);
00178    return theCopy;
00179 }
00180 
00181 
00182 
00183 void StraightReinfLayer::Print(OPS_Stream &s, int flag) const
00184 {
00185    s << "\nReinforcing Layer type:  Straight";
00186    s << "\nMaterial ID: " << matID;
00187    s << "\nReinf. bar diameter: " << barDiam;
00188    s << "\nReinf. bar area: " << area;
00189    s << "\nInitial Position: " << initPosit;
00190    s << "\nFinal Position: " << finalPosit;
00191 }
00192 
00193 
00194 OPS_Stream &operator<<(OPS_Stream &s, const StraightReinfLayer &straightReinfLayer)
00195 {  
00196    straightReinfLayer.Print(s);
00197    return s;
00198 }
00199  

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