Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_CrsGraph.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_CRSGRAPH_H
45 #define EPETRA_CRSGRAPH_H
46 
47 #include "Epetra_ConfigDefs.h"
48 #include "Epetra_DistObject.h"
49 #include "Epetra_CrsGraphData.h"
50 class Epetra_BlockMap;
51 class Epetra_Util;
52 class Epetra_Time;
53 class Epetra_Import;
54 class Epetra_Export;
55 class Epetra_Distributor;
56 class Epetra_RowMatrix;
57 
59 
213 class EPETRA_LIB_DLL_EXPORT Epetra_CrsGraph: public Epetra_DistObject {
214 
215  public:
216 
218 
219 
232  Epetra_CrsGraph(Epetra_DataAccess CV, const Epetra_BlockMap& RowMap, const int* NumIndicesPerRow, bool StaticProfile = false);
233 
235 
248  Epetra_CrsGraph(Epetra_DataAccess CV, const Epetra_BlockMap& RowMap, int NumIndicesPerRow, bool StaticProfile = false);
249 
251 
266  const Epetra_BlockMap& ColMap, const int* NumIndicesPerRow, bool StaticProfile = false);
267 
269 
286  const Epetra_BlockMap& ColMap, int NumIndicesPerRow, bool StaticProfile = false);
287 
289 
292  Epetra_CrsGraph(const Epetra_CrsGraph& Graph);
293 
295  virtual ~Epetra_CrsGraph();
297 
299 
300 
315 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
316  int InsertGlobalIndices(int GlobalRow, int NumIndices, int* Indices);
317 #endif
318 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
319  int InsertGlobalIndices(long long GlobalRow, int NumIndices, long long* Indices);
320 #endif
321 
323 
332 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
333  int RemoveGlobalIndices(int GlobalRow, int NumIndices, int* Indices);
334 #endif
335 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
336  int RemoveGlobalIndices(long long GlobalRow, int NumIndices, long long* Indices);
337 #endif
338 
340 
347  int RemoveGlobalIndices(long long Row);
348 
349 
351 
366  int InsertMyIndices(int LocalRow, int NumIndices, int* Indices);
367 
369 
378  int RemoveMyIndices(int LocalRow, int NumIndices, int* Indices);
379 
381 
388  int RemoveMyIndices(int Row);
390 
392 
393 
395 
402  int FillComplete();
403 
405 
417  int FillComplete(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
418 
420 
434  int OptimizeStorage();
435 
437 
439 
440 
442 
450 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
451  int ExtractGlobalRowCopy(int GlobalRow, int LenOfIndices, int& NumIndices, int* Indices) const;
452 #endif
453 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
454  int ExtractGlobalRowCopy(long long GlobalRow, int LenOfIndices, int& NumIndices, long long* Indices) const;
455 #endif
456 
458 
468  int ExtractMyRowCopy(int LocalRow, int LenOfIndices, int& NumIndices, int* Indices) const;
469 
471 
481 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
482  int ExtractGlobalRowView(int GlobalRow, int& NumIndices, int*& Indices) const;
483 #endif
484 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
485  int ExtractGlobalRowView(long long GlobalRow, int& NumIndices, long long*& Indices) const;
486 #endif
487 
489 
499  int ExtractMyRowView(int LocalRow, int& NumIndices, int*& Indices) const;
501 
503 
504  bool Filled() const {return(CrsGraphData_->Filled_);}
506 
508  bool StorageOptimized() const {return(CrsGraphData_->StorageOptimized_);}
509 
511  bool IndicesAreGlobal() const {return(CrsGraphData_->IndicesAreGlobal_);}
512 
514  bool IndicesAreLocal() const {return(CrsGraphData_->IndicesAreLocal_);}
515 
517 
520  bool LowerTriangular() const {return(CrsGraphData_->LowerTriangular_);}
521 
523 
526  bool UpperTriangular() const {return(CrsGraphData_->UpperTriangular_);}
527 
529 
532  bool NoDiagonal() const {return(CrsGraphData_->NoDiagonal_);}
533 
535 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
536  bool MyGlobalRow(int GID) const {return(RowMap().MyGID(GID));}
537 #endif
538 
539 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
540  bool MyGlobalRow(long long GID) const {return(RowMap().MyGID(GID));}
541 #endif
542 
544 
548  bool HaveColMap() const {return(CrsGraphData_->HaveColMap_);}
550 
552 
553 
555  int NumMyRows() const {return(CrsGraphData_->NumMyRows_);}
556 
558 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
559  int NumGlobalRows() const {
560  if(RowMap().GlobalIndicesInt())
561  return (int) NumGlobalRows64();
562  throw "Epetra_CrsGraph::NumGlobalRows: GlobalIndices not int.";
563  }
564 #endif
565  long long NumGlobalRows64() const {return(CrsGraphData_->NumGlobalRows_);}
566 
568 
572  int NumMyCols() const {return(CrsGraphData_->NumMyCols_);}
573 
575 
578 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
579  int NumGlobalCols() const {
580  if(RowMap().GlobalIndicesInt())
581  return (int) NumGlobalCols64();
582  throw "Epetra_CrsGraph::NumGlobalCols: GlobalIndices not int.";
583  }
584 #endif
585  long long NumGlobalCols64() const {return(CrsGraphData_->NumGlobalCols_);}
586 
588 
594 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
595  int NumGlobalNonzeros() const {
596  if(RowMap().GlobalIndicesInt())
597  return (int) NumGlobalNonzeros64();
598  throw "Epetra_CrsGraph::NumGlobalNonzeros: GlobalIndices not int.";
599  }
600 #endif
601  long long NumGlobalNonzeros64() const {return(CrsGraphData_->NumGlobalNonzeros_);}
602 
604 
607 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
608  int NumGlobalDiagonals() const {
609  if(RowMap().GlobalIndicesInt())
610  return (int) NumGlobalDiagonals64();
611  throw "Epetra_CrsGraph::NumGlobalDiagonals: GlobalIndices not int.";
612  }
613 #endif
614  long long NumGlobalDiagonals64() const {return(CrsGraphData_->NumGlobalDiagonals_);}
615 
617 
620  int NumMyDiagonals() const {return(CrsGraphData_->NumMyDiagonals_);}
621 
623  int NumMyBlockRows() const {return(CrsGraphData_->NumMyBlockRows_);}
624 
626 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
627  int NumGlobalBlockRows() const {
628  if(RowMap().GlobalIndicesInt())
629  return (int) NumGlobalBlockRows64();
630  throw "Epetra_CrsGraph::NumGlobalBlockRows: GlobalIndices not int.";
631  }
632 #endif
633  long long NumGlobalBlockRows64() const {return(CrsGraphData_->NumGlobalBlockRows_);}
634 
636 
639  int NumMyBlockCols() const {return(CrsGraphData_->NumMyBlockCols_);}
640 
642 
645 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
646  int NumGlobalBlockCols() const {
647  if(RowMap().GlobalIndicesInt())
648  return (int) NumGlobalBlockCols64();
649  throw "Epetra_CrsGraph::NumGlobalBlockCols: GlobalIndices not int.";
650  }
651 #endif
652  long long NumGlobalBlockCols64() const {return(CrsGraphData_->NumGlobalBlockCols_);}
653 
655 
658  int NumMyBlockDiagonals() const {return(CrsGraphData_->NumMyBlockDiagonals_);}
659 
661 
664 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
666  if(RowMap().GlobalIndicesInt())
667  return (int) NumGlobalBlockDiagonals64();
668  throw "Epetra_CrsGraph::NumGlobalBlockDiagonals: GlobalIndices not int.";
669  }
670 #endif
671  long long NumGlobalBlockDiagonals64() const {return(CrsGraphData_->NumGlobalBlockDiagonals_);}
672 
674 
677 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
678  int NumGlobalEntries() const {
679  if(RowMap().GlobalIndicesInt())
680  return (int) NumGlobalEntries64();
681  throw "Epetra_CrsGraph::NumGlobalEntries: GlobalIndices not int.";
682  }
683 #endif
684  long long NumGlobalEntries64() const {return(CrsGraphData_->NumGlobalEntries_);}
685 
687 
690  int NumMyEntries() const {return(CrsGraphData_->NumMyEntries_);}
692 
695  int MaxRowDim() const {return(CrsGraphData_->MaxRowDim_);}
696 
698 
701  int GlobalMaxRowDim() const {return(CrsGraphData_->GlobalMaxRowDim_);}
702 
704 
707  int MaxColDim() const {return(CrsGraphData_->MaxColDim_);}
708 
710 
713  int GlobalMaxColDim() const {return(CrsGraphData_->GlobalMaxColDim_);}
714 
716 
719  int NumMyNonzeros() const {return(CrsGraphData_->NumMyNonzeros_);}
720 
722  int NumGlobalIndices(long long Row) const;
723 
725  int NumAllocatedGlobalIndices(long long Row) const;
726 
728 
731  int MaxNumIndices() const {return(CrsGraphData_->MaxNumIndices_);}
732 
734 
737  int GlobalMaxNumIndices() const {return(CrsGraphData_->GlobalMaxNumIndices_);}
738 
740 
749  int MaxNumNonzeros() const {return(CrsGraphData_->MaxNumNonzeros_);}
750 
752 
756  int GlobalMaxNumNonzeros() const {return(CrsGraphData_->GlobalMaxNumNonzeros_);}
757 
759  int NumMyIndices(int Row) const {if (Row<0 || Row >= NumMyRows()) return(0);
760  if (StorageOptimized()) return(CrsGraphData_->IndexOffset_[Row+1] - CrsGraphData_->IndexOffset_[Row]);
761  else return(CrsGraphData_->NumIndicesPerRow_[Row]);}
762 
764  int NumAllocatedMyIndices(int Row) const {if (Row<0 || Row >= NumMyRows()) return(0);
765  if (StorageOptimized()) return(CrsGraphData_->IndexOffset_[Row+1] - CrsGraphData_->IndexOffset_[Row]);
766  else return(CrsGraphData_->NumAllocatedIndicesPerRow_[Row]);}
767 
769 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
770  int IndexBase() const {
772  if(RowMap().GlobalIndicesInt())
773  return (int) IndexBase64();
774  throw "Epetra_CrsGraph::IndexBase: GlobalIndices not int.";
775  }
776 #endif
777  long long IndexBase64() const {return(CrsGraphData_->IndexBase_);};
778 
780  const Epetra_BlockMap& RowMap() const {return(Epetra_DistObject::Map());}
781 
788  int ReplaceRowMap(const Epetra_BlockMap& newmap);
789 
798  int ReplaceColMap(const Epetra_BlockMap& newmap);
799 
801 
809  int ReplaceDomainMapAndImporter(const Epetra_BlockMap& NewDomainMap, const Epetra_Import * NewImporter);
810 
812 
823  int RemoveEmptyProcessesInPlace(const Epetra_BlockMap * NewMap);
824 
825 
827 
830  const Epetra_BlockMap& ColMap() const {return(CrsGraphData_->ColMap_);}
831 
833 
836  const Epetra_BlockMap& DomainMap() const {return(CrsGraphData_->DomainMap_);}
837 
839 
842  const Epetra_BlockMap& RangeMap() const {return(CrsGraphData_->RangeMap_);}
843 
845  const Epetra_Import* Importer() const {return(CrsGraphData_->Importer_);}
846 
848  const Epetra_Export* Exporter() const {return(CrsGraphData_->Exporter_);}
849 
851  const Epetra_Comm& Comm() const {return(Epetra_DistObject::Comm());}
853 
855 
856 
858 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
859  int LRID(int GRID_in) const {return(RowMap().LID(GRID_in));}
860 #endif
861 
862 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
863  int LRID(long long GRID_in) const {return(RowMap().LID(GRID_in));}
864 #endif
865 
866 #if defined(EPETRA_NO_32BIT_GLOBAL_INDICES) && defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
867  // default implementation so that no compiler/linker error in case neither 32 nor 64
868  // bit indices present.
869  int LRID(long long GRID_in) const {return(RowMap().LID(GRID_in));}
870 #endif
871 
873 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
874  int GRID(int LRID_in) const {
875  if(RowMap().GlobalIndicesInt())
876  return (int) GRID64(LRID_in);
877  throw "Epetra_CrsGraph::GRID: GlobalIndices not int.";
878  }
879 #endif
880  long long GRID64(int LRID_in) const {return(RowMap().GID64(LRID_in));}
881 
883 
886 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
887  int LCID(int GCID_in) const
888  {
889  return( CrsGraphData_->HaveColMap_ ? ColMap().LID(GCID_in) : -1 );
890  }
891 #endif
892 
893 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
894  int LCID(long long GCID_in) const
895  {
896  return( CrsGraphData_->HaveColMap_ ? ColMap().LID(GCID_in) : -1 );
897  }
898 #endif
899 
901 
904 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
905  int GCID(int LCID_in) const {
906  if(RowMap().GlobalIndicesInt())
907  return (int) GCID64(LCID_in);
908  throw "Epetra_CrsGraph::GCID: GlobalIndices not int.";
909  }
910 #endif
911  long long GCID64(int LCID_in) const
912  {
913  return( CrsGraphData_->HaveColMap_ ? ColMap().GID64(LCID_in) : -1 );
914  }
915 
917 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
918  bool MyGRID(int GRID_in) const {return(LRID(GRID_in) != -1);}
919 #endif
920 
921 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
922  bool MyGRID(long long GRID_in) const {return(LRID(GRID_in) != -1);}
923 #endif
924 
926  bool MyLRID(int LRID_in) const {return(GRID64(LRID_in) != IndexBase64() - 1);}
927 
929 
932 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
933  bool MyGCID(int GCID_in) const {return(LCID(GCID_in) != -1);}
934 #endif
935 
936 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
937  bool MyGCID(long long GCID_in) const {return(LCID(GCID_in) != -1);}
938 #endif
939 
941 
944  bool MyLCID(int LCID_in) const {return(GCID64(LCID_in) != IndexBase64() - 1);}
946 
948 
949 
951 
957  inline int* operator[]( int Loc ) {
958  if (StorageOptimized()){ return(CrsGraphData_->data->All_Indices_.Values() + CrsGraphData_->IndexOffset_[Loc]);}
959  else return(CrsGraphData_->data->Indices_[Loc]); }
960 
961  inline int* operator[]( int Loc ) const {
962  if (StorageOptimized()) { return(CrsGraphData_->data->All_Indices_.Values() +CrsGraphData_->IndexOffset_[Loc]);}
963  else return(CrsGraphData_->data->Indices_[Loc]); }
964 
966 
968 
972 
974 
975 
977  virtual void Print(std::ostream& os) const;
978 
979  void PrintGraphData(std::ostream& os) const {CrsGraphData_->Print(os);}
980  void PrintGraphData(std::ostream& os, int level) const {CrsGraphData_->Print(os, level);}
982 
984 
985 
987  const Epetra_BlockMap& ImportMap() const {return(CrsGraphData_->ColMap_);}
988 
990  int TransformToLocal();
991 
993  int TransformToLocal(const Epetra_BlockMap* DomainMap, const Epetra_BlockMap* RangeMap);
994 
996 
998 
999 
1001 
1002  int ReferenceCount() const {return(CrsGraphData_->ReferenceCount());}
1003 
1005 
1006  const Epetra_CrsGraphData* DataPtr() const {return(CrsGraphData_);}
1007 
1008 
1010 
1013  Epetra_IntSerialDenseVector& ExpertExtractIndexOffset();
1014 
1016 
1019  Epetra_IntSerialDenseVector& ExpertExtractIndices();
1020 
1021 
1023 
1032  void SortGhostsAssociatedWithEachProcessor(bool Flag) {CrsGraphData_->SortGhostsAssociatedWithEachProcessor_ = Flag;}
1033 
1035 
1036  // functions listed in protected are the ones used by CrsMatrix and VbrMatrix.
1037  // functions listed in private are the ones that are really private.
1038  // (just pretend CrsMatrix and VbrMatrix derive from CrsGraph to understand the distinction.)
1039  friend class Epetra_CrsMatrix;
1040  friend class Epetra_VbrMatrix;
1041  friend class Epetra_FECrsGraph;
1042  friend class Epetra_FECrsMatrix;
1043  friend class Epetra_FEVbrMatrix;
1044  friend class Epetra_OffsetIndex;
1045 
1046  protected:
1047  int *All_Indices() const {
1048  if (!StorageOptimized()) throw ReportError("This method: int *All_Indices() cannot be called when StorageOptimized()==false", -1);
1049  else return(CrsGraphData_->data->All_Indices_.Values());}
1050 #if defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM)
1051  int *All_IndicesPlus1() const;
1052 #endif
1053  int *IndexOffset() const {
1054  if (!StorageOptimized()) throw ReportError("This method: int *IndexOffset() cannot be called when StorageOptimized()==false", -1);
1055  else return(CrsGraphData_->IndexOffset_.Values());}
1056  int* NumIndicesPerRow() const {
1057  if (StorageOptimized()) throw ReportError("This method: int* NumIndicesPerRow() cannot be called when StorageOptimized()==true", -1);
1058  else return(CrsGraphData_->NumIndicesPerRow_.Values());}
1060  if (StorageOptimized()) throw ReportError("This method: int* NumAllocatedIndicesPerRow() cannot be called when StorageOptimized()==true", -1);
1061  else return(CrsGraphData_->NumAllocatedIndicesPerRow_.Values());}
1062  int** Indices() const {
1063  if (StorageOptimized()) throw ReportError("This method: int** Indices() cannot be called when StorageOptimized()==true", -1);
1064  else return(CrsGraphData_->data->Indices_);}
1065  int* Indices(int LocalRow) const {
1066  if (StorageOptimized()) return(CrsGraphData_->data->All_Indices_.Values()+CrsGraphData_->IndexOffset_[LocalRow]);
1067  else return(CrsGraphData_->data->Indices_[LocalRow]);}
1068 
1069  template<typename int_type>
1070  int_type** TIndices() const {
1071  if (StorageOptimized()) throw ReportError("This method: int_type** TIndices() cannot be called when StorageOptimized()==true", -1);
1072  else return(CrsGraphData_->Data<int_type>().Indices_);}
1073 
1074  template<typename int_type>
1075  int_type* TIndices(int LocalRow) const {
1076  if (StorageOptimized()) return(CrsGraphData_->Data<int_type>().All_Indices_.Values()+CrsGraphData_->IndexOffset_[LocalRow]);
1077  else return(CrsGraphData_->Data<int_type>().Indices_[LocalRow]);}
1078 
1079  // If column indices are stored in one long array (via a call to OptimizeStorage),
1080  // IndicesAreContiguous returns true, otherwise it returns false.
1081  bool IndicesAreContiguous() const {return(CrsGraphData_->IndicesAreContiguous_);}
1082  bool StaticProfile() const {return(CrsGraphData_->StaticProfile_);}
1083  bool GlobalConstantsComputed() const;
1084 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1085  bool FindGlobalIndexLoc(int LocalRow, int Index, int Start, int& Loc) const;
1086  bool FindGlobalIndexLoc(int NumIndices, const int* Indices, int Index, int Start, int& Loc) const;
1087 #endif
1088 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1089  bool FindGlobalIndexLoc(int LocalRow, long long Index, int Start, int& Loc) const;
1090  bool FindGlobalIndexLoc(int NumIndices, const long long* Indices, long long Index, int Start, int& Loc) const;
1091 #endif
1092 
1093  bool FindMyIndexLoc(int LocalRow, int Index, int Start, int& Loc) const;
1094  bool FindMyIndexLoc(int NumIndices, const int* Indices, int Index, int Start, int& Loc) const;
1095 
1096  int InsertIndices(int Row, int NumIndices, int* Indices);
1097  int InsertIndicesIntoSorted(int Row, int NumIndices, int* Indices);
1098 
1099  int InsertIndices(int Row, int NumIndices, long long* Indices);
1100  int InsertIndicesIntoSorted(int Row, int NumIndices, long long* Indices);
1101 
1102  int MakeIndicesLocal(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1103  void SetIndicesAreLocal(bool Flag) {CrsGraphData_->IndicesAreLocal_ = Flag;}
1104  void SetIndicesAreGlobal(bool Flag) {CrsGraphData_->IndicesAreGlobal_ = Flag;}
1105  void SetSorted(bool Flag) {CrsGraphData_->Sorted_ = Flag;}
1106 
1107 
1109 
1112  int SortIndices();
1113 
1115  bool Sorted() const {return(CrsGraphData_->Sorted_);}
1116 
1118 
1121  int RemoveRedundantIndices();
1122  int DetermineTriangular();
1123 
1125  bool NoRedundancies() const {return(CrsGraphData_->NoRedundancies_);}
1126 
1127  private:
1128  void SetGlobalConstantsComputed(bool Flag) {CrsGraphData_->GlobalConstantsComputed_ = Flag;}
1129  void SetIndicesAreContiguous(bool Flag) {CrsGraphData_->IndicesAreContiguous_ = Flag;}
1130  void SetNoRedundancies(bool Flag) {CrsGraphData_->NoRedundancies_ = Flag;}
1131  void ComputeIndexState();
1132  int MakeColMap(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1133 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1134  int MakeColMap_int(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1135 #endif
1136 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1137  int MakeColMap_LL (const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1138 #endif
1139  int Allocate(const int* NumIndicesPerRow, int Inc, bool StaticProfile);
1140  //int ReAllocate();
1141  int ComputeGlobalConstants();
1142  void SetFilled(bool Flag) {CrsGraphData_->Filled_ = Flag;}
1143  bool Allocated() const {return(CrsGraphData_->Allocated_);}
1144  void SetAllocated(bool Flag) {CrsGraphData_->Allocated_ = Flag;}
1145 
1146  int CheckSizes(const Epetra_SrcDistObject& A);
1147 
1148  int CopyAndPermute(const Epetra_SrcDistObject& Source,
1149  int NumSameIDs,
1150  int NumPermuteIDs,
1151  int* PermuteToLIDs,
1152  int* PermuteFromLIDs,
1153  const Epetra_OffsetIndex * Indexor,
1154  Epetra_CombineMode CombineMode = Zero);
1155  int CopyAndPermuteRowMatrix(const Epetra_RowMatrix& A,
1156  int NumSameIDs,
1157  int NumPermuteIDs,
1158  int* PermuteToLIDs,
1159  int* PermuteFromLIDs,
1160  const Epetra_OffsetIndex * Indexor,
1161  Epetra_CombineMode CombineMode);
1162 
1163  template<typename int_type>
1164  int CopyAndPermuteRowMatrix(const Epetra_RowMatrix& A,
1165  int NumSameIDs,
1166  int NumPermuteIDs,
1167  int* PermuteToLIDs,
1168  int* PermuteFromLIDs,
1169  const Epetra_OffsetIndex * Indexor,
1170  Epetra_CombineMode CombineMode);
1171 
1172  int CopyAndPermuteCrsGraph(const Epetra_CrsGraph& A,
1173  int NumSameIDs,
1174  int NumPermuteIDs,
1175  int* PermuteToLIDs,
1176  int* PermuteFromLIDs,
1177  const Epetra_OffsetIndex * Indexor,
1178  Epetra_CombineMode CombineMode);
1179 
1180  template<typename int_type>
1181  int CopyAndPermuteCrsGraph(const Epetra_CrsGraph& A,
1182  int NumSameIDs,
1183  int NumPermuteIDs,
1184  int* PermuteToLIDs,
1185  int* PermuteFromLIDs,
1186  const Epetra_OffsetIndex * Indexor,
1187  Epetra_CombineMode CombineMode);
1188 
1189  int PackAndPrepare(const Epetra_SrcDistObject& Source,
1190  int NumExportIDs,
1191  int* ExportLIDs,
1192  int& LenExports,
1193  char*& Exports,
1194  int& SizeOfPacket,
1195  int * Sizes,
1196  bool & VarSizes,
1197  Epetra_Distributor& Distor);
1198  int PackAndPrepareCrsGraph(const Epetra_CrsGraph& A,
1199  int NumExportIDs,
1200  int* ExportLIDs,
1201  int& LenExports,
1202  char*& Exports,
1203  int& SizeOfPacket,
1204  int* Sizes,
1205  bool& VarSizes,
1206  Epetra_Distributor& Distor);
1207  int PackAndPrepareRowMatrix(const Epetra_RowMatrix& A,
1208  int NumExportIDs,
1209  int* ExportLIDs,
1210  int& LenExports,
1211  char*& Exports,
1212  int& SizeOfPacket,
1213  int* Sizes,
1214  bool& VarSizes,
1215  Epetra_Distributor& Distor);
1216 
1217  int UnpackAndCombine(const Epetra_SrcDistObject& Source,
1218  int NumImportIDs,
1219  int* ImportLIDs,
1220  int LenImports,
1221  char* Imports,
1222  int& SizeOfPacket,
1223  Epetra_Distributor& Distor,
1224  Epetra_CombineMode CombineMode,
1225  const Epetra_OffsetIndex * Indexor);
1226 
1227  void CleanupData();
1228 
1230 
1231 private:
1232 
1233  template<typename int_type>
1234  int TAllocate(const int* numIndicesPerRow, int Inc, bool staticProfile);
1235 
1236  template<typename int_type>
1237  int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type* Indices);
1238 
1239  template<typename int_type>
1240  int TInsertIndices(int Row, int NumIndices, int_type* Indices);
1241 
1242  template<typename int_type>
1243  int TInsertIndicesIntoSorted(int Row, int NumIndices, int_type* Indices);
1244 
1245  template<typename int_type>
1246  int RemoveGlobalIndices(int_type GlobalRow, int NumIndices, int_type* Indices);
1247 
1248  template<typename int_type>
1249  int TRemoveGlobalIndices(long long Row);
1250 
1251  template<typename int_type>
1252  bool FindGlobalIndexLoc(int LocalRow, int_type Index, int Start, int& Loc) const;
1253 
1254  template<typename int_type>
1255  bool FindGlobalIndexLoc(int NumIndices, const int_type* Indices, int_type Index, int Start, int& Loc) const;
1256 
1257  template<typename int_type>
1258  int ExtractGlobalRowCopy(int_type Row, int LenOfIndices, int& NumIndices, int_type* Indices) const;
1259 
1260  template<typename int_type>
1261  int ExtractMyRowCopy(int Row, int LenOfIndices, int& NumIndices, int_type* targIndices) const;
1262 };
1263 #endif /* EPETRA_CRSGRAPH_H */
1264 
1265 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
1266 #ifdef __GNUC__
1267 #warning "The Epetra package is deprecated"
1268 #endif
1269 #endif
1270 
void SetFilled(bool Flag)
const Epetra_BlockMap & RangeMap() const
Returns the RangeMap associated with this graph.
bool HaveColMap() const
Returns true if we have a well-defined ColMap, and returns false otherwise.
int GlobalMaxNumIndices() const
Returns the maximun number of nonzero entries across all rows across all processors.
int NumGlobalRows() const
Returns the number of matrix rows in global matrix.
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
long long NumGlobalRows64() const
int NumMyBlockRows() const
Returns the number of block matrix rows on this processor.
long long GCID64(int LCID_in) const
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this graph.
const Epetra_Comm & Comm() const
Returns the address of the Epetra_Comm for this multi-vector.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
virtual int CopyAndPermute(const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)=0
Perform ID copies and permutations that are on processor.
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
int MaxColDim() const
Returns the max column dimension of block entries on the processor.
int * IndexOffset() const
bool MyGlobalRow(int GID) const
Returns true of GID is owned by the calling processor, otherwise it returns false.
int NumGlobalBlockCols() const
Returns the number of Block matrix columns in global matrix.
long long NumGlobalCols64() const
virtual void Print(std::ostream &os) const
Print method.
bool MyGRID(int GRID_in) const
Returns true if the GRID passed in belongs to the calling processor in this map, otherwise returns fa...
int ** Indices() const
Epetra Finite-Element CrsGraph.
int NumMyEntries() const
Returns the number of entries on this processor.
const Epetra_Import * Importer() const
Returns the Importer associated with this graph.
long long NumGlobalDiagonals64() const
int NumMyBlockCols() const
Returns the number of Block matrix columns on this processor.
int NumMyBlockDiagonals() const
Returns the number of Block diagonal entries in the local graph, based on global row/column index com...
int NumMyRows() const
Returns the number of matrix rows on this processor.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
Definition: Epetra_Export.h:62
Epetra_VbrMatrix: A class for the construction and use of real-valued double-precision variable block...
const Epetra_BlockMap & ColMap() const
Returns the Column Map associated with this graph.
const Epetra_BlockMap & ImportMap() const
Use ColMap() instead.
void SetAllocated(bool Flag)
const Epetra_BlockMap & DomainMap() const
Returns the DomainMap associated with this graph.
int NumGlobalEntries() const
Returns the number of entries in the global graph.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
Definition: Epetra_Import.h:63
int_type ** TIndices() const
long long NumGlobalBlockDiagonals64() const
bool StaticProfile() const
int MaxNumNonzeros() const
Returns the maximum number of nonzero points across all rows on this processor.
Epetra_CrsGraphData * CrsGraphData_
virtual int CheckSizes(const Epetra_SrcDistObject &Source)=0
Allows the source and target (this) objects to be compared for compatibility, return nonzero if not...
int LCID(long long GCID_in) const
int NumGlobalBlockDiagonals() const
Returns the number of Block diagonal entries in the global graph, based on global row/column index co...
Epetra_Time: The Epetra Timing Class.
Definition: Epetra_Time.h:75
int NumMyCols() const
Returns the number of entries in the set of column-indices that appear on this processor.
Epetra_CrsGraphData: The Epetra CrsGraph Data Class.
bool NoRedundancies() const
If RemoveRedundantIndices() has been called, this query returns true, otherwise it returns false...
int LRID(int GRID_in) const
Returns the local row index for given global row index, returns -1 if no local row for this global ro...
Epetra_Util: The Epetra Util Wrapper Class.
Definition: Epetra_Util.h:79
long long NumGlobalNonzeros64() const
bool MyLRID(int LRID_in) const
Returns true if the LRID passed in belongs to the calling processor in this map, otherwise returns fa...
const Epetra_CrsGraphData * DataPtr() const
Returns a pointer to the CrsGraphData instance this CrsGraph uses.
Epetra Finite-Element CrsMatrix.
int LCID(int GCID_in) const
Returns the local column index for given global column index, returns -1 if no local column for this ...
int NumGlobalCols() const
Returns the number of matrix columns in global matrix.
bool MyGlobalRow(long long GID) const
bool Sorted() const
If SortIndices() has been called, this query returns true, otherwise it returns false.
void PrintGraphData(std::ostream &os, int level) const
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:73
int MaxRowDim() const
Returns the max row dimension of block entries on the processor.
void SetIndicesAreGlobal(bool Flag)
void SetIndicesAreLocal(bool Flag)
bool MyLCID(int LCID_in) const
Returns true if the LRID passed in belongs to the calling processor in this map, otherwise returns fa...
void SetNoRedundancies(bool Flag)
int * NumIndicesPerRow() const
void SetIndicesAreContiguous(bool Flag)
long long NumGlobalBlockRows64() const
long long NumGlobalBlockCols64() const
bool IndicesAreGlobal() const
If column indices are in global range, this query returns true, otherwise it returns false...
virtual int UnpackAndCombine(const Epetra_SrcDistObject &Source, int NumImportIDs, int *ImportLIDs, int LenImports, char *Imports, int &SizeOfPacket, Epetra_Distributor &Distor, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor)=0
Perform any unpacking and combining after call to DoTransfer().
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int GCID(int LCID_in) const
Returns the global column index for give local column index, returns IndexBase-1 if we don&#39;t have thi...
long long GRID64(int LRID_in) const
int NumGlobalNonzeros() const
Returns the number of indices in the global graph.
const Epetra_BlockMap & RowMap() const
Returns the RowMap associated with this graph.
int NumAllocatedMyIndices(int Row) const
Returns the allocated number of nonzero entries in specified local row on this processor.
int LRID(long long GRID_in) const
int * All_Indices() const
void SetGlobalConstantsComputed(bool Flag)
void SortGhostsAssociatedWithEachProcessor(bool Flag)
Forces FillComplete() to locally order ghostnodes associated with each remote processor in ascending ...
Epetra_DistObject & operator=(const Epetra_DistObject &src)
int GlobalMaxColDim() const
Returns the max column dimension of block entries across all processors.
bool MyGCID(long long GCID_in) const
int ReferenceCount() const
Returns the reference count of CrsGraphData.
int NumMyIndices(int Row) const
Returns the current number of nonzero entries in specified local row on this processor.
int GRID(int LRID_in) const
Returns the global row index for give local row index, returns IndexBase-1 if we don&#39;t have this loca...
void SetSorted(bool Flag)
int * NumAllocatedIndicesPerRow() const
int GlobalMaxRowDim() const
Returns the max row dimension of block entries across all processors.
Epetra Finite-Element VbrMatrix.
bool UpperTriangular() const
If graph is upper triangular in local index space, this query returns true, otherwise it returns fals...
int_type * TIndices(int LocalRow) const
bool StorageOptimized() const
If OptimizeStorage() has been called, this query returns true, otherwise it returns false...
bool MyGCID(int GCID_in) const
Returns true if the GCID passed in belongs to the calling processor in this map, otherwise returns fa...
int * Indices(int LocalRow) const
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
bool IndicesAreContiguous() const
int MaxNumIndices() const
Returns the maximum number of nonzero entries across all rows on this processor.
Epetra_CombineMode
bool Allocated() const
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
int NumMyDiagonals() const
Returns the number of diagonal entries in the local graph, based on global row/column index compariso...
long long IndexBase64() const
const Epetra_Export * Exporter() const
Returns the Exporter associated with this graph.
bool NoDiagonal() const
If graph has no diagonal entries in global index space, this query returns true, otherwise it returns...
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
int * operator[](int Loc) const
Epetra_RowMatrix: A pure virtual class for using real-valued double-precision row matrices...
void PrintGraphData(std::ostream &os) const
int * operator[](int Loc)
Inlined bracket operator for fast access to data. (Const and Non-const versions)
Epetra_DataAccess
int NumGlobalBlockRows() const
Returns the number of Block matrix rows in global matrix.
int NumMyNonzeros() const
Returns the number of indices in the local graph.
bool LowerTriangular() const
If graph is lower triangular in local index space, this query returns true, otherwise it returns fals...
int GlobalMaxNumNonzeros() const
Returns the maximun number of nonzero points across all rows across all processors.
long long NumGlobalEntries64() const
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...
int NumGlobalDiagonals() const
Returns the number of diagonal entries in the global graph, based on global row/column index comparis...
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
bool MyGRID(long long GRID_in) const
virtual int PackAndPrepare(const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)=0
Perform any packing or preparation required for call to DoTransfer().
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.
bool IndicesAreLocal() const
If column indices are in local range, this query returns true, otherwise it returns false...