cgma
WeightedOctree< X, C, E >::Cell Class Reference

#include <WeightedOctree.hpp>

List of all members.

Public Types

enum  {
  X_MIN = 0, Y_MIN = 0, Z_MIN = 0, X_MAX = 1,
  Y_MAX = 2, Z_MAX = 4
}

Public Member Functions

 Cell ()
bool removeNode (const X &node)
void addNode (const X &node)
bool leaf ()
void appendNodes (std::vector< X > &list)
const std::vector< X > & nodes () const
int nodeCount ()
void setWeight (int w)
void addWeight (int w)
int weight ()
void setCenter (double &x, double &y, double &z)
void setCenter (CubitVector &center)
CubitVectorcenter ()
void removeAllNodes ()
Cellchild (int quadrant)
void setChild (int quadrant, Cell *c)
void setParent (Cell *)
Cellparent ()
void appendAllNodes (std::vector< X > &list)

Protected Attributes

CellParent
CellChildren [8]
std::vector< XNodes
int TotalWeight
CubitVector Center
bool IsLeaf

Detailed Description

template<class X, class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
class WeightedOctree< X, C, E >::Cell

Definition at line 49 of file WeightedOctree.hpp.


Member Enumeration Documentation

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
anonymous enum
Enumerator:
X_MIN 
Y_MIN 
Z_MIN 
X_MAX 
Y_MAX 
Z_MAX 

Definition at line 83 of file WeightedOctree.hpp.

           {
        X_MIN = 0,
        Y_MIN = 0,
        Z_MIN = 0,
        X_MAX = 1,
        Y_MAX = 2,
        Z_MAX = 4
      };

Constructor & Destructor Documentation

template<class X , class C , class E >
WeightedOctree< X, C, E >::Cell::Cell ( )

Definition at line 562 of file WeightedOctree.cpp.

{
  this->TotalWeight=0;
  this->IsLeaf=true;


  this->Parent=NULL;
  for(int i=0;i<8;i++)
  {
    this->Children[i]=NULL;
  }
}

Member Function Documentation

template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::addNode ( const X node)

Definition at line 631 of file WeightedOctree.cpp.

{
  
  this->Nodes.push_back(node);
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::addWeight ( int  w)

Definition at line 648 of file WeightedOctree.cpp.

{
   this->TotalWeight+=w;
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::appendAllNodes ( std::vector< X > &  list)

Definition at line 590 of file WeightedOctree.cpp.

{
  if(this->Nodes.size())
  {
    appendNodes( list );
  }
 
  for( int i = 0; i < 8; i++ )
  {
    if(this->Children[i])
      this->Children[i]->appendAllNodes(list);
  }

}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::appendNodes ( std::vector< X > &  list)

Definition at line 611 of file WeightedOctree.cpp.

{
  list.insert(list.end(),this->Nodes.begin(),this->Nodes.end());
}
template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
CubitVector& WeightedOctree< X, C, E >::Cell::center ( ) [inline]

Definition at line 77 of file WeightedOctree.hpp.

{return Center;}
template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
Cell* WeightedOctree< X, C, E >::Cell::child ( int  quadrant) [inline]

Definition at line 97 of file WeightedOctree.hpp.

      {
        assert( quadrant >= 0 && quadrant < 8);
        return this->Children[quadrant];
      }
template<class X , class C , class E >
bool WeightedOctree< X, C, E >::Cell::leaf ( )

Definition at line 606 of file WeightedOctree.cpp.

{
 return !this->Children[0];
}
template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
int WeightedOctree< X, C, E >::Cell::nodeCount ( ) [inline]

Definition at line 69 of file WeightedOctree.hpp.

{ return Nodes.size(); }
template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
const std::vector<X>& WeightedOctree< X, C, E >::Cell::nodes ( ) const [inline]

Definition at line 64 of file WeightedOctree.hpp.

{ return Nodes; }
template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
Cell* WeightedOctree< X, C, E >::Cell::parent ( ) [inline]

Definition at line 110 of file WeightedOctree.hpp.

{return this->Parent;}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::removeAllNodes ( )

Definition at line 659 of file WeightedOctree.cpp.

{
  this->Nodes.clear();
  this->TotalWeight=0;
  
}
template<class X , class C , class E >
bool WeightedOctree< X, C, E >::Cell::removeNode ( const X node)

Definition at line 617 of file WeightedOctree.cpp.

{
  typename std::vector<X>::iterator iter;
  iter=std::remove(this->Nodes.begin(),this->Nodes.end(),node);
  if(iter!=this->Nodes.end())
  {
    //The nodes was found;
    this->Nodes.erase(iter,this->Nodes.end());
    return true;
  }

  return false;
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::setCenter ( double &  x,
double &  y,
double &  z 
)

Definition at line 667 of file WeightedOctree.cpp.

{
  this->Center.set(x,y,z);
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::setCenter ( CubitVector center)

Definition at line 654 of file WeightedOctree.cpp.

{
  this->Center=center;
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::setChild ( int  quadrant,
Cell c 
)

Definition at line 583 of file WeightedOctree.cpp.

{
  assert( quadrant >= 0 && quadrant < 8);
  this->Children[quadrant]=c;
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::setParent ( Cell parent)

Definition at line 576 of file WeightedOctree.cpp.

{
  this->Parent=parent;
}
template<class X , class C , class E >
void WeightedOctree< X, C, E >::Cell::setWeight ( int  w)

Definition at line 643 of file WeightedOctree.cpp.

{
   this->TotalWeight=w;
}
template<class X , class C , class E >
int WeightedOctree< X, C, E >::Cell::weight ( )

Definition at line 637 of file WeightedOctree.cpp.

  {
  return this->TotalWeight;
  }

Member Data Documentation

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
CubitVector WeightedOctree< X, C, E >::Cell::Center [protected]

Definition at line 124 of file WeightedOctree.hpp.

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
Cell* WeightedOctree< X, C, E >::Cell::Children[8] [protected]

Definition at line 120 of file WeightedOctree.hpp.

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
bool WeightedOctree< X, C, E >::Cell::IsLeaf [protected]

Definition at line 125 of file WeightedOctree.hpp.

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
std::vector<X> WeightedOctree< X, C, E >::Cell::Nodes [protected]

Definition at line 122 of file WeightedOctree.hpp.

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
Cell* WeightedOctree< X, C, E >::Cell::Parent [protected]

Definition at line 119 of file WeightedOctree.hpp.

template<class X , class C = DefaultOctreeCell, class E = DefaultWeightedNodeQuery<X>>
int WeightedOctree< X, C, E >::Cell::TotalWeight [protected]

Definition at line 123 of file WeightedOctree.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines