cgma
RefFace Class Reference

#include <RefFace.hpp>

Inheritance diagram for RefFace:
BasicTopologyEntity TopologyEntity RefEntity CubitEntity CubitObservable ToolDataUser CubitAttribUser

List of all members.

Public Types

typedef RefEdge ChildType
typedef RefVolume ParentType

Public Member Functions

virtual ~RefFace ()
virtual const char * class_name () const
DagType dag_type () const
 Returns the dag type of this enity.
const std::type_info & entity_type_info () const
 Returns the type info of this enity.
void get_parent_ref_entities (DLIList< RefEntity * > &entity_list)
CubitStatus get_co_faces (DLIList< CoFace * > &co_faces_found_list, RefVolume *input_ref_volume_ptr)
CubitStatus ordered_loops (DLIList< Loop * > &loop_list)
int co_edge_loops (DLIList< DLIList< CoEdge * > > &co_edge_loops)
int ref_edge_loops (DLIList< DLIList< RefEdge * > > &ref_edge_loops)
void ref_vertex_loops (DLIList< DLIList< RefVertex * > > &ref_vert_loop_list)
int number_of_Loops ()
RefVolumeref_volume ()
void hard_points (DLIList< RefVertex * > &new_hard_point_list)
int adjoins (RefFace *input_face_ptr)
RefVolumecommon_ref_volume (RefFace *input_face_ptr)
RefEdgecommon_ref_edge (RefFace *input_face_ptr)
int common_ref_edges (RefFace *input_face_ptr, DLIList< RefEdge * > &common_edge_list)
CoFaceget_matching_CoFace (RefVolume *ref_volume_ptr)
int genus ()
int num_poles ()
virtual CubitVector center_point ()
 Return the approximate (spatial) center of this RefEntity.
CubitSense sense (RefVolume *volume)
CubitSense sense (RefFace *face_ptr)
CubitSense get_geometry_sense ()
CubitBoolean about_spatially_equal (RefFace *ref_face_ptr_2, double tolerance_factor=1.0, CubitBoolean notify_refEntity=CUBIT_FALSE, CubitBoolean test_bbox=CUBIT_TRUE, int test_internal=0)
CubitSense compare_alignment (RefFace *second_ref_face_ptr)
CubitVector normal_at (const CubitVector &location, RefVolume *volume=NULL, double *u_guess=NULL, double *v_guess=NULL)
void reverse_normal ()
virtual void reverse_topology ()
CubitBoolean set_outward_normal (RefVolume *volume)
virtual void move_to_surface (CubitVector &location, double *u_guess=NULL, double *v_guess=NULL)
virtual CubitStatus move_to_surface (CubitVector &location, CubitVector &along_vec)
void find_closest_point_trimmed (CubitVector from_point, CubitVector &point_on_surface)
void find_closest_points_trimmed (std::vector< CubitVector > &from_points, std::vector< CubitVector > &points_on_surface)
CubitPointContainment point_containment (const CubitVector &point)
CubitPointContainment point_containment (double u, double v)
CubitStatus get_principal_curvatures (const CubitVector &point, double &curvature1, double &curvature2, RefVolume *ref_volume_ptr=NULL)
CubitStatus evaluate (double u, double v, CubitVector *position, CubitVector *normal, CubitVector *curvature1, CubitVector *curvature2)
CubitVector position_from_u_v (double u, double v)
CubitStatus u_v_from_position (CubitVector const &location, double &u, double &v, CubitVector *closest_location=NULL)
CubitBoolean is_parametric ()
CubitBoolean get_param_range_U (double &lower_bound, double &upper_bound)
CubitBoolean get_param_range_V (double &lower_bound, double &upper_bound)
CubitBoolean is_periodic ()
CubitBoolean is_periodic_in_U (double &period)
CubitBoolean is_periodic_in_V (double &period)
CubitBoolean is_singular_in_U (double u_param)
CubitBoolean is_singular_in_V (double v_param)
CubitBoolean is_closed_in_U ()
CubitBoolean is_closed_in_V ()
CubitStatus uv_derivitives (double u_param, double v_param, CubitVector &du, CubitVector &dv)
virtual int dimension () const
double area ()
virtual double measure ()
virtual CubitString measure_label ()
 Returns the type of measure: (volume, area, length, or N/A)
CubitBoolean is_planar ()
CubitBoolean is_cylindrical ()
CubitStatus get_point_normal (CubitVector &origin, CubitVector &normal)
virtual int validate ()
 Perform checks to see if entity valid.
double get_crack_length ()
void add_hard_point (RefVertex *ref_vertex_ptr)
Surfaceget_surface_ptr ()
Surface const * get_surface_ptr () const
CubitStatus get_graphics (GMem &results, unsigned short normal_tolerance=15, double distance_tolerance=0.0, double longest_edge=0.0)
CubitStatus get_projected_distance_on_surface (CubitVector *pos1, CubitVector *pos2, double &distance)

Static Public Member Functions

static const char * get_class_name ()

Protected Member Functions

 RefFace (Surface *surfacePtr)

Protected Attributes

DLIList< RefVertex * > hardPointList

Private Member Functions

 RefFace (const RefFace &)
void operator= (const RefFace &)
void initialize ()

Private Attributes

double maxPositionDeviation
int hardPointColor

Friends

class RefEntityFactory

Detailed Description

Definition at line 74 of file RefFace.hpp.


Member Typedef Documentation

Definition at line 78 of file RefFace.hpp.

Definition at line 79 of file RefFace.hpp.


Constructor & Destructor Documentation

RefFace::~RefFace ( ) [virtual]

Definition at line 91 of file RefFace.cpp.

{
    // Delete the hardpoints associated with this RefFace
  
  
//     // Delete the contents of the SurfVertexList
//   for ( i = surfVertexList.size(); i > 0; i --)
//   {
//     delete surfVertexList.get_and_step();
//   }
  
    // Delete the contents of the HardPointList (these are RefVertices).
    // Calling the remove() function ensures that the DAG cleaned out 
    // appropriately.
  int i;
  for ( i = hardPointList.size(); i > 0; i --)
  {
    hardPointList.get_and_step()->remove_from_DAG();
  }
  
  remove_from_observers();  
}
RefFace::RefFace ( Surface surfacePtr) [protected]

Definition at line 62 of file RefFace.cpp.

{
     // Set the GeometryEntity pointer   if (surfacePtr != NULL)
   if (surfacePtr != NULL)
   {
      set_geometry_entity_ptr(surfacePtr) ;
   }
   else
   {
      PRINT_ERROR("In the RefFace(Surface*) constructor\n"
                  "       Input Surface pointer is NULL\n");
      assert(CUBIT_FALSE);
   }
   
     // Initialize the member data
   initialize();
}
RefFace::RefFace ( const RefFace ) [private]

Member Function Documentation

CubitBoolean RefFace::about_spatially_equal ( RefFace ref_face_ptr_2,
double  tolerance_factor = 1.0,
CubitBoolean  notify_refEntity = CUBIT_FALSE,
CubitBoolean  test_bbox = CUBIT_TRUE,
int  test_internal = 0 
)

Definition at line 521 of file RefFace.cpp.

{
     // Get rid of the trivial case...
   if( this == ref_face_ptr_2)
   {
      if (notify_refEntity)
        remove_compare_data();
      return CUBIT_TRUE;
   }

   const double tolerance = tolerance_factor * GEOMETRY_RESABS;
   CubitBox box_1 = this->bounding_box();
   CubitBox box_2 = ref_face_ptr_2->bounding_box();
   if (!box_1.overlap( tolerance, box_2) )
    return CUBIT_FALSE;


   GeometryQueryTool* gqt = GeometryQueryTool::instance();
   DLIList<RefEdge*> ref_edge_list_1, ref_edge_list_2;
   this->ref_edges( ref_edge_list_1 );
   ref_face_ptr_2->ref_edges( ref_edge_list_2 );
      
        //compare the size of the two lists.
   if ( ref_edge_list_1.size() != ref_edge_list_2.size() )
     return CUBIT_FALSE;
   
   if (test_internal == 2) // Do internal test for splines only
   {
     const GeometryType this_type = this->geometry_type();
     const GeometryType othr_type = ref_face_ptr_2->geometry_type();
     if (this_type != SPLINE_SURFACE_TYPE    &&
         this_type != BEST_FIT_SURFACE_TYPE  &&
         this_type != UNDEFINED_SURFACE_TYPE &&
         othr_type != SPLINE_SURFACE_TYPE    &&
         othr_type != BEST_FIT_SURFACE_TYPE  &&
         othr_type != UNDEFINED_SURFACE_TYPE   )
      test_internal = 0;
     else
      test_bbox = CUBIT_FALSE;
   }
      
   
     //This compare precedure does the following :
     //   1. Test the bounding boxes of the 2 faces for equality;
     //      If they are "equal" (within "resabs*tolerance_factor"):
     //   2. Compare the ref-edges.
     //   3. Test a point on the two surfaces. 
     //   4. When notify_refEntity is CUBIT_TRUE, whenever find an
     //      two ReEntity's are spatially equal, notify the RefEntity.
     //**** Reorderd by J.Kraftcheck, Sept 22, 2003 ****
     // - Check mergable curves first.  Then check boxes and finally
     //   the internal position.
     
   DLIList<Loop*> loop_list_1, loop_list_2;
   DLIList<CoEdge*> loop_1_coedges;
   this->loops( loop_list_1 );
   ref_face_ptr_2->loops( loop_list_2 );
   if( loop_list_1.size() != loop_list_2.size() )
     return CUBIT_FALSE;

   CubitSense relative_sense = compare_alignment( ref_face_ptr_2 );

   // match each loop in loop_list_1 with one in loop_list_2
   for( int i1 = loop_list_1.size(); i1 > 0; i1-- )
   {
     Loop* loop_1 = loop_list_1.get_and_step();
     loop_1_coedges.clean_out();
     loop_1->ordered_co_edges( loop_1_coedges );
     bool loop_match = false;

     // check every loop in loop_list_2 to see if it matches
     // the current loop from loop_list_1
     for( int i2 = loop_list_2.size(); (i2 > 0) && !loop_match; i2-- )
     {
       Loop* loop_2 = loop_list_2.step_and_get();
       loop_match = loop_2->about_spatially_equal( loop_1_coedges,
                                                   relative_sense,
                                                   tolerance_factor,
                                                   notify_refEntity );
     }
                                          
     // loop from loop_list_1 did not match any loop in loop_list_2
     if( ! loop_match )
       return CUBIT_FALSE;

     // found a match for the current one, so remove it
     loop_list_2.extract();

   } // for( loop_list_1 )


   if ( test_bbox )
   {
       // This test checks to see that the min and max vectors of the
       // bounding boxes are within 10% of the length of the bbox diagonal.
       // Note that this assumes the default values of resabs=1e-6 and
       // tolerance_factor=500

       // It has already been determined that the RefEdges of the
       // surfaces are mergeable, so the bounding boxes of the 
       // RefEdges should be equivalent.  Consider the bounding box
       // of each RefFace to be the RefFace's box united with the
       // box of all the curves.  This removes any potential issues
       // with non-tight bounding boxes for spline curves from 
       // consideration, while still comparing any extend of the boxes
       // that is the result of some internal feature of the surfaces.
     if (ref_edge_list_1.size())
     {
       int i;
       // Call 'unmerged_bounding_box' here so that we get the aggregate bounding box
       // of all of the Topology Bridges of curves that are already merged.  If we don't
       // do this we may not expand the bounding boxes sufficiently to get correct results.
       CubitBox edge_box = ref_edge_list_1.step_and_get()->unmerged_bounding_box();
       for (i = ref_edge_list_1.size(); i > 1; i--)
        edge_box |= ref_edge_list_1.step_and_get()->unmerged_bounding_box();
       for (i = ref_edge_list_2.size(); i > 0; i--)
        edge_box |= ref_edge_list_2.step_and_get()->unmerged_bounding_box();
       box_1 |= edge_box;
       box_2 |= edge_box;
     }

     CubitVector tol_vect(
         CUBIT_MIN(box_1.x_range(), box_2.x_range()),
         CUBIT_MIN(box_1.y_range(), box_2.y_range()),
         CUBIT_MIN(box_1.z_range(), box_2.z_range()) );
     tol_vect *= 200.0 * tolerance;

     if( tol_vect.x() < tolerance ) tol_vect.x(tolerance);
     if( tol_vect.y() < tolerance ) tol_vect.y(tolerance);
     if( tol_vect.z() < tolerance ) tol_vect.z(tolerance);
     
     if( (fabs(box_1.minimum().x() - box_2.minimum().x()) > tol_vect.x()) ||
         (fabs(box_1.maximum().x() - box_2.maximum().x()) > tol_vect.x()) ||
         (fabs(box_1.minimum().y() - box_2.minimum().y()) > tol_vect.y()) ||
         (fabs(box_1.maximum().y() - box_2.maximum().y()) > tol_vect.y()) ||
         (fabs(box_1.minimum().z() - box_2.minimum().z()) > tol_vect.z()) ||
         (fabs(box_1.maximum().z() - box_2.maximum().z()) > tol_vect.z()) )
     {
        return CUBIT_FALSE;
     }
   }
    
   //if both lists of edges are zero, this is the concentric sphere or torus case.
   //must look for a point on the surface then.
   if ( (ref_edge_list_1.size() == 0 && ref_edge_list_2.size() == 0 ) ||
         test_internal != 0 )
   {
       //test a point in the middle.
     CubitVector center_1, center_2;
     CubitVector temp_1 = this->center_point();
     this->find_closest_point_trimmed( temp_1, center_1);
       //Okay, now we have the point.  See if this point is on the other 
       //surface.
     ref_face_ptr_2->find_closest_point_trimmed( center_1, center_2 );
     if ( !gqt->about_spatially_equal(center_1, center_2, tolerance_factor ) )
       return CUBIT_FALSE;
   }


     // If we have come this far, we have found matches for
     // every edge of the FACEs. Now notify the associated RefEntities
     // that a match was found.
   if (notify_refEntity == CUBIT_TRUE )
   {
      this->comparison_found(ref_face_ptr_2);
   }

   return CUBIT_TRUE;

}    
void RefFace::add_hard_point ( RefVertex ref_vertex_ptr)

Definition at line 957 of file RefFace.cpp.

{
   hardPointList.append( ref_vertex_ptr );
}
int RefFace::adjoins ( RefFace input_face_ptr)
double RefFace::area ( )

Definition at line 1186 of file RefFace.cpp.

Return the approximate (spatial) center of this RefEntity.

Reimplemented from RefEntity.

Definition at line 441 of file RefFace.cpp.

{
   CubitVector center_pt = bounding_box().center();
   move_to_surface(center_pt);
   return center_pt;
}
virtual const char* RefFace::class_name ( ) const [inline, virtual]

Reimplemented from BasicTopologyEntity.

Definition at line 94 of file RefFace.hpp.

     {
       return get_class_name();
     }
int RefFace::co_edge_loops ( DLIList< DLIList< CoEdge * > > &  co_edge_loops)

Definition at line 854 of file RefFace.cpp.

{
   DLIList<DLIList<CoEdge*> > temp_loop_list;
   DLIList<Loop*> loop_list;
   CubitStatus status = CUBIT_FAILURE;
   Loop *loop_ptr;
   
     //Get the ordered loops (outside to inside);
   status = ordered_loops( loop_list );
   if ( status == CUBIT_FAILURE )
       return status;
   
     //Now get the co_edges associated with the loops.
   for ( int ii = loop_list.size(); ii > 0; ii-- )
   {
      loop_ptr = loop_list.get_and_step();
      
        // Get the CoEdges on this Loop (the "24" is just a memory allocation
        // chunking value and doesn't imply that we have a list of size 24!!)
      DLIList<CoEdge*> co_edge_list;
      
        //Get the ref_edges with respect to the loop.
      status = loop_ptr->ordered_co_edges( co_edge_list );
      if ( status == CUBIT_FAILURE )
      {
         return status;
      }
      temp_loop_list.append( co_edge_list );
   }
   co_edge_loops += temp_loop_list;
   
   return CUBIT_SUCCESS;
}
RefEdge * RefFace::common_ref_edge ( RefFace input_face_ptr)

Definition at line 1127 of file RefFace.cpp.

{
   DLIList<RefEdge*> this_edge_list;
   ref_edges ( this_edge_list );
   
   for ( int i = this_edge_list.size(); i > 0; i--)
   {
      RefEdge* edge = this_edge_list.get_and_step();
      if (edge->find_sense_entity(input_face_ptr))
        return edge;
   }
   
   return NULL;
}
int RefFace::common_ref_edges ( RefFace input_face_ptr,
DLIList< RefEdge * > &  common_edge_list 
)

Definition at line 1142 of file RefFace.cpp.

{
   DLIList<RefEdge*> this_edge_list;
   ref_edges ( this_edge_list );
   int nedges = 0;
   
   for ( int i = this_edge_list.size(); i > 0; i--)
   {
      RefEdge* edge = this_edge_list.get_and_step();
      if (edge->find_sense_entity(input_face_ptr))
      {
        common_edge_list.append(edge);
        nedges++;
      }
   }
   
   return nedges;
}
RefVolume * RefFace::common_ref_volume ( RefFace input_face_ptr)

Definition at line 1161 of file RefFace.cpp.

{
   DLIList<RefVolume*> this_volume_list;
   DLIList<RefVolume*> input_volume_list;
   
   ref_volumes ( this_volume_list );
   input_face_ptr->ref_volumes ( input_volume_list );
   
   for ( int i = this_volume_list.size(); i > 0; i--)
   {
      if (input_volume_list.move_to (this_volume_list.get()))
      {
         return this_volume_list.get();
      }
      
      this_volume_list.step();
   }
   
   return NULL;
}
CubitSense RefFace::compare_alignment ( RefFace second_ref_face_ptr)

Definition at line 702 of file RefFace.cpp.

{
     //Get the sense by testing the two RefFace's at their common
     //center point.
   CubitVector center_point = this->center_point();
   CubitVector normal_this, normal_second;
   normal_this = this->normal_at( center_point );
   normal_second = second_ref_face_ptr->normal_at( center_point );
   
   double dot = normal_this % normal_second;
   
   CubitSense sense = CUBIT_FORWARD;
   if ( dot < 0 )
   {
      sense = CUBIT_REVERSED;
   }
// Moved this warning into merge tool because this function can
// be used by other code, for which this warning is misleading.
// j.k. - 10/11/01
//   else
//   {
//      PRINT_WARNING("Merging %s (surface %d) and %s (surface %d) "
//                    " which have the same sense.\n"
//                    "This may indicate bad geometry.\n",
//                    entity_name().c_str(), id(),
//                    second_ref_face_ptr->entity_name().c_str(),
//                    second_ref_face_ptr->id() );
//   }
   return sense;
}
DagType RefFace::dag_type ( ) const [inline, virtual]

Returns the dag type of this enity.

Implements BasicTopologyEntity.

Definition at line 100 of file RefFace.hpp.

{ return DagType::ref_face_type(); }
int RefFace::dimension ( ) const [virtual]

Returns the geometric dimension of the entity. vertex == 0, edge == 1, etc.

Reimplemented from RefEntity.

Definition at line 1182 of file RefFace.cpp.

{
   return 2;
}
const std::type_info& RefFace::entity_type_info ( ) const [inline, virtual]

Returns the type info of this enity.

Implements RefEntity.

Definition at line 101 of file RefFace.hpp.

{ return typeid(RefFace); }
CubitStatus RefFace::evaluate ( double  u,
double  v,
CubitVector position,
CubitVector normal,
CubitVector curvature1,
CubitVector curvature2 
)

Definition at line 1457 of file RefFace.cpp.

{
  if( NULL == position && NULL == normal &&
      NULL == curvature1 && NULL == curvature2 )
      return CUBIT_FAILURE;

  Surface* surf_ptr = get_surface_ptr();
  if (!surf_ptr)
  {
    PRINT_ERROR("RefFace %d is invalid -- no attached Surface.\n",id());
    return CUBIT_FAILURE;
  }
  
  return surf_ptr->evaluate(u, v, position, normal, curvature1, curvature2 );
}
void RefFace::find_closest_point_trimmed ( CubitVector  from_point,
CubitVector point_on_surface 
)

Definition at line 302 of file RefFace.cpp.

{
   get_surface_ptr()->closest_point_trimmed(from_point, point_on_surface);
}
void RefFace::find_closest_points_trimmed ( std::vector< CubitVector > &  from_points,
std::vector< CubitVector > &  points_on_surface 
)

Definition at line 308 of file RefFace.cpp.

{
   get_surface_ptr()->closest_points_trimmed(from_points, points_on_surface);
}
int RefFace::genus ( )

Definition at line 417 of file RefFace.cpp.

{
  int nloops = num_loops();
  if (nloops > 0) return (nloops - 1);
  else {
      // need to compute poles
    int num_poles = this->num_poles();
    return -(num_poles+1);
  }
}
static const char* RefFace::get_class_name ( ) [inline, static]

Reimplemented from BasicTopologyEntity.

Definition at line 89 of file RefFace.hpp.

     {
       return "Surface";
     }
CubitStatus RefFace::get_co_faces ( DLIList< CoFace * > &  co_faces_found_list,
RefVolume input_ref_volume_ptr 
)

Definition at line 138 of file RefFace.cpp.

{
  // find two loops to check the shortest distance between as that's where Cubit is most
  // likely to crack surfaces

  DLIList<Loop*> crack_loops;

  DLIList<Loop*> loops;
  this->loops(loops);

  int i, j;
  for(i=0; i<loops.size(); i++)
  {
    Loop* l = loops.get_and_step();
    LoopType loop_type = l->loop_type();
    if(loop_type == LOOP_TYPE_U_PERIODIC || loop_type == LOOP_TYPE_V_PERIODIC)
      crack_loops.append(l);
  }

  if(crack_loops.size() >= 2)
  {
    Loop* loop1 = crack_loops.get_and_step();
    Loop* loop2 = crack_loops.get_and_step();

    DLIList<RefEdge*> loop1_edges;
    loop1->ref_edges(loop1_edges);
    DLIList<RefEdge*> loop2_edges;
    loop2->ref_edges(loop2_edges);

    CubitVector p1, p2;
    double min_dist = -1.0;

    for(i=0; i<loop1_edges.size(); i++)
    {
      RefEdge* edge1 = loop1_edges.get_and_step();
      for(j=0; j<loop2_edges.size(); j++)
      {
        RefEdge* edge2 = loop2_edges.get_and_step();
        if(edge2 != edge1)
        {
          CubitVector v1, v2;
          double dist = -1;
          dist_between(edge1, edge2, v1, v2, dist);
          if(min_dist < 0 || (dist < min_dist && dist > 0))
          {
            min_dist = dist;
            p1 = v1;
            p2 = v2;
          }
        }
      }
    }

    // estimate distance along the surface in case of curvature
    if(min_dist > 0)
    {
      double new_min_dist = 0;
      double start_uv[2];
      double end_uv[2];
      this->u_v_from_position(p1, start_uv[0], start_uv[1]);
      this->u_v_from_position(p2, end_uv[0], end_uv[1]);
      double delta_uv[2];
      delta_uv[0] = (end_uv[0] - start_uv[0]) / 10.0;
      delta_uv[1] = (end_uv[1] - start_uv[1]) / 10.0;

      CubitVector start = p1;
      CubitVector next;
      for(i=0; i<10; i++)
      {
        start_uv[0] += delta_uv[0];
        start_uv[1] += delta_uv[1];
        next = this->position_from_u_v( start_uv[0], start_uv[1] );
        new_min_dist += start.distance_between(next);
        start = next;
      }
      min_dist = new_min_dist;
    }

    if(min_dist < 0)
    {
      min_dist = 0;
    }

    PRINT_DEBUG_99("Crack_length is %f\n", min_dist);
    return min_dist;
  }

  PRINT_DEBUG_99("No valid crack length for surface %i\n", this->id());
  return 0.0;
}
CubitStatus RefFace::get_graphics ( GMem results,
unsigned short  normal_tolerance = 15,
double  distance_tolerance = 0.0,
double  longest_edge = 0.0 
)

Definition at line 1428 of file RefFace.cpp.

{
  Surface* surf_ptr = get_surface_ptr();
  if (!surf_ptr)
  {
    PRINT_ERROR("RefFace %d is invalid -- no attached Surface.\n",id());
    return CUBIT_FAILURE;
  }
  
  return surf_ptr->get_geometry_query_engine()->
    get_graphics(surf_ptr, &facets, 
      normal_tolerance, distance_tolerance, longest_edge );
}

Definition at line 951 of file RefFace.cpp.

{
  return dynamic_cast<CoFace*>(find_sense_entity(ref_volume_ptr));
}
CubitBoolean RefFace::get_param_range_U ( double &  lower_bound,
double &  upper_bound 
)

Definition at line 1021 of file RefFace.cpp.

{
     //- Returns the lower and upper parametric bounds of the 
     //- surface in U, if it is parametric.  Otherwise, it returns
     //- CUBIT_FALSE and zeroes for the upper and lower parametric
     //- bounds.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->get_param_range_U(lower_bound, upper_bound);
}
CubitBoolean RefFace::get_param_range_V ( double &  lower_bound,
double &  upper_bound 
)

Definition at line 1039 of file RefFace.cpp.

{
     //- Returns the lower and upper parametric bounds of the 
     //- surface in V, if it is parametric.  Otherwise, it returns
     //- CUBIT_FALSE and zeroes for the upper and lower parametric
     //- bounds.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->get_param_range_V(lower_bound, upper_bound);
}
void RefFace::get_parent_ref_entities ( DLIList< RefEntity * > &  entity_list) [virtual]

Appends all RefEntities that own this (parent RefEntities) to entity_list. (The query goes up just one dimension. For example, if this is a vertex, the resulting list contains only RefEdges).

Implements RefEntity.

Definition at line 1498 of file RefFace.cpp.

{

  // First get the type of RefEntity that is a child of "this" one
  DagType parent_type = get_parent_ref_entity_type();;

  DLIList<TopologyEntity*> tempList ;

  CubitStatus result = ModelQueryEngine::instance()->
      query_model( *this, parent_type, tempList );
  if (result == CUBIT_FAILURE)
  {
    PRINT_ERROR("In RefEntity::get_parent_ref_entities\n");
    PRINT_ERROR("       Query failed for unknown reason.\n");
    return;
  }

  entity_list.clean_out();
  for(int i=0; i<tempList.size(); i++)
  {
    entity_list.append(static_cast<ParentType*>(tempList[i]));
  }
}

Definition at line 1291 of file RefFace.cpp.

{
   if( is_planar() == CUBIT_FALSE)
      return CUBIT_FAILURE;

   Surface* surface_ptr = get_surface_ptr();

   if( surface_ptr != NULL )
   {
      if( surface_ptr->get_point_normal( origin, normal ) == CUBIT_FAILURE )
         return CUBIT_FAILURE;
   }
   else 
   {
      PRINT_WARNING("In RefFace::get_point_normal\n"
                    "         %s (surface %d) is not associated with a valid\n"
                    "         underlying geoemtric Surface\n",
                    entity_name().c_str(), id()) ;
      return CUBIT_FAILURE;
   }
   
   if (surface_ptr->bridge_sense() == CUBIT_REVERSED)
     normal = -normal;
   
   return CUBIT_SUCCESS;
}
CubitStatus RefFace::get_principal_curvatures ( const CubitVector point,
double &  curvature1,
double &  curvature2,
RefVolume ref_volume_ptr = NULL 
)

Definition at line 389 of file RefFace.cpp.

{
   Surface* surface_ptr = get_surface_ptr();
   
     // Call the relevant function to compute the curvatures
   CubitStatus status = surface_ptr->
       principal_curvatures( point, curvature1, curvature2 );
   if ( status != CUBIT_SUCCESS )
       return status;
       
   if (surface_ptr->bridge_sense() == CUBIT_REVERSED) {
     curvature1 = -curvature1;
     curvature2 = -curvature2;
   }
       
   if ( ref_volume_ptr ) {
      CubitSense s = sense( ref_volume_ptr );
      if (  s == CUBIT_REVERSED ) {
         curvature1 = -curvature1;
         curvature2 = -curvature2;
      }
   }
   return CUBIT_SUCCESS;
}
CubitStatus RefFace::get_projected_distance_on_surface ( CubitVector pos1,
CubitVector pos2,
double &  distance 
)

Definition at line 1478 of file RefFace.cpp.

{
  if( pos1 == pos2 )
    return CUBIT_FAILURE;

  if( NULL == pos1 || NULL == pos2 )
    return CUBIT_FAILURE;

  Surface* surf_ptr = get_surface_ptr();
  if (!surf_ptr)
  {
    PRINT_ERROR("RefFace %d is invalid -- no attached Surface.\n",id());
    return CUBIT_FAILURE;
  }
  
  return surf_ptr->get_projected_distance_on_surface( pos1, pos2, distance );
}

Definition at line 1210 of file RefFace.cpp.

{
  // Just do one cast instead of two -- KGM
  TopologyBridge* bridge = bridge_manager()->topology_bridge();
  return CAST_TO(bridge, Surface);
  //return CAST_TO(get_geometry_entity_ptr(), Surface);
}
const Surface * RefFace::get_surface_ptr ( ) const

Definition at line 1218 of file RefFace.cpp.

