cgma
|
00001 //------------------------------------------------------------------------- 00002 // Filename : PartitionEntity.cpp 00003 // 00004 // Purpose : 00005 // 00006 // Special Notes : 00007 // 00008 // Creator : Jason Kraftcheck 00009 // 00010 // Creation Date : 04/21/02 00011 //------------------------------------------------------------------------- 00012 00013 #include "VGDefines.h" 00014 #include "PartitionEntity.hpp" 00015 #include "CubitMessage.hpp" 00016 #include "CubitPoint.hpp" 00017 00018 #include <typeinfo> 00019 00020 PartitionEntity::~PartitionEntity() 00021 { 00022 entitySet->remove(this); 00023 } 00024 00025 PartitionEntity::PartitionEntity( ) 00026 : mark(0), entitySet(0), entitySetNext(0), entitySetId(0) 00027 { 00028 } 00029 00030 void PartitionEntity::print_debug_info( const char* prefix, 00031 bool print_subent_set ) const 00032 { 00033 if( !prefix ) prefix = ""; 00034 PRINT_INFO("%sPartitionEntity %p\n", prefix, (void*)this ); 00035 if( print_subent_set ) 00036 sub_entity_set().print_debug_info(prefix); 00037 else 00038 print_partitioned_entity( prefix ); 00039 } 00040 00041 void PartitionEntity::print_partitioned_entity( const char* prefix ) const 00042 { 00043 if(!prefix) prefix = ""; 00044 PRINT_INFO("%sPartitioned Entity: %s %p\n", 00045 prefix, 00046 partitioned_entity() ? 00047 fix_type_name(typeid(*partitioned_entity()).name()) : "TopologyBridge", 00048 (void*)partitioned_entity() ); 00049 } 00050 00051 CubitStatus PartitionEntity::move_to_geometry( CubitVector& ) 00052 { return CUBIT_SUCCESS; } 00053 00054 CubitStatus PartitionEntity::relax_to_geometry( CubitPoint* facet_point, 00055 const CubitVector* input_pos ) 00056 { 00057 if (input_pos) 00058 { 00059 CubitVector closest(*input_pos); 00060 if (move_to_geometry(closest) && 00061 facet_point->check_inverted_facets(closest)) 00062 { 00063 facet_point->set(closest); 00064 return CUBIT_SUCCESS; 00065 } 00066 } 00067 00068 CubitVector facet_pos(facet_point->coordinates()); 00069 if (move_to_geometry(facet_pos) && 00070 facet_point->check_inverted_facets(facet_pos)) 00071 { 00072 facet_point->set(facet_pos); 00073 return CUBIT_SUCCESS; 00074 } 00075 00076 return CUBIT_FAILURE; 00077 }