Skip to content

Commit

Permalink
Merge pull request #596 from thelfer/370-tfelutilities-support-for-c+…
Browse files Browse the repository at this point in the history
…+-digit-separator

Fix Issue #370
  • Loading branch information
thelfer authored Jun 28, 2024
2 parents 64c2da4 + a5b2fc5 commit e6f6eaa
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
32 changes: 31 additions & 1 deletion docs/web/release-notes-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,35 @@ secPrefixTemplate: "$$i$$"
eqnPrefixTemplate: "($$i$$)"
---

# New `TFEL/Utilities` features

## Support for `C++` digit separator in `CxxTokenizer`

The `CxxTokenizer` class now supports `C++` digit separators in numbers,
(integer of floatting point numbers), as illustrated in the following
example:

~~~~{.cxx}
@DSL IsotropicMisesCreep;
@Behaviour DigitSeparatorTest;
@UseQt true;
@Epsilon 0.000'000'000'1;
@IterMax 1'000;
@ElasticMaterialProperties{150'000'000'000, 0.3};
@Parameter stress s0 = 10'000'000;
@Parameter strainrate de0 = 8.230'512e-67;
@Parameter strainrate E = 8.2;
@FlowRule{
f = de0 * pow(seq / s0, E);
}
~~~~

# New `TFEL/Math` features

## tiny matrices product
## Tiny matrices product

The product of two tiny matrices has been implemented:

Expand Down Expand Up @@ -287,3 +313,7 @@ For more details, see <https://github.com/thelfer/tfel/issues/526>
## Issue 476: [generic interface] Add support for arrays of thermodynamic forces
For more details, see <https://github.com/thelfer/tfel/issues/476>
## Issue 370: [tfel-utilities] Support for `C++` digit separator
For more details, see <https://github.com/thelfer/tfel/issues/370>
1 change: 1 addition & 0 deletions mfront/tests/behaviours/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ endif(HAVE_DIANAFEA)

configure_file(PolyCrystals_DD_CC.mfront PolyCrystals_DD_CC.mfront.in @ONLY)

install_mfront_data(tests/behaviours DigitSeparatorTest.mfront)
install_mfront_data(tests/behaviours DSLOptionsTest.mfront)
install_mfront_data(tests/behaviours MaterialPropertiesBoundsCheck.mfront)
install_mfront_data(tests/behaviours StateVariablesBoundsCheck.mfront)
Expand Down
14 changes: 14 additions & 0 deletions mfront/tests/behaviours/DigitSeparatorTest.mfront
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@DSL IsotropicMisesCreep;
@Behaviour DigitSeparatorTest;

@Epsilon 0.000'000'000'1;
@IterMax 1'000;

@ElasticMaterialProperties{150'000'000'000, 0.3};
@Parameter stress s0 = 10'000'000;
@Parameter strainrate de0 = 8.230'512e-67;
@Parameter strainrate E = 8.2;

@FlowRule{
f = de0 * pow(seq / s0, E);
}
1 change: 1 addition & 0 deletions mfront/tests/behaviours/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ configure_file("${PROJECT_SOURCE_DIR}/mfront/tests/behaviours/references/PolyCry
PolyCrystalsAngles-30.txt @ONLY)

set(mfront_tests_SOURCES
DigitSeparatorTest
MaterialPropertiesBoundsCheck
StateVariablesBoundsCheck
ExternalStateVariablesBoundsCheck
Expand Down
3 changes: 2 additions & 1 deletion src/Utilities/CxxTokenizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,8 @@ namespace tfel::utilities {
}
}
throw_if((p != pe) && (*p == '.'), "invalid number");
this->tokens.emplace_back(std::string{b, p}, n, o, Token::Number);
this->tokens.emplace_back(replace_all(std::string{b, p}, "\'", ""), n, o,
Token::Number);
const auto d = p - b;
p = b;
advance(o, p, d);
Expand Down

0 comments on commit e6f6eaa

Please sign in to comment.