Пример #1
0
    static void Ublas2Epetra( element_type const& x, vector_ptrtype& v )
    {
        epetra_vector_type& _v( dynamic_cast<epetra_vector_type&>( *v ) );
        Epetra_Map v_map( _v.Map() );

        DVLOG(2) << "Local size of ublas vector" << x.localSize() << "\n";
        DVLOG(2) << "Local size of epetra vector" << v->localSize() << "\n";

        const size_type L = v->localSize();

        for ( size_type i=0; i<L; i++ )
        {
            DVLOG(2) << "v[" << v_map.GID( i ) << "] = "
                           << "x(" << x.firstLocalIndex() + i  << ")="
                           << x( x.firstLocalIndex() + i ) << "\n";

            v->set( v_map.GID( i ), x( x.firstLocalIndex() + i ) );
        }
    }
Пример #2
0
    static void Epetra2Ublas( vector_ptrtype const& u, element_type& x )
    {
        epetra_vector_ptrtype const& _v( dynamic_cast<epetra_vector_ptrtype const&>( u ) );
        Epetra_Map v_map( _v->Map() );

        vector_type v = *u;

        //DVLOG(2) << "Initial EpetraVector " << v << "\n";

        const size_type L = v.localSize();

        for ( size_type i=0; i<L; i++ )
        {
            DVLOG(2) << "x(" << x.firstLocalIndex() + i  << ")="
                           << "v[" << v_map.GID( i ) << "] = "
                           << v( i ) << "\n";

            x( x.firstLocalIndex() + i ) = v( i );
        }

        DVLOG(2) << "Epetra2Ublas:" << x << "\n";
    }