00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 # ifndef shape_cell_list_hpp
00014 # define shape_cell_list_hpp
00015
00016 # include <shape/bcell2d.hpp>
00017 # define TMPL template<class C, class V>
00018 # define REF REF_OF(V)
00019 # define Point point<C,REF>
00020 # define SELF bcell_list<C,V>
00021 # undef Cell
00022 # undef Topology
00023
00024 namespace mmx {
00025 namespace shape {
00026
00027 template<class C, class V=default_env>
00028 class bcell_list: public bcell<C,V> {
00029 public:
00030 typedef bounding_box<C,REF> BoundingBox;
00031 typedef bcell<C,REF> Cell;
00032 typedef topology<C,V> Topology;
00033
00034 bcell_list(void) ;
00035 bcell_list(double xmin, double xmax) ;
00036 bcell_list(double xmin, double xmax, double ymin, double ymax) ;
00037 bcell_list(double xmin, double xmax, double ymin, double ymax, bool itr) ;
00038 bcell_list(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) ;
00039 bcell_list(const BoundingBox& bx);
00040 virtual ~bcell_list(void) ;
00041
00042 virtual bool is_active (void) const;
00043 virtual bool is_regular (void) = 0 ;
00044
00045 virtual bool insert_regular(Topology*);
00046 virtual bool insert_singular(Topology*);
00047
00048
00049 void push_back(Cell *) ;
00050 int count(void) { return m_objects.size() ; }
00051
00052
00053 protected:
00054 Seq<Cell *> m_objects ;
00055 };
00056
00057
00058 TMPL SELF::bcell_list(void){}
00059 TMPL SELF::bcell_list(double xmin, double xmax) : Cell(xmin, xmax) {}
00060 TMPL SELF::bcell_list(double xmin, double xmax, double ymin, double ymax) : Cell(xmin, xmax, ymin, ymax) {}
00061 TMPL SELF::bcell_list(double xmin, double xmax, double ymin, double ymax, bool itr) : Cell(xmin, xmax, ymin, ymax) {}
00062 TMPL SELF::bcell_list(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) : Cell(xmin, xmax, ymin, ymax, zmin, zmax) {}
00063 TMPL SELF::bcell_list(const BoundingBox& bx): Cell(bx) {};
00064
00065 TMPL SELF::~bcell_list(void) {
00066 foreach (Cell* m, m_objects) delete m;
00067 }
00068
00069 TMPL bool
00070 SELF::is_active() const {
00071 foreach (Cell* m, m_objects)
00072 if(m->is_active()) return true;
00073 return false;
00074 }
00075
00076 TMPL bool
00077 SELF::insert_regular(Topology* s) {
00078
00079 foreach(Cell* m, m_objects) m->insert_regular(s);
00080 return true;
00081 }
00082
00083 TMPL bool
00084 SELF::insert_singular(Topology* s) {
00085
00086 foreach(Cell * m, m_objects) m->insert_singular(s);
00087 return true;
00088 }
00089
00090 TMPL void
00091 SELF::push_back(Cell *cv) {
00092 m_objects.push_back(cv);
00093 }
00094
00095
00096 } ;
00097 } ;
00098
00099 # undef TMPL
00100 # undef SELF
00101 # undef REF
00102 # undef Point
00103 # endif // shape_cell_list_hpp