cell.hh

Go to the documentation of this file.
1 
8 #ifndef cell_hh
9 #define cell_hh
10 
11 #include <iostream>
12 
13 #include "basics/outputOperator.hh"
14 #include "basics/typedefs.hh"
15 #include "basics/exceptions.hh"
18 #include "connector.hh"
19 
20 namespace concepts {
21 
22  // ****************************************************************** Cell **
23 
39  class Cell: public OutputOperator {
40  public:
44  virtual Cell* child(uint i) = 0;
48  virtual const Cell* child(uint i) const = 0;
50  inline bool hasChildren() const {
51  return child(0) != 0;
52  }
54  virtual Connector& connector() const = 0;
55 
57  virtual Real3d elemMap(const Real coord_local) const;
58 
60  virtual Real3d elemMap(const Real2d& coord_local) const;
61 
63  virtual Real3d elemMap(const Real3d& coord_local) const;
64 
65  protected:
66  virtual std::ostream& info(std::ostream& os) const = 0;
67  };
68 
70  bool operator<(const Cell& cell_x, const Cell& cell_y);
71 
72  // ***************************************************************** Cell1 **
73 
75  class Cell1: public Cell {
76  public:
77  virtual Cell1* child(uint i) = 0;
78  virtual const Cell1* child(uint i) const = 0;
79  virtual Connector1& connector() const = 0;
81  virtual Real3d vertex(uint i) const = 0;
83  virtual Real3d center() const = 0;
84  };
85 
86  // ***************************************************************** Cell2 **
87 
89  class Cell2: public Cell {
90  public:
91  virtual Cell2* child(uint i) = 0;
92  virtual const Cell2* child(uint i) const = 0;
93  virtual Connector2& connector() const = 0;
95  virtual Real3d vertex(uint i) const = 0;
97  virtual Real3d center() const = 0;
98 
99  virtual Real3d elemMap(const Real2d& coord_local) const = 0;
104  virtual Real3d elemMap(const Real3d& coord_local) const {
105  return elemMap(Real2d(coord_local[0], coord_local[1]));
106  }
107  };
108 
109  // ***************************************************************** Cell3 **
110 
112  class Cell3: public Cell {
113  public:
114  virtual Cell3* child(uint i) = 0;
115  virtual const Cell3* child(uint i) const = 0;
116  virtual Connector3& connector() const = 0;
118  virtual Real3d vertex(uint i) const = 0;
120  virtual Real3d center() const = 0;
121  };
122 
123 } // namespace concepts
124 
125 namespace std {
126 
127  // ****************************************************** std::less<Cell*> **
128 
137  template<>
138  struct less<concepts::Cell*> : public std::binary_function<concepts::Cell*,
139  concepts::Cell*, bool> {
140  bool operator()(concepts::Cell* const & __x,
141  concepts::Cell* const & __y) const;
142  };
143 
144  template<>
145  struct less<concepts::Cell1*> : less<concepts::Cell*> {
146  };
147  template<>
148  struct less<concepts::Cell2*> : less<concepts::Cell*> {
149  };
150  template<>
151  struct less<concepts::Cell3*> : less<concepts::Cell*> {
152  };
153 
154 } // namespace std
155 
156 #endif // cell_hh
virtual Connector & connector() const =0
Returns the connector.
A 3D element of the topology.
Definition: connector.hh:277
virtual Real3d vertex(uint i) const =0
Returns the coordinates of the ith vertex.
virtual const Cell * child(uint i) const =0
Returns a pointer to the ith child.
virtual Cell * child(uint i)=0
Returns a pointer to the ith child.
virtual Real3d center() const =0
Returns the center of the cell.
virtual Real3d center() const =0
Returns the center of the cell.
bool hasChildren() const
Returns true if there is a least one child.
Definition: cell.hh:50
virtual Real3d elemMap(const Real3d &coord_local) const
Element map from point local coordinates in 3D.
Point< Real, 2 > Real2d
A cell in a mesh consist of topological information (neighbours, connectivity, orientation) and geome...
Definition: cell.hh:39
Three dimensional cell.
Definition: cell.hh:112
virtual Real3d elemMap(const Real3d &coord_local) const
Element map from point local coordinates in 3D.
Definition: cell.hh:104
virtual const Cell3 * child(uint i) const =0
Returns a pointer to the ith child.
virtual Cell2 * child(uint i)=0
Returns a pointer to the ith child.
One dimensional cell.
Definition: cell.hh:75
virtual Connector3 & connector() const =0
Returns the connector.
virtual Cell3 * child(uint i)=0
Returns a pointer to the ith child.
virtual Real3d center() const =0
Returns the center of the cell.
A 2D element of the topology.
Definition: connector.hh:226
virtual Cell1 * child(uint i)=0
Returns a pointer to the ith child.
Two dimensional cell.
Definition: cell.hh:89
virtual Connector1 & connector() const =0
Returns the connector.
bool operator<(const Cell &cell_x, const Cell &cell_y)
<-operator could be useful for sorting, e.g. in std::set.
virtual Real3d elemMap(const Real coord_local) const
Element map from point local coordinates in 1D.
virtual const Cell1 * child(uint i) const =0
Returns a pointer to the ith child.
A 1D element of the topology.
Definition: connector.hh:182
virtual Connector2 & connector() const =0
Returns the connector.
virtual Real3d vertex(uint i) const =0
Returns the coordinates of the ith vertex.
virtual std::ostream & info(std::ostream &os) const =0
Returns information in an output stream.
virtual Real3d elemMap(const Real2d &coord_local) const =0
Element map from point local coordinates in 2D.
Class providing an output operator.
virtual const Cell2 * child(uint i) const =0
Returns a pointer to the ith child.
virtual Real3d vertex(uint i) const =0
Returns the coordinates of the ith vertex.
An abstract class for elements of the topology.
Definition: connector.hh:85
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual Real3d elemMap(const Real2d &coord_local) const
Element map from point local coordinates in 2D.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
bool operator()(concepts::Cell *const &__x, concepts::Cell *const &__y) const
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich