Panzer  Version of the Day
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 
70  void buildBCs(std::vector<panzer::BC>& bcs, const Teuchos::ParameterList& p, const Teuchos::RCP<panzer::GlobalData> global_data);
71 
73  enum BCType {
77  };
78 
80  class BC {
81  public:
82  // types supporting hashing
83  struct BCHash {
84  std::hash<std::string> hash;
85  std::size_t operator()(const BC & bc) const
86  { return this->hash(bc.elementBlockID() + "_" + bc.sidesetID());}
87  };
88 
89  struct BCEquality {
90  bool operator()(const BC & bc1,const BC & bc2) const
91  { return bc1.elementBlockID()==bc2.elementBlockID() && bc1.sidesetID()==bc2.sidesetID(); }
92  };
93 
94  public:
95 
97  BC(std::size_t bc_id,
98  BCType bc_type,
99  std::string sideset_id,
100  std::string element_block_id,
101  std::string equation_set_name,
102  std::string strategy);
103 
105  BC(std::size_t bc_id,
106  BCType bc_type,
107  std::string sideset_id,
108  std::string element_block_id,
109  std::string equation_set_name,
110  std::string strategy,
111  const Teuchos::ParameterList& p);
112 
114  BC(std::size_t bc_id,
115  const Teuchos::ParameterList& p);
116 
118  BC(std::size_t bc_id,
119  const Teuchos::ParameterList& p,
120  const Teuchos::RCP<panzer::GlobalData> gd);
121 
123  ~BC();
124 
126  std::size_t bcID() const;
127 
129  BCType bcType() const;
130 
132  std::string sidesetID() const;
133 
135  std::string elementBlockID() const;
136 
138  std::string elementBlockID2() const;
139 
141  std::string equationSetName() const;
142 
144  std::string equationSetName2() const;
145 
147  std::string strategy() const;
148 
150  Teuchos::RCP<const Teuchos::ParameterList> params() const;
151 
153  Teuchos::RCP<panzer::GlobalData> global_data() const;
154 
156  Teuchos::RCP<Teuchos::ParameterList> nonconstParams() const;
157 
159  std::string identifier() const;
160 
162  void print(std::ostream& os) const;
163 
164  private:
165 
166  void validateParameters(Teuchos::ParameterList& p) const;
167 
168  private:
169 
170  std::size_t m_bc_id;
171 
173 
174  std::string m_sideset_id;
175 
176  std::string m_element_block_id;
177 
178  std::string m_element_block_id2;
179 
180  std::string m_equation_set_name;
181 
182  std::string m_equation_set_name2;
183 
184  std::string m_strategy;
185 
186  Teuchos::RCP<Teuchos::ParameterList> m_params;
187 
188  Teuchos::RCP<panzer::GlobalData> m_gd;
189  };
190 
191  std::ostream&
192  operator<<(std::ostream & os, const panzer::BC& bc);
193 
194  struct LessBC {
195 
196  bool operator()(const panzer::BC& left,
197  const panzer::BC& right) const
198  {
199  return left.bcID() < right.bcID();
200  }
201  };
202 
203 }
204 
205 #endif
void validateParameters(Teuchos::ParameterList &p) const
Definition: Panzer_BC.cpp:300
bool operator()(const panzer::BC &left, const panzer::BC &right) const
Definition: Panzer_BC.hpp:196
std::string m_element_block_id
Definition: Panzer_BC.hpp:176
std::string m_strategy
Definition: Panzer_BC.hpp:184
BCType
Type of boundary condition.
Definition: Panzer_BC.hpp:73
~BC()
Dtor.
Definition: Panzer_BC.cpp:172
BCType m_bc_type
Definition: Panzer_BC.hpp:172
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:75
Teuchos::RCP< Teuchos::ParameterList > m_params
Definition: Panzer_BC.hpp:186
std::string elementBlockID2() const
Returns the second element block id associated with this sideset.
Definition: Panzer_BC.cpp:205
Teuchos::RCP< panzer::GlobalData > m_gd
Definition: Panzer_BC.hpp:188
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:248
BCType bcType() const
Returns the boundary condition type (Dirichlet or Neumann or Interface).
Definition: Panzer_BC.cpp:184
std::string m_element_block_id2
Definition: Panzer_BC.hpp:178
Teuchos::RCP< panzer::GlobalData > global_data() const
Returns the RCP to the global data.
Definition: Panzer_BC.cpp:240
Teuchos::RCP< panzer::GlobalData > global_data
std::string identifier() const
A unique string identifier for this boundary condition.
Definition: Panzer_BC.cpp:255
Teuchos::RCP< const Teuchos::ParameterList > params() const
Returns a parameter list with user defined parameters for bc.
Definition: Panzer_BC.cpp:233
std::string m_equation_set_name
Definition: Panzer_BC.hpp:180
std::string strategy() const
Returns the keyword used to construct a bc strategy.
Definition: Panzer_BC.cpp:226
std::string m_equation_set_name2
Definition: Panzer_BC.hpp:182
std::string equationSetName() const
Returns the unknown name/keyword.
Definition: Panzer_BC.cpp:212
std::size_t m_bc_id
Definition: Panzer_BC.hpp:170
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:177
std::size_t operator()(const BC &bc) const
Definition: Panzer_BC.hpp:85
std::string elementBlockID() const
Returns the element block id associated with this sideset.
Definition: Panzer_BC.cpp:198
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
std::string equationSetName2() const
Returns the second unknown name/keyword.
Definition: Panzer_BC.cpp:219
std::string m_sideset_id
Definition: Panzer_BC.hpp:174
Stores input information for a boundary condition.
Definition: Panzer_BC.hpp:80
std::string sidesetID() const
Returns the set id.
Definition: Panzer_BC.cpp:191
void print(std::ostream &os) const
Print object using an ostream.
Definition: Panzer_BC.cpp:264
bool operator()(const BC &bc1, const BC &bc2) const
Definition: Panzer_BC.hpp:90
std::hash< std::string > hash
Definition: Panzer_BC.hpp:84