Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
5c461dc9
Commit
5c461dc9
authored
Jun 05, 2017
by
Kirill Terekhov
Browse files
Avoid data name with spaces writing VTK
parent
50bc6804
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/IO/mesh_vtk_file.cpp
View file @
5c461dc9
...
...
@@ -51,6 +51,16 @@ void ReadCoords(FILE * f,INMOST_DATA_REAL_TYPE c[3])
namespace
INMOST
{
std
::
string
Space2Underscore
(
const
std
::
string
&
inp
)
{
std
::
string
ret
=
inp
;
for
(
size_t
k
=
0
;
k
<
ret
.
size
();
++
k
)
{
if
(
ret
[
k
]
==
' '
)
ret
[
k
]
=
'_'
;
}
return
ret
;
}
int
VtkElementType
(
ElementType
t
)
{
...
...
@@ -346,7 +356,7 @@ safe_output:
||
tags
[
i
].
GetDataType
()
==
DATA_VARIABLE
#endif
)
type_str
=
"double"
;
fprintf
(
f
,
"SCALARS %s %s %d
\n
"
,
tags
[
i
].
GetTagName
().
c_str
(),
type_str
.
c_str
(),
comps
);
fprintf
(
f
,
"SCALARS %s %s %d
\n
"
,
Space2Underscore
(
tags
[
i
].
GetTagName
()
)
.
c_str
(),
type_str
.
c_str
(),
comps
);
fprintf
(
f
,
"LOOKUP_TABLE default
\n
"
);
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
{
...
...
@@ -478,7 +488,7 @@ safe_output:
unsigned
int
comps
=
tags
[
i
].
GetSize
();
if
(
comps
==
ENUMUNDEF
)
{
//printf("Warning: vtk don't support arrays of variable size (tag name: %s)\n",tags[i].
GetTagName
().c_str());
//printf("Warning: vtk don't support arrays of variable size (tag name: %s)\n",tags[i].
\
().c_str());
continue
;
}
else
...
...
@@ -490,7 +500,7 @@ safe_output:
||
tags
[
i
].
GetDataType
()
==
DATA_VARIABLE
#endif
)
type_str
=
"double"
;
fprintf
(
f
,
"SCALARS %s %s %d
\n
"
,
tags
[
i
].
GetTagName
().
c_str
(),
type_str
.
c_str
(),
comps
);
fprintf
(
f
,
"SCALARS %s %s %d
\n
"
,
Space2Underscore
(
tags
[
i
].
GetTagName
()
)
.
c_str
(),
type_str
.
c_str
(),
comps
);
fprintf
(
f
,
"LOOKUP_TABLE default
\n
"
);
for
(
Mesh
::
iteratorNode
it
=
BeginNode
();
it
!=
EndNode
();
it
++
)
{
...
...
@@ -692,7 +702,7 @@ safe_output:
t
=
DATA_REAL
;
else
{
std
::
cout
<<
__FILE__
<<
":"
<<
__LINE__
<<
" unexpected data type "
<<
attrtype
<<
" in "
<<
File
<<
std
::
endl
;
std
::
cout
<<
__FILE__
<<
":"
<<
__LINE__
<<
" unexpected data type "
<<
attrtype
<<
" in "
<<
File
<<
" for "
<<
attrname
<<
std
::
endl
;
std
::
cout
<<
"expected one of: bit, unsigned_char, char, unsigned_short, short, unsigned_int, int, unsigned_long, long, float, double"
<<
std
::
endl
;
throw
BadFile
;
}
...
...
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