MeshKit  1.0
AF2Front.hpp
Go to the documentation of this file.
00001 /*
00002  * AF2Front.hpp
00003  *
00004  * An AF2Front is an object that manages the front for a two-dimensional
00005  * advancing front algorithm.  It tracks which points and which half edges
00006  * are on the front.
00007  *
00008  * The main functions of an AF2Front are to initialize the front, to update
00009  * the front when a face is ready to be added, and to select a portion
00010  * of the front -- a neighborhood -- in which the algorithm should attempt
00011  * to advance the front.  The first two functions are accomplished by
00012  * the addPoint and advanceFront methods.  The third function is
00013  * implemented in the selectNeighborhood method.
00014  *
00015  * The AF2Front provides a method to check whether the front is emtpy,
00016  * which would indicate that the algorithm has completed if the front has
00017  * been in use.  It also tracks the quality of the edges that are on
00018  * the front and provides a convenient method to determine the quality
00019  * level of the highest quality edge that is on the front.
00020  */
00021 
00022 #ifndef AF2FRONT_HPP
00023 #define AF2FRONT_HPP
00024 
00025 // C++
00026 #include <list>
00027 #include <map>
00028 #include <set>
00029 #include <vector>
00030 
00031 // MeshKit
00032 #include "meshkit/AF2Edge3D.hpp"
00033 #include "meshkit/AF2LocalTransformMaker.hpp"
00034 #include "meshkit/AF2Neighborhood.hpp"
00035 #include "meshkit/AF2Point3D.hpp"
00036 
00043 struct EndPointLess {
00047   bool operator()(const AF2Edge3D* const & oneEdge,
00048       const AF2Edge3D* const & otherEdge) const;
00049 };
00050 
00051 class AF2Front : QualityDecreaseObserver
00052 {
00053   friend void AF2Edge3D::decreaseQuality();
00054 
00055   private:
00056 
00057     // a map from the points on the front to a count of the
00058     // number of front half edges that are incident to the point
00059     std::map<AF2Point3D*, int> points;
00060     // a set of half edges that are on the front
00061     std::set<AF2Edge3D*, EndPointLess> edges;
00062     // a vector tracking how many edges of each quality level are
00063     // currently on the front
00064     std::vector<unsigned int> qualityCount;
00065 
00072     void qualityDecreased(const AF2Edge3D* const & anEdge);
00073 
00074   public:
00075 
00079     AF2Front();
00080 
00087     virtual ~AF2Front();
00088 
00095     AF2Front(const AF2Front & toCopy);
00096 
00103     AF2Front& operator=(const AF2Front & rhs);
00104 
00121     void addPoint(AF2Point3D* pointPtr);
00122 
00164     void advanceFront(std::list<AF2Edge3D*> edgeList);
00165 
00174     bool isEmpty() const;
00175 
00185     unsigned int getMaximumQuality() const;
00186 
00204     AF2Neighborhood* selectNeighborhood(
00205         const AF2LocalTransformMaker* const & transformMaker) const;
00206 };
00207 
00208 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines