Commit Graph

92 Commits

Author SHA1 Message Date
Ladislav Michl
49ce1e0449 Base: Quantity: use std::nan 2024-12-23 17:48:42 +01:00
Ladislav Michl
3bddb723d5 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
0b3adee2ab Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
379d7ea9d5 Base: Units: return std::string 2024-12-23 17:48:42 +01:00
wmayer
defc6cd906 Base: Fix memory leak in Quantity::parse
If an exception is thrown then the allocated buffer won't be cleaned up. To make this exception-safe the class
StringBufferCleaner is added using the RAII idiom
2024-04-25 14:34:02 +02:00
Adrián Insaurralde Avalos
592b31eb7b Base: escape quotes in Quantity::getSafeUserString
fix #12204 and fix #12206
2024-02-12 12:09:30 -06:00
Chris Hennes
cfd41683a5 Core: Enable compiling with MSVC /permissive- (#11014)
* Base: Fixes for MSVC permissive-

* App: Fixes for MSVC permissive-

* Gui: Fixes for MSVC permissive-

* Main: Fixes for MSVC permissive-

* Fem: Fixes for MSVC permissive-

* Material: Fixes for MSVC permissive-

* Part: Fixes for MSVC permissive-

* Mesh: Fixes for MSVC permissive-

* Points: Fixes for MSVC permissive-

* Robot: Fixes for MSVC permissive-

* TechDraw: Fixes for MSVC permissive-

* Path: Fixes for MSVC permissive-

* Core; Changes per review comments

* TD: Revision from wandererfan

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-27 17:37:29 +01:00
wmayer
985def3416 Base: apply clang format 2023-11-13 12:01:26 -05:00
mosfet80
cb607ffe1e [BASE] Removed dead code (#10330) 2023-08-28 10:41:20 -05:00
Daniel-Khodabakhsh
071200ac8a Add various matrix related expression functions (#8603)
Adds a few new Expression functions with the goal to:

- Simplify Placement, Rotation, Vector and Matrix object creation.
- Add new matrix functions for rotation and translation.
2023-03-11 20:13:23 -06:00
wmayer
a23d862b2b Base: fix/ignore some clang-tidy warnings 2023-02-28 15:17:06 +01:00
wmayer
545aa0eed9 Base: make static const predefined quantities 2023-02-28 15:17:06 +01:00
wmayer
752e33d340 Base: fix Lint warnings in Quantity 2023-02-28 15:17:06 +01:00
wmayer
c8a35d85fe Base: fix pow() of Quantity 2023-02-27 22:13:08 +01:00
wmayer
75fedd8146 Base: handle several Lint warnings 2023-02-27 20:07:01 +01:00
wmayer
57eb7a5b07 Base: add missing != operator to Quantity 2023-02-27 20:07:01 +01:00
0penBrain
0d577a8789 Base: introduce 'getSafeUserUnit' that fallbacks to full precision and internal unit ...
... in case unit schema would zero a non-zero quantity

 For example, using '1 mil' with UnitsSchemaImperialDecimal schema
2023-02-23 15:22:07 +01:00
Uwe
a58c74c556 [Core] disable the the unit Oersted
- is not feasible for practical usage and (was up to now not used, thus no consequence)
  moreover, Oersted is a cgs unit while we use SI units, thus also not suitable for FEM, only makes problems for magnetization
2023-02-08 19:59:36 +01:00
luzpaz
79e150a81b Fix trailing whitespace, typos, headers
Fix trailing whitespace, typos, and header uniformity.
2023-01-23 00:34:37 +01:00
wmayer
6653991a97 Gui/Mod: handle several compiler warnings:
* ignore -Wfree-nonheap-object for generated code
* replace 0 with Qt::NoModifier when creating a QKeyEvent
* in Qt 5.14 QCombobox::activated(QString) is deprecated, use textActivated
* don't mix QCheckBox::setChecked() with tristate API
2022-11-29 10:36:02 +01:00
0penBrain
caa4784550 Base: fix quantity construction when unit as string is empty 2022-04-02 18:09:35 +02:00
Chris Hennes
b5c72abee4 Base: PR6497 move return statement to new line 2022-03-29 12:34:34 -05:00
wmayer
4a343ab31e Base/App: fix warnings from code analysers:
* convert old-style-casts to explicit C++ casts where possible
* make some implicit conversions explicit
2022-03-06 23:49:30 +01:00
Uwe
686a025416 [Base] Quantity, Rotation, Stream: remove unused includes 2022-03-01 11:27:54 +01:00
wmayer
cad0d01883 Base: modernize C++11
* remove redundant void-arg
* use nullptr
* replace deprecated headers
2022-01-25 20:21:30 +01:00
wmayer
3945dc0f74 Base: only handle Base::ParserError exceptions for quantity expressions 2022-01-22 01:15:12 +01:00
0penBrain
66c513c698 [Core] Fix Quantity construction with value as double + unit as string 2022-01-21 14:56:11 +01:00
Preslav
5030d8bb6d Added stiffness units to FreeCAD [mN/m, N/m, kN/m, MN/m] 2021-08-16 12:27:41 +01:00
wmayer
e4f98b4512 Base: add convenience functions to create a QString from quantity or double 2021-04-20 14:07:20 +02:00
donovaly
6c67300d62 [Base] add electrical conductivity
- this is necessary to perform electrodynamics simulations. Since the typical values are in the range of 1e6 S/m, we need the new units kS and MS

- since this is for simulations, also add electrical conductivity to the FEM material cards
2021-03-25 17:13:52 +01:00
David Carter
6c57cebc9b Base: fixes #0004586: Conversion error for PoundForce (lbf) 2021-03-03 12:39:49 +01:00
luz paz
01b21e0d06 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
Cyril Waechter
b926149363 Fix comment in Quantity.cpp 2020-07-11 19:37:47 +02:00
luz.paz
ae72e2c762 Trivial code formatting for some {.cpp,.h} files 2020-04-06 12:55:27 +02:00
donovaly
d1b354fc6b add units Gauss, Weber and Oersted 2020-01-07 07:36:22 -03:00
donovaly
317c153494 Quantity.cpp: fix spacing 2020-01-05 15:00:46 +01:00
donovaly
68ea38cc8d add the units Ohm and Siemens 2020-01-05 15:00:46 +01:00
luz.paz
011e5aedfa src/Base: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Base` files
2019-12-25 11:38:58 +01:00
donovaly
b255475d7c missing parts from from commit 33b8054228
- also add keV and MeV since these are the units used in practice
2019-12-24 13:31:00 +01:00
wmayer
2484cd56ef Units: extend parser to accept mph, sqft and cft. Fix a bug in imperial civil schema 2019-12-23 19:55:21 +01:00
donovaly
a6a043a6f2 also add unit THz as requested 2019-12-23 16:49:45 +01:00
donovaly
edd97de6a2 add units Mpsi, cal and kcal
- also ass missing parts from commit 0021efbf
2019-12-23 16:49:45 +01:00
wmayer
e1b7ef10c7 add posibility to use a unit schema other then the system schema to represent a quantity 2019-12-21 13:35:14 +01:00
donovaly
26196ae612 add mJ and kW
- also some fixes
- add conversions for forces
2019-12-19 13:31:12 +01:00
donovaly
4b99ee28ce generate QuantityLexer.c
- also set proper unit conversions
- fix MilliWatt and MilliMole
2019-12-19 13:31:12 +01:00
donovaly
94bae36cee add the following units:
- mmol
- ml
- bar
- mbar
- kJ
- kWh
- eV
- C
- T
- F (p, n, u, m)
- H (n, u, m)
2019-12-19 13:31:12 +01:00
wmayer
617a8d7598 Support for Frequency in quantity parser 2019-10-21 11:49:55 +02:00
Zheng, Lei
1efadc928e Base: improve base python object number protocol 2019-09-28 15:30:23 +02:00
wmayer
9fa56345cf core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
wmayer
5c9d30b25a use NaN for invalid quantities instead of DOUBLE_MIN 2019-09-16 18:00:24 +02:00