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


C++ Boundary::leftCell方法代码示例

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


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

示例1: calcGBounds

RVector calcGBounds( const std::vector< RVector3 > & pos, const Mesh & mesh, const RVector & model ){
    /*! Ensure neighbourInfos() */
    RMatrix Jacobian( pos.size(), mesh.cellCount() );

    Jacobian *= 0.;

    for ( uint i = 0; i < pos.size(); i ++ ){
        for ( std::vector< Boundary * >::const_iterator it = mesh.boundaries().begin(); it != mesh.boundaries().end(); it ++ ){
            Boundary *b = *it;
            double Z = lineIntegraldGdz( b->node( 0 ).pos() - pos[ i ], b->node( 1 ).pos() - pos[ i ] );

            if ( b->leftCell() ) Jacobian[ i ][ b->leftCell()->id() ] = Jacobian[ i ][ b->leftCell()->id() ] - Z;
            if ( b->rightCell() ) Jacobian[ i ][ b->rightCell()->id() ] = Jacobian[ i ][ b->rightCell()->id() ] + Z;
        }
    }

    return Jacobian * model * 2.0 * 6.67384e-11 * 1e5;
}
开发者ID:gimli-org,项目名称:gimli,代码行数:18,代码来源:gravimetry.cpp

示例2: findCommonBoundary

Boundary * findCommonBoundary(const Cell & c1, const Cell & c2){
    for (Index i = 0; i < c1.boundaryCount(); i ++){
        Boundary * b = findBoundary(c1.boundaryNodes(i));
        if ((b->leftCell() == &c1 && b->rightCell() == &c2) || 
            (b->leftCell() == &c2 && b->rightCell() == &c1)){
            return b;
        }
    }
    return NULL;
}
开发者ID:KristoferHellman,项目名称:gimli,代码行数:10,代码来源:meshentities.cpp

示例3: addTriangleBoundary

bool addTriangleBoundary(Mesh & mesh, double xBoundary, double yBoundary, int cellMarker, 
                          bool save){

    int boundMarker = -5;
    
    mesh.createNeighbourInfos(true);
    Boundary *b = NULL;
    for (std::vector < Boundary * >::const_iterator it = mesh.boundaries().begin();
        it != mesh.boundaries().end(); it ++){
        b = (*it);
        if (! b->leftCell() || ! b->rightCell()) {
            if (b->marker() != MARKER_BOUND_HOMOGEN_NEUMANN){
                b->setMarker(boundMarker);
            }
        }
    }
    
    std::vector < Boundary * > markedBoundaries(mesh.findBoundaryByMarker(boundMarker));
    Boundary *start(markedBoundaries.front());
    
    std::list < Node * > boundNodes;
    
    boundNodes.push_back(& start->node(0));
    Boundary * thisBoundary = start;
    
    while (thisBoundary != NULL){
        Node * thisNode = boundNodes.back();
        Boundary * nextBoundary = NULL;
    
        for (std::set < Boundary * >::iterator it = thisNode->boundSet().begin();
                it != thisNode->boundSet().end(); it++){
        
            if ((*it)->marker() == boundMarker && (*it) != thisBoundary){
                nextBoundary = (*it);
                break;
            }
        }
        if (nextBoundary){
            Node * nextNode = NULL; 
            if (&nextBoundary->node(0) != thisNode){
                nextNode = &nextBoundary->node(0);
            } else {
                nextNode = &nextBoundary->node(1);
            }
            //** Check closed polygones here 
            if (find(boundNodes.begin(), boundNodes.end(), nextNode) == boundNodes.end()) {
                boundNodes.push_back(nextNode);
            } else {
                break;
            }
        }
        thisBoundary = nextBoundary;
    }
    boundNodes.push_front(& start->node(1));
    thisBoundary = start;
    
    while (thisBoundary != NULL){
        Node * thisNode = boundNodes.front();
        Boundary * nextBoundary = NULL;
    
        for (std::set < Boundary * >::iterator it = thisNode->boundSet().begin();
                it != thisNode->boundSet().end(); it++){
        
            if ((*it)->marker() == boundMarker && (*it) != thisBoundary){
                nextBoundary = (*it);
                break;
            }
        }
        if (nextBoundary){
            Node * nextNode = NULL; 
            if (& nextBoundary->node(0) != thisNode){
                nextNode = & nextBoundary->node(0);
            } else {
                nextNode = & nextBoundary->node(1);
            }

            //** Check closed polygones here 
            if (find(boundNodes.begin(), boundNodes.end(), nextNode) == boundNodes.end()) {
                boundNodes.push_front(nextNode);
            } else {
                break;
            }
        }
        thisBoundary = nextBoundary;
    }
    
    Mesh poly;
    std::vector < Node * > innerBound;
    for (std::list < Node * >::iterator it = boundNodes.begin(); 
        it != boundNodes.end(); it ++){
        innerBound.push_back(poly.createNode((*it)->pos()));
    }
        
    //** looking for polygon ends
    Node * upperLeftSurface = innerBound.front(); 
    Node * upperRightSurface = innerBound.back();
    if (upperLeftSurface->pos()[0] > upperRightSurface->pos()[0]){
        upperLeftSurface = innerBound.back(); 
        upperRightSurface = innerBound.front();
    }
//.........这里部分代码省略.........
开发者ID:zhangwise,项目名称:gimli,代码行数:101,代码来源:meshgenerators.cpp


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