CollisionModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::CollisionModel
28 
29 Group
30  grpLagrangianIntermediateCollisionSubModels
31 
32 Description
33  Templated collision model class.
34 
35 SourceFiles
36  CollisionModel.C
37  CollisionModelNew.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef CollisionModel_H
42 #define CollisionModel_H
43 
44 #include "IOdictionary.H"
45 #include "autoPtr.H"
46 #include "runTimeSelectionTables.H"
47 #include "CloudSubModelBase.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class CollisionModel Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class CloudType>
59 class CollisionModel
60 :
61  public CloudSubModelBase<CloudType>
62 {
63  // Protected data
64 
65  //- Convenience typedef for parcel type
66  typedef typename CloudType::parcelType parcelType;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("collisionModel");
73 
74  //- Declare runtime constructor selection table
76  (
77  autoPtr,
79  dictionary,
80  (
81  const dictionary& dict,
82  CloudType& owner
83  ),
84  (dict, owner)
85  );
86 
87 
88  // Constructors
89 
90  //- Construct null from owner
91  CollisionModel(CloudType& owner);
92 
93  //- Construct from components
95  (
96  const dictionary& dict,
97  CloudType& owner,
98  const word& type
99  );
100 
101  //- Construct copy
102  CollisionModel(const CollisionModel<CloudType>& cm);
103 
104  //- Construct and return a clone
105  virtual autoPtr<CollisionModel<CloudType>> clone() const = 0;
106 
107 
108  //- Destructor
109  virtual ~CollisionModel();
110 
111 
112  //- Selector
113  static autoPtr<CollisionModel<CloudType>> New
114  (
115  const dictionary& dict,
116  CloudType& owner
117  );
118 
119 
120  // Member Functions
121 
122  //- Return the number of times to subcycle the current
123  // timestep to meet the criteria of the collision model
124  virtual label nSubCycles() const = 0;
125 
126  // Collision function
127  virtual void collide() = 0;
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #define makeCollisionModel(CloudType) \
138  \
139  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
140  defineNamedTemplateTypeNameAndDebug \
141  ( \
142  Foam::CollisionModel<collidingCloudType>, \
143  0 \
144  ); \
145  namespace Foam \
146  { \
147  defineTemplateRunTimeSelectionTable \
148  ( \
149  CollisionModel<collidingCloudType>, \
150  dictionary \
151  ); \
152  }
153 
154 
155 #define makeCollisionModelType(SS, CloudType) \
156  \
157  typedef Foam::CloudType::collidingCloudType collidingCloudType; \
158  defineNamedTemplateTypeNameAndDebug(Foam::SS<collidingCloudType>, 0); \
159  \
160  Foam::CollisionModel<collidingCloudType>:: \
161  adddictionaryConstructorToTable<Foam::SS<collidingCloudType>> \
162  add##SS##CloudType##collidingCloudType##ConstructorToTable_;
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #ifdef NoRepository
168  #include "CollisionModel.C"
169 #endif
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
CloudSubModelBase.H
Foam::CollisionModel::nSubCycles
virtual label nSubCycles() const =0
Return the number of times to subcycle the current.
Foam::CollisionModel::collide
virtual void collide()=0
Foam::CloudType
DSMCCloud< dsmcParcel > CloudType
Definition: makeDSMCParcelBinaryCollisionModels.C:38
Foam::CollisionModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, CollisionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::CollisionModel::CollisionModel
CollisionModel(CloudType &owner)
Construct null from owner.
Definition: CollisionModel.C:33
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::CollisionModel::~CollisionModel
virtual ~CollisionModel()
Destructor.
Definition: CollisionModel.C:64
IOdictionary.H
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::CollisionModel::clone
virtual autoPtr< CollisionModel< CloudType > > clone() const =0
Construct and return a clone.
Foam::CollisionModel::TypeName
TypeName("collisionModel")
Runtime type information.
Foam::CollisionModel::New
static autoPtr< CollisionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: CollisionModelNew.C:36
CollisionModel.C
autoPtr.H