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
7e9846a5
Commit
7e9846a5
authored
Oct 14, 2008
by
Mark Olesen
Browse files
IOobjects - consistency fixes
- consistent constructors and consistent behaviour with MUST_READ, READ_IF_PRESENT
parent
56296e89
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOobject/IOobject.H
View file @
7e9846a5
...
...
@@ -155,7 +155,7 @@ protected:
// Protected member functions
//- Construct and return an IFstream for the object.
// The results is NULL if the stream constuction failed
// The results is NULL if the stream const
r
uction failed
Istream
*
objectStream
();
//- Set the object state to bad
...
...
src/OpenFOAM/db/IOobjects/IOField/IOField.C
View file @
7e9846a5
...
...
@@ -29,53 +29,93 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
IOField
<
Type
>::
IOField
(
const
IOobject
&
io
)
Foam
::
IOField
<
Type
>::
IOField
(
const
IOobject
&
io
)
:
regIOobject
(
io
),
Field
<
Type
>
(
readStream
(
typeName
))
regIOobject
(
io
)
{
close
();
if
(
io
.
readOpt
()
==
IOobject
::
MUST_READ
||
(
io
.
readOpt
()
==
IOobject
::
READ_IF_PRESENT
&&
headerOk
())
)
{
readStream
(
typeName
)
>>
*
this
;
close
();
}
}
template
<
class
Type
>
Foam
::
IOField
<
Type
>::
IOField
(
const
IOobject
&
io
,
const
label
size
)
Foam
::
IOField
<
Type
>::
IOField
(
const
IOobject
&
io
,
const
label
size
)
:
regIOobject
(
io
),
Field
<
Type
>
(
size
)
{}
regIOobject
(
io
)
{
if
(
io
.
readOpt
()
==
IOobject
::
MUST_READ
||
(
io
.
readOpt
()
==
IOobject
::
READ_IF_PRESENT
&&
headerOk
())
)
{
readStream
(
typeName
)
>>
*
this
;
close
();
}
else
{
Field
<
Type
>::
setSize
(
size
);
}
}
template
<
class
Type
>
Foam
::
IOField
<
Type
>::
IOField
(
const
IOobject
&
io
,
const
Field
<
Type
>&
f
)
Foam
::
IOField
<
Type
>::
IOField
(
const
IOobject
&
io
,
const
Field
<
Type
>&
f
)
:
regIOobject
(
io
),
Field
<
Type
>
(
f
)
regIOobject
(
io
)
{
if
(
io
.
readOpt
()
==
IOobject
::
READ_IF_PRESENT
&&
headerOk
())
if
(
io
.
readOpt
()
==
IOobject
::
MUST_READ
||
(
io
.
readOpt
()
==
IOobject
::
READ_IF_PRESENT
&&
headerOk
())
)
{
readStream
(
typeName
)
>>
*
this
;
close
();
}
else
{
Field
<
Type
>::
operator
=
(
f
);
}
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template
<
class
T
>
Foam
::
IOField
<
T
>::~
IOField
()
template
<
class
T
ype
>
Foam
::
IOField
<
T
ype
>::~
IOField
()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
Type
>
bool
Foam
::
IOField
<
Type
>::
writeData
(
Ostream
&
os
)
const
{
return
(
os
<<
static_cast
<
const
Field
<
Type
>&>
(
*
this
)).
good
();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template
<
class
Type
>
void
Foam
::
IOField
<
Type
>::
operator
=
(
const
IOField
<
Type
>&
rhs
)
{
Field
<
Type
>::
operator
=
(
rhs
);
}
template
<
class
Type
>
void
Foam
::
IOField
<
Type
>::
operator
=
(
const
Field
<
Type
>&
rhs
)
{
Field
<
Type
>::
operator
=
(
rhs
);
}
// ************************************************************************* //
src/OpenFOAM/db/IOobjects/IOField/IOField.H
View file @
7e9846a5
...
...
@@ -63,24 +63,13 @@ public:
// Constructors
//- Construct from IOobject
IOField
(
const
IOobject
&
);
IOField
(
const
IOobject
&
);
//- Construct from components
IOField
(
const
IOobject
&
,
const
Field
<
Type
>&
);
IOField
(
const
IOobject
&
,
const
Field
<
Type
>&
);
//- Construct from IOobject and size (does not set values)
IOField
(
const
IOobject
&
,
const
label
size
);
IOField
(
const
IOobject
&
,
const
label
size
);
// Destructor
...
...
@@ -90,23 +79,14 @@ public:
// Member functions
bool
writeData
(
Ostream
&
os
)
const
{
return
(
os
<<
static_cast
<
const
Field
<
Type
>&>
(
*
this
)).
good
();
}
bool
writeData
(
Ostream
&
)
const
;
// Member operators
void
operator
=
(
const
IOField
<
Type
>&
iof
)
{
Field
<
Type
>::
operator
=
(
iof
);
}
void
operator
=
(
const
IOField
<
Type
>&
);
void
operator
=
(
const
Field
<
Type
>&
f
)
{
Field
<
Type
>::
operator
=
(
f
);
}
void
operator
=
(
const
Field
<
Type
>&
);
};
...
...
src/OpenFOAM/db/IOobjects/IOList/IOList.C
View file @
7e9846a5
...
...
@@ -84,7 +84,6 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
{
List
<
T
>::
operator
=
(
list
);
}
}
...
...
@@ -95,26 +94,29 @@ Foam::IOList<T>::~IOList()
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
T
>
void
Foam
::
IOList
<
T
>::
operator
=
(
const
IOList
<
T
>&
rhs
)
bool
Foam
::
IOList
<
T
>::
writeData
(
Ostream
&
os
)
const
{
List
<
T
>::
operator
=
(
rhs
);
return
(
os
<<
*
this
).
good
(
);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template
<
class
T
>
void
Foam
::
IOList
<
T
>::
operator
=
(
const
List
<
T
>&
rhs
)
void
Foam
::
IOList
<
T
>::
operator
=
(
const
IO
List
<
T
>&
rhs
)
{
List
<
T
>::
operator
=
(
rhs
);
}
template
<
class
T
>
bool
Foam
::
IOList
<
T
>::
writeData
(
Ostream
&
os
)
const
void
Foam
::
IOList
<
T
>::
operator
=
(
const
List
<
T
>&
rhs
)
{
return
(
os
<<
*
this
).
good
(
);
List
<
T
>::
operator
=
(
rhs
);
}
...
...
src/OpenFOAM/db/IOobjects/IOMap/IOMap.C
View file @
7e9846a5
...
...
@@ -31,8 +31,7 @@ License
template
<
class
T
>
Foam
::
IOMap
<
T
>::
IOMap
(
const
IOobject
&
io
)
:
regIOobject
(
io
),
Map
<
T
>
()
regIOobject
(
io
)
{
if
(
...
...
src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.C
View file @
7e9846a5
...
...
@@ -91,20 +91,21 @@ Foam::IOPtrList<T>::~IOPtrList()
{}
// * * * * * * * * * * * * * * * Member
Operator
s * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member
Function
s * * * * * * * * * * * * * //
template
<
class
T
>
void
Foam
::
IOPtrList
<
T
>::
operator
=
(
const
IOPtrList
<
T
>&
rhs
)
bool
Foam
::
IOPtrList
<
T
>::
writeData
(
Ostream
&
os
)
const
{
PtrList
<
T
>::
operator
=
(
rhs
);
return
(
os
<<
*
this
).
good
(
);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template
<
class
T
>
bool
Foam
::
IOPtrList
<
T
>::
writeData
(
Ostream
&
os
)
const
void
Foam
::
IOPtrList
<
T
>::
operator
=
(
const
IOPtrList
<
T
>&
rhs
)
{
return
(
os
<<
*
this
).
good
(
);
PtrList
<
T
>::
operator
=
(
rhs
);
}
// ************************************************************************* //
src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C
View file @
7e9846a5
...
...
@@ -42,15 +42,10 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
IOdictionary
::
IOdictionary
(
const
IOobject
&
io
)
Foam
::
IOdictionary
::
IOdictionary
(
const
IOobject
&
io
)
:
regIOobject
(
io
)
{
dictionary
::
name
()
=
IOobject
::
objectPath
();
if
(
io
.
readOpt
()
==
IOobject
::
MUST_READ
...
...
@@ -60,18 +55,29 @@ Foam::IOdictionary::IOdictionary
readStream
(
typeName
)
>>
*
this
;
close
();
}
dictionary
::
name
()
=
IOobject
::
objectPath
();
}
Foam
::
IOdictionary
::
IOdictionary
(
const
IOobject
&
io
,
const
dictionary
&
dict
)
Foam
::
IOdictionary
::
IOdictionary
(
const
IOobject
&
io
,
const
dictionary
&
dict
)
:
regIOobject
(
io
),
dictionary
(
dict
)
regIOobject
(
io
)
{
if
(
io
.
readOpt
()
==
IOobject
::
MUST_READ
||
(
io
.
readOpt
()
==
IOobject
::
READ_IF_PRESENT
&&
headerOk
())
)
{
readStream
(
typeName
)
>>
*
this
;
close
();
}
else
{
dictionary
::
operator
=
(
dict
);
}
dictionary
::
name
()
=
IOobject
::
objectPath
();
}
...
...
@@ -92,9 +98,9 @@ const Foam::word& Foam::IOdictionary::name() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void
Foam
::
IOdictionary
::
operator
=
(
const
IOdictionary
&
d
)
void
Foam
::
IOdictionary
::
operator
=
(
const
IOdictionary
&
rhs
)
{
dictionary
::
operator
=
(
d
);
dictionary
::
operator
=
(
rhs
);
}
...
...
src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C
View file @
7e9846a5
...
...
@@ -34,27 +34,17 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool
IOdictionary
::
readData
(
Istream
&
is
)
bool
Foam
::
IOdictionary
::
readData
(
Istream
&
is
)
{
is
>>
*
this
;
return
!
is
.
bad
();
}
bool
IOdictionary
::
writeData
(
Ostream
&
os
)
const
bool
Foam
::
IOdictionary
::
writeData
(
Ostream
&
os
)
const
{
dictionary
::
write
(
os
,
false
);
return
os
.
good
();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// ************************************************************************* //
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