Skip to content

Commit

Permalink
remove redundant ucs constructor; #3199
Browse files Browse the repository at this point in the history
  • Loading branch information
samm82 committed Jan 12, 2023
1 parent e0db5ec commit cb9e122
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ rOB = uc' "rOB"
"FIXME: Define this or remove the need for definitions"
(sub (eqSymb QP.displacement) (Concat [lOrigin, lBodyB])) Real metre

posCM = ucs "p_CM" (nounPhraseSP "Center of Mass")
posCM = uc' "p_CM" (nounPhraseSP "Center of Mass")
--"mass-weighted average position of a rigid " ++
-- "body's particles")
"FIXME: Define this or remove the need for definitions"
Expand Down
20 changes: 10 additions & 10 deletions code/drasil-example/ssp/lib/Drasil/SSP/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ intNormForce = ucsWS "G_i" (cn "interslice normal forces")
S "exerted between each pair of adjacent slices")
(vec cG) (Vect Real) forcePerMeterU

slipHght = ucs "y_slip,i" (nounPhraseSent $ plural yCoord +:+ S "of the slip surface")
slipHght = uc' "y_slip,i" (nounPhraseSent $ plural yCoord +:+ S "of the slip surface")
"heights of the slip surface"
(sub (vec lY) lSlip) (Vect Real) metre

Expand Down Expand Up @@ -324,27 +324,27 @@ surfLoad = ucsWS "Q_i" (cn "external forces")
S "acting into the surface from the midpoint of each slice")
(vec cQ) (Vect Real) forcePerMeterU

baseAngle = ucs "alpha_i" (cn "base angles")
baseAngle = uc' "alpha_i" (cn "base angles")
"the angles between the base of each slice and the horizontal"
(vec lAlpha) (Vect Real) degree

surfAngle = ucs "beta_i" (cn "surface angles")
surfAngle = uc' "beta_i" (cn "surface angles")
"the angles between the surface of each slice and the horizontal"
(vec lBeta) (Vect Real) degree

impLoadAngle = ucs "omega_i" (cn "imposed load angles")
impLoadAngle = uc' "omega_i" (cn "imposed load angles")
"the angles between the external force acting into the surface of each slice and the vertical"
(vec lOmega) (Vect Real) degree

baseWthX = ucsWS "b_i" (cn "base width of slices")
(S "the width of each slice" `S.inThe` phrase xDir)
(vec lB) (Vect Real) metre

baseLngth = ucs "l_b,i" (cn "total base lengths of slices")
baseLngth = uc' "l_b,i" (cn "total base lengths of slices")
"the lengths of each slice in the direction parallel to the slope of the base"
(sub (vec cL) lB) (Vect Real) metre

surfLngth = ucs "l_s,i" (cn "surface lengths of slices")
surfLngth = uc' "l_s,i" (cn "surface lengths of slices")
"the lengths of each slice in the direction parallel to the slope of the surface"
(sub (vec cL) lS) (Vect Real) metre

Expand All @@ -367,12 +367,12 @@ sliceHghtW = makeUCWDS "h_z,w,i" (cn "heights of the water table")
(S "the heights" `S.inThe` phrase yDir +:+ S "from the base of each slice to the water table")
(sub (vec lH) lHeights) Real metre

nrmShearNum = ucs "C_num,i" (cn "proportionality constant numerator")
nrmShearNum = uc' "C_num,i" (cn "proportionality constant numerator")
("values for each slice that sum together to form the numerator of the " ++
"interslice normal to shear force proportionality constant")
(sub (vec cC) lNum) (Vect Real) newton

nrmShearDen = ucs "C_den,i" (cn "proportionality constant denominator")
nrmShearDen = uc' "C_den,i" (cn "proportionality constant denominator")
("values for each slice that sum together to form the denominator of the " ++
"interslice normal to shear force proportionality constant")
(sub (vec cC) lDen) (Vect Real) newton
Expand All @@ -397,11 +397,11 @@ watForceSum = uc' "F_x^H" (cn "sums of the interslice normal water forces")
"the sums of the normal water forces acting on each pair of adjacent interslice boundaries"
(sup (subX (vec cF)) lNormWat) Real newton

sliceHghtRight = ucs "h^R" (cn "heights of the right side of slices")
sliceHghtRight = uc' "h^R" (cn "heights of the right side of slices")
"the heights of the right side of each slice, assuming slice surfaces have negative slope"
(sup (vec lH) lRight) (Vect Real) metre

