- Timestamp:
- 03/25/09 19:16:24 (12 months ago)
- Location:
- ddriv/trunk
- Files:
-
- 21 modified
-
DdrivDerivs.cpp (modified) (38 diffs)
-
DdrivDerivs.hpp (modified) (9 diffs)
-
GeomGenerator.cpp (modified) (1 diff)
-
Makefile (modified) (3 diffs)
-
MkCone.cpp (modified) (13 diffs)
-
MkCyl.cpp (modified) (2 diffs)
-
MkDDSCell.cpp (modified) (72 diffs)
-
MkEllCyl.cpp (modified) (3 diffs)
-
MkILCCell.cpp (modified) (17 diffs)
-
MkILCEndCell.cpp (modified) (1 diff)
-
MkRFSwitch.cpp (modified) (1 diff)
-
MkRFSwitchReal.cpp (modified) (69 diffs)
-
MkTwoCyls.cpp (modified) (6 diffs)
-
MkUser.cpp (modified) (2 diffs)
-
O3PXlate.cpp (modified) (5 diffs)
-
O3PXlate.hpp (modified) (5 diffs)
-
OptUtils.cpp (modified) (9 diffs)
-
OptUtils.hpp (modified) (6 diffs)
-
SmoothUtils.cpp (modified) (12 diffs)
-
SmoothUtils.hpp (modified) (1 diff)
-
ddriv.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ddriv/trunk/DdrivDerivs.cpp
r2696 r2754 15 15 #include "MsqError.hpp" 16 16 #include "LaplacianIQ.hpp" 17 #include "iBase_SNL_SIDL_defs.h"18 17 19 18 #include <iostream> … … 34 33 #define CV_S_INDEX(cv, s) (s*(handle_index_vecs[0].size()+handle_index_vecs[1].size())+cv) 35 34 36 #define CE catch (iBase::Error err)\37 {std::cerr << "Error msg: " << err.getDescription()<< "." << std::endl; return false;}35 #define CE(e) if (ierr != iBase_SUCCESS) { \ 36 std::cerr << "Error msg: " << e << "." << std::endl; return false;} 38 37 39 38 #define RS if (!success) return success; … … 42 41 // and the list of parameter names 43 42 DdrivDerivs::DdrivDerivs(OptUtils &ou, SmoothUtils &su, GeomGenerator *gg) 44 : myOu(ou), mySu(su), myGeomGenerator(gg), adj_cv_s(NULL), infl_scl_p(NULL),45 infl_cv_p(NULL)43 : myOu(ou), mySu(su), myGeomGenerator(gg), adj_cv_s(NULL), infl_scl_p(NULL), 44 infl_cv_p(NULL) 46 45 47 46 { … … 89 88 // (STEPS 4, 6) GENERATE MODIFIED MODELS 90 89 91 // su->smoother_driver("T");90 // su->smoother_driver("T"); 92 91 // 1. build the overall topology graph 93 92 success = build_topology_graph(adj_cv_s, handle_index_vecs); RS; … … 139 138 { 140 139 bool success; 140 int ierr; 141 141 142 142 if (myDParams.empty()) { … … 153 153 mySu.my_algorithm(SmoothUtils::DEFORMING); 154 154 155 // allocate a set for meshsets for use later in restoring vertex coords156 std::set<iBase_Entity Handle> saved_msets;155 // allocate a set for meshsets for use later in restoring vertex coords 156 std::set<iBase_EntitySetHandle> saved_msets; 157 157 158 158 int pmax = myGeomGenerator->num_params(); … … 165 165 166 166 // a. reset classification data and model 167 myOu. myRelate.removeRelations(&myOu.myGeom, &myOu.myMesh);167 myOu.reset_relation(true); 168 168 myGeomGenerator->reset_model(); 169 169 … … 192 192 193 193 // c. Relate mesh for those entities 194 try{195 for (int i = 0; i < 3; i++) 196 myOu.myRelate.relateGeomEntities(&myOu.myGeom, &myOu.myMesh, gents[i], gents_size[i]);197 // myOu.myRelate.relateAllEntities(&myOu.myGeom, &myOu.myMesh);194 for (int i = 0; i < 3; i++) { 195 iRel_inferEntArrAssociations(myOu.myRel, myOu.myRelH, &gents[i][0], gents_size[i], 196 0, &ierr); 197 CE("Trouble inferring relations for entities."); 198 198 } 199 catch (iBase::Error) {200 return false;201 }202 199 203 200 // f. smooth 2d geom entities dependent on p 204 success = mySu.smooth(gents[1] , gents_size[1]);RS;205 success = myOu.project_to_geom( gents[0], gents_size[0]);RS;201 success = mySu.smooth(gents[1]);RS; 202 success = myOu.project_to_geom(&gents[0][0], gents[0].size());RS; 206 203 207 204 if (debug_output_models) { … … 211 208 212 209 char* options; 213 iMesh_save( myOu.myMesh, mfilename, options, &result, strlen(mfilename), 0); 214 215 success = mySu.smooth(gents[2], gents_size[2]);RS; 210 iBase_EntitySetHandle root_set; 211 iMesh_getRootSet(myOu.myMesh, &root_set, &ierr); 212 CE("Couldn't get root set."); 213 214 iMesh_save( myOu.myMesh, root_set, mfilename.c_str(), options, &ierr, mfilename.length(), 0); 215 216 success = mySu.smooth(gents[2]);RS; 216 217 mfilename = "tmp_mesh_p"; 217 218 mfilename += myOu.itoa(p); 218 219 mfilename += "_after.vtk"; 219 try {myOu.myMesh.save(0, mfilename);} catch (iBase::Error) {return false;}220 iMesh_save( myOu.myMesh, root_set, mfilename.c_str(), options, &ierr, mfilename.length(), 0); 220 221 } 221 222 222 223 else 223 success = mySu.smooth(gents[2] , gents_size[2]);RS;224 success = mySu.smooth(gents[2]);RS; 224 225 } 225 226 226 227 // g. Compute d(xyz)/dp & store in tag on vertices 227 // h. Compute d(n)/dp for all surf vertices & store in tag on them228 // h. Compute d(n)/dp for all surf vertices & store in tag on them 228 229 success = store_coords_normals(bogus_derivs, 229 230 gents[2], gents_size[2], 2, … … 231 232 myOu.origCoords_tag(), myOu.normal_tag(), myDParams[p]); RS; 232 233 233 // i. Compute d(n)/dp for all surfs containing curve & vertex mesh vertices &234 // store in tag on them234 // i. Compute d(n)/dp for all surfs containing curve & vertex mesh vertices & 235 // store in tag on them 235 236 success = store_coords_normals(bogus_derivs, 236 237 gents[1], gents_size[1], 1, … … 246 247 for (int i = 0; i < 3; i++) { 247 248 if (0 == gents_size[i]) continue; 248 std::vector<iBase_EntityHandle> tmp_msets;249 int tmp_msets_size ;250 try {251 myOu.myRelate.getGeomRelatedEntities(&myOu.myGeom, &myOu.myMesh,252 gents[i], gents_size[i],253 tmp_msets, tmp_msets_size);254 } CE;255 iBase_EntityHandle *msets_ptr = ARRAY_PTR(tmp_msets, iBase_EntityHandle);256 saved_msets.insert(msets_ptr, msets_ptr+tmp_msets_size);249 iBase_EntitySetHandle *tmp_msets = NULL; 250 int tmp_msets_size, tmp_msets_alloc = 0; 251 iRel_getEntArrSetArrAssociation(myOu.myRel, myOu.myRelH, 252 &gents[i][0], gents_size[i], 0, 253 &tmp_msets, &tmp_msets_alloc, &tmp_msets_size, 254 &ierr); 255 CE("Couldn't get relation."); 256 std::copy(tmp_msets, tmp_msets+tmp_msets_size, 257 std::inserter(saved_msets, saved_msets.begin())); 257 258 } 258 259 } // for p = ... 259 260 260 261 // ok, success; reset model, removing classifications too 261 myOu. myRelate.removeRelations(&myOu.myGeom, &myOu.myMesh);262 myOu.reset_relation(true); 262 263 myGeomGenerator->reset_model(); 263 264 264 // finally, reset coords for the msets whose vertices were moved265 // finally, reset coords for the msets whose vertices were moved 265 266 if (debug) 266 267 std::cout << "Resetting coords on " << saved_msets.size() << " msets." << std::endl; … … 272 273 myGeomGenerator->get_params(new_params); 273 274 success = myGeomGenerator->generate_model(&new_params[0], new_params.size()); RS; 274 myOu.myRelate.relateAllEntities(&myOu.myGeom, &myOu.myMesh); 275 iRel_inferAllAssociations(myOu.myRel, myOu.myRelH, &ierr); 276 CE("Unable to infer all relations."); 275 277 276 278 if (debug) … … 302 304 iBase_EntitySetHandle& new_set) 303 305 { 304 int err; 305 306 // make a new set 307 CAST_iBase_INTERFACE(myOu.myMesh, mesh_eset, EntSet); 308 309 iMesh_createEntSet( mesh_eset, 1, new_set, &ierr ); 310 CHKERR; 306 int ierr; 307 308 // make a new mesh entity set 309 iMesh_createEntSet(myOu.myMesh, 1, &new_set, &ierr); 310 CE("Couldn't make a new set."); 311 311 312 312 // get all the dim-dimensional entities … … 314 314 for (std::vector<iBase_EntityHandle>::iterator vit = gents.begin(); 315 315 vit != gents.end(); vit++) { 316 std::vector<iBase_EntityHandle> tmp_ments; 317 int tmp_ments_size; 318 myOu.myRelate.getGeomOwnedMesh(&myOu.myGeom, &myOu.myMesh, *vit, 2, 319 tmp_ments, tmp_ments_size); 320 append_from_sidl(tmp_ments, tmp_ments_size, set_ments); 316 iBase_EntityHandle *tmp_ments = NULL; 317 int tmp_ments_alloc = 0, tmp_ments_size; 318 iRel_getEntEntArrAssociation(myOu.myRel, myOu.myRelH, *vit, 0, 319 &tmp_ments, &tmp_ments_alloc, &tmp_ments_size, 320 &ierr); 321 CE("Couldn't get related mesh entities."); 322 std::copy(tmp_ments, tmp_ments+tmp_ments_size, std::back_inserter(set_ments)); 323 free(tmp_ments); 321 324 } 322 325 323 326 // now put them all in the set 324 iMesh_addEntArrToSet( mesh_eset, &set_ments[0], set_ments.size(), 325 new_set, &ierr ); 326 CHKERR; 327 328 return true; 329 } 330 331 //! for surfaces, get mesh vertex coordinates and normals at those vertices, 332 //! compute derivatives if old_xxx_tag is non-zero, then store results in xxx_tag 333 //! variant that works on all entities of given dimension 334 bool DdrivDerivs::store_coords_normals(const bool bogus_derivs, 335 std::vector<iBase_EntityHandle> *handle_index_vecs, 336 const int gent_dim, 337 TagHandle coord_tag, TagHandle normal_tag, 338 TagHandle old_coord_tag, TagHandle old_normal_tag, 339 const double dp) 340 { 341 // do coords & normals on surfaces 342 int gents_size = handle_index_vecs[gent_dim].size(); 343 std::vector<iBase_EntityHandle> gents(convert_to_sidl_vector(&handle_index_vecs[gent_dim][0], 344 gents_size)); 345 346 return store_coords_normals(bogus_derivs, gents, gents_size, gent_dim, 347 coord_tag, normal_tag, old_coord_tag, old_normal_tag, 348 dp); 327 iMesh_addEntArrToSet(myOu.myMesh, &set_ments[0], set_ments.size(), new_set, 328 &ierr ); 329 CE("Couldn't add to set."); 330 331 return true; 349 332 } 350 333 … … 356 339 const int gents_size, 357 340 const int gent_dim, 358 TagHandle coord_tag,TagHandle normal_tag,359 TagHandle old_coord_tag,TagHandle old_normal_tag,341 iBase_TagHandle coord_tag, iBase_TagHandle normal_tag, 342 iBase_TagHandle old_coord_tag, iBase_TagHandle old_normal_tag, 360 343 const double dp) 361 344 { 362 345 363 int err;364 365 std::vector<MentitySetHandle> msets;366 int msets_ size;367 try {368 myOu.myRelate.getGeomRelatedEntities(&myOu.myGeom, &myOu.myMesh,369 gents, gents_size, msets, msets_size);370 } catch (iBase::Error) {return false;}346 int ierr; 347 348 iBase_EntitySetHandle *msets = NULL; 349 int msets_alloc = 0, msets_size; 350 iRel_getEntArrSetArrAssociation(myOu.myRel, myOu.myRelH, 351 &gents[0], gents.size(), 0, &msets, &msets_alloc, &msets_size, 352 &ierr); 353 CE("Couldn't get related mesh entity sets."); 371 354 372 355 for (int g = 0; g < msets_size; g++) { … … 383 366 384 367 // grab the geom and mesh entity handles and index right away 385 iBase_EntityHandle this_gent = gents .get(g);386 iBase_Entity Handle this_ment = msets.get(g);368 iBase_EntityHandle this_gent = gents[g]; 369 iBase_EntitySetHandle this_ment = msets[g]; 387 370 assert(0 != this_gent && 0 != this_ment); 388 371 389 // get the mesh vertices and their coordinates for this gent390 391 // get mesh vertices in this_mset372 // get the mesh vertices and their coordinates for this gent 373 374 // get mesh vertices in this_mset 392 375 iBase_EntityHandle *mverts = NULL; 393 376 int mverts_alloc = 0, mverts_size; 394 377 int result; 395 378 iMesh_getEntities(myOu.myMesh, this_ment, 396 i Mesh::EntityType_VERTEX,397 iMesh ::EntityTopology_ALL_TOPOLOGIES,379 iBase_VERTEX, 380 iMesh_ALL_TOPOLOGIES, 398 381 &mverts, &mverts_alloc, &mverts_size, &result); 399 382 400 383 if (iBase_SUCCESS != result) { 401 384 char dum_str[256]; 402 iMesh_getDescription(my Mesh, dum_str, &result, 256);385 iMesh_getDescription(myOu.myMesh, dum_str, &result, 256); 403 386 std::cerr << "Couldn't get entities in set in reset_coords." 404 387 << std::endl … … 415 398 int coords_size, avg_normals_size; 416 399 bool success = myOu.get_coords(mverts, mverts_size, 417 coords , coords_size); RS;400 coords); RS; 418 401 419 402 // allocate space for the avg normals, same size as coords array 420 avg_normals = avg_normals.create1d(coords_size); 421 avg_normals_size = coords_size; 403 avg_normals.resize(coords.size()); 422 404 423 405 // get the connected surfaces 424 406 std::vector<iBase_EntityHandle> all_gsurfs; 425 int all_gsurfs_size; 426 success = myOu.get_connected_surfs(this_gent, gent_dim, all_gsurfs, all_gsurfs_size); 407 success = myOu.get_connected_surfs(this_gent, gent_dim, all_gsurfs); 427 408 if (!success) return success; 428 409 … … 452 433 if (0 != old_coord_tag) 453 434 compute_vector_difference(mverts, mverts_size, 454 coords, coords_size, old_coord_tag, dp); 455 435 coords, old_coord_tag, dp); 456 436 } 457 437 458 438 // now set the coords and normal tags on those vertices 459 iMesh_setDblArrData ( mesh_atag, mverts, mverts_size, coord_tag, 460 coords, coords_size, &err); 461 CE; 439 iMesh_setDblArrData (myOu.myMesh, mverts, mverts_size, coord_tag, 440 &coords[0], coords_size, &ierr); 441 CE("Couldn't set coords/normals tag."); 442 443 free(mverts); 462 444 } 463 445 … … 469 451 //! derivatives and surface normal derivatives 470 452 bool DdrivDerivs::compute_vector_difference(std::vector<iBase_EntityHandle> &mverts, 453 std::vector<double> &new_vec, 454 iBase_TagHandle old_vec_tag, 455 const double dp) 456 { 457 return compute_vector_difference(&mverts[0], mverts.size(), new_vec, old_vec_tag, dp); 458 } 459 460 bool DdrivDerivs::compute_vector_difference(iBase_EntityHandle *mverts, 471 461 const int mverts_size, 472 462 std::vector<double> &new_vec, 473 const int new_vec_size, 474 TagHandle old_vec_tag, 463 iBase_TagHandle old_vec_tag, 475 464 const double dp) 476 465 { 477 int err;466 int ierr; 478 467 479 468 // given new values and a tag which holds old values, compute the differences and … … 483 472 484 473 // get the old values 485 std::vector<char> old_vec; 486 int old_vec_size; 487 CAST_iBase_INTERFACE(myOu.myMesh, mesh_atag, ArrTag); 488 try { 489 mesh_atag.getArrData(mverts, mverts_size, old_vec_tag, 490 old_vec, old_vec_size); 491 } CE; 492 493 double *old_vec_ptr = reinterpret_cast<double*>(old_vec._get_ior()->d_firstElement); 494 double *new_vec_ptr = reinterpret_cast<double*>(new_vec._get_ior()->d_firstElement); 474 char *old_vec = NULL; 475 int old_vec_alloc = 0, old_vec_size; 476 iMesh_getArrData(myOu.myMesh, mverts, mverts_size, old_vec_tag, 477 &old_vec, &old_vec_alloc, &old_vec_size, &ierr); 478 CE("Couldn't get old tag values."); 479 480 double *old_vec_ptr = reinterpret_cast<double*>(old_vec); 481 double *new_vec_ptr = reinterpret_cast<double*>(&new_vec[0]); 495 482 496 483 double denom = 1.0 / dp; … … 517 504 } 518 505 else { 519 for (int i = 0; i < 3*mverts_size; i++) {520 double deriv = (new_vec.get(i)- old_vec_ptr[i])*denom;521 new_vec.set(i, deriv);522 } 523 }506 for (int i = 0; i < 3*mverts_size; i++) 507 new_vec[i] = (new_vec[i] - old_vec_ptr[i])*denom; 508 } 509 510 free(old_vec); 524 511 525 512 return true; … … 533 520 { 534 521 std::vector<iBase_EntityHandle>::iterator handle_index = 535 std::find(handle_index_vecs[dim].begin(),536 handle_index_vecs[dim].end(), this_gent);522 std::find(handle_index_vecs[dim].begin(), 523 handle_index_vecs[dim].end(), this_gent); 537 524 538 525 return (handle_index == handle_index_vecs[dim].end()) ? -1 : 539 (handle_index - handle_index_vecs[dim].begin());526 (handle_index - handle_index_vecs[dim].begin()); 540 527 } 541 528 … … 550 537 std::vector<iBase_EntityHandle> *handle_index_vecs, 551 538 std::vector<iBase_EntityHandle> &surf_gents, 552 int &surf_gents_size,553 std::vector<iBase_EntityHandle> &c_gents,554 int &c_gents_size,555 std::vector<iBase_EntityHandle> &v_gents,556 int &v_gents_size,557 const bool cv_too)558 {559 // get the surfaces560 std::vector<iBase_EntityHandle> tmp_surfs;561 std::set<iBase_EntityHandle> tmp_cs, tmp_vs;562 std::set<iBase_EntityHandle> *tmp_cs_ptr, *tmp_vs_ptr;563 if (cv_too) {564 tmp_vs_ptr = &tmp_vs;565 tmp_cs_ptr = &tmp_cs;566 }567 else {568 tmp_vs_ptr = NULL;569 tmp_cs_ptr = NULL;570 }571 572 iBase_EntityHandle this_surf;573 574 bool result = get_influenced_gents(infl_scl_p, handle_index_vecs,575 tmp_surfs, tmp_cs_ptr, tmp_vs_ptr);576 if (!result) return result;577 578 // now put them into the surface and curve/vertex sidl arrays579 surf_gents_size = tmp_surfs.size();580 surf_gents = surf_gents.create1d(surf_gents_size);581 for (unsigned int s = 0; s < tmp_surfs.size(); s++)582 surf_gents.set(s, tmp_surfs[s]);583 584 if (cv_too) {585 c_gents_size = tmp_cs.size();586 c_gents = c_gents.create1d(c_gents_size);587 v_gents_size = tmp_vs.size();588 v_gents = v_gents.create1d(v_gents_size);589 590 unsigned int v, c;591 std::set<iBase_EntityHandle>::iterator sit;592 for (c = 0, sit = tmp_cs.begin(); c < c_gents_size; c++, sit++)593 c_gents.set(c, *sit);594 for (v = 0, sit = tmp_vs.begin(); v < v_gents_size; v++, sit++)595 v_gents.set(v, *sit);596 }597 598 return true;599 }600 601 //! same as other version of this function, but taking STL vectors as args instead602 //! of sidl arrays603 bool DdrivDerivs::get_influenced_gents(const unsigned int *infl_scl_p,604 std::vector<iBase_EntityHandle> *handle_index_vecs,605 std::vector<iBase_EntityHandle> &surf_gents,606 539 std::set<iBase_EntityHandle> *cs, 607 540 std::set<iBase_EntityHandle> *vs) 608 541 { 542 int ierr; 543 544 std::set<iBase_EntityHandle> *cv_sets[2] = {vs, cs}; 609 545 610 546 for (int s = 0; s < handle_index_vecs[2].size(); s++) { … … 616 552 if (NULL == cs || NULL == vs) continue; 617 553 618 // now get adjacent curves/vertices and put them in the set 619 int adj_vs_size, adj_cs_size; 620 621 iBase_EntityHandle *adj_vs = NULL; 622 int adj_vs_alloc = 0; 623 iGeom_getEntAdj(myOu.myGeom, this_surf, ::iBase_VERTEX, 624 &adj_vs, &adj_vs_alloc, &adj_vs_size, &result); 625 626 627 iBase_EntityHandle *adj_cs = NULL; 628 int adj_cs_alloc = 0; 629 iGeom_getEntAdj(myOu.myGeom, this_surf, ::iBase_VERTEX, 630 &adj_cs, &adj_cs_alloc, &adj_cs_size, &result); 631 632 633 for (int nv = 0; nv < adj_vs_size; nv++) vs->insert(adj_vs.get(nv)); 634 for (int nc = 0; nc < adj_cs_size; nc++) cs->insert(adj_cs.get(nc)); 635 } 636 554 // now get adjacent curves/vertices and put them in the set 555 for (int dim = 0; dim < 2; dim++) { 556 int adj_alloc = 0, adj_size; 557 iBase_EntityHandle *adj = NULL; 558 iGeom_getEntAdj(myOu.myGeom, this_surf, dim, 559 &adj, &adj_alloc, &adj_size, &ierr); 560 CE("Couldn't get adjacent geometry."); 561 562 std::copy(adj, adj+adj_size, 563 std::inserter(*cv_sets[dim], cv_sets[dim]->begin())); 564 free(adj); 565 } 566 } 567 637 568 return true; 638 569 } … … 669 600 for (int s = 0; s < handle_index_vecs[2].size(); s++) { 670 601 infl_cv_p[CV_P_INDEX(cv, p)] += 671 adj_cv_s[CV_S_INDEX(cv, s)] * myGeomGenerator->paramSurfInfls[S_P_INDEX(s, p)];602 adj_cv_s[CV_S_INDEX(cv, s)] * myGeomGenerator->paramSurfInfls[S_P_INDEX(s, p)]; 672 603 } 673 604 } … … 680 611 for (int cv = 0; cv < ncv; cv++) { 681 612 infl_scl_p[S_P_INDEX(s, p)] += 682 adj_cv_s[CV_S_INDEX(cv, s)] * infl_cv_p[CV_P_INDEX(cv, p)];613 adj_cv_s[CV_S_INDEX(cv, s)] * infl_cv_p[CV_P_INDEX(cv, p)]; 683 614 } 684 615 } … … 734 665 //! the overall surface-curve/vertex adjacency matrix (stored as unsigned ints) 735 666 bool 736 DdrivDerivs::build_topology_graph(unsigned int *&adj_cv_s, 737 std::vector<iBase_EntityHandle> *handle_index_vecs) 738 { 667 DdrivDerivs::build_topology_graph(unsigned int *&adj_cv_s, 668 std::vector<iBase_EntityHandle> *handle_index_vecs) 669 { 670 int ierr; 739 671 // get the handle_index_vecs 740 672 bool success = populate_index_vecs(handle_index_vecs); … … 743 675 if (NULL != adj_cv_s) delete [] adj_cv_s; 744 676 int adj_cv_s_size = handle_index_vecs[2].size() * (handle_index_vecs[0].size() + 745 handle_index_vecs[1].size());677 handle_index_vecs[1].size()); 746 678 adj_cv_s = new unsigned int [adj_cv_s_size]; 747 679 for (int i = 0; i < adj_cv_s_size; i++) adj_cv_s[i] = 0; … … 751 683 for (int s = 0; s < handle_index_vecs[2].size(); s++) { 752 684 753 // - get handle & adjacent entities685 // - get handle & adjacent entities 754 686 iBase_EntityHandle this_surf = handle_index_vecs[2][s]; 755 687 … … 757 689 int rowstart = 0; 758 690 for (int dim = 0; dim < 2; dim++) { 759 int adj_gents_size; 760 761 762 iBase_EntityHandle *adj_gents = NULL; 763 int adj_vs_alloc = 0; 764 iGeom_getEntAdj(myOu.myGeom, this_surf, (::int)dim, 765 &adj_gents, &adj_gents_alloc, 766 &adj_gents_size, &result); 767 691 iBase_EntityHandle *adj_gents = NULL; 692 int adj_gents_alloc = 0, adj_gents_size; 693 iGeom_getEntAdj(myOu.myGeom, this_surf, dim, 694 &adj_gents, &adj_gents_alloc, &adj_gents_size, 695 &ierr); 696 CE("Couldn't get adj geometry entities."); 768 697 769 698 for (int ag = 0; ag < adj_gents_size; ag++) { 770 const int adj_index771 = get_gent_index(adj_gents[ag], handle_index_vecs, dim);772 assert(adj_index < handle_index_vecs[dim].size());773 adj_cv_s[CV_S_INDEX(rowstart+adj_index, s)] = 1;699 const int adj_index 700 = get_gent_index(adj_gents[ag], handle_index_vecs, dim); 701 assert(adj_index < handle_index_vecs[dim].size()); 702 adj_cv_s[CV_S_INDEX(rowstart+adj_index, s)] = 1; 774 703 } 775 704 776 705 rowstart += handle_index_vecs[0].size(); 706 707 free(adj_gents); 777 708 } 778 709 } … … 787 718 788 719 bool 789 DdrivDerivs::assign_indices(std::map<int, gent_data*> *id_gentdata_map,790 std::vector<iBase_EntityHandle> *handle_index_vecs,791 std::vector<int> *id_index_vecs,792 int *num_indices)720 DdrivDerivs::assign_indices(std::map<int, gent_data*> *id_gentdata_map, 721 std::vector<iBase_EntityHandle> *handle_index_vecs, 722 std::vector<int> *id_index_vecs, 723 int *num_indices) 793 724 { 794 725 795 726 // loop over dimension/id map, assigning indexes 796 727 // also generate two vectors, for handle[index] and global_id[index] 797 for (int dim = 0; dim < 3; dim++) {798 799 int tot_indices = 0;800 std::map<int, gent_data*>::iterator mit = (id_gentdata_map[dim]).begin();801 for ( ; mit != (id_gentdata_map[dim]).end(); mit++) {802 gent_data *ged = (*mit).second;803 ged->index = tot_indices;804 handle_index_vecs[dim].push_back(ged->gent);805 id_index_vecs[dim].push_back(ged->gid);806 tot_indices++;807 }808 num_indices[dim] = tot_indices;809 }810 811 return true;728 for (int dim = 0; dim < 3; dim++) { 729 730 int tot_indices = 0; 731 std::map<int, gent_data*>::iterator mit = (id_gentdata_map[dim]).begin(); 732 for ( ; mit != (id_gentdata_map[dim]).end(); mit++) { 733 gent_data *ged = (*mit).second; 734 ged->index = tot_indices; 735 handle_index_vecs[dim].push_back(ged->gent); 736 id_index_vecs[dim].push_back(ged->gid); 737 tot_indices++; 738 } 739 num_indices[dim] = tot_indices; 740 } 741 742 return true; 812 743 } 813 744 … … 817 748 bool DdrivDerivs::init_tags() 818 749 { 819 CAST_iBase_INTERFACE(myOu.myMesh, mesh_tag_iface, Tag);820 821 750 dcoordsdpTag.clear(); 822 751 dnormaldpTag.clear(); 823 752 for (int i = 0; i < myGeomGenerator->num_params(); i++) { 824 753 std::string tmp_name = std::string("DCOORDS_DP_") + 825 std::string(myGeomGenerator->get_param_name(i));826 dcoordsdpTag.push_back(get_tag_handle(m esh_tag_iface,754 std::string(myGeomGenerator->get_param_name(i)); 755 dcoordsdpTag.push_back(get_tag_handle(myOu.myMesh, 827 756 tmp_name.c_str(), 3, 828 ::iBase_DOUBLE));757 iBase_DOUBLE)); 829 758 830 759 tmp_name = std::string("DNORMAL_DP_") + 831 std::string(myGeomGenerator->get_param_name(i));832 dnormaldpTag.push_back(get_tag_handle(m esh_tag_iface,760 std::string(myGeomGenerator->get_param_name(i)); 761 dnormaldpTag.push_back(get_tag_handle(myOu.myMesh, 833 762 tmp_name.c_str(), 3, 834 ::iBase_DOUBLE));763 iBase_DOUBLE)); 835 764 } 836 765 … … 839 768 840 769 //! retrieves or creates a tag handle given the tag's description 770 iBase_TagHandle DdrivDerivs::get_tag_handle(iMesh_Instance &iface, 771 const char *tag_name, 772 const int tag_size, 773 const iBase_TagValueType tag_type) 774 { 775 iBase_TagHandle return_tag = 0; 776 777 int ierr; 778 iMesh_createTag(iface, 779 tag_name, tag_size, tag_type, 780 &return_tag, &ierr, 781 strlen(tag_name)); 782 if (iBase_SUCCESS != ierr && iBase_TAG_ALREADY_EXISTS) { 783 CE("Trouble creating tag."); 784 } 785 786 return return_tag; 787 } 788 841 789 void 842 *DdrivDerivs::get_tag_handle(::iBase::Tag &iface, 843 const char *tag_name, 844 const int tag_size, 845 const ::iBase::TagValueType tag_type) 846 { 847 void *return_tag = 0; 848 849 iBase_TagHandle th; 850 iMesh_createTag(iface, 851 tag_name, 852 tag_size, 853 tag_type, 854 &th, 855 &result, 856 strlen(tag_name)); 857 } 858 859 if (iBase_SUCCESS != result) { 860 std::cerr << "Error creating/accessing tag: " << tag_name << std::endl; 861 return 0; 862 } 863 864 return return_tag; 865 } 866 867 void 868 DdrivDerivs::print_adj_graph(const unsigned int *adj_cv_s, 869 std::vector<iBase_EntityHandle> *handle_index_vecs) 790 DdrivDerivs::print_adj_graph(const unsigned int *adj_cv_s, 791 std::vector<iBase_EntityHandle> *handle_index_vecs) 870 792 { 871 793 std::cout << std::endl; … … 893 815 { 894 816 895 iBase::ArrTag tag_iface = (iBase::ArrTag)(myOu.myMesh);896 897 817 std::vector<iBase_EntityHandle> handle_index_vecs[4]; 898 818 819 int ierr; 820 899 821 bool success = populate_index_vecs(handle_index_vecs); RS; 900 822 901 // Get all surfaces which depend on p and all children902 // of those surfaces823 // Get all surfaces which depend on p and all children 824 // of those surfaces 903 825 std::vector<iBase_EntityHandle> surf_gents; 904 826 std::set<iBase_EntityHandle> v_gents, c_gents; 905 827 success = get_influenced_gents(&infl_scl_p[S_P_INDEX(0, param_index)], 906 handle_index_vecs, surf_gents,907 &c_gents, &v_gents); RS;908 909 // put all the curves/verts onto the end of the surf list828 handle_index_vecs, surf_gents, 829 &c_gents, &v_gents); RS; 830 831 // put all the curves/verts onto the end of the surf list 910 832 std::copy(c_gents.begin(), c_gents.end(), std::back_inserter(surf_gents)); 911 833 std::copy(v_gents.begin(), v_gents.end(), std::back_inserter(surf_gents)); 912 834 913 // for each gent835 // for each gent 914 836 for (int s = 0; s < surf_gents.size(); s++) { 915 837 916 // - get all vertices on entity917 std::vector<iBase_EntityHandle> mverts;838 // - get all vertices on entity 839 iBase_EntityHandle *mverts = NULL; 918 840 int mverts_size; 919 841 success = myOu.get_gentity_mvertices(surf_gents[s], mverts, mverts_size); … … 923 845 } 924 846 925 // - append vertices to list 926 std::copy(ARRAY_PTR(mverts, iBase_EntityHandle), 927 ARRAY_PTR(mverts, iBase_EntityHandle)+mverts_size, 928 std::back_inserter(vertices)); 929 930 // - get tag for that parameter 931 TagHandle param_tag = dcoordsdpTag[param_index]; 932 933 934 935 iBase_EntityHandle *mverts = NULL; 936 int mverts_alloc = 0, mverts_size; 937 double *params = NULL; 938 int params_alloc = 0, params_size; 939 940 iMesh_getDblArrData(myOu.myMesh, mverts, mverts_size, 941 param_tag, ¶ms, ¶ms_alloc, 942 ¶ms_size, &result); 943 944 if (iBase_SUCCESS != result) { 945 char dum_str[256]; 946 iMesh_getDescription(myMesh, dum_str, &result, 256); 947 std::cerr << "Couldn't get coordinates tag on mvertices 948 in store_cv_coords_normals." 949 << std::endl 950 << dum_str << std::endl; 951 return false; 952 } 953 954 955 956 // - append to list 957 std::copy(ARRAY_PTR(params, double), ARRAY_PTR(params, double)+params_size, 958 std::back_inserter(vertex_DV)); 959 } 847 // - append vertices to list 848 std::copy(mverts, mverts+mverts_size, std::back_inserter(vertices)); 849 850 free(mverts); 851 } 852 853 // - get tag for that parameter 854 iBase_TagHandle param_tag = dcoordsdpTag[param_index]; 855 856 double *params = NULL; 857 int params_alloc = 0, params_size; 858 859 iMesh_getDblArrData(myOu.myMesh, &vertices[0], vertices.size(), 860 param_tag, ¶ms, ¶ms_alloc, ¶ms_size, 861 &ierr); 862 if (iBase_SUCCESS != ierr) { 863 char dum_str[256]; 864 iMesh_getDescription(myOu.myMesh, dum_str, &ierr, 256); 865 std::cerr << "Couldn't get coordinates tag on mvertices" 866 << " in store_cv_coords_normals." 867 << std::endl 868 << dum_str << std::endl; 869 return false; 870 } 871 872 // - append to list 873 std::copy(params, params+params_size, std::back_inserter(vertex_DV)); 874 free(params); 960 875 961 876 return true; … … 965 880 double &integrated_dv) 966 881 { 967 iBase::ArrTag tag_iface = (iBase::ArrTag)(myOu.myMesh);968 CAST_iMesh_INTERFACE(myOu.myMesh, mesh_ent, Entity);969 970 882 std::vector<iBase_EntityHandle> handle_index_vecs[4]; 971 883 bool success = populate_index_vecs(handle_index_vecs); RS; 972 884 973 // Get all surfaces which depend on p and all children974 // of those surfaces885 // Get all surfaces which depend on p and all children 886 // of those surfaces 975 887 std::vector<iBase_EntityHandle> surf_gents; 976 888 std::set<iBase_EntityHandle> v_gents, c_gents; 977 889 success = get_influenced_gents(&infl_scl_p[S_P_INDEX(0, param_index)], 978 handle_index_vecs, surf_gents,979 NULL, NULL); RS;890 handle_index_vecs, surf_gents, 891 NULL, NULL); RS; 980 892 981 893 // get the entity sets corresponding to those 982 std::vector<MentitySetHandle> msets; 983 int msets_size; 984 std::vector<iBase_EntityHandle> surf_gents_sidl 985 = convert_to_sidl_vector(surf_gents); 986 try { 987 myOu.myRelate.getGeomRelatedEntities(&myOu.myGeom, &myOu.myMesh, 988 surf_gents_sidl, surf_gents.size(), 989 msets, msets_size); 990 } catch (iBase::Error) {return false;} 894 iBase_EntitySetHandle *msets = NULL; 895 int msets_alloc = 0, msets_size; 896 int ierr; 897 iRel_getEntArrSetArrAssociation(myOu.myRel, myOu.myRelH, 898 &surf_gents[0], surf_gents.size(), 0, 899 &msets, &msets_alloc, &msets_size, 900 &ierr); 901 CE("Couldn't get related mesh sets."); 991 902 992 903 // - get tag for that parameter 993 TagHandle param_tag = dcoordsdpTag[param_index];904 iBase_TagHandle param_tag = dcoordsdpTag[param_index]; 994 905 995 906 integrated_dv = 0.0; 996 907 997 // for each surface908 // for each surface 998 909 for (int s = 0; s < surf_gents.size(); s++) { 999 910 1000 // - get all triangles on entity 1001 myOu.myMesh.getEntities(msets[s], iMesh::EntityType_FACE, 1002 iMesh::EntityTopology_ALL_TOPOLOGIES, 1003 faces, faces_size); 1004 1005 911 // - get all triangles on entity 1006 912 iBase_EntityHandle *faces = NULL; 1007 913 int faces_alloc = 0, faces_size; 1008 iMesh_getEntities(myOu.myMesh, msets[s], 1009 iMesh::EntityType_FACE, 1010 iMesh::EntityTopology_ALL_TOPOLOGIES, 1011 &faces, &faces_alloc, &faces_size, &result); 1012 1013 if (iBase_SUCCESS != result) { 914 iMesh_getEntities(myOu.myMesh, msets[s], 915 iBase_FACE, iMesh_ALL_TOPOLOGIES, 916 &faces, &faces_alloc, &faces_size, &ierr); 917 918 if (iBase_SUCCESS != ierr) { 1014 919 char dum_str[256]; 1015 iMesh_getDescription(my Mesh, dum_str, &result, 256);920 iMesh_getDescription(myOu.myMesh, dum_str, &ierr, 256); 1016 921 std::cerr << "Couldn't get entities in set in reset_coords." 1017 922 << std::endl … … 1022 927 1023 928 double surf_area = 0.0, surf_integrated_dv = 0.0; 1024 1025 929 for (int t = 0; t < faces_size; t++) { 1026 930 1027 931 // get vertices for those triangles and coordinates for vertices 1028 std::vector<iBase_EntityHandle> mverts; 1029 int mverts_size; 1030 try { 1031 mesh_ent.getEntAdj(faces[t], iMesh::EntityType_VERTEX, 1032 mverts, mverts_size); 1033 } 1034 catch (iBase::Error err) { 1035 std::cerr << "Trouble getting vertices for a face." << std::endl; 932 iBase_EntityHandle *mverts = NULL; 933 int mverts_alloc = 0, mverts_size; 934 iMesh_getEntAdj(myOu.myMesh, faces[t], iBase_VERTEX, 935 &mverts, &mverts_alloc, &mverts_size, &ierr); 936 CE("Trouble getting vertices for a face."); 937 938 double *coords = NULL; 939 int coords_alloc = 0, coords_size; 940 iMesh_getVtxArrCoords(myOu.myMesh, mverts, mverts_size, 941 iBase_INTERLEAVED, 942 &coords, &coords_alloc, &coords_size, &ierr); 943 CE("Trouble getting vertex coordinates."); 944 assert(coords_size == mverts_size*3); 945 946 947 // get design v's and normals for those verts 948 double *params = NULL; 949 int params_alloc = 0, params_size; 950 iMesh_getDblArrData(myOu.myMesh, mverts, mverts_size, 951 param_tag, ¶ms, ¶ms_alloc, 952 ¶ms_size, &ierr); 953 954 if (iBase_SUCCESS != ierr) { 955 char dum_str[256]; 956 iMesh_getDescription(myOu.myMesh, dum_str, &ierr, 256); 957 std::cerr << "Couldn't get coordinates tag on mvertices" 958 << " in store_cv_coords_normals." 959 << std::endl 960 << dum_str << std::endl; 1036 961 return false; 1037 962 } 1038 963 1039 std::vector<double> coords; 1040 int coords_size; 1041 iMesh::StorageOrder so = iMesh::StorageOrder_INTERLEAVED; 1042 try { 1043 myOu.myMesh.getVtxArrCoords(mverts, mverts_size, 1044 so, coords, coords_size); 1045 } 1046 catch (iBase::Error err) { 1047 std::cerr << "Trouble getting vertex coordinates." << std::endl; 964 double *normals = NULL; 965 int normals_alloc = 0, normals_size; 966 967 iMesh_getDblArrData(myOu.myMesh, mverts, mverts_size, 968 myOu.normal_tag(), &normals, 969 &normals_alloc, &normals_size, &ierr); 970 if (iBase_SUCCESS != ierr) { 971 char dum_str[256]; 972 iMesh_getDescription(myOu.myMesh, dum_str, &ierr, 256); 973 std::cerr << "Couldn't get coordinates tag on mvertices" 974 << " in store_cv_coords_normals." 975 << std::endl 976 << dum_str << std::endl; 1048 977 return false; 1049 978 } 1050 assert(coords_size == mverts_size*3);1051 1052 1053 // get design v's and normals for those verts1054 1055 Base_EntityHandle *mverts = NULL;1056 int mverts_alloc = 0, mverts_size;1057 double *params = NULL;1058 int params_alloc = 0, params_size;1059 1060 iMesh_getDblArrData(myOu.myMesh, mverts, mverts_size,1061 param_tag, ¶ms, ¶ms_alloc,1062 ¶ms_size, &result);1063 1064 if (iBase_SUCCESS != result) {1065 char dum_str[256];1066 iMesh_getDescription(myMesh, dum_str, &result, 256);1067 std::cerr << "Couldn't get coordinates tag on mvertices1068 in store_cv_coords_normals."1069 << std::endl1070 << dum_str << std::endl;1071 return false;1072 }1073 1074 1075 int normals_alloc = 0;1076 1077 iMesh_getDblArrData(myOu.myMesh, mverts, mverts_size,1078 myOu.normal_tag(), &normals,1079 &normals_alloc, &normals_size, &result);1080 1081 if (iBase_SUCCESS != result) {1082 char dum_str[256];1083 iMesh_getDescription(myMesh, dum_str, &result, 256);1084 std::cerr << "Couldn't get coordinates tag on mvertices1085 in store_cv_coords_normals."1086 << std::endl1087 << dum_str << std::endl;1088 return false;1089 }1090 1091 1092 979 1093 980 // put the edge vectors in for the coords of 2 pts … … 1127 1014 term += params[i]*normals[i]; 1128 1015 surf_integrated_dv += (term/(double)mverts_size) * area; 1016 1017 free(mverts); free(coords); free(params); free(normals); 1129 1018 } 1130 1019 1131 1020 std::cout << "Surface " << myOu.get_gentity_id(surf_gents[s]) 1132 1021 << " area = " << surf_area << 1133 ", integrated dv contribution = " << surf_integrated_dv << std::endl;1022 ", integrated dv contribution = " << surf_integrated_dv << std::endl; 1134 1023 1135 1024 integrated_dv += surf_integrated_dv; 1025 1026 free(faces); 1136 1027 } 1137 1028 -
ddriv/trunk/DdrivDerivs.hpp
r2696 r2754 20 20 21 21 22 #include "MeshTSTT.hpp"23 #include "GeomTSTT.hpp"24 25 22 #include "OptUtils.hpp" 26 23 #include "SmoothUtils.hpp" … … 30 27 #include <vector> 31 28 32 typedef void* MentitySetHandle;33 typedef void* TagHandle;34 29 35 30 class GeomGenerator; … … 91 86 unsigned int *adj_cv_s, *infl_scl_p, *infl_cv_p; 92 87 93 std::vector< TagHandle> dcoordsdpTag, dnormaldpTag, dnormaldpSTag;88 std::vector<iBase_TagHandle> dcoordsdpTag, dnormaldpTag, dnormaldpSTag; 94 89 95 90 // params vector and requested difference step size (initialize to ???) … … 108 103 bool make_mesh_set(std::vector<iBase_EntityHandle> &gents, 109 104 const int dimension, 110 MentitySetHandle &new_set);105 iBase_EntitySetHandle &new_set); 111 106 112 107 //! for surfaces, get mesh vertex coordinates and normals at those vertices, … … 117 112 const int gents_size, 118 113 const int gent_dim, 119 TagHandle coord_tag, TagHandle normal_tag, 120 TagHandle old_coord_tag, TagHandle old_normal_tag, 121 const double dp); 122 123 //! for surfaces, get mesh vertex coordinates and normals at those vertices, 124 //! compute derivatives if old_xxx_tag is non-zero, then store results in xxx_tag 125 bool store_coords_normals(const bool bogus_derivs, 126 std::vector<iBase_EntityHandle> *handle_index_vecs, 127 const int gent_dim, 128 TagHandle coord_tag, TagHandle normal_tag, 129 TagHandle old_coord_tag, TagHandle old_normal_tag, 114 iBase_TagHandle coord_tag, iBase_TagHandle normal_tag, 115 iBase_TagHandle old_coord_tag, iBase_TagHandle old_normal_tag, 130 116 const double dp); 131 117 … … 134 120 //! derivatives and surface normal derivatives 135 121 bool compute_vector_difference(std::vector<iBase_EntityHandle> &mverts, 136 const int mverts_size,137 122 std::vector<double> &new_vec, 138 const int new_vec_size, 139 TagHandle old_vec_tag, 123 iBase_TagHandle old_vec_tag, 124 const double dp); 125 126 bool compute_vector_difference(iBase_EntityHandle *mverts, 127 int mverts_size, 128 std::vector<double> &new_vec, 129 iBase_TagHandle old_vec_tag, 140 130 const double dp); 141 131 … … 148 138 const int mverts_size, 149 139 std::vector<double> &new_vec, 150 TagHandle old_vec_tag,140 iBase_TagHandle old_vec_tag, 151 141 const int surf_indices_size, 152 142 const double dp, … … 158 148 //! that space on the input tag 159 149 bool allocate_cv_normal_tags(std::vector<iBase_EntityHandle> &mverts, 160 const int mverts_size, TagHandle normal_tag,150 const int mverts_size, iBase_TagHandle normal_tag, 161 151 const int surf_indices_size, 162 152 std::vector<double> &mvert_normals); … … 248 238 249 239 //! retrieves or creates a tag handle given the tag's description 250 void *get_tag_handle(iBase_Instance &iface, const char *tag_name,251 const int tag_size, const iBase_TagValueType tag_type);240 iBase_TagHandle get_tag_handle(iMesh_Instance &iface, const char *tag_name, 241 const int tag_size, const iBase_TagValueType tag_type); 252 242 253 243 //! print the adjacency graph, with header row containing vertex/curve indices -
ddriv/trunk/GeomGenerator.cpp
r2696 r2754 340 340 341 341 iGeom_save(myOu.myGeom, myOutputGeomFile.c_str(), NULL, &result, 342 myOutputGeomFile.length(), &result);342 myOutputGeomFile.length(), 0); 343 343 344 344 if (iBase_SUCCESS != result) { -
ddriv/trunk/Makefile
r2696 r2754 15 15 #include ${IREL_DIR}/lib/iRel-Defs.inc 16 16 17 include /home/malusare/bin/lib/iRel-Defs.inc18 include /home/malusare/bin/lib/iGeom-Defs.inc19 include /home/malusare/bin/lib/iMesh-Defs.inc17 include ${IREL_DIR}/lib/iRel-Defs.inc 18 include ${IGEOM_DIR}/lib/iGeom-Defs.inc 19 include ${IMESH_DIR}/lib/iMesh-Defs.inc 20 20 21 21 … … 60 60 61 61 ddriv: ${DDRIV_OBJS} libddriv.a ${MESQUITE_LIBS} 62 $(IREL_CXX) $(CXXFLAGS) -o $@ ${DDRIV_OBJS} -L. -lddriv ${MESQUITE_LIBS_LINK} ${IREL_LIBS} 62 $(IREL_CXX) $(CXXFLAGS) -o $@ ${DDRIV_OBJS} -L. -lddriv ${MESQUITE_LIBS_LINK} ${IREL_LIBS} ${IMESH_LIBS} ${IGEOM_LIBS} 63 63 64 64 libddriv.a: $(DDRIV_LIB_OBJS) … … 119 119 ${CXX} -DMSQ_TSTT_USE_MOAB -c ${CXXFLAGS} ${IGEOM_INCLUDES} $< 120 120 .cpp.o: 121 ${CXX} -DMSQ_TSTT_USE_MOAB -c ${CXXFLAGS} ${ iRel_INCLUDES} ${IGEOM_INCLUDES} ${MESQUITE_INCLUDES} $<121 ${CXX} -DMSQ_TSTT_USE_MOAB -c ${CXXFLAGS} ${IREL_INCLUDES} ${IMESH_INCLUDES} ${IGEOM_INCLUDES} ${MESQUITE_INCLUDES} $< 122 122 123 123 -
ddriv/trunk/MkCone.cpp
r2696 r2754 37 37 #include <vector> 38 38 #include <cmath> 39 using namespace std;40 39 41 40 #include "iGeom.h" 42 #include "iBase_SNL_SIDL_defs.h"43 41 #include "CubitVector.hpp" 44 #include "AcisModifyEngine.hpp"45 42 #include "GeometryModifyTool.hpp" 46 43 #include "GeometryQueryTool.hpp" … … 52 49 #include "ConeParamInfls.hpp" 53 50 51 #define CE(s) if (iBase_SUCCESS != ierr) {std::cerr << s << std::endl; return false;} 52 54 53 /* 55 54 * Interpolation functions: interpolateY and interpolateZ … … 68 67 69 68 /* ================================================== */ 70 vector<double>71 interpolateY(vector<double> y, double angle, double beta)69 std::vector<double> 70 interpolateY(std::vector<double> y, double angle, double beta) 72 71 { 73 vector<double> result;72 std::vector<double> result; 74 73 size_t len = y.size(); 75 74 for(size_t i = 0; i < len; ++i) { … … 81 80 82 81 /* ================================================== */ 83 vector<double>84 interpolateZ( vector<double> z, double angle, double gamma)82 std::vector<double> 83 interpolateZ(std::vector<double> z, double angle, double gamma) 85 84 { 86 vector<double> result;85 std::vector<double> result; 87 86 size_t len = z.size(); 88 87 for(size_t i = 0; i < len; ++i) { … … 140 139 } 141 140 142 vector<double> frac, x, y, z, other;141 std::vector<double> frac, x, y, z, other; 143 142 144 143 // create the fraction vector … … 175 174 for(int v = 0; v < NUM_V-2; v++) { 176 175 // vertices at angle (v+1)*angle 177 vector<double> new_y = interpolateY(y, angle, beta);178 vector<double> new_z = interpolateZ(z, angle, gamma);176 std::vector<double> new_y = interpolateY(y, angle, beta); 177 std::vector<double> new_z = interpolateZ(z, angle, gamma); 179 178 for(int u = 0; u < NUM_U; ++u) { 180 179 points[u][v+1]->set(x[u], new_y[u], new_z[u]); … … 267 266 // assign to RefEntity* so cast to void* works correctly 268 267 RefEntity *this_body_refent = this_body; 269 typedef void* iBase_EntityHandle; 270 iBase_EntityHandle this_gent = this_body_refent, cone_body; 268 iBase_EntityHandle this_gent = (iBase_EntityHandle) this_body_refent, cone_body; 271 269 272 270 // get the other parts by copy/reflect/uniting 273 271 274 272 iBase_EntityHandle q2, q3, q4; 275 276 iGeom_copyEnt( geom_iface, this_gent, q2, &result);277 278 if (iBase_SUCCESS != result) {273 int ierr; 274 iGeom_copyEnt( geom_iface, this_gent, &q2, &ierr); 275 276 if (iBase_SUCCESS != ierr) { 279 277 std::cerr << "Failed Copy." << std::endl; 280 278 return false; … … 282 280 283 281 284 iGeom_reflectEnt(geom_iface, q2, 0.0, 0.0, 1.0, &result);285 286 if (iBase_SUCCESS != result) {282 iGeom_reflectEnt(geom_iface, &q2, 0.0, 0.0, 1.0, &ierr); 283 284 if (iBase_SUCCESS != ierr) { 287 285 std::cerr << "Failed Reflect." << std::endl; 288 286 return false; … … 291 289 292 290 293 iGeom_copyEnt( geom_iface, q2, q3, &result);294 295 if (iBase_SUCCESS != result) {291 iGeom_copyEnt( geom_iface, q2, &q3, &ierr); 292 293 if (iBase_SUCCESS != ierr) { 296 294 std::cerr << "Failed Copy." << std::endl; 297 295 return false; … … 299 297 300 298 301 iGeom_copyEnt( geom_iface, this_gent, q4, &result);302 303 if (iBase_SUCCESS != result) {299 iGeom_copyEnt( geom_iface, this_gent, &q4, &ierr); 300 301 if (iBase_SUCCESS != ierr) { 304 302 std::cerr << "Failed Copy." << std::endl; 305 303 return false; … … 308 306 309 307 310 iGeom_reflectEnt(geom_iface, q3, 0.0, 1.0, 0.0, &result);311 312 if (iBase_SUCCESS != result) {308 iGeom_reflectEnt(geom_iface, &q3, 0.0, 1.0, 0.0, &ierr); 309 310 if (iBase_SUCCESS != ierr) { 313 311 std::cerr << "Failed Reflect." << std::endl; 314 312 return false; … … 316 314 317 315 318 iGeom_reflectEnt(geom_iface, q4, 0.0, 1.0, 0.0, &result);316 iGeom_reflectEnt(geom_iface, &q4, 0.0, 1.0, 0.0, &ierr); 319 317 320 if (iBase_SUCCESS != result) {318 if (iBase_SUCCESS != ierr) { 321 319 std::cerr << "Failed Reflect." << std::endl; 322 320 return false; … … 324 322 325 323 326 std::vector<iBase_EntityHandle> pieces = pieces.create1d(4); 327 pieces.set(0, this_gent); 328 pieces.set(1, q2); 329 pieces.set(2, q3); 330 pieces.set(3, q4); 331 332 333 iGeom_uniteEnts( geom_iface, &pieces, 4, &cone_body, &result); 334 335 if (iBase_SUCCESS != result) { 336 std::cerr << "Failed Unite." << std::endl; 337 return false; 338 } 339 340 341 342 iBase_EntityHandle q2, q3, q4; 343 344 iGeom_copyEnt( geom_iface, this_gent, q2, &result); 345 346 if (iBase_SUCCESS != result) { 347 std::cerr << "Failed Copy." << std::endl; 348 return false; 349 } 350 351 352 iGeom_reflectEnt( geom_iface, q2, 0.0, 0.0, 1.0, &result); 353 354 if (iBase_SUCCESS != result) { 355 std::cerr << "Failed Subtract." << std::endl; 356 return false; 357 } 358 359 360 iGeom_copyEnt( geom_iface, q2, q3, &result); 361 362 if (iBase_SUCCESS != result) { 363 std::cerr << "Failed Copy." << std::endl; 364 return false; 365 } 366 367 368 iGeom_copyEnt( geom_iface, this_gent, q4, &result); 369 370 if (iBase_SUCCESS != result) { 371 std::cerr << "Failed Copy." << std::endl; 372 return false; 373 } 374 375 376 iGeom_reflectEnt( geom_iface, q3, 0.0, 1.0, 0.0, &result); 377 378 if (iBase_SUCCESS != result) { 379 std::cerr << "Failed Reflect." << std::endl; 380 return false; 381 } 382 383 384 iGeom_reflectEnt( geom_iface, q4, 0.0, 1.0, 0.0, &result); 385 386 if (iBase_SUCCESS != result) { 387 std::cerr << "Failed Reflect." << std::endl; 388 return false; 389 } 390 391 392 std::vector<iBase_EntityHandle> pieces = pieces.create1d(4); 393 pieces.set(0, this_gent); 394 pieces.set(1, q2); 395 pieces.set(2, q3); 396 pieces.set(3, q4); 397 398 iGeom_uniteEnts( geom_face, &pieces, 4, &cone_body, &result); 399 400 if (iBase_SUCCESS != result) { 401 std::cerr << "Failed Unite." << std::endl; 402 return false; 403 } 404 324 iBase_EntityHandle pieces[4] = {this_gent, q2, q3, q4}; 325 iGeom_uniteEnts(geom_iface, pieces, 4, &cone_body, &ierr); 326 CE("Failed Unite."); 327 328 iGeom_copyEnt( geom_iface, this_gent, &q2, &ierr); 329 CE("Failed Copy."); 330 331 iGeom_reflectEnt( geom_iface, &q2, 0.0, 0.0, 1.0, &ierr); 332 CE("Failed Subtract."); 333 334 335 336 iGeom_copyEnt( geom_iface, q2, &q3, &ierr); 337 CE("Failed Copy."); 338 339 iGeom_copyEnt( geom_iface, this_gent, &q4, &ierr); 340 CE("Failed Copy."); 341 342 iGeom_reflectEnt( geom_iface, &q3, 0.0, 1.0, 0.0, &ierr); 343 CE("Failed Reflect."); 344 345 iGeom_reflectEnt( geom_iface, &q4, 0.0, 1.0, 0.0, &ierr); 346 CE("Failed Reflect."); 347 348 iBase_EntityHandle pieces2[] = {this_gent, q2, q3, q4}; 349 iGeom_uniteEnts(geom_iface, pieces2, 4, &cone_body, &ierr); 350 CE("Failed Unite."); 405 351 406 352 // if we got here, and it's requested, pass back the param-surf influence matrix 407 353 if (NULL != param_surf_infls) { 408 409 354 int num_param_surf_infls = paramInflsNumSurfs*paramInflsNumParams; 410 355 411 356 if (NULL == *param_surf_infls) 412 413 357 *param_surf_infls = new unsigned int [num_param_surf_infls]; 414 415 358 memcpy(*param_surf_infls, paramSurfInfls, 416 359 num_param_surf_infls*sizeof(unsigned int)); -
ddriv/trunk/MkCyl.cpp
r2696 r2754 21 21 #include <iostream> 22 22 #include "iGeom.h" 23 #include "iBase_SNL_SIDL_defs.h"24 23 #include "cylParamInfls.hpp" 24 #include <cstring> 25 25 26 typedef void* iBase_EntityHandle;27 26 int result; 28 27 … … 50 49 51 50 52 iGeom_sectionEnt( geom_iface, cyl_tmp, 1.0, 0.0, 0.0, 0.0,51 iGeom_sectionEnt( geom_iface, &cyl_tmp, 1.0, 0.0, 0.0, 0.0, 53 52 false, &cyl, &result); 54 53 -
ddriv/trunk/MkDDSCell.cpp
r2696 r2754 20 20 #include <iostream> 21 21 #include "iGeom.h" 22 #include "iBase_SNL_SIDL_defs.h"23 22 #include "ddsdefines.h" 24 23 #include "DDSParamInfls.hpp" 25 26 24 #include <cstring> 25 #include <vector> 26 #include <math.h> 27 27 28 28 /* ============== typedefs section =============== */ 29 29 int result; 30 31 typedef void* iBase_EntityHandle;32 30 33 31 const double fixed_params[15] = { … … 56 54 bool cleanup_other_geom(iGeom_Instance &geom, 57 55 iBase_EntityHandle &dds_cell, 58 std::vector<iBase_EntityHandle> &initial_gents,56 iBase_EntityHandle *initial_gents, 59 57 int initial_gents_size); 60 58 … … 62 60 const double RADTODEG = 180.0/(4.0*atan(1.0)); 63 61 64 62 #define CE(s) if (iBase_SUCCESS != ierr) { \ 63 std::cerr << s << std::endl; return false; } 64 65 65 66 66 … … 89 89 90 90 if (iBase_SUCCESS != result) { 91 std::cerr << "Trouble getting gentities of dimension" << dim<< std::endl;91 std::cerr << "Trouble getting gentities of dimension" << iBase_REGION << std::endl; 92 92 return false; 93 93 } … … 201 201 202 202 203 iGeom_moveEnt( iGeom_transforms,temp2, -.5*brround,203 iGeom_moveEnt(geom, &temp2, -.5*brround, 204 204 .5*b_n0_fillet_pos+.5*brround, 0.0, &result); 205 205 … … 210 210 211 211 212 iGeom_subtract (geom, temp1, temp2, &temp3, &result);212 iGeom_subtractEnts(geom, temp1, temp2, &temp3, &result); 213 213 214 214 if (iBase_SUCCESS != result) { … … 218 218 219 219 220 iGeom_moveEnt( iGeom_Instance,temp3, .5*brround,220 iGeom_moveEnt(geom, &temp3, .5*brround, 221 221 .5*b_n0_fillet_pos+.5*brround, 0.0, &result ); 222 222 … … 230 230 double angb00 = asin(brrbc/(b_n0_fillet_pos+brround))*RADTODEG; 231 231 232 iGeom_rotateEnt( geom, temp3, angb00, 0.0, 0.0, 1.0, &result);232 iGeom_rotateEnt( geom, &temp3, angb00, 0.0, 0.0, 1.0, &result); 233 233 234 234 if (iBase_SUCCESS != result) { … … 242 242 243 243 244 iGeom_sectionEnt( geom, temp3, 0.0, 1.0, 0.0,244 iGeom_sectionEnt( geom, &temp3, 0.0, 1.0, 0.0, 245 245 offset, true, &angled, &result); 246 246 … … 249 249 return false; 250 250 } 251 252 253 std::vector<iBase_EntityHandle> tempa =254 std::vector<iBase_EntityHandle>::create1d(2);255 256 251 257 252 double sinang00_pos … … 272 267 273 268 274 iGeom_moveEnt( geom, temp1, wnarrow_pos-rround,269 iGeom_moveEnt( geom, &temp1, wnarrow_pos-rround, 275 270 .5*b_n0_fillet_pos+.5*s_b_manif_pos+.5*rmanif, 276 271 0.0, &result); … … 282 277 283 278 284 tempa.set(0, angled); 285 tempa.set(1, temp1); 279 iBase_EntityHandle tempa[2] = {angled, temp1}; 286 280 rounded_disk_top = NULL; 287 281 288 282 289 iGeom_uniteEnts( geom, &tempa, 2, &rounded_disk_top, &result);283 iGeom_uniteEnts( geom, tempa, 2, &rounded_disk_top, &result); 290 284 291 285 if (iBase_SUCCESS != result) { … … 295 289 296 290 297 iGeom_moveEnt( geom, rounded_disk_top, 0.0, 0.0,291 iGeom_moveEnt( geom, &rounded_disk_top, 0.0, 0.0, 298 292 0.25*(t_neg-t_pos), &result); 299 293 … … 336 330 337 331 338 iGeom_moveEnt( geom, temp1, wnarrow_pos - .5*rround,332 iGeom_moveEnt( geom, &temp1, wnarrow_pos - .5*rround, 339 333 .5*slen_pos + dmove_pos, 340 334 .5*rround + .25*t_neg - .25*t_pos, &result); … … 355 349 356 350 357 iGeom_rotateEnt( geom, temp2, 90.0, 1.0, 0.0, 0.0, &result);351 iGeom_rotateEnt( geom, &temp2, 90.0, 1.0, 0.0, 0.0, &result); 358 352 359 353 if (iBase_SUCCESS != result) { … … 363 357 364 358 365 iGeom_moveEnt( geom, temp2, -rround, dmove_pos + .5*slen_pos,359 iGeom_moveEnt( geom, &temp2, -rround, dmove_pos + .5*slen_pos, 366 360 .5*cell_height - .5*t_pos + rround, &result); 367 361 … … 373 367 374 368 lower_brick = NULL; 375 iGeom_subtract (geom, temp1, temp2, &lower_brick, &result);369 iGeom_subtractEnts(geom, temp1, temp2, &lower_brick, &result); 376 370 377 371 if (iBase_SUCCESS != result) { … … 392 386 393 387 394 iGeom_moveEnt( geom, upper_brick, wnarrow_pos,388 iGeom_moveEnt( geom, &upper_brick, wnarrow_pos, 395 389 .5*slen_pos + dmove_pos, .25*t_neg, &result); 396 390 … … 411 405 412 406 413 iGeom_moveEnt( geom, cyl_sm, rslot, dmove_pos,407 iGeom_moveEnt( geom, &cyl_sm, rslot, dmove_pos, 414 408 .25*t_neg, &result); 415 409 … … 432 426 433 427 434 iGeom_moveEnt( geom, temp1, rslot, dmove_pos,428 iGeom_moveEnt( geom, &temp1, rslot, dmove_pos, 435 429 .25*(t_neg-t_pos)+.5*rround, &result); 436 430 … … 454 448 455 449 456 iGeom_moveEnt( geom, temp2, rslot, dmove_pos,450 iGeom_moveEnt( geom, &temp2, rslot, dmove_pos, 457 451 .5*cell_height-.5*t_pos+rround, &result); 458 452 … … 466 460 cyl_lrg = NULL; 467 461 468 iGeom_subtract (geom, temp1, temp2, &cyl_lrg, &result);462 iGeom_subtractEnts(geom, temp1, temp2, &cyl_lrg, &result); 469 463 470 464 if (iBase_SUCCESS != result) { … … 474 468 475 469 476 std::vector<iBase_EntityHandle> tempa = 477 std::vector<iBase_EntityHandle>::create1d(4); 478 479 tempa.set(0, lower_brick); 480 tempa.set(1, upper_brick); 481 tempa.set(2, cyl_sm); 482 tempa.set(3, cyl_lrg); 470 iBase_EntityHandle tempa[4] = {lower_brick, upper_brick, cyl_sm, cyl_lrg}; 483 471 rounded_disk_side_pos = NULL; 484 485 486 iGeom_uniteEnts( geom, &tempa, 4, &rounded_disk_side_pos, &result); 472 iGeom_uniteEnts( geom, tempa, 4, &rounded_disk_side_pos, &result); 487 473 488 474 if (iBase_SUCCESS != result) { … … 526 512 527 513 528 iGeom_moveEnt( geom, temp1, wnarrow_neg - .5*rround,514 iGeom_moveEnt( geom, &temp1, wnarrow_neg - .5*rround, 529 515 0.0, -.5*rround, &result); 530 516 … … 543 529 } 544 530 545 iGeom_rotateEnt( geom, temp2, 90.0, 1.0, 0.0, 0.0, &result);531 iGeom_rotateEnt( geom, &temp2, 90.0, 1.0, 0.0, 0.0, &result); 546 532 547 533 if (iBase_SUCCESS != result) { … … 551 537 552 538 553 iGeom_moveEnt( geom, temp2, -rround, 0.0, -rround, &result);539 iGeom_moveEnt( geom, &temp2, -rround, 0.0, -rround, &result); 554 540 555 541 if (iBase_SUCCESS != result) { … … 560 546 561 547 upper_brick = NULL; 562 iGeom_subtract (geom, temp1, temp2, &upper_brick, &result);548 iGeom_subtractEnts(geom, temp1, temp2, &upper_brick, &result); 563 549 564 550 if (iBase_SUCCESS != result) { … … 568 554 569 555 570 iGeom_moveEnt( geom, upper_brick, 0.0, .5*slen_neg, 0.0, &result);556 iGeom_moveEnt( geom, &upper_brick, 0.0, .5*slen_neg, 0.0, &result); 571 557 572 558 if (iBase_SUCCESS != result) { … … 589 575 590 576 591 iGeom_moveEnt( geom, lower_brick, wnarrow_neg, .5*slen_neg,577 iGeom_moveEnt( geom, &lower_brick, wnarrow_neg, .5*slen_neg, 592 578 -.25*t_neg-.5*rround, &result); 593 579 … … 612 598 613 599 614 iGeom_moveEnt( geom, temp1, rslot, 0.0, -.5*rround, &result);600 iGeom_moveEnt( geom, &temp1, rslot, 0.0, -.5*rround, &result); 615 601 616 602 if (iBase_SUCCESS != result) { … … 632 618 633 619 634 iGeom_moveEnt( iGeom_transforms,temp2, rslot, 0.0, -rround, &result);620 iGeom_moveEnt( geom, &temp2, rslot, 0.0, -rround, &result); 635 621 636 622 if (iBase_SUCCESS != result) { … … 643 629 cyl_lrg = NULL; 644 630 645 iGeom_subtract (geom, temp1, temp2, &cyl_lrg, &result);631 iGeom_subtractEnts(geom, temp1, temp2, &cyl_lrg, &result); 646 632 647 633 if (iBase_SUCCESS != result) { … … 661 647 } 662 648 663 iGeom_moveEnt(geom, cyl_sm,rslot,0.0,-.25*t_neg-.5*rround,&result);649 iGeom_moveEnt(geom, &cyl_sm,rslot,0.0,-.25*t_neg-.5*rround,&result); 664 650 665 651 if (iBase_SUCCESS != result) { … … 671 657 // unite to get rounded_disk_side_neg 672 658 673 std::vector<iBase_EntityHandle> tempa = 674 std::vector<iBase_EntityHandle>::create1d(4); 675 676 tempa.set(0, lower_brick); 677 tempa.set(1, upper_brick); 678 tempa.set(2, cyl_sm); 679 tempa.set(3, cyl_lrg); 680 659 iBase_EntityHandle tempa[4] = {lower_brick, upper_brick, cyl_sm, cyl_lrg}; 681 660 rounded_disk_side_neg = NULL; 682 661 683 iGeom_uniteEnts( geom, &tempa, 4, &rounded_disk_side_neg, &result);662 iGeom_uniteEnts( geom, tempa, 4, &rounded_disk_side_neg, &result); 684 663 685 664 if (iBase_SUCCESS != result) { … … 688 667 } 689 668 690 iGeom_moveEnt( geom, rounded_disk_side_neg, 0.0, dmove_neg,669 iGeom_moveEnt( geom, &rounded_disk_side_neg, 0.0, dmove_neg, 691 670 -.5*(cell_height-t_neg), &result); 692 671 … … 721 700 double ang01_neg = asin(sinang00_neg)*RADTODEG; 722 701 723 iGeom_rotateEnt( geom, rounded_disk_side_pos,702 iGeom_rotateEnt( geom, &rounded_disk_side_pos, 724 703 ang01_pos, 0.0, 0.0, 1.0 , &result); 725 704 … … 730 709 731 710 732 iGeom_rotateEnt( geom, rounded_disk_side_neg,711 iGeom_rotateEnt( geom, &rounded_disk_side_neg, 733 712 ang01_neg, 0.0, 0.0, 1.0, &result); 734 713 … … 739 718 740 719 741 iGeom_rotateEnt( geom, rounded_disk_top, ang01_pos,742 0.0, 0.0, 1.0, &result);720 iGeom_rotateEnt( geom, &rounded_disk_top, ang01_pos, 721 0.0, 0.0, 1.0, &result); 743 722 744 723 if (iBase_SUCCESS != result) { … … 748 727 749 728 750 std::vector<iBase_EntityHandle> tempa = 751 std::vector<iBase_EntityHandle>::create1d(3); 752 753 tempa.set(0, rounded_disk_side_pos); 754 tempa.set(1, rounded_disk_side_neg); 755 tempa.set(2, rounded_disk_top); 756 757 729 iBase_EntityHandle tempa[] = {rounded_disk_side_pos, rounded_disk_side_neg, 730 rounded_disk_top}; 731 758 732 temp1 = NULL; 759 iGeom_uniteEnts( geom, &tempa, 3, &temp1, &result);733 iGeom_uniteEnts( geom, tempa, 3, &temp1, &result); 760 734 761 735 if (iBase_SUCCESS != result) { … … 766 740 767 741 temp2 = NULL; 768 void iGeom_sectionEnt( geom,temp1, 1.0, 0.0, 0.0,769 0.0, true, &temp2, &result);742 iGeom_sectionEnt( geom, &temp1, 1.0, 0.0, 0.0, 743 0.0, true, &temp2, &result); 770 744 771 745 if (iBase_SUCCESS != result) { … … 776 750 777 751 temp3 = NULL; 778 iGeom_copyEnt( geom, temp2, temp3, &result);752 iGeom_copyEnt( geom, temp2, &temp3, &result); 779 753 780 754 if (iBase_SUCCESS != result) { … … 784 758 785 759 786 iGeom_reflectEnt( geom, temp3, 1.0, 0.0, 0.0, &result);760 iGeom_reflectEnt( geom, &temp3, 1.0, 0.0, 0.0, &result); 787 761 788 762 if (iBase_SUCCESS != result) { … … 792 766 793 767 794 std::vector<iBase_EntityHandle> tempb = 795 std::vector<iBase_EntityHandle>::create1d(2); 796 797 tempb.set(0, temp2); 798 tempb.set(1, temp3); 768 iBase_EntityHandle tempb[] = {temp2, temp3}; 799 769 800 770 temp4 = NULL; 801 iGeom_uniteEnts( geom, &tempb, 2, &temp4, &result);771 iGeom_uniteEnts(geom, tempb, 2, &temp4, &result); 802 772 803 773 if (iBase_SUCCESS != result) { … … 825 795 826 796 827 iGeom_rotateEnt( geom, temp1, taa, 1.0, 0.0, 0.0, &result);797 iGeom_rotateEnt( geom, &temp1, taa, 1.0, 0.0, 0.0, &result); 828 798 829 799 if (iBase_SUCCESS != result) { … … 833 803 834 804 835 iGeom_moveEnt( geom, temp1, 0.0, dymanif_ave, 0.0, &result); 836 837 if (iBase_SUCCESS != result) { 838 std::cerr << "Failed Move." << std::endl; 839 return false; 840 } 841 842 843 std::vector<iBase_EntityHandle> tempc = 844 std::vector<iBase_EntityHandle>::create1d(2); 845 846 tempc.set(0, temp4); 847 tempc.set(1, temp1); 805 iGeom_moveEnt( geom, &temp1, 0.0, dymanif_ave, 0.0, &result); 806 807 if (iBase_SUCCESS != result) { 808 std::cerr << "Failed Move." << std::endl; 809 return false; 810 } 811 812 813 iBase_EntityHandle tempc[] = {temp4, temp1}; 848 814 temp2 = NULL; 849 815 850 816 851 iGeom_uniteEnts( geom, &tempc, 2, &temp2, &result);817 iGeom_uniteEnts( geom, tempc, 2, &temp2, &result); 852 818 853 819 if (iBase_SUCCESS != result) { … … 858 824 859 825 temp3 = NULL; 860 iGeom_sectionEnt( geom, temp2, 0.0, 0.0, 1.0,826 iGeom_sectionEnt( geom, &temp2, 0.0, 0.0, 1.0, 861 827 .5*cell_height, true, &temp3, &result); 862 828 … … 868 834 869 835 rounded_slot_manif = NULL; 870 iGeom_sectionEnt( geom, temp3, 0.0, 0.0, 1.0, -.5*cell_height,836 iGeom_sectionEnt( geom, &temp3, 0.0, 0.0, 1.0, -.5*cell_height, 871 837 false, &rounded_slot_manif, &result); 872 838 … … 917 883 918 884 919 iGeom_moveEnt( geom, temp2, 0.0, 0.0,885 iGeom_moveEnt( geom, &temp2, 0.0, 0.0, 920 886 .25*cell_height+.125*tdiff, &result); 921 887 … … 936 902 937 903 938 iGeom_moveEnt( geom, temp3, 0.0, 0.0,904 iGeom_moveEnt( geom, &temp3, 0.0, 0.0, 939 905 -.25*cell_height+.125*tdiff, &result); 940 906 … … 945 911 946 912 947 std::vector<iBase_EntityHandle> tempa = 948 std::vector<iBase_EntityHandle>::create1d(3); 949 950 tempa.set(0, temp1); 951 tempa.set(1, temp2); 952 tempa.set(2, temp3); 913 iBase_EntityHandle tempa2[] = {temp1, temp2, temp3}; 953 914 cyls = NULL; 954 915 955 916 956 iGeom_uniteEnts( geom, &tempa, 3, &cyls, &result);917 iGeom_uniteEnts( geom, tempa2, 3, &cyls, &result); 957 918 958 919 if (iBase_SUCCESS != result) { … … 973 934 974 935 975 iGeom_rotateEnt( geom, temp1, 90.0, 1.0, 0.0, 0.0, &result);936 iGeom_rotateEnt( geom, &temp1, 90.0, 1.0, 0.0, 0.0, &result); 976 937 977 938 if (iBase_SUCCESS != result) { … … 981 942 982 943 983 iGeom_moveEnt( geom, temp1, -(a_pos+anose_pos),944 iGeom_moveEnt( geom, &temp1, -(a_pos+anose_pos), 984 945 0.5, .5*cell_height+.25*tdiff, &result); 985 946 … … 991 952 992 953 // find surface of previous volume with max y coord 993 std::vector<double> minc, maxc;994 int num_adj_surfs, num_minc, num_maxc;995 996 954 iBase_EntityHandle *adj_surfs = NULL; 997 int adj_surfs_alloc = 0; 998 iGeom_getEntAdj(geom, temp1, ::iBase_FACE, adj_surfs, 999 &adj_surfs_alloc, &adj_surfs_size, &result); 1000 1001 1002 ::iBase::StorageOrder order = ::iBase::StorageOrder_INTERLEAVED; 1003 1004 1005 iGeom_getArrBoundBox(geom, &adj_surfs, num_adj_surfs, &order, 1006 &minc, &num_minc, &maxc, &num_maxc, &result); 955 int adj_surfs_alloc = 0, adj_surfs_size; 956 iGeom_getEntAdj(geom, temp1, iBase_FACE, 957 &adj_surfs, &adj_surfs_alloc, &adj_surfs_size, 958 &result); 959 960 int order = iBase_INTERLEAVED; 961 int mc_size = 3*adj_surfs_size; 962 std::vector<double> minc(mc_size), maxc(mc_size); 963 double *minc_ptr = &minc[0], *maxc_ptr = &maxc[0]; 964 iGeom_getArrBoundBox(geom, adj_surfs, adj_surfs_size, &order, 965 &minc_ptr, &mc_size, &mc_size, 966 &maxc_ptr, &mc_size, &mc_size, &result); 1007 967 1008 968 … … 1014 974 1015 975 iBase_EntityHandle this_surf = 0; 1016 for (int i = 0; i < num_adj_surfs; i++) {1017 if (minc .get(3*i+1) >= -1.0e-6 && maxc.get(3*i+1)<= 1.0e-6) {1018 this_surf = adj_surfs .get(i);976 for (int i = 0; i < adj_surfs_size; i++) { 977 if (minc[3*i+1] >= -1.0e-6 && maxc[3*i+1] <= 1.0e-6) { 978 this_surf = adj_surfs[i]; 1019 979 break; 1020 980 } … … 1022 982 1023 983 if (0 == this_surf) { 1024 iBase::Error err = iBase::Error::_create(); 1025 err.set(iBase::ErrorType_FAILURE, "Didn't create surface for rotate."); 1026 err.setNote("Didn't create surface for rotate."); 1027 throw err; 984 int ierr = iBase_FAILURE; 985 CE("Didn't create surface for rotate."); 1028 986 } 1029 987 1030 988 1031 989 temp2 = NULL; 1032 iGeom_copyEnt( geom, this_surf, temp2, &result);990 iGeom_copyEnt( geom, this_surf, &temp2, &result); 1033 991 1034 992 if (iBase_SUCCESS != result) { … … 1059 1017 1060 1018 1061 iGeom_rotateEnt( geom, temp1, 90.0, 1.0, 0.0, 0.0, &result);1019 iGeom_rotateEnt( geom, &temp1, 90.0, 1.0, 0.0, 0.0, &result); 1062 1020 1063 1021 if (iBase_SUCCESS != result) { … … 1067 1025 1068 1026 1069 iGeom_moveEnt( geom, temp1, -(a_neg+anose_neg),1027 iGeom_moveEnt( geom, &temp1, -(a_neg+anose_neg), 1070 1028 0.5, -.5*cell_height+.25*tdiff, &result); 1071 1029 … … 1077 1035 1078 1036 // find surface of previous volume with max y coord 1079 std::vector<iBase_EntityHandle> adj_surfs; 1080 std::vector<double> minc, maxc; 1081 int num_adj_surfs, num_minc, num_maxc; 1082 1083 iBase_EntityHandle *adj_surfs = NULL; 1084 int adj_surfs_alloc = 0; 1085 iGeom_getEntAdj(geom, temp1, ::iBase_FACE, adj_surfs, 1037 adj_surfs = NULL; 1038 adj_surfs_alloc = 0; 1039 iGeom_getEntAdj(geom, temp1, ::iBase_FACE, &adj_surfs, 1086 1040 &adj_surfs_alloc, &adj_surfs_size, &result); 1087 1041 1088 1089 ::iBase::StorageOrder order = ::iBase::StorageOrder_INTERLEAVED;1090 1091 1092 iGeom_getArrBoundBox(geom, &adj_surfs, num_adj_surfs, &order,1093 &m inc, &num_minc, &maxc, &num_maxc, &result);1042 mc_size = 3*adj_surfs_size; 1043 minc.resize(mc_size); maxc.resize(mc_size); 1044 minc_ptr = &minc[0]; maxc_ptr = &maxc[0]; 1045 iGeom_getArrBoundBox(geom, adj_surfs, adj_surfs_size, &order, 1046 &minc_ptr, &mc_size, &mc_size, 1047 &maxc_ptr, &mc_size, &mc_size, &result); 1094 1048 1095 1049 … … 1101 1055 1102 1056 1103 iBase_EntityHandlethis_surf = 0;1104 for (int i = 0; i < num_adj_surfs; i++) {1105 if (minc .get(3*i+1) >= -1.0e-6 && maxc.get(3*i+1)<= 1.0e-6) {1106 this_surf = adj_surfs .get(i);1057 this_surf = 0; 1058 for (int i = 0; i < adj_surfs_size; i++) { 1059 if (minc[3*i+1] >= -1.0e-6 && maxc[3*i+1] <= 1.0e-6) { 1060 this_surf = adj_surfs[i]; 1107 1061 break; 1108 1062 } … … 1111 1065 1112 1066 if (0 == this_surf) { 1113 iBase::Error err = iBase::Error::_create(); 1114 err.set(iBase::ErrorType_FAILURE, "Didn't create surface for rotate."); 1115 err.setNote("Didn't create surface for rotate."); 1116 throw err; 1067 int ierr = iBase_FAILURE; 1068 CE("Didn't create surface for rotate."); 1117 1069 } 1118 1070 1119 1071 1120 1072 temp2 = NULL; 1121 iGeom_copyEnt( geom, this_surf, temp2, &result);1073 iGeom_copyEnt( geom, this_surf, &temp2, &result); 1122 1074 1123 1075 if (iBase_SUCCESS != result) { … … 1142 1094 1143 1095 temp1 = NULL; 1144 iGeom_subtract (geom, cyls, ell_pos, &temp1, &result);1096 iGeom_subtractEnts(geom, cyls, ell_pos, &temp1, &result); 1145 1097 1146 1098 if (iBase_SUCCESS != result) { … … 1152 1104 1153 1105 temp2 = NULL; 1154 iGeom_subtract (geom, temp1, ell_neg, &temp2, &result);1106 iGeom_subtractEnts(geom, temp1, ell_neg, &temp2, &result); 1155 1107 1156 1108 if (iBase_SUCCESS != result) { … … 1161 1113 1162 1114 1163 iGeom_moveEnt( geom, temp2, 0.0, 0.0, -.25*tdiff, &result);1115 iGeom_moveEnt( geom, &temp2, 0.0, 0.0, -.25*tdiff, &result); 1164 1116 1165 1117 if (iBase_SUCCESS != result) { … … 1172 1124 1173 1125 temp3 = NULL; 1174 iGeom_copyEnt( geom, rounded_slot_manif, temp3, &result);1126 iGeom_copyEnt( geom, rounded_slot_manif, &temp3, &result); 1175 1127 1176 1128 if (iBase_SUCCESS != result) { … … 1180 1132 1181 1133 1182 iGeom_rotateEnt( geom, temp3, 90.0, 0.0, 0.0, 1.0, &result);1134 iGeom_rotateEnt( geom, &temp3, 90.0, 0.0, 0.0, 1.0, &result); 1183 1135 1184 1136 if (iBase_SUCCESS != result) { … … 1188 1140 1189 1141 1190 std::vector<iBase_EntityHandle> tempa = 1191 std::vector<iBase_EntityHandle>::create1d(3); 1192 1193 tempa.set(0, temp2); 1194 tempa.set(1, rounded_slot_manif); 1195 tempa.set(2, temp3); 1142 iBase_EntityHandle tempa[] = {temp2, rounded_slot_manif, temp3}; 1196 1143 temp4 = NULL; 1197 1144 1198 1145 1199 iGeom_uniteEnts( geom, &tempa, 3, &temp4, &result);1146 iGeom_uniteEnts( geom, tempa, 3, &temp4, &result); 1200 1147 1201 1148 if (iBase_SUCCESS != result) { … … 1206 1153 1207 1154 temp1 = NULL; 1208 void iGeom_sectionEnt( geom,temp4, 0.0, 1.0, 0.0,1209 0.0, false, &temp1, &result);1155 iGeom_sectionEnt( geom, &temp4, 0.0, 1.0, 0.0, 1156 0.0, false, &temp1, &result); 1210 1157 1211 1158 if (iBase_SUCCESS != result) { … … 1216 1163 1217 1164 dds_cell = NULL; 1218 void iGeom_sectionEnt( geom,temp1, 1.0, 0.0,1219 0.0, 0.0, true, &dds_cell, &result);1165 iGeom_sectionEnt( geom, &temp1, 1.0, 0.0, 1166 0.0, 0.0, true, &dds_cell, &result); 1220 1167 1221 1168 if (iBase_SUCCESS != result) { … … 1233 1180 bool cleanup_other_geom(iGeom_Instance &geom, 1234 1181 iBase_EntityHandle &dds_cell, 1235 std::vector<iBase_EntityHandle> &initial_gents,1182 iBase_EntityHandle *initial_gents, 1236 1183 int initial_gents_size) 1237 1184 { 1238 1185 // get all the 3-dimensional entities, and all 3d entities adj to dds_cell 1239 std::vector<iBase_EntityHandle> adj_gents,deletable_gents;1240 int all_gents_size, adj_gents_size,deletable_gents_size;1186 std::vector<iBase_EntityHandle> deletable_gents; 1187 int deletable_gents_size; 1241 1188 1242 1189 … … 1250 1197 1251 1198 if (iBase_SUCCESS != result) { 1252 std::cerr << "Trouble getting gentities of dimension" << dim << std::endl; 1253 return false; 1254 } 1255 1256 1199 std::cerr << "Trouble getting gentities of dimension" << iBase_REGION 1200 << std::endl; 1201 return false; 1202 } 1257 1203 1258 1204 iBase_EntityHandle *adj_gents = NULL; 1259 1205 int adj_gents_size, adj_gents_alloc; 1260 1206 // get all entities of this dimension 1261 iGeom_getEnt ities(geom, dds_cell, iBase_REGION, &adj_gents,1207 iGeom_getEntAdj(geom, dds_cell, iBase_REGION, &adj_gents, 1262 1208 &adj_gents_alloc, 1263 1209 &adj_gents_size, &result); 1264 1210 1265 1211 if (iBase_SUCCESS != result) { 1266 std::cerr << "Trouble getting gentities of dimension" << dim << std::endl; 1267 return false; 1268 } 1269 1270 1271 deletable_gents = deletable_gents.create1d(all_gents_size-1); 1272 deletable_gents_size = 0; 1273 1212 std::cerr << "Trouble getting gentities of dimension" << iBase_REGION 1213 << std::endl; 1214 return false; 1215 } 1216 1217 1274 1218 for (int i = 0; i < all_gents_size; i++) { 1275 1276 if (all_gents.get(i) == adj_gents.get(0)) { 1277 continue; 1278 } 1219 if (all_gents[i] == adj_gents[0]) continue; 1279 1220 1280 1221 bool insert_this = true; 1281 1222 for (int j = 0; j < initial_gents_size; j++) { 1282 1223 1283 if (all_gents .get(i) == initial_gents.get(j)) {1224 if (all_gents[i] == initial_gents[j]) { 1284 1225 insert_this = false; 1285 1226 break; … … 1287 1228 } 1288 1229 1289 if (insert_this) { 1290 deletable_gents.set(deletable_gents_size++, all_gents.get(i)); 1291 } 1230 if (insert_this) 1231 deletable_gents.push_back(all_gents[i]); 1292 1232 } 1293 1233 1294 1234 1295 for ( int i = 0; i < deletable_gents_size; i++) {1296 1297 iGeom_deleteEnt( geom, deletable_gents.get(i), &result);1235 for (std::vector<iBase_EntityHandle>::iterator vit = 1236 deletable_gents.begin(); vit != deletable_gents.end(); vit++) { 1237 iGeom_deleteEnt( geom, *vit, &result); 1298 1238 1299 1239 if (iBase_SUCCESS != result) { … … 1305 1245 return true; 1306 1246 } 1307 1308 1309 -
ddriv/trunk/MkEllCyl.cpp
r2696 r2754 19 19 #include <iostream> 20 20 #include "iGeom.h" 21 #include "iBase_SNL_SIDL_defs.h"22 21 #include "ellcylParamInfls.hpp" 23 24 25 /* ================= Typedef,Global section =============== */ 26 27 typedef void* iBase_EntityHandle; 28 22 #include <cstring> 29 23 30 24 … … 38 32 39 33 iBase_EntityHandle cyl_tmp, cyl; 40 41 iGeom_createCylinder( geom, params[0], params[1],34 int result; 35 iGeom_createCylinder(geom_iface, params[0], params[1], 42 36 params[2], &cyl_tmp, &result); 43 37 … … 48 42 49 43 50 iGeom_sectionEnt( geom ,cyl_tmp, 1.0, 0.0, 0.0, 0.0, false,44 iGeom_sectionEnt( geom_iface, &cyl_tmp, 1.0, 0.0, 0.0, 0.0, false, 51 45 &cyl, &result); 52 46 -
ddriv/trunk/MkILCCell.cpp
r2696 r2754 17 17 18 18 #include "iGeom.h" 19 #include "iBase_SNL_SIDL_defs.h"20 19 #include "ILCParamInfls.hpp" 21 20 #include <iostream> 21 #include <vector> 22 #include <cstring> 23 #include "math.h" 22 24 #include "ilcdefines.h" 23 25 26 #define CE(a) if (iBase_SUCCESS != result) { \ 27 std::cerr << a << std::endl; return false;} 28 29 30 #define HDECL(a) iBase_EntityHandle *a = NULL; \ 31 int a ## _alloc = 0, a ## _size; 32 24 33 /* ================= TypeDef/Global Section ================== */ 25 34 int result; 26 35 27 typedef void* iBase_EntityHandle;28 29 36 extern void 30 GetTangPoint(const double& xic, const double& yic, const double& ai,31 const double& bi,const double xtc, const double& ytc,32 const double& at, const double& bt, double& xi,33 double& yi, double& xt, double& yt);37 GetTangPoint(const double& xic, const double& yic, const double& ai, 38 const double& bi,const double xtc, const double& ytc, 39 const double& at, const double& bt, double& xi, 40 double& yi, double& xt, double& yt); 34 41 35 42 const bool debug = false; … … 37 44 38 45 double fixed_params[] = { 39 7.59,40 10.0,41 50.0,42 34.4,43 50.0,44 7.6,45 10.0,46 98.89,47 41.0,48 30.0,49 115.4,50 57.7,51 347,52 71.6,53 150.0,54 4.0,55 4.0,56 4.0,57 4.0,58 30.046 7.59, 47 10.0, 48 50.0, 49 34.4, 50 50.0, 51 7.6, 52 10.0, 53 98.89, 54 41.0, 55 30.0, 56 115.4, 57 57.7, 58 347, 59 71.6, 60 150.0, 61 4.0, 62 4.0, 63 4.0, 64 4.0, 65 30.0 59 66 }; 60 67 … … 62 69 #define ABS(a) (a > 0 ? a : -a) 63 70 64 EntityHandle65 construct_end_cell(iGeom_Instance &geom_mod,66 const double local_a1, const double local_a2,67 const double local_b1,68 const double local_al, const double local_bl,69 const double local_ar, const double local_br,70 const double local_ra1, const double local_ra2,71 const double local_zcr, const double local_zcl,72 const double local_b,73 const double local_zcb, const double local_zcll,74 const double local_zcc,75 const double local_all, const double local_bll,76 const double local_a1l, const double local_b1l,77 const double local_ra0,78 const bool reflect_it,79 const double x_offset);80 81 EntityHandle82 construct_half_cell(iGeom_Instance &geom_mod,83 const double local_a1, const double local_b1,84 const double local_al, const double local_bl,85 const double local_ra1, const double local_zcl,86 const double local_b,87 const bool reflect_it);88 89 90 EntityHandle get_surface(iGeom_Instance &geom_mod,91 iBase_EntityHandle from_gent,92 const double xyz_location,93 const int xyorz,94 const double tol);71 iBase_EntityHandle 72 construct_end_cell(iGeom_Instance &geom_mod, 73 const double local_a1, const double local_a2, 74 const double local_b1, 75 const double local_al, const double local_bl, 76 const double local_ar, const double local_br, 77 const double local_ra1, const double local_ra2, 78 const double local_zcr, const double local_zcl, 79 const double local_b, 80 const double local_zcb, const double local_zcll, 81 const double local_zcc, 82 const double local_all, const double local_bll, 83 const double local_a1l, const double local_b1l, 84 const double local_ra0, 85 const bool reflect_it, 86 const double x_offset); 87 88 iBase_EntityHandle 89 construct_half_cell(iGeom_Instance &geom_mod, 90 const double local_a1, const double local_b1, 91 const double local_al, const double local_bl, 92 const double local_ra1, const double local_zcl, 93 const double local_b, 94 const bool reflect_it); 95 96 97 iBase_EntityHandle get_surface(iGeom_Instance &geom_mod, 98 iBase_EntityHandle from_gent, 99 const double xyz_location, 100 const int xyorz, 101 const double tol); 95 102 96 103 const double RAD_TO_DEG = 180.0 / acos(-1.0); … … 108 115 { 109 116 110 if (NULL == params || 0 == num_params) {111 params = fixed_params;112 }113 114 double local_params[20];115 for (int i = 0; i < 20; i++) {116 local_params[i] = 1000.0*params[i];117 }117 if (NULL == params || 0 == num_params) { 118 params = fixed_params; 119 } 120 121 double local_params[20]; 122 for (int i = 0; i < 20; i++) { 123 local_params[i] = 1000.0*params[i]; 124 } 118 125 119 126 // read in center seven cells 120 if (debug) { 121 std::cout << "Reading in mid_7cells.sat." << std::endl; 122 } 123 124 std::vector<std::string> options; 125 std::string tmp_string = "mid_7cells.sat"; 126 127 iGeom_load(geom_iface, tmp_string, options, &result, tmp_string.length(), 0); 128 129 if (iBase_SUCCESS != result) { 130 std::cerr << "Failed Load." << std::endl; 131 return false; 132 } 127 if (debug) { 128 std::cout << "Reading in mid_7cells.sat." << std::endl; 129 } 130 131 iGeom_load(geom_iface, "mid_7cells.sat", NULL, &result, 132 strlen("mid_7cells.sat"), 0); 133 134 if (iBase_SUCCESS != result) { 135 std::cerr << "Failed Load." << std::endl; 136 return false; 137 } 133 138 134 139 135 140 // get the unchanged bodies in an array before we create the changing ones 136 iBase_EntityHandle *all_bods = NULL;137 int all_bods_size=0, all_bods_alloc;141 iBase_EntityHandle all_bods[11], *all_bods_ptr = &all_bods[0]; 142 int all_bods_alloc = 11, all_bods_size; 138 143 // get all entities of this dimension 139 iGeom_getEntities(geom_iface, 0, iBase_REGION, &all_bods, 140 &all_bods_alloc, &all_bods_size, &result); 141 142 if (iBase_SUCCESS != result) { 143 std::cerr << "Trouble getting gentities of dimension" 144 << dim << std::endl; 145 return false; 146 } 147 148 if (7 != all_bods_size) { 149 throw iBase::Error(); 150 } 151 152 153 /* ====================== PLM => Unknown Catch Condition =================== */ 154 } 155 catch (iBase::Error err) { 156 std::cerr << "Failed to get right number of bodies after reading unchanged ones." 157 << std::endl; 158 return false; 159 } 160 144 iGeom_getEntities(geom_iface, 0, iBase_REGION, 145 &all_bods_ptr, &all_bods_alloc, &all_bods_size, &result); 146 147 if (iBase_SUCCESS != result) { 148 std::cerr << "Trouble getting gentities of dimension" 149 << iBase_REGION << std::endl; 150 return false; 151 } 152 153 if (7 != all_bods_size) { 154 std::cerr << "wrong number of bodies produced." << std::endl; 155 return false; 156 } 157 161 158 /* ========================================================================= */ 162 159 163 160 164 161 165 // construct left end cell166 if (debug) { 167 std::cout << "Constructing left end cell." << std::endl;162 // construct left end cell 163 if (debug) { 164 std::cout << "Constructing left end cell." << std::endl; 168 165 } 169 166 … … 172 169 173 170 iBase_EntityHandle left_end_cell = 174 construct_end_cell(geom_iface,175 a1, a2, b1, al, bl, ar, br, ra1, ra2,176 zcr, zcl, b, zcb, zcll, zcc, all, bll, a1l, b1l, ra0,177 false, left_offset);171 construct_end_cell(geom_iface, 172 a1, a2, b1, al, bl, ar, br, ra1, ra2, 173 zcr, zcl, b, zcb, zcll, zcc, all, bll, a1l, b1l, ra0, 174 false, left_offset); 178 175 179 176 if (0 == left_end_cell) { … … 182 179 } 183 180 184 all_bods .set(9, left_end_cell);181 all_bods[9] = left_end_cell; 185 182 all_bods_size++; 186 183 187 std::vector<std::string> options; 188 int result; 189 std::string str = std::string("ilc_leftbod.sat"); 190 191 iGeom_save( geom_iface, str, options, &result, str.length(), 0); 192 193 if (iBase_SUCCESS != result) { 194 std::cerr << "ERROR : can not save a geometry to " << std::endl; 195 return false; 196 } 197 198 199 // construct right end cell 200 if (debug) { 201 std::cout << "Constructing right end cell." << std::endl; 184 iGeom_save( geom_iface, "ilc_leftbod.sat", "", &result, 185 strlen("ilc_leftbod.sat"), 0); 186 187 if (iBase_SUCCESS != result) { 188 std::cerr << "ERROR : can not save a geometry to " << std::endl; 189 return false; 190 } 191 192 193 // construct right end cell 194 if (debug) { 195 std::cout << "Constructing right end cell." << std::endl; 202 196 } 203 197 … … 205 199 end_suffix = "right"; 206 200 iBase_EntityHandle right_end_cell = 207 construct_end_cell(geom_iface, a1, a2, b1, al, bl, ar, br,208 ra1, ra2,209 zcr, zcl, b, zcb, zcll, zcc, all, bll, a1l, b1l, ra0,210 true, right_offset);201 construct_end_cell(geom_iface, a1, a2, b1, al, bl, ar, br, 202 ra1, ra2, 203 zcr, zcl, b, zcb, zcll, zcc, all, bll, a1l, b1l, ra0, 204 true, right_offset); 211 205 212 206 if (0 == right_end_cell) { … … 215 209 } 216 210 217 all_bods .set(10, right_end_cell);211 all_bods[10] = right_end_cell; 218 212 all_bods_size++; 219 213 220 214 221 int result; 222 std::string str1 = std::string("ilc_rightbod.sat"); 223 224 iGeom_save(geom_iface, str1, options, &result, str1.length(), 0); 225 226 if (iBase_SUCCESS != result) { 227 std::cerr << "ERROR : can not save a geometry to " << std::endl; 215 std::string str1 = std::string(); 216 217 iGeom_save(geom_iface, "ilc_rightbod.sat", NULL, &result, 218 strlen("ilc_rightbod.sat"), 0); 219 220 if (iBase_SUCCESS != result) { 221 std::cerr << "ERROR : can not save a geometry to " << std::endl; 222 return false; 223 } 224 225 226 227 // get all the bodies for imprint/merge 228 if (debug) { 229 std::cout << "Gathering bodies for imprint/merge." << std::endl; 230 } 231 232 HDECL(im_bods); 233 iBase_EntitySetHandle root_set; 234 iGeom_getRootSet(geom_iface, &root_set, &result); 235 236 iGeom_getEntities(geom_iface, root_set, iBase_REGION, 237 &im_bods, &im_bods_alloc, &im_bods_size, &result); 238 CE("Failed to get regions in preparation for imprint."); 239 240 // now scale & change params 241 242 for (int i = 0; i < im_bods_size; i++) { 243 244 iBase_EntityHandle this_bod = im_bods[i]; 245 246 iGeom_scaleEnt( geom_iface, &this_bod, .001, .001, .001, &result); 247 248 if (iBase_SUCCESS != result) { 249 250 std::cerr << "Failed Scale." << std::endl; 228 251 return false; 229 } 230 231 232 233 // get all the bodies for imprint/merge 234 if (debug) { 235 std::cout << "Gathering bodies for imprint/merge." << std::endl; 236 } 237 238 std::vector<iBase_EntityHandle> im_bods; 239 int im_bods_size = 0; 240 241 /* ================ PLM => Did not find porting for getEntitites ====== */ 242 243 try { 244 geom_topo.getEntities(0, iBase_REGION, im_bods, im_bods_size);
![(please configure the [header_logo] section in trac.ini)](/projects/ITAPS/chrome/common/trac_banner.png)