cgma
SubEntitySet.hpp
Go to the documentation of this file.
00001 #ifndef SUB_ENTITY_SET_HPP
00002 #define SUB_ENTITY_SET_HPP
00003 
00004 #include "TBOwnerSet.hpp"
00005 
00006 class PartitionEntity;
00007 class TopologyBridge;
00008 class CubitSimpleAttrib;
00009 class CubitVector;
00010 class PartitionBody;
00011 
00012 class SubEntitySet : public TBOwnerSet
00013 {
00014 
00015   public:
00016   
00017     SubEntitySet( TopologyBridge* real_entity,
00018                   PartitionEntity* first_partition );
00019     virtual ~SubEntitySet();
00020     
00021     TopologyBridge* get_entity() const
00022       { return myEntity; }
00023     
00024     void add_partition( PartitionEntity* partition,
00025                         PartitionEntity* insert_after = 0 );
00026                       
00027     void add_lower_order( PartitionEntity* partition );
00028     void add_lower_order( PartitionEntity* entity, 
00029                           const CubitSimpleAttrib& attrib,
00030                           int dimension,
00031                           DLIList<CubitVector*>& points_from_attrib,
00032                           DLIList<int>& facets_from_attrib,
00033                           DLIList<int>& children_from_attrib,
00034                           DLIList<int>& facet_point_owners_from_attrib );
00035     
00036     void remove( PartitionEntity* partition );
00037     
00038       
00039     bool has_lower_order() const
00040       { return lowerOrderHead != 0; }
00041     
00042     bool has_multiple_sub_entities() const;
00043     
00044     PartitionBody* body() const
00045       { return bodyPtr; }
00046     
00047     void get_owners( DLIList<TopologyBridge*>& owner_list ) const;
00048     
00049     CubitStatus remove_bridge( TopologyBridge* bridge );
00050     CubitStatus swap_bridge( TopologyBridge* remove, 
00051                              TopologyBridge* add,
00052                              bool reversed );
00053     void notify_reversed( TopologyBridge* bridge );
00054     CubitStatus bridge_destroyed( TopologyBridge* bridge );
00055   
00056     void print_debug_info( const char* prefix = 0 ) const;
00057   
00058     void add_attribute( PartitionEntity* entity, const CubitSimpleAttrib& csa );
00059     void rem_attribute( PartitionEntity* entity, const CubitSimpleAttrib& csa );
00060     void get_attributes( PartitionEntity* entity, 
00061                          DLIList<CubitSimpleAttrib>& list );
00062     void get_attributes( PartitionEntity* entity, const char* name,
00063                          DLIList<CubitSimpleAttrib>& list );
00064     void rem_all_attrib( PartitionEntity* entity );
00065     void unwrap_attributes();
00066   
00067     void get_sub_entities( DLIList<PartitionEntity*>& result_set ) const;
00068     void get_lower_order( DLIList<PartitionEntity*>& result_set ) const;
00069 
00070     int get_id( PartitionEntity* entity ) const;
00071     PartitionEntity* entity_from_id( int id ) const;
00072     
00073       // The following two methods are used by PartitionEngine
00074       // when restoring geometry.  Calling them at the wrong
00075       // time will result in the loss of attribute data.
00076     void set_id( PartitionEntity* entity, int id );
00077     void renumerate( int lowest_value, bool only_higher_ids  );
00078       // renumerate sets new SubEntitySet ids on owned entities.
00079       // The lowest id of any updated entity will be the passed value.
00080       // If only_higher_ids is true, only entities with IDs equal to
00081       // or higher than the passed value are updated.
00082       
00083     int get_owner_layer() const { return layerNumber; }
00084     
00085     
00086     CubitStatus save_geometry();
00087     
00088     int get_unique_id();
00089     void reset_unique_id() { uniqueId = 0; }
00090     
00091     CubitStatus save_geometry( int id, int dimension,
00092                                DLIList<CubitVector*>* point_list,
00093                                DLIList<int>* point_connectivity,
00094                                DLIList<int>* topo_connectivity,
00095                                DLIList<int>* point_owners,
00096                                CubitSimpleAttrib& attrib );
00097 
00098     static CubitStatus read_geometry( int& id, int& dimension,
00099                                DLIList<CubitVector*>& point_list,
00100                                DLIList<int>& point_connectivity,
00101                                DLIList<int>& topo_connectivity,
00102                                DLIList<int>& point_owners,
00103                                const CubitSimpleAttrib& attrib );
00104     
00105     static int get_geom_dimension( const CubitSimpleAttrib& attrib );
00106       // return the dimension of the geometry stored in the attrib
00107     
00108     static int get_geom_id( const CubitSimpleAttrib& attrib );
00109     
00110     static int get_segment_count( const CubitSimpleAttrib& attrib );
00111     
00112     static void remove_non_geom_attribs( DLIList<CubitSimpleAttrib>& list );
00113       // given a list of all the geometry attributes on an entity,
00114       // remove and destroy any that are not partition geometry.
00115     
00116     static void strip_attributes( TopologyBridge* bridge );
00117       // remove any attributes related to partition geometry
00118       // from the passed bridge.
00119 
00120     void strip_attributes(); 
00121       // remove all attributes on paritioned entities,
00122       // sub entities and lower-order entities
00123       
00124     inline SubEntitySet* next_in_body() const
00125       { return bodyNext; }
00126     
00127   private:
00128     
00129     friend class PartitionBody;
00130     SubEntitySet* bodyNext;
00131     PartitionBody* bodyPtr;
00132       
00133        // don't allow assignment (make assignment private)
00134     SubEntitySet& operator=( const SubEntitySet& ) { return *this;}
00135     bool operator==( const SubEntitySet& c ) const { return &c == this; }
00136   
00137     CubitStatus wrap_attribute( CubitSimpleAttrib& csa, int id ) const;
00138     int unwrap_attribute( CubitSimpleAttrib& csa ) const;
00139     bool is_attribute( const CubitSimpleAttrib& csa, int id = 0 ) const;
00140       
00141     TopologyBridge* myEntity;
00142     
00143     PartitionEntity* subEntityHead;
00144     PartitionEntity* lowerOrderHead;
00145     
00146     int lastId;
00147     
00148     int layerNumber;
00149     
00150     int uniqueId;
00151 };
00152 
00153 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines