| 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_PHYSICS2_HPP |
| 12 |
#define USER_APP_BCSTRATEGY_FACTORY_PHYSICS2_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 |
/* commenting out since object is already declared in physics 1 factory |
| 27 |
PANZER_DECLARE_BCSTRATEGY_TEMPLATE_BUILDER( |
| 28 |
user_app::BCStrategy_Dirichlet_Constant, BCStrategy_Dirichlet_Constant) |
| 29 |
*/ |
| 30 |
|
| 31 |
class BCFactoryPhysics2 : public panzer::BCStrategyFactory { |
| 32 |
|
| 33 |
bool m_throw_on_failure; |
| 34 |
|
| 35 |
public: |
| 36 |
|
| 37 |
BCFactoryPhysics2(bool throw_on_failure) : |
| 38 |
m_throw_on_failure(throw_on_failure) |
| 39 |
{ } |
| 40 |
|
| 41 |
Teuchos::RCP<panzer::BCStrategy_TemplateManager<panzer::Traits> > |
| 42 |
buildBCStrategy(const panzer::BC& bc, const Teuchos::RCP<panzer::GlobalData>& global_data) const |
| 43 |
{ |
| 44 |
|
| 45 |
Teuchos::RCP<panzer::BCStrategy_TemplateManager<panzer::Traits> > bcs_tm = |
| 46 |
Teuchos::rcp(new panzer::BCStrategy_TemplateManager<panzer::Traits>); |
| 47 |
|
| 48 |
bool found = false; |
| 49 |
|
| 50 |
PANZER_BUILD_BCSTRATEGY_OBJECTS("Constant 2", |
| 51 |
BCStrategy_Dirichlet_Constant); |
| 52 |
|
| 53 |
if (m_throw_on_failure) |
| 54 |
TEUCHOS_TEST_FOR_EXCEPTION(!found, std::logic_error, |
| 55 |
"Error - the BC Strategy Physics2 called \"" << bc.strategy() << |
| 56 |
"\" 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); |
| 57 |
|
| 58 |
if (!found) |
| 59 |
return Teuchos::null; |
| 60 |
|
| 61 |
return bcs_tm; |
| 62 |
} |
| 63 |
|
| 64 |
}; |
| 65 |
|
| 66 |
} |
| 67 |
|
| 68 |
#endif |