GRINS-0.8.0
system_helper.h
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 // GRINS
26 #include "grins/shared_ptr.h"
27 #include "grins/multiphysics_sys.h"
28 #include "grins/mesh_builder.h"
29 
30 // libMesh
31 #include "libmesh/getpot.h"
32 #include "libmesh/unstructured_mesh.h"
33 #include "libmesh/equation_systems.h"
34 
35 namespace GRINSTesting
36 {
39  {
40  protected:
41 
42  void setup_multiphysics_system(const std::string& filename)
43  {
44  _input.reset( new GetPot(filename) );
45  GRINS::MeshBuilder mesh_builder;
46  _mesh = mesh_builder.build( *_input, *TestCommWorld );
47  _es.reset( new libMesh::EquationSystems(*_mesh) );
48  _system = &_es->add_system<GRINS::MultiphysicsSystem>( "GRINS-TEST" );
49 
50  // We may not need any of these options, but this does some setup work that's needed
51  // and all the options have sane defaults if they're not in the testing input file.
53  }
54 
55  void reset_all()
56  {
57  _input.reset();
58  _es.reset(); // This will delete the system
59  _mesh.reset();
60  }
61 
62  libMesh::UniquePtr<GetPot> _input;
63  GRINS::SharedPtr<libMesh::UnstructuredMesh> _mesh;
64  libMesh::UniquePtr<libMesh::EquationSystems> _es;
65 
66  // Needs to be an ordinar pointer since EquationSystems owns this
68  };
69 
70 } // end namespace GRINSTesting
void setup_multiphysics_system(const std::string &filename)
Definition: system_helper.h:42
GRINS::SharedPtr< libMesh::UnstructuredMesh > _mesh
Definition: system_helper.h:63
libMesh::Parallel::Communicator * TestCommWorld
Definition: unit_driver.C:70
Helper class for setting up basic GRINS::MultiphysicsSystem for unit testing.
Definition: system_helper.h:38
libMesh::UniquePtr< libMesh::EquationSystems > _es
Definition: system_helper.h:64
Interface with libMesh for solving Multiphysics problems.
GRINS::MultiphysicsSystem * _system
Definition: system_helper.h:67
SharedPtr< libMesh::UnstructuredMesh > build(const GetPot &input, const libMesh::Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
Builds the libMesh::Mesh according to input options.
Definition: mesh_builder.C:46
libMesh::UniquePtr< GetPot > _input
Definition: system_helper.h:62
virtual void read_input_options(const GetPot &input)
Reads input options for this class and all physics that are enabled.

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