MeshKit  1.0
test_make_watertight.cpp
Go to the documentation of this file.
00001 //
00002 // Patrick Shriwise
00003 // September 2013
00004 // This program is designed to run a set of tests on the make_watertight algorithm.
00005 // This will be a stand-alone piece of code that uses MOAB to open, modify
00006 // (break), and re-seal geometries/ 
00007 // input: cyl.h5m file (found in ../make_watertight/test/)
00008 // output: pass/fail for each of the tests
00009 
00010 
00011 #include <iostream>
00012 #include <cmath>
00013 #include <cstdlib>
00014 #include <ctime>
00015 #include <vector>
00016 #include <set>
00017 #include <algorithm>
00018 #include "moab/Core.hpp"
00019 #include "MBTagConventions.hpp"
00020 #include "moab/Range.hpp"
00021 #include "moab/Skinner.hpp"
00022 
00023 #include "meshkit/mw_func.hpp"
00024 #include "meshkit/cw_func.hpp"
00025 #include "meshkit/gen.hpp"
00026 #include "meshkit/arc.hpp"
00027 #include "meshkit/zip.hpp"
00028 
00029 #include "TestUtil.hpp"
00030 using namespace moab;
00031 ErrorCode move_vert( EntityHandle vertex, double dx, double dy, double dz, bool verbose = false );
00032 ErrorCode rand_vert_move( EntityHandle vertex, double tol, bool verbose = false);
00033 ErrorCode move_vert_theta( EntityHandle vertex, double tolerance, bool verbose = false);
00034 ErrorCode move_vert_R ( EntityHandle vertex, double tol, bool verbose = false ) ;
00035 ErrorCode rand_adj_pair( Range verts, EntityHandle &vert1, EntityHandle &vert2);
00036 
00037 
00039 struct coords_and_id {
00040   double x1;
00041   double y1;
00042   double z1;
00043   double x2;
00044   double y2;
00045   double z2;
00046   int  surf_id;
00047   bool matched;
00048   EntityHandle vert1;
00049   EntityHandle vert2;
00050 };
00051 
00053 ErrorCode move_vert( EntityHandle vertex, double dx, double dy, double dz, bool verbose) {
00054 
00055  ErrorCode result;
00056  
00057  //get coordinates from the mesh
00058  double coords[3];
00059  result= MBI()-> get_coords( &vertex , 1 , coords );
00060  if(gen::error(MB_SUCCESS!=result, "could not get the vertex coordinates")) return result;
00061 
00062  if(verbose)
00063  {
00064   //original coordinates
00065   std::cout << std::endl << "Original Coordinates" << std::endl;
00066   std::cout << "x = " << coords[0] << std::endl;
00067   std::cout << "y = " << coords[1] << std::endl;
00068   std::cout << "z = " << coords[2] << std::endl;
00069  }
00070   coords[0]+=dx;
00071   coords[1]+=dy;
00072   coords[2]+=dz;
00073   
00074  if(verbose)
00075  {
00076   //altered coordinates
00077   std::cout << std::endl << "Modified Coordinates" << std::endl;
00078   std::cout << "x = " << coords[0] << std::endl;
00079   std::cout << "y = " << coords[1] << std::endl;
00080   std::cout << "z = " << coords[2] << std::endl;
00081  }
00082  
00083   //write new coordinates to the mesh
00084   result=MBI()-> set_coords( &vertex, 1, coords);
00085   if (gen::error(MB_SUCCESS!=result, "could not set the vertex coordinates")) return result;
00086 
00087 return MB_SUCCESS;
00088 }
00089 
00092 ErrorCode rand_vert_move( EntityHandle vertex, double tol, bool verbose) {
00093 
00094  ErrorCode result;
00095  
00096  //get coordinates from the mesh
00097  double coords[3];
00098  result= MBI()-> get_coords( &vertex , 1 , coords );
00099  if(gen::error(MB_SUCCESS!=result, "could not get the vertex coordinates")) return result;
00100 
00101  // get random values for the changes in x,y,z
00102  double dx,dy,dz;
00103  dx=rand(); dy=rand(); dz=rand();
00104 
00105  double mag= sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2));
00106 
00107  // set the change in the vertex to be a unit vector
00108  dx/=mag; dy/=mag; dz/=mag;
00109 
00110  // set the change in the vertex to be something slightly less than the facet tolerance
00111  dx*=tol*0.9; dy*=tol*0.9; dz*=tol*0.9;
00112 
00113 
00114  if(verbose)
00115  {
00116   //original coordinates
00117   std::cout << std::endl << "Original Coordinates" << std::endl;
00118   std::cout << "x = " << coords[0] << std::endl;
00119   std::cout << "y = " << coords[1] << std::endl;
00120   std::cout << "z = " << coords[2] << std::endl;
00121  }
00122   coords[0]+=dx;
00123   coords[1]+=dy;
00124   coords[2]+=dz;
00125 
00126  if(verbose)
00127  {
00128   //altered coordinates
00129   std::cout << std::endl << "Modified Coordinates" << std::endl;
00130   std::cout << "x = " << coords[0] << std::endl;
00131   std::cout << "y = " << coords[1] << std::endl;
00132   std::cout << "z = " << coords[2] << std::endl;
00133  }
00134  
00135   //write new coordinates to the mesh
00136   result=MBI()-> set_coords( &vertex, 1, coords);
00137   if (gen::error(MB_SUCCESS!=result, "could not set the vertex coordinates")) return result;
00138 
00139 return MB_SUCCESS;
00140 }
00141 
00143 ErrorCode move_vert_theta( EntityHandle vertex, double tolerance, bool verbose) {
00144 
00145  ErrorCode result;
00146   
00147   //get vertex coordinates
00148   double coords[3];
00149   result= MBI()-> get_coords( &vertex , 1 , coords );
00150  
00151   // determine radius
00152   double radius=sqrt(pow(coords[0],2)+pow(coords[1],2));
00153   //std::cout << "radius = " << radius << std::endl;
00154 
00155   // get the current theta value
00156   // need both because of the oddness/evenness of the inverse functions
00157   double theta_x=acos(coords[0]/radius);
00158   double theta_y=asin(coords[1]/radius);
00159 
00160   //std::cout << "theta = " << theta << std::endl;
00161   
00162   // set the vertex bump distance
00163   double dtheta = tolerance/(radius);
00164   //std::cout << "dtheta = " << dtheta << std::endl;
00165 
00166   if(verbose){
00167   //original coordinates
00168   std::cout << std::endl << "Original Coordinates" << std::endl;
00169   std::cout << "x = " << coords[0] << std::endl;
00170   std::cout << "y = " << coords[1] << std::endl;
00171   std::cout << "z = " << coords[2] << std::endl;
00172  }
00173  // create new x and y values
00174   coords[0]=radius*cos(theta_x+dtheta); 
00175   //std::cout << "new x value = " << coords[0] << std::endl;
00176   coords[1]=radius*sin(theta_y+dtheta);
00177   //std::cout << "new y value = " << coords[1] << std::endl;
00178   if(verbose){
00179   //altered coordinates
00180   std::cout << std::endl << "Modified Coordinates" << std::endl;
00181   std::cout << "x = " << coords[0] << std::endl;
00182   std::cout << "y = " << coords[1] << std::endl;
00183   std::cout << "z = " << coords[2] << std::endl;
00184  }
00185   //set new vertex coordinates  
00186   result=MBI()-> set_coords( &vertex, 1, coords);
00187   if (gen::error(MB_SUCCESS!=result, "could not set the vertex coordinates")) return result;
00188 
00189   return MB_SUCCESS;
00190 }
00191 
00193 ErrorCode move_vert_R( EntityHandle vertex, double tol, bool verbose ) {
00194 
00195   ErrorCode result;
00196   
00197   //get vertex coordinates
00198   double coords[3];
00199   result= MBI()-> get_coords( &vertex , 1 , coords );
00200   if(gen::error(MB_SUCCESS!=result, "could not get the vertex coordinates"));
00201 
00202   if(verbose){
00203   //original coordinates
00204   std::cout << "Vertex ID: " << gen::geom_id_by_handle(vertex) << std::endl;
00205   std::cout << std::endl << "Original Coordinates" << std::endl;
00206   std::cout << "x = " << coords[0] << std::endl;
00207   std::cout << "y = " << coords[1] << std::endl;
00208   std::cout << "z = " << coords[2] << std::endl;
00209   }
00210   double radius = sqrt(pow(coords[0],2)+pow(coords[1],2));
00211   //get unit vector in x-y plane
00212   coords[0]/=radius;
00213   coords[1]/=radius;
00214   
00215   //alter radius to new value of radius+tol
00216   radius-=tol;
00217   coords[0]*=radius;
00218   coords[1]*=radius;
00219  
00220   if(verbose){
00221   //altered coordinates
00222   std::cout << std::endl << "Modified Coordinates" << std::endl;
00223   std::cout << "x = " << coords[0] << std::endl;
00224   std::cout << "y = " << coords[1] << std::endl;
00225   std::cout << "z = " << coords[2] << std::endl;
00226   }
00227   
00228   //set new vertex coordinates  
00229   result=MBI()-> set_coords( &vertex, 1, coords);
00230   if (gen::error(MB_SUCCESS!=result, "could not set the vertex coordinates")) return result;
00231 
00232 return MB_SUCCESS;
00233 }
00234 
00235 
00237 ErrorCode write_mod_file( std::string filename ) {
00238 
00239  ErrorCode result;
00240  std::string output_filename = filename + "_mod.h5m";
00241  //write file
00242  result=MBI()->write_mesh(output_filename.c_str());
00243  if(gen::error(MB_SUCCESS!=result,"could not write the mesh to output_filename")) return result;
00244 
00245   return MB_SUCCESS;
00246 }
00247 
00248 
00249 // used to clear all mesh data and reload the file as original
00250 ErrorCode reload_mesh(const char* filename,  EntityHandle &meshset, bool debug = false) {
00251 
00252   ErrorCode result;
00253 
00254   // delete meshset
00255   result= MBI() -> delete_mesh();
00256   if(gen::error(MB_SUCCESS!=result, "could not delete the mesh set")) return result;
00257 
00258 
00259 
00260   // re-initialize meshset
00261   result= MBI() -> create_meshset(MESHSET_SET, meshset);
00262   if(gen::error(MB_SUCCESS!=result, "could not create the new meshset")) return result;
00263  
00264   //reload the file
00265   result = MBI() -> load_file(filename, &meshset);
00266   if(gen::error(MB_SUCCESS!=result, "could not re-load the file into the mesh set")) return result;
00267 
00268   //check that something was loaded into the meshset
00269   int num_meshsets;   
00270 
00271   result= MBI() -> num_contained_meshsets ( meshset, &num_meshsets);
00272   if(gen::error(MB_SUCCESS!=result, "could not get the number of meshsets")) return result;
00273   
00274   if(debug) std::cout << "number of mesh sets after reload = " << num_meshsets << std::endl;
00275 
00276   if(num_meshsets==0) return MB_FAILURE;
00277 
00278   return result;
00279 }
00280 
00281 
00283 ErrorCode single_vert_bump( Range verts, double bump_dist_x, double bump_dist_y, double bump_dist_z, bool verbose = false ) {
00284  
00285   ErrorCode result;
00286   EntityHandle vertex=verts.back();
00287   //move the desired vertex by the allotted distance
00288   result = move_vert( vertex, bump_dist_x, bump_dist_y, bump_dist_z );
00289   if(gen::error(MB_SUCCESS!=result, "could not move single vert")) return result;
00290 
00291   return MB_SUCCESS;
00292 }
00293 
00295 ErrorCode single_vert_bump_R( Range verts, double facet_tol, bool verbose = false ) {
00296  
00297   ErrorCode result;
00298   EntityHandle vertex=verts.back();
00299   //move the desired vertex by the allotted distance
00300   result = move_vert_R( vertex, facet_tol, verbose );
00301   if(gen::error(MB_SUCCESS!=result, "could not move single vert")) return result;
00302 
00303   return MB_SUCCESS;
00304 }
00305 
00307 ErrorCode locked_pair_bump( Range verts, double bump_dist_x, double bump_dist_y, double bump_dist_z,  std::string root_name, bool verbose = false ) {
00308  
00309   ErrorCode result;
00310 
00311   EntityHandle vertex1=verts.back();
00312   EntityHandle vertex2=(verts.back()-1);
00313  
00314   //move the desired verticies by the allotted distance(s)
00315   result = move_vert( vertex1, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00316   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00317   result = move_vert( vertex2, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00318   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00319 
00320 
00321   return MB_SUCCESS;
00322 }
00324 ErrorCode rand_locked_pair_bump_rand( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00325  
00326   ErrorCode result;
00327 
00328   //select random verticies from verts
00329   EntityHandle vertex1;
00330   EntityHandle vertex2;
00331 
00332   result = rand_adj_pair( verts, vertex1, vertex2);
00333   
00334   //move the desired verticies by the allotted distance(s)
00335   result = rand_vert_move( vertex1, facet_tol , verbose);
00336   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00337   result = rand_vert_move( vertex2, facet_tol, verbose);
00338   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00339 
00340   return MB_SUCCESS;
00341 }
00342 
00344 ErrorCode rand_locked_pair_bump_theta( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00345  
00346   ErrorCode result;
00347 
00348   //select random verticies from verts
00349   EntityHandle vertex1;
00350   EntityHandle vertex2;
00351 
00352   result = rand_adj_pair(verts, vertex1, vertex2);
00353   
00354   //move the desired verticies by the allotted distance(s)
00355   result = move_vert_theta( vertex1, facet_tol , verbose);
00356   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00357   result = move_vert_theta( vertex2, facet_tol, verbose);
00358   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00359 
00360   return MB_SUCCESS;
00361 }
00363 ErrorCode rand_locked_pair_bump( Range verts, double bump_dist_x, double bump_dist_y, double bump_dist_z,  std::string root_name, bool verbose = false ) {
00364  
00365   ErrorCode result;
00366 
00367   //select random verticies from verts
00368   EntityHandle vertex1;
00369   EntityHandle vertex2;
00370 
00371   result = rand_adj_pair( verts, vertex1, vertex2);
00372   
00373   //move the desired verticies by the allotted distance(s)
00374   result = move_vert( vertex1, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00375   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00376   result = move_vert( vertex2, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00377   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00378 
00379   return MB_SUCCESS;
00380 }
00382 ErrorCode locked_pair_bump_rand( Range verts, double facet_tol,  std::string root_name, bool verbose = false ) {
00383  
00384   ErrorCode result;
00385 
00386   EntityHandle vertex1=verts.back();
00387   EntityHandle vertex2=(verts.back()-1);
00388   
00389   //move the desired verticies by the allotted distance(s)
00390   result = rand_vert_move( vertex1, facet_tol, verbose);
00391   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00392   result = rand_vert_move( vertex2, facet_tol, verbose);
00393   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00394 
00395   return MB_SUCCESS;
00396 }
00397 
00398 
00400 ErrorCode rand_vert_bump( Range verts, double facet_tol, std::string root_name, bool verbose = false ) {
00401  
00402   ErrorCode result;
00403   EntityHandle vertex = verts.back();
00404   //move the desired vertex by the allotted distance
00405   result = rand_vert_move( vertex, facet_tol, verbose);
00406   if(gen::error(MB_SUCCESS!=result, "could not move single vert")) return result;
00407 
00408 
00409   return MB_SUCCESS;
00410 }
00411 
00412 // FOR CYLINDER TESTING ONLY 
00414 ErrorCode theta_vert_bump( Range verts, double bump_dist_theta, double tolerance, std::string root_name, bool verbose = false ) {
00415  
00416   ErrorCode result;
00417   
00418   //get vertex coordinates
00419   double coords[3];
00420   EntityHandle vertex=verts.back();
00421   result= MBI()-> get_coords( &vertex , 1 , coords );
00422  
00423   // determine radius
00424   double radius=sqrt(pow(coords[0],2)+pow(coords[1],2));
00425   //std::cout << "radius = " << radius << std::endl;
00426 
00427   // get the current theta value
00428   double theta=asin(coords[1]/radius);
00429   //std::cout << "theta = " << theta << std::endl;
00430   
00431   // set the vertex bump distance
00432   double dtheta = 0.5*tolerance/(radius);
00433   //std::cout << "dtheta = " << dtheta << std::endl;
00434 
00435  
00436  if(verbose)
00437  {
00438   //original coordinates
00439   std::cout << std::endl << "Original Coordinates" << std::endl;
00440   std::cout << "x = " << coords[0] << std::endl;
00441   std::cout << "y = " << coords[1] << std::endl;
00442   std::cout << "z = " << coords[2] << std::endl;
00443   }
00444  // create new x and y values
00445   coords[0]=radius*cos(theta+dtheta); 
00446   //std::cout << "new x value = " << coords[0] << std::endl;
00447   coords[1]=radius*sin(theta+dtheta);
00448   //std::cout << "new y value = " << coords[1] << std::endl;
00449   if(verbose)
00450   {
00451   //altered coordinates
00452   std::cout << std::endl << "Modified Coordinates" << std::endl;
00453   std::cout << "x = " << coords[0] << std::endl;
00454   std::cout << "y = " << coords[1] << std::endl;
00455   std::cout << "z = " << coords[2] << std::endl;
00456   }
00457   //write new coordinates to the mesh
00458   // might not be necesarry any longer as we move to doing tests on a moab-instance basis
00459   result=MBI()-> set_coords( &vertex, 1, coords);
00460   if (gen::error(MB_SUCCESS!=result, "could not set the vertex coordinates")) return result;
00461   // alter output filename
00462  
00463   return MB_SUCCESS;
00464 }
00465 
00467 ErrorCode locked_pair_move_theta( Range verts, double tolerance, std::string root_name,  bool verbose = false) {
00468 
00469   ErrorCode result;
00470 
00471   //get vertex coordinates
00472   EntityHandle vertex1=verts.back();
00473   EntityHandle vertex2=verts.back()-1;
00474   
00475   result= move_vert_theta( vertex1, tolerance, verbose);
00476   if(gen::error(MB_SUCCESS!=result,"could not move vertex1 along theta")) return result;
00477   result= move_vert_theta( vertex2, tolerance, verbose);
00478   if(gen::error(MB_SUCCESS!=result,"could not move vertex1 along theta")) return result;
00479 
00480   return MB_SUCCESS;
00481 }
00482 
00484 ErrorCode adjplone_locked_pair_bump( Range verts, double bump_dist_x, double bump_dist_y, double bump_dist_z,  std::string root_name, bool verbose = false ) {
00485  
00486   ErrorCode result;
00487 
00488   EntityHandle vertex1=verts.back();
00489   EntityHandle vertex2=(verts.back()-2);
00490  
00491   //move the desired verticies by the allotted distance(s)
00492   result = move_vert( vertex1, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00493   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00494   result = move_vert( vertex2, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00495   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00496 
00497 
00498   return MB_SUCCESS;
00499 }
00500 
00502 ErrorCode adjplone_locked_pair_bump_theta( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00503  
00504   ErrorCode result;
00505 
00506   EntityHandle vertex1=verts.back();
00507   EntityHandle vertex2=(verts.back()-2);
00508  
00509   //move the desired verticies by the allotted distance(s)
00510   result = move_vert_theta( vertex1, facet_tol, verbose);
00511   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00512   result = move_vert_theta( vertex2, facet_tol, verbose);
00513   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00514 
00515 
00516   return MB_SUCCESS;
00517 }
00518 
00520 ErrorCode adjplone_locked_pair_bump_rand( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00521  
00522   ErrorCode result;
00523 
00524   EntityHandle vertex1=verts.back();
00525   EntityHandle vertex2=(verts.back()-2);
00526  
00527   //move the desired verticies by the allotted distance(s)
00528   result = rand_vert_move( vertex1, facet_tol, verbose);
00529   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00530   result = rand_vert_move( vertex2, facet_tol, verbose);
00531   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00532 
00533 
00534   return MB_SUCCESS;
00535 }
00536 
00537 
00539 ErrorCode nonadj_locked_pair_bump( Range verts, double bump_dist_x, double bump_dist_y, double bump_dist_z,  std::string root_name, bool verbose = false ) {
00540  
00541   ErrorCode result;
00542 
00543   //select random verticies from verts
00544   int number_of_verts = verts.size();
00545   double num = rand()/static_cast<double>(RAND_MAX);
00546   //std::cout << "max index = " << (number_of_verts-2)<< std::endl;
00547   int index = static_cast<int>(num*((number_of_verts-2)));
00548   //std::cout << "index = " << index << std::endl;
00549 
00550   EntityHandle vertex1=verts.back();
00551   EntityHandle vertex2=(verts.back()-index);
00552   
00553   //move the desired verticies by the allotted distance(s)
00554   result = move_vert( vertex1, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00555   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00556   result = move_vert( vertex2, bump_dist_x, bump_dist_y, bump_dist_z, verbose);
00557   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00558 
00559   return MB_SUCCESS;
00560 }
00561 
00563 ErrorCode nonadj_locked_pair_bump_theta( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00564  
00565   ErrorCode result;
00566 
00567   //select random verticies from verts
00568   int number_of_verts = verts.size();
00569   double num = rand()/static_cast<double>(RAND_MAX);
00570   //std::cout << "max index = " << (number_of_verts-2)<< std::endl;
00571   int index = static_cast<int>(num*((number_of_verts-2)));
00572   //std::cout << "index = " << index << std::endl;
00573 
00574   EntityHandle vertex1=verts.back();
00575   EntityHandle vertex2=(verts.back()-index);
00576   
00577   //move the desired verticies by the allotted distance(s)
00578   result = move_vert_theta( vertex1, facet_tol, verbose);
00579   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00580   result = move_vert_theta( vertex2, facet_tol , verbose);
00581   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00582 
00583   return MB_SUCCESS;
00584 }
00585 
00587 ErrorCode nonadj_locked_pair_bump_rand( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00588  
00589   ErrorCode result;
00590 
00591   //select random verticies from verts
00592   int number_of_verts = verts.size();
00593   double num = rand()/static_cast<double>(RAND_MAX);
00594   //std::cout << "max index = " << (number_of_verts-2)<< std::endl;
00595   int index = static_cast<int>(num*((number_of_verts-2)));
00596   //std::cout << "index = " << index << std::endl;
00597 
00598   EntityHandle vertex1=verts.back();
00599   EntityHandle vertex2=(verts.back()-index);
00600   
00601   //move the desired verticies by the allotted distance(s)
00602   result = rand_vert_move( vertex1, facet_tol, verbose);
00603   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00604   result = rand_vert_move( vertex2, facet_tol , verbose);
00605   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00606 
00607   return MB_SUCCESS;
00608 }
00609 
00610 ErrorCode locked_pair_bump_R( Range verts, double facet_tol,  std::string root_name, bool verbose = false ) {
00611  
00612   ErrorCode result;
00613 
00614   EntityHandle vertex1=verts.back();
00615   EntityHandle vertex2=(verts.back()-1);
00616  
00617   //move the desired verticies by the allotted distance(s)
00618   result = move_vert_R( vertex1, facet_tol, verbose);
00619   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00620   result = move_vert_R( vertex2, facet_tol, verbose);
00621   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00622 
00623 
00624   return MB_SUCCESS;
00625 }
00626 
00628 ErrorCode rand_locked_pair_bump_R( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00629  
00630   ErrorCode result;
00631 
00632   //select random verticies from verts
00633   EntityHandle vertex1;
00634   EntityHandle vertex2;
00635 
00636   result = rand_adj_pair( verts, vertex1, vertex2);
00637   
00638   //move the desired verticies by the allotted distance(s)
00639   result = move_vert_R( vertex1, facet_tol , verbose);
00640   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00641   result = move_vert_R( vertex2, facet_tol, verbose);
00642   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00643 
00644   return MB_SUCCESS;
00645 }
00646 
00648 ErrorCode adjplone_locked_pair_bump_R( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00649  
00650   ErrorCode result;
00651 
00652   EntityHandle vertex1=verts.back();
00653   EntityHandle vertex2=(verts.back()-2);
00654  
00655   //move the desired verticies by the allotted distance(s)
00656   result = move_vert_R( vertex1, facet_tol, verbose);
00657   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00658   result = move_vert_R( vertex2, facet_tol, verbose);
00659   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00660 
00661 
00662   return MB_SUCCESS;
00663 }
00664 
00666 ErrorCode nonadj_locked_pair_bump_R( Range verts, double facet_tol , std::string root_name, bool verbose = false ) {
00667  
00668   ErrorCode result;
00669 
00670   //select random verticies from verts
00671   int number_of_verts = verts.size();
00672   double num = rand()/static_cast<double>(RAND_MAX);
00673   //std::cout << "max index = " << (number_of_verts-2)<< std::endl;
00674   int index = static_cast<int>(num*((number_of_verts-2)));
00675   //std::cout << "index = " << index << std::endl;
00676 
00677   EntityHandle vertex1=verts.back();
00678   EntityHandle vertex2=(verts.back()-index);
00679   
00680   //move the desired verticies by the allotted distance(s)
00681   result = move_vert_R( vertex1, facet_tol, verbose);
00682   if(gen::error(MB_SUCCESS!=result, "could not move vertex1")) return result;
00683   result = move_vert_R( vertex2, facet_tol , verbose);
00684   if(gen::error(MB_SUCCESS!=result, "could not move vertex2")) return result;
00685 
00686   return MB_SUCCESS;
00687 }
00688  
00689 ErrorCode rand_adj_pair( Range verts, EntityHandle &vert1, EntityHandle &vert2)
00690 {
00691 
00692 
00693   //select random verticies from verts
00694   int number_of_verts = verts.size();
00695   double num = rand()/static_cast<double>(RAND_MAX);
00696  
00697   int index = static_cast<int>(num*(number_of_verts-2));
00698 
00699 
00700   vert1=(verts.front()+index);
00701   vert2=(verts.front()+(index+1));
00702 
00703 
00704   return MB_SUCCESS;
00705 }
00706 
00707 int main(int argc, char **argv)
00708 {
00709 
00710 //open moab instance
00711 Interface *MBI();
00712 
00713 //for unit testing purposes, we don't care about the output. Just PASS or FAIL. 
00714 bool verbose=false;
00715 
00716 // ******************************************************************
00717   // Load the h5m file and create tags.
00718   // ******************************************************************
00719 
00720   //clock_t start_time;
00721   //start_time = clock();
00722   //save the mesh to a new filename
00723   std::string input_name="cyl.h5m";
00724   std::string root_name=input_name;
00725   int len = root_name.length();
00726   root_name.erase(len-4);
00727 
00728   // load file and get tolerance from input argument
00729   ErrorCode result;
00730   std::string filename = TestDir + "/" + input_name; //set filename
00731   EntityHandle input_set;
00732   result = MBI()->create_meshset( MESHSET_SET, input_set ); //create handle to meshset
00733   if(MB_SUCCESS != result)
00734     {
00735       return result;
00736     }
00737 
00738 result = MBI()->load_file( filename.c_str(), &input_set ); //load the file into the meshset
00739   if(MB_SUCCESS != result)
00740     {
00741       // failed to load the file
00742       std::cout << "could not load file" << std::endl;
00743       return result;
00744     }
00745 
00747   double facet_tolerance;
00748 
00749   Tag faceting_tol_tag;
00750   //get faceting tolerance handle from file
00751   result = MBI()->tag_get_handle( "FACETING_TOL", 1, MB_TYPE_DOUBLE,
00752         faceting_tol_tag , MB_TAG_SPARSE|MB_TAG_CREAT );
00753   if(gen::error(MB_SUCCESS!=result, "could not get the faceting tag handle")) return result;
00754   
00755   //get the faceting tolerance of any entity
00756   Range file_set;
00757   result = MBI()->get_entities_by_type_and_tag( 0, MBENTITYSET, 
00758                         &faceting_tol_tag, NULL, 1, file_set );
00759 
00760   //get facetint tolerance value
00761   result = MBI()->tag_get_data( faceting_tol_tag, &file_set.front(), 1, &facet_tolerance );
00762   if(gen::error(MB_SUCCESS!=result, "could not get the faceting tolerance")) return result;
00763 
00764   // create tags on geometry
00765   Tag geom_tag, id_tag;
00766   result = MBI()->tag_get_handle( GEOM_DIMENSION_TAG_NAME, 1, 
00767                             MB_TYPE_INTEGER, geom_tag, MB_TAG_DENSE|MB_TAG_CREAT );
00768   if(gen::error(MB_SUCCESS != result, "could not get GEOM_DIMENSION_TAG_NAME handle")) return result;
00769 
00770   result = MBI()->tag_get_handle( GLOBAL_ID_TAG_NAME, 1, 
00771                             MB_TYPE_INTEGER, id_tag, MB_TAG_DENSE|MB_TAG_CREAT );
00772   if(gen::error(MB_SUCCESS != result, "could not get GLOBAL_ID_TAG_NAME handle")) return result;
00773   
00774   // get surface and volume sets
00775   Range surf_sets, vol_sets; // Range of set of surfaces and volumes
00776   // surface sets
00777   int dim = 2;
00778   void* input_dim[] = {&dim};
00779   result = MBI()->get_entities_by_type_and_tag( input_set, MBENTITYSET, &geom_tag, 
00780                                                 input_dim, 1, surf_sets);
00781   if(MB_SUCCESS != result)
00782     {
00783       return result;
00784     }
00785 
00786   // volume sets
00787   dim = 3;
00788   result = MBI()->get_entities_by_type_and_tag( input_set, MBENTITYSET, &geom_tag, 
00789                                                 input_dim, 1, vol_sets);
00790   if(MB_SUCCESS != result)
00791     {
00792       return result;
00793     }
00794     
00795   //vertex sets
00796   dim= 0;
00797   Range verts;
00798   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
00799   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
00800   
00801   if(gen::error(MB_SUCCESS!=result, "could not get vertex coordinates")) return result;
00802   
00803 if(verbose)
00804 {
00805   std::cout<< "number of verticies= " << verts.size() << std::endl;  
00806   std::cout<< "number of surfaces= " << surf_sets.size() << std::endl;
00807   std::cout<< "number of volumes= "  << vol_sets.size() << std::endl;
00808 }
00809 
00810 //initialize booleans to pass to make_mesh_watertight
00811 
00812   //bool check_topology;
00813   bool test, sealed;
00814        //check_topology=false;
00815        test=true;
00816   
00817 // initialize boolean for each set of tests
00818   bool test_set_result=true;
00819 
00821   std::cout << "SINGLE VERTEXT MOVEMENT TESTS" << std::endl;
00822 
00824 
00825  std::cout << "Test 1: vertex bump in x direction:";
00826 
00827   //perform single vertex bump and test
00828   result=single_vert_bump(verts, 0.9*facet_tolerance , 0 , 0 ); 
00829   if(gen::error(MB_SUCCESS!=result, "could not create single vertex bump test")) return result;
00830   
00831   // seal the model using make_watertight 
00832   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
00833   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
00834   
00835   // Lastly Check to see if make_watertight fixed the model
00836   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
00837   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
00838   
00839   if(sealed)
00840   {
00841    std::cout << "PASS" << std::endl;
00842   }
00843   else
00844   {
00845    std::cout << "FAIL" << std::endl;
00846    test_set_result=false;
00847   }
00848 
00850 
00851   std::cout << "Test 2: vertex bump in y direction:";
00852 
00853   // Clear the mesh and reload original geometry for the next test
00854   result=reload_mesh( filename.c_str(), input_set);
00855   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
00856 
00857   // retrieve the verticies again so the model can be broken
00858   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
00859   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
00860 
00861   // "Break" the geometry
00862   result=single_vert_bump(verts, 0 , 0.9*facet_tolerance , 0); 
00863   if(gen::error(MB_SUCCESS!=result, "could not create single vertex bump test")) return result;
00864   
00865   // Seal the mesh
00866   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
00867   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
00868 
00869 // Lastly Check to see if make_watertight fixed the model
00870   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
00871   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
00872   
00873 
00874     if(sealed)
00875   {
00876    std::cout << "PASS" << std::endl;
00877   }
00878   else
00879   {
00880    std::cout << "FAIL" << std::endl;
00881    test_set_result=false;
00882   }
00883 
00884 
00886 
00887   std::cout << "Test 3: vertex bump in z direction:" ;
00888 
00889   // Clear the mesh and reload original geometry for the next test
00890   result=reload_mesh( filename.c_str(), input_set);
00891   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
00892 
00893   // retrieve the verticies again so the model can be broken
00894   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
00895   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
00896 
00897   // "Break" the geometry
00898   result = single_vert_bump(verts, 0 , 0 , 0.9*facet_tolerance ); 
00899   if(gen::error(MB_SUCCESS!=result, "could not create single vertex bump test")) return result;
00900   
00901   // Seal the mesh
00902   result = mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
00903   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
00904 
00905 // Lastly Check to see if make_watertight fixed the model
00906   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
00907   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
00908   
00909 
00910     if(sealed)
00911   {
00912    std::cout << "PASS" << std::endl;
00913   }
00914   else
00915   {
00916    std::cout << "FAIL" << std::endl;
00917    test_set_result=false;
00918   }
00919 
00920 
00922 
00923   std::cout << "Test 4: vertex bump in R direction:" ;
00924 
00925   // Clear the mesh and reload original geometry for the next test
00926   result=reload_mesh( filename.c_str(), input_set);
00927   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
00928 
00929   // retrieve the verticies again so the model can be broken
00930   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
00931   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
00932 
00933     // "Break" the geometry
00934   result=single_vert_bump_R(verts, facet_tolerance ); 
00935   if(gen::error(MB_SUCCESS!=result, "could not create single vertex bump test")) return result;
00936   
00937 
00938   // Seal the mesh
00939   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
00940   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
00941 
00942   // Lastly Check to see if make_watertight fixed the model
00943   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
00944   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
00945   
00946 
00947     if(sealed)
00948   {
00949    std::cout << "PASS" << std::endl;
00950   }
00951   else
00952   {
00953    std::cout << "FAIL" << std::endl;
00954    test_set_result=false;
00955   }
00957 
00958   std::cout << "Test 5: vertex bump in theta direction:" ;
00959 
00960   // Clear the mesh and reload original geometry for the next test
00961   result=reload_mesh( filename.c_str(), input_set);
00962   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
00963 
00964   // retrieve the verticies again so the model can be broken
00965   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
00966   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
00967 
00968   
00969   // "Break" the geometry
00970   result=theta_vert_bump(verts, 0, facet_tolerance, root_name ); 
00971   if(gen::error(MB_SUCCESS!=result, "could not create single vertex bump test")) return result;
00972   
00973   // Seal the mesh
00974   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
00975   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
00976 
00977   // Lastly Check to see if make_watertight fixed the model
00978   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
00979   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
00980   
00981 
00982     if(sealed)
00983   {
00984    std::cout << "PASS" << std::endl;
00985   }
00986   else
00987   {
00988    std::cout << "FAIL" << std::endl;
00989    test_set_result=false;
00990   }
00991 
00993 
00994   std::cout << "Test 6: vertex bump in rand direction:" ;
00995 
00996   // Clear the mesh and reload original geometry for the next test
00997   result=reload_mesh( filename.c_str(), input_set);
00998   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
00999 
01000   // retrieve the verticies again so the model can be broken
01001   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01002   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01003 
01004   
01005   // "Break" the geometry
01006   result=rand_vert_bump(verts, facet_tolerance, root_name); 
01007   if(gen::error(MB_SUCCESS!=result, "could not create single vertex bump test")) return result;
01008   
01009   // Seal the mesh
01010   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01011   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01012 
01013 // Lastly Check to see if make_watertight fixed the model
01014   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01015   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01016   
01017 
01018   if(sealed)
01019   {
01020    std::cout << "PASS" << std::endl << std::endl ;
01021   }
01022   else
01023   {
01024    std::cout << "FAIL" << std::endl << std::endl ;
01025    test_set_result=false;
01026   }
01027 
01029 
01030   if(test_set_result)
01031   {
01032    std::cout << "SINGLE VERTEX MOVEMENT TESTS PASSED" << std::endl << std::endl;
01033   }
01034   else
01035   {
01036    std::cout << "SINGLE VERTEX MOVEMENT TESTS FAILED" << std::endl << std::endl;
01037    exit(0);
01038   }
01039 
01041 
01042 std::cout << "LOCKED VERTEX PAIR MOVEMENT TESTS" << std::endl;
01043 
01045 
01046   std::cout << "Test 1: locked pair of verticies move in x:" ;
01047 
01048   // Clear the mesh and reload original geometry for the next test
01049   result=reload_mesh( filename.c_str(), input_set);
01050   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01051 
01052   // retrieve the verticies again so the model can be broken
01053   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01054   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01055 
01056   
01057   // "Break" the geometry
01058   result=locked_pair_bump(verts, 0.9*facet_tolerance , 0 , 0 , root_name ); 
01059   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01060 
01061 
01062    // Seal the mesh
01063   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01064   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01065 
01066   // Lastly Check to see if make_watertight fixed the model
01067   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01068   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01069   
01070     if(sealed)
01071   {
01072    std::cout << "PASS" << std::endl;
01073   }
01074   else
01075   {
01076    std::cout << "FAIL" << std::endl;
01077    test_set_result=false;
01078   }
01079 
01081 
01082   std::cout << "Test 2: locked pair of verticies move in y:" ;
01083 
01084   // Clear the mesh and reload original geometry for the next test
01085   result=reload_mesh( filename.c_str(), input_set);
01086   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01087 
01088   // retrieve the verticies again so the model can be broken
01089   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01090   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01091 
01092   
01093   // "Break" the geometry
01094   result=locked_pair_bump(verts, 0 , 0.9*facet_tolerance , 0 , root_name ); 
01095   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01096 
01097 
01098    // Seal the mesh
01099   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01100   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01101 
01102   // Lastly Check to see if make_watertight fixed the model
01103   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01104   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01105   
01106     if(sealed)
01107   {
01108    std::cout << "PASS" << std::endl;
01109   }
01110   else
01111   {
01112    std::cout << "FAIL" << std::endl;
01113    test_set_result=false;
01114   }
01115 
01116 
01118 
01119   std::cout << "Test 3: locked pair of verticies move in z:" ;
01120 
01121   // Clear the mesh and reload original geometry for the next test
01122   result=reload_mesh( filename.c_str(), input_set);
01123   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01124 
01125   // retrieve the verticies again so the model can be broken
01126   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01127   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01128 
01129   
01130   // "Break" the geometry
01131   result=locked_pair_bump(verts, 0 , 0 , 0.9*facet_tolerance , root_name ); 
01132   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01133 
01134 
01135    // Seal the mesh
01136   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01137   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01138 
01139   // Lastly Check to see if make_watertight fixed the model
01140   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01141   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01142   
01143     if(sealed)
01144   {
01145    std::cout << "PASS" << std::endl;
01146   }
01147   else
01148   {
01149    std::cout << "FAIL" << std::endl;
01150    test_set_result=false;
01151   }
01152 
01154 
01155   std::cout << "Test 4: locked pair of verticies move in R:" ;
01156 
01157   // Clear the mesh and reload original geometry for the next test
01158   result=reload_mesh( filename.c_str(), input_set);
01159   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01160 
01161   // retrieve the verticies again so the model can be broken
01162   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01163   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01164 
01165   
01166   // "Break" the geometry
01167   result=locked_pair_bump_R(verts, facet_tolerance , root_name); 
01168   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01169 
01170   
01171   // Seal the mesh
01172   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01173   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01174 
01175   // Lastly Check to see if make_watertight fixed the model
01176   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01177   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01178   
01179     if(sealed)
01180   {
01181    std::cout << "PASS" << std::endl;
01182   }
01183   else
01184   {
01185    std::cout << "FAIL" << std::endl;
01186    test_set_result=false;
01187   }
01188 
01190 
01191   std::cout << "Test 5: locked pair of verticies move in theta:" ;
01192 
01193   // Clear the mesh and reload original geometry for the next test
01194   result=reload_mesh( filename.c_str(), input_set);
01195   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01196 
01197   // retrieve the verticies again so the model can be broken
01198   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01199   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01200 
01201   
01202   // "Break" the geometry
01203   result=locked_pair_move_theta(verts, facet_tolerance , root_name); 
01204   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01205 
01206 
01207    // Seal the mesh
01208   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01209   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01210 
01211   // Lastly Check to see if make_watertight fixed the model
01212   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01213   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01214   
01215     if(sealed)
01216   {
01217    std::cout << "PASS" << std::endl;
01218   }
01219   else
01220   {
01221    std::cout << "FAIL" << std::endl;
01222    test_set_result=false;
01223   }
01224 
01226 
01227   std::cout << "Test 6: adj. pair of verticies random move:" ;
01228 
01229   // Clear the mesh and reload original geometry for the next test
01230   result=reload_mesh( filename.c_str(), input_set);
01231   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01232 
01233   // retrieve the verticies again so the model can be broken
01234   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01235   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01236 
01237   
01238   // "Break" the geometry
01239   result=locked_pair_bump_rand(verts, facet_tolerance , root_name); 
01240   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01241 
01242   
01243 
01244    // Seal the mesh
01245   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01246   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01247 
01248 
01249   // Lastly Check to see if make_watertight fixed the model
01250   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01251   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01252   
01253 
01254   if(sealed)
01255   {
01256    std::cout << "PASS" << std::endl << std::endl ;
01257   }
01258   else
01259   {
01260    std::cout << "FAIL" << std::endl << std::endl ;
01261    test_set_result=false;
01262   }
01263 
01264 
01266 
01267   if(test_set_result)
01268   {
01269    std::cout << "LOCKED VERTEX PAIR MOVEMENT TESTS PASSED" << std::endl << std::endl;
01270   }
01271   else
01272   {
01273    std::cout << "LOCKED VERTEX PAIR MOVEMENT TESTS FAILED" << std::endl << std::endl;
01274    exit(0);
01275   }
01276 
01277 
01279 
01280 std::cout << "RAND PAIR MOVEMENT TESTS" << std::endl;
01281 
01283 
01284   std::cout << "Test 1: random locked pair of verticies move in x:" ;
01285 
01286   // Clear the mesh and reload original geometry for the next test
01287   result=reload_mesh( filename.c_str(), input_set);
01288   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01289 
01290   // retrieve the verticies again so the model can be broken
01291   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01292   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01293   
01294   // "Break" the geometry
01295   result=rand_locked_pair_bump(verts, 0.9*facet_tolerance , 0 , 0 , root_name ); 
01296   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01297 
01298   // Seal the mesh
01299   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01300   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01301 
01302   // Lastly Check to see if make_watertight fixed the model
01303   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01304   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01305   
01306     if(sealed)
01307   {
01308    std::cout << "PASS" << std::endl;
01309   }
01310   else
01311   {
01312    std::cout << "FAIL" << std::endl;
01313    test_set_result=false;
01314   }
01315 
01317 
01318   std::cout << "Test 2: random locked pair of verticies move in y:" ;
01319 
01320   // Clear the mesh and reload original geometry for the next test
01321   result=reload_mesh( filename.c_str(), input_set);
01322   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01323 
01324   // retrieve the verticies again so the model can be broken
01325   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01326   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01327 
01328   
01329   // "Break" the geometry
01330   result=rand_locked_pair_bump(verts, 0 , 0.9*facet_tolerance , 0 , root_name ); 
01331   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01332 
01333   // Seal the mesh
01334   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01335   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01336 
01337   // Lastly Check to see if make_watertight fixed the model
01338   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01339   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01340   
01341     if(sealed)
01342   {
01343    std::cout << "PASS" << std::endl;
01344   }
01345   else
01346   {
01347    std::cout << "FAIL" << std::endl;
01348    test_set_result=false;
01349   }
01350 
01352 
01353   std::cout << "Test 3: random locked pair of verticies move in z:" ;
01354 
01355   // Clear the mesh and reload original geometry for the next test
01356   result=reload_mesh( filename.c_str(), input_set);
01357   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01358 
01359   // retrieve the verticies again so the model can be broken
01360   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01361   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01362   
01363   // "Break" the geometry
01364   result=rand_locked_pair_bump(verts, 0 , 0 , 0.9*facet_tolerance , root_name ); 
01365   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01366 
01367   // Seal the mesh
01368   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01369   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01370 
01371   // Lastly Check to see if make_watertight fixed the model
01372   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01373   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01374   
01375     if(sealed)
01376   {
01377    std::cout << "PASS" << std::endl;
01378   }
01379   else
01380   {
01381    std::cout << "FAIL" << std::endl;
01382    test_set_result=false;
01383   }
01384 
01386 
01387   std::cout << "Test 4: random locked pair of verticies move in R:" ;
01388 
01389   // Clear the mesh and reload original geometry for the next test
01390   result=reload_mesh( filename.c_str(), input_set);
01391   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01392 
01393   // retrieve the verticies again so the model can be broken
01394   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01395   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01396 
01397   // "Break" the geometry
01398   result=rand_locked_pair_bump_R(verts, facet_tolerance , root_name); 
01399   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01400 
01401   // Seal the mesh
01402   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01403   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01404 
01405   // Lastly Check to see if make_watertight fixed the model
01406   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01407   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01408   
01409     if(sealed)
01410   {
01411    std::cout << "PASS" << std::endl;
01412   }
01413   else
01414   {
01415    std::cout << "FAIL" << std::endl;
01416    test_set_result=false;
01417   }
01418 
01420 
01421   std::cout << "Test 5: random locked pair of verticies move in theta:" ;
01422 
01423   // Clear the mesh and reload original geometry for the next test
01424   result=reload_mesh( filename.c_str(), input_set);
01425   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01426 
01427   // retrieve the verticies again so the model can be broken
01428   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01429   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01430 
01431   // "Break" the geometry
01432   result=rand_locked_pair_bump_theta(verts, facet_tolerance , root_name); 
01433   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01434 
01435   // Seal the mesh
01436   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01437   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01438 
01439   // Lastly Check to see if make_watertight fixed the model
01440   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01441   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01442   
01443     if(sealed)
01444   {
01445    std::cout << "PASS" << std::endl;
01446   }
01447   else
01448   {
01449    std::cout << "FAIL" << std::endl;
01450    test_set_result=false;
01451   }
01452 
01454 
01455   std::cout << "Test 6: random pair of verticies move in random dir:" ;
01456 
01457   // Clear the mesh and reload original geometry for the next test
01458   result=reload_mesh( filename.c_str(), input_set);
01459   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01460 
01461   // retrieve the verticies again so the model can be broken
01462   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01463   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01464 
01465   // "Break" the geometry
01466   result=rand_locked_pair_bump_rand(verts, facet_tolerance , root_name); 
01467   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01468 
01469   // Seal the mesh
01470   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01471   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01472 
01473   // Lastly Check to see if make_watertight fixed the model
01474   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01475   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01476   
01477     if(sealed)
01478   {
01479    std::cout << "PASS" << std::endl << std::endl ;
01480   }
01481   else
01482   {
01483    std::cout << "FAIL" << std::endl << std::endl ;
01484    test_set_result=false;
01485   }
01486 
01487 
01489 
01490   if(test_set_result)
01491   {
01492    std::cout << "RANDOM LOCKED VERTEX PAIR MOVEMENT TESTS PASSED" << std::endl << std::endl;
01493   }
01494   else
01495   {
01496    std::cout << "RANDOM LOCKED VERTEX PAIR MOVEMENT TESTS FAILED" << std::endl << std::endl;
01497    exit(0);
01498   }
01499 
01500 
01502 
01503 std::cout << "ADJACENT PLUS ONE TESTS" << std::endl;
01504 
01506 
01507   std::cout << "Test 1: locked pair of verticies (adj+1) move in x:" ;
01508 
01509   // Clear the mesh and reload original geometry for the next test
01510   result=reload_mesh( filename.c_str(), input_set);
01511   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01512 
01513   // retrieve the verticies again so the model can be broken
01514   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01515   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01516 
01517   //"Break" the geometry
01518   result=adjplone_locked_pair_bump(verts, 0.9*facet_tolerance , 0 , 0 , root_name ); 
01519   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01520 
01521   // Seal the mesh
01522   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01523   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01524 
01525   // Lastly Check to see if make_watertight fixed the model
01526   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01527   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01528   
01529     if(sealed)
01530   {
01531    std::cout << "PASS" << std::endl;
01532   }
01533   else
01534   {
01535    std::cout << "FAIL" << std::endl;
01536    test_set_result=false;
01537   }
01538 
01540 
01541   std::cout << "Test 2: locked pair of verticies (adj+1) move in y:" ;
01542 
01543   // Clear the mesh and reload original geometry for the next test
01544   result=reload_mesh( filename.c_str(), input_set);
01545   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01546 
01547   // retrieve the verticies again so the model can be broken
01548   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01549   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01550 
01551   //"Break" the geometry
01552   result=adjplone_locked_pair_bump(verts, 0 , 0.9*facet_tolerance , 0 , root_name ); 
01553   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01554 
01555   // Seal the mesh
01556   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01557   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01558 
01559   // Lastly Check to see if make_watertight fixed the model
01560   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01561   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01562   
01563     if(sealed)
01564   {
01565    std::cout << "PASS" << std::endl;
01566   }
01567   else
01568   {
01569    std::cout << "FAIL" << std::endl;
01570    test_set_result=false;
01571   }
01572 
01574 
01575   std::cout << "Test 3: locked pair of verticies (adj+1) move in z:" ;
01576 
01577   // Clear the mesh and reload original geometry for the next test
01578   result=reload_mesh( filename.c_str(), input_set);
01579   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01580 
01581   // retrieve the verticies again so the model can be broken
01582   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01583   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01584 
01585   //"Break" the geometry
01586   result=adjplone_locked_pair_bump(verts, 0 , 0 , 0.9*facet_tolerance , root_name ); 
01587   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01588 
01589   // Seal the mesh
01590   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01591   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01592 
01593   // Lastly Check to see if make_watertight fixed the model
01594   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01595   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01596   
01597     if(sealed)
01598   {
01599    std::cout << "PASS" << std::endl;
01600   }
01601   else
01602   {
01603    std::cout << "FAIL" << std::endl;
01604    test_set_result=false;
01605   }
01606 
01608 
01609   std::cout << "Test 4: locked pair of verticies (adj+1) move in R:" ;
01610 
01611   // Clear the mesh and reload original geometry for the next test
01612   result=reload_mesh( filename.c_str(), input_set);
01613   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01614 
01615   // retrieve the verticies again so the model can be broken
01616   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01617   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01618 
01619   //"Break" the geometry
01620   result=adjplone_locked_pair_bump_R(verts, facet_tolerance , root_name ); 
01621   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01622  
01623   // Seal the mesh
01624   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01625   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01626 
01627   // Lastly Check to see if make_watertight fixed the model
01628   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01629   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01630   
01631     if(sealed)
01632   {
01633    std::cout << "PASS" << std::endl;
01634   }
01635   else
01636   {
01637    std::cout << "FAIL" << std::endl;
01638    test_set_result=false;
01639   }
01641 
01642   std::cout << "Test 5: locked pair of verticies (adj+1) move in theta:" ;
01643 
01644   // Clear the mesh and reload original geometry for the next test
01645   result=reload_mesh( filename.c_str(), input_set);
01646   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01647 
01648   // retrieve the verticies again so the model can be broken
01649   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01650   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01651 
01652   //"Break" the geometry
01653   result=adjplone_locked_pair_bump_theta(verts, facet_tolerance , root_name ); 
01654   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01655 
01656   // Seal the mesh
01657   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01658   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01659 
01660   // Lastly Check to see if make_watertight fixed the model
01661   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01662   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01663   
01664     if(sealed)
01665   {
01666    std::cout << "PASS" << std::endl;
01667   }
01668   else
01669   {
01670    std::cout << "FAIL" << std::endl;
01671    test_set_result=false;
01672   }
01673 
01675 
01676   std::cout << "Test 6: pair of verticies (adj+1) move in random dir:" ;
01677 
01678   // Clear the mesh and reload original geometry for the next test
01679   result=reload_mesh( filename.c_str(), input_set);
01680   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01681 
01682   // retrieve the verticies again so the model can be broken
01683   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01684   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01685 
01686   //"Break" the geometry
01687   result=adjplone_locked_pair_bump_rand(verts, facet_tolerance , root_name ); 
01688   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01689 
01690   // Seal the mesh
01691   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01692   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01693 
01694   // Lastly Check to see if make_watertight fixed the model
01695   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01696   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01697   
01698     if(sealed)
01699   {
01700    std::cout << "PASS" << std::endl << std::endl ;
01701   }
01702   else
01703    
01704   {
01705    std::cout << "FAIL" << std::endl << std::endl ;
01706    test_set_result=false;
01707   }
01708 
01710 
01711   if(test_set_result)
01712   {
01713    std::cout << "ADJACENT PLUS ONE VERTEX PAIR MOVEMENT TESTS PASSED" << std::endl << std::endl;
01714   }
01715   else
01716   {
01717    std::cout << "ADJACENT PLUS ONE VERTEX PAIR MOVEMENT TESTS FAILED" << std::endl << std::endl;
01718    exit(0);
01719   }
01720 
01721 
01723 
01724 std::cout << "NON-ADJACENT LOCKED PAIR TESTS" << std::endl;
01725 
01727 
01728   std::cout << "Test 1: non-adjacent locked pair of verticies move in x:" ;
01729 
01730   // Clear the mesh and reload original geometry for the next test
01731   result=reload_mesh( filename.c_str(), input_set);
01732   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01733 
01734   // retrieve the verticies again so the model can be broken
01735   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01736   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01737 
01738   //"Break" the geometry
01739   result= nonadj_locked_pair_bump(verts,  0.9*facet_tolerance , 0 , 0 , root_name ); 
01740   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01741 
01742   // Seal the mesh
01743   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01744   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01745 
01746   // Lastly Check to see if make_watertight fixed the model
01747   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01748   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01749   
01750     if(sealed)
01751   {
01752    std::cout << "PASS" << std::endl;
01753   }
01754   else
01755   {
01756    std::cout << "FAIL" << std::endl;
01757    test_set_result=false;
01758   }
01759 
01761 
01762   std::cout << "Test 2: non-adjacent locked pair of verticies move in y:" ;
01763 
01764   // Clear the mesh and reload original geometry for the next test
01765   result=reload_mesh( filename.c_str(), input_set);
01766   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01767 
01768   // retrieve the verticies again so the model can be broken
01769   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01770   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01771 
01772   //"Break" the geometry
01773   result= nonadj_locked_pair_bump(verts, 0 ,  0.9*facet_tolerance , 0 , root_name ); 
01774   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01775 
01776   // Seal the mesh
01777   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01778   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01779 
01780   // Lastly Check to see if make_watertight fixed the model
01781   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01782   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01783   
01784     if(sealed)
01785   {
01786    std::cout << "PASS" << std::endl;
01787   }
01788   else
01789   {
01790    std::cout << "FAIL" << std::endl;
01791    test_set_result=false;
01792   }
01793 
01794 
01796 
01797   std::cout << "Test 3: non-adjacent locked pair of verticies move in z:" ;
01798 
01799   // Clear the mesh and reload original geometry for the next test
01800   result=reload_mesh( filename.c_str(), input_set);
01801   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01802 
01803   // retrieve the verticies again so the model can be broken
01804   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01805   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01806 
01807   //"Break" the geometry
01808   result= nonadj_locked_pair_bump(verts, 0 , 0 ,  0.9*facet_tolerance  , root_name ); 
01809   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01810 
01811   // Seal the mesh
01812   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01813   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01814 
01815   // Lastly Check to see if make_watertight fixed the model
01816   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01817   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01818   
01819     if(sealed)
01820   {
01821    std::cout << "PASS" << std::endl;
01822   }
01823   else
01824   {
01825    std::cout << "FAIL" << std::endl;
01826    test_set_result=false;
01827   }
01828 
01830 
01831   std::cout << "Test 4: non-adjacent locked pair of verticies move in R:" ;
01832 
01833   // Clear the mesh and reload original geometry for the next test
01834   result=reload_mesh( filename.c_str(), input_set);
01835   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01836 
01837   // retrieve the verticies again so the model can be broken
01838   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01839   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01840 
01841   //"Break" the geometry
01842   result= nonadj_locked_pair_bump_R(verts, facet_tolerance , root_name ); 
01843   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01844 
01845   // write a new file for checking broken geometry
01846   result = write_mod_file( root_name);
01847   if(gen::error(MB_SUCCESS!=result, "could not write new file")) return result;
01848 
01849   // Seal the mesh
01850   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01851   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01852 
01853   // Lastly Check to see if make_watertight fixed the model
01854   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01855   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01856   
01857     if(sealed)
01858   {
01859    std::cout << "PASS" << std::endl;
01860   }
01861   else
01862   {
01863    std::cout << "FAIL" << std::endl;
01864    test_set_result=false;
01865   }
01866 
01868 
01869   std::cout << "Test 5: non-adjacent locked pair of verticies move in theta:" ;
01870 
01871   // Clear the mesh and reload original geometry for the next test
01872   result=reload_mesh( filename.c_str(), input_set);
01873   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01874 
01875   // retrieve the verticies again so the model can be broken
01876   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01877   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01878 
01879   //"Break" the geometry
01880   result= nonadj_locked_pair_bump_theta(verts, facet_tolerance , root_name ); 
01881   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01882 
01883   // Seal the mesh
01884   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01885   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01886 
01887   // Lastly Check to see if make_watertight fixed the model
01888   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01889   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01890   
01891     if(sealed)
01892   {
01893    std::cout << "PASS" << std::endl;
01894   }
01895   else
01896   {
01897    std::cout << "FAIL" << std::endl;
01898    test_set_result=false;
01899   }
01900 
01901 
01903 
01904   std::cout << "Test 6: non-adjacent pair of verticies move in random dir:" ;
01905 
01906   // Clear the mesh and reload original geometry for the next test
01907   result=reload_mesh( filename.c_str(), input_set);
01908   if (gen::error(MB_SUCCESS!=result, "could not reload the mesh" )) return result;
01909 
01910   // retrieve the verticies again so the model can be broken
01911   result = MBI()->get_entities_by_dimension(input_set, dim, verts, false);
01912   if(gen::error(MB_SUCCESS!=result, " could not get vertices from the mesh")) return result;
01913 
01914   //"Break" the geometry
01915   result= nonadj_locked_pair_bump_rand(verts, facet_tolerance , root_name ); 
01916   if(gen::error(MB_SUCCESS!=result, "could not create locked pair vertex bump test")) return result;
01917 
01918   // Seal the mesh
01919   result=mw_func::make_mesh_watertight (input_set, facet_tolerance, verbose);
01920   if(gen::error(MB_SUCCESS!=result, "could not make the mesh watertight")) return result;
01921 
01922   // Lastly Check to see if make_watertight fixed the model
01923   result=cw_func::check_mesh_for_watertightness( input_set, facet_tolerance, sealed, test);
01924   if(gen::error(MB_SUCCESS!=result, "could not check model for watertightness")) return result;
01925   
01926     if(sealed)
01927   {
01928    std::cout << "PASS" << std::endl << std::endl ;
01929   }
01930   else
01931   {
01932    std::cout << "FAIL" << std::endl << std::endl ;
01933    test_set_result=false;
01934   }
01935 
01936 
01938 
01939   if(test_set_result)
01940   {
01941    std::cout << "NON-ADJACENT LOCKED VERTEX PAIR MOVEMENT TESTS PASSED" << std::endl << std::endl;
01942   }
01943   else
01944   {
01945    std::cout << "NON-ADJACENT LOCKED VERTEX PAIR MOVEMENT TESTS FAILED" << std::endl << std::endl;
01946    exit(0);
01947   }
01948 
01949 
01950 }
01951 
01952 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines