|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 00010 //---------------------------------------------------------------------- 00011 #include <stdexcept> 00012 #include <iostream> 00013 #include <sstream> 00014 #include <algorithm> 00015 00016 #include <stk_util/util/string_case_compare.hpp> 00017 00018 #include <stk_mesh/base/PartRelation.hpp> 00019 #include <stk_mesh/base/Part.hpp> 00020 #include <stk_mesh/base/Trace.hpp> 00021 00022 #include <stk_mesh/baseImpl/PartImpl.hpp> 00023 #include <stk_util/environment/ReportHandler.hpp> 00024 00025 //---------------------------------------------------------------------- 00026 00027 namespace stk_classic { 00028 namespace mesh { 00029 00030 namespace impl { 00031 00032 void PartImpl::add_part_to_subset( Part & part) 00033 { 00034 TraceIfWatching("stk_classic::mesh::impl::PartImpl::add_part_to_subset", LOG_PART, m_universe_ordinal); 00035 DiagIfWatching(LOG_PART, m_universe_ordinal, "New subset is: " << part ); 00036 00037 insert( m_subsets, part ); 00038 } 00039 00040 00041 void PartImpl::add_part_to_superset( Part & part ) 00042 { 00043 TraceIfWatching("stk_classic::mesh::impl::PartImpl::add_part_to_superset", LOG_PART, m_universe_ordinal); 00044 DiagIfWatching(LOG_PART, m_universe_ordinal, "New superset is: " << part ); 00045 00046 insert( m_supersets, part ); 00047 } 00048 00049 void PartImpl::add_relation( PartRelation relation ) 00050 { 00051 TraceIfWatching("stk_classic::mesh::impl::PartImpl::add_relation", LOG_PART, m_universe_ordinal); 00052 DiagIfWatching(LOG_PART, m_universe_ordinal, "New relation from: " << relation.m_root << ", to: " << relation.m_target ); 00053 00054 m_relations.push_back(relation); 00055 } 00056 00057 void PartImpl::set_intersection_of( const PartVector & pv ) 00058 { 00059 TraceIfWatching("stk_classic::mesh::impl::PartImpl::set_intersection_of", LOG_PART, m_universe_ordinal); 00060 DiagIfWatching(LOG_PART, m_universe_ordinal, "Intersection: " << pv ); 00061 00062 m_intersect = pv ; 00063 } 00064 00065 // Subset part constructor: 00066 PartImpl::PartImpl( MetaData * arg_meta_data , 00067 const std::string & arg_name , 00068 EntityRank arg_rank , 00069 size_t arg_ordinal ) 00070 : m_name( arg_name ), 00071 m_attribute(), 00072 m_subsets() , m_supersets() , m_intersect() , m_relations() , 00073 m_mesh_meta_data( arg_meta_data ), 00074 m_universe_ordinal( arg_ordinal ), 00075 m_entity_rank( arg_rank ) 00076 {} 00077 00078 void PartImpl::set_primary_entity_rank( EntityRank entity_rank ) 00079 { 00080 TraceIfWatching("stk_classic::mesh::impl::PartImpl::set_primary_entity_rank", LOG_PART, m_universe_ordinal); 00081 if ( entity_rank == m_entity_rank ) return; 00082 00083 const bool rank_already_set = m_entity_rank != InvalidEntityRank && entity_rank != m_entity_rank; 00084 00085 //const bool has_subsets = m_subsets.size() > 0; 00086 //ThrowErrorMsgIf( has_subsets, " Error: Part '" << m_name << "' has subsets"); 00087 00088 if ( entity_rank == InvalidEntityRank ) return; 00089 ThrowErrorMsgIf( rank_already_set, " Error: Different entity rank has already been set on Part"); 00090 00091 m_entity_rank = entity_rank; 00092 } 00093 00094 00095 //---------------------------------------------------------------------- 00096 00097 00098 00099 //---------------------------------------------------------------------- 00100 00101 } // namespace impl 00102 00103 } // namespace mesh 00104 } // namespace stk_classic 00105 00106