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
e06bf700
Commit
e06bf700
authored
Sep 16, 2008
by
mattijs
Browse files
binary read/write
parent
8e53a861
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/boundBox/boundBox.C
View file @
e06bf700
...
...
@@ -79,10 +79,9 @@ boundBox::boundBox(const pointField& points, const bool doReduce)
boundBox
::
boundBox
(
Istream
&
is
)
:
min_
(
is
),
max_
(
is
)
{}
{
operator
>>
(
is
,
*
this
);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
...
...
@@ -113,7 +112,7 @@ Istream& operator>>(Istream& is, boundBox& bb)
{
if
(
is
.
format
()
==
IOstream
::
ASCII
)
{
return
is
>>
bb
.
min_
>>
bb
.
max_
;
return
is
>>
bb
.
min_
>>
bb
.
max_
;
}
else
{
...
...
src/OpenFOAM/meshes/meshShapes/edge/edge.H
View file @
e06bf700
...
...
@@ -141,6 +141,9 @@ inline label Hash<edge>::operator()(const edge& e) const
return
e
[
0
]
*
e
[
1
]
+
e
[
0
]
+
e
[
1
];
}
template
<
>
inline
bool
contiguous
<
edge
>
()
{
return
true
;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
View file @
e06bf700
...
...
@@ -166,6 +166,9 @@ inline label Hash<triFace>::operator()(const triFace& t) const
return
(
t
[
0
]
*
t
[
1
]
*
t
[
2
]
+
t
[
0
]
+
t
[
1
]
+
t
[
2
]);
}
template
<
>
inline
bool
contiguous
<
triFace
>
()
{
return
true
;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/OpenFOAM/primitives/contiguous/contiguous.H
View file @
e06bf700
...
...
@@ -38,6 +38,8 @@ Description
#ifndef contiguous_H
#define contiguous_H
#include
"label.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
...
...
@@ -45,54 +47,117 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Forward declaration of friend functions and operators
template
<
class
T
,
label
Size
>
class
FixedList
;
template
<
class
T
>
class
Pair
;
// Assume the data associated with type T is not contiguous
template
<
class
T
>
inline
bool
contiguous
()
{
return
false
;}
// Specify data associated with primitive types is contiguous
// Specify data associated with primitive types (and simple fixed size
// containers - only size 2 defined here) is contiguous
template
<
>
inline
bool
contiguous
<
bool
>
()
{
return
true
;}
inline
bool
contiguous
<
bool
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
bool
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
bool
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
char
>
()
{
return
true
;}
inline
bool
contiguous
<
char
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
char
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
char
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
unsigned
char
>
()
{
return
true
;}
inline
bool
contiguous
<
unsigned
char
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
unsigned
char
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
unsigned
char
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
short
>
()
{
return
true
;}
inline
bool
contiguous
<
short
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
short
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
short
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
unsigned
short
>
()
{
return
true
;}
inline
bool
contiguous
<
unsigned
short
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
unsigned
short
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
unsigned
short
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
int
>
()
{
return
true
;}
inline
bool
contiguous
<
int
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
int
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
int
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
unsigned
int
>
()
{
return
true
;}
inline
bool
contiguous
<
unsigned
int
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
unsigned
int
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
unsigned
int
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
long
>
()
{
return
true
;}
inline
bool
contiguous
<
long
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
long
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
long
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
unsigned
long
>
()
{
return
true
;}
inline
bool
contiguous
<
unsigned
long
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
unsigned
long
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
unsigned
long
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
long
long
>
()
{
return
true
;}
inline
bool
contiguous
<
long
long
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
long
long
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
long
long
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
unsigned
long
long
>
()
{
return
true
;}
inline
bool
contiguous
<
unsigned
long
long
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
unsigned
long
long
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
unsigned
long
long
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
float
>
()
{
return
true
;}
inline
bool
contiguous
<
float
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
float
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
float
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
double
>
()
{
return
true
;}
inline
bool
contiguous
<
double
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
double
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
double
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
long
double
>
()
{
return
true
;}
inline
bool
contiguous
<
long
double
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
FixedList
<
long
double
,
2
>
>
()
{
return
true
;}
template
<
>
inline
bool
contiguous
<
Pair
<
long
double
>
>
()
{
return
true
;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
src/triSurface/tools/labelledTri/labelledTri.H
View file @
e06bf700
...
...
@@ -105,6 +105,10 @@ public:
};
template
<
>
inline
bool
contiguous
<
labelledTri
>
()
{
return
true
;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
...
...
src/triSurface/tools/labelledTri/labelledTriI.H
View file @
e06bf700
...
...
@@ -58,16 +58,7 @@ inline labelledTri::labelledTri
inline
labelledTri
::
labelledTri
(
Istream
&
is
)
{
// Read beginning of labelledTri point pair
is
.
readBegin
(
"labelledTri"
);
is
>>
static_cast
<
triFace
&>
(
*
this
)
>>
region_
;
// Read end of labelledTri point pair
is
.
readEnd
(
"labelledTri"
);
// Check state of Istream
is
.
check
(
"labelledTri::labelledTri(Istream& is)"
);
operator
>>
(
is
,
*
this
);
}
...
...
@@ -88,13 +79,20 @@ inline label& labelledTri::region()
inline
Istream
&
operator
>>
(
Istream
&
is
,
labelledTri
&
t
)
{
// Read beginning of labelledTri point pair
is
.
readBegin
(
"labelledTri"
);
if
(
is
.
format
()
==
IOstream
::
ASCII
)
{
// Read beginning of labelledTri point pair
is
.
readBegin
(
"labelledTri"
);
is
>>
static_cast
<
triFace
&>
(
t
)
>>
t
.
region_
;
is
>>
static_cast
<
triFace
&>
(
t
)
>>
t
.
region_
;
// Read end of labelledTri point pair
is
.
readEnd
(
"labelledTri"
);
// Read end of labelledTri point pair
is
.
readEnd
(
"labelledTri"
);
}
else
{
is
.
read
(
reinterpret_cast
<
char
*>
(
&
t
),
sizeof
(
labelledTri
));
}
// Check state of Ostream
is
.
check
(
"Istream& operator>>(Istream&, labelledTri&)"
);
...
...
@@ -105,9 +103,24 @@ inline Istream& operator>>(Istream& is, labelledTri& t)
inline
Ostream
&
operator
<<
(
Ostream
&
os
,
const
labelledTri
&
t
)
{
os
<<
token
::
BEGIN_LIST
<<
static_cast
<
const
triFace
&>
(
t
)
<<
token
::
SPACE
<<
t
.
region_
<<
token
::
END_LIST
;
if
(
os
.
format
()
==
IOstream
::
ASCII
)
{
os
<<
token
::
BEGIN_LIST
<<
static_cast
<
const
triFace
&>
(
t
)
<<
token
::
SPACE
<<
t
.
region_
<<
token
::
END_LIST
;
}
else
{
os
.
write
(
reinterpret_cast
<
const
char
*>
(
&
t
),
sizeof
(
labelledTri
)
);
}
// Check state of Ostream
os
.
check
(
"Ostream& operator<<(Ostream&, const labelledTri&)"
);
return
os
;
}
...
...
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