void setBendAngles(const Polymorph& aValue)
   {
     BendAngles = aValue;
     PolymorphVector aValueVector(aValue.as<PolymorphVector>());
     for(unsigned int i(0); i != aValueVector.size(); ++i)
       {
         theBendAngles.push_back(aValueVector[i].as<double>());
       }
   }
示例#2
0
    SET_METHOD( Polymorph, SSystemMatrix )
    {
        SSystemMatrix = value;
        PolymorphVector aValueVector( value.as<PolymorphVector>() );
        theSystemSize = aValueVector.size();

        // init Substance Vector
        theY.resize( boost::extents[ theSystemSize + 1 ][ Order + 1 ] );

        // init S-System Vector & Matrix
        theAlpha.resize( boost::extents[ theSystemSize + 1 ] );
        theBeta.resize( boost::extents[ theSystemSize + 1] );
        theG.resize( boost::extents[ theSystemSize + 1 ][ theSystemSize + 1 ] );
        theH.resize( boost::extents[ theSystemSize + 1 ][ theSystemSize + 1 ] );

        // init S-System tmp Vector & Matrix
        theAlphaBuffer.resize( boost::extents[ theSystemSize + 1 ][ Order + 1 ] );
        theBetaBuffer.resize( boost::extents[ theSystemSize + 1 ][ Order + 1 ] );
        theGBuffer.resize( boost::extents[ theSystemSize + 1 ][ Order + 1 ] );
        theHBuffer.resize( boost::extents[ theSystemSize + 1 ][ Order + 1 ] );

        theFBuffer.resize( boost::extents[ Order + 1 ][ Order + 1 ] );

        // init Factorial matrix
        for(int m( 2 ) ; m < Order+1 ; m++)
        {
            for(int q( 1 ); q < m ; q++)
            {
                const Real aFact( 1 / gsl_sf_fact(q-1) * gsl_sf_fact(m-q-1) * m * (m-1) );
                (theFBuffer[m])[q] = aFact;
            }
        }

        // set Alpha, Beta, G, H
        for( int i( 0 ); i < theSystemSize; ++i )
        {

            theAlpha[i+1] = (aValueVector[i].as<PolymorphVector>())[0].as<Real>() ;
            for( int j( 0 ); j < theSystemSize; ++j )
            {
                if( i == j )
                {

                    (theG[i+1])[j+1] = (aValueVector[i].as<PolymorphVector>())[j+1].as<Real>() - 1 ;
                }
                else
                {
                    (theG[i+1])[j+1] = (aValueVector[i].as<PolymorphVector>())[j+1].as<Real>() ;
                }
            }
            theBeta[i+1] = (aValueVector[i].as<PolymorphVector>())[1+theSystemSize].as<Real>() ;
            for( int j( 0 ); j < theSystemSize; ++j )
            {
                if( i == j )
                {
                    (theH[i+1])[j+1] = (aValueVector[i].as<PolymorphVector>())[2+j+theSystemSize].as<Real>() -1 ;
                }
                else
                {
                    (theH[i+1])[j+1] = (aValueVector[i].as<PolymorphVector>())[2+j+theSystemSize].as<Real>() ;
                }
            }
        }
    }