MeshKit
1.0
|
00001 // IAVariable.hpp stubbed 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 // stubbed #include "meshkit/Types.hpp" // for Firmness 00011 00012 namespace MeshKit 00013 { 00014 00015 enum Firmness {DEFAULT, SOFT, HARD}; // stubbed 00016 00017 class IAVariable; // forward declare for stubbed ModelEnt 00018 class ModelEnt // stubbed ; 00019 { 00020 public: 00021 static int max_stub_id; 00022 int stub_id; 00023 00024 IAVariable *iaVar; 00025 IAVariable *ia_var() const {return iaVar;} 00026 void ia_var(IAVariable *v) {iaVar = v;} 00027 00028 double meshIntervalSize; 00029 double mesh_interval_size() const {return meshIntervalSize;} 00030 00031 double entMeasure; 00032 double measure() const {return entMeasure;} 00033 00034 int meshIntervals; 00035 void mesh_intervals( const int set_mesh_int ) { meshIntervals = set_mesh_int; } 00036 00037 Firmness entFirmness; 00038 Firmness interval_firmness() const {return entFirmness;} 00039 00040 ModelEnt() : stub_id(max_stub_id++), iaVar(NULL), 00041 meshIntervalSize(1.), entMeasure(1.), meshIntervals(1), entFirmness(SOFT) {} 00042 }; 00043 typedef std::vector<ModelEnt*> MEntVector; 00044 00053 class IAVariable 00054 { 00055 public: 00056 00063 void set_model_ent(ModelEnt* me) {modelEnt = me;} 00064 ModelEnt *get_model_ent() const {return modelEnt;} 00065 00068 // enum Firmness {DEFAULT, SOFT, HARD}; //defined already in Types.hpp 00069 typedef MeshKit::Firmness Firmness; 00070 00071 void set_firmness(Firmness set_firm) { firmness = set_firm; } 00072 Firmness get_firmness() const {return firmness;} 00073 void set_hard() {firmness = HARD;} 00074 void set_soft() {firmness = SOFT;} 00075 void unset() {firmness = DEFAULT;} 00076 bool is_soft() const {return firmness == SOFT;} 00077 bool is_hard() const {return firmness == HARD;} 00078 bool is_default() const {return firmness == DEFAULT;} 00079 00083 void set_goal(double goal_value) {goal=goal_value;} 00084 double get_goal() const {return goal;} 00085 00094 int get_solution() const {return solution;} 00095 00099 //void IAVariable(); 00100 IAVariable(ModelEnt *model_entity = NULL, Firmness set_firmness = SOFT, double goal_value = 0. ); 00101 00102 private: 00106 Firmness firmness; 00109 double goal; 00112 int solution; 00115 ModelEnt *modelEnt; 00120 static unsigned int numVariables; 00121 unsigned int uniqueId; 00122 friend class IAInterface; 00123 }; 00124 00125 inline 00126 IAVariable::IAVariable(ModelEnt *model_entity, Firmness set_firmness, double goal_value ) 00127 : firmness(set_firmness), goal(goal_value), solution(0), modelEnt(model_entity), uniqueId(numVariables++) 00128 {} 00129 00130 } // namespace MeshKit 00131 #endif