Skip to content
GitLab
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
61db7b5b
Commit
61db7b5b
authored
Aug 06, 2011
by
Henry
Browse files
OpenFOAM library: Add better error messaging from compound token transfer
parent
90780e09
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
View file @
61db7b5b
...
...
@@ -56,7 +56,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
{
L
=
dynamicCast
<
token
::
Compound
<
List
<
T
>
>
>
(
firstToken
.
transferCompoundToken
()
firstToken
.
transferCompoundToken
(
is
)
);
}
else
if
(
firstToken
.
isLabel
())
...
...
src/OpenFOAM/containers/Lists/List/ListIO.C
View file @
61db7b5b
...
...
@@ -59,7 +59,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
(
dynamicCast
<
token
::
Compound
<
List
<
T
>
>
>
(
firstToken
.
transferCompoundToken
()
firstToken
.
transferCompoundToken
(
is
)
)
);
}
...
...
src/OpenFOAM/db/IOstreams/token/CompoundToken.H
deleted
100644 → 0
View file @
90780e09
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::CompoundToken
Description
An abstract base class for managing compound tokens
\*---------------------------------------------------------------------------*/
#ifndef CompoundToken_H
#define CompoundToken_H
#include
"refCount.H"
#include
"typeInfo.H"
#include
"autoPtr.H"
#include
"runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// Forward declaration of friend functions and operators
class
CompoundToken
;
Ostream
&
operator
<<
(
Ostream
&
,
const
CompoundToken
&
);
/*---------------------------------------------------------------------------*\
Class CompoundToken Declaration
\*---------------------------------------------------------------------------*/
class
CompoundToken
:
public
refCount
{
// Private Member Functions
//- Disallow default bitwise copy construct
CompoundToken
(
const
CompoundToken
&
);
//- Disallow default bitwise assignment
void
operator
=
(
const
CompoundToken
&
);
public:
//- Runtime type information
virtual
const
word
&
type
()
const
=
0
;
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr
,
CompoundToken
,
Istream
,
(
const
word
&
type
,
Istream
&
is
),
(
type
,
is
)
);
// Constructors
//- Construct null
CompoundToken
()
{}
//- Return the clone as this and increment reference count
virtual
autoPtr
<
CompoundToken
>
clone
()
const
=
0
;
// Selectors
//- Select null constructed
static
autoPtr
<
CompoundToken
>
New
(
const
word
&
type
,
Istream
&
is
);
//- Destructor
virtual
~
CompoundToken
();
// Member Functions
// Access
// Check
// Edit
// Write
virtual
void
write
(
Istream
&
)
=
0
;
// IOstream Operators
friend
Ostream
&
operator
<<
(
Ostream
&
,
const
CompoundToken
&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
src/OpenFOAM/db/IOstreams/token/token.C
View file @
61db7b5b
...
...
@@ -63,11 +63,11 @@ Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
if
(
cstrIter
==
IstreamConstructorTablePtr_
->
end
())
{
FatalErrorIn
(
"token::compound::New(const word&, Istream&)"
)
Fatal
IO
ErrorIn
(
"token::compound::New(const word&, Istream&)"
,
is
)
<<
"Unknown compound type "
<<
compoundType
<<
nl
<<
nl
<<
"Valid compound types:"
<<
endl
<<
IstreamConstructorTablePtr_
->
sortedToc
()
<<
abort
(
FatalError
);
<<
abort
(
Fatal
IO
Error
);
}
return
autoPtr
<
Foam
::
token
::
compound
>
(
cstrIter
()(
is
));
...
...
@@ -86,15 +86,15 @@ bool Foam::token::compound::isCompound(const word& name)
}
Foam
::
token
::
compound
&
Foam
::
token
::
transferCompoundToken
()
Foam
::
token
::
compound
&
Foam
::
token
::
transferCompoundToken
(
const
Istream
&
is
)
{
if
(
type_
==
COMPOUND
)
{
if
(
compoundTokenPtr_
->
empty
())
{
FatalErrorIn
(
"token::transferCompoundToken(
)"
)
Fatal
IO
ErrorIn
(
"token::transferCompoundToken(
const Istream& is)"
,
is
)
<<
"compound has already been transfered from token
\n
"
<<
info
()
<<
abort
(
FatalError
);
<<
info
()
<<
abort
(
Fatal
IO
Error
);
}
else
{
...
...
src/OpenFOAM/db/IOstreams/token/token.H
View file @
61db7b5b
...
...
@@ -351,7 +351,7 @@ public:
inline
bool
isCompound
()
const
;
inline
const
compound
&
compoundToken
()
const
;
compound
&
transferCompoundToken
();
compound
&
transferCompoundToken
(
const
Istream
&
is
);
inline
label
lineNumber
()
const
;
inline
label
&
lineNumber
();
...
...
src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
View file @
61db7b5b
...
...
@@ -147,7 +147,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
(
dynamicCast
<
token
::
Compound
<
List
<
scalar
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -184,7 +184,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
(
dynamicCast
<
token
::
Compound
<
List
<
vector
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -224,7 +224,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
token
::
Compound
<
List
<
sphericalTensor
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -264,7 +264,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
token
::
Compound
<
List
<
symmTensor
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -301,7 +301,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
(
dynamicCast
<
token
::
Compound
<
List
<
tensor
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
View file @
61db7b5b
...
...
@@ -129,7 +129,7 @@ genericPointPatchField<Type>::genericPointPatchField
(
dynamicCast
<
token
::
Compound
<
List
<
scalar
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -167,7 +167,7 @@ genericPointPatchField<Type>::genericPointPatchField
(
dynamicCast
<
token
::
Compound
<
List
<
vector
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -208,7 +208,7 @@ genericPointPatchField<Type>::genericPointPatchField
token
::
Compound
<
List
<
sphericalTensor
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -249,7 +249,7 @@ genericPointPatchField<Type>::genericPointPatchField
token
::
Compound
<
List
<
symmTensor
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
@@ -287,7 +287,7 @@ genericPointPatchField<Type>::genericPointPatchField
(
dynamicCast
<
token
::
Compound
<
List
<
tensor
>
>
>
(
fieldToken
.
transferCompoundToken
()
fieldToken
.
transferCompoundToken
(
is
)
)
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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