Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
19bd06c8
Commit
19bd06c8
authored
Nov 22, 2016
by
Mark Olesen
Browse files
COMP: adjust vtk formatting for 64-bit labels
parent
87a566c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/fileFormats/vtk/format/foamVtkFormatter.C
View file @
19bd06c8
...
...
@@ -116,7 +116,7 @@ Foam::foamVtkFormatter::openTag(const word& tag)
Foam
::
foamVtkFormatter
&
Foam
::
foamVtkFormatter
::
closeTag
(
bool
isEmpty
)
Foam
::
foamVtkFormatter
::
closeTag
(
const
bool
isEmpty
)
{
if
(
!
inTag_
)
{
...
...
@@ -207,20 +207,23 @@ Foam::foamVtkFormatter&
Foam
::
foamVtkFormatter
::
xmlAttr
(
const
word
&
k
,
const
label
v
,
const
int32_t
v
,
const
char
quote
)
{
if
(
!
inTag_
)
{
WarningInFunction
<<
"xml attribute '"
<<
k
<<
"' but not within a tag!"
<<
endl
;
}
return
xmlAttribute
(
k
,
v
,
quote
);
}
os_
<<
' '
<<
k
<<
'='
<<
quote
<<
v
<<
quote
;
return
*
this
;
Foam
::
foamVtkFormatter
&
Foam
::
foamVtkFormatter
::
xmlAttr
(
const
word
&
k
,
const
int64_t
v
,
const
char
quote
)
{
return
xmlAttribute
(
k
,
v
,
quote
);
}
...
...
@@ -232,16 +235,7 @@ Foam::foamVtkFormatter::xmlAttr
const
char
quote
)
{
if
(
!
inTag_
)
{
WarningInFunction
<<
"xml attribute '"
<<
k
<<
"' but not within a tag!"
<<
endl
;
}
os_
<<
' '
<<
k
<<
'='
<<
quote
<<
v
<<
quote
;
return
*
this
;
return
xmlAttribute
(
k
,
v
,
quote
);
}
...
...
@@ -253,16 +247,7 @@ Foam::foamVtkFormatter::xmlAttr
const
char
quote
)
{
if
(
!
inTag_
)
{
WarningInFunction
<<
"xml attribute '"
<<
k
<<
"' but not within a tag!"
<<
endl
;
}
os_
<<
' '
<<
k
<<
'='
<<
quote
<<
v
<<
quote
;
return
*
this
;
return
xmlAttribute
(
k
,
v
,
quote
);
}
...
...
@@ -283,7 +268,18 @@ Foam::foamVtkFormatter&
Foam
::
foamVtkFormatter
::
operator
()
(
const
word
&
k
,
const
label
v
const
int32_t
v
)
{
return
xmlAttr
(
k
,
v
);
}
Foam
::
foamVtkFormatter
&
Foam
::
foamVtkFormatter
::
operator
()
(
const
word
&
k
,
const
int64_t
v
)
{
return
xmlAttr
(
k
,
v
);
...
...
src/fileFormats/vtk/format/foamVtkFormatter.H
View file @
19bd06c8
...
...
@@ -70,6 +70,16 @@ class foamVtkFormatter
mutable
bool
inTag_
;
//- Write XML attribute
template
<
class
Type
>
foamVtkFormatter
&
xmlAttribute
(
const
word
&
,
const
Type
&
,
const
char
quote
);
protected:
// Protected Member Functions
...
...
@@ -113,9 +123,9 @@ public:
virtual
void
writeSize
(
const
uint64_t
)
=
0
;
virtual
void
write
(
const
uint8_t
)
=
0
;
virtual
void
write
(
const
label
)
=
0
;
virtual
void
write
(
const
float
)
=
0
;
virtual
void
write
(
const
double
)
=
0
;
virtual
void
write
(
const
label
)
=
0
;
virtual
void
write
(
const
float
)
=
0
;
virtual
void
write
(
const
double
)
=
0
;
virtual
void
flush
()
=
0
;
...
...
@@ -136,7 +146,7 @@ public:
//- Close XML tag, optional as an empty container.
// Always adds a trailing newline.
foamVtkFormatter
&
closeTag
(
bool
isEmpty
=
false
);
foamVtkFormatter
&
closeTag
(
const
bool
isEmpty
=
false
);
//- End XML tag, optional with sanity check
// Always adds a trailing newline.
...
...
@@ -164,21 +174,28 @@ public:
}
//- Write XML attribute
foamVtkFormatter
&
xmlAttr
(
const
word
&
,
const
std
::
string
&
,
const
char
quote
=
'\''
const
char
quote
=
'\''
);
//- Write XML attribute
foamVtkFormatter
&
xmlAttr
(
const
word
&
,
const
label
,
const
char
quote
=
'\''
const
int32_t
,
const
char
quote
=
'\''
);
//- Write XML attribute
foamVtkFormatter
&
xmlAttr
(
const
word
&
,
const
int64_t
,
const
char
quote
=
'\''
);
//- Write XML attribute
...
...
@@ -186,7 +203,7 @@ public:
(
const
word
&
,
const
uint64_t
,
const
char
quote
=
'\''
const
char
quote
=
'\''
);
//- Write XML attribute
...
...
@@ -194,7 +211,7 @@ public:
(
const
word
&
,
const
scalar
,
const
char
quote
=
'\''
const
char
quote
=
'\''
);
...
...
@@ -205,7 +222,10 @@ public:
foamVtkFormatter
&
operator
()(
const
word
&
,
const
std
::
string
&
);
//- Write XML attribute
foamVtkFormatter
&
operator
()(
const
word
&
,
const
label
);
foamVtkFormatter
&
operator
()(
const
word
&
,
const
int32_t
);
//- Write XML attribute
foamVtkFormatter
&
operator
()(
const
word
&
,
const
int64_t
);
//- Write XML attribute
foamVtkFormatter
&
operator
()(
const
word
&
,
const
uint64_t
);
...
...
src/fileFormats/vtk/format/foamVtkFormatterTemplates.C
View file @
19bd06c8
...
...
@@ -26,6 +26,28 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
foamVtkFormatter
&
Foam
::
foamVtkFormatter
::
xmlAttribute
(
const
word
&
k
,
const
Type
&
v
,
const
char
quote
)
{
if
(
!
inTag_
)
{
WarningInFunction
<<
"xml attribute '"
<<
k
<<
"' but not within a tag!"
<<
endl
;
}
os_
<<
' '
<<
k
<<
'='
<<
quote
<<
v
<<
quote
;
return
*
this
;
}
template
<
class
Type
,
int
nComp
>
Foam
::
foamVtkFormatter
&
Foam
::
foamVtkFormatter
::
openDataArray
(
...
...
src/fileFormats/vtk/format/foamVtkLegacyFormatter.C
View file @
19bd06c8
...
...
@@ -77,8 +77,9 @@ void Foam::foamVtkLegacyFormatter::writeSize(const uint64_t)
void
Foam
::
foamVtkLegacyFormatter
::
write
(
const
uint8_t
val
)
{
// Can only handle integers
int
copy
(
val
);
// Legacy can only handle 32-bit integers.
// Nonetheless promote to 'label' (32 or 64 bit) and deal with it later
label
copy
(
val
);
write
(
copy
);
}
...
...
Write
Preview
Markdown
is supported
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