shape_doc 0.1
cell_list< C, V > Class Template Reference

#include <cell_list.hpp>

Inheritance diagram for cell_list< C, V >:
cell< C, V > bounding_box< C, V > Shape

List of all members.

Public Types

Public Member Functions

Protected Attributes


Detailed Description

template<class C, class V = default_env>
class mmx::shape::cell_list< C, V >

Definition at line 28 of file cell_list.hpp.


Member Typedef Documentation

typedef bounding_box<C, REF_OF(V) > BoundingBox

Reimplemented from cell< C, V >.

Definition at line 30 of file cell_list.hpp.

typedef cell<C, REF_OF(V) > Cell

Definition at line 31 of file cell_list.hpp.

typedef topology<C,V> Topology

Reimplemented from cell< C, V >.

Definition at line 32 of file cell_list.hpp.

typedef use<cell_def,V> VARIANT [inherited]

Definition at line 57 of file cell.hpp.


Constructor & Destructor Documentation

cell_list ( void  )

Definition at line 58 of file cell_list.hpp.

{}
cell_list ( double  xmin,
double  xmax 
)

Definition at line 59 of file cell_list.hpp.

: Cell(xmin, xmax) {}
cell_list ( double  xmin,
double  xmax,
double  ymin,
double  ymax 
)

Definition at line 60 of file cell_list.hpp.

:  Cell(xmin, xmax, ymin, ymax) {}
cell_list ( double  xmin,
double  xmax,
double  ymin,
double  ymax,
bool  itr 
)

Definition at line 61 of file cell_list.hpp.

: Cell(xmin, xmax, ymin, ymax) {}
cell_list ( double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmin,
double  zmax 
)

Definition at line 62 of file cell_list.hpp.

cell_list ( const BoundingBox bx)

Definition at line 63 of file cell_list.hpp.

: Cell(bx) {};
~cell_list ( void  ) [virtual]

Definition at line 65 of file cell_list.hpp.

                          {
    foreach (Cell* m, m_objects) delete m;
  }

Member Function Documentation

BoundingBox boundingBox ( ) const [inline, inherited]

Definition at line 88 of file cell.hpp.

{ return (BoundingBox)*this; }
virtual Point center ( void  ) const [inline, virtual, inherited]

Definition at line 82 of file cell.hpp.

                                         { 
    // XXX ???
    return Point(this->xmax()-this->xmin(),
                 this->ymax()-this->ymin(),
                 this->zmax()-this->zmin()); 
  }
bool contains ( double  x,
bool  strict = false 
) [inherited]

Definition at line 205 of file bounding_box.hpp.

{
    if(!strict)
        return (((m_xmin <= x) && (x <= m_xmax))) ;
    else 
        return (((m_xmin <  x) && (x <  m_xmax))) ;
}
bool contains ( double  x,
double  y,
bool  strict = false 
) [inherited]

Definition at line 214 of file bounding_box.hpp.

{
    if(!strict)
        return (((m_xmin <= x) && (x <= m_xmax)) 
           &&   ((m_ymin <= y) && (y <= m_ymax))) ;
    else 
        return (((m_xmin <  x) && (x <  m_xmax)) 
           &&   ((m_ymin <  y) && (y <  m_ymax))) ;
}
bool contains ( double  x,
double  y,
double  z,
bool  strict = false 
) [inherited]

Definition at line 225 of file bounding_box.hpp.

{
    if(!strict)
        return (((m_xmin <= x) && (x <= m_xmax)) 
           &&   ((m_ymin <= y) && (y <= m_ymax)) 
           &&   ((m_zmin <= z) && (z <= m_zmax)))  ;
    else 
        return (((m_xmin <  x) && (x <  m_xmax)) 
           &&   ((m_ymin <  y) && (y <  m_ymax)) 
           &&   ((m_zmin <  z) && (z <  m_zmax)))  ;
}
int count ( void  ) [inline]

Definition at line 50 of file cell_list.hpp.

References cell_list< C, V >::m_objects.

{ return m_objects.size() ; }
bool insert_regular ( Topology s) [virtual]

Implements cell< C, V >.

Definition at line 77 of file cell_list.hpp.

References cell< C, V >::insert_regular().

                                {
  //    foreach(Point* p, m_singulars) s->insert_singular(p);
  foreach(Cell*  m, m_objects)   m->insert_regular(s);
  return true;
}
bool insert_singular ( Topology s) [virtual]

Implements cell< C, V >.

Definition at line 84 of file cell_list.hpp.

References cell< C, V >::insert_singular().

                                 {
  //s->singular(this);
  foreach(Cell * m, m_objects) m->insert_singular(s);
  return true;
}
bounding_box< C, V > * intersect ( const bounding_box< C, V > &  other) [inherited]

Definition at line 318 of file bounding_box.hpp.

References mmx::shape::mmxmax(), mmx::shape::mmxmin(), and SELF.

Referenced by bounding_box< double, V >::operator*().

                                 {
  SELF * cell = new SELF ;
  cell->set_xmin(mmxmax(this->xmin(), other.xmin())) ;
  cell->set_xmax(mmxmin(this->xmax(), other.xmax())) ;
  cell->set_ymin(mmxmax(this->ymin(), other.ymin())) ;
  cell->set_ymax(mmxmin(this->ymax(), other.ymax())) ;
  cell->set_zmin(mmxmax(this->zmin(), other.zmin())) ;
  cell->set_zmax(mmxmin(this->zmax(), other.zmax())) ;
  return cell ;
}
void intersected ( bounding_box< C, V > *  other) [inherited]

Definition at line 298 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

                              {
  set_xmin(mmxmax(this->xmin(), other->xmin())) ;
  set_xmax(mmxmin(this->xmax(), other->xmax())) ;
  set_ymin(mmxmax(this->ymin(), other->ymin())) ;
  set_ymax(mmxmin(this->ymax(), other->ymax())) ;
  set_zmin(mmxmax(this->zmin(), other->zmin())) ;
  set_zmax(mmxmin(this->zmax(), other->zmax())) ;
}
bool intersects ( bounding_box< C, V > *  other,
bool  strict = true 
) [inherited]

Definition at line 238 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

{
         if(this->is0D())
            return (this->xmin() == other->xmin()) ;
    else if(this->is1D())
        if(strict)
            return ((mmxmax(this->xmin(), other->xmin()) <  mmxmin(this->xmax(), other->xmax()))) ;
        else
            return ((mmxmax(this->xmin(), other->xmin()) <= mmxmin(this->xmax(), other->xmax()))) ;
    else if(this->is2D())
        if(strict)
            return ((mmxmax(this->xmin(), other->xmin()) <  mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <  mmxmin(this->ymax(), other->ymax()))) ;
        else
            return ((mmxmax(this->xmin(), other->xmin()) <= mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <= mmxmin(this->ymax(), other->ymax()))) ;
    else if(this->is3d()) {
        if(strict)
            return ((mmxmax(this->xmin(), other->xmin()) <  mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <  mmxmin(this->ymax(), other->ymax())) &&
                    (mmxmax(this->zmin(), other->zmin()) <  mmxmin(this->zmax(), other->zmax()))) ;
        else
            return ((mmxmax(this->xmin(), other->xmin()) <= mmxmin(this->xmax(), other->xmax())) &&
                    (mmxmax(this->ymin(), other->ymin()) <= mmxmin(this->ymax(), other->ymax())) &&
                    (mmxmax(this->zmin(), other->zmin()) <= mmxmin(this->zmax(), other->zmax()))) ;
    }
         return false ;
}
bool is0D ( void  ) const [inline, inherited]

Definition at line 80 of file bounding_box.hpp.

{ return ((m_xmin == m_xmax) && (m_ymin == m_ymax) && (m_zmin == m_zmax)) ; }
bool is1D ( void  ) const [inline, inherited]

Definition at line 81 of file bounding_box.hpp.

{ return ((m_xmin != m_xmax) && (m_ymin == m_ymax) && (m_zmin == m_zmax)) ; }
bool is2D ( void  ) const [inline, inherited]

Definition at line 82 of file bounding_box.hpp.

{ return ((m_xmin != m_xmax) && (m_ymin != m_ymax) && (m_zmin == m_zmax)) ; }
bool is3d ( void  ) const [inline, inherited]

Definition at line 83 of file bounding_box.hpp.

{ return ((m_xmin != m_xmax) && (m_ymin != m_ymax) && (m_zmin != m_zmax)) ; }
bool is_active ( void  ) const [virtual]

Definition at line 70 of file cell_list.hpp.

References cell< C, V >::is_active().

                      {
  foreach (Cell* m, m_objects) 
    if(m->is_active()) return true;
  return false;
}
virtual bool is_regular ( void  ) [pure virtual]

Implements cell< C, V >.

double operator() ( unsigned  v,
unsigned  s 
) const [inherited]

Definition at line 342 of file bounding_box.hpp.

                                             {
  switch(v) {
  case 0:
    if(s==0) return xmin(); else return xmax();
  case 1:
    if(s==0) return ymin(); else return ymax();
  default:
    if(s==0) return zmin(); else return zmax();
  }
  
}
double & operator() ( unsigned  v,
unsigned  s 
) [inherited]

Definition at line 355 of file bounding_box.hpp.

                                       {
  switch(v) {
  case 0:
    if(s==0) return m_xmin; else return m_xmax;
  case 1:
    if(s==0) return m_ymin; else return m_ymax;
  default:
    if(s==0) return m_zmin; else return m_zmax;
  }
  
}
bounding_box<C,V>* operator* ( const bounding_box< C, V > &  other) [inline, inherited]

Definition at line 103 of file bounding_box.hpp.

{ return intersect(other) ; }
bounding_box<C,V>* operator+ ( const bounding_box< C, V > &  other) [inline, inherited]

Definition at line 104 of file bounding_box.hpp.

{ return     unite(other) ; }
void push_back ( Cell cv)

Definition at line 91 of file cell_list.hpp.

                        {
  m_objects.push_back(cv);
}
void set_xmax ( double  x) [inline, inherited]

Definition at line 74 of file bounding_box.hpp.

{ this->m_xmax = x ; }
void set_xmin ( double  x) [inline, inherited]

Definition at line 73 of file bounding_box.hpp.

{ this->m_xmin = x ; }
void set_ymax ( double  y) [inline, inherited]

Definition at line 76 of file bounding_box.hpp.

{ this->m_ymax = y ; }
void set_ymin ( double  y) [inline, inherited]

Definition at line 75 of file bounding_box.hpp.

{ this->m_ymin = y ; }
void set_zmax ( double  z) [inline, inherited]

Definition at line 78 of file bounding_box.hpp.

{ this->m_zmax = z ; }
void set_zmin ( double  z) [inline, inherited]

Definition at line 77 of file bounding_box.hpp.

{ this->m_zmin = z ; }
virtual void split_position ( int &  v,
double &  s 
) [pure virtual, inherited]
int subdivide ( cell< C, V > *&  left,
cell< C, V > *&  right 
) [virtual, inherited]
virtual void subdivide ( cell< C, V > *&  left,
cell< C, V > *&  right,
int  v,
double  s 
) [pure virtual, inherited]
bounding_box< C, V > * unite ( bounding_box< C, V > *  other) [inherited]

Definition at line 330 of file bounding_box.hpp.

References mmx::shape::mmxmax(), mmx::shape::mmxmin(), and SELF.

Referenced by bounding_box< double, V >::operator+().

                        {
  SELF * cell = new SELF ;
  cell->set_xmin(mmxmin(this->xmin(), other->xmin())) ;
  cell->set_xmax(mmxmax(this->xmax(), other->xmax())) ;
  cell->set_ymin(mmxmin(this->ymin(), other->ymin())) ;
  cell->set_ymax(mmxmax(this->ymax(), other->ymax())) ;
  cell->set_zmin(mmxmin(this->zmin(), other->zmin())) ;
  cell->set_zmax(mmxmax(this->zmax(), other->zmax())) ;
  return cell ;
}
void united ( bounding_box< C, V > *  other) [inherited]

