writeLocalObjects.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "writeLocalObjects.H"
27 #include "stringListOps.H"
28 #include "dictionary.H"
29 
30 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
31 
33 (
34  const word& name
35 )
36 {
37  localObjectNames_.clear();
38  localObjectNames_.append(name);
39 }
40 
41 
43 (
44  const wordList& names
45 )
46 {
47  localObjectNames_.clear();
48  localObjectNames_.append(names);
49 }
50 
51 
53 {
54  wordList names
55  (
57  );
58 
59  return names;
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 
66 (
67  const objectRegistry& obr,
68  const Switch& log
69 )
70 :
71  writeObjectsBase(obr, log),
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77 
79 {}
80 
81 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
84 const Foam::wordList&
86 {
87  return localObjectNames_;
88 }
89 
90 
92 {
93  if (dict.found("objects"))
94  {
96  }
97  else
98  {
100  }
101 
102  return true;
103 }
104 
105 
106 // ************************************************************************* //
dictionary dict
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:643
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
void resetLocalObjectName(const word &name)
Reset the list of local object names from a single word.
virtual wordList objectNames()
Get the list of field names to be written.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
writeLocalObjects(const objectRegistry &obr, const Switch &logRef)
Construct from objectRegistry and inheriting function object.
Operations on lists of strings.
wordList localObjectNames_
Object names that are handled on behalf of the inheritor.
A class for handling words, derived from string.
Definition: word.H:59
const wordList & localObjectNames() const
Return const access to the local object names.
void resetLocalObjectNames(const wordList &names)
Reset the list of local object names from a wordList.
void resetWriteObjectName(const wordRe &name)
Reset the list of object names to be written to a single regular.
detect if the string contains meta-characters
wordReList writeObjectNames_
Object names requested by the user to be written.
A wordRe is a word, but can also have a regular expression for matching words.
Definition: wordRe.H:74
A wrapper for matching a List of wordRe.
virtual bool read(const dictionary &)
Read the list of objects to be written.
StringListType subsetStrings(const regExp &re, const StringListType &lst, const bool invert=false)
Extract elements of StringList when regular expression matches.
writeObjectsBase(const objectRegistry &obr, const Switch &logRef)
Construct from objectRegistry and inheriting function object.
Registry of regIOobjects.
virtual bool read(const dictionary &)
Read the list of objects to be written.