Changeset 3204 for cgm

Show
Ignore:
Timestamp:
10/14/09 15:27:42 (5 months ago)
Author:
jvporter
Message:

Add support for iGeom_get(Ent|Arr)UToUV

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cgm/trunk/itaps/iGeom_CGMA.cc

    r3203 r3204  
    45024502                   int* err) 
    45034503{ 
    4504   RETURN(iBase_NOT_SUPPORTED); 
    4505  
     4504  RefEdge* edge = dynamic_cast<RefEdge*>((RefEntity*)edge_handle); 
     4505  RefFace* face = dynamic_cast<RefFace*>((RefEntity*)face_handle); 
     4506  if (!edge || !face) { 
     4507    RETURN(iBase_INVALID_ENTITY_TYPE); 
     4508  } 
     4509   
     4510  CubitVector xyz; 
     4511  CubitStatus s; 
     4512  s = edge->position_from_u( in_u, xyz ); 
     4513  if (s != CUBIT_SUCCESS) 
     4514    RETURN(iBase_FAILURE); 
     4515 
     4516  s = face->u_v_from_position( xyz, *u, *v ); 
     4517  RETURN( (s == CUBIT_SUCCESS ? iBase_SUCCESS : iBase_FAILURE) ); 
     4518} 
     4519 
     4520static bool 
     4521iGeom_check_array_size(int size1, int size2) 
     4522{ 
     4523    return size1 == 1 || size2 == 1 || size1 == size2;         
     4524} 
    45064525 
    45074526void 
     
    45194538                   int* err) 
    45204539{ 
    4521   RETURN(iBase_NOT_SUPPORTED); 
    4522  
     4540  int count; 
     4541  size_t edge_step, face_step, coord_step, in_u_step; 
     4542 
     4543  if (!(iGeom_check_array_size(edge_handles_size, face_handles_size) && 
     4544        iGeom_check_array_size(edge_handles_size, in_u_size) && 
     4545        iGeom_check_array_size(face_handles_size, in_u_size))) { 
     4546    ERROR(iBase_INVALID_ENTITY_COUNT, "Mismatched input array sizes."); 
     4547  } 
     4548 
     4549  edge_step = (edge_handles_size == 1) ? 0:1; 
     4550  face_step = (face_handles_size == 1) ? 0:1; 
     4551  in_u_step = (in_u_size == 1) ? 0:1; 
     4552 
     4553  count = std::max(edge_handles_size, std::max(face_handles_size, in_u_size)); 
     4554 
     4555  CHECK_SIZE( *uv, double, 2*count ); 
     4556   
     4557  const double *in_u_iter; 
     4558  double *u, *v; 
     4559  in_u_iter = in_u; 
     4560  u = *uv; 
     4561  if (storage_order == iBase_BLOCKED) { 
     4562    v = u + count; 
     4563    coord_step = 1; 
     4564  }  
     4565  else { 
     4566    v = u + 1; 
     4567    coord_step = 2; 
     4568  } 
     4569   
     4570  iBase_ErrorType result = iBase_SUCCESS; 
     4571  RefEntity** edge_ent = (RefEntity**)edge_handles; 
     4572  RefEntity** face_ent = (RefEntity**)face_handles; 
     4573  for (int i = 0; i < count; ++i) { 
     4574    RefEdge* edge = dynamic_cast<RefEdge*>(*edge_ent); 
     4575    RefFace* face = dynamic_cast<RefFace*>(*face_ent); 
     4576    if (!edge || !face) { 
     4577      RETURN(iBase_INVALID_ENTITY_TYPE); 
     4578    } 
     4579     
     4580    CubitVector xyz; 
     4581    CubitStatus s; 
     4582    s = edge->position_from_u( *in_u_iter, xyz ); 
     4583    if (CUBIT_SUCCESS != s) 
     4584      result = iBase_FAILURE; 
     4585    s = face->u_v_from_position( xyz, *u, *v ); 
     4586    if (CUBIT_SUCCESS != s) 
     4587      result = iBase_FAILURE; 
     4588 
     4589    edge_ent += edge_step; 
     4590    face_ent += face_step; 
     4591    in_u_iter += in_u_step; 
     4592    u += coord_step; 
     4593    v += coord_step; 
     4594  } 
     4595   
     4596  RETURN(result); 
     4597} 
    45234598 
    45244599void