//============================================================================== // Epetra_OffsetIndex constructor from Exporter Epetra_OffsetIndex::Epetra_OffsetIndex( const Epetra_CrsGraph & SourceGraph, const Epetra_CrsGraph & TargetGraph, Epetra_Export & Exporter ) : Epetra_Object("Epetra::OffsetIndex"), NumSame_(0), SameOffsets_(0), NumPermute_(0), PermuteOffsets_(0), NumExport_(0), NumRemote_(0), RemoteOffsets_(0), DataOwned_(true) { NumSame_ = Exporter.NumSameIDs(); NumPermute_ = Exporter.NumPermuteIDs(); int * PermuteLIDs = Exporter.PermuteToLIDs(); NumExport_ = Exporter.NumExportIDs(); int * ExportLIDs = Exporter.ExportLIDs(); NumRemote_ = Exporter.NumRemoteIDs(); int * RemoteLIDs = Exporter.RemoteLIDs(); if(!SourceGraph.RowMap().GlobalIndicesTypeMatch(TargetGraph.RowMap())) throw ReportError("Epetra_OffsetIndex::Epetra_OffsetIndex: SourceGraph and TargetGraph global indices type mismatch", -1); if(SourceGraph.RowMap().GlobalIndicesInt()) { #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES GenerateLocalOffsets_<int>( SourceGraph, TargetGraph, PermuteLIDs ); GenerateRemoteOffsets_<int>( SourceGraph, TargetGraph, ExportLIDs, RemoteLIDs, Exporter.Distributor() ); #else throw ReportError("Epetra_OffsetIndex::Epetra_OffsetIndex: ERROR, GlobalIndicesInt but no API for it.",-1); #endif } else if(SourceGraph.RowMap().GlobalIndicesLongLong()) { #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES GenerateLocalOffsets_<long long>( SourceGraph, TargetGraph, PermuteLIDs ); GenerateRemoteOffsets_<long long>( SourceGraph, TargetGraph, ExportLIDs, RemoteLIDs, Exporter.Distributor() ); #else throw ReportError("Epetra_OffsetIndex::Epetra_OffsetIndex: ERROR, GlobalIndicesLongLong but no API for it.",-1); #endif } else throw ReportError("Epetra_OffsetIndex::Epetra_OffsetIndex: SourceGraph global indices type unknown", -1); }
//============================================================================= int Epetra_DistObject::Import(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor) { if (!Map_.SameAs(Exporter.SourceMap())) EPETRA_CHK_ERR(-2); if (!A.Map().SameAs(Exporter.TargetMap())) EPETRA_CHK_ERR(-3); int NumSameIDs = Exporter.NumSameIDs(); int NumPermuteIDs = Exporter.NumPermuteIDs(); int NumRemoteIDs = Exporter.NumExportIDs(); int NumExportIDs = Exporter.NumRemoteIDs(); int* ExportLIDs = Exporter.RemoteLIDs(); int* RemoteLIDs = Exporter.ExportLIDs(); int* PermuteToLIDs = Exporter.PermuteFromLIDs(); int* PermuteFromLIDs = Exporter.PermuteToLIDs(); EPETRA_CHK_ERR(DoTransfer(A, CombineMode, NumSameIDs, NumPermuteIDs, NumRemoteIDs, NumExportIDs, PermuteToLIDs, PermuteFromLIDs, RemoteLIDs, ExportLIDs, LenImports_, Imports_, LenExports_, Exports_, Exporter.Distributor(), true, Indexor)); return(0); }