cgma
TopologyEntity Class Reference

#include <TopologyEntity.hpp>

Inheritance diagram for TopologyEntity:
BasicTopologyEntity GroupingEntity SenseEntity RefEdge RefFace RefVertex RefVolume Body Chain Loop Shell CoEdge CoFace CoVertex CoVolume

List of all members.

Public Member Functions

 TopologyEntity ()
virtual ~TopologyEntity ()
virtual const char * class_name () const
GeometryQueryEngineget_geometry_query_engine () const
CubitBoolean is_directly_related (TopologyEntity *entity)
CubitStatus bodies (DLIList< Body * > &body_list)
CubitStatus shells (DLIList< Shell * > &shell_list)
CubitStatus loops (DLIList< Loop * > &loop_list)
CubitStatus chains (DLIList< Chain * > &chain_list)
CubitStatus ref_volumes (DLIList< RefVolume * > &ref_volume_list)
CubitStatus ref_faces (DLIList< RefFace * > &ref_face_list)
CubitStatus ref_edges (DLIList< RefEdge * > &ref_edge_list)
CubitStatus ref_vertices (DLIList< RefVertex * > &ref_vertex_list)
CubitStatus co_volumes (DLIList< CoVolume * > &co_volume_list)
CubitStatus co_faces (DLIList< CoFace * > &co_face_list)
CubitStatus co_edges (DLIList< CoEdge * > &co_edge_list)
CubitStatus co_vertices (DLIList< CoVertex * > &co_vertex_list)
RefVertexref_vertex ()
RefEdgeref_edge ()
RefFaceref_face ()
RefVolumeref_volume ()
Bodybody ()
CoEdgeco_edge ()
int num_loops ()
int num_ref_volumes ()
int num_ref_faces ()
int num_ref_edges ()
int num_ref_vertices ()
const BridgeManagerbridge_manager () const
BridgeManagerbridge_manager ()
virtual void reverse_topology ()
virtual int get_children (DLIList< TopologyEntity * > *list=0) const =0
virtual int get_parents (DLIList< TopologyEntity * > *list=0) const =0
virtual DagType dag_type () const =0
void deactivated (CubitBoolean flag)
CubitBoolean deactivated () const
CubitStatus remove_from_DAG (CubitBoolean recursive_flag=CUBIT_FALSE)
void disconnect_from_DAG ()
virtual CubitStatus remove_child_link (TopologyEntity *child_ptr)=0
virtual CubitStatus disconnect_all_children (DLIList< TopologyEntity * > *children=0)=0
virtual CubitStatus disconnect_all_parents (DLIList< TopologyEntity * > *parents=0)=0

Static Public Member Functions

static const char * get_class_name ()

Protected Member Functions

CubitStatus set_topology_bridge (TopologyBridge *TB_ptr)
virtual CubitBoolean query_append_parents (DLIList< TopologyEntity * > &list)=0
virtual CubitBoolean query_append_children (DLIList< TopologyEntity * > &list)=0

Protected Attributes

cBit deactivatedStatus_: 1
cBit encountered_: 1

Private Member Functions

 TopologyEntity (const TopologyEntity &)
void operator= (const TopologyEntity &)

Private Attributes

BridgeManager bridgeMan

Friends

class ModelQueryEngine

Detailed Description

Definition at line 56 of file TopologyEntity.hpp.


Constructor & Destructor Documentation

Definition at line 118 of file TopologyEntity.cpp.

{
  // Make sure that the TopologyEntity class does not have a pointer to this
  // TopologyEntity in its list.  If it does, then remove the instances
  // of the pointer
  DAG::instance()->remove(this);
}

Member Function Documentation

Definition at line 185 of file TopologyEntity.cpp.

{
  DLIList<Body*> these_bodies;
  this->bodies(these_bodies);
  if (these_bodies.size() > 0) return these_bodies.get();
  else return NULL;
}
const BridgeManager* TopologyEntity::bridge_manager ( ) const [inline]

Definition at line 128 of file TopologyEntity.hpp.

    { return &bridgeMan; }

Definition at line 130 of file TopologyEntity.hpp.

    { return &bridgeMan; }
virtual const char* TopologyEntity::class_name ( ) const [inline, virtual]

Reimplemented in RefFace, BasicTopologyEntity, RefVolume, Body, RefEdge, and RefVertex.

Definition at line 70 of file TopologyEntity.hpp.

     { return get_class_name(); }

Definition at line 194 of file TopologyEntity.cpp.

{
  DLIList<CoEdge*> these_co_edges;
  co_edges(these_co_edges);
  if (these_co_edges.size() > 0) return these_co_edges.get();
  else return NULL;
}

Definition at line 386 of file TopologyEntity.cpp.

{
   if (deactivatedStatus_ != flag)
   {
     deactivatedStatus_ = flag ;
     if (flag == CUBIT_TRUE)
     {
        DAG::instance()->add_deactivated_DAG_node(this) ;
     }
     else
     {
        DAG::instance()->remove_deactivated_DAG_node(this) ;
     }
   }
}
virtual CubitStatus TopologyEntity::disconnect_all_children ( DLIList< TopologyEntity * > *  children = 0) [pure virtual]
virtual CubitStatus TopologyEntity::disconnect_all_parents ( DLIList< TopologyEntity * > *  parents = 0) [pure virtual]

Definition at line 367 of file TopologyEntity.cpp.

{
    // disconnects this entity from any others
    // to which it is connected in the DAG; does not delete the DAGNode

  disconnect_all_children();
  disconnect_all_parents();
}
virtual int TopologyEntity::get_children ( DLIList< TopologyEntity * > *  list = 0) const [pure virtual]
static const char* TopologyEntity::get_class_name ( ) [inline, static]

Reimplemented in RefFace, BasicTopologyEntity, RefVolume, Body, RefEdge, and RefVertex.

Definition at line 67 of file TopologyEntity.hpp.

     { return "TopologyEntity"; }

Definition at line 128 of file TopologyEntity.cpp.

{
  TopologyBridge* bridge = 
    const_cast<TopologyEntity*>(this)->bridgeMan.topology_bridge();
  if (bridge)
    return bridge->get_geometry_query_engine();
  else
    return NULL;
}
virtual int TopologyEntity::get_parents ( DLIList< TopologyEntity * > *  list = 0) const [pure virtual]

Definition at line 241 of file TopologyEntity.cpp.

{
    // NULL?
  if ( !entity )
    return CUBIT_FALSE;
  
    // self?
  if (entity == this)
    return CUBIT_TRUE;  

    // same type but not self?
  if ( dag_type() == entity->dag_type() )  
    return CUBIT_FALSE;
  
    // Get the entities of the right type.
  DLIList<TopologyEntity*> kin_folk;
  CubitStatus result = ModelQueryEngine::instance()->
    query_model( *this, entity->dag_type(), kin_folk );
    //only fails if types are the same, caught above. 
  assert(result != CUBIT_FAILURE); 
  if (CUBIT_FAILURE == result) {
    PRINT_ERROR("ModelQueryEngine::query_model failed.\n");
    return CUBIT_FALSE;
  }

    // Search entities for passed in entity.
  TopologyEntity* model_entity = CAST_TO(entity, TopologyEntity) ;
  return kin_folk.is_in_list( model_entity );
}

Definition at line 202 of file TopologyEntity.cpp.

{
  DLIList<Loop*> these_loops;
  loops(these_loops);
  return these_loops.size();
}

Definition at line 224 of file TopologyEntity.cpp.

{
  DLIList<RefEdge*> these_ref_edges;
  ref_edges(these_ref_edges);
  return these_ref_edges.size();
}

Definition at line 217 of file TopologyEntity.cpp.

{
  DLIList<RefFace*> these_ref_faces;
  ref_faces(these_ref_faces);
  return these_ref_faces.size();
}

Definition at line 231 of file TopologyEntity.cpp.

{
  DLIList<RefVertex*> these_ref_vertices;
  ref_vertices(these_ref_vertices);
  return these_ref_vertices.size();
}

Definition at line 210 of file TopologyEntity.cpp.

{
  DLIList<RefVolume*> these_ref_volumes;
  ref_volumes(these_ref_volumes);
  return these_ref_volumes.size();
}
void TopologyEntity::operator= ( const TopologyEntity ) [private]
virtual CubitBoolean TopologyEntity::query_append_children ( DLIList< TopologyEntity * > &  list) [protected, pure virtual]
virtual CubitBoolean TopologyEntity::query_append_parents ( DLIList< TopologyEntity * > &  list) [protected, pure virtual]

Definition at line 161 of file TopologyEntity.cpp.

{
  DLIList<RefEdge*> edges;
  ref_edges(edges);
  if (edges.size() > 0) return edges.get();
  else return NULL;
}

Definition at line 169 of file TopologyEntity.cpp.

{
  DLIList<RefFace*> faces;
  ref_faces(faces);
  if (faces.size() > 0) return faces.get();
  else return NULL;
}

Definition at line 153 of file TopologyEntity.cpp.

{
  DLIList<RefVertex*> verts;
  ref_vertices(verts);
  if (verts.size() > 0) return verts.get();
  else return NULL;
}

Reimplemented in RefFace.

Definition at line 177 of file TopologyEntity.cpp.

{
  DLIList<RefVolume*> volumes;
  ref_volumes(volumes);
  if (volumes.size() > 0) return volumes.get();
  else return NULL;
}
virtual CubitStatus TopologyEntity::remove_child_link ( TopologyEntity child_ptr) [pure virtual]

Definition at line 283 of file TopologyEntity.cpp.

{
     // This counter will be used in the recursion to test whether
     // the call is from outside or from the function itself. When
     // the call comes from outside, the counter should always be
     // zero.

  CubitBoolean this_recurse = recurse_flag;
  if (recurse_flag == CUBIT_FALSE) recurse_flag = CUBIT_TRUE;

  DLIList<TopologyEntity*> childModEntList;

     // Check to see if there are no parents of this object.
   if ( get_parents() == 0 )
   {
      if (this_recurse == CUBIT_FALSE)
      {
         // Since we are not recursing, this is a top-level entity.
         // Notify the static observers that a top-level entity is being
         // destructed.  This must be done before children are disconnected.
       CubitObservable *top_level = CAST_TO(this, CubitObservable);
       AppUtil::instance()->send_event(GeometryEvent(GeometryEvent::TOP_LEVEL_ENTITY_DESTRUCTED, dynamic_cast<RefEntity*>(top_level)));
      }

        // Go through all the children and remove their link to
        // the current object.

      TopologyEntity* tempModEntPtr = NULL ;
      TopologyEntity* childModEntPtr = NULL ;

      childModEntList.clean_out();
      disconnect_all_children(&childModEntList);

        // The following while conditional may not work...it depends on
        // what is_at_end does when you step over the end...CHECK THIS
      int i;
      for( i = 0 ; i < childModEntList.size() ; i++ )
      {
           // Get the next ModelEnti in the child list and make sure its
           // pointer to its parent is removed.
         tempModEntPtr = childModEntList.get_and_step();

           // Try remove() on the child ModEnt. If it comes back with
           // a success, then delete it.
         childModEntPtr = tempModEntPtr;

         if ( childModEntPtr->remove_from_DAG(recurse_flag) == CUBIT_SUCCESS )
         {
              // Now deactivate the child ModEnt
            childModEntPtr->deactivated(CUBIT_TRUE) ;

              // remove it from observables, just before we go to delete it
            CubitObservable *observable = CAST_TO(childModEntPtr, CubitObservable);
            if (observable)
            {
              AppUtil::instance()->send_event(GeometryEvent(GeometryEvent::TOPOLOGY_ENTITY_DESTRUCTED, dynamic_cast<RefEntity*>(observable)));
            }
         }
      }


        // If this is the top of the recursion, then clean out all the deactivated
        // entities.
      if (this_recurse == CUBIT_FALSE)
      {
         this->deactivated(CUBIT_TRUE) ;

         // remove it from observables, just before we go to delete it
         CubitObservable *observable = CAST_TO(childModEntPtr, CubitObservable);
         if (observable)
         {
           AppUtil::instance()->send_event(GeometryEvent(GeometryEvent::TOPOLOGY_ENTITY_DESTRUCTED, dynamic_cast<RefEntity*>(observable)));
         }
         GeometryQueryTool::instance()->cleanout_deactivated_geometry() ;
      }

      return CUBIT_SUCCESS ;
   }
   else
   {
      return CUBIT_FAILURE ;
   }
}
virtual void TopologyEntity::reverse_topology ( ) [inline, virtual]

Reimplemented in RefFace, and RefEdge.

Definition at line 137 of file TopologyEntity.hpp.

{}

Definition at line 271 of file TopologyEntity.cpp.

{
  assert (TB_ptr != NULL);
  CubitStatus rv = CUBIT_SUCCESS;
  
  BridgeManager* bridges = bridge_manager();
  bridges->remove_all_bridges();
  bridges->add_bridge(TB_ptr);

  return rv;
}

Friends And Related Function Documentation

friend class ModelQueryEngine [friend]

Definition at line 169 of file TopologyEntity.hpp.


Member Data Documentation

Definition at line 184 of file TopologyEntity.hpp.

Definition at line 175 of file TopologyEntity.hpp.

Definition at line 178 of file TopologyEntity.hpp.


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