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


C++ SurfaceMesh::elementsBegin方法代码示例

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


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

示例1: operator

    void operator()( const Grid & grid,
                     const unsigned dir,
                     const bool begin,
                     SurfaceMesh & surfaceMesh ) const
    {
        //! Sanity check of direction
        VERIFY_MSG( (dir < Grid::dim), "Input argument for direction wrong" );

        //! Dimensions of the grid
        const MultiIndexType gridSizes = grid.gridSizes();

        //! Multi-index component to compare with
        const int mIndexComp = ( begin == false ? 0 : gridSizes[dir]-1 );

        //! Number of elements in the structured grid
        const std::size_t numElements = MultiIndex::length( gridSizes );

        //! Number of elements on the requested surface
        const std::size_t numElementsOnSurface = numElements / gridSizes[ dir ];

        //! Construct parametric geometry of the element
        const unsigned surfaceID =
            detail_::convertToSurfaceID<VolumeElement::shape>( dir, begin );

        //! List of indices of the parameter space vertices which form the surface
        typename ParameterSurface::Surface
            parameterSurfaceIndices = ParameterSurface::surfaceTable[ surfaceID ];

        //! Interpolation points of the surface shape function
        boost::array< typename SurfaceShapeFun::VecDim,
                      SurfaceShapeFun::numFun> surfaceSupportPoints;
        SurfaceShapeFun::supportPoints( surfaceSupportPoints );

        
        //! Vertices of the parameter volume
        boost::array< typename LinearVolumeFun::VecDim,
                      LinearVolumeFun::numFun> volumeVertices;
        LinearVolumeFun::supportPoints( volumeVertices );

        // --> Reorder for hiearchical ordering
        //     Then, the object ParameterFaces< shape, dim-1> can be used and
        //     ParamaterSurface discarded.

        //! Iterator to surface mesh elements
        typename SurfaceMesh::ElementPtrIter surfElemIter
            = surfaceMesh.elementsBegin();

        //! Linear shape function on the surface simplex
        LinearSimplexFun linearSimplexFun;

        //! Hexahedra will have two triangles per face
        const unsigned numSurfElementsPerElement = 
            detail_::NumSimplicesPerElementSurface<VolumeElement::shape>::value;

        //! Temporary storage of surface elements and nodes
        std::vector<SurfaceElement*> surfaceElements;
        surfaceElements.reserve( numElementsOnSurface * numSurfElementsPerElement );
        std::vector<SurfaceNode*>    surfaceNodes;

        //! node counter
        std::size_t nodeCtr = 0;

        //! Go through all elements
        for ( std::size_t e = 0; e < numElements; e ++ ) {

            //! Construct multi-index from linear counter
            const MultiIndexType eM = MultiIndex::wrap( e, gridSizes );

            //! Check if on requested boundary surface
            const bool onBoundary = ( eM[ dir ] == mIndexComp );

            //! If so, construct the surface element(s)
            if ( onBoundary ) {

                //! Get pointer to volume element
                VolumeElement * vep = grid.elementPtr( eM );

                //! Go through elements on the surface of the volume element
                for ( unsigned se = 0; se < numSurfElementsPerElement; se ++ ) {

                    //! Create new surface element
                    SurfaceElement * surfElem = new SurfaceElement;

                    //! Extract the surface simplex's vertices
                    boost::array<unsigned, numSurfSimplexVertices> surfSimplex;
                    detail_::ExtractSurfaceSimplex<VolumeElement::shape>()( parameterSurfaceIndices,
                                                                            se, surfSimplex );

                    //! Set volume element pointer
                    surfElem -> setVolumeElementPointer( vep );

                    //! Access to surface elements geometry nodes
                    typename SurfaceElement::NodePtrIter nodePtrIter =
                        surfElem -> nodesBegin();

                    //! Go through the parameter points of the surface element
                    typename SurfaceElement::ParamIter paramIter =
                        surfElem -> parametricBegin();
                    typename SurfaceElement::ParamIter paramEnd  =
                        surfElem -> parametricEnd();
//.........这里部分代码省略.........
开发者ID:thrueberg,项目名称:inSilico,代码行数:101,代码来源:GenerateBoundaryTriangulationFromBox.hpp


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