Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADIOS2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
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
Podhorszki, Norbert
ADIOS2
Commits
a018c887
Commit
a018c887
authored
7 years ago
by
William F Godoy
Browse files
Options
Downloads
Patches
Plain Diff
String variable read write example
parent
cd52328b
No related branches found
No related tags found
1 merge request
!318
String variable support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/hello/bpTimeWriter/helloBPTimeWriter.cpp
+18
-3
18 additions, 3 deletions
examples/hello/bpTimeWriter/helloBPTimeWriter.cpp
with
18 additions
and
3 deletions
examples/hello/bpTimeWriter/helloBPTimeWriter.cpp
+
18
−
3
View file @
a018c887
...
...
@@ -96,7 +96,10 @@ int main(int argc, char *argv[])
"Hello from rank: "
+
std
::
to_string
(
rank
)
+
" and timestep: "
+
std
::
to_string
(
timeStep
));
bpWriter
.
PutSync
(
bpString
,
myString
);
if
(
rank
==
0
)
{
bpWriter
.
PutSync
(
bpString
,
myString
);
}
bpWriter
.
EndStep
();
}
...
...
@@ -116,6 +119,9 @@ int main(int argc, char *argv[])
adios2
::
Variable
<
float
>
*
bpFloats000
=
ioReader
.
InquireVariable
<
float
>
(
"bpFloats000"
);
adios2
::
Variable
<
std
::
string
>
*
bpString
=
ioReader
.
InquireVariable
<
std
::
string
>
(
"bpString"
);
if
(
bpFloats000
!=
nullptr
)
{
bpFloats000
->
SetSelection
({{
rank
*
Nx
},
{
Nx
}});
...
...
@@ -125,7 +131,7 @@ int main(int argc, char *argv[])
bpReader
.
GetSync
(
*
bpFloats000
,
data
.
data
());
std
::
cout
<<
"Data timestep "
<<
bpFloats000
->
m_StepsStart
<<
" from rank "
<<
rank
<<
"
\n
"
;
<<
" from rank "
<<
rank
<<
"
:
"
;
for
(
const
auto
datum
:
data
)
{
std
::
cout
<<
datum
<<
" "
;
...
...
@@ -136,8 +142,17 @@ int main(int argc, char *argv[])
{
std
::
cout
<<
"Variable bpFloats000 not found
\n
"
;
}
if
(
bpString
!=
nullptr
)
{
bpString
->
SetStepSelection
({
3
,
1
});
std
::
string
myString
;
bpReader
.
GetSync
(
*
bpString
,
myString
);
std
::
cout
<<
myString
<<
"
\n
"
;
}
bpReader
.
Close
();
//}
}
}
catch
(
std
::
invalid_argument
&
e
)
...
...
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