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


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

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


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

示例1: closest_points_trimmed

void Surface::closest_points_trimmed(DLIList<CubitVector *> &from_point_list, 
                                    DLIList<CubitVector *> &point_on_surface_list)
{
  CubitVector *from_point;
  CubitVector *point_on_surface;
  from_point_list.reset();
  point_on_surface_list.reset();
  for (int i=0; i<from_point_list.size(); i++)
  {
    from_point = from_point_list.get_and_step();
    point_on_surface = point_on_surface_list.get_and_step();
    closest_point_trimmed( *from_point, *point_on_surface );
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:14,代码来源:Surface.cpp

示例2: are_positions_on

void Surface::are_positions_on( DLIList<CubitVector *> &test_position_list,
                              DLIList<CubitBoolean *> &is_on_list )
{
  CubitVector *test_position;
  CubitBoolean *is_on;
  test_position_list.reset();
  is_on_list.reset();
  for (int i=0; i<test_position_list.size(); i++)
  {
    test_position = test_position_list.get_and_step();
    is_on = is_on_list.get_and_step();
    *is_on = is_position_on( *test_position );
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:14,代码来源:Surface.cpp

示例3:

DagNodeRow::DagNodeRow( DLIList<ModelEntity*>& node_list )
{
	length_ = node_list.size();
	array_ = 0;
	if( length_ > 0 )
	{
		array_ = new ModelEntity*[length_];
		node_list.reset();
		for( int i = 0; i < length_; i++ )
			array_[i] = node_list.get_and_step();
	}
}
开发者ID:chrismullins,项目名称:cgma,代码行数:12,代码来源:DagDrawingTool.cpp

示例4: force_simplify_to_torus

CubitStatus GeometryHealerTool::force_simplify_to_torus( DLIList<RefFace*> &ref_face_list, 
                                                         DLIList<Body*>& new_body_list, 
                                                         CubitBoolean keep )
{
   ref_face_list.reset();
   DLIList<RefEntity*> ref_entity_list(ref_face_list.size());
   CAST_LIST_TO_PARENT( ref_face_list, ref_entity_list );

   if (!same_healer_engine(ref_entity_list, CUBIT_TRUE))
   {
      PRINT_ERROR("HEALING faces from different\n"
                  "       geometry engines is not allowed.\n");
      return CUBIT_FAILURE;
   }

   ref_face_list.reset();
   GeometryHealerEngine* GHEPtr = get_engine((TopologyEntity*)(ref_face_list.get()));
   if (GHEPtr)
      return GHEPtr->force_simplify_to_torus(ref_face_list, new_body_list, keep);
   else
      PRINT_ERROR( "Faces are of a geometry engine without a healer\n"
                   "         and cannot be healed.\n");
   return CUBIT_FAILURE;
}
开发者ID:tenpercent,项目名称:cp-sandbox,代码行数:24,代码来源:GeometryHealerTool.cpp

示例5: simplify_surfaces

CubitStatus SimplifyTool::simplify_surfaces(DLIList<RefFace*> ref_face_list, 
                                            double angle_in,
                                            DLIList<RefFace*> respect_face_list,
                                            DLIList<RefEdge*> respect_edge_list,
                                            CubitBoolean respect_rounds,
                                            CubitBoolean respect_imprints,
                                            CubitBoolean local_normals,
                                            CubitBoolean preview)
{
    CubitStatus status = CUBIT_FAILURE;
    ref_face_list.uniquify_unordered();
    while(ref_face_list.size())
    {
        DLIList<RefFace*> ref_faces_in_volume;
        ref_face_list.reset();
        RefFace* cur_face = ref_face_list.get_and_step();
        RefVolume* cur_vol = cur_face->ref_volume();
        ref_faces_in_volume.append(cur_face);
        for(int i =1;i<ref_face_list.size();i++)
        {
            RefFace* face = ref_face_list.get_and_step();
            if(face->ref_volume() == cur_vol)
                ref_faces_in_volume.append(face);
        }

        if(ref_faces_in_volume.size()>1)
        {
            status = simplify_surfaces_in_volume(
                ref_faces_in_volume,
                angle_in,
                respect_face_list,
                respect_edge_list,
                respect_rounds,
                respect_imprints,
                local_normals,
                preview);
        }
        ref_face_list -= ref_faces_in_volume;
    }

    if(preview)
        GfxDebug::flush();

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

示例6: closest_points

CubitStatus Surface::closest_points(DLIList<CubitVector *> &location_list,
                                    DLIList<CubitVector *> *closest_location_list,
                                    DLIList<CubitVector *> *unit_normal_list,
                                    DLIList<CubitVector *> *curvature1_list,
                                    DLIList<CubitVector *> *curvature2_list)
{
  CubitVector *curvature1, *curvature2;
  CubitVector *unit_normal;
  CubitVector *closest_location;
  CubitVector *location;
  CubitStatus stat;
  location_list.reset();
  if (closest_location_list) closest_location_list->reset();
  if (unit_normal_list) unit_normal_list->reset();
  if (curvature1_list) curvature1_list->reset();
  if (curvature2_list) curvature2_list->reset();
  for (int i=0; i<location_list.size(); i++)
  {
    location = location_list.get_and_step();
    if (closest_location_list == NULL)
      closest_location = NULL;
    else
      closest_location = closest_location_list->get_and_step();
    if (unit_normal_list == NULL)
      unit_normal = NULL;
    else
      unit_normal = unit_normal_list->get_and_step();
    if (curvature1_list == NULL)
      curvature1 = NULL;
    else
      curvature1 = curvature1_list->get_and_step();
    if (curvature2_list == NULL)
      curvature2 = NULL;
    else
      curvature2 = curvature2_list->get_and_step();
    stat = closest_point( *location, closest_location, unit_normal, curvature1, curvature2 );
    if (stat != CUBIT_SUCCESS)
      return stat;
  }
  return CUBIT_SUCCESS;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:41,代码来源:Surface.cpp

示例7: copy_refentity_names

// Copy names from one entity to another.  
// Added Aug.14,2000 by J.Kraftcheck for propogating
// names after virtual geometry operations.
void RefEntityName::copy_refentity_names( const RefEntity *source,
                                          RefEntity *target,
                                          CubitBoolean update_attribs )
{
  //No NULL pointers.
  assert( source && target );
  
  //If we can't have duplicate names, then it is not possible to 
  //copy names.
  if( ! get_fix_duplicate_names() ) return;
  
  //Assume the name is valid already, as it is attached to
  //the source entity.  Also, assume the name is unique to
  //the source entity.
  DLIList<CubitString> names;
  get_refentity_name( source, names );
  names.reset();
  
  //For each of the names on the source entity
  for( int i = names.size(); i > 0; i-- )
  {  
    CubitString name = names.get_and_step();
    //make the name unique
    generate_unique_name( name );
    //associate name with target
    nameEntityList.insert( new RefEntityNameMap( name, target ) );
  }
    
  if( (names.size() > 0) && (update_attribs == CUBIT_TRUE) )
  {
      // now tell the entity to update its name attribute
    CubitAttrib *attrib = target->get_cubit_attrib( CA_ENTITY_NAME );
      // force update by resetting update flag
    attrib->has_updated( CUBIT_FALSE );
    attrib->update();
  }
}
开发者ID:chrismullins,项目名称:cgma,代码行数:40,代码来源:RefEntityName.cpp

示例8: new_space_LoopParam

//===================================================================================
// Function: new_space_LoopParam (Public)
// Description: sets up space of flattening
// Author: Shiraj Khan
// Date: 1/21/2003
//===================================================================================
CubitStatus LoopParamTool::new_space_LoopParam( DLIList<DLIList<CubitPoint *>*> &loops_cubit_points,
                                                CubitVector* normal)
{
	
  int ii;
  int jj;
  double sumx = 0.0, sumy = 0.0, sumz = 0.0;
  double sumxx = 0.0, sumxy = 0.0, sumxz = 0.0;
  double sumyy = 0.0, sumyz = 0, sumzz = 0.0;
  double aa[4][4];
  double Xc = 0.0, Yc = 0.0, Zc = 0.0;
  int n = 0;
  
  CubitPoint *point, *point1, *point2;
  CubitVector point_coordinates, point_coordinates1, point_coordinates2;
  CubitVector cm_plane; // center of mass of a plane
  CubitVector vec1, vec2, plane_normal;
  DLIList<CubitPoint *> *sub_loops_cubit_points;

  
  for ( ii = 0; ii < loops_cubit_points.size(); ii++ )
  {
    sub_loops_cubit_points = loops_cubit_points.get_and_step();
    for ( jj = 0; jj < sub_loops_cubit_points->size(); jj++ )
    {
      point = sub_loops_cubit_points->get_and_step();
      point_coordinates = point->coordinates();
      sumx = sumx + point_coordinates.x();
      sumy = sumy + point_coordinates.y();
      sumz = sumz + point_coordinates.z();
      sumxx = sumxx + ( point_coordinates.x() * point_coordinates.x() );
      sumxy = sumxy + ( point_coordinates.x() * point_coordinates.y() );
      sumxz = sumxz + ( point_coordinates.x() * point_coordinates.z() );
      sumyy = sumyy + ( point_coordinates.y() * point_coordinates.y() );
      sumyz = sumyz + ( point_coordinates.y() * point_coordinates.z() );
      sumzz = sumzz + ( point_coordinates.z() * point_coordinates.z() );
      n++;
    }
  }
  Xc = sumx / n;
  Yc = sumy / n;
  Zc = sumz / n;
  cm_plane.set(Xc,Yc,Zc);
  if ( Xc < EPSILON_UPPER && Xc > EPSILON_LOWER ) Xc = 0.0;
  if ( Yc < EPSILON_UPPER && Yc > EPSILON_LOWER ) Yc = 0.0;
  if ( Zc < EPSILON_UPPER && Zc > EPSILON_LOWER ) Zc = 0.0;
  aa[1][1] = sumxx - Xc * sumx;
  aa[1][2] = sumxy - Yc * sumx;
  aa[1][3] = sumxz - Zc * sumx;
  aa[2][1] = sumxy - Xc * sumy;
  aa[2][2] = sumyy - Yc * sumy;
  aa[2][3] = sumyz - Zc * sumy;
  aa[3][1] = sumxz - Xc * sumz;
  aa[3][2] = sumyz - Yc * sumz;
  aa[3][3] = sumzz - Zc * sumz;
	
  for ( ii = 1; ii <=3; ii++ )
  {
    for ( jj = 1; jj <=3; jj++ )
      if ( aa[ii][jj] < EPSILON_UPPER && aa[ii][jj] > EPSILON_LOWER )
        aa[ii][jj] = 0.0;
  }
  double determinant_aa = aa[1][1] * ( aa[2][2]*aa[3][3] - aa[3][2]*aa[2][3] ) - aa[1][2] * ( aa[2][1]*aa[3][3] - aa[3][1]*aa[2][3] )
    + aa[1][3] * ( aa[2][1]*aa[3][2] - aa[3][1]*aa[2][2] );

  if ( determinant_aa < EPSILON_UPPER && determinant_aa > EPSILON_LOWER ) 
    determinant_aa = 0.0;
  loops_cubit_points.reset();
  
    // if determinant is 0.0 ( all the points are lying on the plane), the equation of a plane: 
    //(vec1) crossproduct (vec2)
    // where vec1 and vec2 are the vectors originating from a common point( center of mass of a plane) and  
    // lying on the plane.
  if(normal){
    a = normal->x();
    b = normal->y();
    c = normal->z();
    d = -(a*Xc + b*Yc + c*Zc );
  }
  else if ( determinant_aa == 0.0 )
  {
    sub_loops_cubit_points = loops_cubit_points.get_and_step();
    point1 = sub_loops_cubit_points->get_and_step();
    point2 = sub_loops_cubit_points->get_and_step();
    point_coordinates1 = point1->coordinates(); 
    point_coordinates2 = point2->coordinates();
    vec1 = cm_plane - point_coordinates1;
    vec2 = cm_plane - point_coordinates2;
    plane_normal = vec1 * vec2;
    a = plane_normal.x();
    b = plane_normal.y();
    c = plane_normal.z();
    d = -( a*Xc + b*Yc + c*Zc );
  }
//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:LoopParamTool.cpp

示例9: 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

示例10: 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

示例11: split_edge

CubitPoint* CubitFacetData::split_edge( CubitPoint* edge1_pt,  
                                        CubitPoint* edge2_pt, 
                                        const CubitVector& position ) 
{ 
  CubitPointData* new_pt = new CubitPointData(position);
  
    // split edge, if there is one
  
  CubitFacetEdge* edge = edge1_pt->shared_edge( edge2_pt );
  CubitFacetEdgeData* new_edge = 0;
  if ( edge ) {
    CubitFacetEdgeData* edge_d = dynamic_cast<CubitFacetEdgeData*>(edge);
    assert(!!edge_d);
    
      // make sure new edge has same orientation as old edge
    new_edge = dynamic_cast<CubitFacetEdgeData*>(new_pt->shared_edge(edge2_pt));
    if ( edge->point(0) == edge1_pt ) {
      edge_d->set_point(new_pt, 1);
      if ( !new_edge )
      {
        new_edge = new CubitFacetEdgeData( new_pt, edge2_pt );
        DLIList<ToolData*> tds;
        edge->get_all_TDs(&tds);
        for (int i=0; i<tds.size(); i++)
        {
          ToolData* new_td = tds.get_and_step()->propogate(new_edge);
          if (new_td)
            new_edge->add_TD(new_td);
        }
      }
      else if( new_edge->point(0) != new_pt )
        new_edge->flip();
    } else {
      edge_d->set_point(new_pt, 0);
      if ( !new_edge )
      {
        new_edge = new CubitFacetEdgeData( edge2_pt, new_pt );
        DLIList<ToolData*> tds;
        edge->get_all_TDs(&tds);
        for (int i=0; i<tds.size(); i++)
        {
          ToolData* new_td = tds.get_and_step()->propogate(new_edge);
          if (new_td)
            new_edge->add_TD(new_td);
        }
      }
      else if( new_edge->point(1) != new_pt )
        new_edge->flip();
    }
  }
  
    // split triangles
  
  DLIList<CubitFacet*> facets;
  edge1_pt->shared_facets( edge2_pt, facets );
  
  facets.reset();
  for ( int i = facets.size(); i--; ) {

    CubitFacet* facet = facets.get_and_step();
    CubitFacetData* facet_d = dynamic_cast<CubitFacetData*>(facet);
    assert(!!facet_d);
   
 
      // fix up existing facet
    
    int pt2_index = facet->point_index( edge2_pt );
    bool edge_reversed = ( edge1_pt == facet->point( (pt2_index+1) % 3 ) );
    int edge_index = (pt2_index + 1 + edge_reversed) % 3;
    
    edge2_pt->remove_facet( facet );
    facet_d->set_point( new_pt, pt2_index );
    new_pt->add_facet( facet );
    facet->update_plane();
    

      // make new facet
      
    CubitPoint* other_pt = facet->point( edge_index );
    CubitFacetData* new_facet;
    if ( edge_reversed )
      new_facet = new CubitFacetData( other_pt, edge2_pt, new_pt );
    else
      new_facet = new CubitFacetData( other_pt, new_pt, edge2_pt );

    DLIList<ToolData*> td_list;
    facet->get_all_TDs(&td_list);
    for (int i=0; i< td_list.size(); i++)
    {
      ToolData* new_td = td_list.get_and_step()->propogate(new_facet);
      if (new_td)
      {
        new_facet->add_TD(new_td);
      }
    }
   
    if ( new_edge ) {
      assert(!new_facet->edge(0));
      new_facet->edge( new_edge, 0 );
      new_edge->add_facet( new_facet );
//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:CubitFacetData.cpp

示例12: order_edges

CubitStatus ChollaCurve::order_edges()
{
  int i;
  bool periodic = false;
  if (NULL == startPoint)
  {
    DLIList<ChollaPoint *>  cholla_points = get_points();
    periodic = (cholla_points.size() == 1);

    ChollaPoint *chpt = cholla_points.get();
    CubitPoint *start_point = dynamic_cast<CubitPoint *> (chpt->get_facets());

    this->set_start( start_point );
    if (NULL == start_point)
      return CUBIT_FAILURE;
    start_point->set_as_feature();

    if (periodic)
    {
      this->set_end(start_point);
    }
    else
    {
      chpt = cholla_points.step_and_get();
      CubitPoint *end_point = dynamic_cast<CubitPoint *> (chpt->get_facets());
      if (NULL == end_point)
        return CUBIT_FAILURE;
      this->set_end(end_point);
      end_point->set_as_feature();
    }
  }

  assert(startPoint);  
  assert(endPoint);

  if (curveEdgeList.size() > 1)
  {    
    DLIList<CubitFacetEdge*> edges_ordered;
    CAST_LIST(curveEdgeList, edges_ordered, CubitFacetEdge);
    
    CubitStatus stat = CubitFacetEdge::order_edge_list(edges_ordered, startPoint, endPoint);

    if (CUBIT_FAILURE == stat)
      return CUBIT_FAILURE;

    // store the edges in the correct order
    clean_out_edges();    

    edges_ordered.reset();
    for (i=0; i< edges_ordered.size(); i++)
    {      
      this->add_facet(edges_ordered.get_and_step());     
    }    
  }

  
  // make sure all the edges are oriented correctly
  DLIList<FacetEntity *> flist = this->get_facet_list();
  flist.reset();
  DLIList<CubitFacetEdge *> elist;
  CAST_LIST( flist, elist, CubitFacetEdge );
  elist.reset();
  CubitPoint *cur_pt = startPoint, *tmp_pt;
  for ( i = elist.size(); i > 0; i-- ) 
  {
    CubitFacetEdge *edge_ptr = elist.get_and_step();
    CubitPoint *point0_ptr = edge_ptr->point(0);
    CubitPoint *point1_ptr = edge_ptr->point(1);
    if (point0_ptr != cur_pt)
    {
      assert( cur_pt == point1_ptr );
      edge_ptr->flip();
      tmp_pt = point0_ptr;
      point0_ptr = point1_ptr;
      point1_ptr = tmp_pt;
      assert( point0_ptr == edge_ptr->point(0) &&
             point1_ptr == edge_ptr->point(1) );
    }
    cur_pt = point1_ptr;
  }
  
  int mydebug = 0;
  if (mydebug)
  {
    int i;
    DLIList<FacetEntity *> flist = this->get_facet_list();
    flist.reset();
    DLIList<CubitFacetEdge *> elist;
    CAST_LIST( flist, elist, CubitFacetEdge );
    elist.reset();
    for ( i = elist.size(); i > 0; i-- ) {  
      CubitFacetEdge *edge = elist.get_and_step();
      CubitVector pt0_v = edge->point(0)->coordinates();
      CubitVector pt1_v = edge->point(1)->coordinates();
      GfxDebug::draw_point(pt0_v, CUBIT_GREEN );
      GfxDebug::draw_point(pt1_v, CUBIT_RED );
      GfxDebug::draw_line( pt0_v, pt1_v, CUBIT_YELLOW );
      GfxDebug::flush();
      int view = 0;
      if (view)
//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:ChollaCurve.cpp

示例13: build_curve_from_edges

//=============================================================================
//Function: build_curve_from_edges 
//Description: insert the ordered and oriented edges into this cholla curve
//Notes:  traverses starting at start_point and gathers facet edges until it 
//        runs into another curve.
//        start_point is an existing CubitPoint at either end of the curve
//        max_edges is the maximum number of edges on this curve.  should be 
//        known beforehand (used for error checking).
//
// ***this function used to be part of split_curve. ***
//Author: sjowen
//Return: 
//Date: 09/07/2009
//=============================================================================
CubitStatus ChollaCurve::build_curve_from_edges( CubitPoint *start_point,
                                                int periodic,
                                                int max_edges,
                                                CubitFacetEdge *start_edge_ptr,
                                                ChollaCurve *parent_curve )
{
  
  // find the first edge.  Match the chollacurve owner with this curve
  // do this only if the start_edge_ptr was not passed in
  
  DLIList<CubitFacetEdge *> point_edge_list;
  start_point->edges(point_edge_list);
  CubitFacetEdge *edge_ptr;
  if (start_edge_ptr == NULL)
  {
    for (int ii=0; ii<point_edge_list.size() && !start_edge_ptr; ii++)
    {
      edge_ptr = point_edge_list.get_and_step();
      TDGeomFacet *td_geom = TDGeomFacet::get_geom_facet( edge_ptr );
      
      // assumes that the TDGeomFacet info has already been set up for the edges
      assert(td_geom != NULL);
      
      DLIList<ChollaCurve *> cholla_curves;
      td_geom->get_cholla_curves(cholla_curves);
      
      // currently should be only one-to-one relationship
      // could also be edge on surface in which case no curves associated
      assert(cholla_curves.size() <= 1);
      if (cholla_curves.size())
      {
        if (cholla_curves.get() == this)
          start_edge_ptr = edge_ptr;
      }
    }
    assert(start_edge_ptr != NULL);  // didn't find an edge that marched this chollacurve
  }
  
  // create a new curve to hold the edge info
  
  this->set_start( start_point );
  start_point->set_as_feature();
  
  this->add_facet( start_edge_ptr );
  int iedgecount = 0;
  edge_ptr = start_edge_ptr;
  CubitPoint *point0_ptr = start_point, *point1_ptr;
  CubitPoint *end_point = NULL;
  while(!end_point)
  {
    point1_ptr = edge_ptr->other_point( point0_ptr );
    if ((edge_ptr = parent_curve->next_edge( point1_ptr, edge_ptr )) == NULL)
    {
      end_point = point1_ptr;
    }
    else
    {
      iedgecount++;
      if (iedgecount > max_edges)
      {
        PRINT_ERROR("ChollaCurve has start, but no end\n");
        return CUBIT_FAILURE;
      }
      
      this->add_facet( edge_ptr );
      if (periodic && point1_ptr == start_point)
        end_point = start_point;
      point0_ptr = point1_ptr;
    }
  }
  this->set_end( end_point );
  end_point->set_as_feature();
  
  // make sure all the edges are oriented correctly
  
  int i;
  DLIList<FacetEntity *> flist = this->get_facet_list();
  flist.reset();
  DLIList<CubitFacetEdge *> elist;
  CAST_LIST( flist, elist, CubitFacetEdge );
  elist.reset();
  CubitPoint *cur_pt = start_point, *tmp_pt;
  for ( i = elist.size(); i > 0; i-- ) 
  {
    edge_ptr = elist.get_and_step();
    point0_ptr = edge_ptr->point(0);
//.........这里部分代码省略.........
开发者ID:chrismullins,项目名称:cgma,代码行数:101,代码来源:ChollaCurve.cpp

示例14: get_curve_facets

CubitStatus Faceter::get_curve_facets( RefEdge* curve, DLIList<CubitPoint*>& segments ) const
{
//const double COS_ANGLE_TOL =  0.965925826289068312213715; // cos(15)
  const double COS_ANGLE_TOL =  0.984807753012208020315654; // cos(10)
//const double COS_ANGLE_TOL =  0.996194698091745545198705; // cos(5)
  GMem curve_graphics;
  const double dist_tol = GEOMETRY_RESABS;
  const double dist_tol_sqr = dist_tol*dist_tol;
  Curve* curve_ptr = curve->get_curve_ptr();
  curve_ptr->get_geometry_query_engine()->get_graphics( curve_ptr, &curve_graphics );
  
  GPoint* gp = curve_graphics.point_list();
  CubitPoint* last = (CubitPoint*) new FaceterPointData( gp->x, gp->y, gp->z );
  ((FaceterPointData*)last)->owner(dynamic_cast<RefEntity*>(curve));
  CubitVector lastv = last->coordinates();
  segments.append( last );
  GPoint* end = gp + curve_graphics.pointListCount - 1;
  
  for( gp++; gp < end; gp++ )
  {
    CubitVector pos(  gp->x, gp->y, gp->z );
    CubitVector step1 = (pos - lastv);
    double len1 = step1.length();
    if( len1 < dist_tol ) continue;
    
    GPoint* np = gp + 1;
    CubitVector next( np->x, np->y, np->z );
    CubitVector step2 = next - pos;
    double len2 = step2.length();
    if( len2 < dist_tol ) continue;
    
    double cosine = (step1 % step2) / (len1 * len2);
    if( cosine > COS_ANGLE_TOL ) continue;
    
    last = new FaceterPointData( pos );
    ((FaceterPointData*)last)->owner(dynamic_cast<RefEntity*>(curve));
    segments.append( last );
    lastv = last->coordinates();
  }
  
  CubitVector last_pos( gp->x, gp->y, gp->z );
  segments.last();
  while( (last_pos - (segments.get()->coordinates())).length_squared() < dist_tol_sqr )
  {
    delete segments.pop();
    segments.last();
  }
  CubitPoint *tmp_point = (CubitPoint*) new FaceterPointData( last_pos );
  segments.append( tmp_point );
  ((FaceterPointData*)tmp_point)->owner( dynamic_cast<RefEntity*>(curve) );
    
  // Now check if the segment list is reversed wrt the curve direction.
  segments.reset();
  double u1, u2;
  if( segments.size() > 2 )
  {
    u1 = curve->u_from_position( (segments.next(1)->coordinates()) );
    u2 = curve->u_from_position( (segments.next(2)->coordinates()) );    
  }
  else
  {
    u1 = curve->u_from_position( (segments.get()->coordinates() ) );
    u2 = curve->u_from_position( (segments.next()->coordinates()) );
  }
  if( (u2 < u1) && (curve->start_param() <= curve->end_param()) )
    segments.reverse();

    //Make sure we don't have duplicate points.
  int jj;
  CubitVector curr, prev;
  for ( jj = segments.size(); jj > 0; jj-- )
  {
    prev = segments.prev()->coordinates();
    curr = segments.get_and_step()->coordinates();
    if ( prev.about_equal(curr) )
    {
      PRINT_DEBUG_129("Points on curve %d within tolerance...\n", curve->id());
      segments.back();
      delete segments.remove();
    }
  }
  return CUBIT_SUCCESS;
}
开发者ID:chrismullins,项目名称:cgma,代码行数:83,代码来源:Faceter.cpp

示例15: 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


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