当前位置: 首页>>代码示例>>C++>>正文


C++ Soil::size方法代码示例

本文整理汇总了C++中Soil::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Soil::size方法的具体用法?C++ Soil::size怎么用?C++ Soil::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Soil的用法示例。


在下文中一共展示了Soil::size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
ReactionNitrification::initialize (const Units&, const Geometry&,
                                   const Soil& soil, 
                                   const SoilWater&, const SoilHeat&,
                                   const Surface&, Treelog&)
{
  const size_t cell_size = soil.size ();

  NH4 = std::vector<double> (cell_size, 0.0);
  NO3 = std::vector<double> (cell_size, 0.0);
  N2O = std::vector<double> (cell_size, 0.0);
}
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:12,代码来源:reaction_nit.C

示例2:

void
ClayOMBiomod::set_rates (const Soil& soil, const std::vector<SMB*>& smb) const
{ 
  // We always have two SMB pools in BIOMOD.
  daisy_assert (smb.size () == 2);

  // Total death and maintenance.
  const double t_SMB1 = smb[0]->turnover_rate + smb[0]->maintenance;
  const double t_SMB2 = smb[1]->turnover_rate + smb[1]->maintenance;

  // The ratios we want to change.
  const double r_SMB1 = smb[0]->turnover_rate / t_SMB1;
  const double r_SMB2 = smb[1]->turnover_rate / t_SMB2;

  for (unsigned int i  = 0; i < soil.size (); i++)
    {
      // Find modifier.
      const double f = find_f (r_SMB1, r_SMB2, soil.clay (i));
      daisy_assert (f > 0.0);

      // Update turnover rate and maintence.
      const double clay_rate1 = smb[0]->turnover_rate * f;
      daisy_assert (clay_rate1 < 1.0);
      smb[0]->clay_turnover.push_back (clay_rate1);
      daisy_assert (t_SMB1 >= clay_rate1);
      smb[0]->clay_maintenance.push_back (t_SMB1 - clay_rate1);
      const double clay_rate2 = smb[1]->turnover_rate * f;
      daisy_assert (clay_rate2 < 1.0);
      smb[1]->clay_turnover.push_back (clay_rate2);
      daisy_assert (t_SMB2 >= clay_rate2);
      smb[1]->clay_maintenance.push_back (t_SMB2 - clay_rate2);
    }

  for (unsigned int i = 0; i < smb.size (); i++)
    {
      daisy_assert (smb[i]->clay_turnover.size () == soil.size ());
      daisy_assert (smb[i]->clay_maintenance.size () == soil.size ());
    }
}
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:39,代码来源:clayom_biomod.C

示例3:

void
ReactionDenit::initialize (const Units&, const Geometry&,
                           const Soil& soil, const SoilWater&,
                           const SoilHeat&, const Surface&, Treelog&)
{
  const size_t cell_size = soil.size ();

  converted.insert (converted.begin (), cell_size, 0.0);
  converted_fast.insert (converted_fast.begin (), cell_size, 0.0);
  converted_redox.insert (converted_redox.begin (), cell_size, 0.0);
  potential.insert (potential.begin (), cell_size, 0.0);
  potential_fast.insert (potential_fast.begin (), cell_size, 0.0);
}
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:13,代码来源:reaction_denit.C

示例4:

void 
Ridge::Implementation::initialize (const Geometry1D& geo,
                                   const Soil& soil,
                                   const SoilWater& soil_water)
{
  // Find values depending on soil numerics.
  last_cell = geo.interval_plus (lowest);
  daisy_assert (last_cell+1 < soil.size ());
  dz = 0 - geo.zplus (last_cell);
  K_sat_below = soil.K (last_cell+1, 0.0, 0.0, 20.0);

  // Initialize water content.
  Theta = 0.0;
  for (int i = 0; i <= last_cell; i++)
    Theta += soil_water.Theta (i) * geo.dz (i);
  Theta /= dz;
  Theta_pre = Theta;
  daisy_assert (Theta < soil.Theta (0, 0.0, 0.0));
  h = soil.h (0, Theta);
  K = soil.K (0, 0.0, 0.0, 20.0);
}
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:21,代码来源:ridge.C

示例5: nest

void 
Movement1D::tick_water (const Geometry1D& geo,
                        const Soil& soil, const SoilHeat& soil_heat, 
                        Surface& surface, Groundwater& groundwater,
                        const std::vector<double>& S,
                        std::vector<double>& h_old,
                        const std::vector<double>& Theta_old,
                        const std::vector<double>& h_ice,
                        std::vector<double>& h,
                        std::vector<double>& Theta,
                        std::vector<double>& q,
                        std::vector<double>& q_p,
                        const double dt, 
                        Treelog& msg)
{
  const size_t top_edge = 0U;
  const size_t bottom_edge = geo.edge_size () - 1U;

  // Limit for groundwater table.
  size_t last  = soil.size () - 1;

  // Limit for ridging.
  const size_t first = (surface.top_type (geo, 0U) == Surface::soil)
    ? surface.last_cell (geo, 0U) 
    : 0U;
  // Calculate matrix flow next.

  for (size_t m = 0; m < matrix_water.size (); m++)
    {
      water_attempt (m);
      Treelog::Open nest (msg, matrix_water[m]->name);
      try
        {
          matrix_water[m]->tick (msg, geo, soil, soil_heat,
                                 first, surface, top_edge, 
                                 last, groundwater, bottom_edge,
                                 S, h_old, Theta_old, h_ice, h, Theta, 0U, q, 
                                 dt);

          for (size_t i = last + 2; i <= soil.size (); i++)
            {
              q[i] = q[i-1];
              q_p[i] = q_p[i-1];
            }

          // Update surface and groundwater reservoirs.
          surface.accept_top (q[0] * dt, geo, 0U, dt, msg);
          surface.update_pond_average (geo);
          const double q_down = q[soil.size ()] + q_p[soil.size ()];
          groundwater.accept_bottom (q_down * dt, geo, soil.size ());
          if (m > 0)
            msg.debug ("Reserve model succeeded");
          return;
        }
      catch (const char* error)
        {
          msg.debug (std::string ("UZ problem: ") + error);
        }
      catch (const std::string& error)
        {
          msg.debug (std::string ("UZ trouble: ") + error);
        }
      
      water_failure (m);
    }
  throw "Water matrix transport failed"; 
}
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:67,代码来源:movement_1D.C

示例6: soil_layer_submodel

static DeclareSubmodel 
soil_layer_submodel (Soil::Implementation::Layer::load_syntax, "SoilLayer", "\
A location and content of a soil layer.\n\
The layers apply to the soil section not covered by the 'zones' parameter.");

static DeclareSubmodel 
soil_zone_submodel (Soil::Implementation::Region::load_syntax, "SoilRegion", "\
A location and content of a soil zone.\n\
If several zones cover the same soil, the first one listed is used.\n\
If no zones cover the soil, the 'horizons' parameter is used.\n\
\n\
With regard to the numeric discretization, the whole cell is assumed to\n\
be of the soil found in the cell center.");

size_t 
Soil::size () const
{ return impl->horizon_.size (); }

const Horizon& 
Soil::horizon (size_t i) const
{ return *impl->horizon_[i]; }

double 
Soil::K (size_t i, double h, double h_ice, double T) const
{ 
  static struct ViscosityFactor : public PLF
  {
    ViscosityFactor ()
    {
      const double v20 = Water::viscosity (20.0);
      add ( 0.0, v20 / Water::viscosity (0.0));
开发者ID:pamoakoy,项目名称:daisy-model,代码行数:31,代码来源:soil.C


注:本文中的Soil::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。