Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_BC.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Panzer: A partial differential equation assembly
5// engine for strongly coupled complex multiphysics systems
6// Copyright (2011) Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39// Eric C. Cyr (eccyr@sandia.gov)
40// ***********************************************************************
41// @HEADER
42
43
44#ifndef PANZER_BC_HPP
45#define PANZER_BC_HPP
46
47#include <string>
48#include <iostream>
49#include <functional>
50#include <cstddef>
51#include <vector>
52
53#include <unordered_map>
54
55#include "Teuchos_RCP.hpp"
56
57#include "Panzer_GlobalData.hpp"
58
59namespace Teuchos {
60 class ParameterList;
61}
62
63namespace panzer {
64
65 class BC;
66 class WorksetDescriptor;
67
71 void buildBCs(std::vector<panzer::BC>& bcs, const Teuchos::ParameterList& p, const Teuchos::RCP<panzer::GlobalData> global_data);
72
79
81 class BC {
82 public:
83 // types supporting hashing
84 struct BCHash {
85 std::hash<std::string> hash;
86 std::size_t operator()(const BC & bc) const
87 { return this->hash(bc.elementBlockID() + "_" + bc.sidesetID());}
88 };
89
90 struct BCEquality {
91 bool operator()(const BC & bc1,const BC & bc2) const
92 { return bc1.elementBlockID()==bc2.elementBlockID() && bc1.sidesetID()==bc2.sidesetID(); }
93 };
94
95 public:
96
98 BC(std::size_t bc_id,
99 BCType bc_type,
100 std::string sideset_id,
101 std::string element_block_id,
102 std::string equation_set_name,
103 std::string strategy);
104
106 BC(std::size_t bc_id,
107 BCType bc_type,
108 std::string sideset_id,
109 std::string element_block_id,
110 std::string equation_set_name,
111 std::string strategy,
112 const Teuchos::ParameterList& p);
113
115 BC(std::size_t bc_id,
116 const Teuchos::ParameterList& p);
117
119 BC(std::size_t bc_id,
120 const Teuchos::ParameterList& p,
121 const Teuchos::RCP<panzer::GlobalData> gd);
122
124 ~BC();
125
127 std::size_t bcID() const;
128
130 BCType bcType() const;
131
133 std::string sidesetID() const;
134
136 std::string elementBlockID() const;
137
139 std::string elementBlockID2() const;
140
142 std::string equationSetName() const;
143
145 std::string equationSetName2() const;
146
148 std::string strategy() const;
149
151 Teuchos::RCP<const Teuchos::ParameterList> params() const;
152
154 Teuchos::RCP<panzer::GlobalData> global_data() const;
155
157 Teuchos::RCP<Teuchos::ParameterList> nonconstParams() const;
158
160 std::string identifier() const;
161
163 void print(std::ostream& os) const;
164
165 private:
166
167 void validateParameters(Teuchos::ParameterList& p) const;
168
169 private:
170
171 std::size_t m_bc_id;
172
174
175 std::string m_sideset_id;
176
178
180
182
184
185 std::string m_strategy;
186
187 Teuchos::RCP<Teuchos::ParameterList> m_params;
188
189 Teuchos::RCP<panzer::GlobalData> m_gd;
190 };
191
192 std::ostream&
193 operator<<(std::ostream & os, const panzer::BC& bc);
194
195 struct LessBC {
196
197 bool operator()(const panzer::BC& left,
198 const panzer::BC& right) const
199 {
200 return left.bcID() < right.bcID();
201 }
202 };
203
204 WorksetDescriptor bcDescriptor(const panzer::BC & bc);
205
206}
207
208#endif
Stores input information for a boundary condition.
Definition Panzer_BC.hpp:81
std::string m_strategy
Teuchos::RCP< panzer::GlobalData > m_gd
void buildBCs(std::vector< panzer::BC > &bcs, const Teuchos::ParameterList &p, const Teuchos::RCP< panzer::GlobalData > global_data)
Nonmember constructor to build BC objects from a ParameterList.
Teuchos::RCP< Teuchos::ParameterList > nonconstParams() const
Returns a nonconst parameter list with user defined parameters for bc. Nonconst is meant to be used f...
BCType m_bc_type
std::string m_equation_set_name
std::string sidesetID() const
Returns the set id.
std::string m_element_block_id2
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 m_sideset_id
std::string m_element_block_id
std::string elementBlockID() const
Returns the element block id associated with this sideset.
std::string m_equation_set_name2
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.
std::size_t m_bc_id
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.
Definition Panzer_BC.cpp:77
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
WorksetDescriptor bcDescriptor(const panzer::BC &bc)
BCType
Type of boundary condition.
Definition Panzer_BC.hpp:74
@ BCT_Dirichlet
Definition Panzer_BC.hpp:75
@ BCT_Neumann
Definition Panzer_BC.hpp:76
@ BCT_Interface
Definition Panzer_BC.hpp:77
bool operator()(const BC &bc1, const BC &bc2) const
Definition Panzer_BC.hpp:91
std::hash< std::string > hash
Definition Panzer_BC.hpp:85
std::size_t operator()(const BC &bc) const
Definition Panzer_BC.hpp:86
bool operator()(const panzer::BC &left, const panzer::BC &right) const