MeshKit  1.0
AF2DfltRuleAppVisitor.hpp
Go to the documentation of this file.
00001 /*
00002  * AF2DfltRuleAppVisitor.hpp
00003  *
00004  * An AF2DfltRuleAppVisitor is a default implementation of an
00005  * AF2RuleAppVisitor appropriate to rules that produce triangular faces.
00006  * It stores at most one rule application, which is whichever rule
00007  * application it judges to be best among the rule applications it
00008  * has visited.
00009  *
00010  * Since AF2DfltRuleAppVisitor stores the best result and does not
00011  * provide a method to reset or clear what it has judged to be best,
00012  * it should be used to assess rule applications for at most one neighborhood.
00013  *
00014  * The evaluation of best is based on metrics measuring the new faces
00015  * that the rule application would introduce.  The evaluation favors
00016  * elements that are round, having an area to perimeter ratio similar
00017  * to that of an equilateral triangle and having edges that are not
00018  * too much longer or shorter than unit length.  When multiple faces
00019  * are introduced by a rule, the metric for the first face is taken
00020  * as the metric for the full rule application.
00021  */
00022 
00023 #ifndef AF2DFLTRULEAPPVISITOR_HPP
00024 #define AF2DFLTRULEAPPVISITOR_HPP
00025 
00026 // C++
00027 #include <cmath>
00028 
00029 // MeshKit
00030 #include "meshkit/AF2RuleAppVisitor.hpp"
00031 
00032 class AF2DfltRuleAppVisitor : public AF2RuleAppVisitor
00033 {
00034   private:
00035 
00036     static const double eqTriAreaPerimSqRatio;
00037     double bestMetricVal;
00038     AF2RuleApplication* bestRuleApp;
00039 
00040   public:
00041 
00045     AF2DfltRuleAppVisitor();
00046 
00050     ~AF2DfltRuleAppVisitor();
00051 
00055     AF2DfltRuleAppVisitor(const AF2DfltRuleAppVisitor & toCopy);
00056 
00060     AF2DfltRuleAppVisitor& operator=(const AF2DfltRuleAppVisitor & rhs);
00061 
00073     const AF2RuleApplication* getBestRuleApplication() const;
00074 
00085     void visit(AF2RuleApplication const & ruleApp);
00086 };
00087 
00088 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines