Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
59 namespace Teuchos {
60  class ParameterList;
61 }
62 
63 namespace 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 
74  enum BCType {
78  };
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,
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 
152 
155 
158 
160  std::string identifier() const;
161 
163  void print(std::ostream& os) const;
164 
165  private:
166 
168 
169  private:
170 
171  std::size_t m_bc_id;
172 
174 
175  std::string m_sideset_id;
176 
177  std::string m_element_block_id;
178 
179  std::string m_element_block_id2;
180 
181  std::string m_equation_set_name;
182 
183  std::string m_equation_set_name2;
184 
185  std::string m_strategy;
186 
188 
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
bool operator()(const panzer::BC &left, const panzer::BC &right) const
Definition: Panzer_BC.hpp:197
std::string m_element_block_id
Definition: Panzer_BC.hpp:177
std::string m_strategy
Definition: Panzer_BC.hpp:185
BCType
Type of boundary condition.
Definition: Panzer_BC.hpp:74
~BC()
Dtor.
Definition: Panzer_BC.cpp:174
std::string elementBlockID() const
Returns the element block id associated with this sideset.
Definition: Panzer_BC.cpp:200
BCType m_bc_type
Definition: Panzer_BC.hpp:173
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
Teuchos::RCP< Teuchos::ParameterList > m_params
Definition: Panzer_BC.hpp:187
Teuchos::RCP< panzer::GlobalData > m_gd
Definition: Panzer_BC.hpp:189
void validateParameters(Teuchos::ParameterList &p) const
Definition: Panzer_BC.cpp:303
std::string m_element_block_id2
Definition: Panzer_BC.hpp:179
std::string identifier() const
A unique string identifier for this boundary condition.
Definition: Panzer_BC.cpp:257
std::string m_equation_set_name
Definition: Panzer_BC.hpp:181
std::string m_equation_set_name2
Definition: Panzer_BC.hpp:183
std::string equationSetName2() const
Returns the second unknown name/keyword.
Definition: Panzer_BC.cpp:221
std::string strategy() const
Returns the keyword used to construct a bc strategy.
Definition: Panzer_BC.cpp:228
std::size_t m_bc_id
Definition: Panzer_BC.hpp:171
BCType bcType() const
Returns the boundary condition type (Dirichlet or Neumann or Interface).
Definition: Panzer_BC.cpp:186
std::string elementBlockID2() const
Returns the second element block id associated with this sideset.
Definition: Panzer_BC.cpp:207
void print(std::ostream &os) const
Print object using an ostream.
Definition: Panzer_BC.cpp:266
std::size_t operator()(const BC &bc) const
Definition: Panzer_BC.hpp:86
std::string equationSetName() const
Returns the unknown name/keyword.
Definition: Panzer_BC.cpp:214
std::size_t bcID() const
Returns a unique identifier for this bc - needed for unique parameter setting in LOCA and for map key...
Definition: Panzer_BC.cpp:179
Teuchos::RCP< const Teuchos::ParameterList > params() const
Returns a parameter list with user defined parameters for bc.
Definition: Panzer_BC.cpp:235
std::string sidesetID() const
Returns the set id.
Definition: Panzer_BC.cpp:193
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
std::string m_sideset_id
Definition: Panzer_BC.hpp:175
WorksetDescriptor bcDescriptor(const panzer::BC &bc)
Definition: Panzer_BC.cpp:332
Stores input information for a boundary condition.
Definition: Panzer_BC.hpp:81
Teuchos::RCP< Teuchos::ParameterList > nonconstParams() const
Returns a nonconst parameter list with user defined parameters for bc. Nonconst is meant to be used f...
Definition: Panzer_BC.cpp:250
bool operator()(const BC &bc1, const BC &bc2) const
Definition: Panzer_BC.hpp:91
std::hash< std::string > hash
Definition: Panzer_BC.hpp:85
Teuchos::RCP< panzer::GlobalData > global_data() const
Returns the RCP to the global data.
Definition: Panzer_BC.cpp:242