xc
ElasticSectionPhysicalProperties.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 //ElasticSectionPhysicalProperties.h
29 
30 #ifndef ElasticSectionPhysicalProperties_h
31 #define ElasticSectionPhysicalProperties_h
32 
33 #include "PhysicalProperties.h"
34 
35 namespace XC {
36 
38 //
40 template<class ElasticSection>
42  {
43  public:
44  ElasticSectionPhysicalProperties(const size_t &nMat= 0);
45 
46  bool haveRho(void) const;
47  Vector getRhoi(void) const;
48 
49  void Print(std::ostream &s, int) const;
50  };
51 
53 template<class ElasticSection>
55  : PhysicalProperties<ElasticSection>(nMat,nullptr)
56  {
57  const ElasticSection section;
58  for(size_t i= 0;i<nMat;i++)
59  this->theMaterial[i]= dynamic_cast<ElasticSection *>(section.getCopy());
60  }
61 
63 template <class ElasticSection>
65  {
66  const size_t numMaterials= this->theMaterial.size();
67  bool retval= false;
68  for(size_t i=0; i<numMaterials; i++)
69  {
70  if(this->theMaterial[i]->getRho() != 0.0)
71  {
72  retval= true;
73  break;
74  }
75  }
76  return retval;
77  }
78 
80 template <class ElasticSection>
82  {
83  const size_t numMaterials= this->theMaterial.size();
84  Vector retval(numMaterials);
85  for(size_t i=0; i<numMaterials; i++)
86  retval[i]= this->theMaterial[i]->getRho();
87  return retval;
88  }
89 
91 template <class ElasticSection>
93  {
94  if(flag == -1)
95  {
96  s << this->getClassName()
97  << "\t" << this->theMaterial.size() << "\t" << std::endl;
98  }
99  else if(flag < -1)
100  {
101  int counter= (flag + 1) * -1;
102  for(size_t i= 0;i < this->theMaterial.size();i++)
103  {
104  const Vector &stress= this->theMaterial[i]->getStressResultant();
105  s << "STRESS\t" << counter << "\t" << i << "\tTOP";
106  for(int j=0; j<6; j++)
107  s << "\t" << stress(j);
108  s << std::endl;
109  }
110  }
111  else
112  {
113  s << std::endl;
114  s << "Material Information : \n ";
115  this->theMaterial[0]->Print( s, flag );
116  s << std::endl;
117  }
118  }
119 
120 } // end of XC namespace
121 #endif
Base class for element&#39;s physical properties.
Definition: PhysicalProperties.h:48
Float vector abstraction.
Definition: Vector.h:94
Three-dimensional elastic section physical properties.
Definition: ElasticSectionPhysicalProperties.h:41
ElasticSectionPhysicalProperties(const size_t &nMat=0)
Constructor.
Definition: ElasticSectionPhysicalProperties.h:54
bool haveRho(void) const
check to see if have mass
Definition: ElasticSectionPhysicalProperties.h:64
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Vector getRhoi(void) const
Returns densities for each position.
Definition: ElasticSectionPhysicalProperties.h:81
void Print(std::ostream &s, int) const
print out element data
Definition: ElasticSectionPhysicalProperties.h:92