本文整理匯總了C++中BOOST_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ BOOST_ASSERT函數的具體用法?C++ BOOST_ASSERT怎麽用?C++ BOOST_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BOOST_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: SimpleLogger
/**
* Creates the nodes in the edge expanded graph from edges in the node-based graph.
*/
void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
{
SimpleLogger().Write() << "Identifying components of the (compressed) road network";
// Run a BFS on the undirected graph and identify small components
TarjanSCC<NodeBasedDynamicGraph> component_explorer(m_node_based_graph, *m_restriction_map,
m_barrier_nodes);
component_explorer.run();
SimpleLogger().Write() << "identified: "
<< component_explorer.get_number_of_components() - removed_node_count
<< " (compressed) components";
SimpleLogger().Write() << "identified "
<< component_explorer.get_size_one_count() - removed_node_count
<< " (compressed) SCCs of size 1";
SimpleLogger().Write() << "generating edge-expanded nodes";
Percent progress(m_node_based_graph->GetNumberOfNodes());
// loop over all edges and generate new set of nodes
for (const auto node_u : osrm::irange(0u, m_node_based_graph->GetNumberOfNodes()))
{
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_u < m_node_based_graph->GetNumberOfNodes());
progress.printStatus(node_u);
for (EdgeID e1 : m_node_based_graph->GetAdjacentEdgeRange(node_u))
{
const EdgeData &edge_data = m_node_based_graph->GetEdgeData(e1);
BOOST_ASSERT(e1 != SPECIAL_EDGEID);
const NodeID node_v = m_node_based_graph->GetTarget(e1);
BOOST_ASSERT(SPECIAL_NODEID != node_v);
// pick only every other edge, since we have every edge as an outgoing
// and incoming egde
if (node_u > node_v)
{
continue;
}
BOOST_ASSERT(node_u < node_v);
// Note: edges that end on barrier nodes or on a turn restriction
// may actually be in two distinct components. We choose the smallest
const unsigned size_of_component =
std::min(component_explorer.get_component_size(node_u),
component_explorer.get_component_size(node_v));
const unsigned id_of_smaller_component = [node_u, node_v, &component_explorer]
{
if (component_explorer.get_component_size(node_u) <
component_explorer.get_component_size(node_v))
{
return component_explorer.get_component_id(node_u);
}
return component_explorer.get_component_id(node_v);
}();
const bool component_is_tiny = size_of_component < 1000;
// we only set edgeBasedNodeID for forward edges
if (edge_data.edgeBasedNodeID == SPECIAL_NODEID)
{
InsertEdgeBasedNode(node_v, node_u,
(component_is_tiny ? id_of_smaller_component + 1 : 0));
}
else
{
InsertEdgeBasedNode(node_u, node_v,
(component_is_tiny ? id_of_smaller_component + 1 : 0));
}
}
}
SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
<< " nodes in edge-expanded graph";
}
示例2: ispunct
static int
ispunct(int ch)
{
BOOST_ASSERT(isascii_(ch));
return (ascii_char_types[ch] & BOOST_CC_PUNCT);
}
示例3: isupper
static int
isupper(int ch)
{
BOOST_ASSERT(isascii_(ch));
return (ascii_char_types[ch] & BOOST_CC_UPPER);
}
示例4: isalpha
static int
isalpha(int ch)
{
BOOST_ASSERT(isascii_(ch));
return (ascii_char_types[ch] & BOOST_CC_ALPHA);
}
示例5: iscntrl
static int
iscntrl(int ch)
{
BOOST_ASSERT(isascii_(ch));
return (ascii_char_types[ch] & BOOST_CC_CTRL);
}
示例6: recompute
void recompute(std::vector<hpx::naming::id_type> const& search_objects)
{
BOOST_ASSERT(gid_);
this->base_type::recompute(gid_, search_objects);
}
示例7: ModelObjectInspectorView
WaterUseEquipmentDefinitionInspectorView::WaterUseEquipmentDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent)
: ModelObjectInspectorView(model, true, parent)
{
m_isIP = isIP;
bool isConnected = false;
QWidget* visibleWidget = new QWidget();
this->stackedWidget()->addWidget(visibleWidget);
QGridLayout* mainGridLayout = new QGridLayout();
mainGridLayout->setContentsMargins(7,7,7,7);
mainGridLayout->setSpacing(14);
visibleWidget->setLayout(mainGridLayout);
// Name
QLabel* label = new QLabel("Name: ");
label->setObjectName("H2");
mainGridLayout->addWidget(label,0,0);
m_nameEdit = new OSLineEdit();
mainGridLayout->addWidget(m_nameEdit,1,0,1,3);
// End Use Subcategory
label = new QLabel("End Use Subcategory: ");
label->setObjectName("H2");
mainGridLayout->addWidget(label,2,0);
m_endUseSubcategoryEdit = new OSLineEdit();
mainGridLayout->addWidget(m_endUseSubcategoryEdit,3,0,1,3);
// Peak Flow Rate
label = new QLabel("Peak Flow Rate: ");
label->setObjectName("H2");
mainGridLayout->addWidget(label,4,0);
m_peakFlowRateEdit = new OSQuantityEdit(m_isIP);
isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_peakFlowRateEdit, SLOT(onUnitSystemChange(bool)));
BOOST_ASSERT(isConnected);
mainGridLayout->addWidget(m_peakFlowRateEdit,5,0,1,3);
// Target Temperature Schedule
label = new QLabel("Target Temperature Schedule: ");
label->setObjectName("H2");
mainGridLayout->addWidget(label,6,0);
m_targetTemperatureScheduleVC = new TargetTemperatureScheduleVC();
m_targetTemperatureScheduleDZ = new OSDropZone(m_targetTemperatureScheduleVC);
m_targetTemperatureScheduleDZ->setMaxItems(1);
mainGridLayout->addWidget(m_targetTemperatureScheduleDZ,7,0,1,3);
// Sensible Fraction Schedule
label = new QLabel("Sensible Fraction Schedule: ");
label->setObjectName("H2");
mainGridLayout->addWidget(label,8,0);
m_sensibleFractionScheduleVC = new SensibleFractionScheduleVC();
m_sensibleFractionScheduleDZ = new OSDropZone(m_sensibleFractionScheduleVC);
m_sensibleFractionScheduleDZ->setMaxItems(1);
mainGridLayout->addWidget(m_sensibleFractionScheduleDZ,9,0,1,3);
// Latent Fraction Schedule
label = new QLabel("Latent Fraction Schedule: ");
label->setObjectName("H2");
mainGridLayout->addWidget(label,10,0);
m_latentFractionScheduleVC = new LatentFractionScheduleVC();
m_latentFractionScheduleDZ = new OSDropZone(m_latentFractionScheduleVC);
m_latentFractionScheduleDZ->setMaxItems(1);
mainGridLayout->addWidget(m_latentFractionScheduleDZ,11,0,1,3);
// Stretch
mainGridLayout->setRowStretch(12,100);
mainGridLayout->setColumnStretch(3,100);
}
示例8: enforce_async
lcos::future<void> enforce_async(std::vector<hpx::naming::id_type> const& master_gids,double dt,
std::size_t n,std::size_t N)
{
BOOST_ASSERT(gid_);
return this->base_type::enforce_async(gid_,master_gids,dt,n,N);
}
示例9: move
void move(double dt,double time)
{
BOOST_ASSERT(gid_);
this->base_type::move(gid_,dt,time);
}
示例10: move_async
lcos::future<void> move_async(double dt,double time)
{
BOOST_ASSERT(gid_);
return this->base_type::move_async(gid_,dt,time);
}
示例11: adjust_async
lcos::future<void> adjust_async(double dt)
{
BOOST_ASSERT(gid_);
return this->base_type::adjust_async(gid_,dt);
}
示例12: get_poly
polygon_type get_poly() const
{
BOOST_ASSERT(gid_);
return this->base_type::get_poly(gid_);
}
示例13: BOOST_ASSERT
void EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u,
const NodeID node_v,
const unsigned component_id)
{
// merge edges together into one EdgeBasedNode
BOOST_ASSERT(node_u != SPECIAL_NODEID);
BOOST_ASSERT(node_v != SPECIAL_NODEID);
// find forward edge id and
const EdgeID edge_id_1 = m_node_based_graph->FindEdge(node_u, node_v);
BOOST_ASSERT(edge_id_1 != SPECIAL_EDGEID);
const EdgeData &forward_data = m_node_based_graph->GetEdgeData(edge_id_1);
// find reverse edge id and
const EdgeID edge_id_2 = m_node_based_graph->FindEdge(node_v, node_u);
BOOST_ASSERT(edge_id_2 != SPECIAL_EDGEID);
const EdgeData &reverse_data = m_node_based_graph->GetEdgeData(edge_id_2);
if (forward_data.edgeBasedNodeID == SPECIAL_NODEID &&
reverse_data.edgeBasedNodeID == SPECIAL_NODEID)
{
return;
}
BOOST_ASSERT(m_geometry_compressor.HasEntryForID(edge_id_1) ==
m_geometry_compressor.HasEntryForID(edge_id_2));
if (m_geometry_compressor.HasEntryForID(edge_id_1))
{
BOOST_ASSERT(m_geometry_compressor.HasEntryForID(edge_id_2));
// reconstruct geometry and put in each individual edge with its offset
const std::vector<GeometryCompressor::CompressedNode> &forward_geometry =
m_geometry_compressor.GetBucketReference(edge_id_1);
const std::vector<GeometryCompressor::CompressedNode> &reverse_geometry =
m_geometry_compressor.GetBucketReference(edge_id_2);
BOOST_ASSERT(forward_geometry.size() == reverse_geometry.size());
BOOST_ASSERT(0 != forward_geometry.size());
const unsigned geometry_size = static_cast<unsigned>(forward_geometry.size());
BOOST_ASSERT(geometry_size > 1);
// reconstruct bidirectional edge with individual weights and put each into the NN index
std::vector<int> forward_dist_prefix_sum(forward_geometry.size(), 0);
std::vector<int> reverse_dist_prefix_sum(reverse_geometry.size(), 0);
// quick'n'dirty prefix sum as std::partial_sum needs addtional casts
// TODO: move to lambda function with C++11
int temp_sum = 0;
for (const auto i : osrm::irange(0u, geometry_size))
{
forward_dist_prefix_sum[i] = temp_sum;
temp_sum += forward_geometry[i].second;
BOOST_ASSERT(forward_data.distance >= temp_sum);
}
temp_sum = 0;
for (const auto i : osrm::irange(0u, geometry_size))
{
temp_sum += reverse_geometry[reverse_geometry.size() - 1 - i].second;
reverse_dist_prefix_sum[i] = reverse_data.distance - temp_sum;
// BOOST_ASSERT(reverse_data.distance >= temp_sum);
}
NodeID current_edge_source_coordinate_id = node_u;
if (SPECIAL_NODEID != forward_data.edgeBasedNodeID)
{
max_id = std::max(forward_data.edgeBasedNodeID, max_id);
}
if (SPECIAL_NODEID != reverse_data.edgeBasedNodeID)
{
max_id = std::max(reverse_data.edgeBasedNodeID, max_id);
}
// traverse arrays from start and end respectively
for (const auto i : osrm::irange(0u, geometry_size))
{
BOOST_ASSERT(current_edge_source_coordinate_id ==
reverse_geometry[geometry_size - 1 - i].first);
const NodeID current_edge_target_coordinate_id = forward_geometry[i].first;
BOOST_ASSERT(current_edge_target_coordinate_id != current_edge_source_coordinate_id);
// build edges
m_edge_based_node_list.emplace_back(
forward_data.edgeBasedNodeID, reverse_data.edgeBasedNodeID,
current_edge_source_coordinate_id, current_edge_target_coordinate_id,
forward_data.nameID, forward_geometry[i].second,
reverse_geometry[geometry_size - 1 - i].second, forward_dist_prefix_sum[i],
reverse_dist_prefix_sum[i], m_geometry_compressor.GetPositionForID(edge_id_1),
component_id, i, forward_data.travel_mode, reverse_data.travel_mode);
current_edge_source_coordinate_id = current_edge_target_coordinate_id;
BOOST_ASSERT(m_edge_based_node_list.back().IsCompressed());
BOOST_ASSERT(node_u != m_edge_based_node_list.back().u ||
node_v != m_edge_based_node_list.back().v);
//.........這裏部分代碼省略.........
示例14: recompute_async
lcos::future<void> recompute_async(std::vector<hpx::naming::id_type> const& search_objects)
{
BOOST_ASSERT(gid_);
return this->base_type::recompute_async(gid_, search_objects);
}
示例15: adjust
void adjust(double dt)
{
BOOST_ASSERT(gid_);
this->base_type::adjust(gid_,dt);
}