xc
SectionGeometry.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 //SectionGeometry.h
29 
30 #ifndef SectionGeometry_h
31 #define SectionGeometry_h
32 
33 #include "material/section/repres/section_geometry/region/RegionContainer.h"
34 #include "material/section/repres/section_geometry/reinfLayer/ListReinfLayer.h"
35 #include <list>
36 #include "boost/lexical_cast.hpp"
37 #include "Axis.h"
38 #include "material/section/repres/SectionMassProperties.h"
39 #include <vector>
40 #include "utility/utils/misc_utils/colormod.h"
41 
42 class HalfPlane2d;
43 class Segment2d;
44 class BND2d;
45 
46 namespace XC {
47 class SectionReferenceFrame;
48 class Spot;
49 class Segment;
50 class SectRegion;
51 class ReinfLayer;
52 class MaterialHandler;
53 class Material;
54 class Vector;
55 class Matrix;
56 class CrossSectionProperties3d;
57 class CrossSectionProperties2d;
58 
62 //
64 //
67  {
68  public:
69 
70  typedef std::map<size_t,SectionReferenceFrame *> lst_ref_sys;
71  typedef std::map<size_t,Spot *> lst_spots;
72  typedef std::map<size_t,Axis *> axes_container;
73 
74  protected:
76 
79 
80  lst_ref_sys reference_systems;
81  size_t tag_ref_sys;
82 
83  lst_spots spots;
84  size_t tag_spot;
85  axes_container axes;
86  size_t axis_tag;
87 
88  public:
89  //Constructores
91  inline virtual ~SectionGeometry(void) {}
92 
93  void clear(void);
94 
95  inline int getReferenceFrameTag(void) const
96  { return tag_ref_sys; }
97  void setReferenceFrameTag(int i)
98  { tag_ref_sys= i; }
100  const SectionReferenceFrame *get_reference_system(const size_t &id) const;
101  inline SectionReferenceFrame *current_reference_system(void)
102  { return get_reference_system(tag_ref_sys); }
103  const SectionReferenceFrame *current_reference_system(void) const
104  { return get_reference_system(tag_ref_sys); }
105  SectionReferenceFrame *createReferenceFrame(const std::string &);
106 
107  // Section edition functions
108  inline int getTagSpot(void) const
109  { return tag_spot; }
110  void setTagSpot(int i)
111  { tag_spot= i; }
112  Spot *find_spot(const size_t &);
113  const Spot *find_spot(const size_t &) const;
114  Spot *creaSpot(const Pos2d &);
115  Spot *newSpot(const Pos2d &);
116 
117  inline int getAxisTag(void) const
118  { return axis_tag; }
119  void setAxisTag(int i)
120  { axis_tag= i; }
121  Axis *find_axis(const size_t &);
122  const Axis *find_axis(const size_t &) const;
123  template <class E>
124  Axis *createAxis(void);
125  Segment *newSegment(size_t, size_t);
126 
127  // Section inquiring functions
128  double DistSpots(const size_t &i,const size_t &j) const;
129  std::list<Polygon2d> getRegionsContours(void) const;
130  boost::python::list getRegionsContoursPy(void) const;
131  Polygon2d getRegionsContour(void) const;
133  double getCutLength(const Line2d &r) const;
134  std::vector<double> getCutLengths(const std::list<Line2d> &lr) const;
135  double getCompressedZoneDepth(const HalfPlane2d &) const;
136  double getTensionedZoneDepth(const HalfPlane2d &) const;
137  double getLeverArm(const Line2d &) const;
138  double getAnchoMecanico(const Line2d &) const;
139  double getCover(const Pos2d &) const;
140  double getCompressedStrutWidth(const Segment2d &) const;
141 
142  //Access to containers.
143  inline const RegionContainer &getRegions(void) const
144  { return regions; }
145  inline RegionContainer &getRegions(void)
146  { return regions; }
147  inline const ListReinfLayer &getReinforcementLayers(void) const
148  { return reinforcement_layers; }
149  inline ListReinfLayer &getReinforcementLayers(void)
150  { return reinforcement_layers; }
151  SectionGeometry getGMRegions(void) const;
154  size_t getNumFiberData(void) const;
155 
158  std::set<const Material *>getReinforcementMaterials(void) const
159  { return this->reinforcement_layers.getMaterials(); }
162  std::set<Material *>getReinforcementMaterials(void)
163  { return this->reinforcement_layers.getMaterials(); }
166  boost::python::list getReinforcementMaterialsPy(void)
167  { return this->reinforcement_layers.getMaterialsPy(); }
168 
171  std::set<const Material *>getRegionMaterials(void) const
172  { return this->regions.getMaterials(); }
174  std::set<Material *>getRegionMaterials(void)
175  { return this->regions.getMaterials(); }
178  boost::python::list getRegionMaterialsPy(void)
179  { return this->regions.getMaterialsPy(); }
180 
181  std::set<const Material *>getMaterials(void) const;
182  std::set<Material *>getMaterials(void);
183  boost::python::list getMaterialsPy(void);
184 
185  BND2d getBnd(void) const;
186 
187  double getAreaGrossSection(void) const;
189  double getIyGrossSection(void) const;
190  double getIzGrossSection(void) const;
191  double getPyzGrossSection(void) const;
192 
193  Vector getCenterOfMassHomogenizedSection(const double &E0) const;
194  double getAreaHomogenizedSection(const double &E0) const;
195  double getIyHomogenizedSection(const double &E0) const;
196  double getIzHomogenizedSection(const double &E0) const;
197  double getPyzHomogenizedSection(const double &E0) const;
198 
200  const std::string &Name(void) const;
201 
202  void Print(std::ostream &s, int flag =0) const;
203  friend std::ostream &operator<<(std::ostream &, SectionGeometry &);
204  };
205 
206 std::ostream &operator<<(std::ostream &, SectionGeometry &);
207 
209 template <class E>
211  {
212  Axis *retval= find_axis(axis_tag);
213  if(!retval) //It doesn't already exist
214  {
215  retval= new E(this);
216  if(retval)
217  {
218  retval->Name()= "l"+boost::lexical_cast<std::string>(axis_tag);
219  axes[axis_tag]= retval;
220  axis_tag++;
221  }
222  else
223  std::cerr << Color::red << getClassName() << "::" << __FUNCTION__
224  << "Can't create axis with tag: "
225  << axis_tag << "."
226  << Color::def << std::endl;
227  }
228  return retval;
229  }
230 
231 } // end of XC namespace
232 
233 
234 #endif
235 
boost::python::list getReinforcementMaterialsPy(void)
Return a list of const pointers to the different reinforcing layers materials.
Definition: SectionGeometry.h:166
axes_container axes
Axis container.
Definition: SectionGeometry.h:85
"boundary" en dos dimensiones.
Definition: BND2d.h:38
double getIyHomogenizedSection(const double &E0) const
Returns homogenized moment of inertia of the cross-section with respecto to the axis parallel to y pa...
Definition: SectionGeometry.cc:520
Float vector abstraction.
Definition: Vector.h:94
Axis * find_axis(const size_t &)
Returns a pointer to the axis which name is being passed as parameter.
Definition: SectionGeometry.cc:149
double getIyGrossSection(void) const
Inertia of the gross section about an axis parallel to y through its centroid.
Definition: SectionGeometry.cc:598
std::set< const Material * > getMaterials(void) const
Return a list of const pointers to the different reinforcing layers materials.
Definition: ListReinfLayer.cc:161
double DistSpots(const size_t &i, const size_t &j) const
Return the distance between the points identified by the arguments.
Definition: SectionGeometry.cc:239
std::map< size_t, Axis * > axes_container
line container.
Definition: SectionGeometry.h:72
std::map< size_t, Spot * > lst_spots
point container.
Definition: SectionGeometry.h:71
SectionReferenceFrame * get_reference_system(const size_t &id)
Returns a pointer to the reference system which identifier is being passed as parameter.
Definition: SectionGeometry.cc:103
double getTensionedZoneDepth(const HalfPlane2d &) const
Return the section depth from the border of the half-plane being passed as parameter to the most tens...
Definition: SectionGeometry.cc:338
Vector getCenterOfMassGrossSection(void) const
Returns gross section centroid position.
Definition: SectionGeometry.cc:594
Section composed of some regions.
Definition: RegionContainer.h:54
Posición en dos dimensiones.
Definition: Pos2d.h:41
boost::python::list getMaterialsPy(void)
Return a Python list of pointers to the different region materials.
Definition: RegionContainer.cc:175
Axis * createAxis(void)
Creates a new axis.
Definition: SectionGeometry.h:210
Segment * newSegment(size_t, size_t)
New segment.
Definition: SectionGeometry.cc:223
Line in a two-dimensional space.
Definition: Line2d.h:61
MaterialHandler * material_handler
Material handler (searching,...).
Definition: SectionGeometry.h:75
double getAreaGrossSection(void) const
Returns region&#39;s gross section area.
Definition: SectionGeometry.cc:583
SectionGeometry getGMRegions(void) const
Returns a geometry that contains only the regions defined in this object.
Definition: SectionGeometry.cc:75
boost::python::list getRegionsContoursPy(void) const
Return the contours of the regions in a Python list.
Definition: SectionGeometry.cc:262
double getAreaHomogenizedSection(const double &E0) const
Return the homogenized area of the regions.
Definition: SectionGeometry.cc:493
SectionReferenceFrame * createReferenceFrame(const std::string &)
Creates a new reference frame of the type being passed as parameter.
Definition: SectionGeometry.cc:169
size_t tag_spot
Default identifier for next point.
Definition: SectionGeometry.h:84
std::list< Polygon2d > getRegionsContours(void) const
Return the contours of the regions.
Definition: SectionGeometry.cc:258
std::string & Name(void)
Return a reference to the object name.
Definition: NamedEntity.h:52
double getCover(const Pos2d &) const
Return the cover for the position being passed as parameter.
Definition: SectionGeometry.cc:440
Line segment.
Definition: Segment.h:41
double getCompressedStrutWidth(const Segment2d &) const
Return the width «b0» of the compressed strut that corresponds to the arm lever represented by the se...
Definition: SectionGeometry.cc:408
ListReinfLayer reinforcement_layers
Rebar layers container.
Definition: SectionGeometry.h:78
std::set< const Material * > getMaterials(void) const
Return a list of const pointers to the different region materials.
Definition: RegionContainer.cc:147
Base class for 1D entities in section definition.
Definition: Axis.h:44
virtual std::string getClassName(void) const
Returns demangled class name.
Definition: EntityWithOwner.cc:90
Polígono en dos dimensiones.
Definition: Polygon2d.h:38
Segment in a two-dimensional space.
Definition: Segment2d.h:38
std::map< size_t, SectionReferenceFrame * > lst_ref_sys
reference systems container.
Definition: SectionGeometry.h:70
double getPyzHomogenizedSection(const double &E0) const
Returns homogenized product of inertia of the cross-section with respecto to the axis parallel to y a...
Definition: SectionGeometry.cc:562
Reference system used for make easier defining point positions.
Definition: SectionReferenceFrame.h:43
Reinf layer container (list).
Definition: ListReinfLayer.h:56
double getIzHomogenizedSection(const double &E0) const
Returns homogenized moment of inertia of the cross-section with respecto to the axis parallel to z pa...
Definition: SectionGeometry.cc:541
Point object for section geometry definition.
Definition: Spot.h:44
lst_ref_sys reference_systems
Spatial reference systems.
Definition: SectionGeometry.h:80
const std::string & Name(void) const
Return a reference to the object name.
Definition: SectionGeometry.cc:660
lst_spots spots
Point container.
Definition: SectionGeometry.h:83
Material handler (definition, searching,...).
Definition: MaterialHandler.h:46
BND2d getBnd(void) const
Return the regions boundary.
Definition: SectionGeometry.cc:452
std::set< const Material * > getRegionMaterials(void) const
Return a list of const pointers to the different region materials.
Definition: SectionGeometry.h:171
Polygon2d getCompressedZoneContour(const HalfPlane2d &) const
Return the contour of the compressed part of the regions.
Definition: SectionGeometry.cc:282
std::set< const Material * > getMaterials(void) const
Return a list of const pointers to the different section materials.
Definition: SectionGeometry.cc:460
Spot * creaSpot(const Pos2d &)
Creates a new point.
Definition: SectionGeometry.cc:190
std::set< Material * > getRegionMaterials(void)
Return a list of pointers to the different region materials.
Definition: SectionGeometry.h:174
void Print(std::ostream &s, int flag=0) const
Printing.
Definition: SectionGeometry.cc:677
boost::python::list getMaterialsPy(void)
Return a Python list of pointers to the different reinforcing layers materials.
Definition: ListReinfLayer.cc:191
Polygon2d getRegionsContour(void) const
Return the contour of the regions.
Definition: SectionGeometry.cc:266
Half plane in a two-dimensional space.
Definition: HalfPlane2d.h:38
RegionContainer regions
Region container.
Definition: SectionGeometry.h:77
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
double getAnchoMecanico(const Line2d &) const
Return the section width for the bending plane intersect being passed as parameter.
Definition: SectionGeometry.cc:387
size_t axis_tag
Default identifier for next axis.
Definition: SectionGeometry.h:86
size_t tag_ref_sys
Default identifier for next spatial reference system.
Definition: SectionGeometry.h:81
double getCutLength(const Line2d &r) const
Return the lengths of the segments that results of cutting the line being passed as parameter with th...
Definition: SectionGeometry.cc:355
Cross-section representation able to return mechanical propertis a area, moments of inertia...
Definition: SectionMassProperties.h:51
double getLeverArm(const Line2d &) const
Return the working cross-section lever arm from the position of the half-plane being passed as parame...
Definition: SectionGeometry.cc:302
Spot * find_spot(const size_t &)
Returns a pointer to the point identified by the argument.
Definition: SectionGeometry.cc:129
void clear(void)
Clear the containers of this object.
Definition: SectionGeometry.cc:62
double getIzGrossSection(void) const
Inertia of the gross section about an axis parallel to z through its centroid.
Definition: SectionGeometry.cc:618
double getPyzGrossSection(void) const
Product of inertia of the gross section about y and z axis through its centroid.
Definition: SectionGeometry.cc:638
std::set< Material * > getReinforcementMaterials(void)
Return a list of pointers to the different reinforcing layers materials.
Definition: SectionGeometry.h:162
SectionGeometry getCrackedSection(const HalfPlane2d &) const
Return a section with only the compressed regions of the section.
Definition: SectionGeometry.cc:92
std::set< const Material * > getReinforcementMaterials(void) const
Return a list of const pointers to the different reinforcing layers materials.
Definition: SectionGeometry.h:158
double getCompressedZoneDepth(const HalfPlane2d &) const
Return the section depth from the border of the half-plane being passed as parameter to the most comp...
Definition: SectionGeometry.cc:322
Cross section geometry.
Definition: SectionGeometry.h:66
boost::python::list getRegionMaterialsPy(void)
Return a python list of pointers to the different region materials.
Definition: SectionGeometry.h:178
std::vector< double > getCutLengths(const std::list< Line2d > &lr) const
Return the lengths of the segments that results of cutting the line being passed as parameter with th...
Definition: SectionGeometry.cc:367
boost::python::list getMaterialsPy(void)
Return a Python list of pointers to the different section materials.
Definition: SectionGeometry.cc:476
Spot * newSpot(const Pos2d &)
New spot.
Definition: SectionGeometry.cc:204
SectionGeometry getGMReinforcementLayers(void) const
Returns a geometry that contains only the regions defined in this object.
Definition: SectionGeometry.cc:84