12#include "Teuchos_Assert.hpp"
13#include "Teuchos_ParameterList.hpp"
20panzer::buildBCs(std::vector<panzer::BC>& bcs,
const Teuchos::ParameterList& p,
const Teuchos::RCP<panzer::GlobalData> global_data)
22 using Teuchos::ParameterList;
27 TEUCHOS_TEST_FOR_EXCEPTION(p.isParameter(
"Number of Boundary Conditions"),
29 "Error - the parameter \"Number of Boundary Conditions\" is no longer valid for the boundary condition sublist. Please remove this from your input file!");
31 std::size_t bc_index = 0;
32 for (ParameterList::ConstIterator bc_pl=p.begin(); bc_pl != p.end(); ++bc_pl,++bc_index) {
33 TEUCHOS_TEST_FOR_EXCEPTION( !(bc_pl->second.isList()), std::logic_error,
34 "Error - All objects in the boundary condition sublist must be BC sublists!" );
35 ParameterList& sublist = Teuchos::getValue<Teuchos::ParameterList>(bc_pl->second);
47 std::string sideset_id,
48 std::string element_block_id,
49 std::string eq_set_name,
50 std::string strategy) :
53 m_sideset_id(sideset_id),
54 m_element_block_id(element_block_id),
55 m_equation_set_name(eq_set_name),
64 std::string sideset_id,
65 std::string element_block_id,
66 std::string eq_set_name,
68 const Teuchos::ParameterList& p) :
71 m_sideset_id(sideset_id),
72 m_element_block_id(element_block_id),
73 m_equation_set_name(eq_set_name),
76 m_params = Teuchos::rcp(
new Teuchos::ParameterList(
""));
84 Teuchos::RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
87 this->validateParameters(*params);
90 std::string type = params->get<std::string>(
"Type");
91 if (type ==
"Dirichlet")
93 else if (type ==
"Neumann")
95 else if (type ==
"Interface")
98 m_sideset_id = params->get<std::string>(
"Sideset ID");
99 m_element_block_id = params->get<std::string>(
"Element Block ID");
100 m_equation_set_name = params->get<std::string>(
"Equation Set Name");
101 m_strategy = params->get<std::string>(
"Strategy");
102 m_params = Teuchos::sublist(params,
"Data");
103 if (type ==
"Interface") {
104 m_element_block_id2 = params->get<std::string>(
"Element Block ID2");
105 m_equation_set_name2 = params->get<std::string>(
"Equation Set Name2");
111panzer::BC::BC(std::size_t bc_id,
const Teuchos::ParameterList& p,
const Teuchos::RCP<panzer::GlobalData> gd)
113 Teuchos::RCP<Teuchos::ParameterList> params = Teuchos::parameterList();
118 this->validateParameters(*params);
121 std::string type = params->get<std::string>(
"Type");
122 if (type ==
"Dirichlet")
124 else if (type ==
"Neumann")
126 else if (type ==
"Interface")
129 m_sideset_id = params->get<std::string>(
"Sideset ID");
130 m_element_block_id = params->get<std::string>(
"Element Block ID");
131 m_equation_set_name = params->get<std::string>(
"Equation Set Name");
132 m_strategy = params->get<std::string>(
"Strategy");
133 m_params = Teuchos::sublist(params,
"Data");
134 if (type ==
"Interface") {
135 m_element_block_id2 = params->get<std::string>(
"Element Block ID2");
136 m_equation_set_name2 = params->get<std::string>(
"Equation Set Name2");
170 return m_element_block_id;
177 return m_element_block_id2;
184 return m_equation_set_name;
191 return m_equation_set_name2;
217Teuchos::RCP<Teuchos::ParameterList>
227 std::ostringstream os;
228 os <<
"BC(" << bcID() <<
")";
238 os <<
"panzer::BC" << endl;
240 os <<
" BC ID = " << m_bc_id << endl;
252 os <<
" Type = " << type << endl;
253 os <<
" Identifier = " << identifier() << endl;
254 os <<
" Side Set ID = " << m_sideset_id << endl;
255 os <<
" Element Block ID = " << m_element_block_id << endl;
257 os <<
" Second Element Block ID = " << m_element_block_id2 << endl;
258 os <<
" Strategy = " << m_strategy << endl;
259 os <<
" Variable Name(s) = " << m_equation_set_name << endl;
261 os <<
" Second Variable Name(s) = " << m_equation_set_name2 << endl;
262 os <<
" Strategy Name = " << m_strategy;
264 if (!Teuchos::is_null(m_params))
265 os << endl << m_params;
273 Teuchos::ParameterList valid_params;
275 valid_params.set<std::string>(
"Type",
"Dirichlet");
276 valid_params.set<std::string>(
"Sideset ID",
"???");
277 valid_params.set<std::string>(
"Element Block ID",
"???");
278 valid_params.set<std::string>(
"Element Block ID2",
"???");
279 valid_params.set<std::string>(
"Equation Set Name",
"???");
280 valid_params.set<std::string>(
"Equation Set Name2",
"???");
281 valid_params.set<std::string>(
"Strategy",
"???");
282 valid_params.sublist(
"Data").disableRecursiveValidation();
284 p.validateParametersAndSetDefaults(valid_params);
Stores input information for a boundary condition.
Teuchos::RCP< Teuchos::ParameterList > nonconstParams() const
Returns a nonconst parameter list with user defined parameters for bc. Nonconst is meant to be used f...
std::string sidesetID() const
Returns the set id.
std::size_t bcID() const
Returns a unique identifier for this bc - needed for unique parameter setting in LOCA and for map key...
Teuchos::RCP< const Teuchos::ParameterList > params() const
Returns a parameter list with user defined parameters for bc.
void print(std::ostream &os) const
Print object using an ostream.
BCType bcType() const
Returns the boundary condition type (Dirichlet or Neumann or Interface).
std::string elementBlockID() const
Returns the element block id associated with this sideset.
Teuchos::RCP< panzer::GlobalData > global_data() const
Returns the RCP to the global data.
std::string elementBlockID2() const
Returns the second element block id associated with this sideset.
std::string equationSetName2() const
Returns the second unknown name/keyword.
std::string identifier() const
A unique string identifier for this boundary condition.
void validateParameters(Teuchos::ParameterList &p) const
Teuchos::RCP< Teuchos::ParameterList > m_params
std::string strategy() const
Returns the keyword used to construct a bc strategy.
std::string equationSetName() const
Returns the unknown name/keyword.
BC(std::size_t bc_id, BCType bc_type, std::string sideset_id, std::string element_block_id, std::string equation_set_name, std::string strategy)
Ctor.
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
WorksetDescriptor bcDescriptor(const panzer::BC &bc)
BCType
Type of boundary condition.