cgma
MidPlaneTool Class Reference

#include <MidPlaneTool.hpp>

List of all members.

Public Member Functions

 MidPlaneTool ()
 ~MidPlaneTool ()
CubitStatus create_midplane (RefFace *ref_face1, RefFace *ref_face2, Body *body_ptr, DLIList< RefFace * > &results_list)

Private Member Functions

CubitStatus sort_surfaces (RefFace *big_face, RefFace *predecessor, DLIList< RefFace * > &mid_surfaces)
CubitStatus get_other_surfs (RefFace *base_face, RefFace *predecessor, DLIList< RefFace * > &other_surfs)

Private Attributes

int surfIndex

Detailed Description

Definition at line 25 of file MidPlaneTool.hpp.


Constructor & Destructor Documentation

Definition at line 30 of file MidPlaneTool.hpp.

{surfIndex=0;}

Definition at line 31 of file MidPlaneTool.hpp.

{}

Member Function Documentation

CubitStatus MidPlaneTool::create_midplane ( RefFace ref_face1,
RefFace ref_face2,
Body body_ptr,
DLIList< RefFace * > &  results_list 
)
CubitStatus MidPlaneTool::get_other_surfs ( RefFace base_face,
RefFace predecessor,
DLIList< RefFace * > &  other_surfs 
) [private]

Definition at line 109 of file MidPlaneTool.cpp.

{
  DLIList <Loop*> loop_list;
  DLIList <RefEdge*> loop_edges;
  DLIList <RefFace*> edge_faces;
  RefFace *temp_face;
  RefEdge *temp_edge;
  Loop* temp_loop;

  base_face->loops( loop_list );

  for ( int ii = loop_list.size(); ii > 0; ii-- )
  {
    temp_loop = loop_list.get_and_step();
    loop_edges.clean_out();
    temp_loop->ref_edges( loop_edges );
    for ( int jj = loop_edges.size(); jj > 0; jj-- )
    {
      temp_edge = loop_edges.get_and_step();
      edge_faces.clean_out();
      temp_edge->ref_faces( edge_faces );
      for ( int kk = edge_faces.size(); kk > 0; kk-- )
      {
    temp_face = edge_faces.get_and_step();
    if ( ( temp_face != base_face ) && ( temp_face != predecessor ) )
    {
      other_surfs.append_unique( temp_face );
    }
      }
    }
  }
  return CUBIT_SUCCESS;
}      
CubitStatus MidPlaneTool::sort_surfaces ( RefFace big_face,
RefFace predecessor,
DLIList< RefFace * > &  mid_surfaces 
) [private]

Definition at line 26 of file MidPlaneTool.cpp.

{
  DLIList <Loop*> loop_list;
  DLIList <RefEdge*> loop_edges;
  DLIList <RefFace*> edge_faces;
  RefFace *next_face;
  RefEdge *temp_edge;
  Loop* temp_loop;

  base_face->ordered_loops( loop_list );

  if(loop_list.size() == 1)
  {
    if(surfIndex%2==1)
    {
      mid_surfaces.append(base_face);
    }  
    if ( predecessor == NULL )
    {
      PRINT_ERROR("Bad logic in mid-plane extraction of sorting surfaces.\n");
      return CUBIT_SUCCESS;
    }
    //Now test to see if there are other surfaces attached to this
    //single loop (other than predecessor)
    DLIList <RefFace*> other_surfs;
    CubitStatus tmp_stat = get_other_surfs(base_face, predecessor, other_surfs);
    if ( tmp_stat != CUBIT_SUCCESS )
      return CUBIT_FAILURE;
    int jj;
    for ( jj = other_surfs.size(); jj > 0; jj-- )
    {
      next_face = other_surfs.get_and_step();
      surfIndex++;
      sort_surfaces(next_face,base_face,mid_surfaces);
      surfIndex--;
    }
      
    return CUBIT_SUCCESS;
  }

  if(surfIndex%2==1)
  {
    mid_surfaces.append(base_face);
  }
  loop_list.reset();
  loop_list.remove();
  for ( int ii = loop_list.size(); ii > 0; ii-- )
  {
    temp_loop = loop_list.get_and_step();
    loop_edges.clean_out();
    edge_faces.clean_out();
    temp_loop->ref_edges( loop_edges );
    temp_edge = loop_edges.get();
    temp_edge->ref_faces( edge_faces );
    if( edge_faces.size() > 2 )
    {
      PRINT_ERROR("Bad Logic.\n");
      return CUBIT_FAILURE;
    }
  
    if(edge_faces.size() == 2)
    {
      if(edge_faces.get() == base_face)
      {
        next_face = edge_faces.next();
      } else
      {
        next_face = edge_faces.get();
      }

      surfIndex++;

      sort_surfaces(next_face,base_face,mid_surfaces);

      surfIndex--;

    }
  }  
  return CUBIT_SUCCESS;
}

Member Data Documentation

int MidPlaneTool::surfIndex [private]

Definition at line 41 of file MidPlaneTool.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines