|
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 #include <sstream> 00011 #include <stdexcept> 00012 00013 #include <stk_util/util/StaticAssert.hpp> 00014 00015 #include <stk_util/environment/ReportHandler.hpp> 00016 00017 #include <stk_mesh/base/EntityKey.hpp> 00018 00019 namespace stk_classic { 00020 namespace mesh { 00021 00022 EntityKey::EntityKey( EntityRank entity_rank , 00023 EntityKey::raw_key_type entity_id ) 00024 : key( ( raw_key_type(entity_rank) << id_digits ) | entity_id ) 00025 { 00026 enum { OK = StaticAssert< sizeof(EntityKey) == 00027 sizeof(EntityKey::raw_key_type) >::OK }; 00028 00029 ThrowAssertMsg( rank() == entity_rank, 00030 "entity_rank out of range, entity_rank= " << entity_rank << " rank() = " << rank() << " entity_id= " << entity_id << " id() = " << id() ); 00031 00032 ThrowAssertMsg( id() == entity_id, 00033 "entity_id out of range, entity_rank= " << entity_rank << " rank() = " << rank() << " entity_id= " << entity_id << " id() = " << id() ); 00034 } 00035 00036 00037 } 00038 } 00039