本文整理汇总了C++中Treelog::bug方法的典型用法代码示例。如果您正苦于以下问题:C++ Treelog::bug方法的具体用法?C++ Treelog::bug怎么用?C++ Treelog::bug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Treelog
的用法示例。
在下文中一共展示了Treelog::bug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propagate
static void propagate (Treelog& msg, int nest, const std::string& text)
{
switch (nest)
{
case is_unknown:
msg.entry (text);
break;
case is_debug:
msg.debug (text);
break;
case is_plain:
msg.message (text);
break;
case is_warning:
msg.warning (text);
break;
case is_error:
msg.error (text);
break;
case is_bug:
msg.bug (text);
break;
case is_close:
msg.close ();
break;
case is_touch:
msg.touch ();
break;
case is_flush:
msg.flush ();
break;
default:
msg.open (text);
}
}
示例2: if
void
MovementSolute::solute (const Soil& soil, const SoilWater& soil_water,
const double J_above, Chemical& chemical,
const double dt,
const Scope& scope, Treelog& msg)
{
daisy_assert (std::isfinite (J_above));
const size_t cell_size = geometry ().cell_size ();
const size_t edge_size = geometry ().edge_size ();
// Source term transfered from secondary to primary domain.
std::vector<double> S_extra (cell_size, 0.0);
// Divide top solute flux according to water.
std::map<size_t, double> J_tertiary;
std::map<size_t, double> J_secondary;
std::map<size_t, double> J_primary;
if (J_above > 0.0)
// Outgoing, divide according to content in primary domain only.
divide_top_outgoing (geometry (), chemical, J_above,
J_primary, J_secondary, J_tertiary);
else if (J_above < 0.0)
// Incomming, divide according to all incomming water.
divide_top_incomming (geometry (), soil_water, J_above,
J_primary, J_secondary, J_tertiary);
else
// No flux.
zero_top (geometry (), J_primary, J_secondary, J_tertiary);
// Check result.
{
const std::vector<size_t>& edge_above
= geometry ().cell_edges (Geometry::cell_above);
const size_t edge_above_size = edge_above.size ();
double J_sum = 0.0;
for (size_t i = 0; i < edge_above_size; i++)
{
const size_t edge = edge_above[i];
const double in_sign
= geometry ().cell_is_internal (geometry ().edge_to (edge))
? 1.0 : -1.0;
const double area = geometry ().edge_area (edge); // [cm^2 S]
const double J_edge // [g/cm^2 S/h]
= J_tertiary[edge] + J_secondary[edge] + J_primary[edge];
J_sum += in_sign * J_edge * area; // [g/h]
if (in_sign * J_tertiary[edge] < 0.0)
{
std::ostringstream tmp;
tmp << "J_tertiary[" << edge << "] = " << J_tertiary[edge]
<< ", in_sign = " << in_sign << ", J_above = " << J_above;
msg.bug (tmp.str ());
}
if (in_sign * J_secondary[edge] < 0.0)
{
std::ostringstream tmp;
tmp << "J_secondary[" << edge << "] = " << J_secondary[edge]
<< ", in_sign = " << in_sign << ", J_above = " << J_above;
msg.bug (tmp.str ());
}
}
J_sum /= geometry ().surface_area (); // [g/cm^2 S/h]
daisy_approximate (-J_above, J_sum);
}
// We set a fixed concentration below lower boundary, if specified.
std::map<size_t, double> C_border;
const double C_below = chemical.C_below ();
if (C_below >= 0.0)
{
const std::vector<size_t>& edge_below
= geometry ().cell_edges (Geometry::cell_below);
const size_t edge_below_size = edge_below.size ();
for (size_t i = 0; i < edge_below_size; i++)
{
const size_t edge = edge_below[i];
C_border[edge] = C_below;
}
}
// Tertiary transport.
tertiary->solute (geometry (), soil_water, J_tertiary, dt, chemical, msg);
// Fully adsorbed.
if (chemical.adsorption ().full ())
{
static const symbol solid_name ("immobile transport");
Treelog::Open nest (msg, solid_name);
if (!iszero (J_above))
{
std::ostringstream tmp;
tmp << "J_above = " << J_above << ", expected 0 for full sorbtion";
msg.error (tmp.str ());
}
// Secondary "transport".
std::vector<double> J2 (edge_size, 0.0); // Flux delivered by flow.
std::vector<double> Mn (cell_size); // New content.
//.........这里部分代码省略.........
示例3: if
void
SoilWater::tick_after (const Geometry& geo,
const Soil& soil, const SoilHeat& soil_heat,
const bool initial,
Treelog& msg)
{
TREELOG_SUBMODEL (msg, "SoilWater");
// We need old K for primary/secondary flux division.
std::vector<double> K_old = K_cell_;
// Update cells.
const size_t cell_size = geo.cell_size ();
daisy_assert (K_cell_.size () == cell_size);
daisy_assert (Cw2_.size () == cell_size);
daisy_assert (h_.size () == cell_size);
daisy_assert (h_ice_.size () == cell_size);
daisy_assert (K_old.size () == cell_size);
daisy_assert (Theta_.size () == cell_size);
daisy_assert (Theta_primary_.size () == cell_size);
daisy_assert (Theta_secondary_.size () == cell_size);
daisy_assert (Theta_tertiary_.size () == cell_size);
double z_low = geo.top ();
table_low = NAN;
double z_high = geo.bottom ();
table_high = NAN;
for (size_t c = 0; c < cell_size; c++)
{
// Groundwater table.
const double z = geo.cell_top (c);
const double h = h_[c];
const double table = z + h;
if (h < 0)
{
if (approximate (z, z_low))
{
if (!std::isnormal (table_low)
|| table < table_low)
table_low = table;
}
else if (z < z_low)
table_low = table;
}
else if (approximate (z, z_high))
{
if (!std::isnormal (table_high)
|| table > table_high)
table_high = table;
}
else if (z > z_high)
table_high = table;
// Conductivity.
K_cell_[c] = soil.K (c, h_[c], h_ice_[c], soil_heat.T (c));
// Specific water capacity.
Cw2_[c] = soil.Cw2 (c, h_[c]);
// Primary and secondary water.
if (Theta_[c] <= 0.0)
{
std::ostringstream tmp;
tmp << "Theta[" << c << "] = " << Theta_[c];
daisy_bug (tmp.str ());
Theta_[c] = 1e-9;
}
const double h_lim = soil.h_secondary (c);
if (h_lim >= 0.0 || h_[c] <= h_lim)
{
// No active secondary domain.
Theta_primary_[c] = Theta_[c];
Theta_secondary_[c] = 0.0;
}
else
{
// Secondary domain activated.
const double Theta_lim = soil.Theta (c, h_lim, h_ice_[c]);
daisy_assert (Theta_lim > 0.0);
if (Theta_[c] >= Theta_lim)
{
Theta_primary_[c] = Theta_lim;
Theta_secondary_[c] = Theta_[c] - Theta_lim;
}
else
{
std::ostringstream tmp;
tmp << "h[" << c << "] = " << h_[c]
<< "; Theta[" << c << "] = " << Theta_[c]
<< "\nh_lim = " << h_lim << "; Theta_lim = " << Theta_lim
<< "\nStrenge h > h_lim, yet Theta <= Theta_lim";
msg.bug (tmp.str ());
Theta_primary_[c] = Theta_[c];
Theta_secondary_[c] = 0.0;
}
}
}
if (!std::isnormal (table_high))
//.........这里部分代码省略.........