|
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 00013 #include <string.h> 00014 #include <stdexcept> 00015 #include <iostream> 00016 #include <sstream> 00017 #include <algorithm> 00018 00019 #include <stk_util/util/string_case_compare.hpp> 00020 #include <stk_mesh/base/MetaData.hpp> 00021 00022 namespace stk { 00023 namespace mesh { 00024 00025 //---------------------------------------------------------------------- 00026 00027 void property_data_throw( const PropertyBase & , const Part & ) 00028 { 00029 00030 } 00031 00032 Property<void>::~Property() {} 00033 00034 PropertyBase * 00035 MetaData::get_property_base( const std::string & name , 00036 const std::type_info & type , 00037 unsigned size ) const 00038 { 00039 PropertyBase * p = NULL ; 00040 { 00041 std::vector< PropertyBase * >::const_iterator i ; 00042 for ( i = m_properties.begin() ; 00043 i != m_properties.end() && not_equal_case( (*i)->name() , name ) ; 00044 ++i ); 00045 00046 if ( i != m_properties.end() ) { 00047 const bool error_type = ( (*i)->m_type != type ); 00048 const bool error_size = size && ( (*i)->m_size != size ); 00049 00050 if ( error_type || error_size ) { 00051 std::ostringstream msg ; 00052 msg << "stk::mesh::MetaData::get_property( " << name << " ) FAILED:" ; 00053 if ( error_type ) { 00054 msg << " actual_type(" << (*i)->m_type.name(); 00055 msg << ") != request_type(" << type.name() << ")" ; 00056 } 00057 if ( error_type ) { 00058 msg << " actual_size(" << (*i)->m_size ; 00059 msg << ") != request_size(" << size << ")" ; 00060 } 00061 throw std::runtime_error( msg.str() ); 00062 } 00063 p = *i; 00064 } 00065 } 00066 return p ; 00067 } 00068 00069 //---------------------------------------------------------------------- 00070 00071 } // namespace mesh 00072 } // namespace stk 00073