cgma
BasicTopologyEntity.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : BasicTopologyEntity.hpp
00003 //
00004 // Purpose       : This is the interface to the BasicTopologyEntity base class.
00005 //                 The main characteristic of specific BasicTopoEntities is
00006 //                 that they form the basis of a topological description
00007 //                 of a solid model.  Having ordered lists of these would
00008 //                 be a complete and unambiguous description of a solid
00009 //                 model.
00010 //
00011 //                 The other characteristic of BasicTopoEntities is that 
00012 //                 they contain ("own") various mesh-related entities. 
00013 //
00014 // Special Notes : Although each BasicTopologyEntity is associated with a set of 
00015 //                 GroupingEntity's, there is no member data in a BasicTopologyEntity
00016 //                 that stores this list.  Instead, this connection is
00017 //                 established within the Directed Acyclic Graph (DAG)
00018 //                 datastructure that captures the relationships between
00019 //                 the various TopologyEntity's in the Model.
00020 //
00021 //                 Each BasicTopologyEntity (with the exception of RefVertex) is
00022 //                 associated with a set of GroupingEntity's (GrE's).  These 
00023 //                 GrE's are ordered in a list.  Hence, the BasicTopologyEntity 
00024 //                 interface not only provides the ability to get the entire 
00025 //                 list of GrE's, but also allows you to ask for the "first"
00026 //                 associated GrE. By extension, the GrE interface, provides 
00027 //                 a function to ask for the "next" GrE.  The linked 
00028 //                 list of GrE's ends when the "next" function returns a 
00029 //                 NULL pointer. 
00030 //
00031 //                 Each BasicTopologyEntity HasA GeometryEntity pointer.  This 
00032 //                 pointer is stored explicitly as a member datum because 
00033 //                 Geometry Entity's are *not* represented by nodes in the 
00034 //                 Model DAG.
00035 //
00036 //                 This is a pure virtual class, to prevent instantiation.
00037 //
00038 // Creator       : Malcolm J. Panthaki
00039 //
00040 // Creation Date : 10/14/96
00041 //
00042 // Owner         : Malcolm J. Panthaki
00043 //-------------------------------------------------------------------------
00044 
00045 #ifndef BASIC_TOPOLOGY_ENTITY_HPP
00046 #define BASIC_TOPOLOGY_ENTITY_HPP
00047 
00048 // ********** BEGIN STANDARD INCLUDES      **********
00049 // ********** END STANDARD INCLUDES        **********
00050 
00051 // ********** BEGIN CUBIT INCLUDES         **********
00052 
00053 #include "CubitDefines.h"
00054 #include "GeometryDefines.h"
00055 #include "TopologyEntity.hpp"
00056 #include "RefEntity.hpp"
00057 #include "CubitBox.hpp"
00058 
00059 // ********** END CUBIT INCLUDES           **********
00060 
00061 // ********** BEGIN FORWARD DECLARATIONS   **********
00062 
00063 template <class X> class DLIList;
00064 class GroupingEntity;
00065 class SenseEntity;
00066 class GeometryEntity;
00067 
00068 // ********** END FORWARD DECLARATIONS     **********
00069 
00070 // ********** BEGIN MACRO DEFINITIONS     **********
00071 // ********** END MACRO DEFINITIONS       **********
00072 
00073 // ********** BEGIN ENUM DEFINITIONS     **********
00074 // ********** END ENUM DEFINITIONS       **********
00075 
00076 class CUBIT_GEOM_EXPORT BasicTopologyEntity : public TopologyEntity,
00077                             public RefEntity
00078 {
00079 public:
00080   static const char* get_class_name()
00081     { return "BasicTopologyEntity"; }
00082 
00083   virtual const char* class_name() const
00084     { return get_class_name(); }
00085   
00086   virtual DagType dag_type() const = 0;
00087   
00088    
00089   inline BasicTopologyEntity() ;  
00090     //- Default constructor.
00091    
00092   virtual ~BasicTopologyEntity();  
00093 
00094  CubitStatus get_grouping_entity_list(
00095       DLIList<GroupingEntity*>& groupingEntityList) const;
00096     //R  CubitStatus
00097     //R- CUBIT_SUCCESS/FAILURE.
00098     //O  groupingEntityList
00099     //O- The list of GroupingEntity pointers associated with this
00100     //O- BasicTopologyEntity.
00101     //-  This function returns a list of pointers to GroupingEntity's
00102     //-  associated with this BasicTopologyEntity.
00103     
00104   inline GroupingEntity* get_first_grouping_entity_ptr() const;
00105     //R GroupingEntity* 
00106     //R- The child GroupingEntity pointer or NULL if none.
00107         
00108     CubitStatus get_sense_entity_list( DLIList<SenseEntity*>& senseEntityList ) const;
00109       //R- CubitStatus
00110         //O senseEntityList
00111         //O- The parent SenseEntity pointers for this BTE.
00112   
00113   inline SenseEntity* get_first_sense_entity_ptr() const;
00114   
00115   CubitStatus add_grouping_entity(GroupingEntity*) ;
00116     //R  CubitStatus
00117     //R- CUBIT_SUCCESS/FAILURE.
00118     //I  GroupingEntity*
00119     //I- A pointer to a GroupingEntity which will be added to
00120     //I- the list of grouping entities associated with this BasicTopologyEntity.
00121     //-  This function is used to add a GroupingEntity to the
00122     //-  list of grouping entities associated with this BasicTopologyEntity.
00123 
00124   CubitStatus remove_grouping_entity(GroupingEntity*);
00125     //R  CubitStatus
00126     //R- CUBIT_SUCCESS/FAILURE.
00127     //I  GroupingEntity*
00128     //I- A pointer to a GroupingEntity which will be removed from
00129     //I- the list of grouping entities associated with this BasicTopologyEntity.
00130     //-  This function is used to remove a GroupingEntity from the
00131     //-  list of grouping entities associated with this BasicTopologyEntity.
00132   
00133   CubitStatus set_grouping_entity_list( DLIList<GroupingEntity*>& new_list,
00134                                         DLIList<GroupingEntity*>& removed_list );
00135     //R CubitStatus
00136     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00137     //I new_list
00138     //I- The list of child grouping entities for this BTE
00139     //O removed_list
00140     //O- Any grouping entities disconnected from this BTE
00141     //- Make the child list of grouping entities for this BTE be
00142     //- the passed list, in the same order as the passed list.
00143     //- Pass back any grouping entities that were children of this
00144     //- BTE but were not in new_list.
00145   
00146   CubitStatus add_sense_entity(SenseEntity*);
00147     //R  CubitStatus
00148     //R- CUBIT_SUCCESS/FAILURE.
00149     //I  SenseEntity*
00150     //I- A pointer to a SenseEntity which will be added to
00151     //I- the list of sense entities associated with this BasicTopologyEntity.
00152     //-  This function is used to add a SenseEntity to the
00153     //-  list of sense entities associated with this BasicTopologyEntity.
00154 
00155   CubitStatus remove_sense_entity(SenseEntity*);
00156     //R  CubitStatus
00157     //R- CUBIT_SUCCESS/FAILURE.
00158     //I  SenseEntity*
00159     //I- A pointer to a SenseEntity which will be removed from
00160     //I- the list of sense entities associated with this BasicTopologyEntity.
00161     //-  This function is used to remove a SenseEntity from the
00162     //-  list of sense entities associated with this BasicTopologyEntity.
00163   
00164   SenseEntity* find_sense_entity(GroupingEntity* gpe) const;
00165     //R SenseEntity*
00166     //R-  A parent SenseEntity of this BasicTopologEntity, or NULL.
00167     //I GroupingEntity*
00168     //I- A immediate parent grouping entity of this basic topology entity.
00169     //- Find the sense entity connecting this BTE to the passed 
00170     //- grouping entity.  Returns NULL if more than one sense entity.
00171   
00172   SenseEntity* find_sense_entity(BasicTopologyEntity* bte) const;
00173     //R SenseEntity*
00174     //R-  A parent SenseEntity of this BasicTopologEntity, or NULL.
00175     //I BasicTopologyEntity*
00176     //I- A immediate parent basic topology entity of this basic 
00177     //I- topology entity.
00178     //- Find the sense entity connecting this BTE to the passed 
00179     //- BTE.  Returns NULL if more than one sense entity.
00180     
00181   CubitStatus get_sense_entities( DLIList<SenseEntity*>& result,
00182                                   GroupingEntity* in_this);
00183   CubitStatus get_sense_entities( DLIList<SenseEntity*>& result,
00184                                   BasicTopologyEntity* in_this);
00185     //R CubitStatus
00186     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00187     //I in_this
00188     //I- Subset of parent sense entities joining this to 'in_this'
00189     //I- Must be an immediate parent.
00190     //O result
00191     //O- List of parent sense entities.
00192     //- Get parent sense entities, optionally limiting the result
00193     //- to the subset connecting this to a passed entity.
00194   
00195   CubitBoolean is_nonmanifold( GroupingEntity* in_this_parent );
00196     //R CubitBoolean
00197     //R- CUBIT_TRUE/CUBIT_FALSE
00198     //I in_this_parent
00199     //I- Immediate parent grouping entity to test with respect to.
00200     //- Result is false if there is exactly one sense entity
00201     //- connecting this entity to the parent grouping entity.  
00202     //- Result is true if there are more than one sense entities
00203     //- connecting this entity to the parent grouping entity.
00204     //- Result is undefined if there are no sense entities connecting
00205     //- this entity to the passed parent.
00206    
00207   GeometryEntity* get_geometry_entity_ptr() const;
00208     //R GeometryEntity*
00209     //R- A pointer to the GeometryEntity to which the current 
00210     //R- BasicTopologyEntity points. 
00211     //-  This function returns a pointer to the GeometryEntity
00212     //-  which the current BasicTopologyEntity points to.
00213    
00214   GeometryType geometry_type() const;
00215     //R GeometryType
00216     //R- An enumerated type describing the underlying geometry
00217     //R- representation
00218     //-  This function returns the type of geometry representation
00219     //- underlying this entity
00220 
00221   virtual CubitBox bounding_box();
00222     //- Returns the bounding box of this entity
00223    
00224   virtual CubitBox unmerged_bounding_box();
00225     //- Returns the bounding box of all of the bridges in this entity if
00226     //- it is a merged entity
00227 
00228   CubitStatus set_geometry_entity_ptr(GeometryEntity* geometryEntityPtr) ;
00229     //R CubitStatus
00230     //R- CUBIT_SUCCESS/FAILURE
00231     //I  geometryEntityPtr
00232     //I- A pointer to the GeometryEntity that will be associated with
00233     //I- this RefEntity.
00234     //- This function sets the GeometryEntity associated with this 
00235     //- RefEntity.
00236     //- CUBIT_FAILURE is returned if a problem was detected.
00237    
00238   double measure();
00239     //R double
00240     //R- The numeric value of the measure (its units depend on the dimension
00241     //R- of the RefEntity being "measured")
00242     //- A generic geometric extent function.
00243     //- Returns volume for RefVolumes, area for RefFaces, length for RefEdge,
00244     //- and 1.0 for RefVertices
00245    
00246    virtual int get_parents( DLIList<TopologyEntity*>* list = 0 ) const;
00247    virtual int get_children(DLIList<TopologyEntity*>* list = 0 ) const;
00248    
00249 protected: 
00250    virtual CubitBoolean query_append_parents( DLIList<TopologyEntity*>& list );
00251    virtual CubitBoolean query_append_children(DLIList<TopologyEntity*>& list );
00252    
00253    virtual CubitStatus remove_child_link(TopologyEntity* entity_ptr);
00254    
00255    CubitStatus disconnect_all_children( DLIList<TopologyEntity*>* children = 0 );
00256    CubitStatus disconnect_all_parents( DLIList<TopologyEntity*>* parents = 0 );
00257    
00258 private:
00259 
00260   SenseEntity* firstSenseEntity;
00261   SenseEntity* lastSenseEntity;
00262   GroupingEntity* firstGroupingEntity;
00263   GroupingEntity* lastGroupingEntity;
00264   
00265   BasicTopologyEntity( const BasicTopologyEntity& );
00266   void operator=( const BasicTopologyEntity& );
00267 } ;
00268 
00269 
00270 // ********** BEGIN INLINE FUNCTIONS       **********
00271 BasicTopologyEntity::BasicTopologyEntity()
00272   : firstSenseEntity(0),
00273     lastSenseEntity(0),
00274     firstGroupingEntity(0),
00275     lastGroupingEntity(0)
00276   {}
00277 
00278 SenseEntity* BasicTopologyEntity::get_first_sense_entity_ptr() const
00279   { return firstSenseEntity; }
00280   
00281 GroupingEntity* BasicTopologyEntity::get_first_grouping_entity_ptr() const
00282   { return firstGroupingEntity; }
00283 
00284 // ********** END INLINE FUNCTIONS         **********
00285 
00286 // ********** BEGIN FRIEND FUNCTIONS       **********
00287 // ********** END FRIEND FUNCTIONS         **********
00288 
00289 // ********** BEGIN EXTERN FUNCTIONS       **********
00290 // ********** END EXTERN FUNCTIONS         **********
00291 
00292 #endif
00293 
00294 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines