MeshKit  1.0
IAVariable.hpp
Go to the documentation of this file.
00001 // IAVariable.hpp Meshkit Version
00002 // Data object shared between Meshkit and Interval Assignment
00003 
00004 #ifndef MESHKIT_IA_VARIABLE_HP
00005 #define MESHKIT_IA_VARIABLE_HP
00006 
00007 #include <cstring>
00008 #include <vector>
00009 
00010 #include "meshkit/Types.hpp" // for Firmness
00011 
00012 namespace MeshKit 
00013 {
00014 
00015 class ModelEnt;
00016 
00025 class IAVariable
00026 {
00027 public:
00028   
00035   void set_model_ent(ModelEnt* me) {modelEnt = me;}
00036   ModelEnt *get_model_ent() const {return modelEnt;}
00037   
00040   // enum Firmness {DEFAULT, SOFT, HARD}; //defined already in Types.hpp
00041   typedef MeshKit::Firmness Firmness;
00042   
00043   void set_firmness(Firmness set_firm) { firmness = set_firm; }
00044   Firmness get_firmness() const {return firmness;}
00045   void set_hard() {firmness = HARD;}
00046   void set_soft() {firmness = SOFT;}
00047   void unset()    {firmness = DEFAULT;} 
00048   bool is_soft() const  {return firmness == SOFT;}
00049   bool is_hard() const  {return firmness == HARD;} 
00050   bool is_default() const {return firmness == DEFAULT;}
00051   
00055   void set_goal(double goal_value) {goal=goal_value;}
00056   double get_goal() const {return goal;}
00057   
00066   int get_solution() const {return solution;}
00067   
00071   //void IAVariable();
00072   IAVariable(ModelEnt *model_entity = NULL, Firmness set_firmness = SOFT, double goal_value = 0. );
00073   
00074 private:
00078   Firmness firmness;
00081   double goal; 
00084   int solution; 
00087   ModelEnt *modelEnt;
00092   static unsigned int numVariables;
00093   unsigned int uniqueId;
00094   friend class IAInterface;
00095 };
00096 
00097 inline
00098 IAVariable::IAVariable(ModelEnt *model_entity, Firmness set_firmness, double goal_value )
00099   : firmness(set_firmness), goal(goal_value), solution(0), modelEnt(model_entity), uniqueId(numVariables++)
00100 {}
00101 
00102 } // namespace MeshKit
00103 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines