cgma
SenseEntity.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : SenseEntity.hpp
00003 //
00004 // Purpose       : This class is the base class of all sense entities such,
00005 //                 as CoVolume, CoFace, CoEdge, and CoVertex.
00006 //
00007 // Special Notes : This is a pure virtual class.
00008 //
00009 // Creator       : Xuechen Liu 
00010 //
00011 // Creation Date : 07/11/96
00012 //
00013 // Owner         : Malcolm J. Panthaki
00014 //-------------------------------------------------------------------------
00015 
00016 #ifndef SENSE_ENTITY_HPP
00017 #define SENSE_ENTITY_HPP
00018 
00019 // ********** BEGIN STANDARD INCLUDES      **********
00020 // ********** END STANDARD INCLUDES        **********
00021 
00022 // ********** BEGIN CUBIT INCLUDES         **********
00023 #include "CubitDefines.h"
00024 #include "TopologyEntity.hpp"
00025 #include "CubitObservable.hpp"
00026 
00027 // ********** END CUBIT INCLUDES           **********
00028 
00029 // ********** BEGIN MACROS DEFINITIONS     **********
00030 // ********** END MACROS DEFINITIONS       **********
00031 
00032 // ********** BEGIN FORWARD DECLARATIONS   **********
00033 class BasicTopologyEntity ;
00034 class GroupingEntity;
00035 template <class X> class DLIList ;
00036 // ********** END FORWARD DECLARATIONS     **********
00037 
00038 class CUBIT_GEOM_EXPORT  SenseEntity : public TopologyEntity,
00039                     public CubitObservable
00040 {
00041   public :
00042   
00043   inline SenseEntity();
00044    
00045   virtual ~SenseEntity();
00046 
00047   inline BasicTopologyEntity* get_basic_topology_entity_ptr() ;
00048      //R BasicTopologyEntity*
00049      //R- A pointer to the BasicTopologyEntity which the current sense
00050      //R- entity is associated with.
00051      //- This function returns a pointer to the BasicTopologyEntity which
00052      //- the current sense entity is associated with.
00053          
00054     inline GroupingEntity* get_grouping_entity_ptr();
00055       //R GroupingEntity*
00056         //R- A pointer to the parent GroupingEntity.
00057 
00058   BasicTopologyEntity* get_parent_basic_topology_entity_ptr();
00059    
00060   CubitStatus attach_basic_topology_entity(BasicTopologyEntity* basicTopologyEntityPtr) ;
00061      //R CubitStatus
00062      //R- CUBIT_SUCCESS/FAILURE
00063      //I basicTopologyEntityPtr
00064      //I- The pointer to a BasicTopologyEntity which will be attached as
00065      //I- a BasicTopologyEntity of this SenseEntity.
00066      //- This function is used to attach a BasicTopologyEntity to this 
00067      //- SenseEntity. The operation can fail if the BTE is not the
00068      //- appropriate type. In that case the function returns
00069      //- CUBIT_FAILURE. If the attachment is done successfully, the function
00070      //- returns CUBIT_SUCCESS.
00071      
00072    CubitStatus switch_basic_topology_entity(BasicTopologyEntity* new_bte );
00073     //- Change the BasicTopologyEntity attached to this SenseEntity
00074     //- to the passed BTE.  This is used by unmerge.
00075    
00076    inline void set_sense(CubitSense sense) ;
00077      //R void 
00078      //I sense
00079      //I- The sense to be set.
00080      //- This function sets the sense of the SenseEntity.
00081      
00082    void reverse_sense();
00083      //- Reverse the sense of this SenseEntity.
00084    
00085    inline CubitSense get_sense() const ;
00086      //R CubitSense
00087      //R- The sense of the sense entity - CUBIT_FORWARD/REVERSED.
00088      //- This function returns the sense of the SenseEntity.
00089    
00090    inline SenseEntity* next();
00091      //R SenseEntity*
00092      //R- A SenseEntity pointer
00093      //- This function returns a pointer to the SenseEntity that is
00094      //- a child of this one in the DAG. If it is the end of the line,
00095      //- then a NULL pointer is returned.
00096    
00097    inline SenseEntity* previous();
00098      //R SenseEntity*
00099      //R- A SenseEntity pointer
00100      //- This function returns a pointer to the SenseEntity that is
00101      //- a "parent" of this one in the DAG. If this SenseEntity is
00102      //- already at the beginning of the list, then a NULL pointer is 
00103      //- returned.
00104    
00105    inline SenseEntity* next_on_bte();
00106     //R SenseEntity*
00107     //R- The next sense entity in the linked of list of 
00108     //R- sense entities associated with the child bte.
00109    
00110    virtual int get_parents( DLIList<TopologyEntity*>* list = 0 ) const;
00111    virtual int get_children( DLIList<TopologyEntity*>* list = 0 ) const;
00112    
00113    
00114   protected :
00115    
00116    virtual CubitBoolean query_append_parents( DLIList<TopologyEntity*>& list );
00117    virtual CubitBoolean query_append_children(DLIList<TopologyEntity*>& list );
00118    
00119    virtual CubitStatus remove_child_link( TopologyEntity* );
00120    
00121    CubitStatus disconnect_all_children( DLIList<TopologyEntity*>* children = 0 );
00122    CubitStatus disconnect_all_parents( DLIList<TopologyEntity*>* parents = 0 );
00123    
00124    private :  
00125    
00126     // functions for use by GroupingEntity only
00127    friend class GroupingEntity;
00128    inline CubitStatus gpe_insert_after (SenseEntity* prev_ptr);
00129    inline CubitStatus gpe_insert_before(SenseEntity* next_ptr);
00130    inline CubitStatus gpe_remove();
00131    inline CubitStatus set_grouping_entity_ptr(GroupingEntity* gpe_ptr);
00132    inline void swap_gpe_list_ptrs();
00133    
00134     // functions for use by BasicTopologyEntity only
00135    friend class BasicTopologyEntity;
00136    inline SenseEntity* set_bte_next(SenseEntity* next_ptr);
00137    inline CubitStatus set_basic_topology_entity_ptr(BasicTopologyEntity* bte_ptr);
00138    
00139    CubitSense mySense;
00140    
00141    GroupingEntity* myParent;
00142    SenseEntity* nextInParent;
00143    SenseEntity* prevInParent;
00144    
00145    BasicTopologyEntity* myChild;
00146    SenseEntity* nextInChild;
00147    
00148    SenseEntity( const SenseEntity& );
00149    void operator=( const SenseEntity& );
00150 };
00151 
00152 
00153 SenseEntity::SenseEntity()
00154   : mySense(CUBIT_FORWARD),
00155     myParent(0), 
00156     nextInParent(0),
00157     prevInParent(0),
00158     myChild(0),
00159     nextInChild(0)
00160   {}
00161 
00162 BasicTopologyEntity* SenseEntity::get_basic_topology_entity_ptr() 
00163   { return myChild; }
00164 
00165 GroupingEntity* SenseEntity::get_grouping_entity_ptr()
00166   { return myParent; }
00167 
00168 void SenseEntity::set_sense(CubitSense sense)
00169   { mySense = sense; }
00170   
00171 CubitSense SenseEntity::get_sense() const 
00172   { return mySense; }
00173 
00174 SenseEntity* SenseEntity::next()
00175   { return nextInParent; }
00176 
00177 SenseEntity* SenseEntity::previous()
00178   { return prevInParent; }
00179 
00180 SenseEntity* SenseEntity::next_on_bte()
00181   { return nextInChild; }
00182    
00183 CubitStatus SenseEntity::gpe_insert_after(SenseEntity* prev_ptr)
00184 {
00185   nextInParent = prev_ptr->nextInParent;
00186   if (nextInParent)
00187     nextInParent->prevInParent = this;
00188   prevInParent = prev_ptr;
00189   prev_ptr->nextInParent = this;
00190   return CUBIT_SUCCESS;
00191 }  
00192    
00193 CubitStatus SenseEntity::gpe_insert_before(SenseEntity* next_ptr)
00194 {
00195   prevInParent = next_ptr->prevInParent;
00196   if (prevInParent)
00197     prevInParent->nextInParent = this;
00198   nextInParent = next_ptr;
00199   next_ptr->prevInParent = this;
00200   return CUBIT_SUCCESS;
00201 }  
00202 
00203 CubitStatus SenseEntity::gpe_remove()
00204 {
00205   if (nextInParent)
00206     nextInParent->prevInParent = prevInParent;
00207   if (prevInParent)
00208     prevInParent->nextInParent = nextInParent;
00209   prevInParent = nextInParent = 0;
00210   return CUBIT_SUCCESS;
00211 }
00212 
00213 void SenseEntity::swap_gpe_list_ptrs()
00214 {
00215   SenseEntity* tmp = nextInParent;
00216   nextInParent = prevInParent;
00217   prevInParent = tmp;
00218 }
00219 
00220 CubitStatus SenseEntity::set_grouping_entity_ptr(GroupingEntity* gpe_ptr)
00221 {
00222   myParent = gpe_ptr;
00223   return CUBIT_SUCCESS;
00224 }
00225 
00226 SenseEntity* SenseEntity::set_bte_next(SenseEntity* next_ptr)
00227 {
00228   SenseEntity* old_val = nextInChild;
00229   nextInChild = next_ptr;
00230   return old_val;
00231 }
00232 
00233 CubitStatus SenseEntity::set_basic_topology_entity_ptr(
00234                                   BasicTopologyEntity* bte_ptr)
00235 {
00236   if (myChild && bte_ptr) 
00237     { assert(0); return CUBIT_FAILURE; }
00238     
00239   myChild = bte_ptr;
00240   return CUBIT_SUCCESS;
00241 }
00242 
00243 
00244 // ********** BEGIN HELPER CLASSES         **********
00245 // ********** END   HELPER CLASSES         **********
00246 
00247 // ********** BEGIN INLINE FUNCTIONS       **********
00248 // ********** END INLINE FUNCTIONS         **********
00249 
00250 // ********** BEGIN FRIEND FUNCTIONS       **********
00251 // ********** END FRIEND FUNCTIONS         **********
00252 
00253 // ********** BEGIN EXTERN FUNCTIONS       **********
00254 // ********** END EXTERN FUNCTIONS         **********
00255 
00256 
00257 #endif
00258 
00259 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines