GRINS-0.8.0
dirichlet_bc_factory_function_base.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 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 // libMesh
29 #include "libmesh/function_base.h"
30 #include "libmesh/fem_function_base.h"
31 
32 namespace GRINS
33 {
34  template<typename FunctionType>
35  libMesh::UniquePtr<libMesh::DirichletBoundary> DirichletBCFactoryFunctionBase<FunctionType>::create()
36  {
37  // Make sure all necessary state has been setup
38  this->check_state();
39 
40  // We need to make a copy of var_names because subclasses may
41  // modify what variable names are present to allow the boundary
42  // condition factory implementation to apply only a subset of the
43  // variables.
44  std::vector<std::string> local_var_names = this->get_var_names();
45 
46  libMesh::UniquePtr<FunctionType>
47  func = this->build_func( *(this->_input), *(this->_system),
48  local_var_names, this->_section );
49 
50  libmesh_assert(func);
51 
52  std::vector<VariableIndex> local_var_indices;
53  this->build_var_indices(*(this->_system), local_var_names, local_var_indices);
54 
55  libMesh::UniquePtr<libMesh::DirichletBoundary> new_dbc =
56  this->make_dirichlet_boundary( *(this->_bc_ids), *(this->_system),
57  func, local_var_indices );
58 
59  // Reset state for error checking during next construction
60  this->reset_state();
61 
62  return new_dbc;
63  }
64 
65  template<>
66  libMesh::UniquePtr<libMesh::DirichletBoundary>
68  ( const std::set<BoundaryID>& bc_ids,
69  const libMesh::System& /*system*/,
70  libMesh::UniquePtr<libMesh::FunctionBase<libMesh::Number> >& func,
71  const std::vector<VariableIndex>& var_indices )
72  {
73  return libMesh::UniquePtr<libMesh::DirichletBoundary>(new libMesh::DirichletBoundary(bc_ids, var_indices, func.get()));
74  }
75 
76  template<>
77  libMesh::UniquePtr<libMesh::DirichletBoundary>
79  ( const std::set<BoundaryID>& bc_ids,
80  const libMesh::System& system,
81  libMesh::UniquePtr<libMesh::FEMFunctionBase<libMesh::Number> >& func,
82  const std::vector<VariableIndex>& var_indices )
83  {
84  return libMesh::UniquePtr<libMesh::DirichletBoundary>( new libMesh::DirichletBoundary(bc_ids, var_indices, system, func.get()) );
85  }
86 }
87 
88 // Instantiate the factories
GRINS namespace.
virtual libMesh::UniquePtr< libMesh::DirichletBoundary > create()
Subclasses implement the actual construction of the Base object in create().

Generated on Tue Dec 19 2017 12:47:27 for GRINS-0.8.0 by  doxygen 1.8.9.1