cudaGpu.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  Copyright : (C) 2011 Symscape
3  Website : www.symscape.com
4 -------------------------------------------------------------------------------
5 License
6  This file is part of OpenFOAM.
7 
8  OpenFOAM is free software: you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
14  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16  for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
20 
21 Typedef
22  Foam::cudaGpuFunctionObject
23 
24 Description
25  FunctionObject to initialize device and enable GPU linear solvers.
26 
27 @verbatim
28  functions
29  (
30  cudaGpu
31  {
32  // Type of functionObject
33  type cudaGpu;
34 
35  // Where to load it from (if not already in solver)
36  functionObjectLibs ("gpu");
37 
38  // CUDA Device Id
39  // Optional default = 0
40  // cudaDevice 2;
41  }
42  );
43  @endverbatim
44 
45 SourceFiles
46  cudaGpu.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef cudaGpu_H
51 #define cudaGpu_H
52 
53 #include "functionObject.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59  class cudaGpu : public functionObject
60  {
61  // Private Member Functions
62 
63  //- Disallow default bitwise copy construct
64  cudaGpu(const cudaGpu&);
65 
66  //- Disallow default bitwise assignment
67  void operator=(const cudaGpu&);
68 
69  public:
70  //- Runtime type information
71  TypeName("cudaGpu");
72 
73  // Constructors
74 
75  //- Construct from components
76  cudaGpu
77  (
78  const word& name,
79  const Time&,
80  const dictionary&
81  );
82 
83  // Member Functions
84 
85  //- Called at the start of the time-loop
86  virtual bool start()
87  { return true; }
88 
89  //- Called at each ++ or += of the time-loop
90  virtual bool execute(const bool forceWrite)
91  { return true; }
92 
93  //- Read and set the function object if its data have changed
94  virtual bool read(const dictionary&)
95  { return true; }
96 
97  //- Update for changes of mesh
98  virtual void updateMesh(const mapPolyMesh& mpm)
99  {}
100 
101  //- Update for changes of mesh
102  virtual void movePoints(const polyMesh& mesh)
103  {}
104  };
105 }
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 #endif
110 
111 // ************************************************************************* //
Foam::cudaGpu::updateMesh
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
Definition: cudaGpu.H:98
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::cudaGpu::start
virtual bool start()
Called at the start of the time-loop.
Definition: cudaGpu.H:86
Foam::cudaGpu::operator=
void operator=(const cudaGpu &)
Disallow default bitwise assignment.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::functionObject
Abstract base-class for Time/database function objects.
Definition: functionObject.H:58
Foam::cudaGpu::cudaGpu
cudaGpu(const cudaGpu &)
Disallow default bitwise copy construct.
Foam::cudaGpu::TypeName
TypeName("cudaGpu")
Runtime type information.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::functionObject::name
virtual const word & name() const
Name.
Definition: functionObject.C:105
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
functionObject.H
Foam::cudaGpu::execute
virtual bool execute(const bool forceWrite)
Called at each ++ or += of the time-loop.
Definition: cudaGpu.H:90
Foam::cudaGpu::movePoints
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
Definition: cudaGpu.H:102
Foam::cudaGpu::read
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
Definition: cudaGpu.H:94
Foam::cudaGpu
Definition: cudaGpu.H:59