cgma
BasicTopologyEntity Class Reference

#include <BasicTopologyEntity.hpp>

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

List of all members.

Public Member Functions

virtual const char * class_name () const
virtual DagType dag_type () const =0
 Returns the dag type of this enity.
 BasicTopologyEntity ()
virtual ~BasicTopologyEntity ()
CubitStatus get_grouping_entity_list (DLIList< GroupingEntity * > &groupingEntityList) const
GroupingEntityget_first_grouping_entity_ptr () const
CubitStatus get_sense_entity_list (DLIList< SenseEntity * > &senseEntityList) const
SenseEntityget_first_sense_entity_ptr () const
CubitStatus add_grouping_entity (GroupingEntity *)
CubitStatus remove_grouping_entity (GroupingEntity *)
CubitStatus set_grouping_entity_list (DLIList< GroupingEntity * > &new_list, DLIList< GroupingEntity * > &removed_list)
CubitStatus add_sense_entity (SenseEntity *)
CubitStatus remove_sense_entity (SenseEntity *)
SenseEntityfind_sense_entity (GroupingEntity *gpe) const
SenseEntityfind_sense_entity (BasicTopologyEntity *bte) const
CubitStatus get_sense_entities (DLIList< SenseEntity * > &result, GroupingEntity *in_this)
CubitStatus get_sense_entities (DLIList< SenseEntity * > &result, BasicTopologyEntity *in_this)
CubitBoolean is_nonmanifold (GroupingEntity *in_this_parent)
GeometryEntityget_geometry_entity_ptr () const
GeometryType geometry_type () const
virtual CubitBox bounding_box ()
virtual CubitBox unmerged_bounding_box ()
CubitStatus set_geometry_entity_ptr (GeometryEntity *geometryEntityPtr)
double measure ()
virtual int get_parents (DLIList< TopologyEntity * > *list=0) const
virtual int get_children (DLIList< TopologyEntity * > *list=0) const

Static Public Member Functions

static const char * get_class_name ()

Protected Member Functions

virtual CubitBoolean query_append_parents (DLIList< TopologyEntity * > &list)
virtual CubitBoolean query_append_children (DLIList< TopologyEntity * > &list)
virtual CubitStatus remove_child_link (TopologyEntity *entity_ptr)
CubitStatus disconnect_all_children (DLIList< TopologyEntity * > *children=0)
CubitStatus disconnect_all_parents (DLIList< TopologyEntity * > *parents=0)

Private Member Functions

 BasicTopologyEntity (const BasicTopologyEntity &)
void operator= (const BasicTopologyEntity &)

Private Attributes

SenseEntityfirstSenseEntity
SenseEntitylastSenseEntity
GroupingEntityfirstGroupingEntity
GroupingEntitylastGroupingEntity

Detailed Description

Definition at line 76 of file BasicTopologyEntity.hpp.


Constructor & Destructor Documentation

-------------------------------------------------------------------------

Definition at line 43 of file BasicTopologyEntity.cpp.


Member Function Documentation

Definition at line 107 of file BasicTopologyEntity.cpp.

{
  if (gpe_ptr->dag_type().parent() != dag_type())
    return CUBIT_FAILURE;
  
  if (gpe_ptr->get_basic_topology_entity_ptr())
    return CUBIT_FAILURE;
    
  assert(!gpe_ptr->next());
  
  if (firstGroupingEntity)
  {
    if (!gpe_ptr->insert_after(lastGroupingEntity))
      return CUBIT_FAILURE;
  }
  else
  {
    firstGroupingEntity = gpe_ptr;
  }  
    
  lastGroupingEntity = gpe_ptr;
  gpe_ptr->set_basic_topology_entity_ptr(this);
  return CUBIT_SUCCESS;
}

Definition at line 286 of file BasicTopologyEntity.cpp.

{
  if (se_ptr->dag_type() != dag_type().parent())
    return CUBIT_FAILURE;
  
  if (se_ptr->get_basic_topology_entity_ptr())
    return CUBIT_FAILURE;
    
  assert(!se_ptr->next_on_bte());
  if (firstSenseEntity)
  {
    assert(!lastSenseEntity->next_on_bte());
    lastSenseEntity->set_bte_next(se_ptr);
  }
  else
  {
    firstSenseEntity = se_ptr;
  }
  
  lastSenseEntity = se_ptr;
  se_ptr->set_basic_topology_entity_ptr(this);
  return CUBIT_SUCCESS;
}

Implements CubitEntity.

Definition at line 471 of file BasicTopologyEntity.cpp.

virtual const char* BasicTopologyEntity::class_name ( ) const [inline, virtual]

Reimplemented from TopologyEntity.

Reimplemented in RefFace, RefVolume, RefEdge, and RefVertex.

Definition at line 83 of file BasicTopologyEntity.hpp.

    { return get_class_name(); }
virtual DagType BasicTopologyEntity::dag_type ( ) const [pure virtual]

Returns the dag type of this enity.

Implements RefEntity.

Implemented in RefFace, RefVolume, RefEdge, and RefVertex.

CubitStatus BasicTopologyEntity::disconnect_all_children ( DLIList< TopologyEntity * > *  children = 0) [protected, virtual]

Implements TopologyEntity.

Definition at line 682 of file BasicTopologyEntity.cpp.

{
  while (firstGroupingEntity)
  {
    GroupingEntity* gpe_ptr = firstGroupingEntity;
    
    if (!remove_grouping_entity(gpe_ptr))
      return CUBIT_FAILURE;

    if (list)
      list->append(gpe_ptr);
  }
  return CUBIT_SUCCESS;
}
CubitStatus BasicTopologyEntity::disconnect_all_parents ( DLIList< TopologyEntity * > *  parents = 0) [protected, virtual]

Implements TopologyEntity.

Definition at line 658 of file BasicTopologyEntity.cpp.

{
  while (firstSenseEntity)
  {
    SenseEntity* se_ptr = firstSenseEntity;
    
    if (!remove_sense_entity(se_ptr))
      return CUBIT_FAILURE;

    if (list)
      list->append(se_ptr);
  }
  return CUBIT_SUCCESS;
}

Definition at line 367 of file BasicTopologyEntity.cpp.

{
  SenseEntity *ptr, *result = 0;
  for (ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
  {
    if (ptr->get_grouping_entity_ptr() == gpe)
    {
      if (result)
        return 0;
      result = ptr;
    }
  }
  
  return result;
}

Definition at line 382 of file BasicTopologyEntity.cpp.

{
  SenseEntity *ptr, *result = 0;
  for (ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
  {
    GroupingEntity* gpe = ptr->get_grouping_entity_ptr();
    BasicTopologyEntity* tmp_bte = gpe ? gpe->get_basic_topology_entity_ptr() : 0;
    if (tmp_bte == bte)
    {
      if (result)
        return 0;
      result = ptr;
    }
  }
  
  return result;
}

Definition at line 447 of file BasicTopologyEntity.cpp.

{
     //- returns type of underlying geometry representation
     //- (see GeometryEntity.hpp for list of types)
   return get_geometry_entity_ptr()->geometry_type();
}
int BasicTopologyEntity::get_children ( DLIList< TopologyEntity * > *  list = 0) const [virtual]

Implements TopologyEntity.

Definition at line 566 of file BasicTopologyEntity.cpp.

{
  if (!firstGroupingEntity)
    return 0;
  
  int count = 0;
  GroupingEntity* ptr;
  
  for (ptr = firstGroupingEntity; ptr; ptr = ptr->next())
  {
    count++;
    if (list)
      list->append(ptr);
  }

  return count;
}
static const char* BasicTopologyEntity::get_class_name ( ) [inline, static]

Reimplemented from TopologyEntity.

Reimplemented in RefFace, RefVolume, RefEdge, and RefVertex.

Definition at line 80 of file BasicTopologyEntity.hpp.

    { return "BasicTopologyEntity"; }

Definition at line 278 of file BasicTopologyEntity.hpp.

  { return firstSenseEntity; }

Definition at line 464 of file BasicTopologyEntity.cpp.

{
  TopologyBridge* bridge = bridge_manager()->topology_bridge();
  return dynamic_cast<GeometryEntity*>(bridge);
}

Definition at line 66 of file BasicTopologyEntity.cpp.

{
  for (GroupingEntity* ptr = firstGroupingEntity; ptr; ptr = ptr->next())
  {
    assert(ptr->get_basic_topology_entity_ptr() == this);
    list.append(ptr);
  }
  
  return CUBIT_SUCCESS;
}
int BasicTopologyEntity::get_parents ( DLIList< TopologyEntity * > *  list = 0) const [virtual]

Implements TopologyEntity.

Definition at line 537 of file BasicTopologyEntity.cpp.

{
  if (!firstSenseEntity)
    return 0;
  
  int count = 0;
  SenseEntity* ptr;
  
  for (ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
  {
    count++;
    if (list)
      list->append(ptr);
  }

  return count;
}

Definition at line 400 of file BasicTopologyEntity.cpp.

{
  int input_size = result.size();
  
  for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
    if (!in_this || ptr->get_grouping_entity_ptr() == in_this)
      result.append(ptr);
  
  return result.size() > input_size ? CUBIT_SUCCESS : CUBIT_FAILURE;
}

Definition at line 413 of file BasicTopologyEntity.cpp.

{
  int input_size = result.size();
  
  for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
    if (!in_this || ptr->get_parent_basic_topology_entity_ptr() == in_this)
      result.append(ptr);
  
  return result.size() > input_size ? CUBIT_SUCCESS : CUBIT_FAILURE;
}

Definition at line 87 of file BasicTopologyEntity.cpp.

{
  for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
  {
    assert(ptr->get_basic_topology_entity_ptr() == this);
    list.append(ptr);
  }
  return CUBIT_SUCCESS;
}

Definition at line 436 of file BasicTopologyEntity.cpp.

{
  int count = 0;
  for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
    if (ptr->get_grouping_entity_ptr() == gpe)
      count++;
  
  assert(count);
  return count == 1 ? CUBIT_FALSE : CUBIT_TRUE;
}
double BasicTopologyEntity::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 RefEntity.

Reimplemented in RefFace, and RefEdge.

Definition at line 525 of file BasicTopologyEntity.cpp.

void BasicTopologyEntity::operator= ( const BasicTopologyEntity ) [private]

Implements TopologyEntity.

Definition at line 610 of file BasicTopologyEntity.cpp.

{
  if (!firstGroupingEntity)
    return 0;
  
  CubitBoolean found_some = CUBIT_FALSE;
  ModelQueryEngine *const mqe = ModelQueryEngine::instance();
  GroupingEntity* ptr;
  
  for (ptr = firstGroupingEntity; ptr; ptr = ptr->next())
  {
    if (!mqe->encountered(ptr))
    {
      found_some = CUBIT_TRUE;
      list.append(ptr);
    }
  }

  return found_some;  
}

Implements TopologyEntity.

Definition at line 593 of file BasicTopologyEntity.cpp.

{
  if (!firstSenseEntity)
    return CUBIT_FALSE;
  
  
  CubitBoolean found_some = CUBIT_FALSE;
  ModelQueryEngine *const mqe = ModelQueryEngine::instance();
  for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next_on_bte())
    if (!mqe->encountered(ptr))
    {
      list.append(ptr);
      found_some = CUBIT_TRUE;
    }
  
  return found_some;  
}
CubitStatus BasicTopologyEntity::remove_child_link ( TopologyEntity entity_ptr) [protected, virtual]

Implements TopologyEntity.

Definition at line 640 of file BasicTopologyEntity.cpp.

{
  GroupingEntity* gpe_ptr = dynamic_cast<GroupingEntity*>(entity_ptr);
  if (!gpe_ptr)
    return CUBIT_FAILURE;
  
  return remove_grouping_entity(gpe_ptr);
}

Definition at line 141 of file BasicTopologyEntity.cpp.

{
  if (gpe_ptr->get_basic_topology_entity_ptr() != this)
    return CUBIT_FAILURE;
  
  GroupingEntity* next_gpe_ptr = gpe_ptr->next();
  GroupingEntity* prev_gpe_ptr = gpe_ptr->previous();
  
  if (!gpe_ptr->remove_from_list())
    return CUBIT_FAILURE;
  
  if (firstGroupingEntity == gpe_ptr)
    firstGroupingEntity = next_gpe_ptr;
  if (lastGroupingEntity == gpe_ptr)
    lastGroupingEntity = prev_gpe_ptr;

  gpe_ptr->set_basic_topology_entity_ptr(0);
  return CUBIT_SUCCESS;
}

Definition at line 319 of file BasicTopologyEntity.cpp.

{
  if (se_ptr->get_basic_topology_entity_ptr() != this)
    { assert(0); return CUBIT_FAILURE; }
  
  if (!firstSenseEntity)
    return CUBIT_FAILURE;
  
  if (firstSenseEntity == se_ptr)
  {
    if (lastSenseEntity == se_ptr)
    {
      firstSenseEntity = lastSenseEntity = 0;
    }
    else
    {
      firstSenseEntity = se_ptr->next_on_bte();
    }
  }
  else
  {
    SenseEntity* prev = firstSenseEntity;
    while (prev->next_on_bte() != se_ptr)
    {
      prev = prev->next_on_bte();
      if (!prev)
        return CUBIT_FAILURE;
    }
    
    prev->set_bte_next( se_ptr->next_on_bte() );
    if (lastSenseEntity == se_ptr)
      lastSenseEntity = prev;
  }
  
  se_ptr->set_bte_next(0);
  se_ptr->set_basic_topology_entity_ptr(0);
  return CUBIT_SUCCESS;
}

Definition at line 513 of file BasicTopologyEntity.cpp.

{
//   if (dag_type().dimension() != GE_ptr.dimension())
//   {
//     PRINT_ERROR("Internal Error: %s:%d: Mismatched BTE/GeometryEntity.\n",
//                  __FILE__,__LINE__);
//     return CUBIT_FAILURE;
//   }
   return TopologyEntity::set_topology_bridge(GE_ptr);
}

Definition at line 170 of file BasicTopologyEntity.cpp.

{
  int i;
  
    // Remove all?
  if (list.size() == 0)
  {
    get_grouping_entity_list( removed );
    return disconnect_all_children();
  }
  
    // Check for error conditions before modifying anything
  list.reset();
  for (i = list.size(); i--; )
  {
    GroupingEntity* grouping_entity = list.get_and_step();
    
      // Check to make sure that we are getting the correct type of 
      // GroupingEntity.
    if ( dag_type() != grouping_entity->dag_type().parent() )
       return CUBIT_FAILURE ;
   
      // Check that the grouping entity is not already in some other
      // basic topology entity
    if ( grouping_entity->get_basic_topology_entity_ptr() &&
         grouping_entity->get_basic_topology_entity_ptr() != this )
      return CUBIT_FAILURE;
  }
  
    // Special case for first entity in list.
  list.reset();
  GroupingEntity* new_first = list.get_and_step();
    // No sense entities currently attached...
  if (!firstGroupingEntity)
  {
    firstGroupingEntity = lastGroupingEntity = new_first;
    new_first->set_basic_topology_entity_ptr(this);
  }
    // Already attached, but not first in list...
  else if( firstGroupingEntity != new_first )
  {
    if (!new_first->get_basic_topology_entity_ptr())
      new_first->set_basic_topology_entity_ptr(this);
    else
    {
      if (lastGroupingEntity == new_first)
        lastGroupingEntity = new_first->previous();
      new_first->remove_from_list();
    }
      
    new_first->insert_before(firstGroupingEntity);
    firstGroupingEntity = new_first;
  }
  
    // Now loop through remaining sense entities.
  GroupingEntity* prev = new_first;
  for (i = list.size() - 1; i--; )
  {
    GroupingEntity* curr = list.get_and_step();

      // If next grouping entity in input list is not
      // next grouping entity in this BTE...
    if (prev->next() != curr)
    {
      if (!curr->get_basic_topology_entity_ptr())
        curr->set_basic_topology_entity_ptr(this);
      else
      {
        if (lastGroupingEntity == curr)
          lastGroupingEntity = curr->previous();
        curr->remove_from_list();
      }
      curr->insert_after(prev);
    }
    
      // update lastSenseEntity if necessary...
    if (lastGroupingEntity == prev)
      lastGroupingEntity = curr;
      
      // iterate
    prev = curr;
  }
  
    // Disconnect any grouping entities in this BTE
    // that were not in in the input list (they should now
    // be at the end of the list of grouping entities in this)
    // and pass them back in the 'removed' list.
  CubitStatus result = CUBIT_SUCCESS;
  while (prev != lastGroupingEntity)
  {
    removed.append(prev->next());
    if (!remove_grouping_entity(prev->next()))
    {
      assert(0);
      result = CUBIT_FAILURE;
      prev = prev->next();
    }
  }
  
  return result;
}

Definition at line 479 of file BasicTopologyEntity.cpp.

{
  if(bridge_manager()->number_of_bridges() == 1)
  {
    return get_geometry_entity_ptr()->bounding_box() ;
  }
  else
  {
    CubitBox aggregate_box;
    DLIList<TopologyBridge*> bridges;
    bridge_manager()->get_bridge_list(bridges);
    GeometryEntity *ge = dynamic_cast<GeometryEntity*>(bridges.get_and_step());
    if(ge)
      aggregate_box = ge->bounding_box();
    int i;
    for(i=bridges.size(); i>1; i--)
    {
      ge = dynamic_cast<GeometryEntity*>(bridges.get_and_step());
      if(ge)
        aggregate_box |= ge->bounding_box();
    }
    return aggregate_box;
  }
}

Member Data Documentation


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