| 1 | //------------------------------------------------------------------------- |
|---|
| 2 | // Filename : BasicTopologyEntity.hpp |
|---|
| 3 | // |
|---|
| 4 | // Purpose : This is the interface to the BasicTopologyEntity base class. |
|---|
| 5 | // The main characteristic of specific BasicTopoEntities is |
|---|
| 6 | // that they form the basis of a topological description |
|---|
| 7 | // of a solid model. Having ordered lists of these would |
|---|
| 8 | // be a complete and unambiguous description of a solid |
|---|
| 9 | // model. |
|---|
| 10 | // |
|---|
| 11 | // The other characteristic of BasicTopoEntities is that |
|---|
| 12 | // they contain ("own") various mesh-related entities. |
|---|
| 13 | // |
|---|
| 14 | // Special Notes : Although each BasicTopologyEntity is associated with a set of |
|---|
| 15 | // GroupingEntity's, there is no member data in a BasicTopologyEntity |
|---|
| 16 | // that stores this list. Instead, this connection is |
|---|
| 17 | // established within the Directed Acyclic Graph (DAG) |
|---|
| 18 | // datastructure that captures the relationships between |
|---|
| 19 | // the various TopologyEntity's in the Model. Each |
|---|
| 20 | // TopologyEntity has a member datum which is a pointer |
|---|
| 21 | // to a ModelEntity. This |
|---|
| 22 | // pointer is a link from the TopologyEntity to the node |
|---|
| 23 | // in the Model DAG that represents its "position" and |
|---|
| 24 | // "links" within the Model. |
|---|
| 25 | // |
|---|
| 26 | // Each BasicTopologyEntity (with the exception of RefVertex) is |
|---|
| 27 | // associated with a set of GroupingEntity's (GrE's). These |
|---|
| 28 | // GrE's are ordered in a list. Hence, the BasicTopologyEntity |
|---|
| 29 | // interface not only provides the ability to get the entire |
|---|
| 30 | // list of GrE's, but also allows you to ask for the "first" |
|---|
| 31 | // associated GrE. By extension, the GrE interface, provides |
|---|
| 32 | // a function to ask for the "next" GrE. The linked |
|---|
| 33 | // list of GrE's ends when the "next" function returns a |
|---|
| 34 | // NULL pointer. |
|---|
| 35 | // |
|---|
| 36 | // Each BasicTopologyEntity HasA GeometryEntity pointer. This |
|---|
| 37 | // pointer is stored explicitly as a member datum because |
|---|
| 38 | // Geometry Entity's are *not* represented by nodes in the |
|---|
| 39 | // Model DAG. |
|---|
| 40 | // |
|---|
| 41 | // This is a pure virtual class, to prevent instantiation. |
|---|
| 42 | // |
|---|
| 43 | // Creator : Malcolm J. Panthaki |
|---|
| 44 | // |
|---|
| 45 | // Creation Date : 10/14/96 |
|---|
| 46 | // |
|---|
| 47 | // Owner : Malcolm J. Panthaki |
|---|
| 48 | //------------------------------------------------------------------------- |
|---|
| 49 | |
|---|
| 50 | #ifndef BASIC_TOPOLOGY_ENTITY_HPP |
|---|
| 51 | #define BASIC_TOPOLOGY_ENTITY_HPP |
|---|
| 52 | |
|---|
| 53 | // ********** BEGIN STANDARD INCLUDES ********** |
|---|
| 54 | // ********** END STANDARD INCLUDES ********** |
|---|
| 55 | |
|---|
| 56 | // ********** BEGIN CUBIT INCLUDES ********** |
|---|
| 57 | |
|---|
| 58 | #include "CubitDefines.h" |
|---|
| 59 | #include "GeometryDefines.h" |
|---|
| 60 | #include "TopologyEntity.hpp" |
|---|
| 61 | #include "RefEntity.hpp" |
|---|
| 62 | #include "CubitBox.hpp" |
|---|
| 63 | |
|---|
| 64 | // ********** END CUBIT INCLUDES ********** |
|---|
| 65 | |
|---|
| 66 | // ********** BEGIN FORWARD DECLARATIONS ********** |
|---|
| 67 | |
|---|
| 68 | template <class X> class DLIList; |
|---|
| 69 | class GroupingEntity; |
|---|
| 70 | class SenseEntity; |
|---|
| 71 | class GeometryEntity; |
|---|
| 72 | |
|---|
| 73 | // ********** END FORWARD DECLARATIONS ********** |
|---|
| 74 | |
|---|
| 75 | // ********** BEGIN MACRO DEFINITIONS ********** |
|---|
| 76 | // ********** END MACRO DEFINITIONS ********** |
|---|
| 77 | |
|---|
| 78 | // ********** BEGIN ENUM DEFINITIONS ********** |
|---|
| 79 | // ********** END ENUM DEFINITIONS ********** |
|---|
| 80 | |
|---|
| 81 | class CUBIT_GEOM_EXPORT BasicTopologyEntity : public TopologyEntity, |
|---|
| 82 | public RefEntity |
|---|
| 83 | { |
|---|
| 84 | public: |
|---|
| 85 | static const char* get_class_name() |
|---|
| 86 | { return "BasicTopologyEntity"; } |
|---|
| 87 | |
|---|
| 88 | virtual const char* class_name() const |
|---|
| 89 | { return get_class_name(); } |
|---|
| 90 | |
|---|
| 91 | virtual DagType dag_type() const = 0; |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | inline BasicTopologyEntity() ; |
|---|
| 95 | //- Default constructor. |
|---|
| 96 | |
|---|
| 97 | virtual ~BasicTopologyEntity(); |
|---|
| 98 | |
|---|
| 99 | CubitStatus get_grouping_entity_list( |
|---|
| 100 | DLIList<GroupingEntity*>& groupingEntityList) const; |
|---|
| 101 | //R CubitStatus |
|---|
| 102 | //R- CUBIT_SUCCESS/FAILURE. |
|---|
| 103 | //O groupingEntityList |
|---|
| 104 | //O- The list of GroupingEntity pointers associated with this |
|---|
| 105 | //O- BasicTopologyEntity. |
|---|
| 106 | //- This function returns a list of pointers to GroupingEntity's |
|---|
| 107 | //- associated with this BasicTopologyEntity. |
|---|
| 108 | |
|---|
| 109 | inline GroupingEntity* get_first_grouping_entity_ptr() const; |
|---|
| 110 | //R GroupingEntity* |
|---|
| 111 | //R- The child GroupingEntity pointer or NULL if none. |
|---|
| 112 | |
|---|
| 113 | CubitStatus get_sense_entity_list( DLIList<SenseEntity*>& senseEntityList ) const; |
|---|
| 114 | //R- CubitStatus |
|---|
| 115 | //O senseEntityList |
|---|
| 116 | //O- The parent SenseEntity pointers for this BTE. |
|---|
| 117 | |
|---|
| 118 | inline SenseEntity* get_first_sense_entity_ptr() const; |
|---|
| 119 | |
|---|
| 120 | CubitStatus add_grouping_entity(GroupingEntity*) ; |
|---|
| 121 | //R CubitStatus |
|---|
| 122 | //R- CUBIT_SUCCESS/FAILURE. |
|---|
| 123 | //I GroupingEntity* |
|---|
| 124 | //I- A pointer to a GroupingEntity which will be added to |
|---|
| 125 | //I- the list of grouping entities associated with this BasicTopologyEntity. |
|---|
| 126 | //- This function is used to add a GroupingEntity to the |
|---|
| 127 | //- list of grouping entities associated with this BasicTopologyEntity. |
|---|
| 128 | |
|---|
| 129 | CubitStatus remove_grouping_entity(GroupingEntity*); |
|---|
| 130 | //R CubitStatus |
|---|
| 131 | //R- CUBIT_SUCCESS/FAILURE. |
|---|
| 132 | //I GroupingEntity* |
|---|
| 133 | //I- A pointer to a GroupingEntity which will be removed from |
|---|
| 134 | //I- the list of grouping entities associated with this BasicTopologyEntity. |
|---|
| 135 | //- This function is used to remove a GroupingEntity from the |
|---|
| 136 | //- list of grouping entities associated with this BasicTopologyEntity. |
|---|
| 137 | |
|---|
| 138 | CubitStatus set_grouping_entity_list( DLIList<GroupingEntity*>& new_list, |
|---|
| 139 | DLIList<GroupingEntity*>& removed_list ); |
|---|
| 140 | //R CubitStatus |
|---|
| 141 | //R- CUBIT_SUCCESS/CUBIT_FAILURE |
|---|
| 142 | //I new_list |
|---|
| 143 | //I- The list of child grouping entities for this BTE |
|---|
| 144 | //O removed_list |
|---|
| 145 | //O- Any grouping entities disconnected from this BTE |
|---|
| 146 | //- Make the child list of grouping entities for this BTE be |
|---|
| 147 | //- the passed list, in the same order as the passed list. |
|---|
| 148 | //- Pass back any grouping entities that were children of this |
|---|
| 149 | //- BTE but were not in new_list. |
|---|
| 150 | |
|---|
| 151 | CubitStatus add_sense_entity(SenseEntity*); |
|---|
| 152 | //R CubitStatus |
|---|
| 153 | //R- CUBIT_SUCCESS/FAILURE. |
|---|
| 154 | //I SenseEntity* |
|---|
| 155 | //I- A pointer to a SenseEntity which will be added to |
|---|
| 156 | //I- the list of sense entities associated with this BasicTopologyEntity. |
|---|
| 157 | //- This function is used to add a SenseEntity to the |
|---|
| 158 | //- list of sense entities associated with this BasicTopologyEntity. |
|---|
| 159 | |
|---|
| 160 | CubitStatus remove_sense_entity(SenseEntity*); |
|---|
| 161 | //R CubitStatus |
|---|
| 162 | //R- CUBIT_SUCCESS/FAILURE. |
|---|
| 163 | //I SenseEntity* |
|---|
| 164 | //I- A pointer to a SenseEntity which will be removed from |
|---|
| 165 | //I- the list of sense entities associated with this BasicTopologyEntity. |
|---|
| 166 | //- This function is used to remove a SenseEntity from the |
|---|
| 167 | //- list of sense entities associated with this BasicTopologyEntity. |
|---|
| 168 | |
|---|
| 169 | SenseEntity* find_sense_entity(GroupingEntity* gpe) const; |
|---|
| 170 | //R SenseEntity* |
|---|
| 171 | //R- A parent SenseEntity of this BasicTopologEntity, or NULL. |
|---|
| 172 | //I GroupingEntity* |
|---|
| 173 | //I- A immediate parent grouping entity of this basic topology entity. |
|---|
| 174 | //- Find the sense entity connecting this BTE to the passed |
|---|
| 175 | //- grouping entity. Returns NULL if more than one sense entity. |
|---|
| 176 | |
|---|
| 177 | SenseEntity* find_sense_entity(BasicTopologyEntity* bte) const; |
|---|
| 178 | //R SenseEntity* |
|---|
| 179 | //R- A parent SenseEntity of this BasicTopologEntity, or NULL. |
|---|
| 180 | //I BasicTopologyEntity* |
|---|
| 181 | //I- A immediate parent basic topology entity of this basic |
|---|
| 182 | //I- topology entity. |
|---|
| 183 | //- Find the sense entity connecting this BTE to the passed |
|---|
| 184 | //- BTE. Returns NULL if more than one sense entity. |
|---|
| 185 | |
|---|
| 186 | CubitStatus get_sense_entities( DLIList<SenseEntity*>& result, |
|---|
| 187 | GroupingEntity* in_this); |
|---|
| 188 | CubitStatus get_sense_entities( DLIList<SenseEntity*>& result, |
|---|
| 189 | BasicTopologyEntity* in_this); |
|---|
| 190 | //R CubitStatus |
|---|
| 191 | //R- CUBIT_SUCCESS/CUBIT_FAILURE |
|---|
| 192 | //I in_this |
|---|
| 193 | //I- Subset of parent sense entities joining this to 'in_this' |
|---|
| 194 | //I- Must be an immediate parent. |
|---|
| 195 | //O result |
|---|
| 196 | //O- List of parent sense entities. |
|---|
| 197 | //- Get parent sense entities, optionally limiting the result |
|---|
| 198 | //- to the subset connecting this to a passed entity. |
|---|
| 199 | |
|---|
| 200 | CubitBoolean is_nonmanifold( GroupingEntity* in_this_parent ); |
|---|
| 201 | //R CubitBoolean |
|---|
| 202 | //R- CUBIT_TRUE/CUBIT_FALSE |
|---|
| 203 | //I in_this_parent |
|---|
| 204 | //I- Immediate parent grouping entity to test with respect to. |
|---|
| 205 | //- Result is false if there is exactly one sense entity |
|---|
| 206 | //- connecting this entity to the parent grouping entity. |
|---|
| 207 | //- Result is true if there are more than one sense entities |
|---|
| 208 | //- connecting this entity to the parent grouping entity. |
|---|
| 209 | //- Result is undefined if there are no sense entities connecting |
|---|
| 210 | //- this entity to the passed parent. |
|---|
| 211 | |
|---|
| 212 | GeometryEntity* get_geometry_entity_ptr() const; |
|---|
| 213 | //R GeometryEntity* |
|---|
| 214 | //R- A pointer to the GeometryEntity to which the current |
|---|
| 215 | //R- BasicTopologyEntity points. |
|---|
| 216 | //- This function returns a pointer to the GeometryEntity |
|---|
| 217 | //- which the current BasicTopologyEntity points to. |
|---|
| 218 | |
|---|
| 219 | GeometryType geometry_type() const; |
|---|
| 220 | //R GeometryType |
|---|
| 221 | //R- An enumerated type describing the underlying geometry |
|---|
| 222 | //R- representation |
|---|
| 223 | //- This function returns the type of geometry representation |
|---|
| 224 | //- underlying this entity |
|---|
| 225 | |
|---|
| 226 | virtual CubitBox bounding_box(); |
|---|
| 227 | //- Returns the bounding box of this entity |
|---|
| 228 | |
|---|
| 229 | CubitStatus set_geometry_entity_ptr(GeometryEntity* geometryEntityPtr) ; |
|---|
| 230 | //R CubitStatus |
|---|
| 231 | //R- CUBIT_SUCCESS/FAILURE |
|---|
| 232 | //I geometryEntityPtr |
|---|
| 233 | //I- A pointer to the GeometryEntity that will be associated with |
|---|
| 234 | //I- this RefEntity. |
|---|
| 235 | //- This function sets the GeometryEntity associated with this |
|---|
| 236 | //- RefEntity. |
|---|
| 237 | //- CUBIT_FAILURE is returned if a problem was detected. |
|---|
| 238 | |
|---|
| 239 | double measure(); |
|---|
| 240 | //R double |
|---|
| 241 | //R- The numeric value of the measure (its units depend on the dimension |
|---|
| 242 | //R- of the RefEntity being "measured") |
|---|
| 243 | //- A generic geometric extent function. |
|---|
| 244 | //- Returns volume for RefVolumes, area for RefFaces, length for RefEdge, |
|---|
| 245 | //- and 1.0 for RefVertices |
|---|
| 246 | |
|---|
| 247 | virtual int get_parents( DLIList<ModelEntity*>* list = 0 ) const; |
|---|
| 248 | virtual int get_children(DLIList<ModelEntity*>* list = 0 ) const; |
|---|
| 249 | |
|---|
| 250 | protected: |
|---|
| 251 | virtual CubitBoolean query_append_parents( DLIList<ModelEntity*>& list ); |
|---|
| 252 | virtual CubitBoolean query_append_children(DLIList<ModelEntity*>& list ); |
|---|
| 253 | |
|---|
| 254 | virtual CubitStatus remove_child_link(ModelEntity* entity_ptr); |
|---|
| 255 | |
|---|
| 256 | CubitStatus disconnect_all_children( DLIList<ModelEntity*>* children = 0 ); |
|---|
| 257 | CubitStatus disconnect_all_parents( DLIList<ModelEntity*>* parents = 0 ); |
|---|
| 258 | |
|---|
| 259 | private: |
|---|
| 260 | |
|---|
| 261 | SenseEntity* firstSenseEntity; |
|---|
| 262 | SenseEntity* lastSenseEntity; |
|---|
| 263 | GroupingEntity* firstGroupingEntity; |
|---|
| 264 | GroupingEntity* lastGroupingEntity; |
|---|
| 265 | |
|---|
| 266 | BasicTopologyEntity( const BasicTopologyEntity& ); |
|---|
| 267 | void operator=( const BasicTopologyEntity& ); |
|---|
| 268 | } ; |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | // ********** BEGIN INLINE FUNCTIONS ********** |
|---|
| 272 | BasicTopologyEntity::BasicTopologyEntity() |
|---|
| 273 | : firstSenseEntity(0), |
|---|
| 274 | lastSenseEntity(0), |
|---|
| 275 | firstGroupingEntity(0), |
|---|
| 276 | lastGroupingEntity(0) |
|---|
| 277 | {} |
|---|
| 278 | |
|---|
| 279 | SenseEntity* BasicTopologyEntity::get_first_sense_entity_ptr() const |
|---|
| 280 | { return firstSenseEntity; } |
|---|
| 281 | |
|---|
| 282 | GroupingEntity* BasicTopologyEntity::get_first_grouping_entity_ptr() const |
|---|
| 283 | { return firstGroupingEntity; } |
|---|
| 284 | |
|---|
| 285 | // ********** END INLINE FUNCTIONS ********** |
|---|
| 286 | |
|---|
| 287 | // ********** BEGIN FRIEND FUNCTIONS ********** |
|---|
| 288 | // ********** END FRIEND FUNCTIONS ********** |
|---|
| 289 | |
|---|
| 290 | // ********** BEGIN EXTERN FUNCTIONS ********** |
|---|
| 291 | // ********** END EXTERN FUNCTIONS ********** |
|---|
| 292 | |
|---|
| 293 | #endif |
|---|
| 294 | |
|---|