void RefFace::hard_points ( DLIList< RefVertex * > &  new_hard_point_list)

Definition at line 962 of file RefFace.cpp.

{
   new_hard_point_list = hardPointList;
}
void RefFace::initialize ( ) [private]

Definition at line 1352 of file RefFace.cpp.

{
     // Set the Entity ID for this new RefFace
   GeometryEntity* geom_ptr = get_geometry_entity_ptr();
   int saved_id = geom_ptr->get_saved_id();
   if ( !saved_id || RefEntityFactory::instance()->get_ref_face(saved_id) )
   {
     saved_id =  RefEntityFactory::instance()->next_ref_face_id();
     geom_ptr->set_saved_id(saved_id);
   }
   entityId = saved_id;
   
     // Default graphics attributes
   hardPointColor = 1;

     // initialize meshing data

     // initialize the bounding box
   CubitBox bound_box = bounding_box();
   maxPositionDeviation = 
       (bound_box.maximum() - bound_box.minimum()).length()/10.0;

     // read and initialize attributes
   auto_read_cubit_attrib();
   auto_actuate_cubit_attrib();

#ifdef ALPHA_TREADSWEEP
   if(entityId != saved_id)
     geom_ptr->set_saved_id(entityId);
#endif
   
     // Assign a default entity name
   assign_default_name();   
   
}

Definition at line 1445 of file RefFace.cpp.

{
  Surface* surface_ptr = get_surface_ptr();
  return surface_ptr->is_closed_in_U();
}

Definition at line 1451 of file RefFace.cpp.

{
  Surface* surface_ptr = get_surface_ptr();
  return surface_ptr->is_closed_in_V();
}

Definition at line 1268 of file RefFace.cpp.

{
     // Cast the generic GeometryEntity pointer to Surface pointer
   Surface* surfacePtr = this->get_surface_ptr() ;
   
     // Check if we have a valid Surface. If so, return the result of
     // querying the Surface if it is planar.
   if ( surfacePtr != NULL )
   {
      GeometryType geo_type;
      geo_type = surfacePtr->is_cylindrical();
      return geo_type == CYLINDER_SURFACE_TYPE ? CUBIT_TRUE : CUBIT_FALSE;
   }
   else
   {
      PRINT_WARNING("In RefFace::is_cylindrical\n"
                    "         %s (surface %d) is not associated with a valid\n"
                    "         underlying geoemtric Surface\n",
                    entity_name().c_str(), id()) ;
      return CUBIT_FALSE ;
   }
}

Definition at line 1006 of file RefFace.cpp.

{
     //- This function determines whether the underlying geometry of the
     //- Surface is parametrically defined or not.  Returns CUBIT_TRUE if 
     //- it is and CUBIT_FALSE if it is not.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->is_parametric();
}

Definition at line 1056 of file RefFace.cpp.

{
     //- This function determines whether the underlying geometry of the
     //- Surface is periodic or not.  Returns CUBIT_TRUE if it is and 
     //- CUBIT_FALSE if it is not.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->is_periodic();
}

Definition at line 1071 of file RefFace.cpp.

{
     //- Determines whether the surface object is 
     //- periodic in the U direction or not.  If it is, it
     //- returns CUBIT_TRUE and the value of the period. Otherwise,
     //- it returns CUBIT_FALSE and a value of 0.0 or the period.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->is_periodic_in_U(period);
}

Definition at line 1087 of file RefFace.cpp.

{
     //- Determines whether the surface object is 
     //- periodic in the V direction or not.  If it is, it
     //- returns CUBIT_TRUE and the value of the period. Otherwise,
     //- it returns CUBIT_FALSE and a value of 0.0 or the period.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->is_periodic_in_V(period);
}

Definition at line 1234 of file RefFace.cpp.

{
     // Cast the generic GeometryEntity pointer to Surface pointer
   Surface* surfacePtr = this->get_surface_ptr() ;
   
     // Check if we have a valid Surface. If so, return the result of
     // querying the Surface if it is planar.
   if ( surfacePtr != NULL )
   {
      GeometryType geo_type;
      geo_type = surfacePtr->geometry_type();
      return geo_type == PLANE_SURFACE_TYPE ? CUBIT_TRUE : CUBIT_FALSE;
   }
   else
   {
      PRINT_WARNING("In RefFace::is_planar\n"
                    "         %s (surface %d) is not associated with a valid\n"
                    "         underlying geoemtric Surface\n",
                    entity_name().c_str(), id()) ;
      return CUBIT_FALSE ;
   }
}

Definition at line 1102 of file RefFace.cpp.

{
     //- Determines whether the surface object is 
     //- singular in the U direction or not.  
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->is_singular_in_U(u_param);
}

Definition at line 1114 of file RefFace.cpp.

{
     //- Determines whether the surface object is 
     //- singular in the V direction or not.  
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   return surface->is_singular_in_V(v_param);
}
double RefFace::measure ( ) [virtual]

A generic geometric extent function. Returns volume for RefVolumes, area for RefFaces, length for RefEdge, and 1.0 for RefVertices A RefGroup calculates the maximum dimension of its contained entities and returns the sum of the measures() of all entities of that dimension. Default return value is 0.0 for all other entities.

Reimplemented from BasicTopologyEntity.

Definition at line 1191 of file RefFace.cpp.

{
   return this->area();
}

Returns the type of measure: (volume, area, length, or N/A)

Reimplemented from RefEntity.

Definition at line 1196 of file RefFace.cpp.

{
   return "area";
}
void RefFace::move_to_surface ( CubitVector location,
double *  u_guess = NULL,
double *  v_guess = NULL 
) [virtual]

Definition at line 329 of file RefFace.cpp.

{
  CubitVector closest_location;
  CubitStatus result;

  if(!u_guess || !v_guess) // no guess was provided
  {
    if (u_guess || v_guess)
    {
      PRINT_ERROR("move_to_surface(): neither or both of u_guess and "
                  "v_guess must be specified.\n");
      assert(u_guess && v_guess);
    }
    result = get_surface_ptr()->closest_point(location, &closest_location);
  }
  else
  {
    result = get_surface_ptr()->closest_point_uv_guess(location, 
                                                       *u_guess, *v_guess,
                                                       &closest_location);
  }
  

  if (result == CUBIT_FAILURE)
  {
    PRINT_ERROR("In RefFace::move_to_surface\n"
                "       Could not compute the closest point to "
                "location {%f %f %f} on %s (surface %d).\n",
                location.x(), location.y(), location.z(),
                this->entity_name().c_str(),
                this->id());
    assert ( result == CUBIT_SUCCESS );
    return;
  }

  location.set ( closest_location.x(), 
                closest_location.y(), 
                closest_location.z() );
}
CubitStatus RefFace::move_to_surface ( CubitVector location,
CubitVector along_vec 
) [virtual]

Definition at line 314 of file RefFace.cpp.

{  
  CubitVector closest_location;
  CubitStatus status = get_surface_ptr()->closest_point_along_vector(location, along_vec,                                                        
                                                       closest_location);

  if( CUBIT_SUCCESS == status )
    location.set ( closest_location.x(), 
    closest_location.y(), 
    closest_location.z() );

  return status;
}
CubitVector RefFace::normal_at ( const CubitVector location,
RefVolume volume = NULL,
double *  u_guess = NULL,
double *  v_guess = NULL 
)

Definition at line 229 of file RefFace.cpp.

{
     // The Surface::normal_at function not only returns the normal, but 
     // also returns the point on the actual surface that is closest to 
     // the input location.  The normal is actually computed at *this*
     // (closest) point on the surface, not at the input location.
   CubitVector normal;
   CubitStatus result;
   Surface* surface_ptr = get_surface_ptr();
   
  if(!u_guess || !v_guess) // no guess was provided
  {
    if (u_guess || v_guess)
    {
      PRINT_ERROR("normal_at(): neither or both of u_guess and "
                  "v_guess must be specified.\n");
      assert(u_guess && v_guess);
    }
    result = surface_ptr->closest_point(location, NULL, &normal);
  }
  else
  {
    result = surface_ptr->closest_point_uv_guess(location, 
                                                       *u_guess, *v_guess,
                                                       NULL, &normal );
  }

   if (result == CUBIT_FAILURE)
   {
      PRINT_ERROR("In RefFace::normal_at\n"
                  "       Could not compute the requested normal at "
                  "location {%f %f %f} on %s (surface %d).\n",
                  location.x(), location.y(), location.z(),
                  this->entity_name().c_str(),
                  this->id());
      //assert ( result == CUBIT_SUCCESS );
      return CubitVector(0.0, 0.0, 0.0);
   }
   
   if (surface_ptr->bridge_sense() == CUBIT_REVERSED)
     normal = -normal;
   
   if ( volume )
   {
      CubitSense s = sense( volume );
      if( s != CUBIT_FORWARD && s != CUBIT_REVERSED )
      {
        if(!(volume->is_sheet()))
        {
          PRINT_ERROR("Surface %d has bad sense information with respect to volume %d\n"
                      "       Probably is a 2-sided surface embedded in volume %d\n"  
                      "       Cannot handle this case.\n", id(), volume->id(), volume->id() );
          return CubitVector(0.0, 0.0, 0.0);
        }
      }
      
      if ( s == CUBIT_REVERSED )
          normal = -normal;
   }
   
   return normal;
}

Definition at line 428 of file RefFace.cpp.

{
  int num_poles = 0;
  double u_low, u_high, v_low, v_high;
  get_param_range_U(u_low, u_high);
  get_param_range_V(v_low, v_high);
  if (is_singular_in_U(u_low)) num_poles++;
  if (is_singular_in_U(u_high)) num_poles++;
  if (is_singular_in_V(v_low)) num_poles++;
  if (is_singular_in_V(v_high)) num_poles++;
  return num_poles;
}

Definition at line 448 of file RefFace.cpp.

{
   int number_of_loops = 0;
   
     // Get the GroupingEntities (Loops) associated with this 
     // BasicTopologyEntity (RefFace)
   DLIList<GroupingEntity*> loopList;
   if ( this->get_grouping_entity_list(loopList) == CUBIT_SUCCESS)
   {
      number_of_loops = loopList.size();
   }
   
   else
   {
      PRINT_ERROR("In RefFace::number_of_Loops\n"
                  "       Unknown problem retrieving Loops "
                  "for %s (surface %d).\n",
                  entity_name().c_str(),
                  this->id());
      number_of_loops = 0;
   }
   
   return number_of_loops;
}
void RefFace::operator= ( const RefFace ) [private]

Definition at line 370 of file RefFace.cpp.

{
  Surface *surf = get_surface_ptr();
  return surf->point_containment(point);
}
CubitPointContainment RefFace::point_containment ( double  u,
double  v 
)

Definition at line 376 of file RefFace.cpp.

{
  Surface *surf = get_surface_ptr();
  return surf->point_containment(u, v);
}
CubitVector RefFace::position_from_u_v ( double  u,
double  v 
)

Definition at line 967 of file RefFace.cpp.

{
     // Get the Surface this object points to
   Surface* surfacePtr = get_surface_ptr();
   
     // Make sure we get a valid Surface
   assert(surfacePtr != NULL) ;
   
     // Ask the Surface to do the real work
   return surfacePtr->position_from_u_v(u, v) ;
}
int RefFace::ref_edge_loops ( DLIList< DLIList< RefEdge * > > &  ref_edge_loops)

Definition at line 888 of file RefFace.cpp.

