Go to the documentation of this file.00001
00006 #ifndef meshRelations_hh
00007 #define meshRelations_hh
00008
00009 #include "toolbox/sequence.hh"
00010 #include "topology.hh"
00011
00012 namespace concepts {
00013
00014
00015
00021 template<uint dim = 2>
00022 class PointInCell : public OutputOperator {
00023 public:
00024 const Connector* cntr_;
00025 Point<Real,dim> p_;
00026 protected:
00027 virtual std::ostream& info(std::ostream& os) const;
00028 };
00029
00030 template<>
00031 class PointInCell<1> : public OutputOperator {
00032 public:
00033 const Connector* cntr_;
00034 Real p_;
00035 protected:
00036 virtual std::ostream& info(std::ostream& os) const;
00037 };
00038
00039
00040
00041 template<uint sdim = 2, uint tdim = 2>
00042 class CellToCellMapping : public OutputOperator {
00043 public:
00044 virtual PointInCell<tdim> operator()(const PointInCell<sdim> P) const = 0;
00045 protected:
00046 virtual std::ostream& info(std::ostream& os) const {
00047 return os << "CellToCellMapping()";
00048 }
00049 };
00050
00051
00052
00060 class RelativeCells : public OutputOperator {
00061 public:
00066 RelativeCells(std::vector<const Connector*> cells);
00067
00075 bool child (const PointInCell<2> P, PointInCell<2>& T) const;
00083 bool parent(const PointInCell<2> P, PointInCell<2>& T) const;
00084 PointInCell<2> finestCell (const PointInCell<2> P) const;
00085 PointInCell<2> coarsestCell(const PointInCell<2> P) const;
00086
00088 void rebuildCells();
00089 protected:
00090 virtual std::ostream& info(std::ostream& os) const {
00091 return os << "RelativeCells()";
00092 }
00093 private:
00095 mutable concepts::Sequence<const Connector*> cells_;
00096
00097
00098 mutable std::map<const Connector*, const Connector*> parents_;
00099
00100 mutable std::map<const Connector*, uint> childNo_;
00101
00102 bool edgeChild_(const Edge* cntr, const Real2d xi, PointInCell<2>& P) const;
00103
00104 bool quadChild_(const Quad* cntr, const Real2d xi, PointInCell<2>& P) const;
00105
00106 bool edgeParent_(const Edge* cntr, const Real2d xi, uint i,
00107 Real2d& Txi) const;
00108
00109 bool quadParent_(const Quad* cntr, const Real2d xi, uint i,
00110 Real2d& Txi) const;
00111 };
00112
00113
00114 }
00115
00116
00117 #endif // meshRelations_hh