Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_GlobalEvaluationDataContainer.cpp
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 
12 
13 namespace panzer {
14 
16 
19 void GlobalEvaluationDataContainer::addDataObject(const std::string & key,
21 {
22  lookupTable_[key] = ged;
23 }
24 
27 bool GlobalEvaluationDataContainer::containsDataObject(const std::string & key) const
28 {
29  return lookupTable_.find(key)!=lookupTable_.end();
30 }
31 
35 {
36  std::unordered_map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr;
37  for(itr=begin();itr!=end();++itr) {
38  if(itr->first==key)
39  return itr->second;
40  }
41 
42  {
43  std::stringstream ss;
44  ss << "Valid keys = ";
45  for(const_iterator litr=begin();litr!=end();++litr)
46  ss << "\"" << litr->first << "\" ";
47 
48  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
49  "In GlobalEvaluationDataContainer::getDataObject(key) failed to find the data object specified by \""+key+"\"\n " + ss.str());
50  }
51 
52  return Teuchos::null;
53 /*
54  std::unordered_map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr = lookupTable_.find(key);
55 
56  if(itr==lookupTable_.end()) {
57  std::stringstream ss;
58  ss << "Valid keys = ";
59  for(const_iterator litr=begin();litr!=end();++litr)
60  ss << "\"" << litr->first << "\" ";
61 
62  TEUCHOS_TEST_FOR_EXCEPTION(itr==lookupTable_.end(),std::logic_error,
63  "In GlobalEvaluationDataContainer::getDataObject(key) failed to find the data object specified by \""+key+"\"\n " + ss.str());
64  }
65 
66  return itr->second;
67 */
68 }
69 
72 {
73  for(iterator itr=begin();itr!=end();++itr)
74  itr->second->ghostToGlobal(p);
75 }
76 
79 {
80  for(iterator itr=begin();itr!=end();++itr)
81  itr->second->globalToGhost(p);
82 }
83 
86 {
87  for(iterator itr=begin();itr!=end();++itr)
88  itr->second->initializeData();
89 }
90 
91 }
void addDataObject(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
std::unordered_map< std::string, Teuchos::RCP< GlobalEvaluationData > >::iterator iterator
std::unordered_map< std::string, Teuchos::RCP< GlobalEvaluationData > > lookupTable_
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void initialize()
Call initialize on all containers.
void globalToGhost(int p)
Call global to ghost on all the containers.
Teuchos::RCP< GlobalEvaluationData > getDataObject(const std::string &key) const
std::unordered_map< std::string, Teuchos::RCP< GlobalEvaluationData > >::const_iterator const_iterator
void ghostToGlobal(int p)
Call ghost to global on all the containers.