GRINS-0.8.0
physics_factory_with_core.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 namespace GRINS
29 {
30  PhysicsFactoryWithCore::PhysicsFactoryWithCore( const std::string& physics_name,
31  const std::string& core_physics_name )
32  : PhysicsFactoryBase(physics_name)
33  {
34  this->core_physics_names().insert( std::make_pair(physics_name, core_physics_name) );
35  }
36 
37  std::string PhysicsFactoryWithCore::find_core_physics_name( const std::string& physics_name )
38  {
39  std::string physics_name_stripped = PhysicsNaming::extract_physics(physics_name);
40 
41  if( this->core_physics_names().find(physics_name_stripped) == this->core_physics_names().end() )
42  libmesh_error_msg("ERROR: Could not find core_physics associated with "+physics_name_stripped+"!");
43 
44  std::string core_physics_no_suffix = this->core_physics_names().find(physics_name_stripped)->second;
45 
46  // The user will be expecting any suffix to be on the returned core physics name
47  std::string core_physics = core_physics_no_suffix+PhysicsNaming::extract_suffix(physics_name);
48 
49  return core_physics;
50  }
51 
52  std::map<std::string,std::string>& PhysicsFactoryWithCore::core_physics_names()
53  {
54  static std::map<std::string,std::string> _core_physics_names;
55  return _core_physics_names;
56  }
57 
58 } // end namespace GRINS
GRINS namespace.
Builds Physics objects, used by PhysicsBuilder.
static std::string extract_physics(const std::string &full_name)
Extract the physics name from the full_name.
PhysicsFactoryWithCore(const std::string &physics_name, const std::string &core_physics_name)
static std::map< std::string, std::string > & core_physics_names()
Cache for "core" physics names.
std::string find_core_physics_name(const std::string &physics_name)
static std::string extract_suffix(const std::string &full_name)
Extract the suffix from the full_name.

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