Debian Codegraph @

packages/panzer/adapters-stk/test/bcstrategy/user_app_BCStrategy_Factory_Physics1.hpp

raw
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 USER_APP_BCSTRATEGY_FACTORY_PHYSICS1_HPP
12 #define USER_APP_BCSTRATEGY_FACTORY_PHYSICS1_HPP
13
14 #include "Teuchos_RCP.hpp"
15 #include "Panzer_Traits.hpp"
16 #include "Panzer_BCStrategy_TemplateManager.hpp"
17 #include "Panzer_BCStrategy_Factory.hpp"
18 #include "Panzer_BCStrategy_Factory_Defines.hpp"
19 #include "Panzer_GlobalData.hpp"
20
21 // Add my bcstrategies here
22 #include "user_app_BCStrategy_Dirichlet_Constant.hpp"
23
24 namespace user_app {
25
26 PANZER_DECLARE_BCSTRATEGY_TEMPLATE_BUILDER(
27 user_app::BCStrategy_Dirichlet_Constant, BCStrategy_Dirichlet_Constant)
28
29 class BCFactoryPhysics1 : public panzer::BCStrategyFactory {
30
31 bool m_throw_on_failure;
32
33 public:
34
35 BCFactoryPhysics1(bool throw_on_failure) :
36 m_throw_on_failure(throw_on_failure)
37 { }
38
39 Teuchos::RCP<panzer::BCStrategy_TemplateManager<panzer::Traits> >
40 buildBCStrategy(const panzer::BC& bc, const Teuchos::RCP<panzer::GlobalData>& global_data) const
41 {
42
43 Teuchos::RCP<panzer::BCStrategy_TemplateManager<panzer::Traits> > bcs_tm =
44 Teuchos::rcp(new panzer::BCStrategy_TemplateManager<panzer::Traits>);
45
46 bool found = false;
47
48 PANZER_BUILD_BCSTRATEGY_OBJECTS("Constant 1",
49 BCStrategy_Dirichlet_Constant);
50
51 if (m_throw_on_failure)
52 TEUCHOS_TEST_FOR_EXCEPTION(!found, std::logic_error,
53 "Error - the BC Strategy Physics1 called \"" << bc.strategy() <<
54 "\" is not a valid identifier in the BCStrategyFactory. Either add a valid implementation to your factory or fix your input file. The relevant boundary condition is:\n\n" << bc << std::endl);
55
56 if (!found)
57 return Teuchos::null;
58
59 return bcs_tm;
60 }
61
62 };
63
64 }
65
66 #endif