engineMeshNew.C
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-2015 OpenFOAM Foundation
9  Copyright (C) 2019-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "engineMesh.H"
30 #include "Time.H"
31 
32 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
33 
35 {
36  const IOdictionary dict
37  (
38  IOobject
39  (
40  "engineGeometry",
41  io.time().constant(),
42  io.db(),
45  false // Do not register
46  )
47  );
48 
49  const word modelType(dict.get<word>("engineMesh"));
50 
51  Info<< "Selecting engineMesh " << modelType << endl;
52 
53  auto* ctorPtr = IOobjectConstructorTable(modelType);
54 
55  if (!ctorPtr)
56  {
58  (
59  dict,
60  "engineMesh",
61  modelType,
62  *IOobjectConstructorTablePtr_
63  ) << exit(FatalIOError);
64  }
65 
66  return autoPtr<engineMesh>(ctorPtr(io));
67 }
68 
69 
70 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::IOobject::time
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:493
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::engineMesh::New
static autoPtr< engineMesh > New(const IOobject &io)
Select null constructed.
Definition: engineMeshNew.C:34
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
engineMesh.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePathsI.H:96
Foam::IOobject::db
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:487