mesher2d< C, V > Class Template Reference

#include <mesher2d.hpp>

Inheritance diagram for mesher2d< C, V >:
arrangement2d< C, V > semialgebraic2d< C, V >

List of all members.

Public Types

Public Member Functions

Public Attributes

Protected Member Functions

Protected Attributes


Detailed Description

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

Definition at line 61 of file mesher2d.hpp.


Member Typedef Documentation

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 69 of file mesher2d.hpp.

typedef bcell<C,V> Cell

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 70 of file mesher2d.hpp.

typedef bcell2d<C, REF_OF(V) > Cell2d

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 71 of file mesher2d.hpp.

typedef curve< REF_OF(V) > Curve

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 72 of file mesher2d.hpp.

typedef topology<C,V>::Edge Edge

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 67 of file mesher2d.hpp.

typedef topology<C,V>::Face Face

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 68 of file mesher2d.hpp.

typedef kdtree<Cell*> Kdtree

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 75 of file mesher2d.hpp.

typedef node<Cell*> Node

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 74 of file mesher2d.hpp.

typedef tpl3d<C,V> Output

Definition at line 73 of file mesher2d.hpp.

typedef topology<C,V>::Point Point

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 66 of file mesher2d.hpp.

typedef topology<C,V> Topology

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 65 of file mesher2d.hpp.


Constructor & Destructor Documentation

mesher2d ( void   )  [inline]

Definition at line 158 of file mesher2d.hpp.

00158                    : m_smooth(0.1), m_prec(0.01) {
00159     m_tree = new Kdtree ;
00160     m_input_bbx = BoundingBox(0, 1, 0, 1);
00161     m_output = new Output;
00162 }

~mesher2d ( void   )  [inline, virtual]

Definition at line 165 of file mesher2d.hpp.

00165                     {
00166     delete m_tree ;
00167 }


Member Function Documentation

void add_input ( Shape s  )  [inline]

Definition at line 177 of file mesher2d.hpp.

References Seq< C, R >::push_back().

00177                               {
00178     this->m_input_objects.push_back(object);
00179 }

bcell< C, V > * get_input_cell (  )  [inline]

Definition at line 183 of file mesher2d.hpp.

References Seq< C, R >::size().

Referenced by mesher2d< C, V >::run().

00183                      {
00184     if(this->m_input_objects.size() == 1)
00185         return Cell2dFactory::instance()->create(this->m_input_objects[0],this->m_input_bbx);
00186     else
00187         return Cell2dFactory::instance()->create(this->m_input_objects,this->m_input_bbx);
00188 }

Output* get_output ( void   )  [inline]
double get_precision ( void   )  [inline]

Definition at line 86 of file mesher2d.hpp.

Referenced by mesher2d< C, V >::run().

00086 { return m_prec;   }

double get_smoothness ( void   )  [inline]

Definition at line 85 of file mesher2d.hpp.

Referenced by mesher2d< C, V >::run().

00085 { return m_smooth; }

bool insert_regular ( Cell bcell  )  [inline, protected]

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 294 of file mesher2d.hpp.

References mesher2d< C, V >::get_output(), and bcell< C, V >::insert_regular().

00294                               {
00295     return cl->insert_regular(this->get_output());
00296 }

bool insert_singular ( Cell bcell  )  [inline, protected]

Definition at line 299 of file mesher2d.hpp.

References mesher2d< C, V >::get_output(), and bcell< C, V >::insert_singular().

00299                                {
00300     return cl->insert_singular(this->get_output()) ;
00301 }

void insert_singular ( Point p  )  [inline, virtual]

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 304 of file mesher2d.hpp.

References mesher2d< C, V >::m_specials.

Referenced by mesher2d< C, V >::run().

00304                                {
00305     m_specials<<p;
00306 }

bool is_regular ( Cell bcell  )  [inline, protected]

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 289 of file mesher2d.hpp.

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

Referenced by mesher2d< C, V >::run().

00289                           {
00290     return cl->is_regular();
00291 }

void run ( void   )  [inline]

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 190 of file mesher2d.hpp.

References mesher2d< C, V >::b_leaves, Seq< C, R >::clear(), Graph< T >::dfs(), bcell2d< C, V >::e_neighbors, node< _CELL >::get_cell(), mesher2d< C, V >::get_input_cell(), mesher2d< C, V >::get_output(), mesher2d< C, V >::get_precision(), mesher2d< C, V >::get_smoothness(), tpl3d< C, V >::insert_regular(), mesher2d< C, V >::insert_singular(), cell< C, V >::is_active(), bcell2d< C, V >::is_border(), mesher2d< C, V >::is_regular(), bcell2d< C, V >::m_gnode, mesher2d< C, V >::m_leaves, mesher2d< C, V >::m_nodes, Seq< C, R >::member(), bcell2d< C, V >::n_neighbors, Graph< T >::push_edge(), Graph< T >::push_vertex(), kdtree< CELL >::root(), bcell2d< C, V >::s_neighbors, node< _CELL >::set_cell(), Seq< C, R >::size(), bounding_box< C, V >::size(), mesher2d< C, V >::subdivide(), and bcell2d< C, V >::w_neighbors.

00190           {
00191 
00192     Node* root = m_tree->root() ;
00193 
00194     //std::cout<<"Running, objs="<<this->m_input_objects.size() << std::endl;
00195 
00196     Cell* cl = this->get_input_cell();
00197     //  Cell2dFactory::instance()->create(this->m_objects,this->m_bbx);
00198 
00199     root->set_cell( (Cell*)cl ) ;
00200     this->m_nodes.push_back(root) ;
00201 
00202     //std::cout<<"RUNing "<< cl <<std::endl;
00203 
00204     // double maxsz = this->m_maxprec*m_tree->root()->get_cell()->size();
00205     // double minsz = this->m_minprec*m_tree->root()->get_cell()->size();
00206     double maxsz = this->get_smoothness();
00207     double minsz = this->get_precision();
00208 
00209     while(!m_nodes.empty()  ) {   //
00210         Node * node = m_nodes.front() ;
00211         Cell   * cl = node->get_cell() ;
00212         Cell2d * cl2= dynamic_cast<Cell2d*>(cl);
00213 
00214         //std::cout<<"node "<<cl->size()<<std::endl;
00215 
00216         if(cl->is_active()) {
00217 
00218             //std::cout<<"active.. "<<std::endl;
00219 
00220             if(cl->size() > maxsz)
00221             {
00222                 //std::cout<<"subdivide "<<cl->size()<<std::endl;
00223                 this->subdivide(cl, node) ;
00224             }
00225             else if(this->is_regular(cl) )// && cl->is_intersected())
00226             {
00227                 //std::cout<<"ins regular "<<std::endl;
00228                 this->get_output()->insert_regular(cl) ;
00229                 //std::cout<<"ok "<<std::endl;
00230                 cl2->m_gnode=
00231                         this->m_leaves.push_vertex(cl2);
00232                 if (  cl2->is_border() )
00233                     this->b_leaves.push_vertex(cl2);
00234             }
00235             else if(cl->size() > minsz)
00236             {
00237                 //std::cout<<"subdivide "<<cl->size()<<std::endl;
00238                 this->subdivide(cl, node) ;
00239             }
00240             else
00241             {
00242                 this->insert_singular(cl) ;
00243                 cl2->m_gnode=
00244                         this->m_leaves.push_vertex(cl2);
00245                 if (  cl2->is_border() )
00246                     this->b_leaves.push_vertex(cl2);
00247             }
00248         }
00249         else    //inactive leaf -- end if
00250         {
00251             // cl2->m_gnode=
00252             // this->m_leaves.push_vertex(cl2);
00253             if (  cl2->is_border() )
00254                 this->b_leaves.push_vertex(cl2);
00255         }
00256         this->m_nodes.pop_front() ;
00257     }
00258 
00259     /* add edges */
00260     Seq<Cell2d*> nlist;
00261 
00262     //std::cout<<"border " << std::endl;
00263     // Border graph
00264     this->b_leaves.dfs(nlist);
00265     foreach(Cell2d* cl2, nlist)
00266     {
00267         if (cl2->s_neighbors.size()==0)
00268             foreach(Cell2d* nb, cl2->e_neighbors )
00269                 if (nlist.member(nb) && nb->s_neighbors.size()==0)
00270                     this->b_leaves.push_edge( cl2,nb ) ;
00271         if (cl2->e_neighbors.size()==0)
00272             foreach(Cell2d* nb, cl2->n_neighbors )
00273                 if (nlist.member(nb) && nb->e_neighbors.size()==0)
00274                     this->b_leaves.push_edge( cl2,nb ) ;
00275         if (cl2->n_neighbors.size()==0)
00276             foreach(Cell2d* nb, cl2->w_neighbors )
00277                 if (nlist.member(nb)&& nb->n_neighbors.size()==0)
00278                     this->b_leaves.push_edge( cl2,nb ) ;
00279         if (cl2->w_neighbors.size()==0)
00280             foreach(Cell2d* nb, cl2->s_neighbors )
00281                 if (nlist.member(nb)&& nb->w_neighbors.size()==0)
00282                     this->b_leaves.push_edge( cl2,nb ) ;
00283     }
00284     nlist.clear();
00285 }

void set_input_bbox ( const BoundingBox bx  )  [inline]

Definition at line 170 of file mesher2d.hpp.

References bounding_box< C, V >::set_zmax(), and bounding_box< C, V >::set_zmin().

00170                                            {
00171     m_input_bbx=box;
00172     m_input_bbx.set_zmin(0);
00173     m_input_bbx.set_zmax(0);
00174 }

void set_precision ( double  e  )  [inline]

Definition at line 83 of file mesher2d.hpp.

00083 { m_prec   = e; }

void set_smoothness ( double  e  )  [inline]

Definition at line 82 of file mesher2d.hpp.

00082 { m_smooth = e; }

typedef SHAPE_OF (  ) 
bool subdivide ( Cell bcell,
Node node 
) [inline, protected]

Reimplemented in arrangement2d< C, V >, and semialgebraic2d< C, V >.

Definition at line 309 of file mesher2d.hpp.

References node< _CELL >::LEFT, mmx::ssi::left(), node< _CELL >::m_left, mesher2d< C, V >::m_nodes, node< _CELL >::m_right, node< _CELL >::RIGHT, mmx::ssi::right(), and bcell< C, V >::subdivide().

Referenced by mesher2d< C, V >::run().

00309                                       {
00310     int v=0;
00311 
00312     Cell* left, * right;
00313     v = cl->subdivide(left, right) ;
00314 
00315     node->m_left  = new Node(node, left,  Node::LEFT,  v);
00316     m_nodes << node->m_left ;
00317     node->m_right = new Node(node, right, Node::RIGHT, v);
00318     m_nodes << node->m_right;
00319 
00320     return true ;
00321 }


Member Data Documentation

Definition at line 128 of file mesher2d.hpp.

std::list<Node *> m_nodes [protected]

Definition at line 110 of file mesher2d.hpp.

Referenced by mesher2d< C, V >::run(), and mesher2d< C, V >::subdivide().


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

Generated on 6 Dec 2012 for shape by  doxygen 1.6.1