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


C++ Switch::create方法代码示例

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


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

示例1: checkVolumes

Real checkVolumes ( RegionMesh const& mesh,
                    std::vector<bool>& elSign,
                    Switch& sw )
{
    Real meas = 0.0;
    Real lmeas = 0.0;
    elSign.clear();
    elSign.reserve ( mesh.numVolumes() );
    typedef typename RegionMesh::elementShape_Type GeoShape;

    switch ( GeoShape::S_shape )
    {
        case TETRA:
        {
            CurrentFE fe ( feTetraP1, geoLinearTetra, quadRuleTetra1pt );
            for ( ID i = 0; i < mesh.numVolumes(); i++ )
            {
                fe.updateJac ( mesh.volume ( i ) );
                lmeas = fe.measure();
                meas += lmeas;
                elSign.push_back ( lmeas > 0.0 );
            }
        }
        break;
        case HEXA:
        {
            CurrentFE fe ( feHexaQ1, geoBilinearHexa, quadRuleHexa1pt );
            for ( ID i = 0; i < mesh.numVolumes(); i++ )
            {
                fe.updateJac ( mesh.volume ( i ) );
                lmeas = fe.measure();
                meas += lmeas;
                elSign.push_back ( lmeas > 0.0 );
            }
        }
        break;
        default:
            sw.create ( "SKIP_ORIENTATION_TEST", true );

            return 0;
    }

    if ( std::find ( elSign.begin(), elSign.end(), false ) != elSign.end() )
    {
        sw.create ( "HAS_NEGATIVE_VOLUMES", true );
    }

    return meas;
}
开发者ID:erianthus,项目名称:lifev,代码行数:49,代码来源:MeshChecks.hpp

示例2: fixVolumes

void fixVolumes ( RegionMesh& mesh,
                  const std::vector<bool>& elSign,
                  Switch& sw )
{

    for ( ID i = 0; i < mesh.numVolumes(); i++ )
    {
        if ( ! elSign[ i ] )
        {
            mesh.volume (i).reversePoints();
        }
    }
    sw.create ("HAS_VOLUMES", true);
}
开发者ID:erianthus,项目名称:lifev,代码行数:14,代码来源:MeshChecks.hpp

示例3: 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)
//.........这里部分代码省略.........
开发者ID:erianthus,项目名称:lifev,代码行数:101,代码来源:MeshChecks.hpp


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