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, const ElasticSection *sectionPtr= nullptr);
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, sectionPtr)
56  {}
57 
59 template <class ElasticSection>
61  {
62  const size_t numMaterials= this->theMaterial.size();
63  bool retval= false;
64  for(size_t i=0; i<numMaterials; i++)
65  {
66  if(this->theMaterial[i]->getRho() != 0.0)
67  {
68  retval= true;
69  break;
70  }
71  }
72  return retval;
73  }
74 
76 template <class ElasticSection>
78  {
79  const size_t numMaterials= this->theMaterial.size();
80  Vector retval(numMaterials);
81  for(size_t i=0; i<numMaterials; i++)
82  retval[i]= this->theMaterial[i]->getRho();
83  return retval;
84  }
85 
87 template <class ElasticSection>
89  {
90  if(flag == -1)
91  {
92  s << this->getClassName()
93  << "\t" << this->theMaterial.size() << "\t" << std::endl;
94  }
95  else if(flag < -1)
96  {
97  int counter= (flag + 1) * -1;
98  for(size_t i= 0;i < this->theMaterial.size();i++)
99  {
100  const Vector &stress= this->theMaterial[i]->getStressResultant();
101  s << "STRESS\t" << counter << "\t" << i << "\tTOP";
102  for(int j=0; j<6; j++)
103  s << "\t" << stress(j);
104  s << std::endl;
105  }
106  }
107  else
108  {
109  s << std::endl;
110  s << "Material Information : \n ";
111  this->theMaterial[0]->Print( s, flag );
112  s << std::endl;
113  }
114  }
115 
116 } // end of XC namespace
117 #endif
Base class for element&#39;s physical properties.
Definition: PhysicalProperties.h:48
Float vector abstraction.
Definition: Vector.h:94
ElasticSectionPhysicalProperties(const size_t &nMat=0, const ElasticSection *sectionPtr=nullptr)
Constructor.
Definition: ElasticSectionPhysicalProperties.h:54
Three-dimensional elastic section physical properties.
Definition: ElasticSectionPhysicalProperties.h:41
bool haveRho(void) const
check to see if have mass
Definition: ElasticSectionPhysicalProperties.h:60
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Vector getRhoi(void) const
Returns densities for each position.
Definition: ElasticSectionPhysicalProperties.h:77
void Print(std::ostream &s, int) const
print out element data
Definition: ElasticSectionPhysicalProperties.h:88