// @HEADER // ***************************************************************************** // Trilinos: An Object-Oriented Solver Framework // // Copyright 2001-2024 NTESS and the Trilinos contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #include #include #include #include #include #include using std::vector; namespace EpetraExt { AmesosAMDGlobal_CrsGraph:: ~AmesosAMDGlobal_CrsGraph() { } AmesosAMDGlobal_CrsGraph::NewTypeRef AmesosAMDGlobal_CrsGraph:: operator()( OriginalTypeRef orig ) { origObj_ = &orig; if( orig.RowMap().DistributedGlobal() ) { std::cout << "FAIL for Global!\n"; abort(); } if( orig.IndicesAreGlobal() ) { std::cout << "FAIL for Global Indices!\n"; abort(); } // Extract the CCS information int n = orig.NumMyRows(); int nnz = orig.NumMyNonzeros(); vector Ap(n+1,0); // column pointers vector Ai(nnz); // row indices int cnt; for( int i = 0; i < n; ++i ) { int * tmpP = &Ai[Ap[i]]; orig.ExtractMyRowCopy( i, nnz-Ap[i], cnt, tmpP ); Ap[i+1] = Ap[i] + cnt; } if (verbose_) { std::cout << "-----------------------------------------\n"; std::cout << "CRS Format Graph\n"; std::cout << "-----------------------------------------\n"; for( int i = 0; i < n; ++i ) { std::cout << Ap[i] << " - " << Ap[i+1] << " : "; for( int j = Ap[i]; jImport( orig, Importer, Insert ); NewGraph_->FillComplete(); if (verbose_) { std::cout << "New CrsGraph\n"; std::cout << *NewGraph_ << std::endl; } newObj_ = &*NewGraph_; return *NewGraph_; } } //namespace EpetraExt