cgma
RefFace.cpp File Reference
#include <stdio.h>
#include <math.h>
#include "CubitDefines.h"
#include "CubitVector.hpp"
#include "Body.hpp"
#include "RefVolume.hpp"
#include "RefFace.hpp"
#include "RefEdge.hpp"
#include "RefVertex.hpp"
#include "CubitObserver.hpp"
#include "RefEntityFactory.hpp"
#include "GeometryQueryTool.hpp"
#include "GfxDebug.hpp"
#include "GeometryDefines.h"
#include "Loop.hpp"
#include "CoFace.hpp"
#include "CoEdge.hpp"
#include "Surface.hpp"
#include "DLIList.hpp"
#include "CastTo.hpp"
#include "CubitString.hpp"
#include "CubitUtil.hpp"
#include "GeomMeasureTool.hpp"
#include "GeometryUtil.hpp"
#include "ModelQueryEngine.hpp"
#include "SDLList.hpp"

Go to the source code of this file.

Classes

class  LoopAngles

Functions

static void dist_between (RefEdge *edge1, RefEdge *edge2, CubitVector &v1, CubitVector &v2, double &dist)
 SDLListdeclare (SDLLoopAngles, LoopAngles *, angle_metric, double) CubitStatus RefFace

Function Documentation

static void dist_between ( RefEdge edge1,
RefEdge edge2,
CubitVector v1,
CubitVector v2,
double &  dist 
) [static]

Definition at line 115 of file RefFace.cpp.

{
  // check compatibility first
  DLIList<TopologyEntity*> entity_list(2);
  DLIList<TopologyBridge*> bridge_list(2);
  entity_list.append(edge1);
  entity_list.append(edge2);
  GeometryQueryEngine* gqe = GeometryQueryTool::instance()->common_query_engine( entity_list, bridge_list );
  if(gqe)
    GeometryQueryTool::instance()->entity_entity_distance(edge1, edge2, v1, v2, dist);
  else
  {
    BasicTopologyEntity* bte1 = dynamic_cast<BasicTopologyEntity*>(edge1);
    BasicTopologyEntity* bte2 = dynamic_cast<BasicTopologyEntity*>(edge2);
    if(bte1 && bte2)
    {
      GeometryEntity *ge1 = dynamic_cast<GeometryEntity*>(bte1->bridge_manager()->topology_bridge());
      GeometryEntity *ge2 = dynamic_cast<GeometryEntity*>(bte2->bridge_manager()->topology_bridge());
      GeometryQueryTool::instance()->entity_entity_distance(ge1, ge2, v1, v2, dist);
    }
  }
}
SDLListdeclare ( SDLLoopAngles  ,
LoopAngles ,
angle_metric  ,
double   
)

Definition at line 748 of file RefFace.cpp.

{
   CubitStatus status;
   SDLLoopAngles loop_angle_list;
//   DLIList<LoopAngles*> loop_angle_list;
   DLIList<Loop*> temp_loop_list;
     //Get all of the loops for this RefFace.
   loops( temp_loop_list );
   
   if ( temp_loop_list.size() < 2 )
   {
     loop_list += temp_loop_list;
   }
   else
   {
     // See if the underlying geometry engine can give us the ordered list
     // before trying to do it manually.
     GeometryQueryTool::instance()->get_ordered_loops(this, loop_list);
     if(loop_list.size() > 0 && loop_list.size() == temp_loop_list.size())
         return CUBIT_SUCCESS;
     else
       loop_list.clean_out();

     // If we were not able to get the ordered list from the underlying
     // geometry engine we will do it manually.

     // Order the list of loops from outside to inside.
     Loop *loop_ptr;
     LoopAngles *loop_angles;
     
     for ( int ii = temp_loop_list.size(); ii > 0; ii-- )
     {
       loop_ptr = temp_loop_list.get_and_step();
       loop_angles = new LoopAngles( loop_ptr );
       status = loop_ptr->get_angle_metric( loop_angles->angleMetric );
       if ( status == CUBIT_FAILURE )
       {
         PRINT_ERROR("In RefFace::ordered_loops\n"
                     "       Unknown problem computing the angle metric"
                     " of the Loop.\n");
         delete loop_angles;
         
         while( loop_angle_list.size() != 0 )
           delete loop_angle_list.remove();
         
         return CUBIT_FAILURE;
       }
      loop_angle_list.append( loop_angles );
     }
     
     loop_angle_list.sort();
//     std::stable_sort(&loop_angle_list[0], &loop_angle_list[0]+loop_angle_list.size(), DLIListSorter<LoopAngles*>());
     loop_angle_list.reset();
     for ( int jj = 0; jj < loop_angle_list.size(); jj++ )
     {
       Loop* loop =  loop_angle_list.get_and_step()->loopPtr;
       loop_list.append( loop );
       bool debug = false;
       if (debug)
       {
         DLIList<RefEdge*> edge_list;
         loop->ordered_ref_edges(edge_list);
         for (int kk = 0; kk < edge_list.size(); kk++)
         {
           RefEdge *e = edge_list[kk];
           GfxDebug::highlight_ref_edge(e);
           GfxDebug::flush();
         }
         GfxDebug::clear_highlight();
       }
     }
     
       //Delete loop_angles
     while( loop_angle_list.size() != 0 )
       delete loop_angle_list.remove();
   }
   
   bool debug = false;
   if (debug)
   {
     PRINT_INFO("Debugging ordered_loops\n");
     for (int i = 0; i < loop_list.size(); i++)
     {
       DLIList<RefEdge*> edge_list;
       Loop* loop = loop_list[i];
       loop->ordered_ref_edges(edge_list);
       PRINT_INFO("  Edges: ");
       for (int j = 0; j < edge_list.size(); j++)
       {
         PRINT_INFO("%d ", edge_list[j]->id());
       }
       PRINT_INFO("\n");
     }
   } 
   return CUBIT_SUCCESS;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines