Commit 7176bc05 authored by Spencer Sherwin's avatar Spencer Sherwin
Browse files

Merge branch 'feature/skip-blank-xml' into 'master'

Issue warning and ignore empty XML tags

This MR modifies the session reader logic to ignore empty XML tags which would otherwise replace non-empty tags. This prevents, for example, the empty CONDITIONS section generated by NekMesh from displacing the user-provided conditions if the user condition file is supplied before the mesh file on the command-line.

@ssherw: This has been tested locally and everything passed. Just running through buildbot now.

See merge request !581
parents f4253c1d 453a7e13
......@@ -23,6 +23,7 @@ v4.3.0
- Fix bug with initial conditions of CG simulations using variable P (!543)
- Fix bug in 3DH2D with non-zero Dirichlet boundary conditions (!545)
- Added in a method to convert equispaced interpolated points back to coefficients which requires the introduction of a new StdRegions matrix.(!561)
- Empty XML tags which would override non-empty XML tags are now ignored (!581)
- Add contribution guide (!551)
- Add a filter to calculate exponential moving averages (!566)
......@@ -48,14 +48,20 @@ files as illustrated below:
When specifying multiple files, repeated XML sub-elements are not merged.
The sub-elements from files appearing later in the list will override those
elements from earlier files.
The sub-elements from files appearing later in the list will, in general,
override those elements from earlier files.
For example, the \inlsh{NekMesh} utility will produce a default
\inltt{EXPANSIONS} element and blank \inltt{CONDITIONS} element. Specifying
a custom-written XML file containing these sections \emph{after} the
file produced by \inlsh{NekMesh} will override these defaults.
The exception to this rule is when an empty XML sub-element would override a
non-empty XML sub-element. In this case the empty XML sub-element will be
ignored. If the custom-written XML file containing \inltt{CONDITIONS} were
specified before the file produced by \inlsh{NEKMESH}, the empty
\inltt{CONDITIONS} tag in the latter file would be ignored.
......@@ -1463,12 +1463,26 @@ namespace Nektar
TiXmlElement *vMainEntry =
TiXmlElement *q = new TiXmlElement(*p);
if (vMainEntry)
// First check if the new item is in fact blank
if (!p->FirstChild() && vMainEntry)
std::string warningmsg =
"File " + pFilenames[i] + " contains " +
"an empty XML element " +
std::string(p->Value()) +
" which will be ignored.";
WARNINGL0(false, warningmsg.c_str());
if (vMainEntry)
TiXmlElement *q = new TiXmlElement(*p);
p = p->NextSiblingElement();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment