forked from trilinos/Trilinos
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test yaml-cpp parser #219
Open
cwschilly
wants to merge
14
commits into
develop
Choose a base branch
from
yaml-parser
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test yaml-cpp parser #219
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements an optional
yaml-cpp
parser.This PR should not be merged; its source code changes have been added to Trilinos PR #12599.
Current status
I am testing these by running MiniEM with the following input files:
-
maxwell-pthOrder.xml
-
maxwell-pthOrder-oldyaml.yaml
-
maxwell-pthOrder-newyaml.yaml
This table represents the testing status. We expect all tests to pass except
yaml-cpp Off
xnew yaml
.The difference between the old yaml and new yaml is this block:
General Notes
Teuchos_YamlParser.cpp
came from this commit, which removed yaml-cpp from Trilinos in 2017. I mainly "undid" these changes, with some other additions and the introduction of#ifdef
directives.Regarding Teuchos::Array
The original yaml-cpp parser (referenced above) could only support 1-D or 2-D Teuchos::Arrays. This meant that ragged arrays and higher dimensional arrays could not be parsed.
In the event of the user having a simple 1- or 2-D array in the yaml, the parser will create either a standard
Teuchos::Array
or aTeuchos::TwoDArray
.For the other cases, I've defined functions (
getYaml2DRaggedArray
andgetYaml3DArray
) that return Teuchos::Arrays of Teuchos::Arrays (of Teuchos::Arrays, in the 3D case).Regarding CMake
LIB_OPTIONAL_TPL
in the TeuchosCore package.HAVE_TEUCHOSCORE_YAMLCPP
macro, which allows for#ifdef
statements.Regarding Changes to Source Code
In order to use a yaml input file, some changes were required in the
MiniEM
source code.Originally,
seed
was read directly in as anunsigned int
, with the xml input files specifying its type. Since yaml does not allow for types besidesint
,double
, andstring
, I had to change the code to accept anint
and then cast it as anunsigned int
.int
as well.BlockPrec/main.cpp
now contains the option to parse yaml inputs: