initFuel :: Catalog -> Int -> SpreadEnv -> IO ()
initFuel (Catalog catalog) fuel SpreadEnv{..} = do
  let d1hr    = realToFrac (_seD1hr   /~ one)
      d10hr   = realToFrac (_seD10hr  /~ one)
      d100hr  = realToFrac (_seD100hr /~ one)
      herb    = realToFrac (_seHerb   /~ one)
      wood    = realToFrac (_seWood   /~ one)
      model   = fromIntegral fuel
      windFpm = realToFrac (_seWindSpeed   /~ footMin)
      windDeg = realToFrac (_seWindAzimuth /~ degree)
      slope   = realToFrac (_seSlope       /~ one)
      aspect  = realToFrac (_seAspect      /~ degree)
  [C.block| void {
      double moisture[6] = { $(double d1hr)
                           , $(double d10hr)
                           , $(double d100hr)
                           , 0
                           , $(double herb)
                           , $(double wood)
                           };
      Fire_SpreadNoWindNoSlope($(void *catalog), $(size_t model), moisture);
      Fire_SpreadWindSlopeMax( $(void *catalog), $(size_t model)
                             , $(double windFpm), $(double windDeg)
                             , $(double slope), $(double aspect));
      double az = Fuel_AzimuthMax( (FuelCatalogPtr)$(void *catalog)
                                  , $(size_t model));
      size_t w = FIRE_BYRAMS | FIRE_FLAME;
      Fire_SpreadAtAzimuth( $(void *catalog), $(size_t model), az, w);
  } |]
initFuel :: Catalog -> Int -> SpreadEnv -> IO ()
initFuel (Catalog catalog) fuel SpreadEnv{..} = do
  let d1hr    = realToFrac (_seD1hr   /~ one)
      d10hr   = realToFrac (_seD10hr  /~ one)
      d100hr  = realToFrac (_seD100hr /~ one)
      herb    = realToFrac (_seHerb   /~ one)
      wood    = realToFrac (_seWood   /~ one)
      model   = fromIntegral fuel
      windFpm = realToFrac (_seWindSpeed   /~ footMin)
      windDeg = realToFrac (_seWindAzimuth /~ degree)
      slope   = realToFrac (_seSlope       /~ one)
      aspect  = realToFrac (_seAspect      /~ degree)
  [C.block| void {
      double moisture[6] = { $(double d1hr)
                           , $(double d10hr)
                           , $(double d100hr)
                           , 0
                           , $(double herb)
                           , $(double wood)
                           };
      Fire_SpreadNoWindNoSlope($(void *catalog), $(size_t model), moisture);
      Fire_SpreadWindSlopeMax( $(void *catalog), $(size_t model)
                             , $(double windFpm), $(double windDeg)
                             , $(double slope), $(double aspect));
      double az = Fuel_AzimuthMax( (FuelCatalogPtr)$(void *catalog)
                                  , $(size_t model));
      size_t w = FIRE_BYRAMS | FIRE_FLAME;
      Fire_SpreadAtAzimuth( $(void *catalog), $(size_t model), az, w);
  } |]
initFuel (Catalog catalog) fuel SpreadEnv{..} = do
  let d1hr    = realToFrac (_seD1hr   /~ one)
      d10hr   = realToFrac (_seD10hr  /~ one)
      d100hr  = realToFrac (_seD100hr /~ one)
      herb    = realToFrac (_seHerb   /~ one)
      wood    = realToFrac (_seWood   /~ one)
      model   = fromIntegral fuel
      windFpm = realToFrac (_seWindSpeed   /~ footMin)
      windDeg = realToFrac (_seWindAzimuth /~ degree)
      slope   = realToFrac (_seSlope       /~ one)
      aspect  = realToFrac (_seAspect      /~ degree)
  [C.block| void {
      double moisture[6] = { $(double d1hr)
                           , $(double d10hr)
                           , $(double d100hr)
                           , 0
                           , $(double herb)
                           , $(double wood)
                           };
      Fire_SpreadNoWindNoSlope($(void *catalog), $(size_t model), moisture);
      Fire_SpreadWindSlopeMax( $(void *catalog), $(size_t model)
                             , $(double windFpm), $(double windDeg)
                             , $(double slope), $(double aspect));
      double az = Fuel_AzimuthMax( (FuelCatalogPtr)$(void *catalog)
                                  , $(size_t model));
      size_t w = FIRE_BYRAMS | FIRE_FLAME;
      Fire_SpreadAtAzimuth( $(void *catalog), $(size_t model), az, w);
  } |]