MeshKit  1.0
AF2Algorithm.hpp
Go to the documentation of this file.
00001 /*
00002  * AF2Algorithm.hpp
00003  *
00004  * \brief An AF2Algorithm provides the capability to execute
00005  * a two-dimensional advancing front algorithm.
00006  *
00007  * An AF2Algorithm is an object that executes a two-dimensional advancing
00008  * front algorithm.  It is constructed with a list of rules.  When the
00009  * execute method is called, AF2Algorithm enters a loop attempting to
00010  * advance the front until the front is empty, which means the algorithm
00011  * has completed successfully, or failure termination criteria have
00012  * been satisfied.  In the loop, the algorithm selects a baseline edge
00013  * on the current advancing front.  The neighborhood surrounding that
00014  * edge is transformed to a two-dimensional coordinate space, and
00015  * the algorithm attempts to apply each of the rules to that baseline
00016  * edge in the two-dimensional coordinate space.  If a rule can be
00017  * applied, the best rule is chosen and the front is advanced.  If no
00018  * rule can be applied, the baseline edge has its quality decreased
00019  * so that the next time, if any, that the same baseline edge is chosen,
00020  * there will be more flexibility in what constitutes a successful
00021  * application of a rule.
00022  *
00023  * The execute method returns an AF2Algorithm result that is either
00024  * successful or unsuccessful.  If it is successful, it contains lists
00025  * of all points and faces that are part of the result mesh.
00026  */
00027 #ifndef AF2ALGORITHM_HPP
00028 #define AF2ALGORITHM_HPP
00029 
00030 // C++
00031 #include <list>
00032 #include <map>
00033 
00034 // MOAB
00035 #include "moab/Types.hpp"
00036 
00037 // MeshKit
00038 #include "meshkit/AF2AlgorithmResult.hpp"
00039 #include "meshkit/AF2LocalTransformMaker.hpp"
00040 #include "meshkit/AF2Front.hpp"
00041 #include "meshkit/AF2Neighborhood.hpp"
00042 #include "meshkit/AF2Point2D.hpp"
00043 #include "meshkit/AF2Point3D.hpp"
00044 #include "meshkit/AF2Polygon2D.hpp"
00045 #include "meshkit/AF2Polygon3D.hpp"
00046 #include "meshkit/AF2Rule.hpp"
00047 
00048 class AF2Algorithm
00049 {
00050   private:
00051 
00052     const std::list<const AF2Rule*> ruleList;
00053 
00057     void initFront(AF2Front & front, std::list<AF2Point3D*> & pntList,
00058         unsigned long & pntId,
00059         const double* coords, unsigned int numPoints,
00060         const unsigned int* edges, unsigned int numEdges,
00061         const moab::EntityHandle* vertexHandles) const;
00062 
00066     void processNewFace(const AF2Polygon2D* newFace2D,
00067         AF2Neighborhood* & ngbhd,
00068         std::map<const AF2Point2D*, AF2Point3D*> & newPointsMap,
00069         std::list<const AF2Polygon3D*> & allFaces, AF2Front & front) const;
00070 
00074     void processNewPoint(const AF2Point2D* newPoint2D,
00075         unsigned long & pntId, AF2Neighborhood* & ngbhd,
00076         std::map<const AF2Point2D*, AF2Point3D*> & newPointsMap,
00077         std::list<AF2Point3D*> & allPoints, AF2Front & front) const;
00078 
00082     void release(std::list<AF2Point3D*> & allPoints,
00083         std::list<const AF2Polygon3D*> & allFaces) const;
00084 
00089     void output_intermediate_result (std::list<AF2Point3D*> & allPoints,
00090             std::list<const AF2Polygon3D*> & allFaces,int face,  int step) const;
00091 
00092   public:
00093 
00108     AF2Algorithm(const std::list<const AF2Rule*> & ruleListArg);
00109 
00113     ~AF2Algorithm();
00114 
00121     AF2Algorithm(const AF2Algorithm & toCopy);
00122 
00129     AF2Algorithm& operator=(const AF2Algorithm & rhs);
00130 
00194     AF2AlgorithmResult* execute(
00195         const AF2LocalTransformMaker* const & transformMaker,
00196         const double* coords, unsigned int numPoints,
00197         const unsigned int* edges, unsigned int numEdges,
00198         const moab::EntityHandle* vertexHandles = NULL, int debug = 0) const;
00199 };
00200 
00201 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines