77 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: SourceGraph and TargetGraph global indices type mismatch", -1);
79 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
80 GenerateLocalOffsets_<int>( SourceGraph, TargetGraph,
83 GenerateRemoteOffsets_<int>( SourceGraph, TargetGraph,
84 ExportLIDs, RemoteLIDs,
87 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: ERROR, GlobalIndicesInt but no API for it.",-1);
91 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
92 GenerateLocalOffsets_<long long>( SourceGraph, TargetGraph,
95 GenerateRemoteOffsets_<long long>( SourceGraph, TargetGraph,
96 ExportLIDs, RemoteLIDs,
99 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: ERROR, GlobalIndicesLongLong but no API for it.",-1);
103 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: SourceGraph global indices type unknown", -1);
133 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: SourceGraph and TargetGraph global indices type mismatch", -1);
135 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
136 GenerateLocalOffsets_<int>( SourceGraph, TargetGraph,
139 GenerateRemoteOffsets_<int>( SourceGraph, TargetGraph,
140 ExportLIDs, RemoteLIDs,
143 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: ERROR, GlobalIndicesInt but no API for it.",-1);
147 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
148 GenerateLocalOffsets_<long long>( SourceGraph, TargetGraph,
151 GenerateRemoteOffsets_<long long>( SourceGraph, TargetGraph,
152 ExportLIDs, RemoteLIDs,
155 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: ERROR, GlobalIndicesLongLong but no API for it.",-1);
159 throw ReportError(
"Epetra_OffsetIndex::Epetra_OffsetIndex: SourceGraph global indices type unknown", -1);
166 NumSame_(Indexor.NumSame_),
167 SameOffsets_(Indexor.SameOffsets_),
168 NumPermute_(Indexor.NumPermute_),
169 PermuteOffsets_(Indexor.PermuteOffsets_),
171 NumRemote_(Indexor.NumRemote_),
172 RemoteOffsets_(Indexor.RemoteOffsets_),
196 template<
typename int_type>
199 const int * PermuteLIDs )
203 int NumSourceIndices;
204 int_type * SourceIndices = 0;
205 if( GlobalMaxNumSourceIndices>0 ) SourceIndices =
new int_type[GlobalMaxNumSourceIndices];
211 for(
int i = 0; i <
NumSame_; ++i ) {
212 int_type GID = (int_type) SourceGraph.
GRID64(i);
214 GlobalMaxNumSourceIndices,
218 if( NumSourceIndices > 0 )
SameOffsets_[i] =
new int[NumSourceIndices];
222 for(
int j = 0; j < NumSourceIndices; ++j ) {
236 int_type GID = (int_type) SourceGraph.
GRID64(PermuteLIDs[i]);
238 GlobalMaxNumSourceIndices,
242 if( NumSourceIndices > 0 )
PermuteOffsets_[i] =
new int[NumSourceIndices];
246 for(
int j = 0; j < NumSourceIndices; ++j ) {
255 if( GlobalMaxNumSourceIndices>0 )
delete [] SourceIndices;
259 template<
typename int_type>
262 const int * ExportLIDs,
263 const int * RemoteLIDs,
285 TotalSize += Sizes[i];
288 int_type * SourceArray =
new int_type[TotalSize+1];
291 int_type GID = (int_type) SourceGraph.
GRID64(ExportLIDs[i]);
292 SourceArray[Loc] = Sizes[i]-1;
296 &(SourceArray[Loc+1]) );
301 char * cRecvArray = 0;
302 int_type * RecvArray = 0;
303 int RecvArraySize = 0;
305 Distor.
Do( reinterpret_cast<char *>(SourceArray),
306 (
int)
sizeof(int_type),
310 RecvArray =
reinterpret_cast<int_type*
>(cRecvArray);
318 NumIndices = (int) RecvArray[Loc];
323 for(
int j = 0; j < NumIndices; ++j ) {
337 if( Sizes )
delete [] Sizes;
338 if( SourceArray )
delete [] SourceArray;
339 if( RecvArraySize )
delete [] cRecvArray;
345 os <<
"Number of Same IDs = " <<
NumSame_ << std::endl;
346 os <<
"Number of Permute IDs = " <<
NumPermute_ << std::endl;
347 os <<
"Number of Remote IDs = " <<
NumRemote_ << std::endl;
int GlobalMaxNumIndices() const
Returns the maximun number of nonzero entries across all rows across all processors.
int * ExportLIDs() const
List of elements that will be sent to other processors.
int NumRemoteIDs() const
Returns the number of elements that are not on the calling processor.
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
int NumSameIDs() const
Returns the number of elements that are identical between the source and target maps, up to the first different ID.
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
virtual void Print(std::ostream &os) const
Print object to an output stream Print method.
int NumPermuteIDs() const
Returns the number of elements that are local to the calling processor, but not part of the first Num...
Epetra_Distributor & Distributor() const
int NumSameIDs() const
Returns the number of elements that are identical between the source and target maps, up to the first different ID.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
void GenerateLocalOffsets_(const Epetra_CrsGraph &SourceGraph, const Epetra_CrsGraph &TargetGraph, const int *PermuteLIDs)
Epetra_Distributor & Distributor() const
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
int * ExportLIDs() const
List of elements that will be sent to other processors.
bool FindGlobalIndexLoc(int LocalRow, int Index, int Start, int &Loc) const
int NumExportIDs() const
Returns the number of elements that must be sent by the calling processor to other processors...
Epetra_Object: The base Epetra class.
long long GRID64(int LRID_in) const
const Epetra_BlockMap & RowMap() const
Returns the RowMap associated with this graph.
int * RemoteLIDs() const
List of elements in the target map that are coming from other processors.
int ExtractGlobalRowCopy(int GlobalRow, int LenOfIndices, int &NumIndices, int *Indices) const
Extract a list of elements in a specified global row of the graph. Put into storage allocated by call...
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
virtual int Do(char *export_objs, int obj_size, int &len_import_objs, char *&import_objs)=0
Execute plan on buffer of export objects in a single step.
int NumPermuteIDs() const
Returns the number of elements that are local to the calling processor, but not part of the first Num...
Epetra_OffsetIndex(const Epetra_CrsGraph &SourceGraph, const Epetra_CrsGraph &TargetGraph, Epetra_Import &Importer)
Constructs a Epetra_OffsetIndex object from the graphs and an importer.
int NumMyIndices(int Row) const
Returns the current number of nonzero entries in specified local row on this processor.
int NumExportIDs() const
Returns the number of elements that must be sent by the calling processor to other processors...
void GenerateRemoteOffsets_(const Epetra_CrsGraph &SourceGraph, const Epetra_CrsGraph &TargetGraph, const int *ExportLIDs, const int *RemoteLIDs, Epetra_Distributor &Distor)
virtual int NumProc() const =0
Returns total number of processes.
int * RemoteLIDs() const
List of elements in the target map that are coming from other processors.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
int NumRemoteIDs() const
Returns the number of elements that are not on the calling processor.
virtual ~Epetra_OffsetIndex(void)
Epetra_OffsetIndex destructor.
int * PermuteToLIDs() const
List of elements in the target map that are permuted.
int * PermuteToLIDs() const
List of elements in the target map that are permuted.
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...
bool GlobalIndicesTypeMatch(const Epetra_BlockMap &other) const