Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_BCStrategy_Factory_Composite.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 #include "Panzer_BC.hpp"
13 
14 namespace panzer {
15 
17  m_bc_strategy_factories(factories)
18  {
19 
20  }
21 
25  const Teuchos::RCP<panzer::GlobalData>& global_data) const
26  {
28 
29  bool found = false;
30 
31  for (std::vector<Teuchos::RCP<panzer::BCStrategyFactory> >::const_iterator factory = m_bc_strategy_factories.begin();
32  factory != m_bc_strategy_factories.end(); ++factory) {
33 
34  bcs_tm = (*factory)->buildBCStrategy(bc,global_data);
35 
36  if (nonnull(bcs_tm)) {
37  found = true;
38  break;
39  }
40 
41  }
42 
43  TEUCHOS_TEST_FOR_EXCEPTION(!found, std::logic_error,
44  "Error - the BC Strategy called \"" << bc.strategy() <<
45  "\" is not a valid identifier in the BCStrategyFactory. Either add " <<
46  "a valid implementation to the factory or fix the input file. The " <<
47  "relevant boundary condition is:\n\n" << bc << std::endl);
48 
49  return bcs_tm;
50 
51  }
52 
53 }
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
BCFactoryComposite(const std::vector< Teuchos::RCP< panzer::BCStrategyFactory > > &factories)
Teuchos::RCP< panzer::BCStrategy_TemplateManager< panzer::Traits > > buildBCStrategy(const panzer::BC &bc, const Teuchos::RCP< panzer::GlobalData > &global_data) const
std::string strategy() const
Returns the keyword used to construct a bc strategy.
Definition: Panzer_BC.cpp:196
bool nonnull(const boost::shared_ptr< T > &p)
std::vector< Teuchos::RCP< panzer::BCStrategyFactory > > m_bc_strategy_factories
Stores input information for a boundary condition.
Definition: Panzer_BC.hpp:48