Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wenqing
ogs
Commits
d1795bf9
Commit
d1795bf9
authored
10 years ago
by
Norihiro Watanabe
Committed by
Dmitri Naumov
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
don't use new lines and tabs in property tree if Boost > 1.55
parent
fa58a4a0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FileIO/XmlIO/Boost/BoostVtuInterface.cpp
+26
-1
26 additions, 1 deletion
FileIO/XmlIO/Boost/BoostVtuInterface.cpp
with
26 additions
and
1 deletion
FileIO/XmlIO/Boost/BoostVtuInterface.cpp
+
26
−
1
View file @
d1795bf9
...
...
@@ -421,8 +421,10 @@ void BoostVtuInterface::addScalarPointProperty(std::string const& name,
return
;
}
#if BOOST_VERSION <= 105500
const
std
::
string
data_array_close
(
"
\t\t\t\t
"
);
const
std
::
string
data_array_indent
(
"
\t\t\t\t
"
);
#endif
// go to the node where data should be inserted
using
boost
::
property_tree
::
ptree
;
...
...
@@ -433,9 +435,13 @@ void BoostVtuInterface::addScalarPointProperty(std::string const& name,
// prepare the data
std
::
stringstream
oss
(
std
::
stringstream
::
out
);
oss
.
precision
(
_out
.
precision
());
#if BOOST_VERSION <= 105500
oss
<<
"
\n
"
<<
data_array_indent
;
std
::
copy
(
prop_vals
.
cbegin
(),
prop_vals
.
cend
(),
std
::
ostream_iterator
<
double
>
(
oss
,
" "
));
oss
<<
"
\n
"
<<
data_array_close
;
#else
std
::
copy
(
prop_vals
.
cbegin
(),
prop_vals
.
cend
(),
std
::
ostream_iterator
<
double
>
(
oss
,
" "
));
#endif
this
->
addDataArray
(
pointdata_node
,
name
,
"Float64"
,
oss
.
str
());
oss
.
str
(
std
::
string
());
}
...
...
@@ -448,8 +454,10 @@ void BoostVtuInterface::buildPropertyTree()
const
std
::
vector
<
MeshLib
::
Node
*>
&
nodes
(
_mesh
->
getNodes
());
const
std
::
vector
<
MeshLib
::
Element
*>
&
elements
(
_mesh
->
getElements
());
#if BOOST_VERSION <= 105500
const
std
::
string
data_array_close
(
"
\t\t\t\t
"
);
const
std
::
string
data_array_indent
(
"
\t\t\t\t
"
);
#endif
using
boost
::
property_tree
::
ptree
;
...
...
@@ -475,21 +483,31 @@ void BoostVtuInterface::buildPropertyTree()
std
::
stringstream
oss
(
std
::
stringstream
::
out
);
oss
.
precision
(
_out
.
precision
());
#if BOOST_VERSION <= 105500
oss
<<
std
::
endl
<<
data_array_indent
;
for
(
unsigned
i
=
0
;
i
<
nElems
;
i
++
)
oss
<<
elements
[
i
]
->
getValue
()
<<
" "
;
oss
<<
std
::
endl
<<
data_array_close
;
#else
for
(
unsigned
i
=
0
;
i
<
nElems
;
i
++
)
oss
<<
elements
[
i
]
->
getValue
()
<<
" "
;
#endif
this
->
addDataArray
(
celldata_node
,
"MaterialIDs"
,
"Int32"
,
oss
.
str
());
oss
.
str
(
std
::
string
());
oss
.
clear
();
// point coordinates
ptree
&
points_node
=
piece_node
.
add
(
"Points"
,
""
);
#if BOOST_VERSION <= 105500
oss
<<
std
::
endl
;
for
(
unsigned
i
=
0
;
i
<
nNodes
;
i
++
)
oss
<<
data_array_indent
<<
(
*
nodes
[
i
])[
0
]
<<
" "
<<
(
*
nodes
[
i
])[
1
]
<<
" "
<<
(
*
nodes
[
i
])[
2
]
<<
std
::
endl
;
oss
<<
data_array_close
;
#else
for
(
unsigned
i
=
0
;
i
<
nNodes
;
i
++
)
oss
<<
(
*
nodes
[
i
])[
0
]
<<
" "
<<
(
*
nodes
[
i
])[
1
]
<<
" "
<<
(
*
nodes
[
i
])[
2
]
<<
" "
;
#endif
this
->
addDataArray
(
points_node
,
"Points"
,
"Float64"
,
oss
.
str
(),
3
);
oss
.
str
(
std
::
string
());
oss
.
clear
();
...
...
@@ -498,26 +516,33 @@ void BoostVtuInterface::buildPropertyTree()
ptree
&
cells_node
=
piece_node
.
add
(
"Cells"
,
""
);
std
::
stringstream
offstream
(
std
::
stringstream
::
out
);
std
::
stringstream
typestream
(
std
::
stringstream
::
out
);
#if BOOST_VERSION <= 105500
oss
<<
std
::
endl
;
offstream
<<
std
::
endl
<<
data_array_indent
;
typestream
<<
std
::
endl
<<
data_array_indent
;
#endif
unsigned
offset_count
(
0
);
for
(
unsigned
i
=
0
;
i
<
nElems
;
i
++
)
{
MeshLib
::
Element
*
element
(
elements
[
i
]);
const
unsigned
nElemNodes
(
element
->
getNBaseNodes
());
#if BOOST_VERSION <= 105500
oss
<<
data_array_indent
;
#endif
for
(
unsigned
j
=
0
;
j
<
nElemNodes
;
j
++
)
oss
<<
element
->
getNode
(
j
)
->
getID
()
<<
" "
;
#if BOOST_VERSION <= 105500
oss
<<
std
::
endl
;
#endif
offset_count
+=
nElemNodes
;
offstream
<<
offset_count
<<
" "
;
typestream
<<
this
->
getVTKElementID
(
element
->
getGeomType
())
<<
" "
;
}
#if BOOST_VERSION <= 105500
oss
<<
data_array_close
;
offstream
<<
std
::
endl
<<
data_array_close
;
typestream
<<
std
::
endl
<<
data_array_close
;
#endif
// connectivity attributes
this
->
addDataArray
(
cells_node
,
"connectivity"
,
"Int32"
,
oss
.
str
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment