xc
LineBase.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 //LineBase.h
29 
30 #ifndef LINEBASE_H
31 #define LINEBASE_H
32 
33 #include "Edge.h"
34 
35 
36 namespace XC {
37 
41 class LineBase: public Edge
42  {
43  protected:
44  Pnt *p1;
45  Pnt *p2;
46 
47  virtual bool check_points(void) const;
48  public:
49  LineBase(Preprocessor *m,const size_t &ndiv= 4);
50  LineBase(const std::string &name,Preprocessor *m,const size_t &ndiv= 4);
51  virtual bool operator==(const LineBase &) const;
53  inline Pnt *P1(void)
54  { return p1; }
56  virtual Pnt *P2(void)
57  { return p2; }
58  const Pnt *P1(void) const;
59  const Pnt *P2(void) const;
60 
61  virtual double getLambda(const Pos3d &) const= 0;
62  double getLambda(const Node &n) const;
63  bool less(const Pos3d &a, const Pos3d &b) const;
64  bool less(const Node &a, const Node &b) const;
65  std::vector<std::pair<double,Pos3d> > sort(const std::deque<Pos3d> &) const;
66  std::vector<std::pair<double,Node *> > sort(const std::deque<Node *> &) const;
67 
68  void create_nodes(const std::deque<Pos3d> &positions);
69 
70  virtual const Pnt *getVertex(const size_t &i) const;
71  virtual Pnt *getVertex(const size_t &i);
72  virtual void SetVertice(const size_t &,Pnt *);
73  void SetVertice(const size_t &,const size_t &);
74  void SetVertices(Pnt *,Pnt *);
75 
76  boost::python::dict getPyDict(void) const;
77  void setPyDict(const boost::python::dict &);
78  };
79 
80 } //end of XC namespace
81 #endif
bool less(const Pos3d &a, const Pos3d &b) const
Return true if lambda value (see getLambda) of point a is smaller than lambda value of point b...
Definition: LineBase.cc:101
std::vector< std::pair< double, Pos3d > > sort(const std::deque< Pos3d > &) const
Return the positions sorted by its distance to the first point of the line.
Definition: LineBase.cc:111
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: LineBase.cc:228
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: LineBase.cc:213
Base class for one-dimensional geometry objects.
Definition: Edge.h:48
Finite element model generation tools.
Definition: Preprocessor.h:59
virtual bool check_points(void) const
Checks that the points are defined.
Definition: LineBase.cc:159
Pnt * p1
Back end.
Definition: LineBase.h:44
Base class for 1D entities.
Definition: LineBase.h:41
virtual Pnt * P2(void)
Return pointer to front end.
Definition: LineBase.h:56
LineBase(Preprocessor *m, const size_t &ndiv=4)
Constructor.
Definition: LineBase.cc:41
virtual void create_nodes(void)
Create nodes on objects.
Definition: Edge.cc:691
virtual void SetVertice(const size_t &, Pnt *)
Sets the i-th vertex.
Definition: LineBase.cc:172
Pnt * p2
Front end.
Definition: LineBase.h:45
virtual const Pnt * getVertex(const size_t &i) const
Return the i-th vertex.
Definition: LineBase.cc:74
Point (KPoint).
Definition: Pnt.h:50
virtual bool operator==(const LineBase &) const
Comparison operator.
Definition: LineBase.cc:49
Posición en tres dimensiones.
Definition: Pos3d.h:44
Pnt * P1(void)
Return pointer to back end.
Definition: LineBase.h:53
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Mesh node.
Definition: Node.h:111
void SetVertices(Pnt *, Pnt *)
Assigns line ends.
Definition: LineBase.cc:197