MOAB: Mesh Oriented datABase
(version 5.4.1)
|
00001 /* ***************************************************************** 00002 MESQUITE -- The Mesh Quality Improvement Toolkit 00003 00004 Copyright 2010 Sandia National Laboratories. Developed at the 00005 University of Wisconsin--Madison under SNL contract number 00006 624796. The U.S. Government and the University of Wisconsin 00007 retain certain rights to this software. 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 (lgpl.txt) along with this library; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00023 (2011) kraftche@cae.wisc.edu 00024 00025 ***************************************************************** */ 00026 00027 /** \file voshell.cpp 00028 * \brief Implement some of the examples from N. Voshell. 00029 * \author Jason Kraftcheck 00030 * \author Nick Voshell 00031 */ 00032 00033 #include "TestUtil.hpp" 00034 #include "ShapeImprover.hpp" 00035 #include "UntangleWrapper.hpp" 00036 #include "MeshImpl.hpp" 00037 #include "MsqError.hpp" 00038 #include "QualityAssessor.hpp" 00039 00040 #include "PlanarDomain.hpp" 00041 #include "CylinderDomain.hpp" 00042 #include "SphericalDomain.hpp" 00043 #include "MeshDomain1D.hpp" 00044 #include "DomainClassifier.hpp" 00045 00046 #include "HexLagrangeShape.hpp" 00047 #include "TestUtil.hpp" 00048 00049 #include <iostream> 00050 #include <string> 00051 #include <cstdlib> 00052 00053 using namespace MBMesquite; 00054 00055 std::string get_homogenious_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00056 00057 std::string get_part_example_tri( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00058 00059 std::string get_part_example_quad( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00060 00061 std::string get_sphere_cube_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00062 00063 std::string get_cut_cube_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00064 00065 std::string get_sphere_cylinder_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00066 00067 std::string get_hex_3d_part_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00068 00069 typedef std::string ( *example_setup_t )( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ); 00070 struct Example 00071 { 00072 char flag; 00073 example_setup_t func; 00074 const char* desc; 00075 }; 00076 00077 int run_example( const Example& e, bool write_output_file ); 00078 00079 const Example examples[] = { { 'H', &get_homogenious_example, "homogenous mesh (curvey surface) example" }, 00080 { 't', &get_part_example_tri, "part mesh with triangles" }, 00081 { 'q', &get_part_example_quad, "part mesh with quads" }, 00082 { 'c', &get_sphere_cube_example, "cube with subtracted hemisphere" }, 00083 { 'l', &get_cut_cube_example, "cube with slot removed" }, 00084 { 's', &get_sphere_cylinder_example, "cylinder with subtracted sphere" }, 00085 { 'x', &get_hex_3d_part_example, "rectangular prism with two cylindrical slots" } }; 00086 const int num_examples = sizeof( examples ) / sizeof( examples[0] ); 00087 00088 void usage( const char* argv0, bool help = false ) 00089 { 00090 std::cerr << "Usage: " << argv0 << "[-w] "; 00091 for( int i = 0; i < num_examples; ++i ) 00092 std::cerr << " [-" << examples[i].flag << "]"; 00093 std::cerr << std::endl; 00094 00095 if( !help ) 00096 { 00097 std::cerr << " " << argv0 << " -h" << std::endl; 00098 std::exit( 1 ); 00099 } 00100 std::cerr << " -w : Write final meshes to VTK file" << std::endl; 00101 std::cerr << "NOTE: If no options are specified, all examples will be run" << std::endl; 00102 for( int i = 0; i < num_examples; ++i ) 00103 std::cerr << " -" << examples[i].flag << " : Run " << examples[i].desc << std::endl; 00104 std::cerr << std::endl; 00105 std::exit( 0 ); 00106 } 00107 00108 int main( int argc, char* argv[] ) 00109 { 00110 bool write_final_meshes = false; 00111 std::vector< Example > list; 00112 for( int i = 1; i < argc; ++i ) 00113 { 00114 if( argv[i][0] != '-' ) 00115 { 00116 std::cerr << "Invalid argument: \"" << argv[i] << '"' << std::endl; 00117 usage( argv[0] ); 00118 } 00119 for( int j = 1; argv[i][j]; ++j ) 00120 { 00121 if( argv[i][j] == 'w' ) 00122 { 00123 write_final_meshes = true; 00124 } 00125 else 00126 { 00127 int idx; 00128 for( idx = 0; idx < num_examples; ++idx ) 00129 if( examples[idx].flag == argv[i][j] ) break; 00130 if( idx == num_examples ) 00131 { 00132 if( argv[i][j] == 'h' ) 00133 usage( argv[0], true ); 00134 else 00135 { 00136 std::cerr << "Invalid flag: '" << argv[i][j] << "'" << std::endl; 00137 usage( argv[0] ); 00138 } 00139 } 00140 list.push_back( examples[idx] ); 00141 } 00142 } 00143 } 00144 00145 const Example* exlist; 00146 int exlistlen; 00147 if( list.empty() ) 00148 { 00149 exlist = examples; 00150 exlistlen = num_examples; 00151 } 00152 else 00153 { 00154 exlist = &list[0]; 00155 exlistlen = list.size(); 00156 } 00157 00158 int result = 0; 00159 for( int i = 0; i < exlistlen; ++i ) 00160 result += run_example( exlist[i], write_final_meshes ); 00161 00162 return result; 00163 } 00164 00165 int run_example( const Example& e, bool write_output_file ) 00166 { 00167 MsqPrintError err( std::cerr ); 00168 MeshImpl mesh; 00169 DomainClassifier domain; 00170 HexLagrangeShape hex27; 00171 00172 std::cout << std::endl 00173 << "--------------------------------------------------------------------" << std::endl 00174 << e.desc << std::endl 00175 << "--------------------------------------------------------------------" << std::endl; 00176 00177 std::string name = e.func( domain, mesh, err ); 00178 if( MSQ_CHKERR( err ) ) return 2; 00179 std::cout << "Loaded mesh from: " << name << std::endl; 00180 00181 UntangleWrapper untangler; 00182 untangler.set_slaved_ho_node_mode( Settings::SLAVE_NONE ); 00183 untangler.set_mapping_function( &hex27 ); 00184 MeshDomainAssoc mesh_and_domain = MeshDomainAssoc( &mesh, &domain, false, true ); 00185 untangler.run_instructions( &mesh_and_domain, err ); 00186 if( MSQ_CHKERR( err ) ) return 1; 00187 ShapeImprover smoother; 00188 smoother.set_slaved_ho_node_mode( Settings::SLAVE_NONE ); 00189 smoother.set_mapping_function( &hex27 ); 00190 smoother.set_vertex_movement_limit_factor( 0.05 ); 00191 smoother.run_instructions( &mesh_and_domain, err ); 00192 if( MSQ_CHKERR( err ) ) return 1; 00193 00194 if( write_output_file ) 00195 { 00196 size_t idx = name.find( ".vtk" ); 00197 if( idx != std::string::npos ) 00198 { 00199 std::string newname( name.substr( 0, idx ) ); 00200 newname += ".out"; 00201 newname += name.substr( idx ); 00202 name.swap( newname ); 00203 } 00204 else 00205 { 00206 name += ".out"; 00207 } 00208 00209 mesh.write_vtk( name.c_str(), err );MSQ_CHKERR( err ); 00210 std::cout << "Write mesh to file: " << name << std::endl; 00211 } 00212 00213 return smoother.quality_assessor().invalid_elements(); 00214 } 00215 00216 void get_planar_example( const char* filename, DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00217 { 00218 static PlanarDomain z( PlanarDomain::XY ); 00219 mesh.read_vtk( filename, err );MSQ_ERRRTN( err ); 00220 mesh.mark_skin_fixed( err );MSQ_ERRRTN( err ); 00221 DomainClassifier::DomainSet set( &z ); 00222 mesh.get_all_vertices( set.vertices, err );MSQ_ERRRTN( err ); 00223 mesh.get_all_elements( set.elements, err );MSQ_ERRRTN( err ); 00224 DomainClassifier::classify_by_handle( geom, &mesh, &set, 1, err );MSQ_ERRRTN( err ); 00225 } 00226 00227 std::string get_homogenious_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00228 { 00229 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/homogeneousPart.vtk"; 00230 get_planar_example( filename.c_str(), geom, mesh, err );MSQ_CHKERR( err ); 00231 return filename; 00232 } 00233 00234 std::string get_part_example_tri( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00235 { 00236 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/triPart.vtk"; 00237 get_planar_example( filename.c_str(), geom, mesh, err );MSQ_CHKERR( err ); 00238 return filename; 00239 } 00240 00241 std::string get_part_example_quad( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00242 { 00243 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/quadPart.vtk"; 00244 get_planar_example( filename.c_str(), geom, mesh, err );MSQ_CHKERR( err ); 00245 return filename; 00246 } 00247 00248 std::string get_sphere_cube_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00249 { 00250 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/sphereCube.vtk"; 00251 00252 const Vector3D vec_i( 5, 0, 0 ), vec_ni( -5, 0, 0 ); 00253 const Vector3D vec_j( 0, 5, 0 ), vec_nj( 0, -5, 0 ); 00254 const Vector3D vec_k( 0, 0, 5 ), vec_nk( 0, 0, -5 ); 00255 00256 const Vector3D vec_tfl( 5, -5, 5 ), vec_tfr( 5, 5, 5 ); 00257 const Vector3D vec_tbl( -5, -5, 5 ), vec_tbr( -5, 5, 5 ); 00258 const Vector3D vec_bfl( 5, -5, -5 ), vec_bfr( 5, 5, -5 ); 00259 const Vector3D vec_bbl( -5, -5, -5 ), vec_bbr( -5, 5, -5 ); 00260 00261 const Vector3D vec_ts( 5, 0, 2 ), vec_bs( 5, 0, -2 ); 00262 00263 //++ 0D domains ++ 00264 00265 static PointDomain pt_tfl( vec_tfl ), pt_tfr( vec_tfr ); 00266 static PointDomain pt_tbl( vec_tbl ), pt_tbr( vec_tbr ); 00267 static PointDomain pt_bfl( vec_bfl ), pt_bfr( vec_bfr ); 00268 static PointDomain pt_bbl( vec_bbl ), pt_bbr( vec_bbr ); 00269 00270 //++ 1D domains ++ 00271 00272 // top square 00273 static LineDomain ln_tf( vec_tfl, vec_j ), lin_tb( vec_tbr, vec_nj ); 00274 static LineDomain ln_tl( vec_tfl, vec_ni ), lin_tr( vec_tbr, vec_i ); 00275 // bottom square 00276 static LineDomain ln_bf( vec_bfl, vec_j ), lin_bb( vec_bbr, vec_nj ); 00277 static LineDomain ln_bl( vec_bfl, vec_ni ), lin_br( vec_bbr, vec_i ); 00278 // sides 00279 static LineDomain ln_lf( vec_bfl, vec_k ), lin_rf( vec_bfr, vec_k ); 00280 static LineDomain ln_lb( vec_bbl, vec_k ), lin_rb( vec_bbr, vec_k ); 00281 00282 // top sphere 00283 // CircleDomain cr_tf(vec_ts,vec_i,1.0), cr_tn(vec_ts,vec_k,1.0); 00284 // bottom sphere 00285 // CircleDomain cr_bf(vec_bs,vec_i,1.0), cr_bn(vec_bs,vec_k,1.0); 00286 static CircleDomain cr_ct( vec_k, vec_k, 1.0 ); 00287 00288 //++ 2D domains ++ 00289 00290 // cube 00291 static PlanarDomain sf_i( vec_i, vec_i ), sf_ni( vec_ni, vec_ni ); 00292 static PlanarDomain sf_j( vec_j, vec_j ), sf_nj( vec_nj, vec_nj ); 00293 static PlanarDomain sf_k( vec_k, vec_k ), sf_nk( vec_nk, vec_nk ); 00294 // cut 00295 // CylinderDomain cy(1.0,vec_k,vec_bs); 00296 static SphericalDomain sp_t( vec_k, 1.0 ); //, sp_b(vec_bs,1.0); 00297 00298 MeshDomain* base_domains[] = { 00299 &pt_tfl, &pt_tfr, &pt_tbl, &pt_tbr, &pt_bfl, &pt_bfr, &pt_bbl, &pt_bbr, 00300 00301 &ln_tf, &lin_tb, &ln_tl, &lin_tr, &ln_bf, &lin_bb, &ln_bl, &lin_br, &ln_lf, &lin_rf, &ln_lb, &lin_rb, 00302 00303 // &cr_tf, &cr_tn, 00304 // &cr_bf, &cr_bn, 00305 &cr_ct, 00306 00307 &sf_i, &sf_ni, &sf_j, &sf_nj, &sf_k, &sf_nk, 00308 //&cy, 00309 &sp_t //, &sp_b 00310 }; 00311 const int NDOM = sizeof( base_domains ) / sizeof( base_domains[0] ); 00312 00313 int dim_array[NDOM] = { 00314 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1,1,1, 00315 2, 2, 2, 2, 2, 2, 2 //,2,2 00316 }; 00317 00318 //++ MESH & DOMAIN ++ 00319 00320 mesh.read_vtk( filename.c_str(), err ); 00321 MSQ_ERRZERO( err ); 00322 DomainClassifier::classify_skin_geometrically( geom, &mesh, 0.1, base_domains, dim_array, NDOM, err ); 00323 MSQ_ERRZERO( err ); 00324 mesh.set_skin_flags( false, false, true, err ); 00325 MSQ_ERRZERO( err ); 00326 00327 return filename; 00328 } 00329 00330 std::string get_cut_cube_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00331 { 00332 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/cutCube.vtk"; 00333 00334 const Vector3D vec_i( 5, 0, 0 ), vec_ni( -5, 0, 0 ); 00335 const Vector3D vec_j( 0, 5, 0 ), vec_nj( 0, -5, 0 ); 00336 const Vector3D vec_k( 0, 0, 5 ), vec_nk( 0, 0, -5 ); 00337 00338 const Vector3D vec_tfl( 5, -5, 5 ), vec_tfr( 5, 5, 5 ); 00339 const Vector3D vec_tbl( -5, -5, 5 ), vec_tbr( -5, 5, 5 ); 00340 const Vector3D vec_bfl( 5, -5, -5 ), vec_bfr( 5, 5, -5 ); 00341 const Vector3D vec_bbl( -5, -5, -5 ), vec_bbr( -5, 5, -5 ); 00342 00343 const Vector3D vec_ts( 5, 0, 2 ), vec_bs( 5, 0, -2 ); 00344 00345 //++ 0D domains ++ 00346 00347 static PointDomain pt_tfl( vec_tfl ), pt_tfr( vec_tfr ); 00348 static PointDomain pt_tbl( vec_tbl ), pt_tbr( vec_tbr ); 00349 static PointDomain pt_bfl( vec_bfl ), pt_bfr( vec_bfr ); 00350 static PointDomain pt_bbl( vec_bbl ), pt_bbr( vec_bbr ); 00351 00352 //++ 1D domains ++ 00353 00354 // top square 00355 static LineDomain ln_tf( vec_tfl, vec_j ), lin_tb( vec_tbr, vec_nj ); 00356 static LineDomain ln_tl( vec_tfl, vec_ni ), lin_tr( vec_tbr, vec_i ); 00357 // bottom square 00358 static LineDomain ln_bf( vec_bfl, vec_j ), lin_bb( vec_bbr, vec_nj ); 00359 static LineDomain ln_bl( vec_bfl, vec_ni ), lin_br( vec_bbr, vec_i ); 00360 // sides 00361 static LineDomain ln_lf( vec_bfl, vec_k ), lin_rf( vec_bfr, vec_k ); 00362 static LineDomain ln_lb( vec_bbl, vec_k ), lin_rb( vec_bbr, vec_k ); 00363 00364 // top sphere 00365 static CircleDomain cr_tf( vec_ts, vec_i, 1.0 ), cr_tn( vec_ts, vec_k, 1.0 ); 00366 // bottom sphere 00367 static CircleDomain cr_bf( vec_bs, vec_i, 1.0 ), cr_bn( vec_bs, vec_k, 1.0 ); 00368 00369 //++ 2D domains ++ 00370 00371 // cube 00372 static PlanarDomain sf_i( vec_i, vec_i ), sf_ni( vec_ni, vec_ni ); 00373 static PlanarDomain sf_j( vec_j, vec_j ), sf_nj( vec_nj, vec_nj ); 00374 static PlanarDomain sf_k( vec_k, vec_k ), sf_nk( vec_nk, vec_nk ); 00375 // cut 00376 static CylinderDomain cy( 1.0, vec_k, vec_bs ); 00377 static SphericalDomain sp_t( vec_ts, 1.0 ), sp_b( vec_bs, 1.0 ); 00378 00379 MeshDomain* base_domains[] = { &pt_tfl, &pt_tfr, &pt_tbl, &pt_tbr, &pt_bfl, &pt_bfr, &pt_bbl, &pt_bbr, 00380 00381 &ln_tf, &lin_tb, &ln_tl, &lin_tr, &ln_bf, &lin_bb, &ln_bl, &lin_br, &ln_lf, 00382 &lin_rf, &ln_lb, &lin_rb, &cr_tf, &cr_tn, &cr_bf, &cr_bn, 00383 00384 &sf_i, &sf_ni, &sf_j, &sf_nj, &sf_k, &sf_nk, &cy, &sp_t, &sp_b }; 00385 const int NDOM = sizeof( base_domains ) / sizeof( base_domains[0] ); 00386 00387 int dim_array[NDOM] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00388 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; 00389 00390 //++ MESH & DOMAIN ++ 00391 00392 mesh.read_vtk( filename.c_str(), err ); 00393 MSQ_ERRZERO( err ); 00394 DomainClassifier::classify_skin_geometrically( geom, &mesh, 0.1, base_domains, dim_array, NDOM, err ); 00395 MSQ_ERRZERO( err ); 00396 mesh.set_skin_flags( false, false, true, err ); 00397 MSQ_ERRZERO( err ); 00398 00399 return filename; 00400 } 00401 00402 std::string get_sphere_cylinder_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00403 { 00404 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/sphereCylinder_1194_inv.vtk"; 00405 00406 const Vector3D vec_k( 0, 0, 8 ), vec_nk( 0, 0, -8 ); 00407 const Vector3D vec_c( 0, 0, 5 ); 00408 00409 //++ 0D domains ++ 00410 00411 //++ 1D domains ++ 00412 00413 // top circle 00414 static CircleDomain cr_to( vec_k, vec_k, 8.0 ), cr_ti( vec_k, vec_k, 4.0 ); 00415 // bottom circle 00416 static CircleDomain cr_bo( vec_nk, vec_nk, 8.0 ); 00417 00418 //++ 2D domains ++ 00419 00420 static PlanarDomain sf_t( vec_k, vec_k ), sf_b( vec_nk, vec_nk ); 00421 static CylinderDomain cy( 8.0, vec_k, vec_k ); 00422 static SphericalDomain sp( vec_c, 5.0 ); 00423 00424 MeshDomain* base_domains[] = { &cr_to, &cr_ti, &cr_bo, &sf_t, &sf_b, &cy, &sp }; 00425 const int NDOM = sizeof( base_domains ) / sizeof( base_domains[0] ); 00426 00427 int dim_array[NDOM] = { 1, 1, 1, 2, 2, 2, 2 }; 00428 00429 //++ MESH & DOMAIN ++ 00430 00431 mesh.read_vtk( filename.c_str(), err ); 00432 MSQ_ERRZERO( err ); 00433 DomainClassifier::classify_skin_geometrically( geom, &mesh, 0.001, base_domains, dim_array, NDOM, err ); 00434 MSQ_ERRZERO( err ); 00435 mesh.set_skin_flags( false, false, true, err ); 00436 MSQ_ERRZERO( err ); 00437 00438 return filename; 00439 } 00440 00441 std::string get_hex_3d_part_example( DomainClassifier& geom, MeshImpl& mesh, MsqError& err ) 00442 { 00443 std::string filename = std::string( STRINGIFY( SRCDIR ) ) + "/hex3Dpart.vtk"; 00444 00445 // 2D domains 00446 00447 const Vector3D vec_i( 1, 0, 0 ), vec_j( 0, 1, 0 ), vec_k( 0, 0, 1 ); 00448 const Vector3D vec_ni( -1, 0, 0 ), vec_nj( 0, -1, 0 ), vec_nk( 0, 0, -1 ); 00449 00450 const Vector3D vec_left( -11.5, 0, 0 ), vec_right( 11.5, 0, 0 ); 00451 const Vector3D vec_top( 0, 5, 0 ), vec_bottom( 0, -5, 0 ); 00452 const Vector3D vec_front( 0, 0, 5 ), vec_back( 0, 0, -5 ); 00453 00454 // 1D domains 00455 00456 const Vector3D pt_top_front( 0, 5, 5 ), pt_top_back( 0, 5, -5 ); 00457 const Vector3D pt_bottom_front( 0, -5, 5 ), pt_bottom_back( 0, -5, -5 ); 00458 00459 const Vector3D pt_top_left( -11.5, 5, 0 ), pt_top_right( 11.5, 5, 0 ); 00460 const Vector3D pt_bottom_left( -11.5, -5, 0 ), pt_bottom_right( 11.5, -5, 0 ); 00461 00462 const Vector3D pt_left_front( -11.5, 0, 5 ), pt_left_back( -11.5, 0, -5 ); 00463 const Vector3D pt_right_front( 11.5, 0, 5 ), pt_right_back( 11.5, 0, -5 ); 00464 00465 const Vector3D cpt_top_left( -1.5, 5, 0 ), cpt_top_right( 1.5, 5, 0 ); 00466 const Vector3D cpt_bottom_left( -1.5, -5, 0 ), cpt_bottom_right( 1.5, -5, 0 ); 00467 00468 // 0D domains 00469 00470 const Vector3D pt_tlf( -11.5, 5, 5 ), pt_tlb( -11.5, 5, -5 ); 00471 const Vector3D pt_trf( 11.5, 5, 5 ), pt_trb( 11.5, 5, -5 ); 00472 const Vector3D pt_blf( -11.5, -5, 5 ), pt_blb( -11.5, -5, -5 ); 00473 const Vector3D pt_brf( 11.5, -5, 5 ), pt_brb( 11.5, -5, -5 ); 00474 00475 const Vector3D pt_c_tlf( -1.5, 5, 5 ), pt_c_tlb( -1.5, 5, -5 ); 00476 const Vector3D pt_c_trf( 1.5, 5, 5 ), pt_c_trb( 1.5, 5, -5 ); 00477 const Vector3D pt_c_blf( -1.5, -5, 5 ), pt_c_blb( -1.5, -5, -5 ); 00478 const Vector3D pt_c_brf( 1.5, -5, 5 ), pt_c_brb( 1.5, -5, -5 ); 00479 00480 static PointDomain p00( pt_tlf ); 00481 static PointDomain p01( pt_tlb ); 00482 static PointDomain p02( pt_trf ); 00483 static PointDomain p03( pt_trb ); 00484 static PointDomain p04( pt_blf ); 00485 static PointDomain p05( pt_blb ); 00486 static PointDomain p06( pt_brf ); 00487 static PointDomain p07( pt_brb ); 00488 00489 static PointDomain p08( pt_c_tlf ); 00490 static PointDomain p09( pt_c_tlb ); 00491 static PointDomain p10( pt_c_trf ); 00492 static PointDomain p11( pt_c_trb ); 00493 static PointDomain p12( pt_c_blf ); 00494 static PointDomain p13( pt_c_blb ); 00495 static PointDomain p14( pt_c_brf ); 00496 static PointDomain p15( pt_c_brb ); 00497 00498 static CircleDomain c00( pt_top_front, vec_k, 1.5 ); 00499 static CircleDomain c01( pt_top_back, vec_k, 1.5 ); 00500 static CircleDomain c02( pt_bottom_front, vec_k, 1.5 ); 00501 static CircleDomain c03( pt_bottom_back, vec_k, 1.5 ); 00502 00503 static LineDomain l00( cpt_top_left, vec_k ); 00504 static LineDomain l01( cpt_top_right, vec_k ); 00505 static LineDomain l02( cpt_bottom_left, vec_k ); 00506 static LineDomain l03( cpt_bottom_right, vec_k ); 00507 00508 static LineDomain l04( pt_top_front, vec_i ); 00509 static LineDomain l05( pt_top_back, vec_i ); 00510 static LineDomain l06( pt_bottom_front, vec_i ); 00511 static LineDomain l07( pt_bottom_back, vec_i ); 00512 static LineDomain l08( pt_top_left, vec_k ); 00513 static LineDomain l09( pt_top_right, vec_k ); 00514 static LineDomain l10( pt_bottom_left, vec_k ); 00515 static LineDomain l11( pt_bottom_right, vec_k ); 00516 static LineDomain l12( pt_left_front, vec_j ); 00517 static LineDomain l13( pt_left_back, vec_j ); 00518 static LineDomain l14( pt_right_front, vec_j ); 00519 static LineDomain l15( pt_right_back, vec_j ); 00520 00521 static CylinderDomain C00( 1.5, vec_k, vec_top, false ); 00522 static CylinderDomain C01( 1.5, vec_k, vec_bottom, false ); 00523 static PlanarDomain P00( vec_ni, vec_left ); 00524 static PlanarDomain P01( vec_i, vec_right ); 00525 static PlanarDomain P02( vec_j, vec_top ); 00526 static PlanarDomain P03( vec_nj, vec_bottom ); 00527 static PlanarDomain P04( vec_k, vec_front ); 00528 static PlanarDomain P05( vec_nk, vec_back ); 00529 00530 const int NDOM = 44; 00531 MeshDomain* base_domains[NDOM] = { &p00, &p01, &p02, &p03, &p04, &p05, &p06, &p07, 00532 00533 &p08, &p09, &p10, &p11, &p12, &p13, &p14, &p15, 00534 00535 &c00, &c01, &c02, &c03, 00536 00537 &l00, &l01, &l02, &l03, 00538 00539 &l04, &l05, &l06, &l07, &l08, &l09, &l10, &l11, &l12, &l13, &l14, &l15, 00540 00541 &C00, &C01, &P00, &P01, &P02, &P03, &P04, &P05 }; 00542 00543 int dim_array[NDOM] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 00544 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 }; 00545 00546 //++ MESH & DOMAIN ++ 00547 00548 mesh.read_vtk( filename.c_str(), err ); 00549 MSQ_ERRZERO( err ); 00550 DomainClassifier::classify_skin_geometrically( geom, &mesh, 0.1, base_domains, dim_array, NDOM, err ); 00551 MSQ_ERRZERO( err ); 00552 mesh.set_skin_flags( false, false, true, err ); 00553 MSQ_ERRZERO( err ); 00554 00555 return filename; 00556 }