xc
Grid2d.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //Grid2d.h
22 
23 #ifndef Grid2d_h
24 #define Grid2d_h
25 
26 #include "Surface2d.h"
27 #include "../pos_vec/Pos2dArray.h"
28 
30 //
32 class Grid2d: public Surface2d
33  {
34  Pos2dArray points;
35  public:
36  Grid2d(void);
37  Grid2d(int numSubdivIJ, int numSubdivJK);
38  explicit Grid2d(const Pos2dArray &m)
39  : Surface2d(), points(m) {}
40  virtual ~Grid2d(void);
41  virtual GeomObj *getCopy(void) const
42  { return new Grid2d(*this); }
43 
44  inline const Pos2d &operator()(const size_t &i,const size_t &j) const
45  { return points(i,j); }
46  inline Pos2d &operator()(const size_t &i,const size_t &j)
47  { return points(i,j); }
49  inline Pos2dArray &getPoints(void)
50  { return points; }
51 
52  GEOM_FT GetMax(unsigned short int i) const;
53  GEOM_FT GetMin(unsigned short int i) const;
54  GEOM_FT getArea(void) const;
55  GEOM_FT Ix(void) const;
56  GEOM_FT Iy(void) const;
57  GEOM_FT Pxy(void) const;
58  Pos2d getCenterOfMass(void) const;
59  const FT_matrix &GetVertCoords(const size_t &,const size_t &) const;
60  Pos2d getPoint(const size_t &,const size_t &) const;
61  Quadrilateral2d GetQuad(const size_t &i,const size_t &j) const;
62  bool In(const Pos2d &, const double &) const;
63 
64  void Transform(const Trf2d &trf2d);
65 
66  void Print(std::ostream &os) const;
67  };
68 
69 #endif
70 
GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i coordinate.
Definition: Grid2d.cc:80
Posición en dos dimensiones.
Definition: Pos2d.h:41
GEOM_FT Iy(void) const
Moment of inertia with respect to the center of mass in local coordinates.
Definition: Grid2d.cc:52
Base class for two-dimensional transformations.
Definition: Trf2d.h:40
GEOM_FT getArea(void) const
Return the area of the grid.
Definition: Grid2d.cc:44
Pos2d getCenterOfMass(void) const
Return the center of mass.
Definition: Grid2d.cc:60
Array of positions in a two-dimensional space.
Definition: Pos2dArray.h:38
GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i coordinate.
Definition: Grid2d.cc:84
GEOM_FT Ix(void) const
of inertia with respect to the center of mass in local coordinates.
Definition: Grid2d.cc:48
GEOM_FT Pxy(void) const
product of inertia with respect to the center of mass in local coordinates.
Definition: Grid2d.cc:56
Base class for surfaces in a two-dimensional space.
Definition: Surface2d.h:33
const FT_matrix & GetVertCoords(const size_t &, const size_t &) const
Return the coordinates of the i,j point.
Definition: Grid2d.cc:64
Pos2dArray & getPoints(void)
Return a reference to the 2D point array defining the grid.
Definition: Grid2d.h:49
Grid in a two-dimensional space.
Definition: Grid2d.h:32
Grid2d(void)
Constructor.
Definition: Grid2d.cc:33
void Transform(const Trf2d &trf2d)
Aplica al objeto la transformación que se pasa como parámetro.
Definition: Grid2d.cc:90
Quadrilateral on a bi-dimensional space.
Definition: Quadrilateral2d.h:44
Quadrilateral2d GetQuad(const size_t &i, const size_t &j) const
Return the i,j cell quad:
Definition: Grid2d.cc:72
bool In(const Pos2d &, const double &) const
Return true if the point belongs to the grid.
Definition: Grid2d.cc:76
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
Matrix which components are GEOM_FT numbers.
Definition: FT_matrix.h:40
Pos2d getPoint(const size_t &, const size_t &) const
Return the point i,j.
Definition: Grid2d.cc:68