newCoordinateModification.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "coordinateModification.H"
27 #include "dictionary.H"
28 #include "error.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 
37 autoPtr<Foam::coordinateModification> Foam::coordinateModification::New
38 (
39  const word& name,
40  const dictionary& dict
41 )
42 {
43  if( debug )
44  {
45  Info<< "coordinateModification::New(const word&, const dictionary&) : "
46  << "constructing coordinateModification"
47  << endl;
48  }
49 
50  // default type is self
51  word cmType(typeName_());
52  if( dict.found("type") )
53  {
54  dict.lookup("type") >> cmType;
55  }
56 
57  dictionaryConstructorTable::iterator cstrIter =
58  dictionaryConstructorTablePtr_->find(cmType);
59 
60  if( cstrIter == dictionaryConstructorTablePtr_->end() )
61  {
63  (
64  "coordinateModification::New(const word&, const dictionary&)",
65  dict
66  ) << "Unknown coordinateModification type " << cmType << nl << nl
67  << "Valid coordinateModification types are :" << nl
68  << "[default: " << typeName_() << "]"
69  << dictionaryConstructorTablePtr_->toc()
70  << exit(FatalIOError);
71  }
72 
73  return autoPtr<coordinateModification>(cstrIter()(name, dict));
74 }
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 } // End namespace Foam
79 
80 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::coordinateModification::New
static autoPtr< coordinateModification > New(const word &name, const dictionary &dict)
Select constructed from dictionary.
Definition: newCoordinateModification.C:38
Foam::dictionary::found
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:304
error.H
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
FatalIOErrorIn
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:324
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
coordinateModification.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
dictionary.H
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47