{
// NOTE: all of the ref_edge_list's will need to be deleted by 
//       the calling function...

   DLIList<RefEdge*> ref_edge_list;
   DLIList<DLIList<RefEdge*> > temp_loop_list;
   DLIList<Loop*> loop_list;
   CubitStatus status = CUBIT_FAILURE;
   Loop *loop_ptr;
   
     //Get the ordered loops (outside to inside);
   status = ordered_loops( loop_list );
   if ( status == CUBIT_FAILURE )
       return status;
   
     //Now get the ref-edges associated with the loops.
   for ( int ii = loop_list.size(); ii > 0; ii-- )
   {
      loop_ptr = loop_list.get_and_step();
      
      ref_edge_list.clean_out();
      
        //Get the ref_edges with respect to the loop.
      status = loop_ptr->ordered_ref_edges( ref_edge_list );
      if ( status == CUBIT_FAILURE )
      {
         return status;
      }
      temp_loop_list.append( ref_edge_list );
   }
   ref_edge_loops += temp_loop_list;
   
   return CUBIT_SUCCESS;
}
void RefFace::ref_vertex_loops ( DLIList< DLIList< RefVertex * > > &  ref_vert_loop_list)

Reimplemented from TopologyEntity.

Definition at line 925 of file RefFace.cpp.

{
   DLIList<RefEntity*> entity_list;
   DLIList<RefVolume*> vol_list;
   RefVolume *vol_ptr;
   
     // Get the list of RefVolumes that own this RefFace.
   get_parent_ref_entities( entity_list );
   CAST_LIST( entity_list, vol_list , RefVolume);
   
     // Return the first valid RefVolume from the list.
   vol_list.reset();
   for( int i = vol_list.size(); i>0; i-- )
   {
      vol_ptr = vol_list.get_and_step();
      if( vol_ptr )
          return vol_ptr;
   }
   
     // Print ERROR if no valid RefVolume was found.
   PRINT_ERROR("No RefVolume found for the RefEdge.\n");
   return NULL;
}
void RefFace::reverse_topology ( ) [virtual]

Reimplemented from TopologyEntity.

Definition at line 1388 of file RefFace.cpp.

{
   
   int i;
   
     // switch sense going up in dimension 
   DLIList<CoFace*> co_face_list;
   co_faces( co_face_list );
   for ( i = co_face_list.size(); i--; ) {
      CoFace *co_face = co_face_list.get_and_step();
      co_face->set_sense( CubitUtil::opposite_sense( co_face->get_sense() ) );    
   }
   
     // switch sense going down in dimension 
   DLIList<Loop*> loop_list;
   loops( loop_list );
   for ( i = loop_list.size(); i--; )
       loop_list.get_and_step()->reverse_direction();
}

Definition at line 473 of file RefFace.cpp.

{
   SenseEntity* co_face = find_sense_entity(volume);
   return co_face ? co_face->get_sense() : CUBIT_UNKNOWN;
}

Definition at line 479 of file RefFace.cpp.

{
    DLIList<RefEdge*> edge_list, other_edge_list;
    ref_edges( edge_list );
    face_ptr->ref_edges( other_edge_list );
    edge_list.intersect( other_edge_list );
    
    CubitSense result = CUBIT_UNKNOWN;
    if( edge_list.size() > 0 )
    {
        RefEdge* edge = edge_list.get_and_step();
        if( edge->sense(this) == edge->sense(face_ptr) )
            result = CUBIT_REVERSED;
        else result = CUBIT_FORWARD;
    }
    for( int i = edge_list.size(); i > 1; i-- )
    {
        RefEdge* edge = edge_list.get_and_step();
        CubitSense temp = (edge->sense(this)==edge->sense(face_ptr)) 
            ? CUBIT_FORWARD : CUBIT_REVERSED;
        if( temp != result )
        {
            result = CUBIT_UNKNOWN;
            break;
        }
    }
    return result;
}

Definition at line 1414 of file RefFace.cpp.

{
   CubitSense vol_sense = sense( volume );
   if ( vol_sense == CUBIT_UNKNOWN )
      return CUBIT_FALSE;
   assert( vol_sense == CUBIT_FORWARD || vol_sense == CUBIT_REVERSED );
   if ( vol_sense == CUBIT_REVERSED ) {
      reverse_normal();
      return CUBIT_TRUE;
   }
   // else already right pointing right way.
   return CUBIT_FALSE;
}
CubitStatus RefFace::u_v_from_position ( CubitVector const &  location,
double &  u,
double &  v,
CubitVector closest_location = NULL 
)

Definition at line 979 of file RefFace.cpp.

{
     //- This function returns the {u, v} coordinates of the point 
     //- on the Surface closest to the input point (specified in global
     //- space). The closest_location is also returned.
   
     // pass call directly to surface
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   assert(surface != NULL);
   
   if(is_parametric() == CUBIT_TRUE)
   {
      return surface->u_v_from_position (location, u, v,
                                      closest_location);
   }
   else
   {
     return CUBIT_FAILURE;
   }
}
CubitStatus RefFace::uv_derivitives ( double  u_param,
double  v_param,
CubitVector du,
CubitVector dv 
)

Definition at line 294 of file RefFace.cpp.

{
  return get_surface_ptr()->uv_derivitives(u_param, v_param, du, dv);
}
int RefFace::validate ( ) [virtual]

Perform checks to see if entity valid.

Reimplemented from RefEntity.

Definition at line 1318 of file RefFace.cpp.

{
     //- This function determines whether the entity is valid.
     //- Several types of checks can be done, 
   int error = 0;
   
     // Perform general RefEntity checks (measure > 0)
   error += RefEntity::validate();
   
     // Pass through to surface and add in its validation
   Surface *surface = get_surface_ptr();
   
     // check surface ptr
   if (surface != NULL) {
        // Check underlying surface
       DLIList <TopologyEntity*> bad_entities;
      error += surface->validate(entity_name(), bad_entities);
   } else {
      PRINT_WARNING("\tWARNING: Null underlying surface for %s, (%s %d)\n",
                    entity_name().c_str(), class_name(), id());
      error++;
   }
   return error;
}

Friends And Related Function Documentation

friend class RefEntityFactory [friend]

Definition at line 81 of file RefFace.hpp.


Member Data Documentation

int RefFace::hardPointColor [private]

Definition at line 538 of file RefFace.hpp.

Definition at line 526 of file RefFace.hpp.

Definition at line 536 of file RefFace.hpp.


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