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 
1009 
1018  void SortGhostsAssociatedWithEachProcessor(bool Flag) {CrsGraphData_->SortGhostsAssociatedWithEachProcessor_ = Flag;}
1019 
1021 
1022  // functions listed in protected are the ones used by CrsMatrix and VbrMatrix.
1023  // functions listed in private are the ones that are really private.
1024  // (just pretend CrsMatrix and VbrMatrix derive from CrsGraph to understand the distinction.)
1025  friend class Epetra_CrsMatrix;
1026  friend class Epetra_VbrMatrix;
1027  friend class Epetra_FECrsGraph;
1028  friend class Epetra_FECrsMatrix;
1029  friend class Epetra_FEVbrMatrix;
1030  friend class Epetra_OffsetIndex;
1031 
1032  protected:
1033  int *All_Indices() const {
1034  if (!StorageOptimized()) throw ReportError("This method: int *All_Indices() cannot be called when StorageOptimized()==false", -1);
1035  else return(CrsGraphData_->data->All_Indices_.Values());}
1036 #if defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM)
1037  int *All_IndicesPlus1() const;
1038 #endif
1039  int *IndexOffset() const {
1040  if (!StorageOptimized()) throw ReportError("This method: int *IndexOffset() cannot be called when StorageOptimized()==false", -1);
1041  else return(CrsGraphData_->IndexOffset_.Values());}
1042  int* NumIndicesPerRow() const {
1043  if (StorageOptimized()) throw ReportError("This method: int* NumIndicesPerRow() cannot be called when StorageOptimized()==true", -1);
1044  else return(CrsGraphData_->NumIndicesPerRow_.Values());}
1046  if (StorageOptimized()) throw ReportError("This method: int* NumAllocatedIndicesPerRow() cannot be called when StorageOptimized()==true", -1);
1047  else return(CrsGraphData_->NumAllocatedIndicesPerRow_.Values());}
1048  int** Indices() const {
1049  if (StorageOptimized()) throw ReportError("This method: int** Indices() cannot be called when StorageOptimized()==true", -1);
1050  else return(CrsGraphData_->data->Indices_);}
1051  int* Indices(int LocalRow) const {
1052  if (StorageOptimized()) return(CrsGraphData_->data->All_Indices_.Values()+CrsGraphData_->IndexOffset_[LocalRow]);
1053  else return(CrsGraphData_->data->Indices_[LocalRow]);}
1054 
1055  template<typename int_type>
1056  int_type** TIndices() const {
1057  if (StorageOptimized()) throw ReportError("This method: int_type** TIndices() cannot be called when StorageOptimized()==true", -1);
1058  else return(CrsGraphData_->Data<int_type>().Indices_);}
1059 
1060  template<typename int_type>
1061  int_type* TIndices(int LocalRow) const {
1062  if (StorageOptimized()) return(CrsGraphData_->Data<int_type>().All_Indices_.Values()+CrsGraphData_->IndexOffset_[LocalRow]);
1063  else return(CrsGraphData_->Data<int_type>().Indices_[LocalRow]);}
1064 
1065  // If column indices are stored in one long array (via a call to OptimizeStorage),
1066  // IndicesAreContiguous returns true, otherwise it returns false.
1067  bool IndicesAreContiguous() const {return(CrsGraphData_->IndicesAreContiguous_);}
1068  bool StaticProfile() const {return(CrsGraphData_->StaticProfile_);}
1069  bool GlobalConstantsComputed() const;
1070 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1071  bool FindGlobalIndexLoc(int LocalRow, int Index, int Start, int& Loc) const;
1072  bool FindGlobalIndexLoc(int NumIndices, const int* Indices, int Index, int Start, int& Loc) const;
1073 #endif
1074 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1075  bool FindGlobalIndexLoc(int LocalRow, long long Index, int Start, int& Loc) const;
1076  bool FindGlobalIndexLoc(int NumIndices, const long long* Indices, long long Index, int Start, int& Loc) const;
1077 #endif
1078 
1079  bool FindMyIndexLoc(int LocalRow, int Index, int Start, int& Loc) const;
1080  bool FindMyIndexLoc(int NumIndices, const int* Indices, int Index, int Start, int& Loc) const;
1081 
1082  int InsertIndices(int Row, int NumIndices, int* Indices);
1083  int InsertIndicesIntoSorted(int Row, int NumIndices, int* Indices);
1084 
1085  int InsertIndices(int Row, int NumIndices, long long* Indices);
1086  int InsertIndicesIntoSorted(int Row, int NumIndices, long long* Indices);
1087 
1088  int MakeIndicesLocal(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1089  void SetIndicesAreLocal(bool Flag) {CrsGraphData_->IndicesAreLocal_ = Flag;}
1090  void SetIndicesAreGlobal(bool Flag) {CrsGraphData_->IndicesAreGlobal_ = Flag;}
1091  void SetSorted(bool Flag) {CrsGraphData_->Sorted_ = Flag;}
1092 
1093 
1095 
1098  int SortIndices();
1099 
1101  bool Sorted() const {return(CrsGraphData_->Sorted_);}
1102 
1104 
1107  int RemoveRedundantIndices();
1108  int DetermineTriangular();
1109 
1111  bool NoRedundancies() const {return(CrsGraphData_->NoRedundancies_);}
1112 
1113  private:
1114  void SetGlobalConstantsComputed(bool Flag) {CrsGraphData_->GlobalConstantsComputed_ = Flag;}
1115  void SetIndicesAreContiguous(bool Flag) {CrsGraphData_->IndicesAreContiguous_ = Flag;}
1116  void SetNoRedundancies(bool Flag) {CrsGraphData_->NoRedundancies_ = Flag;}
1117  void ComputeIndexState();
1118  int MakeColMap(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1119 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1120  int MakeColMap_int(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1121 #endif
1122 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1123  int MakeColMap_LL (const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1124 #endif
1125  int Allocate(const int* NumIndicesPerRow, int Inc, bool StaticProfile);
1126  //int ReAllocate();
1127  int ComputeGlobalConstants();
1128  void SetFilled(bool Flag) {CrsGraphData_->Filled_ = Flag;}
1129  bool Allocated() const {return(CrsGraphData_->Allocated_);}
1130  void SetAllocated(bool Flag) {CrsGraphData_->Allocated_ = Flag;}
1131 
1132  int CheckSizes(const Epetra_SrcDistObject& A);
1133 
1134  int CopyAndPermute(const Epetra_SrcDistObject& Source,
1135  int NumSameIDs,
1136  int NumPermuteIDs,
1137  int* PermuteToLIDs,
1138  int* PermuteFromLIDs,
1139  const Epetra_OffsetIndex * Indexor,
1140  Epetra_CombineMode CombineMode = Zero);
1141  int CopyAndPermuteRowMatrix(const Epetra_RowMatrix& A,
1142  int NumSameIDs,
1143  int NumPermuteIDs,
1144  int* PermuteToLIDs,
1145  int* PermuteFromLIDs,
1146  const Epetra_OffsetIndex * Indexor,
1147  Epetra_CombineMode CombineMode);
1148 
1149  template<typename int_type>
1150  int CopyAndPermuteRowMatrix(const Epetra_RowMatrix& A,
1151  int NumSameIDs,
1152  int NumPermuteIDs,
1153  int* PermuteToLIDs,
1154  int* PermuteFromLIDs,
1155  const Epetra_OffsetIndex * Indexor,
1156  Epetra_CombineMode CombineMode);
1157 
1158  int CopyAndPermuteCrsGraph(const Epetra_CrsGraph& A,
1159  int NumSameIDs,
1160  int NumPermuteIDs,
1161  int* PermuteToLIDs,
1162  int* PermuteFromLIDs,
1163  const Epetra_OffsetIndex * Indexor,
1164  Epetra_CombineMode CombineMode);
1165 
1166  template<typename int_type>
1167  int CopyAndPermuteCrsGraph(const Epetra_CrsGraph& A,
1168  int NumSameIDs,
1169  int NumPermuteIDs,
1170  int* PermuteToLIDs,
1171  int* PermuteFromLIDs,
1172  const Epetra_OffsetIndex * Indexor,
1173  Epetra_CombineMode CombineMode);
1174 
1175  int PackAndPrepare(const Epetra_SrcDistObject& Source,
1176  int NumExportIDs,
1177  int* ExportLIDs,
1178  int& LenExports,
1179  char*& Exports,
1180  int& SizeOfPacket,
1181  int * Sizes,
1182  bool & VarSizes,
1183  Epetra_Distributor& Distor);
1184  int PackAndPrepareCrsGraph(const Epetra_CrsGraph& A,
1185  int NumExportIDs,
1186  int* ExportLIDs,
1187  int& LenExports,
1188  char*& Exports,
1189  int& SizeOfPacket,
1190  int* Sizes,
1191  bool& VarSizes,
1192  Epetra_Distributor& Distor);
1193  int PackAndPrepareRowMatrix(const Epetra_RowMatrix& A,
1194  int NumExportIDs,
1195  int* ExportLIDs,
1196  int& LenExports,
1197  char*& Exports,
1198  int& SizeOfPacket,
1199  int* Sizes,
1200  bool& VarSizes,
1201  Epetra_Distributor& Distor);
1202 
1203  int UnpackAndCombine(const Epetra_SrcDistObject& Source,
1204  int NumImportIDs,
1205  int* ImportLIDs,
1206  int LenImports,
1207  char* Imports,
1208  int& SizeOfPacket,
1209  Epetra_Distributor& Distor,
1210  Epetra_CombineMode CombineMode,
1211  const Epetra_OffsetIndex * Indexor);
1212 
1213  void CleanupData();
1214 
1216 
1217 private:
1218 
1219  template<typename int_type>
1220  int TAllocate(const int* numIndicesPerRow, int Inc, bool staticProfile);
1221 
1222  template<typename int_type>
1223  int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type* Indices);
1224 
1225  template<typename int_type>
1226  int TInsertIndices(int Row, int NumIndices, int_type* Indices);
1227 
1228  template<typename int_type>
1229  int TInsertIndicesIntoSorted(int Row, int NumIndices, int_type* Indices);
1230 
1231  template<typename int_type>
1232  int RemoveGlobalIndices(int_type GlobalRow, int NumIndices, int_type* Indices);
1233 
1234  template<typename int_type>
1235  int TRemoveGlobalIndices(long long Row);
1236 
1237  template<typename int_type>
1238  bool FindGlobalIndexLoc(int LocalRow, int_type Index, int Start, int& Loc) const;
1239 
1240  template<typename int_type>
1241  bool FindGlobalIndexLoc(int NumIndices, const int_type* Indices, int_type Index, int Start, int& Loc) const;
1242 
1243  template<typename int_type>
1244  int ExtractGlobalRowCopy(int_type Row, int LenOfIndices, int& NumIndices, int_type* Indices) const;
1245 
1246  template<typename int_type>
1247  int ExtractMyRowCopy(int Row, int LenOfIndices, int& NumIndices, int_type* targIndices) const;
1248 };
1249 #endif /* EPETRA_CRSGRAPH_H */
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.
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...