sliceHghtLeft = ucs "h^L" (cn "heights of the left side of slices")
sliceHghtLeft = uc' "h^L" (cn "heights of the left side of slices")
"the heights of the left side of each slice, assuming slice surfaces have negative slope"
(sup (vec lH) lLeft) (Vect Real) metre

Expand Down
4 changes: 2 additions & 2 deletions code/drasil-lang/lib/Language/Drasil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module Language.Drasil (
, DefinedQuantityDict, dqd, dqd', dqdNoUnit, dqdQd, dqdWr
-- Language.Drasil.Chunk.Unital
, UnitalChunk(..), makeUCWDS
, uc, uc', ucStaged, ucs, ucsWS, ucuc, ucw
, uc, uc', ucStaged, ucsWS, ucuc, ucw
-- Language.Drasil.Chunk.UnitDefn
, UnitDefn(..)
, fromUDefn, unitCon, makeDerU
Expand Down Expand Up @@ -354,7 +354,7 @@ import Language.Drasil.Chunk.DifferentialModel(DifferentialModel(..), ODESolverF
makeASingleDE, formEquations)
import Language.Drasil.Chunk.UncertainQuantity
import Language.Drasil.Chunk.Unital(UnitalChunk(..), makeUCWDS, uc, uc',
ucStaged, ucs, ucsWS, ucuc, ucw)
ucStaged, ucsWS, ucuc, ucw)
import Language.Drasil.Chunk.Unitary
import Language.Drasil.Data.Citation (CiteField(..), HP(..), CitationKind(..)
, HasFields(getFields)
Expand Down
4 changes: 2 additions & 2 deletions code/drasil-lang/lib/Language/Drasil/Chunk/Constrained.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Control.Lens ((^.), makeLenses, view)
import Language.Drasil.Chunk.Concept (cw, dcc)
import Language.Drasil.Chunk.DefinedQuantity (DefinedQuantityDict, dqd, dqd', dqdWr)
import Language.Drasil.Chunk.Quantity (QuantityDict, qw, vc)
import Language.Drasil.Chunk.Unital (ucs)
import Language.Drasil.Chunk.Unital (uc')
import Language.Drasil.Chunk.Unitary (unitary)
import Language.Drasil.Symbol (HasSymbol(..), Symbol)
import Language.Drasil.Classes (NamedIdea(term), Idea(getA), Express(express),
Expand Down Expand Up @@ -126,7 +126,7 @@ constrainedNRV' q cs = ConstrConcept (dqdWr q) cs Nothing
cuc' :: (IsUnit u) => String -> NP -> String -> Symbol -> u
-> Space -> [ConstraintE] -> Expr -> ConstrConcept
cuc' nam trm desc sym un space cs rv =
ConstrConcept (dqd (cw (ucs nam trm desc sym space un)) sym space uu) cs (Just rv)
ConstrConcept (dqd (cw (uc' nam trm desc sym space un)) sym space uu) cs (Just rv)
where uu = unitWrapper un

-- | Similar to 'cuc'', but 'Symbol' is dependent on 'Stage'.
Expand Down
7 changes: 1 addition & 6 deletions code/drasil-lang/lib/Language/Drasil/Chunk/Unital.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Language.Drasil.Chunk.Unital (
-- * Chunk Type
UnitalChunk(..),
-- * Constructors
makeUCWDS, uc, uc', ucStaged, ucs, ucsWS, ucuc, ucw) where
makeUCWDS, uc, uc', ucStaged, ucsWS, ucuc, ucw) where

import Control.Lens (makeLenses, view, (^.))

Expand Down Expand Up @@ -78,11 +78,6 @@ ucStaged :: (IsUnit u) => String -> NP -> String -> (Stage -> Symbol) -> Space -
ucStaged i t d sym space u = UC (dqd' (dcc i t d) sym space (Just un)) un
where un = unitWrapper u

-- | Similar to 'uc'', but does not assume the 'Space'.
ucs :: (IsUnit u) => String -> NP -> String -> Symbol -> Space -> u -> UnitalChunk
ucs nam trm desc sym space un = UC (dqd (dcc nam trm desc) sym space uu) uu
where uu = unitWrapper un

-- | Similar to 'ucs', but uses a 'Sentence' for description.
ucsWS :: (IsUnit u) => String -> NP ->
Sentence -> Symbol -> Space -> u -> UnitalChunk
Expand Down

0 comments on commit cb9e122

Please sign in to comment.