cgma
|
00001 //- Class: CubitAttrib 00002 //- Owner: Greg Nielson 00003 //- Description: implementation of the CubitAttrib class. 00004 //- Checked By: 00005 //- Version: 00006 00007 #include "CastTo.hpp" 00008 #include "CubitAttrib.hpp" 00009 #include "CubitAttribUser.hpp" 00010 #include "Body.hpp" 00011 #include "RefVolume.hpp" 00012 #include "RefFace.hpp" 00013 #include "RefEdge.hpp" 00014 #include "RefVertex.hpp" 00015 #include "CADeferredAttrib.hpp" 00016 #include "RefEntity.hpp" 00017 #include "DLIList.hpp" 00018 #include "RefEntityFactory.hpp" 00019 #include "MergeTool.hpp" 00020 #include "ModelQueryEngine.hpp" 00021 #include "GeometryQueryTool.hpp" 00022 00023 00024 00025 00026 CubitAttrib::CubitAttrib(RefEntity *attrib_owner) 00027 { 00028 attribOwnerEntity = attrib_owner; 00029 hasActuated = CUBIT_FALSE; 00030 hasUpdated = CUBIT_FALSE; 00031 hasWritten = CUBIT_FALSE; 00032 deleteAttrib = CUBIT_FALSE; 00033 nextAttrib = NULL; 00034 00035 // add this to the owner 00036 if (attrib_owner) attrib_owner->add_cubit_attrib(this); 00037 } 00038 00039 CubitAttrib::~CubitAttrib() 00040 { 00041 if( !hasActuated ) 00042 CADeferredAttrib::remove_unactuated_ca( this ); 00043 } 00044 00045 CubitStatus CubitAttrib::actuate_list(DLIList<RefEntity*> entity_list) 00046 { 00047 RefEntity * ref_ent; 00048 for(int i = entity_list.size(); i > 0; i--) 00049 { 00050 ref_ent = entity_list.get_and_step(); 00051 ref_ent->actuate_cubit_attrib(CA_ENTITY_NAME); 00052 ref_ent->actuate_cubit_attrib ( CA_UNIQUE_ID ); 00053 ref_ent->actuate_cubit_attrib(CA_SIZING_FUNCTION_SKELETON); 00054 ref_ent->actuate_cubit_attrib(CA_MESH_INTERVAL); 00055 ref_ent->actuate_cubit_attrib(CA_GROUP); 00056 ref_ent->actuate_cubit_attrib(CA_GENESIS_ENTITY); 00057 // ref_ent->actuate_cubit_attrib ( CA_ENTITY_ID ); 00058 ref_ent->actuate_cubit_attrib ( CA_MESH_SCHEME ); 00059 ref_ent->actuate_cubit_attrib ( CA_SMOOTH_SCHEME ); 00060 ref_ent->actuate_cubit_attrib ( CA_PARTITION_VG ); 00061 ref_ent->actuate_cubit_attrib ( CA_COMPOSITE_VG ); 00062 ref_ent->actuate_cubit_attrib ( CA_VIRTUAL_VG ); 00063 ref_ent->actuate_cubit_attrib(CA_MERGE_PARTNER); 00064 ref_ent->actuate_cubit_attrib(CA_DEFERRED_ATTRIB); 00065 ref_ent->actuate_cubit_attrib(CA_MESH_CONTAINER); 00066 ref_ent->actuate_cubit_attrib(CA_BODIES); 00067 ref_ent->actuate_cubit_attrib ( CA_ENTITY_ID ); 00068 ref_ent->actuate_cubit_attrib(CA_ENTITY_COLOR); 00069 ref_ent->actuate_cubit_attrib(CA_ENTITY_TOL); 00070 //#ifdef CAT 00071 ref_ent->actuate_cubit_attrib(CA_VERTEX_FORCE); 00072 ref_ent->actuate_cubit_attrib(CA_SURFACE_FORCE); 00073 ref_ent->actuate_cubit_attrib(CA_CURVE_FORCE); 00074 ref_ent->actuate_cubit_attrib(CA_VERTEX_DISPLACEMENT); 00075 ref_ent->actuate_cubit_attrib(CA_SURFACE_DISPLACEMENT); 00076 ref_ent->actuate_cubit_attrib(CA_CURVE_DISPLACEMENT); 00077 ref_ent->actuate_cubit_attrib(CA_VOLUME_DISPLACEMENT); 00078 ref_ent->actuate_cubit_attrib(CA_SURFACE_PRESSURE); 00079 ref_ent->actuate_cubit_attrib(CA_CURVE_PRESSURE); 00080 ref_ent->actuate_cubit_attrib(CA_SURFACE_TEMPERATURE); 00081 ref_ent->actuate_cubit_attrib(CA_CURVE_TEMPERATURE); 00082 ref_ent->actuate_cubit_attrib(CA_VERTEX_TEMPERATURE); 00083 ref_ent->actuate_cubit_attrib(CA_SURFACE_HEATFLUX); 00084 ref_ent->actuate_cubit_attrib(CA_CURVE_HEATFLUX); 00085 ref_ent->actuate_cubit_attrib(CA_SURFACE_CONVECTION); 00086 ref_ent->actuate_cubit_attrib(CA_CURVE_CONVECTION); 00087 ref_ent->actuate_cubit_attrib(CA_SURFACE_CONTACT); 00088 ref_ent->actuate_cubit_attrib(CA_CURVE_CONTACT); 00089 ref_ent->actuate_cubit_attrib(CA_COORD_SYS); 00090 ref_ent->actuate_cubit_attrib(CA_PROPERTY_BLOCK); 00091 ref_ent->actuate_cubit_attrib(CA_MATERIAL_BLOCK); 00092 //#endif 00093 ref_ent->actuate_cubit_attrib(CA_MERGE_STATUS); 00094 } 00095 return CUBIT_SUCCESS; 00096 } 00097 00098 void CubitAttrib::has_written(CubitBoolean set_has_written) 00099 { 00100 hasWritten = set_has_written; 00101 00102 // if the written flag is being set to true, reset the hasUpdated flag 00103 if (CUBIT_TRUE == hasWritten) 00104 hasUpdated = CUBIT_FALSE; 00105 } 00106 00107 CubitBoolean CubitAttrib::has_written() const 00108 {return hasWritten;} 00109 00110 void CubitAttrib::remove_attribute() 00111 { 00112 if (has_written()) 00113 attribOwnerEntity->remove_attrib_geometry_entity(this); 00114 } 00115 00116 void CubitAttrib::add_attribute() 00117 { 00118 attribOwnerEntity->add_cubit_attrib(this); 00119 } 00120 00121 int CubitAttrib::equivalent(const CubitSimpleAttrib& csa_ptr) 00122 { 00123 //- return true if the csa and this are equivalent 00124 CubitSimpleAttrib this_csa_ptr = cubit_simple_attrib(); 00125 00126 return this_csa_ptr == csa_ptr; 00127 } 00128 00129 void CubitAttrib::print() 00130 { 00131 // print some details about this attrib 00132 PRINT_INFO("Attrib type %s, Owner = %s %d, Actuated=%d, Updated=%d, " 00133 "Written=%d, Delete=%d\n", 00134 att_internal_name(), 00135 (attribOwnerEntity ? attribOwnerEntity->class_name() : "(none)"), 00136 (attribOwnerEntity ? attribOwnerEntity->id() : 0), 00137 hasActuated, hasUpdated, 00138 hasWritten, deleteAttrib); 00139 00140 } 00141