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 
45 namespace XC {
46 class SectionReferenceFrame;
47 class Spot;
48 class Segment;
49 class SectRegion;
50 class ReinfLayer;
51 class MaterialHandler;
52 class Material;
53 class Vector;
54 class Matrix;
55 class CrossSectionProperties3d;
56 class CrossSectionProperties2d;
57 
61 //
63 //
66  {
67  public:
68 
69  typedef std::map<size_t,SectionReferenceFrame *> lst_ref_sys;
70  typedef std::map<size_t,Spot *> lst_spots;
71  typedef std::map<size_t,Axis *> axes_container;
72 
73  protected:
75 
78 
79  lst_ref_sys reference_systems;
80  size_t tag_ref_sys;
81 
82  lst_spots spots;
83  size_t tag_spot;
84  axes_container axes;
85  size_t axis_tag;
86 
87  public:
88  //Constructores
90  inline virtual ~SectionGeometry(void) {}
91 
92  void clear(void);
93 
94  inline int getReferenceFrameTag(void) const
95  { return tag_ref_sys; }
96  void setReferenceFrameTag(int i)
97  { tag_ref_sys= i; }
99  const SectionReferenceFrame *get_reference_system(const size_t &id) const;
100  inline SectionReferenceFrame *current_reference_system(void)
101  { return get_reference_system(tag_ref_sys); }
102  const SectionReferenceFrame *current_reference_system(void) const
103  { return get_reference_system(tag_ref_sys); }
104  SectionReferenceFrame *createReferenceFrame(const std::string &);
105 
106  // Section edition functions
107  inline int getTagSpot(void) const
108  { return tag_spot; }
109  void setTagSpot(int i)
110  { tag_spot= i; }
111  Spot *find_spot(const size_t &);
112  const Spot *find_spot(const size_t &) const;
113  Spot *creaSpot(const Pos2d &);
114  Spot *newSpot(const Pos2d &);
115 
116  inline int getAxisTag(void) const
117  { return axis_tag; }
118  void setAxisTag(int i)
119  { axis_tag= i; }
120  Axis *find_axis(const size_t &);
121  const Axis *find_axis(const size_t &) const;
122  template <class E>
123  Axis *createAxis(void);
124  Segment *newSegment(size_t, size_t);
125 
126  // Section inquiring functions
127  double DistSpots(const size_t &i,const size_t &j) const;
128  Polygon2d getRegionsContour(void) const;
130  double getCutLength(const Line2d &r) const;
131  std::vector<double> getCutLengths(const std::list<Line2d> &lr) const;
132  double getCompressedZoneDepth(const HalfPlane2d &) const;
133  double getTensionedZoneDepth(const HalfPlane2d &) const;
134  double getLeverArm(const Line2d &) const;
135  double getAnchoMecanico(const Line2d &) const;
136  double getCover(const Pos2d &) const;
137  double getCompressedStrutWidth(const Segment2d &) const;
138 
139  //Access to containers.
140  inline const RegionContainer &getRegions(void) const
141  { return regions; }
142  inline RegionContainer &getRegions(void)
143  { return regions; }
144  inline const ListReinfLayer &getReinforcementLayers(void) const
145  { return reinforcement_layers; }
146  inline ListReinfLayer &getReinforcementLayers(void)
147  { return reinforcement_layers; }
148  SectionGeometry getGMRegions(void) const;
151  size_t getNumFiberData(void) const;
152 
153  double getAreaGrossSection(void) const;
155  double getIyGrossSection(void) const;
156  double getIzGrossSection(void) const;
157  double getPyzGrossSection(void) const;
158 
159  Vector getCenterOfMassHomogenizedSection(const double &E0) const;
160  double getAreaHomogenizedSection(const double &E0) const;
161  double getIyHomogenizedSection(const double &E0) const;
162  double getIzHomogenizedSection(const double &E0) const;
163  double getPyzHomogenizedSection(const double &E0) const;
164 
166  const std::string &Name(void) const;
167 
168  void Print(std::ostream &s, int flag =0) const;
169  friend std::ostream &operator<<(std::ostream &, SectionGeometry &);
170  };
171 
172 std::ostream &operator<<(std::ostream &, SectionGeometry &);
173 
175 template <class E>
177  {
178  Axis *retval= find_axis(axis_tag);
179  if(!retval) //It doesn't already exist
180  {
181  retval= new E(this);
182  if(retval)
183  {
184  retval->Name()= "l"+boost::lexical_cast<std::string>(axis_tag);
185  axes[axis_tag]= retval;
186  axis_tag++;
187  }
188  else
189  std::cerr << Color::red << getClassName() << "::" << __FUNCTION__
190  << "Can't create axis with tag: "
191  << axis_tag << "."
192  << Color::def << std::endl;
193  }
194  return retval;
195  }
196 
197 } // end of XC namespace
198 
199 
200 #endif
201 
axes_container axes
Axis container.
Definition: SectionGeometry.h:84
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:470
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:148
double getIyGrossSection(void) const
Inertia of the gross section about an axis parallel to y through its centroid.
Definition: SectionGeometry.cc:548
double DistSpots(const size_t &i, const size_t &j) const
Return the distance between the points identified by the arguments.
Definition: SectionGeometry.cc:238
std::map< size_t, Axis * > axes_container
line container.
Definition: SectionGeometry.h:71
std::map< size_t, Spot * > lst_spots
point container.
Definition: SectionGeometry.h:70
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:102
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:329
Vector getCenterOfMassGrossSection(void) const
Returns gross section centroid position.
Definition: SectionGeometry.cc:544
Section composed of some regions.
Definition: RegionContainer.h:53
Posición en dos dimensiones.
Definition: Pos2d.h:41
Axis * createAxis(void)
Creates a new axis.
Definition: SectionGeometry.h:176
Segment * newSegment(size_t, size_t)
New segment.
Definition: SectionGeometry.cc:222
Line in a two-dimensional space.
Definition: Line2d.h:61
MaterialHandler * material_handler
Material handler (searching,...).
Definition: SectionGeometry.h:74
double getAreaGrossSection(void) const
Returns region&#39;s gross section area.
Definition: SectionGeometry.cc:533
SectionGeometry getGMRegions(void) const
Returns a geometry that contains only the regions defined in this object.
Definition: SectionGeometry.cc:74
double getAreaHomogenizedSection(const double &E0) const
Return the homogenized area of the regions.
Definition: SectionGeometry.cc:443
SectionReferenceFrame * createReferenceFrame(const std::string &)
Creates a new reference frame of the type being passed as parameter.
Definition: SectionGeometry.cc:168
size_t tag_spot
Default identifier for next point.
Definition: SectionGeometry.h:83
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:431
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:399
ListReinfLayer reinforcement_layers
Rebar layers container.
Definition: SectionGeometry.h:77
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:69
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:512
Reference system used for make easier defining point positions.
Definition: SectionReferenceFrame.h:43
Reinf layer container (list).
Definition: ListReinfLayer.h:54
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:491
Point object for section geometry definition.
Definition: Spot.h:44
lst_ref_sys reference_systems
Spatial reference systems.
Definition: SectionGeometry.h:79
const std::string & Name(void) const
Return a reference to the object name.
Definition: SectionGeometry.cc:610
lst_spots spots
Point container.
Definition: SectionGeometry.h:82
Material handler (definition, searching,...).
Definition: MaterialHandler.h:46
Polygon2d getCompressedZoneContour(const HalfPlane2d &) const
Return the contour of the compressed part of the regions.
Definition: SectionGeometry.cc:273
Spot * creaSpot(const Pos2d &)
Creates a new point.
Definition: SectionGeometry.cc:189
void Print(std::ostream &s, int flag=0) const
Printing.
Definition: SectionGeometry.cc:627
Polygon2d getRegionsContour(void) const
Return the contour of the regions.
Definition: SectionGeometry.cc:257
Half plane in a two-dimensional space.
Definition: HalfPlane2d.h:38
RegionContainer regions
Region container.
Definition: SectionGeometry.h:76
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:378
size_t axis_tag
Default identifier for next axis.
Definition: SectionGeometry.h:85
size_t tag_ref_sys
Default identifier for next spatial reference system.
Definition: SectionGeometry.h:80
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:346
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:293
Spot * find_spot(const size_t &)
Returns a pointer to the point identified by the argument.
Definition: SectionGeometry.cc:128
void clear(void)
Clear the containers of this object.
Definition: SectionGeometry.cc:61
double getIzGrossSection(void) const
Inertia of the gross section about an axis parallel to z through its centroid.
Definition: SectionGeometry.cc:568
double getPyzGrossSection(void) const
Product of inertia of the gross section about y and z axis through its centroid.
Definition: SectionGeometry.cc:588
SectionGeometry getCrackedSection(const HalfPlane2d &) const
Return a section with only the compressed regions of the section.
Definition: SectionGeometry.cc:91
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:313
Cross section geometry.
Definition: SectionGeometry.h:65
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:358
Spot * newSpot(const Pos2d &)
New spot.
Definition: SectionGeometry.cc:203
SectionGeometry getGMReinforcementLayers(void) const
Returns a geometry that contains only the regions defined in this object.
Definition: SectionGeometry.cc:83