void ShapeCompPanel::UpdateBtnColor()
{
	wxColor col_begin(m_pc->col_begin.r, m_pc->col_begin.g, m_pc->col_begin.b, m_pc->col_begin.a);
	m_begin_col_btn->SetBackgroundColour(col_begin);

	wxColor col_end(m_pc->col_end.r, m_pc->col_end.g, m_pc->col_end.b, m_pc->col_end.a);
	m_end_col_btn->SetBackgroundColour(col_end);
}
Exemple #2
0
 T const 
 operator()( A_Matrix const & A,     //the scattering matrix A working
             Offset_Itor off_begin,  //introduced beam tilt
             Current_Itor current_begin, //target current
             T const pi_lambda_t = 7.879 ) const 
 {
     typedef typename Current_Itor::value_type value_type;
     auto I = feng::construct_a<value_type>().make_new_i_with_offset( A, pi_lambda_t, off_begin );
     T residual = 0;
     std::size_t const mid = I.row() >> 1;
     //the central column
     feng::for_each( I.col_begin(mid), I.col_end(mid), current_begin, [&residual](value_type const v1, value_type const v2)
                     {  auto const diff = v1 - v2; residual += diff*diff; } );
     return residual;
 }
Exemple #3
0
    const complex_matrix_type make_ug( const matrix_type& G, const matrix_type& A, const matrix_type& D ) const
    {
        assert( G.col() == 3 );
        assert( A.col() == 3 );
        assert( D.col() == 1 );
        assert( A.row() == D.row() );
        auto const M = make_matrix();
        auto const S = G * ( M.inverse() );
        matrix_type s( 1, S.row() );

        for ( size_type i = 0; i < S.row(); ++ i )
        {
            s[0][i] = value_type( 0.5 ) * std::sqrt( std::inner_product( S.row_begin( i ), S.row_end( i ), S.row_begin( i ), value_type( 0 ) ) );
        }

        auto const piomega =  3.141592553590 * feng::inner_product( array_type( M[0][0], M[1][0], M[2][0] ), 
                                                                    feng::cross_product( array_type( M[0][1], M[1][1], M[2][1] ), array_type( M[0][2], M[1][2], M[2][2] ) ) );
        auto const atomcellfacte = make_gaussian_electron( s, v0 );
        const complex_matrix_type dwss = D * feng::pow( s, value_type( 2 ) );
        const complex_matrix_type piag = A * G.transpose();
        auto fact = feng::exp( - dwss - piag * complex_type( 0, 6.2831853071796 ) );
        std::transform( fact.begin(), fact.end(), atomcellfacte.begin(), fact.begin(), [piomega]( const complex_type f,  const value_type a )
        {
            return f * a / piomega;
        } );
        complex_matrix_type Ug( fact.col(), 1 );

        for ( size_type i = 0; i < fact.col(); ++i )
        {
            Ug[i][0] = std::accumulate( fact.col_begin( i ), fact.col_end( i ), complex_type() );
            //if ( std::abs(Ug[i][0].real()) < 1.0e-8 ) Ug[i][0].real(0);
            //if ( std::abs(Ug[i][0].imag()) < 1.0e-8 ) Ug[i][0].imag(0);
        }

        return Ug;
    }
 const_reverse_col_type col_crend( const size_type index = 0 ) const
 {
     return const_reverse_col_type( col_begin( index ) );
 }
 reverse_col_type col_rend( const size_type index = 0 )
 {
     return reverse_col_type( col_begin( index ) );
 }
 const_col_type col_cend( const size_type index ) const
 {
     zen_type const& zen = static_cast<zen_type const&>( *this );
     return col_begin( index ) + zen.row();
 }