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  Copyright (C) 2020 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 "patchInteractionData.H"
30 #include "dictionaryEntry.H"
31 #include "PatchInteractionModel.H"
32 
33 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
34 
36 :
37  interactionTypeName_("unknownInteractionTypeName"),
38  patchName_("unknownPatch"),
39  e_(0.0),
40  mu_(0.0)
41 {}
42 
43 
44 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
45 
47 {
48  return interactionTypeName_;
49 }
50 
51 
53 {
54  return patchName_;
55 }
56 
57 
58 Foam::scalar Foam::patchInteractionData::e() const
59 {
60  return e_;
61 }
62 
63 
64 Foam::scalar Foam::patchInteractionData::mu() const
65 {
66  return mu_;
67 }
68 
69 
70 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
71 
72 Foam::Istream& Foam::operator>>
73 (
74  Istream& is,
76 )
77 {
78  is.check(FUNCTION_NAME);
79 
80  const dictionaryEntry dictEntry(dictionary::null, is);
81  const dictionary& dict = dictEntry.dict();
82 
83  pid.patchName_ = dictEntry.keyword();
84 
85  dict.readEntry("type", pid.interactionTypeName_);
86  pid.e_ = dict.getOrDefault<scalar>("e", 1);
87  pid.mu_ = dict.getOrDefault<scalar>("mu", 0);
88 
89  return is;
90 }
91 
92 
93 // ************************************************************************* //
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::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:46
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:64
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:35
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:58
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:270
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:122
Foam::patchInteractionData::patchName
const keyType & patchName() const
Return const access to the patch name.
Definition: patchInteractionData.C:52