Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
cede5e83
Commit
cede5e83
authored
11 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added a few more unit definitions to the unit conversion system.
Former-commit-id: 07ccd6dde999c9f0f91b4e344435dd5e0026f7ca
parent
ed59345d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/units.c
+26
-0
26 additions, 0 deletions
src/units.c
src/units.h
+9
-0
9 additions, 0 deletions
src/units.h
with
35 additions
and
0 deletions
src/units.c
+
26
−
0
View file @
cede5e83
...
...
@@ -152,6 +152,32 @@ void getBaseUnitExponantsArray(float baseUnitsExp[5], enum UnitConversionFactor
case
UNIT_CONV_PRESSURE
:
baseUnitsExp
[
UNIT_MASS
]
=
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
-
1
;
baseUnitsExp
[
UNIT_TIME
]
=
-
2
;
break
;
case
UNIT_CONV_ELECTRIC_CHARGE
:
baseUnitsExp
[
UNIT_TIME
]
=
1
;
baseUnitsExp
[
UNIT_CURRENT
]
=
1
;
break
;
case
UNIT_CONV_ELECTRIC_VOLTAGE
:
baseUnitsExp
[
UNIT_MASS
]
=
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
2
;
baseUnitsExp
[
UNIT_TIME
]
=
-
3
;
baseUnitsExp
[
UNIT_CURRENT
]
=
-
1
;
break
;
case
UNIT_CONV_ELECTRIC_CAPACITANCE
:
baseUnitsExp
[
UNIT_MASS
]
=
-
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
-
2
;
baseUnitsExp
[
UNIT_TIME
]
=
4
;
baseUnitsExp
[
UNIT_CURRENT
]
=
2
;
break
;
case
UNIT_CONV_ELECTRIC_RESISTANCE
:
baseUnitsExp
[
UNIT_MASS
]
=
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
2
;
baseUnitsExp
[
UNIT_TIME
]
=
-
3
;
baseUnitsExp
[
UNIT_CURRENT
]
=
-
2
;
break
;
case
UNIT_CONV_ELECTRIC_CONDUCTANCE
:
baseUnitsExp
[
UNIT_MASS
]
=
-
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
-
2
;
baseUnitsExp
[
UNIT_TIME
]
=
3
;
baseUnitsExp
[
UNIT_CURRENT
]
=
2
;
break
;
case
UNIT_CONV_MAGNETIC_FLUX
:
baseUnitsExp
[
UNIT_MASS
]
=
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
2
;
baseUnitsExp
[
UNIT_TIME
]
=
-
2
;
baseUnitsExp
[
UNIT_CURRENT
]
=
-
1
;
break
;
case
UNIT_CONV_MAGNETIC_FIELD
:
baseUnitsExp
[
UNIT_MASS
]
=
1
;
baseUnitsExp
[
UNIT_TIME
]
=
-
2
;
baseUnitsExp
[
UNIT_CURRENT
]
=
-
1
;
break
;
case
UNIT_CONV_MAGNETIC_INDUCTANCE
:
baseUnitsExp
[
UNIT_MASS
]
=
1
;
baseUnitsExp
[
UNIT_LENGTH
]
=
2
;
baseUnitsExp
[
UNIT_TIME
]
=
-
2
;
baseUnitsExp
[
UNIT_CURRENT
]
=
-
2
;
break
;
case
UNIT_CONV_TEMPERATURE
:
baseUnitsExp
[
UNIT_TEMPERATURE
]
=
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/units.h
+
9
−
0
View file @
cede5e83
...
...
@@ -71,6 +71,15 @@ enum UnitConversionFactor
UNIT_CONV_POWER
,
UNIT_CONV_PRESSURE
,
UNIT_CONV_FREQUENCY
,
UNIT_CONV_ELECTRIC_CHARGE
,
UNIT_CONV_ELECTRIC_VOLTAGE
,
UNIT_CONV_ELECTRIC_CAPACITANCE
,
UNIT_CONV_ELECTRIC_RESISTANCE
,
UNIT_CONV_ELECTRIC_CONDUCTANCE
,
UNIT_CONV_MAGNETIC_FLUX
,
UNIT_CONV_MAGNETIC_FIELD
,
UNIT_CONV_MAGNETIC_INDUCTANCE
,
UNIT_CONV_TEMPERATURE
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment