patchInteractionData.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 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 \*---------------------------------------------------------------------------*/
27 
28 #include "patchInteractionData.H"
29 #include "dictionaryEntry.H"
30 #include "PatchInteractionModel.H"
31 
32 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
33 
35 :
36  interactionTypeName_("unknownInteractionTypeName"),
37  patchName_("unknownPatch"),
38  e_(0.0),
39  mu_(0.0)
40 {}
41 
42 
43 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
44 
46 {
47  return interactionTypeName_;
48 }
49 
50 
52 {
53  return patchName_;
54 }
55 
56 
57 Foam::scalar Foam::patchInteractionData::e() const
58 {
59  return e_;
60 }
61 
62 
63 Foam::scalar Foam::patchInteractionData::mu() const
64 {
65  return mu_;
66 }
67 
68 
69 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
70 
71 Foam::Istream& Foam::operator>>
72 (
73  Istream& is,
75 )
76 {
77  is.check(FUNCTION_NAME);
78 
79  const dictionaryEntry dictEntry(dictionary::null, is);
80  const dictionary& dict = dictEntry.dict();
81 
82  pid.patchName_ = dictEntry.keyword();
83 
84  dict.readEntry("type", pid.interactionTypeName_);
85  pid.e_ = dict.lookupOrDefault<scalar>("e", 1.0);
86  pid.mu_ = dict.lookupOrDefault<scalar>("mu", 0.0);
87 
88  return is;
89 }
90 
91 
92 // ************************************************************************* //
PatchInteractionModel.H
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:65
Foam::patchInteractionData
Helper class for the LocalInteraction patch interaction model.
Definition: patchInteractionData.H:57
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
patchInteractionData.H
Foam::entry::keyword
const keyType & keyword() const
Return keyword.
Definition: entry.H:187
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.H:1241
Foam::dictionary::null
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition: dictionary.H:385
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:60
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::pid
pid_t pid()
Return the PID of this process.
Definition: MSwindows.C:330
Foam::patchInteractionData::interactionTypeName
const word & interactionTypeName() const
Return const access to the interaction type name.
Definition: patchInteractionData.C:45
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::patchInteractionData::mu
scalar mu() const
Return const access to the restitution coefficient.
Definition: patchInteractionData.C:63
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
dictionaryEntry.H
Foam::patchInteractionData::patchInteractionData
patchInteractionData()
Construct null.
Definition: patchInteractionData.C:34
Foam::dictionaryEntry::dict
virtual const dictionary & dict() const
Return dictionary.
Definition: dictionaryEntry.C:102
Foam::patchInteractionData::e
scalar e() const
Return const access to the elasticity coefficient.
Definition: patchInteractionData.C:57
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:261
Foam::patchInteractionData::patchName
const keyType & patchName() const
Return const access to the patch name.
Definition: patchInteractionData.C:51