Changeset 26833


Ignore:
Timestamp:
01/28/22 10:30:33 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: speeding up FindParam by specifying data type

Location:
issm/trunk-jpl/src/jl/core
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/jl/core/analyses/masstransportanalysis.jl

    r26738 r26833  
    8686        vx_input      = GetInput(element, VxEnum)
    8787        vy_input      = GetInput(element, VyEnum)
    88         dt            = FindParam(element, TimesteppingTimeStepEnum)
    89         stabilization = FindParam(element, MasstransportStabilizationEnum)
     88        dt            = FindParam(Float64, element, TimesteppingTimeStepEnum)
     89        stabilization = FindParam(Int64, element, MasstransportStabilizationEnum)
    9090
    9191        h = CharacteristicLength(element)
     
    157157   smb_input       = GetInput(element, SmbMassBalanceEnum)
    158158        olevelset_input = GetInput(element, MaskOceanLevelsetEnum)
    159         dt            = FindParam(element, TimesteppingTimeStepEnum)
    160         stabilization = FindParam(element, MasstransportStabilizationEnum)
     159        dt            = FindParam(Float64, element, TimesteppingTimeStepEnum)
     160        stabilization = FindParam(Int64, element, MasstransportStabilizationEnum)
    161161
    162162   #How much is actually grounded?
     
    221221
    222222        #Get some parameters
    223         rho_water = FindParam(element, MaterialsRhoSeawaterEnum)
    224         rho_ice   = FindParam(element, MaterialsRhoIceEnum)
    225         H_min     = FindParam(element, MasstransportMinThicknessEnum)
     223        rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum)
     224        rho_ice   = FindParam(Float64, element, MaterialsRhoIceEnum)
     225        H_min     = FindParam(Float64, element, MasstransportMinThicknessEnum)
    226226
    227227        #Now split solution vector into x and y components
  • issm/trunk-jpl/src/jl/core/analyses/stressbalanceanalysis.jl

    r26766 r26833  
    8181
    8282        #Fetch parameters relevant to solution sequence
    83         maxiter = FindParam(femmodel.parameters,StressbalanceMaxiterEnum)
    84         restol  = FindParam(femmodel.parameters,StressbalanceRestolEnum)
    85         reltol  = FindParam(femmodel.parameters,StressbalanceReltolEnum)
    86         abstol  = FindParam(femmodel.parameters,StressbalanceAbstolEnum)
     83        maxiter = FindParam(Int64, femmodel.parameters,StressbalanceMaxiterEnum)
     84        restol  = FindParam(Float64, femmodel.parameters,StressbalanceRestolEnum)
     85        reltol  = FindParam(Float64, femmodel.parameters,StressbalanceReltolEnum)
     86        abstol  = FindParam(Float64, femmodel.parameters,StressbalanceAbstolEnum)
    8787
    8888        #Call solution sequence to compute new speeds
     
    174174        H_input  = GetInput(element, ThicknessEnum)
    175175        s_input  = GetInput(element, SurfaceEnum)
    176         rho_ice  = FindParam(element, MaterialsRhoIceEnum)
    177         g        = FindParam(element, ConstantsGEnum)
     176        rho_ice  = FindParam(Float64, element, MaterialsRhoIceEnum)
     177        g        = FindParam(Float64, element, ConstantsGEnum)
    178178
    179179        #Start integrating
     
    197197                #Get additional parameters and inputs
    198198                b_input   = GetInput(element, BaseEnum)
    199                 rho_water = FindParam(element, MaterialsRhoSeawaterEnum)
     199                rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum)
    200200
    201201                #Get normal and ice front coordinates
  • issm/trunk-jpl/src/jl/core/analyses/transientanalysis.jl

    r26736 r26833  
    1515function Core(analysis::TransientAnalysis,femmodel::FemModel)# {{{
    1616
    17         step      = FindParam(femmodel.parameters, StepEnum)
    18         time      = FindParam(femmodel.parameters, TimeEnum)
    19         finaltime = FindParam(femmodel.parameters, TimesteppingFinalTimeEnum)
    20         yts       = FindParam(femmodel.parameters, ConstantsYtsEnum)
    21         dt        = FindParam(femmodel.parameters, TimesteppingTimeStepEnum)
     17        step      = FindParam(Int64, femmodel.parameters, StepEnum)
     18        time      = FindParam(Float64, femmodel.parameters, TimeEnum)
     19        finaltime = FindParam(Float64, femmodel.parameters, TimesteppingFinalTimeEnum)
     20        yts       = FindParam(Float64, femmodel.parameters, ConstantsYtsEnum)
     21        dt        = FindParam(Float64, femmodel.parameters, TimesteppingTimeStepEnum)
    2222
    23         isstressbalance = FindParam(femmodel.parameters, TransientIsstressbalanceEnum)
    24    ismasstransport = FindParam(femmodel.parameters, TransientIsmasstransportEnum)
     23        isstressbalance = FindParam(Bool, femmodel.parameters, TransientIsstressbalanceEnum)
     24   ismasstransport = FindParam(Bool, femmodel.parameters, TransientIsmasstransportEnum)
    2525
    2626   while(time < finaltime - (yts*eps(Float64))) #make sure we run up to finaltime.
  • issm/trunk-jpl/src/jl/core/elements.jl

    r26738 r26833  
    149149
    150150end # }}}
    151 function FindParam(element::Tria,enum::IssmEnum) # {{{
    152 
    153         return FindParam(element.parameters, enum)
     151function FindParam(::Type{T}, element::Tria, enum::IssmEnum) where T # {{{
     152
     153        return FindParam(T, element.parameters, enum)
    154154
    155155end # }}}
     
    312312
    313313
    314         rho_water   = FindParam(element, MaterialsRhoSeawaterEnum)
    315         rho_ice     = FindParam(element, MaterialsRhoIceEnum)
     314        rho_water   = FindParam(Float64, element, MaterialsRhoSeawaterEnum)
     315        rho_ice     = FindParam(Float64, element, MaterialsRhoIceEnum)
    316316        density     = rho_ice/rho_water
    317317
  • issm/trunk-jpl/src/jl/core/friction.jl

    r26766 r26833  
    1919function CoreFriction(element::Tria) #{{{
    2020
    21         frictionlaw = FindParam(element, FrictionLawEnum)
     21        frictionlaw = FindParam(Int64, element, FrictionLawEnum)
    2222
    2323        if frictionlaw==1
     
    2626                c_input  = GetInput(element, FrictionCoefficientEnum)
    2727
    28                 rho_ice   = FindParam(element, MaterialsRhoIceEnum)
    29                 rho_water = FindParam(element, MaterialsRhoSeawaterEnum)
    30                 g         = FindParam(element, ConstantsGEnum)
     28                rho_ice   = FindParam(Float64, element, MaterialsRhoIceEnum)
     29                rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum)
     30                g         = FindParam(Float64, element, ConstantsGEnum)
    3131
    3232                return CoreBuddFriction(H_input, b_input, c_input, rho_ice, rho_water, g)
  • issm/trunk-jpl/src/jl/core/modules.jl

    r26738 r26833  
    302302
    303303        #Get Step and Time from parameters
    304         step = FindParam(femmodel.parameters,StepEnum)
    305         time = FindParam(femmodel.parameters,TimeEnum)
     304        step = FindParam(Int64, femmodel.parameters,StepEnum)
     305        time = FindParam(Float64, femmodel.parameters,TimeEnum)
    306306       
    307307        #Now fetch results
  • issm/trunk-jpl/src/jl/core/parameters.jl

    r26730 r26833  
    4646
    4747end#}}}
    48 function FindParam(parameters::Parameters,enum::IssmEnum) #{{{
     48function FindParam(::Type{T}, parameters::Parameters,enum::IssmEnum) where T #{{{
    4949
    5050        param = parameters.lookup[enum]
    51         return GetParameterValue(param)
     51        return GetParameterValue(param)::T
    5252
    5353end#}}}
Note: See TracChangeset for help on using the changeset viewer.