本文整理汇总了C++中Switch类的典型用法代码示例。如果您正苦于以下问题:C++ Switch类的具体用法?C++ Switch怎么用?C++ Switch使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Switch类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkMesh3D
bool checkMesh3D ( RegionMesh& mesh,
Switch& sw,
bool fix = true,
bool verbose = false,
std::ostream& out = std::cerr,
std::ostream& err = std::cerr,
std::ostream& clog = std::clog )
{
verbose = verbose && ( mesh.comm()->MyPID() == 0 );
typedef typename RegionMesh::point_Type point_Type;
if ( mesh.storedPoints() == 0 )
{
err << "FATAL: mesh does not store points: I cannot do anything"
<< std::endl;
sw.create ( "ABORT_CONDITION", true );
sw.create ( "NOT_HAS_POINTS", true );
return false;
}
if (verbose)
{
out << " Check point marker ids" << std::endl;
}
if ( !MeshUtility::checkIsMarkerSet ( mesh.pointList ) )
{
if (verbose)
{
err << "WARNING: Not all points have marker id set" << std::endl;
}
sw.create ( "POINTS_MARKER_UNSET", true );
}
//-------------------------------------------------------------------------
// VOLUMES
//-------------------------------------------------------------------------
if ( mesh.storedVolumes() == 0 )
{
if (verbose) err << "FATAL: mesh does not store volumes: I cannot do anything"
<< std::endl;
sw.create ( "ABORT_CONDITION", true );
sw.create ( "NOT_HAS_VOLUMES", true );
return false;
}
if ( !MeshUtility::checkId ( mesh.volumeList ) )
{
if (verbose)
{
err << "ERROR: volume ids were wrongly set" << std::endl;
err << "FIXED" << std::endl;
}
if ( fix )
{
sw.create ( "FIXED_VOLUMES_ID", true );
}
if ( fix )
{
MeshUtility::fixId ( mesh.volumeList );
}
}
if (verbose)
{
out << " Check volum marker ids" << std::endl;
}
if ( !MeshUtility::checkIsMarkerSet ( mesh.volumeList ) )
{
if (verbose)
{
err << "WARNING: Not all volumes have marker flag set" << std::endl;
}
sw.create ( "VOLUMES_MARKER_UNSET", true );
if ( fix )
{
if (verbose)
{
out << "Fixing volume marker ids" << std::endl;
}
for ( typename RegionMesh::volumes_Type::iterator iv = mesh.volumeList.begin();
iv != mesh.volumeList.end(); ++iv )
{
if ( iv->isMarkerUnset() )
{
iv->setMarkerID ( mesh.markerID() );
}
}
}
}
if ( mesh.numElements() < mesh.storedVolumes() )
{
if (verbose)
//.........这里部分代码省略.........
示例2: notify_collision_with_switch
/**
* \brief This function is called when a switch detects a collision with this entity.
* \param sw the switch
* \param collision_mode the collision mode that detected the event
*/
void Block::notify_collision_with_switch(Switch& sw, CollisionMode collision_mode) {
sw.try_activate(*this);
}
示例3: notify_collision_with_switch
/**
* @brief This function is called when a the sprite of a switch
* detects a pixel-precise collision with a sprite of this entity.
* @param sw the switch
* @param sprite_overlapping the sprite of the current entity that collides with the switch
*/
void Explosion::notify_collision_with_switch(Switch& sw, Sprite& sprite_overlapping) {
sw.try_activate();
}