GRINS-0.7.0
dirichlet_bc_factory_abstract.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 // This class
27 
28 // Full specialization for the Factory<DirichetBoundary>
29 namespace libMesh
30 {
31  template<>
32  std::map<std::string, Factory<DirichletBoundary>*>&
33  Factory<DirichletBoundary>::factory_map()
34  {
35  static std::map<std::string, Factory<DirichletBoundary>*> _map;
36  return _map;
37  }
38 } // end namespace libMesh
39 
40 namespace GRINS
41 {
42  // Definition of static members
43  template<>
45 
46  template<>
48 
49  template<>
50  const std::set<BoundaryID>* BCFactoryAbstract<libMesh::DirichletBoundary>::_bc_ids = NULL;
51 
52  template<>
54 
55  template<>
57 
58  void DirichletBCFactoryAbstract::check_for_vars( const GetPot& input, const std::string& section,
59  const std::vector<std::string>& var_names,
60  std::set<std::string>* vars_found )
61  {
62  if( vars_found )
63  vars_found->clear();
64 
65  bool found_var = false;
66 
67  for( std::vector<std::string>::const_iterator name = var_names.begin();
68  name < var_names.end(); ++name )
69  {
70  if( input.have_variable( section+"/"+(*name) ) )
71  {
72  found_var = true;
73 
74  if( vars_found )
75  vars_found->insert( (*name) );
76  }
77  }
78 
79  // If no variables were found to be set, error out printing
80  // the section and the variable names we were looking for.
81  if( !found_var )
82  {
83  std::string err_msg = "ERROR: Could find any active variable assigned a Dirichlet boundary value\n";
84  err_msg += " in section "+section+". Active variables are:\n";
85 
86  for( std::vector<std::string>::const_iterator name = var_names.begin();
87  name < var_names.end(); ++name )
88  err_msg += " "+(*name)+"\n";
89 
90  libmesh_error_msg(err_msg);
91  }
92 
93  if( vars_found )
94  libmesh_assert(!vars_found->empty());
95  }
96 
97 } // end namespace GRINS
GRINS namespace.
Interface with libMesh for solving Multiphysics problems.
void check_for_vars(const GetPot &input, const std::string &section, const std::vector< std::string > &var_names, std::set< std::string > *vars_found=NULL)
Helper function.
Abstract factory that provides availability of GetPot.

Generated on Thu Jun 2 2016 21:52:27 for GRINS-0.7.0 by  doxygen 1.8.10