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
0ca47c40
Commit
0ca47c40
authored
7 years ago
by
williamfgc
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #168 from williamfgc/xmlpermissive
Makes missing xml file permissive
parents
045c384b
52141202
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!170
Release
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/adios2/helper/adiosString.cpp
+2
-4
2 additions, 4 deletions
source/adios2/helper/adiosString.cpp
source/adios2/helper/adiosString.h
+1
-1
1 addition, 1 deletion
source/adios2/helper/adiosString.h
source/adios2/helper/adiosXML.cpp
+23
-7
23 additions, 7 deletions
source/adios2/helper/adiosXML.cpp
with
26 additions
and
12 deletions
source/adios2/helper/adiosString.cpp
+
2
−
4
View file @
0ca47c40
...
@@ -20,15 +20,13 @@
...
@@ -20,15 +20,13 @@
namespace
adios2
namespace
adios2
{
{
std
::
string
FileToString
(
const
std
::
string
&
fileName
)
std
::
string
FileToString
(
const
std
::
string
&
fileName
)
noexcept
{
{
std
::
ifstream
fileStream
(
fileName
);
std
::
ifstream
fileStream
(
fileName
);
if
(
!
fileStream
)
if
(
!
fileStream
)
{
{
throw
std
::
invalid_argument
(
return
std
::
string
();
// empty string
"ERROR: file "
+
fileName
+
" could not be opened. Check permissions or existence
\n
"
);
}
}
std
::
ostringstream
fileSS
;
std
::
ostringstream
fileSS
;
...
...
This diff is collapsed.
Click to expand it.
source/adios2/helper/adiosString.h
+
1
−
1
View file @
0ca47c40
...
@@ -27,7 +27,7 @@ namespace adios2
...
@@ -27,7 +27,7 @@ namespace adios2
* @param fileName of text file
* @param fileName of text file
* @return file contents in a string
* @return file contents in a string
*/
*/
std
::
string
FileToString
(
const
std
::
string
&
fileName
);
std
::
string
FileToString
(
const
std
::
string
&
fileName
)
noexcept
;
/**
/**
* Transforms a vector to a map of parameters
* Transforms a vector to a map of parameters
...
...
This diff is collapsed.
Click to expand it.
source/adios2/helper/adiosXML.cpp
+
23
−
7
View file @
0ca47c40
...
@@ -196,11 +196,13 @@ Params GetTagAttributesXML(const std::string &tagHeader)
...
@@ -196,11 +196,13 @@ Params GetTagAttributesXML(const std::string &tagHeader)
auto
lf_GetAttributes
=
[
&
](
const
std
::
string
&
tag
)
->
Params
{
auto
lf_GetAttributes
=
[
&
](
const
std
::
string
&
tag
)
->
Params
{
Params
attributes
;
Params
attributes
;
std
::
string
currentTag
(
tag
.
substr
(
tag
.
find_first_of
(
"
\t\n
"
)));
std
::
string
currentTag
(
tag
.
substr
(
tag
.
find_first_of
(
"
\t\n
"
)));
std
::
string
::
size_type
currentPosition
(
0
);
while
(
currentTag
.
find
(
'='
)
!=
currentTag
.
npos
)
// equalPosition
while
(
currentTag
.
find
(
'='
,
currentPosition
)
!=
currentTag
.
npos
)
// equalPosition
{
{
currentTag
=
currentTag
=
currentTag
.
substr
(
currentTag
.
substr
(
currentTag
.
find_first_not_of
(
"
\t\n
"
));
currentTag
.
find_first_not_of
(
"
\t\n
"
,
currentPosition
));
auto
equalPosition
=
currentTag
.
find
(
'='
);
auto
equalPosition
=
currentTag
.
find
(
'='
);
if
(
currentTag
.
size
()
<=
equalPosition
+
1
)
if
(
currentTag
.
size
()
<=
equalPosition
+
1
)
{
{
...
@@ -210,20 +212,28 @@ Params GetTagAttributesXML(const std::string &tagHeader)
...
@@ -210,20 +212,28 @@ Params GetTagAttributesXML(const std::string &tagHeader)
"in call to ADIOS constructor
\n
"
);
"in call to ADIOS constructor
\n
"
);
}
}
const
std
::
string
key
(
currentTag
.
substr
(
0
,
equalPosition
));
std
::
string
key
(
currentTag
.
substr
(
0
,
equalPosition
));
key
.
erase
(
key
.
find_last_not_of
(
"
\t\n
"
)
+
1
);
std
::
string
value
;
std
::
string
value
;
const
char
quote
=
currentTag
[
equalPosition
+
1
];
auto
quotePosition
=
currentTag
.
find_first_not_of
(
"
\t\n
"
,
equalPosition
+
1
);
const
char
quote
=
currentTag
.
at
(
quotePosition
);
if
(
quote
==
'\''
||
quote
==
'"'
)
if
(
quote
==
'\''
||
quote
==
'"'
)
{
{
value
=
lf_GetQuotedValue
(
quote
,
e
qu
al
Position
+
1
,
currentTag
);
value
=
lf_GetQuotedValue
(
quote
,
qu
ote
Position
,
currentTag
);
}
}
else
else
{
{
// throw exception here?
throw
std
::
invalid_argument
(
"ERROR: quote must be
\"
or ' in XML config tag "
+
tag
+
", in call to ADIOS constructor"
);
}
}
attributes
.
emplace
(
key
,
value
);
attributes
.
emplace
(
key
,
value
);
currentPosition
=
quotePosition
+
value
.
size
()
+
1
;
}
}
return
attributes
;
return
attributes
;
};
};
...
@@ -262,6 +272,12 @@ void InitXML(const std::string configXML, const MPI_Comm mpiComm,
...
@@ -262,6 +272,12 @@ void InitXML(const std::string configXML, const MPI_Comm mpiComm,
{
{
// independent IO
// independent IO
std
::
string
fileContents
(
FileToString
(
configXML
));
std
::
string
fileContents
(
FileToString
(
configXML
));
if
(
fileContents
.
empty
())
{
// issue a warning?
return
;
}
RemoveCommentsXML
(
fileContents
);
RemoveCommentsXML
(
fileContents
);
// adios-config
// adios-config
...
...
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