cgma
ChollaEngine.cpp File Reference
#include <set>
#include <map>
#include <vector>
#include "CubitDefines.h"
#include "ChollaEngine.hpp"
#include "DLIList.hpp"
#include "TDGeomFacet.hpp"
#include "CastTo.hpp"
#include "ChollaSkinTool.hpp"
#include "ChollaVolume.hpp"
#include "ChollaSurface.hpp"
#include "ChollaCurve.hpp"
#include "ChollaPoint.hpp"
#include "CubitFacet.hpp"
#include "CubitFacetData.hpp"
#include "CubitFacetEdge.hpp"
#include "CubitFacetEdgeData.hpp"
#include "CubitPoint.hpp"
#include "CubitPointData.hpp"
#include "FacetEntity.hpp"
#include "FacetEvalTool.hpp"
#include "FacetDataUtil.hpp"
#include "ChollaDebug.hpp"
#include "TDFacetBoundaryEdge.hpp"
#include "TDFacetBoundaryPoint.hpp"
#include "CurveFacetEvalTool.hpp"
#include "Cholla.h"
#include "GfxDebug.hpp"
#include "TDFacetboolData.hpp"
#include "GMem.hpp"

Go to the source code of this file.

Functions

static CubitStatus create_tri_facets (int *face_list, int current_position, CubitPoint **point_list, DLIList< CubitFacet * > &facet_list)

Function Documentation

static CubitStatus create_tri_facets ( int *  face_list,
int  current_position,
CubitPoint **  point_list,
DLIList< CubitFacet * > &  facet_list 
) [static]

Definition at line 2910 of file ChollaEngine.cpp.

{
  int step = face_list[current_position];
    //This function is hard coded to work for splitting 4, 5, and 6
    //faceted points into triangles.
  if ( step > 6 || step < 4 )
  {
    PRINT_ERROR("Trying to split facets with wrong function.\n");
    return CUBIT_FAILURE;
  }
    //Basically get the points in a list first.
  int ii = current_position + 1, jj;
  DLIList <CubitPoint*> temp_points;
  
  for( jj = ii; jj < ii+step; jj++ )
  {
    int index_to_point = face_list[jj];
    assert(index_to_point >= 0 );
    temp_points.append(point_list[index_to_point]);
  }
    //Now cycle through the points and creat facets from them.
  CubitPoint *point_1, *point_2, *point_3;
    //This definatly could be improved to get more optimal triangles...
    //Create the first two facets in the normal way.  This is the
    //same for 4, 5 and 6 points.
  for ( jj = 0; jj < 2; jj++ )
  {
    point_1 = temp_points.get_and_step();
    point_2 = temp_points.get_and_step();
    point_3 = temp_points.get();
      //If these are colinear we are screwed...
    CubitFacet *new_facet = (CubitFacet *)
      new CubitFacetData(point_1, point_2, point_3);
    facet_list.append(new_facet);
  }
    //create the third facet for 5 points.
  if ( step == 5 )
  {
      //Now create the last facet with the first point, last point and
      //third point.
    temp_points.reset();
    point_1 = temp_points.prev();
    point_2 = temp_points.get();
    point_3 = temp_points.next(2);
    CubitFacet *new_facet = (CubitFacet *)
      new CubitFacetData(point_1, point_2, point_3);
    facet_list.append(new_facet);
  }
    //create the third and fourth for 6 points.
  else if ( step == 6 )
  {
      //get the current point (should be position 5/6)
    point_1 = temp_points.get();
      //get the next point. (should be position 6/6)
    point_2 = temp_points.next();
      //get the prev(2) point. ( should be position 3/6)
    point_3 = temp_points.prev(2);
    CubitFacet *new_facet = (CubitFacet *)
      new CubitFacetData(point_1, point_2, point_3);
    facet_list.append(new_facet);
      // get the next point. (should be 6/6)
    point_1 = temp_points.next();
      // get the next 2 point ( should be 1/6)
    point_2 = temp_points.next(2);
      //point3 stays the same (position 3/6).
    new_facet = (CubitFacet *)
      new CubitFacetData(point_1, point_2, point_3);
    facet_list.append(new_facet);
  }
  return CUBIT_SUCCESS;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines