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: