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


C++ GaussPoint::setNaturalCoordinates方法代码示例

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


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

示例1: computeVertexBendingMoments

void
DKTPlate :: computeVertexBendingMoments(FloatMatrix &answer, TimeStep *tStep)
{
#ifdef DKT_EnableVertexMomentsCache
    if ( stateCounter == tStep->giveSolutionStateCounter() ) {
        answer = vertexMoments;
        return;
    }
#endif

    // the results should be cached somehow, as computing on the fly is highly inefficient
    // due to multiple requests
    FloatMatrix dndx;
    answer.resize(5, 3);

    FloatMatrix b;
    FloatArray eps, m;
    FloatArray coords [ 3 ]; // vertex local coordinates
    coords [ 0 ] = {
        1.0, 0.0
    };
    coords [ 1 ] = {
        0.0, 1.0
    };
    coords [ 2 ] = {
        0.0, 0.0
    };

    GaussIntegrationRule iRule = GaussIntegrationRule(1, this, 1, 1); // dummy rule used to evaluate B at vertices
    iRule.SetUpPointsOnTriangle(1, _Unknown);
    GaussPoint *vgp = iRule.getIntegrationPoint(0);

    for ( int i = 1; i <= this->numberOfDofMans; i++ ) {
        vgp->setNaturalCoordinates(coords [ i - 1 ]);
        this->computeStrainVector(eps, vgp, tStep);
        this->giveStructuralCrossSection()->giveGeneralizedStress_Plate(m, vgp, eps, tStep);
        answer.setColumn(m, i);
    }

#ifdef DKT_EnableVertexMomentsCache
    this->vertexMoments = answer;
    this->stateCounter = tStep->giveSolutionStateCounter();
#endif
}
开发者ID:vivianyw,项目名称:oofem,代码行数:44,代码来源:dkt.C

示例2: SetUpPointsOnWedge

int
PatchIntegrationRule :: SetUpPointsOnWedge(int nPointsTri, int nPointsDepth, MaterialMode mode)
{
    //int pointsPassed = 0;

    // TODO: set properly
    firstLocalStrainIndx = 1;
    lastLocalStrainIndx = 3;

    double totArea = 0.0;
    for ( size_t i = 0; i < mTriangles.size(); i++ ) {
        totArea += mTriangles [ i ].getArea();
    }

    std :: vector< int >triToKeep;
    const double triTol = ( 1.0e-6 ) * totArea;

    for ( size_t i = 0; i < mTriangles.size(); i++ ) {
        if ( mTriangles [ i ].getArea() > triTol ) {
            triToKeep.push_back(i);
        }
    }

    int nPointsTot = nPointsTri * nPointsDepth * triToKeep.size();
    FloatArray coords_xi1, coords_xi2, coords_xi3, weightsTri, weightsDepth;
    this->giveTriCoordsAndWeights(nPointsTri, coords_xi1, coords_xi2, weightsTri);
    this->giveLineCoordsAndWeights(nPointsDepth, coords_xi3, weightsDepth);
    this->gaussPoints.resize(nPointsTot);

    std :: vector< FloatArray >newGPCoord;

    double parentArea = this->elem->computeArea();
    int count = 0;

    // Loop over triangles
    for ( int i = 0; i < int( triToKeep.size() ); i++ ) {

        Triangle triangle = mTriangles [ triToKeep [ i ] ];
        
        // global coords of the the triangle verticies
        std::vector< FloatArray > gCoords( triangle.giveNrVertices() );
        for ( int j = 0; j < triangle.giveNrVertices(); j++ ) {
            gCoords[j] = (triangle.giveVertex(j + 1));
        }
        

        for ( int k = 1; k <= nPointsTri; k++ ) {
            for ( int m = 1; m <= nPointsDepth; m++ ) {
                // local coords in the parent triangle
                FloatArray *lCoords = new FloatArray(3);
                lCoords->at(1) = coords_xi1.at(k);
                lCoords->at(2) = coords_xi2.at(k);
                lCoords->at(3) = coords_xi3.at(m);

                double refElArea = 0.5;
                double oldWeight = weightsTri.at(k) * weightsDepth.at(m);
                double newWeight = 2.0 * refElArea * oldWeight * triangle.getArea() / parentArea; 
                
                GaussPoint *gp = new GaussPoint(this, count + 1, lCoords, newWeight, mode);
                this->gaussPoints[count] = gp;
                count++;
                
                
                // Compute global gp coordinate in the element from local gp coord in the sub triangle
                FloatArray global;
                mTriInterp.local2global( global, * gp->giveNaturalCoordinates(),
                                    FEIVertexListGeometryWrapper(gCoords) );
                 
                
                // Compute local gp coordinate in the element from global gp coord in the element
                FloatArray local;
                this->elem->computeLocalCoordinates(local, global);
                local.at(3) = coords_xi3.at(m); // manually set third coordinate
                // compute global coords again, since interpolator dosn't give the z-coord 
                this->elem->computeGlobalCoordinates(global, local);
                
                gp->setGlobalCoordinates(global);
                gp->setNaturalCoordinates(local);
                gp->setSubPatchCoordinates(local);

                // Store new global gp coord for vtk output
                newGPCoord.push_back(global);
            }
        }


        //for ( int k = 0; k < mTriangles [ triToKeep [ i ] ].giveNrVertices(); k++ ) {
        //    delete gCoords [ k ];
        //}

        //delete [] gCoords;
    }

    XfemManager *xMan = elem->giveDomain()->giveXfemManager();
    if ( xMan != NULL ) {
        if ( xMan->giveVtkDebug() ) {
            double time = 0.0;

            Element *el = this->elem;
            if ( el != NULL ) {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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