ImplDetails.hpp

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 #ifndef stk_linsys_ImplDetails_hpp
00010 #define stk_linsys_ImplDetails_hpp
00011 
00012 #include <stk_linsys/FieldIdMap.hpp>
00013 
00014 #include <limits>
00015 #include <map>
00016 #include <stdexcept>
00017 #include <stk_mesh/base/Field.hpp>
00018 
00019 namespace stk {
00020 
00023 namespace linsys {
00024 
00027 namespace impl {
00028 
00032 int map_field_to_int(FieldIdMap& field_id_map,
00033                      const stk::mesh::FieldBase& field);
00034 
00038 int
00039 query_field_to_int_mapping(const FieldIdMap& field_id_map,
00040                            const stk::mesh::FieldBase& field);
00041 
00045 const stk::mesh::FieldBase* get_field(const FieldIdMap& field_id_map,
00046                                       int field_id);
00047 
00051 int entityid_to_int(stk::mesh::EntityId id);
00052 
00056 int entitytype_to_int(stk::mesh::EntityType entity_type);
00057 
00062 template<typename T>
00063 void verify_convertible_to_int(T id, const char* caller)
00064 {
00065   if (sizeof(T) <= sizeof(int)) return;
00066 
00067   T intmax = std::numeric_limits<int>::max();
00068   if (intmax < id) {
00069     std::ostringstream msg;
00070     msg << caller << " ERROR, id " << id << " is too large to convert to int.";
00071     std::string str = msg.str();
00072     throw std::runtime_error(str);
00073   }
00074 }
00075 
00076 }//namespace impl
00077 }//namespace linsys
00078 }//namespace stk
00079 
00080 #endif
00081 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7