Exemple #1
0
    sparse_matrix_ptrtype newMatrix( DataMap const& domainmap,
                                     DataMap const& imagemap,
                                     size_type matrix_properties = NON_HERMITIAN,
                                     bool init = true )
    {
        Epetra_Map erowmap = BackendTrilinos::epetraMap( imagemap );
        Epetra_Map ecolmap = BackendTrilinos::epetraMapStatic( domainmap );
        Epetra_Map edomainmap = BackendTrilinos::epetraMap( imagemap );

        //std::cout << "Rowmap: " << erowmap << "\n";
        //std::cout << "Colmap: " << ecolmap << "\n";
        //std::cout << "Domainmap: " << edomainmap << "\n";

        //std::cout << "Is matrix rectangular? " << !erowmap.SameAs( ecolmap ) << "\n";

        if ( !erowmap.SameAs( ecolmap ) )
        {
            Epetra_Map eimagemap = BackendTrilinos::epetraMap( domainmap );
            //std::cout << "Imagemap: " << eimagemap << "\n";
            auto A= sparse_matrix_ptrtype( new epetra_sparse_matrix_type( erowmap, ecolmap, edomainmap, eimagemap ) );
            A->setMatrixProperties( matrix_properties );
            return A;
        }

        else
        {
            auto A= sparse_matrix_ptrtype( new epetra_sparse_matrix_type( erowmap, ecolmap ) );
            A->setMatrixProperties( matrix_properties );
            return A;
        }
    }
Exemple #2
0
 sparse_matrix_ptrtype
 newMatrix( datamap_ptrtype const& d1, datamap_ptrtype const& d2, size_type matrix_properties = NON_HERMITIAN, bool init = true )
 {
     auto A = sparse_matrix_ptrtype( new eigen_sparse_matrix_type( d1->nGlobalElements(), d2->nGlobalElements() ) );
     A->setMatrixProperties( matrix_properties );
     return A;
 }
Exemple #3
0
void Game::DrawMap()
{
	glPushMatrix();
	glTranslatef(-(MAP_WIDTH * FIGURE_SIZE) / 2.0, -(MAP_HEIGHT * FIGURE_SIZE) / 2.0, 0);
	for(int i = 0; i < MAP_HEIGHT; i++) {
		for(int j = 0; j < MAP_WIDTH; j++) {
			glPushMatrix();
			setMatrixProperties(j, i);	// set the position and color
			switch(map.getTile(j, i)) {
			case Tile::SPHERE:
				glutWireSphere(FIGURE_SIZE/2.0, 10, 10);
				break;
			case Tile::CONE:
				glPushMatrix();
				glTranslatef(0, 0, -FIGURE_SIZE/2.0);
				glutWireCone(FIGURE_SIZE/2.0, FIGURE_SIZE, 10, 10);
				glPopMatrix();
				break;
			case Tile::CUBE:
				glutWireCube(FIGURE_SIZE);
				break;
			case Tile::EMPTY:
				glPushMatrix();
				glTranslatef(0, 0, -FIGURE_SIZE/8.0);
				glutSolidCube(FIGURE_SIZE/2.0);
				glPopMatrix();
				break;
			}
			glPopMatrix();
		}
	}
	glPopMatrix();
}
Exemple #4
0
 static sparse_matrix_ptrtype newMatrix( boost::shared_ptr<DomainSpace> const& space1,
                                         boost::shared_ptr<DualImageSpace> const& space2,
                                         size_type matrix_properties = NON_HERMITIAN )
 {
     Context ctx( matrix_properties );
     //if ( ctx.test( DENSE ) )
     {
         auto A= sparse_matrix_ptrtype( new eigen_sparse_matrix_type( space1->nDof(), space2->nDof() ) );
         A->setMatrixProperties( matrix_properties );
         return A;
     }
 }