Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_StlMap_Utilities.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef PANZER_STLMAP_UTILITIES_HPP
12 #define PANZER_STLMAP_UTILITIES_HPP
13 
14 #include "Teuchos_Assert.hpp"
15 #include <map>
16 #include <iostream>
17 
18 namespace panzer {
19 
20  template<typename MapT>
21  const typename MapT::mapped_type &
22  getEntry(const MapT& in_map, const typename MapT::key_type& in_key) {
23 
24  typename MapT::const_iterator it = in_map.find(in_key);
25 
26  TEUCHOS_TEST_FOR_EXCEPTION(it == in_map.end(), std::runtime_error,
27  "Failed to find the key " << in_key << " in the map."
28  << std::endl);
29 
30  return it->second;
31  }
32 
33 }
34 
35 #endif
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
const MapT::mapped_type & getEntry(const MapT &in_map, const typename MapT::key_type &in_key)