backup_controls.h

Go to the documentation of this file.
00001 #ifndef CONTROLS_H
00002 #define CONTROLS_H
00003 
00004 class MyControls
00005 {
00006 private:
00007   static MyControls * only_one;
00008 //  Controls                (void);
00009 //  Controls                (Controls const &);
00010 //  Controls & operator =   (Controls const &);
00011 //  ~Controls               (void);
00012 public:
00013 //  static  Controls & instance (void);
00014 #if 0
00015   // octree parameters
00016   static const int MAX_ITEMS_PER_LEAF = 12;
00017   static const int MAX_OCTREE_DEPTH   = 12;
00018   static const double MIN_CELL_SIZE   = 32.0;
00019 
00020   // set to true to write initialization information
00021   //            for each file to stdout, i.e. verbose setting
00022   // set to false for concise initialization informatin, i.e. concise setting
00023   static const bool WRITE_VERBOSE_INIT = false;
00024 
00025   // set to true to write punished vertices to
00026   //            file specified by PUNISHED_FILE
00027   static const bool WRITE_PUNISHED_VERTICES_TO_FILE = true;
00028 
00029   // set to true to write intersected faces to
00030   //            file specified by INTERSECTED_FILE
00031   static const bool WRITE_INTERSECTED_FACES_TO_FILE = true;
00032 
00033   // choice of output format for intersected faces
00034   //    cp = dreamm custom points format
00035   //    detail = face name and index + vertex details(3X)
00036   // choose one
00037   //static const std::string FORMAT_INTERSECTED_FACES("cp");
00038   static const char FORMAT_INTERSECTED_FACES[];
00039 
00040   // set to true to write nonnice vertices to
00041   //            file specified by NONNICE_FILE
00042   static const bool WRITE_NONNICE_VERTICES_TO_FILE = true;
00043 
00044   // choice of output format for nonnice vertices
00045   //    cp = dreamm custom points format
00046   //    detail = vertex name,index,x,y,z
00047   // choose one
00048   //static const std::string FORMAT_NONNICE_VERTICES("cp");
00049   static const char FORMAT_NONNICE_VERTICES[];
00050 
00051   // set to true to write neighborhood to 
00052   //            file specified by NEIGHBORHOOD_FILE
00053   static const bool WRITE_NEIGHBORHOOD_TO_FILE = false;
00054 
00055   // set to true to write closest point distance
00056   //            to .dat files after every iteration
00057   // set to false to only write distances to .dat
00058   //            file after the last iteration has finished
00059   static const bool WRITE_DISTANCES_EVERY_ITERATION = true;
00060 
00061   // set to true to write meshes to .mesh files after every iteration
00062   // set to false to only write meshes to .mesh
00063   //            file after the last iteration has finished
00064   static const bool WRITE_MESH_EVERY_ITERATION = true;
00065 
00066   // set to true to write vertex move histogram to file after each group
00067   // set to false to do nothing
00068   static const bool WRITE_VERTEX_MOVE_HISTOGRAM = false;
00069 
00070   // set to true to use iteration number in mesh filename
00071   // set to false to use a generic mesh filename and write over existing mesh files
00072   // e.g. if true, then use 'filename_OUTPUT_SUFFIX_1.mesh'
00073   //            else if false, then use 'filename_OUTPUT_SUFFIX.mesh'
00074   // see below for OUTPUT_SUFFIX details
00075   static const bool APPEND_ITERATION_NUMBER_TO_MESH = false;
00076 
00077   // set to true to use iteration number in closest point distances filename
00078   // set to false to use a generic dat filename and write over existing dat file
00079   // e.g. if true, then use 'filename_1.dat'
00080   //            else if false, then use 'filename.dat'
00081   static const bool APPEND_ITERATION_NUMBER_TO_DISTANCES = false;
00082 
00083   // set to true to prevent any new intersections of faces
00084   // set to false to allow new intersecting faces
00085   //    (useful when faces exist with all three vertices nonnice)
00086   static const bool STRICT_FACE_INTERSECTION_PREVENTION = true;
00087 
00088   // set to true to check for complete separation of all faces
00089   // i.e. if Container::ti==0, then set STRICT_FACE_INTERSECTION_PREVENTION=true;
00090 
00091   static const bool DETECT_COMPLETE_SEPARATION = true;
00092 
00093   // set to true to move nonnice vertices
00094   // and intersected face vertices first
00095   // regardless of their virutal displacement ranking
00096   // set to false to strictly follow virtual displacement
00097   // ranking , i.e. topN map
00098   static const bool MOVE_NONNICE_AND_INTERSECTED_FIRST = false;
00099 
00100   // defines the ratio between nanometers and the units of the input data
00101   // e.g. in input is in microns, then set SCALE= 1.0/1000.0
00102   static const double SCALE = 1.0/1.0;  // nm/inpu
00103 
00104   // if moving a vertex creates an edge angle
00105   // less than EDGE_ANGLE_THRESHOLD,
00106   // then vertex is not moved
00107   static const double EDGE_ANGLE_THRESHOLD = 0.017456; //radians (1 degree)
00108   //static const double EDGE_ANGLE_THRESHOLD     0.17453 //radians == 10 degrees
00109   //static const double EDGE_ANGLE_THRESHOLD     0.52360 //radians == 30 degrees
00110 
00111   // for use with "is float close to zero?" 
00112   // in conditional statement
00113   static const double MY_DOUBLE_EPSILON = 1E-10;
00114   static const double EPSILON = 1E-7;
00115 
00116   // subdivide space into cubes with sides of SPACE_LENGTH in size
00117   static const double SPACE_LENGTH = 20; // nm
00118 
00119   // When searching for closest surface point to a given vertex,
00120   // the subdivided space box of given vertex will be searched,
00121   // as well as, all boxes within NUM_ADJACENT_BOXES away from 
00122   // given vertex box. If NUM_ADJACENT_BOXES is zero, then only
00123   // the given vertex box will be searched. If NUM_ADJACENT_BOXES
00124   // is one, then all adjacent boxes to given vertex box will also be searched.
00125   //
00126   // choose such that NUM_ADJACENT_BOXES >= SEARCH_RADIUS/SPACE_LENGTH
00127   static const int NUM_ADJACENT_BOXES = 8;
00128 
00129   // set of vertices to move consists of seed vertex
00130   // and vertices of all faces in boxes intersected by
00131   // cube centered on seed vertex with side length 
00132   // equal to 2*SEED_ADJACENT_BOXES*SPACE_LENGTH
00133   static const int SEED_ADJACENT_BOXES = 1;
00134 
00135   // If a candidate closest point is more than SEARCH_RADIUS 
00136   // distance away from given vertex, then the candidate closest 
00137   // point is not chosen as closest point to given vertex.
00138   // PICK SEARCH_RADIUS < NEIGHBORHOOD_RADIUS else closest point
00139   // will be be just outside neighborhood on same object if no
00140   // other point is found.
00141   static const int NUMBER_RADIUS_STEPS = 1; // must be greater than zero
00142   static const double MIN_SEARCH_CONE_RADIUS = 60.0; //nm
00143   static const double SEARCH_RADIUS_SQ = 16900.0; // 130 nm * 130 nm
00144 
00145   // For a given vertex, faces containing vertices within
00146   // the neighborhood of the given vertex are eliminated from
00147   // the search pool for closest point for the given vertex.
00148   // The neighborhood is the collection of all vertices
00149   // on the same object as the given vertex that lie within
00150   // N edges of the given vertex, where N is a function of
00151   // NEIGHBORHOOD_RADIUS and mean edge length for that object.
00152   static const double NEIGHBORHOOD_RADIUS_SQ = 16900.0; // 130 nm * 130 nm
00153 
00154   //  equivalent to a 30 degree sweep around normal
00155   //  i.e. a 60 degree window around normal
00156   static const double CLOSEST_POINT_COSINE = 0.8660;
00157   static const double CLOSEST_POINT_SINE = 0.50;
00158 
00159   // if USE_EDGE_REFERENCE_LENGTH == true
00160   // then compare edge lengths to instantaneous 
00161   // mean edge length of adjacent faces to edge
00162   // else use original length of each edge
00163   static const bool USE_EDGE_REFERENCE_LENGTH = true;
00164 
00165   // NOTE!! If USE_EDGE_REFERENCE_LENGTH==false
00166   // need to implemenet aspect_ratio detection
00167   // using the constants defined below
00168   // whereby edges associated with adjacent faces
00169   // with aspect ratios greater than ASPECT_RATIO_THRESHOLD
00170   // will experience a force to improve the aspect_ratio
00171   // proportional to ASPECT_GAIN
00172   static const double ASPECT_RATIO_THRESHOLD = 3.0;
00173   static const double ASPECT_GAIN = 3;
00174 
00175   // Force Function Weights
00176   // Weights are normalized during the force calculation,
00177   // so all that matters is the ratio of the four weights.
00178   // NOTE THESE MUST SUM TO 100!!!!!!!!!!!!!!!
00179   static const double INTERSECTION_WEIGHT  =  0.1/100.0;  // nN
00180   static const double EDGE_STRETCH_WEIGHT  =  9.9/100.0;  // nN/nm
00181   static const double SEPARATION_WEIGHT          = 10.0/100.0;  // nN/nm
00182   static const double ANGLE_STRETCH_WEIGHT       = 80.0/100.0;  // nN
00183 
00184   // Force Function gains
00185   // The three principal forces are functions of
00186   // their associated error raised to an exponent
00187   // multiplied by a gain
00188   static const double SEPARATION_GAIN     = 10;
00189   static const double ANGLE_GAIN          = 10;
00190   static const int ANGLE_EXPONENT   = 1;
00191   static const double STRETCH_GAIN        = 40;
00192   static const int STRETCH_EXPONENT = 1;
00193 
00194   // The displacement of each vertex is equal to
00195   // the product of the calculated force using the relative weights
00196   // from above and the gain, where the gain is equal to TIME_STEP/DAMPING.
00197   static const double TIME_STEP = 0.3; // s
00198   static const double DAMPING   = 1.0; // nN/(nm/s)
00199 
00200   // number of vertex moves per group
00201   static const int GROUP_SIZE = 10000;
00202 
00203   // Number of groups of GROUP_SIZE vertex moves to execute.
00204   static const int NUM_GROUPS = 1;
00205 
00206   // size of vertex movie refractory period
00207   // i.e. the minimum number of steps between moves of the same vertex
00208   static const int REFRACTORY_PERIOD = 1000;
00209 
00210   // maximum number of moves each vertex may make per group
00211   static const int MAX_TOUCHES = 10;
00212 
00213   // energy epsilon used after each group
00214   // to decide if max_gain is to be lowered
00215   // if ENERGY_WINDOW averaged energy on two
00216   // consecutive iterations before group
00217   // ends differ by less than ENERGY_EPSILON,
00218   // then lower max_gain
00219   static const double ENERGY_EPSILON = 1E-7;
00220 
00221   // energy averaging window size
00222   static const int ENERGY_WINDOW = 10000;
00223 
00224   // calculate and record total model energy
00225   // with the following period
00226   static const int ENERGY_SAMPLE_PERIOD = 100000;
00227 
00228   // upper and lower threshold on allowable
00229   // number of vertex moves per REFRACTORY_PERIOD
00230   static const int UPPER_MOVES_THRESHOLD = 20;
00231   static const int LOWER_MOVES_THRESHOLD = 10;
00232 
00233   // minimum acceptable virtual displacment of vertex
00234   // if virtual_displacement*virtual_displacement < MIN_DISPLACEMENT_SQ
00235   //  then put vertex into refractory period
00236   static const double MIN_DISPLACEMENT_SQ = 1E-2;
00237 
00238   // pi
00239   static const double PI = 3.14159265358979;
00240 
00241   // desired distance between object surfaces
00242   static const double TARGET_SEPARATION  = 19.5;   // nm
00243   static const double LOOP_TARGET_SEPARATION = 50.0;   // nm
00244 
00245   // vertex single-move displacement shall be capped at MAX_ACTUAL_DISPL_SQ.
00246   // i.e. if (disp>MAX_ACTUAL_DISPL_SQ) then disp=MAX_ACTUAL_DISPL_SQ
00247   // max ratio of vertex displacement to minimum adjacent face edge length
00248   // max 5.7392 (asin(0.1)) degree change in edge angle
00249   // (although vertices on high aspect ratio faces could be moved a lot)
00250   static const double MAX_ACTUAL_DISPL_FRACTION =       0.1;
00251 
00252   // maximum allowed runtime in seconds
00253   static const bool   ENFORCE_MAX_RUNTIME = false;
00254   static const double MAX_RUNTIME = 561600;  // 6.5 days
00255 
00256   // number of vertex moves in cycle with disabled printing
00257   // alternating with a single fully logged vertex move
00258   // minimum value == 1 which will print each vertex move
00259   static const int PRINT_PERIOD = 1000;
00260   //static const int PRINT_PERIOD = 1;
00261 
00262   static const bool ENABLE_VTRACK = false;
00263 
00264   static const bool DISABLE_GAIN_SCHEDULING = false;
00265 
00266   static const int VECTOR_RESERVE = 1000;
00267 
00268   //static const int VERTEX_TOUCH_HISTOGRAM_FREQUENCY = 1000;
00269   // DEBUG
00270   static const int TARGET_VERTEX_INDEX_1 = 4324;
00271   static const char TARGET_VERTEX_NAME_1[];
00272   static const int TARGET_VERTEX_INDEX_2 = 28017;
00273   static const char TARGET_VERTEX_NAME_2[];
00274 
00275   static const int TARGET_FACE_INDEX_1 = 2368;
00276   static const int TARGET_FACE_INDEX_2 = 358;
00277   static const char TARGET_FACE_NAME[];
00278 
00279   static const int TARGET_EDGE_FACE_INDEX_1 = 249902;
00280   static const int TARGET_EDGE_FACE_INDEX_2 = 249903;
00281   static const char TARGET_EDGE_NAME[];
00282   // DEBUG
00283 
00284   static const char INPUT_DATA_DIR[];
00285   static const char OUTPUT_DATA_DIR[];
00286   static const char FROZEN_VERTICES_FILE[];
00287 
00288   static const char OUTPUT_SUFFIX[];
00289   static const char MAIN_LOG_FILE[];
00290   static const char SPACE_LOG_FILE[];
00291   static const char CONT_LOG_FILE[];
00292   static const char SEP_LOG_FILE[];
00293   static const char OBJECT_LIST_FILE[];
00294   static const char CONTROL_FILE[];
00295   static const char NEIGHBORHOOD_FILE[];
00296   static const char VERTEX_SELECTION_FILE[];
00297   static const char PUNISHED_FILE[];
00298   static const char INTERSECTED_FILE[];
00299   static const char NONNICE_FILE[];
00300 #endif
00301 }
00302 
00303 #endif

Generated on Mon Aug 25 21:40:07 2008 for meshmorph by  doxygen 1.5.1