Definition at line 308 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

                         {
  set_xmin(mmxmin(this->xmin(), other->xmin())) ;
  set_xmax(mmxmax(this->xmax(), other->xmax())) ;
  set_ymin(mmxmin(this->ymin(), other->ymin())) ;
  set_ymax(mmxmax(this->ymax(), other->ymax())) ;
  set_zmin(mmxmin(this->zmin(), other->zmin())) ;
  set_zmax(mmxmax(this->zmax(), other->zmax())) ;
}
bool unites ( bounding_box< C, V > *  other,
bool  strict = true 
) [inherited]

Definition at line 268 of file bounding_box.hpp.

References mmx::shape::mmxmax(), and mmx::shape::mmxmin().

{
  if(this->is0D())
    return (this->xmin() == other->xmin()) ;
  else if(this->is1D()) {
    if(strict)
      return ((mmxmin(this->xmin(), other->xmin()) <  mmxmax(this->xmax(), other->xmax()))) ;
    else
      return ((mmxmin(this->xmin(), other->xmin()) <= mmxmax(this->xmax(), other->xmax()))) ;
  } else if(this->is2D()) {
    if(strict)
      return ((mmxmin(this->xmin(), other->xmin()) <  mmxmax(this->xmax(), other->xmax())) &&
              (mmxmin(this->ymin(), other->ymin()) <  mmxmax(this->ymax(), other->ymax()))) ;
    else
      return ((mmxmin(this->xmin(), other->xmin()) <= mmxmax(this->xmax(), other->xmax())) &&
              (mmxmin(this->ymin(), other->ymin()) <= mmxmax(this->ymax(), other->ymax()))) ;
  } else if(this->is3d()) {
    if(strict)
      return ((mmxmin(this->xmin(), other->xmin()) <  mmxmax(this->xmax(), other->xmax())) &&
                    (mmxmin(this->ymin(), other->ymin()) <  mmxmax(this->ymax(), other->ymax())) &&
              (mmxmin(this->zmin(), other->zmin()) <  mmxmax(this->zmax(), other->zmax()))) ;
    else
      return ((mmxmin(this->xmin(), other->xmin()) <= mmxmax(this->xmax(), other->xmax())) &&
              (mmxmin(this->ymin(), other->ymin()) <= mmxmax(this->ymax(), other->ymax())) &&
              (mmxmin(this->zmin(), other->zmin()) <= mmxmax(this->zmax(), other->zmax()))) ;
    }
  return false ;
}
double xmax ( void  ) const [inline, inherited]

Definition at line 63 of file bounding_box.hpp.

{ return m_xmax ; }
double xmin ( void  ) const [inline, inherited]

Definition at line 62 of file bounding_box.hpp.

{ return m_xmin ; }
double xsize ( void  ) const [inline, inherited]

Definition at line 69 of file bounding_box.hpp.

{ return m_xmax-m_xmin ; }
double ymax ( void  ) const [inline, inherited]

Definition at line 65 of file bounding_box.hpp.

{ return m_ymax ; }
double ymin ( void  ) const [inline, inherited]

Definition at line 64 of file bounding_box.hpp.

{ return m_ymin ; }
double ysize ( void  ) const [inline, inherited]

Definition at line 70 of file bounding_box.hpp.

{ return m_ymax-m_ymin ; }
double zmax ( void  ) const [inline, inherited]

Definition at line 67 of file bounding_box.hpp.

{ return m_zmax ; }
double zmin ( void  ) const [inline, inherited]

Definition at line 66 of file bounding_box.hpp.

{ return m_zmin ; }
double zsize ( void  ) const [inline, inherited]

Definition at line 71 of file bounding_box.hpp.

{ return m_zmax-m_zmin ; }

Member Data Documentation

Seq<Cell *> m_objects [protected]

Definition at line 54 of file cell_list.hpp.

Referenced by cell_list< C, V >::count().


The documentation for this class was generated from the following file: