UltraScan III
us_dmga_constr.h
Go to the documentation of this file.
1 #ifndef US_DMGA_CONSTRAINTS_H
3 #define US_DMGA_CONSTRAINTS_H
4 
5 #include "us_extern.h"
6 #include "us_model.h"
7 
8 #ifndef DbgLv
9 #define DbgLv(a) if(dbg_level>=a)qDebug()
10 #endif
11 
19 {
20 
21  public:
22 
25  {
35  ATYPE_KOFF
36  };
37 
40  {
41  public:
43  int mcompx;
44  double low;
45  double high;
46  bool floats;
47  bool logscl;
48  };
49 
51  US_dmGA_Constraints( US_Model* = NULL );
52 
55 
58  void load_base_model ( US_Model* );
59 
62  void load_constraints( US_Model* );
63 
66  void load_constraints( QVector< Constraint >& );
67 
71  int update_constraints( QVector< Constraint >& );
72 
74  void init_constraints( void );
75 
84  int add_constraint( AttribType, int, double, double,
85  bool, bool );
86 
90  bool get_base_model ( US_Model* );
91 
95  bool get_constr_model( US_Model* );
96 
100  bool get_work_model ( US_Model* );
101 
107  int comp_constraints( int, QVector< Constraint >* cnsvP, int* );
108 
114  int assoc_constraints( int, QVector< Constraint >* cnsvP, int* );
115 
119  int float_constraints( QVector< Constraint >* cnsvP );
120 
125  double fetch_attrib( US_Model::SimulationComponent&, const AttribType );
126 
131  double fetch_attrib( US_Model::Association&, const AttribType );
132 
137  void store_attrib( US_Model::SimulationComponent&, const AttribType, const double );
138 
143  void store_attrib( US_Model::Association&, const AttribType, const double );
144 
145  private:
146  US_Model bmodel; // Base model
147  US_Model cmodel; // Constraints model
148  US_Model wmodel; // Work model
149 
150  QVector< Constraint > attribs; // Attribute-defines vector
151 
152  AttribType x_attr; // X model component attribute used
153  AttribType y_attr; // Y model component attribute used
154  AttribType z_attr; // Z (fixed?) model component attribute used
155 
156  int nfloat; // Number of total floats
157  int nbcomp; // Number of base model components
158  int nccomp; // Number of constraints components
159  int nbassoc; // Number of base model associations
160  int ncassoc; // Number of constraints associations
161  int nfvari; // Number of float variations
163 
164  double xfinc; // Change-float increment (1.0/nfcomb)
165 
166  private slots:
167  void constraints_from_model( void ); // Build constraints from model
168  void constraints_from_base ( void ); // Build constraints from base
169  void model_from_constraints( void ); // Build model from constraints
170  bool base_from_cmodel ( void ); // Build base from c. model
171  int count_comp_constraints( int, int*, int* ); // Count comp. constraints
172  int count_asso_constraints( int, int*, int* ); // Count assoc. constraints
173  bool init_work_model ( void ); // Build initial work model
174 };
175 
176 #endif