From abe634ccf81b2fc66004ec8321432b8c4770b12e Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 4 Nov 2025 15:31:06 +0100 Subject: [PATCH 01/15] enforce refArray regex --- src/coreComponents/codingUtilities/RTTypes.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/codingUtilities/RTTypes.cpp b/src/coreComponents/codingUtilities/RTTypes.cpp index 648f94e6b31..790da49d1d5 100644 --- a/src/coreComponents/codingUtilities/RTTypes.cpp +++ b/src/coreComponents/codingUtilities/RTTypes.cpp @@ -182,6 +182,9 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap() // to reference groups, we need to support the / for paths, and * [ ] for fnmatch patterns. string_view const groupNameRefDesc = "Input value must be a string that can contain only upper/lower letters, digits, and the characters . - _ / * [ ]"; string_view const groupNameRefRegex = "[a-zA-Z0-9.\\-_/*\\[\\]]*"; + // to reference an array of groups, we need to support the / for paths, and * [ ] for fnmatch patterns. + string_view const groupNameRefArrayDesc = "Input value must be a list of strings that can contain only upper/lower letters, digits, and the characters . - _ / * [ ]"; + string_view const groupNameRefArrayRegex = "\\{([a-zA-Z0-9.\\-_/*\\[\\], ]+)*\\}"; // Build master list of regexes @@ -220,7 +223,7 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap() { string( CustomTypes::plotLevel ), Regex( intRegex, intDesc ) }, { string( CustomTypes::groupName ), Regex( groupNameRegex, groupNameDesc ) }, { string( CustomTypes::groupNameRef ), Regex( groupNameRefRegex, groupNameRefDesc ) }, - { string( CustomTypes::groupNameRefArray ), constructArrayRegex( groupNameRefRegex, groupNameRefDesc, 1 ) } + { string( CustomTypes::groupNameRefArray ), Regex( groupNameRefArrayRegex, groupNameRefArrayDesc) } }; return regexMap; } From e03d3408dded9261bbd2267805f147031dc5d25c Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 4 Nov 2025 15:31:14 +0100 Subject: [PATCH 02/15] xsd --- src/coreComponents/schema/schema.xsd | 2 +- src/coreComponents/schema/schema.xsd.other | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index e29fdc5fd0b..10004a7ee73 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -55,7 +55,7 @@ - + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 380d963e2ef..5f22e8b261a 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -55,7 +55,7 @@ - + @@ -516,7 +516,7 @@ - + @@ -1516,7 +1516,7 @@ - + From b015667ea2ef270e8303ace8f1f6c57661f8877d Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 5 Nov 2025 10:09:12 +0100 Subject: [PATCH 03/15] add regex spaces --- src/coreComponents/codingUtilities/RTTypes.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/coreComponents/codingUtilities/RTTypes.cpp b/src/coreComponents/codingUtilities/RTTypes.cpp index 790da49d1d5..f19347c9497 100644 --- a/src/coreComponents/codingUtilities/RTTypes.cpp +++ b/src/coreComponents/codingUtilities/RTTypes.cpp @@ -160,7 +160,7 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap() // ([eE][-+]?[\\d]+|\\s*) matches an optional scientific notation number // Note: the xsd regex implementation does not allow an empty branch, so use allow whitespace at the end string_view const realDesc = "Input value must be a real number (eg. 1, .25, +2.3, -.4, 5.6e7, -8E-9, etc.)"; - string_view const realRegex = "[+-]?[\\d]*([\\d]\\.?|\\.[\\d])[\\d]*([eE][-+]?[\\d]+|\\s*)"; + string_view const realRegex = "\\s*[+-]?[\\d]*([\\d]\\.?|\\.[\\d])[\\d]*([eE][-+]?[\\d]+|\\s*)"; string_view const R1Desc = "Input value must be a R1Tensor, an array of 3 real numbers surrounded by braces and separated by commas (eg. \"{ 1, .25, +2.3}\", \"{ -.4, 5.6e7, -8E-9\", etc.) ."; string const R1Regex = "\\s*\\{\\s*(" + string( realRegex ) + "\\s*,\\s*){2}" + string( realRegex ) + "\\s*\\}\\s*"; @@ -168,23 +168,23 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap() string const R2Regex = "\\s*\\{\\s*(" + string( realRegex ) + "\\s*,\\s*){5}" + string( realRegex ) + "\\s*\\}\\s*"; string_view const strDesc = "Input value must be a string that cannot be empty, contain any whitespaces nor the characters , { }"; - string_view const strRegex = "[^,\\{\\}\\s]+\\s*"; + string_view const strRegex = "\\s*[^,\\{\\}\\s]+\\s*"; string_view const strEDesc = "Input value must be a string that cannot contain any whitespaces nor the characters , { }"; - string_view const strERegex = "[^,\\{\\}\\s]*\\s*"; + string_view const strERegex = "\\s*[^,\\{\\}\\s]*\\s*"; string_view const pathDesc = "Input value must be a string that cannot be empty, contain any whitespaces nor the characters * ? < > | : \" "; - string_view const pathRegex = "[^*?<>\\|:\";,\\s]+\\s*"; + string_view const pathRegex = "\\s*[^*?<>\\|:\";,\\s]+\\s*"; string_view const pathEDesc = "Input value must be a string that cannot contain any whitespaces nor the characters * ? < > | : \" "; - string_view const pathERegex = "[^*?<>\\|:\";,\\s]*\\s*"; + string_view const pathERegex = "\\s*[^*?<>\\|:\";,\\s]*\\s*"; string_view const groupNameDesc = "Input value must be a string that cannot be empty and contains only upper/lower letters, digits, and the characters . - _"; - string_view const groupNameRegex = "[a-zA-Z0-9.\\-_]+"; + string_view const groupNameRegex = "\\s*[a-zA-Z0-9.\\-_]+\\s*"; // to reference groups, we need to support the / for paths, and * [ ] for fnmatch patterns. string_view const groupNameRefDesc = "Input value must be a string that can contain only upper/lower letters, digits, and the characters . - _ / * [ ]"; - string_view const groupNameRefRegex = "[a-zA-Z0-9.\\-_/*\\[\\]]*"; + string_view const groupNameRefRegex = "\\s*[a-zA-Z0-9.\\-_/*\\[\\]]*\\s*"; // to reference an array of groups, we need to support the / for paths, and * [ ] for fnmatch patterns. string_view const groupNameRefArrayDesc = "Input value must be a list of strings that can contain only upper/lower letters, digits, and the characters . - _ / * [ ]"; - string_view const groupNameRefArrayRegex = "\\{([a-zA-Z0-9.\\-_/*\\[\\], ]+)*\\}"; + string_view const groupNameRefArrayRegex = "\\s*\\{([a-zA-Z0-9.\\-_/*\\[\\], ]+)*\\}\\s*"; // Build master list of regexes From 77c7b3e94fee41bb8a28c8c885e0f79fe6c9a976 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 5 Nov 2025 13:50:58 +0100 Subject: [PATCH 04/15] uncrustify --- src/coreComponents/codingUtilities/RTTypes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/codingUtilities/RTTypes.cpp b/src/coreComponents/codingUtilities/RTTypes.cpp index f19347c9497..4634f41724d 100644 --- a/src/coreComponents/codingUtilities/RTTypes.cpp +++ b/src/coreComponents/codingUtilities/RTTypes.cpp @@ -223,7 +223,7 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap() { string( CustomTypes::plotLevel ), Regex( intRegex, intDesc ) }, { string( CustomTypes::groupName ), Regex( groupNameRegex, groupNameDesc ) }, { string( CustomTypes::groupNameRef ), Regex( groupNameRefRegex, groupNameRefDesc ) }, - { string( CustomTypes::groupNameRefArray ), Regex( groupNameRefArrayRegex, groupNameRefArrayDesc) } + { string( CustomTypes::groupNameRefArray ), Regex( groupNameRefArrayRegex, groupNameRefArrayDesc ) } }; return regexMap; } From ff77135aad3c4bf72107a1a4eb3278177bb4c888 Mon Sep 17 00:00:00 2001 From: arng40 Date: Fri, 7 Nov 2025 16:00:09 +0100 Subject: [PATCH 05/15] fix test --- .../unitTests/testXmlWrapper.cpp | 1 - src/coreComponents/schema/schema.xsd | 40 +++++++++---------- src/coreComponents/schema/schema.xsd.other | 40 +++++++++---------- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 087eaf546be..1621d470c0f 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -392,7 +392,6 @@ TEST( testXmlWrapper, testGroupNamesFormats ) GroupNameTest( groupNameRegex, "test name" ), GroupNameTest( groupNameRegex, "test\tname" ), GroupNameTest( groupNameRegex, "testname " ), - GroupNameTest( groupNameRegex, " testname" ), //fordbiden characters GroupNameTest( groupNameRegex, "test/name" ), GroupNameTest( groupNameRegex, "test:name" ), diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index 10004a7ee73..94988f8ce35 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -5,17 +5,17 @@ - + - + - + @@ -45,17 +45,17 @@ - + - + - + @@ -100,72 +100,72 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 5f22e8b261a..1003bd493d3 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -5,17 +5,17 @@ - + - + - + @@ -45,17 +45,17 @@ - + - + - + @@ -100,72 +100,72 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + From b89c41a4ea7f713fedc9827bbd321a91e8519d3b Mon Sep 17 00:00:00 2001 From: arng40 Date: Fri, 21 Nov 2025 14:18:56 +0100 Subject: [PATCH 06/15] add & update test --- .../dataRepository/unitTests/testXmlWrapper.cpp | 7 ++----- src/coreComponents/dataRepository/xmlWrapper.hpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 1621d470c0f..4624553d3c9 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -260,7 +260,6 @@ INSTANTIATE_TEST_SUITE_P( std::make_tuple( "1.234gamma", 0, true ), std::make_tuple( "1.2.3", 0, true ), std::make_tuple( "1e2.3 ", 0, true ), - std::make_tuple( "1 ", 0, true ), std::make_tuple( "1e", 0, true ), std::make_tuple( "1e-", 0, true ), std::make_tuple( "1e+", 0, true ))); @@ -301,7 +300,6 @@ INSTANTIATE_TEST_SUITE_P( std::make_tuple( "1.234gamma", 0, true ), std::make_tuple( "1.2.3", 0, true ), std::make_tuple( "1e2.3 ", 0, true ), - std::make_tuple( "1 ", 0, true ), std::make_tuple( "1e", 0, true ), std::make_tuple( "1e-", 0, true ), std::make_tuple( "1e+", 0, true ))); @@ -325,7 +323,6 @@ INSTANTIATE_TEST_SUITE_P( std::make_tuple( "alpha", 0, true ), std::make_tuple( "1beta234", 0, true ), std::make_tuple( "1234gamma", 0, true ), - std::make_tuple( "1 ", 0, true ), std::make_tuple( "1 2", 0, true ))); @@ -375,11 +372,12 @@ TEST( testXmlWrapper, testGroupNamesFormats ) GroupNameTest( groupNameRegex, "test_name" ), GroupNameTest( groupNameRegex, "test-name" ), GroupNameTest( groupNameRegex, "test.name" ), + GroupNameTest( groupNameRegex, " test.name" ), + GroupNameTest( groupNameRegex, " test.name " ), }; for( GroupNameTest const & input : workingInputs ) { EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); - EXPECT_STREQ( input.m_valueToTest.c_str(), groupName.c_str() ); } } { @@ -391,7 +389,6 @@ TEST( testXmlWrapper, testGroupNamesFormats ) //white spaces GroupNameTest( groupNameRegex, "test name" ), GroupNameTest( groupNameRegex, "test\tname" ), - GroupNameTest( groupNameRegex, "testname " ), //fordbiden characters GroupNameTest( groupNameRegex, "test/name" ), GroupNameTest( groupNameRegex, "test:name" ), diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index 011836ad01f..c831fcbc009 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -354,7 +354,7 @@ stringToInputVariable( T & target, string const & value, Regex const & regex ) std::istringstream ss( value ); ss >> target; - GEOS_THROW_IF( ss.fail() || !ss.eof(), + GEOS_THROW_IF( ss.fail(), "Error detected while parsing string \"" << value << "\" to type " << LvArray::system::demangleType< T >(), InputError ); From 95710e33a44b21726c972d3b2336f01a4e1a71f8 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 2 Dec 2025 17:15:02 +0100 Subject: [PATCH 07/15] add tests and update validation regex --- .../unitTests/testXmlWrapper.cpp | 89 ++++++++++ .../dataRepository/xmlWrapper.hpp | 4 +- src/coreComponents/schema/schema.xsd | 154 ++++++++++++++++++ src/coreComponents/schema/schema.xsd.other | 46 ++++++ 4 files changed, 291 insertions(+), 2 deletions(-) diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 4624553d3c9..ccb690a70f7 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -378,6 +378,10 @@ TEST( testXmlWrapper, testGroupNamesFormats ) for( GroupNameTest const & input : workingInputs ) { EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); + std::string groupNameComp; + std::istringstream ss( input.m_valueToTest ); + ss >> groupNameComp >> std::ws; + EXPECT_STREQ( groupNameComp.c_str(), groupName.c_str() ); } } { @@ -403,6 +407,91 @@ TEST( testXmlWrapper, testGroupNamesFormats ) } } } +TEST( testXmlWrapper, testGroupNamesArrayFormats ) +{ + struct GroupNameTest + { + Regex const & m_regex; + string m_valueToTest; + GroupNameTest( Regex const & regex, string_view valueToTest ): + m_regex( regex ), m_valueToTest( valueToTest ) {} + }; + + Regex const & groupNameRefArrayRegex = rtTypes::getTypeRegex< string >( rtTypes::CustomTypes::groupNameRefArray ); + string groupName; + + { + stdVector< GroupNameTest > workingInputs = { + GroupNameTest( groupNameRefArrayRegex, "{}" ), + GroupNameTest( groupNameRefArrayRegex, " {} " ), + GroupNameTest( groupNameRefArrayRegex, " \t {} \n " ), + GroupNameTest( groupNameRefArrayRegex, "{groupName}" ), + GroupNameTest( groupNameRefArrayRegex, "{123name}" ), + GroupNameTest( groupNameRefArrayRegex, "{name123}" ), + GroupNameTest( groupNameRefArrayRegex, "{a-Z0-9./*[]-_,}" ), + GroupNameTest( groupNameRefArrayRegex, "{name.with-special_chars}" ), + GroupNameTest( groupNameRefArrayRegex, "{path/to/resource*}" ), + GroupNameTest( groupNameRefArrayRegex, "{[arrayElement]}" ), + GroupNameTest( groupNameRefArrayRegex, "{name1,name2,name3}" ), + }; + for( GroupNameTest const & input : workingInputs ) + { + EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); + std::string groupNameComp; + std::istringstream ss( input.m_valueToTest ); + ss >> groupNameComp >> std::ws; + EXPECT_STREQ( groupNameComp.c_str(), groupName.c_str() ); + } + } + { + stdVector< GroupNameTest > erroneousInputs = { + GroupNameTest( groupNameRefArrayRegex, "" ), + GroupNameTest( groupNameRefArrayRegex, " " ), + GroupNameTest( groupNameRefArrayRegex, " \t " ), + GroupNameTest( groupNameRefArrayRegex, "{\t}" ), + GroupNameTest( groupNameRefArrayRegex, "{test:name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test;name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test\\name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test|name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test^name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test$name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test&name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test#name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test!name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test%name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test@name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test(name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test)name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test=name}" ), + GroupNameTest( groupNameRefArrayRegex, "{test+name}" ), + GroupNameTest( groupNameRefArrayRegex, "{testname}" ), + GroupNameTest( groupNameRefArrayRegex, "{test\tname}" ), + GroupNameTest( groupNameRefArrayRegex, "{test\nname}" ), + GroupNameTest( groupNameRefArrayRegex, "{test\rname}" ), + GroupNameTest( groupNameRefArrayRegex, "groupName" ), + GroupNameTest( groupNameRefArrayRegex, "{groupName" ), + GroupNameTest( groupNameRefArrayRegex, "groupName}" ), + GroupNameTest( groupNameRefArrayRegex, "{groupName}} " ), + GroupNameTest( groupNameRefArrayRegex, "{}groupName" ), + GroupNameTest( groupNameRefArrayRegex, "groupName{}" ), + GroupNameTest( groupNameRefArrayRegex, "test{groupName}" ), + GroupNameTest( groupNameRefArrayRegex, "{groupName}test" ), + GroupNameTest( groupNameRefArrayRegex, "{groupName} test" ), + GroupNameTest( groupNameRefArrayRegex, "{element with space, another}" ), + GroupNameTest( groupNameRefArrayRegex, "{element, element with space, 123.456, a-b}" ), + GroupNameTest( groupNameRefArrayRegex, "{ space at ends } " ), + GroupNameTest( groupNameRefArrayRegex, "{ value with , commas }" ), + GroupNameTest( groupNameRefArrayRegex, "{{groupname}}" ), + }; + for( GroupNameTest const & input : erroneousInputs ) + { + EXPECT_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ), + InputError ) << "Parsing input '"<< input.m_valueToTest + << "' with regex '" << input.m_regex.m_regexStr << "' didn't throw an InputError as expected."; + } + } +} int main( int argc, char * argv[] ) diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index c831fcbc009..b3200202ae3 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -353,8 +353,8 @@ stringToInputVariable( T & target, string const & value, Regex const & regex ) validateString( value, regex ); std::istringstream ss( value ); - ss >> target; - GEOS_THROW_IF( ss.fail(), + ss >> target >> std::ws; + GEOS_THROW_IF( ss.fail() || !ss.eof(), "Error detected while parsing string \"" << value << "\" to type " << LvArray::system::demangleType< T >(), InputError ); diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index f57aa7aa67b..c0be96ea78a 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -463,6 +463,10 @@ + + + + @@ -491,6 +495,10 @@ + + + + @@ -569,6 +577,10 @@ + + + + @@ -581,6 +593,10 @@ + + + + @@ -2740,6 +2756,7 @@ Information output from lower logLevels is added with the desired log level + @@ -2747,6 +2764,7 @@ Information output from lower logLevels is added with the desired log level + @@ -5028,6 +5046,60 @@ Local- Add jump stabilization on interior of macro elements--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5368,6 +5440,60 @@ Local- Add jump stabilization on interior of macro elements--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5912,9 +6038,11 @@ When set to `all` output both convergence & iteration information to a csv.--> + + @@ -6108,6 +6236,19 @@ Information output from lower logLevels is added with the desired log level + + + + + + + + + + + + + + + + + + + + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 5e8f9ac4725..780af954a61 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -595,6 +595,7 @@ A field can represent a physical variable. (pressure, temperature, global compos + @@ -602,6 +603,7 @@ A field can represent a physical variable. (pressure, temperature, global compos + @@ -1209,6 +1211,17 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + + + + + + @@ -1284,6 +1297,17 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + + + + + + @@ -1452,9 +1476,11 @@ A field can represent a physical variable. (pressure, temperature, global compos + + @@ -1484,9 +1510,11 @@ A field can represent a physical variable. (pressure, temperature, global compos + + @@ -3559,6 +3587,12 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + @@ -3573,14 +3607,26 @@ A field can represent a physical variable. (pressure, temperature, global compos + + + + + + + + + + + + From f2724e4de42422201d76b83b0a6274e973c82c71 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 2 Dec 2025 17:19:05 +0100 Subject: [PATCH 08/15] add test for refArray --- src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index ccb690a70f7..23dfb023753 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -481,6 +481,7 @@ TEST( testXmlWrapper, testGroupNamesArrayFormats ) GroupNameTest( groupNameRefArrayRegex, "{element with space, another}" ), GroupNameTest( groupNameRefArrayRegex, "{element, element with space, 123.456, a-b}" ), GroupNameTest( groupNameRefArrayRegex, "{ space at ends } " ), + GroupNameTest( groupNameRefArrayRegex, "{valuewith,,commas }" ), GroupNameTest( groupNameRefArrayRegex, "{ value with , commas }" ), GroupNameTest( groupNameRefArrayRegex, "{{groupname}}" ), }; From c5513f4ac5188868317b9b9c4a54db45af972fa5 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 2 Dec 2025 17:21:30 +0100 Subject: [PATCH 09/15] uncrust --- src/coreComponents/dataRepository/xmlWrapper.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index b3200202ae3..2f1b853f9ad 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -354,7 +354,7 @@ stringToInputVariable( T & target, string const & value, Regex const & regex ) std::istringstream ss( value ); ss >> target >> std::ws; - GEOS_THROW_IF( ss.fail() || !ss.eof(), + GEOS_THROW_IF( ss.fail() || !ss.eof(), "Error detected while parsing string \"" << value << "\" to type " << LvArray::system::demangleType< T >(), InputError ); From 1a51f53a53e99be744b47bbcab9f89ba5cd45edb Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 3 Dec 2025 17:02:09 +0100 Subject: [PATCH 10/15] try to remove std::ws --- src/coreComponents/dataRepository/xmlWrapper.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index 2f1b853f9ad..011836ad01f 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -353,7 +353,7 @@ stringToInputVariable( T & target, string const & value, Regex const & regex ) validateString( value, regex ); std::istringstream ss( value ); - ss >> target >> std::ws; + ss >> target; GEOS_THROW_IF( ss.fail() || !ss.eof(), "Error detected while parsing string \"" << value << "\" to type " << LvArray::system::demangleType< T >(), From 05c7ae133baf07662b258060eb52c0a9ab9f2ea2 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 3 Dec 2025 17:25:33 +0100 Subject: [PATCH 11/15] try to trimed --- src/coreComponents/dataRepository/xmlWrapper.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index 011836ad01f..77c9af96a1f 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -350,9 +350,10 @@ template< typename T > std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > stringToInputVariable( T & target, string const & value, Regex const & regex ) { - validateString( value, regex ); + string_view stringTrimed = stringutilities::trimSpaces(value); + validateString( string(stringTrimed), regex ); - std::istringstream ss( value ); + std::istringstream ss( (string(stringTrimed)) ); ss >> target; GEOS_THROW_IF( ss.fail() || !ss.eof(), "Error detected while parsing string \"" << value << From 332370c6c97b460311bbc3fcaebc4305d6119765 Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 4 Dec 2025 16:50:35 +0100 Subject: [PATCH 12/15] uncrustify --- src/coreComponents/dataRepository/xmlWrapper.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index 77c9af96a1f..b82a0a5596e 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -350,10 +350,10 @@ template< typename T > std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > stringToInputVariable( T & target, string const & value, Regex const & regex ) { - string_view stringTrimed = stringutilities::trimSpaces(value); - validateString( string(stringTrimed), regex ); + string_view stringTrimed = stringutilities::trimSpaces( value ); + validateString( string( stringTrimed ), regex ); - std::istringstream ss( (string(stringTrimed)) ); + std::istringstream ss( (string( stringTrimed )) ); ss >> target; GEOS_THROW_IF( ss.fail() || !ss.eof(), "Error detected while parsing string \"" << value << From 3dafc57eab6755f7cac166a0ecff081607f9a9a3 Mon Sep 17 00:00:00 2001 From: arng40 Date: Fri, 5 Dec 2025 14:58:04 +0100 Subject: [PATCH 13/15] review adressed --- .../codingUtilities/RTTypes.cpp | 2 +- .../unitTests/testXmlWrapper.cpp | 15 +++++++-- .../dataRepository/xmlWrapper.hpp | 3 +- src/coreComponents/schema/schema.xsd | 31 ++++++++++--------- src/coreComponents/schema/schema.xsd.other | 26 ++++++++-------- 5 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/coreComponents/codingUtilities/RTTypes.cpp b/src/coreComponents/codingUtilities/RTTypes.cpp index 4634f41724d..415a494b1d4 100644 --- a/src/coreComponents/codingUtilities/RTTypes.cpp +++ b/src/coreComponents/codingUtilities/RTTypes.cpp @@ -151,7 +151,7 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap() // string_view const ru = "[\\d]+";// unused string_view const intDesc = "Input value must be a signed int (eg. -123, 455, +789, etc.)"; - string_view const intRegex = "[+-]?[\\d]+"; + string_view const intRegex = "\\s*[+-]?[\\d]+\\s*"; // Explanation of parts: // [+-]?[\\d]* matches an optional +/- at the beginning, any numbers preceding the decimal diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 23dfb023753..948f6cc7224 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -243,6 +243,9 @@ INSTANTIATE_TEST_SUITE_P( real64AttributeTests, real64AttributeTestFixture, ::testing::Values( std::make_tuple( "1", 1, false ), + std::make_tuple( "1 ", 1, false ), + std::make_tuple( " 1", 1, false ), + std::make_tuple( " 1 ", 1, false ), std::make_tuple( "-23", -23, false ), std::make_tuple( "4.5", 4.5, false ), std::make_tuple( "4.", 4.0, false ), @@ -283,6 +286,9 @@ INSTANTIATE_TEST_SUITE_P( real32AttributeTests, real32AttributeTestFixture, ::testing::Values( std::make_tuple( "1", 1, false ), + std::make_tuple( "1 ", 1, false ), + std::make_tuple( " 1", 1, false ), + std::make_tuple( " 1 ", 1, false ), std::make_tuple( "-23", -23, false ), std::make_tuple( "4.5", 4.5, false ), std::make_tuple( "4.", 4.0, false ), @@ -317,6 +323,9 @@ INSTANTIATE_TEST_SUITE_P( integerAttributeTests, integerAttributeTestFixture, ::testing::Values( std::make_tuple( "1", 1, false ), + std::make_tuple( "1 ", 1, false ), + std::make_tuple( " 1", 1, false ), + std::make_tuple( " 1 ", 1, false ), std::make_tuple( "-23", -23, false ), std::make_tuple( "4.5", 0, true ), std::make_tuple( "4.", 0, true ), @@ -371,9 +380,8 @@ TEST( testXmlWrapper, testGroupNamesFormats ) GroupNameTest( groupNameRegex, "testname01" ), GroupNameTest( groupNameRegex, "test_name" ), GroupNameTest( groupNameRegex, "test-name" ), - GroupNameTest( groupNameRegex, "test.name" ), - GroupNameTest( groupNameRegex, " test.name" ), - GroupNameTest( groupNameRegex, " test.name " ), + GroupNameTest( groupNameRegex, " testname " ), + GroupNameTest( groupNameRegex, " \t testname \n " ), }; for( GroupNameTest const & input : workingInputs ) { @@ -475,6 +483,7 @@ TEST( testXmlWrapper, testGroupNamesArrayFormats ) GroupNameTest( groupNameRefArrayRegex, "{groupName}} " ), GroupNameTest( groupNameRefArrayRegex, "{}groupName" ), GroupNameTest( groupNameRefArrayRegex, "groupName{}" ), + GroupNameTest( groupNameRefArrayRegex, "{hello, \t\n\r ,world}" ), GroupNameTest( groupNameRefArrayRegex, "test{groupName}" ), GroupNameTest( groupNameRefArrayRegex, "{groupName}test" ), GroupNameTest( groupNameRefArrayRegex, "{groupName} test" ), diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index b82a0a5596e..5955d95e7f5 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -350,9 +350,8 @@ template< typename T > std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > stringToInputVariable( T & target, string const & value, Regex const & regex ) { + validateString( value, regex ); string_view stringTrimed = stringutilities::trimSpaces( value ); - validateString( string( stringTrimed ), regex ); - std::istringstream ss( (string( stringTrimed )) ); ss >> target; GEOS_THROW_IF( ss.fail() || !ss.eof(), diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index c0be96ea78a..e32bfc23232 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -20,27 +20,27 @@ - + - + - + - + - + @@ -60,42 +60,42 @@ - + - + - + - + - + - + - + - + @@ -3653,8 +3653,9 @@ Information output from lower logLevels is added with the desired log level +Frequency of pressure update is set in SinglePhase/CompositionalMultiphaseStatistics definition. +Setting cycleFrequency='1' will update the pressure every timestep, note that is a lagged property in constraint propertiesNote the event associated with the statists task must be entered before the solver event. +--> diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 780af954a61..7754be635ab 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -20,27 +20,27 @@ - + - + - + - + - + @@ -60,42 +60,42 @@ - + - + - + - + - + - + - + - + From 4a0891542fb0ee61510e4aed7155ecdd61e24b51 Mon Sep 17 00:00:00 2001 From: arng40 Date: Fri, 19 Dec 2025 16:51:07 +0100 Subject: [PATCH 14/15] remove useless code & add test for non array --- .../dataRepository/unitTests/testXmlWrapper.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 948f6cc7224..95606cca7d1 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -386,10 +386,7 @@ TEST( testXmlWrapper, testGroupNamesFormats ) for( GroupNameTest const & input : workingInputs ) { EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); - std::string groupNameComp; - std::istringstream ss( input.m_valueToTest ); - ss >> groupNameComp >> std::ws; - EXPECT_STREQ( groupNameComp.c_str(), groupName.c_str() ); + EXPECT_STREQ( groupName.c_str(), groupName.c_str() ); } } { @@ -406,6 +403,8 @@ TEST( testXmlWrapper, testGroupNamesFormats ) GroupNameTest( groupNameRegex, "test:name" ), GroupNameTest( groupNameRegex, "test;name" ), GroupNameTest( groupNameRegex, "test\\name" ), + GroupNameTest( groupNameRegex, "{[arrayElement]}" ), + GroupNameTest( groupNameRegex, "{name1,name2,name3}" ), }; for( GroupNameTest const & input : erroneousInputs ) { @@ -445,10 +444,7 @@ TEST( testXmlWrapper, testGroupNamesArrayFormats ) for( GroupNameTest const & input : workingInputs ) { EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); - std::string groupNameComp; - std::istringstream ss( input.m_valueToTest ); - ss >> groupNameComp >> std::ws; - EXPECT_STREQ( groupNameComp.c_str(), groupName.c_str() ); + EXPECT_STREQ( groupName.c_str(), groupName.c_str() ); } } { From 26988aeca9a279f9f68ba8ea930ca3de69ca28f8 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 7 Jan 2026 11:31:37 +0100 Subject: [PATCH 15/15] remove assert --- .../dataRepository/unitTests/testXmlWrapper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 95606cca7d1..b6ca71e227d 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -385,8 +385,9 @@ TEST( testXmlWrapper, testGroupNamesFormats ) }; for( GroupNameTest const & input : workingInputs ) { - EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); - EXPECT_STREQ( groupName.c_str(), groupName.c_str() ); + EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ) + << "Parsing input '"<< input.m_valueToTest + << "' with regex '" << input.m_regex.m_regexStr << "' didn't throw an InputError as expected.";; } } { @@ -444,7 +445,6 @@ TEST( testXmlWrapper, testGroupNamesArrayFormats ) for( GroupNameTest const & input : workingInputs ) { EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); - EXPECT_STREQ( groupName.c_str(), groupName.c_str() ); } } {