Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
0f579e40
Commit
0f579e40
authored
Oct 02, 2008
by
mattijs
Browse files
wildcards in dictionaries
parent
bac9f1e1
Changes
9
Hide whitespace changes
Inline
Side-by-side
applications/utilities/surface/surfaceSubset/surfaceSubset.C
View file @
0f579e40
...
...
@@ -100,6 +100,11 @@ int main(int argc, char *argv[])
meshSubsetDict
.
lookup
(
"addFaceNeighbours"
)
);
Switch
invertSelection
(
meshSubsetDict
.
lookup
(
"invertSelection"
)
);
// Mark the cells for the subset
// Faces to subset
...
...
@@ -337,6 +342,27 @@ int main(int argc, char *argv[])
<<
" faces because of addFaceNeighbours"
<<
endl
;
}
if
(
invertSelection
)
{
Info
<<
"Inverting selection."
<<
endl
;
boolList
newFacesToSubset
(
facesToSubset
.
size
());
forAll
(
facesToSubset
,
i
)
{
if
(
facesToSubset
[
i
])
{
newFacesToSubset
[
i
]
=
false
;
}
else
{
newFacesToSubset
[
i
]
=
true
;
}
}
facesToSubset
.
transfer
(
newFacesToSubset
);
}
// Create subsetted surface
labelList
pointMap
;
labelList
faceMap
;
...
...
src/OpenFOAM/db/dictionary/dictionary.H
View file @
0f579e40
...
...
@@ -31,7 +31,7 @@ Description
which are matched using Posix regular expressions. The general order for
searching is
- exact match
- wildcard match
- wildcard match
(in reverse order)
- optional recursion into subdictionaries
The dictionary class is the base class for IOdictionary.
...
...
src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H
View file @
0f579e40
...
...
@@ -43,7 +43,6 @@ SourceFiles
#ifndef dictionaryEntry_H
#define dictionaryEntry_H
#include
"keyType.H"
#include
"entry.H"
#include
"dictionary.H"
#include
"InfoProxy.H"
...
...
src/OpenFOAM/db/dictionary/entry/entry.H
View file @
0f579e40
...
...
@@ -76,6 +76,9 @@ class entry
// Private Member Functions
//- Get the next valid keyword otherwise return false
static
bool
getKeyword
(
keyType
&
keyword
,
Istream
&
is
);
public:
...
...
@@ -113,9 +116,6 @@ public:
// Member functions
//- Get the next valid keyword otherwise return false
static
bool
getKeyword
(
keyType
&
keyword
,
Istream
&
is
);
//- Return keyword
const
keyType
&
keyword
()
const
{
...
...
src/OpenFOAM/db/dictionary/entry/entryIO.C
View file @
0f579e40
...
...
@@ -126,7 +126,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
(
keyword
,
false
,
tru
e
fals
e
);
if
(
existingPtr
)
{
...
...
src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C
View file @
0f579e40
...
...
@@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include
"word.H"
#include
"primitiveEntry.H"
#include
"dictionary.H"
...
...
src/OpenFOAM/primitives/strings/keyType/keyType.H
0 → 100644
View file @
0f579e40
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::keyType
Description
A class for handling keywords in dictionaries.
A keyType is the keyword of a dictionary. It differs from word in that
it accepts wildcards.
SourceFiles
keyType.C
keyTypeIO.C
\*---------------------------------------------------------------------------*/
#ifndef keyType_H
#define keyType_H
#include
"word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// Forward declaration of classes
class
Istream
;
class
Ostream
;
/*---------------------------------------------------------------------------*\
Class keyType Declaration
\*---------------------------------------------------------------------------*/
class
keyType
:
public
word
{
// Private member data
bool
isWildCard_
;
// Private Member Functions
//- Disallow assignments where we cannot determine string/word type
void
operator
=
(
const
std
::
string
&
);
public:
// Constructors
//- Construct null
inline
keyType
();
//- Construct as copy
inline
keyType
(
const
keyType
&
s
);
//- Construct as copy of word
inline
keyType
(
const
word
&
s
);
//- Construct as copy of string. Expect it to be regular expression.
inline
keyType
(
const
string
&
s
);
//- Construct as copy of character array
inline
keyType
(
const
char
*
s
);
//- Construct as copy of std::string
inline
keyType
(
const
std
::
string
&
s
,
const
bool
isWildCard
);
//- Construct from Istream
keyType
(
Istream
&
is
);
// Member functions
//- Is this character valid for a keyType
inline
static
bool
valid
(
char
c
);
//- Is the type a wildcard?
inline
bool
isWildCard
()
const
;
// Member operators
// Assignment
inline
void
operator
=
(
const
keyType
&
s
);
//- Assign from regular expression.
inline
void
operator
=
(
const
string
&
s
);
inline
void
operator
=
(
const
word
&
s
);
inline
void
operator
=
(
const
char
*
);
// IOstream operators
friend
Istream
&
operator
>>
(
Istream
&
is
,
keyType
&
w
);
friend
Ostream
&
operator
<<
(
Ostream
&
os
,
const
keyType
&
w
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include
"keyTypeI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/OpenFOAM/primitives/strings/keyType/keyTypeI.H
0 → 100644
View file @
0f579e40
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct null
inline
Foam
::
keyType
::
keyType
()
:
word
(),
isWildCard_
(
false
)
{}
//- Construct as copy
inline
Foam
::
keyType
::
keyType
(
const
keyType
&
s
)
:
word
(
s
,
false
),
isWildCard_
(
s
.
isWildCard
())
{}
//- Construct as copy of word
inline
Foam
::
keyType
::
keyType
(
const
word
&
s
)
:
word
(
s
,
false
),
isWildCard_
(
false
)
{}
//- Construct as copy of string. Expect it to be regular expression
inline
Foam
::
keyType
::
keyType
(
const
string
&
s
)
:
word
(
s
,
false
),
isWildCard_
(
true
)
{}
//- Construct as copy of character array
inline
Foam
::
keyType
::
keyType
(
const
char
*
s
)
:
word
(
s
,
false
),
isWildCard_
(
false
)
{}
//- Construct as copy of std::string
inline
Foam
::
keyType
::
keyType
(
const
std
::
string
&
s
,
const
bool
isWildCard
)
:
word
(
s
,
false
),
isWildCard_
(
isWildCard
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline
bool
Foam
::
keyType
::
valid
(
char
c
)
{
return
c
!=
'"'
;
}
bool
Foam
::
keyType
::
isWildCard
()
const
{
return
isWildCard_
;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline
void
Foam
::
keyType
::
operator
=
(
const
keyType
&
s
)
{
// Bypass checking
string
::
operator
=
(
s
);
isWildCard_
=
s
.
isWildCard
();
}
inline
void
Foam
::
keyType
::
operator
=
(
const
word
&
s
)
{
word
::
operator
=
(
s
);
isWildCard_
=
false
;
}
inline
void
Foam
::
keyType
::
operator
=
(
const
string
&
s
)
{
// Bypass checking
string
::
operator
=
(
s
);
isWildCard_
=
true
;
}
inline
void
Foam
::
keyType
::
operator
=
(
const
char
*
s
)
{
// Bypass checking
string
::
operator
=
(
s
);
isWildCard_
=
false
;
}
// ************************************************************************* //
src/OpenFOAM/primitives/strings/keyType/keyTypeIO.C
0 → 100644
View file @
0f579e40
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Istream constructor and IOstream operators for word.
\*---------------------------------------------------------------------------*/
#include
"keyType.H"
#include
"IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam
::
keyType
::
keyType
(
Istream
&
is
)
:
word
()
{
is
>>
*
this
;
}
Foam
::
Istream
&
Foam
::
operator
>>
(
Istream
&
is
,
keyType
&
w
)
{
token
t
(
is
);
if
(
!
t
.
good
())
{
is
.
setBad
();
return
is
;
}
if
(
t
.
isWord
())
{
w
=
t
.
wordToken
();
}
else
if
(
t
.
isString
())
{
// Assign from string. Sets regular expression.
w
=
t
.
stringToken
();
}
else
{
is
.
setBad
();
FatalIOErrorIn
(
"operator>>(Istream&, keyType&)"
,
is
)
<<
"wrong token type - expected word or string found "
<<
t
.
info
()
<<
exit
(
FatalIOError
);
return
is
;
}
// Check state of IOstream
is
.
check
(
"Istream& operator>>(Istream&, keyType&)"
);
return
is
;
}
Foam
::
Ostream
&
Foam
::
operator
<<
(
Ostream
&
os
,
const
keyType
&
w
)
{
os
.
write
(
w
);
os
.
check
(
"Ostream& operator<<(Ostream&, const keyType&)"
);
return
os
;
}
// ************************************************************************* //
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment