当前位置: 首页>>代码示例>>C++>>正文


C++ DLIList::clean_out方法代码示例

本文整理汇总了C++中DLIList::clean_out方法的典型用法代码示例。如果您正苦于以下问题:C++ DLIList::clean_out方法的具体用法?C++ DLIList::clean_out怎么用?C++ DLIList::clean_out使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DLIList的用法示例。


在下文中一共展示了DLIList::clean_out方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: get_all_children

//-------------------------------------------------------------------------
// Purpose       : 
//
// Special Notes : 
//
// Creator       : Jason Kraftcheck
//
// Creation Date : 05/26/04
//-------------------------------------------------------------------------
void PartitionBody::get_all_children( DLIList<PartitionEntity*>& list )
{
  DLIList<PartitionEntity*> tmp;
  for (SubEntitySet* ptr = childList; ptr; ptr = ptr->bodyNext )
  {
    tmp.clean_out();
    ptr->get_sub_entities( tmp );
    list += tmp;
    
    tmp.clean_out();
    ptr->get_lower_order( tmp );
    list += tmp;
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:23,代码来源:PartitionBody.cpp

示例2: get_attributes

//-------------------------------------------------------------------------
// Purpose       : Get named attributes
//
// Special Notes : 
//
// Creator       : Jason Kraftcheck
//
// Creation Date : 03/03/03
//-------------------------------------------------------------------------
void CompositeGeom::get_attributes( const char* name,
                                    DLIList<CubitSimpleAttrib>& list )
{
  if (entityList.size() == 1)
  {
      // handle 8.1 attribs on single-entity 'composites'
    list.clean_out();
    entityList[0].entity->get_simple_attribute(COMPOSITE_DATA_ATTRIB_NAME,list);
    while (list.size())
    {
      CubitSimpleAttrib attrib = list.pop();
      if (attrib.int_data_list()[0] == 1)
      {
        entityList[0].entity->remove_simple_attribute_virt(attrib);
        std::vector<CubitString> s(attrib.string_data_list().begin()+1, attrib.string_data_list().end());
        std::vector<int> i(attrib.int_data_list().begin()+1, attrib.int_data_list().end());
        CubitSimpleAttrib new_attrib(&s, &attrib.double_data_list(), &i);
        entityList[0].entity->append_simple_attribute_virt(new_attrib);
      }
    }
    
    entityList[0].entity->get_simple_attribute(name, list);
  }
    
  for (CompositeAttrib* ptr = listHead; ptr; ptr = ptr->next)
    if (ptr->name() == name)
      list.append(ptr->csa());
}
开发者ID:chrismullins,项目名称:cgma,代码行数:37,代码来源:CompositeGeom.cpp

示例3: merge_prepare

void CAMergePartner::merge_prepare(DLIList<RefEntity*> &merge_list)
{
  DLIList<CubitAttrib*> my_ca_list;
  CAMergePartner *my_camp_ptr;
  RefEntity* re_ptr;

    // get all the merge partner attributes that are on my owner
  attribOwnerEntity->find_cubit_attrib_type(CA_MERGE_PARTNER, my_ca_list);
  merge_list.clean_out();
  DLIList<ToolDataUser*> td_list, temp_td_list;
  int i;
  for (i = my_ca_list.size(); i > 0; i--)
  {
    my_camp_ptr = CAST_TO(my_ca_list.get(),CAMergePartner);
    my_ca_list.step();
    td_list.clean_out();
      // get all the objects with this unique id (which is also the merge id)
    TDUniqueId::find_td_unique_id(my_camp_ptr->merge_id(), temp_td_list);
    td_list += temp_td_list;
  }
  
    // now put those entities into the merge_list
  for (i = td_list.size(); i > 0; i--) 
  {
    re_ptr = CAST_TO(td_list.get(), RefEntity);
    if (re_ptr) 
    {
      CubitAttrib *tmp_attrib = re_ptr->get_cubit_attrib( CA_MERGE_PARTNER, CUBIT_FALSE );
      if( tmp_attrib )
        merge_list.append(re_ptr);
    }
    td_list.step();
  }
  
    // Now get bridge sense for each entity in list.
    // Add this entity to list, too.
  merge_list.append( attribOwnerEntity );
  for( i = merge_list.size(); i--; )
  {
    RefEntity* ent = merge_list.get_and_step();
    TopologyEntity* te = dynamic_cast<TopologyEntity*>(ent);
    if( te->bridge_manager()->number_of_bridges() != 1 )
      continue;
    
    my_ca_list.clean_out();
    ent->find_cubit_attrib_type(CA_MERGE_PARTNER, my_ca_list);
    assert( my_ca_list.size() < 2);
    if( !my_ca_list.size() )
      continue;
    
    my_camp_ptr = dynamic_cast<CAMergePartner*>(my_ca_list.get());
    if( my_camp_ptr->bridge_sense() == CUBIT_UNKNOWN )
      continue;
  }  
  merge_list.pop(); // take attribOwnerEntity back off list
    
  return;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:58,代码来源:CAMergePartner.cpp

示例4: get_relatives

void DagDrawingTool::get_relatives( ModelEntity* source_ptr,
	DLIList<ModelEntity*>& result_set, int direction )
{
	result_set.clean_out();
	if( direction == DDT_UP_DAG ) 
		source_ptr->get_parents( &result_set );
	else if( direction == DDT_DOWN_DAG )
	  source_ptr->get_children( &result_set  );
	else assert( (direction == DDT_UP_DAG) || (direction == DDT_DOWN_DAG) );
}
开发者ID:chrismullins,项目名称:cgma,代码行数:10,代码来源:DagDrawingTool.cpp

示例5: find_td_unique_id

int TDUniqueId::find_td_unique_id(const int temp_id,
                                  DLIList<ToolDataUser*> &td_list,
                                  const RefEntity *related_entity)
{
  td_list.clean_out();

  int unique_id = temp_id;

  //if we are not doing an undo and importing and merging within a file...
  if( !GSaveOpen::performingUndo && 
       GeometryQueryTool::importingSolidModel &&
      !GeometryQueryTool::mergeGloballyOnImport)
  {
    //see if the old id maps to a new id...if so, use the new id
    UIDMap old_uid_to_new_uid_map = CAUniqueId::get_old_to_new_uid_map();
    
    UIDMap::iterator iter;
    iter = old_uid_to_new_uid_map.find( unique_id );
    
    if( iter != old_uid_to_new_uid_map.end() )
      unique_id = (*iter).second;
  }
  
  std::pair<TDUIDList::iterator, TDUIDList::iterator> 
    bounds_pair = unique_id_list().equal_range(unique_id);

  TDUIDList::iterator
    it = bounds_pair.first, upper = bounds_pair.second;
 
  if(it == unique_id_list().end())
    return 0;

  if ((*it).first == unique_id ) {
      // the lower bound key is equal to unique_id, so this id is in the list

      // look for duplicate id's, return one that's directly related
      // get all td's with that id
    for (; it != upper; it++) 
    {
      bool related = true;
      ToolDataUser *temp_tdu = (*it).second->owner_entity();
      if (NULL != related_entity) {
        TopologyEntity *topo_ent = CAST_TO(temp_tdu, TopologyEntity);
        RefEntity* temp_entity = const_cast<RefEntity*>(related_entity);
        if (!topo_ent ||
            !topo_ent->is_directly_related(CAST_TO(temp_entity, TopologyEntity))) 
          related = false;
      }
      if (related) td_list.append(temp_tdu);
    }
  }

  return td_list.size();
}
开发者ID:chrismullins,项目名称:cgma,代码行数:54,代码来源:TDUniqueId.cpp

示例6: get_vertices

//=============================================================================
//Function:  get_vertices (PUBLIC)
//Description: get the list of ChollaPoints on this surface
//Author: sjowen
//Date: 09/11/09
//=============================================================================
void ChollaSurface::get_vertices( DLIList<ChollaPoint *> &chpt_list )
{
  chpt_list.clean_out();
  ChollaCurve *chcurv_ptr;
  for (int ii=0; ii<curveList.size(); ii++)
  {
    chcurv_ptr = curveList.get_and_step();
    DLIList<ChollaPoint *> chc_pts = chcurv_ptr->get_points(); 
    chpt_list += chc_pts;
  }
  chpt_list.uniquify_unordered();
}
开发者ID:chrismullins,项目名称:cgma,代码行数:18,代码来源:ChollaSurface.cpp

示例7: get_neighborhood_points_sorted

void PointGridSearch::get_neighborhood_points_sorted(
  DLIList<CubitPoint*> &point_list,
  const CubitVector& center, double cut_off)
{
  point_list.clean_out();
  DLIList<CubitPoint*> temp_point_list;
  int i;

  for (int k = boundingCellMinimumZ; k <= boundingCellMaximumZ; k++)
  {
    int kn = numberGridCellsY * k;
    for (int j = boundingCellMinimumY; j <= boundingCellMaximumY; j++)
    {
      int jn = numberGridCellsX * (kn + j);
      for ( i = boundingCellMinimumX; i <= boundingCellMaximumX; i++)
      {
	int in = jn + i;
        if (neighborhoodList[in])
        {
          temp_point_list += *(neighborhoodList[in]);
        }
      }
    }
  }

  // evaluate point distance to center ... remove those larger than cut_off
  SDLByDouble sorted_index_list;
  IndexedDouble *ID;  
  CubitVector vec;
  cut_off *= cut_off;
  temp_point_list.reset();
  for ( i = 0; i < temp_point_list.size(); i++)
  {
    vec = center - temp_point_list.get_and_step()->coordinates();
    double distance = vec.length_squared();
    if (distance < cut_off)
    {
      ID = new IndexedDouble( i, distance );
      sorted_index_list.append( ID );
    }
  }

  sorted_index_list.sort();
  temp_point_list.reset();
  for ( i = 0; i < sorted_index_list.size(); i++ )
  {
    ID = sorted_index_list.get_and_step();
    point_list.append( temp_point_list.next( ID->index() ) );
    delete ID;
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:51,代码来源:PointGridSearch.cpp

示例8: mass_properties

CubitStatus PartitionShell::mass_properties( CubitVector& centroid, 
                                             double& volume )
{
  PartitionCoSurf* cosurf = 0;
  DLIList<CubitFacetData*> facets;
  CubitVector p1, p2, p3, normal;
  const CubitVector p0(0.0, 0.0, 0.0);
  centroid.set(0.0, 0.0, 0.0 );
  volume = 0.0;
  
  while ((cosurf = next_co_surface( cosurf )))
  {
    if (is_nonmanifold( cosurf->get_surface() ))
      continue;
    
    facets.clean_out();
    cosurf->get_surface()->get_facet_data( facets );
    
    for (int i = facets.size(); i--; )
    {
      CubitFacet* facet = facets.step_and_get();
      p1 = facet->point(0)->coordinates();
      p2 = facet->point(1)->coordinates();
      p3 = facet->point(2)->coordinates();
      normal = (p3 - p1) * (p2 - p1);
  
      double two_area = normal.length();
      if (two_area > CUBIT_RESABS )
      {
        if (cosurf->sense() == CUBIT_REVERSED)
          normal = -normal;
        
        normal /= two_area;
        
        double height = normal % (p0 - p1);
        double vol = two_area * height;
        
        volume += vol;
        centroid += vol * (p0 + p1 + p2 + p3);
      }
    }
  }
  
  if (volume > CUBIT_RESABS)
    centroid /= 4.0 * volume;
  volume /= 6.0;
  return CUBIT_SUCCESS;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:48,代码来源:PartitionShell.cpp

示例9: get_neighborhood_facets

void PointGridSearch::get_neighborhood_facets( DLIList<CubitFacet*> &facet_list )
{
  // retrieve points over the current bounding box range

  facet_list.clean_out();
  DLIList<CubitPoint*> point_list;
  get_neighborhood_points( point_list );

  // retrieve all faces attached to the points in point_list

  for (int i = 0; i < point_list.size(); i++)
  {
    CubitPoint* point = point_list.get_and_step();

    DLIList<CubitFacet*> temp_facet_list;
    point->facets(temp_facet_list);

    for (int j = 0; j < temp_facet_list.size(); j++)
    {
      CubitFacet* facet = temp_facet_list.get_and_step();

      if (!facet->marked())
      {
        facet->marked(CUBIT_TRUE);
        facet_list.append(facet);
      }
    }
  }

  // unmark the found faces and return face_list

  for (int m = 0; m < facet_list.size(); m++)
  {
    facet_list.get_and_step()->marked(CUBIT_FALSE);
  }

}
开发者ID:chrismullins,项目名称:cgma,代码行数:37,代码来源:PointGridSearch.cpp

示例10: get_neighborhood_points

void PointGridSearch::get_neighborhood_points( DLIList<CubitPoint*> &point_list )
{
  // retrieve points over the current bounding box range

  point_list.clean_out();

  for (int k = boundingCellMinimumZ; k <= boundingCellMaximumZ; k++)
  {
    int kn = numberGridCellsY * k;
    for (int j = boundingCellMinimumY; j <= boundingCellMaximumY; j++)
    {
      int jn = numberGridCellsX * (kn + j);
      for (int i = boundingCellMinimumX; i <= boundingCellMaximumX; i++)
      {
        int in = jn + i;
        assert( in >= 0 && in < numberGridCells );
        if (neighborhoodList[in])
        {
           point_list += *(neighborhoodList[in]);
        }
      }
    }
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:24,代码来源:PointGridSearch.cpp

示例11: make_Point

CubitStatus make_Point()
{
  GeometryQueryTool *gti = GeometryQueryTool::instance();
  GeometryModifyTool *gmti = GeometryModifyTool::instance();

  DLIList<Body*> bodies;
  DLIList<RefEntity*>  free_entities;

  // Read in the geometry from files specified on the command line
  const char *argv = "stitch.name_occ";
  CubitStatus status = read_geometry(1, &argv, false);
  if (status == CUBIT_FAILURE) exit(1);
  //Read in 2 volumes.

  gti->bodies(bodies);
  DLIList<Body*> new_bodies;
  DLIList<Body*> from_bodies;
  BodySM* from_body = bodies.get()->get_body_sm_ptr();
  from_bodies.append(bodies.get());
  CubitVector v1(.5,1,3);
  CubitVector v2(.5,2,2);
  CubitVector v3(.5,1,1);
  BodySM* midplane_bodysm = 0;
  status = OCCModifyEngine::instance()->get_mid_plane(v1, v2, v3, from_body, midplane_bodysm);
  if(midplane_bodysm)
  {
    Body *midplane_body;
    midplane_body = gti->make_Body(midplane_bodysm);
    double d = midplane_body->measure();
    assert( d > 99.9999 && d < 100.00001);
  }

  v1.x(2);
  v2.x(2);
  v3.x(2);
  
  midplane_bodysm = 0;
  status = OCCModifyEngine::instance()->get_mid_plane(v1, v2, v3, from_body, midplane_bodysm);
  if(midplane_bodysm)
  {
    Body *midplane_body;
    midplane_body = gti->make_Body(midplane_bodysm);
    double d = midplane_body->measure();
    assert( d > 69.9999 && d < 70.00001);
  }

  DLIList<Body*> neighbor_list;
  status = gmti->webcut_with_plane(from_bodies, v1, v2, v3, new_bodies, neighbor_list, ONLY_INVOLVED_BODIES);
  double d = new_bodies.step_and_get()->measure();
  CubitVector v = new_bodies.get()->center_point();
  int n = new_bodies.get()->num_ref_faces();
  assert(n==8);
  assert(d <= 710 && d > 709.999999);
  // n = 8
  //new bodies has 2 bodies, one has a volume = 170 and the other has a 
  //volume = 710; each of them has 8 ref_faces. 

  bodies.clean_out();
  gti->bodies(bodies);
  //delete all entities
  gti->delete_Body(bodies); 
  
  gti->get_free_ref_entities(free_entities);
  assert(free_entities.size() ==0);

  return CUBIT_SUCCESS;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:67,代码来源:operation.cpp

示例12: sort_and_print_ids

void CubitUtil::sort_and_print_ids( const char *const heading,
                                      DLIList<int> &id_list,
                                      int should_sort, int report_once,
                                      int wrap )
{
    // sort, if desired
  if ( should_sort ) {
    id_list.sort();
  }

  if ( report_once ) {
    DLIList <int> id_list_2( id_list );
    id_list_2.reset();
    id_list.clean_out();
    id_list.append( id_list_2.get_and_step() );
    for ( int j = id_list_2.size()-1; j--; )
    {
      if ( id_list_2.get() != id_list_2.prev() )
        id_list.append( id_list_2.get() );
      id_list_2.step();
    }
  }

  if( wrap == -1 )
  {
    // print out ranges
    int begin = id_list.get_and_step();
    int end = begin;
    int current = -1;
    PRINT_INFO("  The %d %s ids are %d", id_list.size(), heading, begin);
    for (int i=id_list.size()-1; i > 0; i--) {
      current = id_list.get_and_step();
      if (current == end+1) {
        end++;
      }
      else {
        if (end == begin) {
          PRINT_INFO(", %d", current);
        }
        else if (end == begin+1) {
          PRINT_INFO(", %d, %d", end, current);
        }
        else {
          PRINT_INFO(" to %d, %d", end, current);
        }
        begin = current;
        end = begin;
      }
    }
    if (current == begin + 1)	{
      PRINT_INFO(", %d", current);
    }
    else if (current != begin) {
      PRINT_INFO(" to %d", current);
    }
    PRINT_INFO(".\n");
  }
  else
  {
    char pre_string[67];
    sprintf( pre_string, "  The %d %s ids are: ", id_list.size(),heading );
    CubitUtil::list_entity_ids( pre_string, id_list, wrap, ".\n", CUBIT_FALSE,
                                CUBIT_FALSE );
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:65,代码来源:CubitUtil.cpp

示例13: read_attributes

//-------------------------------------------------------------------------
// Purpose       : Read and remove attributes from underlying entities
//
// Special Notes : 
//
// Creator       : Jason Kraftcheck
//
// Creation Date : 06/30/03
//-------------------------------------------------------------------------
void CompositeGeom::read_attributes( GeometryEntity* geom_ptr )
{
  DLIList<CubitSimpleAttrib> list;
  int i;

    // remove any attributes from previous read
  rem_all_attributes();

  if (geom_ptr)
  {
      // Special case for point-curves (no real curves to write
      // attirbutes to.)  Write to passed entity instead.
    assert(entityList.size() == 0);
    geom_ptr->get_simple_attribute(COMPOSITE_DATA_ATTRIB_NAME,list);
    
    list.reset();
    for (i = list.size(); i--; )
    {
      const CubitSimpleAttrib& attrib = list.get_and_step();
      assert(attrib.int_data_list().size());
      if (attrib.int_data_list()[0] == entityList.size())
      {
        geom_ptr->remove_simple_attribute_virt(attrib);
        CubitSimpleAttrib c = attrib;
        c.int_data_list().erase(c.int_data_list().begin());
        c.string_data_list().erase(c.string_data_list().begin());
        listHead = new CompositeAttrib(c,listHead);
      }
    }
    
    return;
  }

  int index_of_entity_with_attribs = -1;

  for (i = 0; i < entityList.size(); i++)
  {
    list.clean_out();
    entityList[i].entity->get_simple_attribute(COMPOSITE_DATA_ATTRIB_NAME,list);

    if( list.size() )
      index_of_entity_with_attribs = i;
  
    list.reset();
    for (int j = list.size(); j--; )
    {
      const CubitSimpleAttrib& attrib = list.get_and_step();
      assert(attrib.int_data_list().size());
      if (attrib.int_data_list()[0] == entityList.size())
      {
        // Take the attributes off of the current entity and put them on the first entity
        // in this list.  I believe this is ok to do because the attributes should apply to
        // the whole composite surface and not just the underlying entity they are on 
        // (the one exception to this might be UNIQUE_ID but I haven't seen any problems
        // with this yet).  The reason for doing this is that there is some code (I believe
        // in uncomposite() that assumes any attributes will be on the first entity
        // in the list.  Previous code actually moved the entity to the beginning
        // of the list but this reordering of the list does not fly with composite
        // curves because there is code depending on the curves in the list being
        // ordered so that they connect end to end in a contiguous manner (the 
        // faceting code, for one, relies on this).  BWC 1/7/07.
        entityList[i].entity->remove_simple_attribute_virt(attrib);
        entityList[0].entity->append_simple_attribute_virt(attrib);

        CubitSimpleAttrib c = attrib;
        c.int_data_list().erase(c.int_data_list().begin());
        c.string_data_list().erase(c.string_data_list().begin());      

        if( NULL == listHead )
          listHead = new CompositeAttrib(c,listHead);               
        else //this assures that we are not adding duplicate attribs 
        {
          bool is_duplicate = false;

          CompositeAttrib* curr_attrib = listHead;

          while( curr_attrib )
          {
            if( curr_attrib->equals( c ) )
            {
              is_duplicate = true;
              break;
            }
            curr_attrib = curr_attrib->next;
          }

          if( false == is_duplicate )
            listHead = new CompositeAttrib(c,listHead);
        }
      }
    }
//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:CompositeGeom.cpp

示例14: mass_properties

CubitStatus FacetLump::mass_properties( CubitVector& centroid, double& volume )
{
  int i;
  
  DLIList<FacetShell*> shells( myShells.size() );
  CAST_LIST( myShells, shells, FacetShell );
  assert( myShells.size() == shells.size() );
  
  DLIList<FacetSurface*> surfaces;
  DLIList<FacetShell*> surf_shells;
  get_surfaces( surfaces );
  
  DLIList<CubitFacet*> facets, surf_facets;
  DLIList<CubitPoint*> junk;
  DLIList<CubitSense> senses;
  for (i = surfaces.size(); i--; )
  {
    FacetSurface* surf = surfaces.step_and_get();
    surf_shells.clean_out();
    surf->get_shells( surf_shells );
    surf_shells.intersect( shells );
    assert( surf_shells.size() );
    CubitSense sense = surf->get_shell_sense( surf_shells.get() );
    if (surf_shells.size() == 1 && CUBIT_UNKNOWN != sense)
    {
      surf_facets.clean_out();
      junk.clean_out();
      surf->get_my_facets( surf_facets, junk );
      facets += surf_facets;
      
      for (int j = surf_facets.size(); j--; )
        senses.append(sense);
    }
  }
  
  const CubitVector p0 = bounding_box().center();
  CubitVector p1, p2, p3, normal;
  centroid.set( 0.0, 0.0, 0.0 );
  volume = 0.0;
  
  facets.reset();
  senses.reset();
  for (i = facets.size(); i--; )
  {
    CubitFacet* facet = facets.get_and_step();
    CubitSense sense = senses.get_and_step();
    p1 = facet->point(0)->coordinates();
    p2 = facet->point(1)->coordinates();
    p3 = facet->point(2)->coordinates();
    normal = (p3 - p1) * (p2 - p1);

    double two_area = normal.length();
    if (two_area > CUBIT_RESABS )
    {
      if (CUBIT_REVERSED == sense)
        normal = -normal;

      normal /= two_area;

      double height = normal % (p0 - p1);
      double vol = two_area * height;

      volume += vol;
      centroid += vol * (p0 + p1 + p2 + p3);
    }
  }
  
  if (volume > CUBIT_RESABS)
    centroid /= 4.0 * volume;
  volume /= 6.0;
  return CUBIT_SUCCESS;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:72,代码来源:FacetLump.cpp

示例15: order_edge_list

// order edges in list beginning at start_point
// report the endpoint
// return CUBIT_SUCCESS if all edges are connected and ordered successfully
// otherwise return CUBIT_FAILURE, in which case no changes are made
CubitStatus CubitFacetEdge::order_edge_list(DLIList<CubitFacetEdge*> &edge_list,
                                            CubitPoint *start_point,
                                            CubitPoint *&end_point)
{
  int i;
  assert(start_point);

  end_point = NULL;

  // invalid input
  if (0 == edge_list.size())
    return CUBIT_FAILURE;

  // simple case of a single edge - endpoitn
  if (1 == edge_list.size())
  {
    end_point = edge_list.get()->other_point(start_point);
    return end_point ? CUBIT_SUCCESS : CUBIT_FAILURE;
  }

  edge_list.reset();

  // note that a periodic/closed curve will fail
  // we could handle that case here if needed, but we may need more information
  // to know where to start and end the curve
  if (NULL == start_point)
    return CUBIT_FAILURE;

  // put edges in a set for faster searching
  std::set<CubitFacetEdge *> edge_set;
  for (i=0; i<edge_list.size(); i++)
    edge_set.insert(dynamic_cast<CubitFacetEdge*> (edge_list.step_and_get()));

  // a vector for the ordered list
  std::vector<CubitFacetEdge*> ordered_edges;

  // find connected edges from the start point
  CubitPoint *cur_pt = start_point;
  do
  {
    // get edges connected to the current point and find the next edge
    DLIList<CubitFacetEdge *> pt_edges;
    cur_pt->edges(pt_edges);

    std::set<CubitFacetEdge *>::iterator iter_found;
    CubitFacetEdge *cur_edge = NULL;
    for (i=0; i<pt_edges.size() && !cur_edge; i++)
    {
      CubitFacetEdge *tmp_edge = pt_edges.get_and_step();
      iter_found = edge_set.find(tmp_edge);
      if ( iter_found != edge_set.end() )
        cur_edge = tmp_edge;
    }

    // if we don't find a connection before we empty the set
    // then not all the edges are connected  -- return failure
    if (NULL == cur_edge)
      return CUBIT_FAILURE;

    // add the edge to the ordered list
    ordered_edges.push_back( cur_edge );
    edge_set.erase(iter_found);

    cur_pt = cur_edge->other_point(cur_pt);
  }
  while ( edge_set.size());

  if (ordered_edges.size() != edge_list.size())
    return CUBIT_FAILURE;

  // store the edges in the correct order
  edge_list.clean_out();

  std::vector<CubitFacetEdge*>::iterator iter;
  for (iter=ordered_edges.begin(); iter!=ordered_edges.end(); iter++)
    edge_list.append(*iter);

  // get the end point
  CubitFacetEdge *edge1 = edge_list[edge_list.size() - 1];
  CubitFacetEdge *edge2 = edge_list[edge_list.size() - 2];

  end_point = edge1->other_point( edge1->shared_point(edge2) );

  return CUBIT_SUCCESS;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:89,代码来源:CubitFacetEdge.cpp


注:本文中的DLIList::clean_out方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。