cgma
|
#include <CAActuateSet.hpp>
Public Member Functions | |
CAActuateSet (DLIList< RefEntity * > &actuate_list) | |
~CAActuateSet () | |
void | set_current_dimension (int dimension) |
RefEntity * | remove_next () |
virtual void | notify_observer (const CubitEvent *observer_event) |
Private Member Functions | |
void | append_to_current (DLIList< RefEntity * > &query_results) |
Static Private Member Functions | |
static DagType | get_type_id (int dimension) |
Private Attributes | |
DLIList< RefEntity * > | typeList [5] |
DLIList< RefEntity * > | currentList |
int | currentDimension |
Definition at line 26 of file CAActuateSet.hpp.
CAActuateSet::CAActuateSet | ( | DLIList< RefEntity * > & | actuate_list | ) |
Definition at line 39 of file CAActuateSet.cpp.
: currentDimension(-1) { // register this as a static observer so that we can // remove entities from the lists as they are destroyed AppUtil::instance()->event_dispatcher().add_observer(this); // put all entities in the actuate_list into the typeList // for the appropriate dimension of entity. for( int i = actuate_list.size(); i--; ) { RefEntity* entity_ptr = actuate_list.get_and_step(); int dimension = entity_ptr->dimension(); if( dimension < 0 ) // body dimension = 4; typeList[dimension].append( entity_ptr ); } }
Definition at line 67 of file CAActuateSet.cpp.
{ // remove from static observer list AppUtil::instance()->event_dispatcher().remove_observer(this); }
void CAActuateSet::append_to_current | ( | DLIList< RefEntity * > & | query_results | ) | [private] |
Definition at line 130 of file CAActuateSet.cpp.
{ int i; // Set marks on all new entities for( i = list.size(); i--; ) list.get_and_step()->marked(1); // Clear marks on entities in current list, // including those also in the new list. for( i = currentList.size(); i--; ) currentList.get_and_step()->marked(0); // Any entities in the new list that are still // marked are not already in the current list. // Add them. for( i = list.size(); i--; ) { RefEntity* entity_ptr = list.get_and_step(); if( entity_ptr->marked() ) { currentList.append( entity_ptr ); entity_ptr->marked(0); } } }
DagType CAActuateSet::get_type_id | ( | int | dimension | ) | [static, private] |
Definition at line 203 of file CAActuateSet.cpp.
{ switch( dimension ) { case 4: return DagType::body_type(); case 3: return DagType::ref_volume_type(); case 2: return DagType::ref_face_type(); case 1: return DagType::ref_edge_type(); case 0: return DagType::ref_vertex_type(); default: assert(0); return DagType::invalid_type(); } }
void CAActuateSet::notify_observer | ( | const CubitEvent * | observer_event | ) | [virtual] |
Implements CubitObserver.
Definition at line 166 of file CAActuateSet.cpp.
{ RefEntity* entity_ptr; int dimension; const GeometryEvent* geom_event = dynamic_cast<const GeometryEvent*>(observer_event); // only care about entities that are destroyed if(!geom_event || geom_event->get_type() != GeometryEvent::TOPOLOGY_ENTITY_DESTRUCTED) return; // is it a body? if( (entity_ptr = dynamic_cast<Body*>(geom_event->get_entity()) ) != NULL ) dimension = 4; // is it some other topology entity else if( (entity_ptr = dynamic_cast<BasicTopologyEntity*>(geom_event->get_entity()) ) != NULL ) dimension = entity_ptr->dimension(); // otherwise we don't care about it else return; // if it exists in the type list, remove it if( typeList[dimension].move_to( entity_ptr ) ) typeList[dimension].extract(); // if it exists in the current list, remove it. if( dimension == currentDimension && currentList.move_to( entity_ptr ) ) currentList.extract(); }
RefEntity * CAActuateSet::remove_next | ( | ) | [inline] |
Definition at line 84 of file CAActuateSet.hpp.
{ return currentList.size() ? currentList.pop() : 0; }
void CAActuateSet::set_current_dimension | ( | int | dimension | ) |
Definition at line 86 of file CAActuateSet.cpp.
{ int i; DLIList<TopologyEntity*> query_source, query_target; DLIList<RefEntity*> temp_list; // Clean out current list before adding new entities currentList.clean_out(); // Get the target type to query for. DagType type = get_type_id( dimension ); // Get children of higher-order entities for( i = 4; i > dimension; i-- ) { query_source.clean_out(); query_target.clean_out(); CAST_LIST( typeList[i], query_source, TopologyEntity ); ModelQueryEngine::instance() ->query_model( query_source, type, query_target ); temp_list.clean_out(); CAST_LIST( query_target, temp_list, RefEntity ); append_to_current( temp_list ); } // Add lcoal entities of current dimension append_to_current( typeList[dimension] ); // Save current dimension currentDimension = dimension; }
int CAActuateSet::currentDimension [private] |
Definition at line 71 of file CAActuateSet.hpp.
DLIList<RefEntity*> CAActuateSet::currentList [private] |
Definition at line 65 of file CAActuateSet.hpp.
DLIList<RefEntity*> CAActuateSet::typeList[5] [private] |
Definition at line 61 of file CAActuateSet.hpp.