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 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_ConfigDefs.h"
56 #include "Epetra_DistObject.h"
57 #include "Epetra_CrsGraphData.h"
58 class Epetra_BlockMap;
59 class Epetra_Util;
60 class Epetra_Time;
61 class Epetra_Import;
62 class Epetra_Export;
63 class Epetra_Distributor;
64 class Epetra_RowMatrix;
65 
67 
221 class EPETRA_LIB_DLL_EXPORT Epetra_CrsGraph: public Epetra_DistObject {
222 
223  public:
224 
226 
227 
240  Epetra_CrsGraph(Epetra_DataAccess CV, const Epetra_BlockMap& RowMap, const int* NumIndicesPerRow, bool StaticProfile = false);
241 
243 
256  Epetra_CrsGraph(Epetra_DataAccess CV, const Epetra_BlockMap& RowMap, int NumIndicesPerRow, bool StaticProfile = false);
257 
259 
274  const Epetra_BlockMap& ColMap, const int* NumIndicesPerRow, bool StaticProfile = false);
275 
277 
294  const Epetra_BlockMap& ColMap, int NumIndicesPerRow, bool StaticProfile = false);
295 
297 
300  Epetra_CrsGraph(const Epetra_CrsGraph& Graph);
301 
303  virtual ~Epetra_CrsGraph();
305 
307 
308 
323 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
324  int InsertGlobalIndices(int GlobalRow, int NumIndices, int* Indices);
325 #endif
326 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
327  int InsertGlobalIndices(long long GlobalRow, int NumIndices, long long* Indices);
328 #endif
329 
331 
340 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
341  int RemoveGlobalIndices(int GlobalRow, int NumIndices, int* Indices);
342 #endif
343 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
344  int RemoveGlobalIndices(long long GlobalRow, int NumIndices, long long* Indices);
345 #endif
346 
348 
355  int RemoveGlobalIndices(long long Row);
356 
357 
359 
374  int InsertMyIndices(int LocalRow, int NumIndices, int* Indices);
375 
377 
386  int RemoveMyIndices(int LocalRow, int NumIndices, int* Indices);
387 
389 
396  int RemoveMyIndices(int Row);
398 
400 
401 
403 
410  int FillComplete();
411 
413 
425  int FillComplete(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
426 
428 
442  int OptimizeStorage();
443 
445 
447 
448 
450 
458 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
459  int ExtractGlobalRowCopy(int GlobalRow, int LenOfIndices, int& NumIndices, int* Indices) const;
460 #endif
461 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
462  int ExtractGlobalRowCopy(long long GlobalRow, int LenOfIndices, int& NumIndices, long long* Indices) const;
463 #endif
464 
466 
476  int ExtractMyRowCopy(int LocalRow, int LenOfIndices, int& NumIndices, int* Indices) const;
477 
479 
489 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
490  int ExtractGlobalRowView(int GlobalRow, int& NumIndices, int*& Indices) const;
491 #endif
492 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
493  int ExtractGlobalRowView(long long GlobalRow, int& NumIndices, long long*& Indices) const;
494 #endif
495 
497 
507  int ExtractMyRowView(int LocalRow, int& NumIndices, int*& Indices) const;
509 
511 
512  bool Filled() const {return(CrsGraphData_->Filled_);}
514 
516  bool StorageOptimized() const {return(CrsGraphData_->StorageOptimized_);}
517 
519  bool IndicesAreGlobal() const {return(CrsGraphData_->IndicesAreGlobal_);}
520 
522  bool IndicesAreLocal() const {return(CrsGraphData_->IndicesAreLocal_);}
523 
525 
528  bool LowerTriangular() const {return(CrsGraphData_->LowerTriangular_);}
529 
531 
534  bool UpperTriangular() const {return(CrsGraphData_->UpperTriangular_);}
535 
537 
540  bool NoDiagonal() const {return(CrsGraphData_->NoDiagonal_);}
541 
543 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
544  bool MyGlobalRow(int GID) const {return(RowMap().MyGID(GID));}
545 #endif
546 
547 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
548  bool MyGlobalRow(long long GID) const {return(RowMap().MyGID(GID));}
549 #endif
550 
552 
556  bool HaveColMap() const {return(CrsGraphData_->HaveColMap_);}
558 
560 
561 
563  int NumMyRows() const {return(CrsGraphData_->NumMyRows_);}
564 
566 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
567  int NumGlobalRows() const {
568  if(RowMap().GlobalIndicesInt())
569  return (int) NumGlobalRows64();
570  throw "Epetra_CrsGraph::NumGlobalRows: GlobalIndices not int.";
571  }
572 #endif
573  long long NumGlobalRows64() const {return(CrsGraphData_->NumGlobalRows_);}
574 
576 
580  int NumMyCols() const {return(CrsGraphData_->NumMyCols_);}
581 
583 
586 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
587  int NumGlobalCols() const {
588  if(RowMap().GlobalIndicesInt())
589  return (int) NumGlobalCols64();
590  throw "Epetra_CrsGraph::NumGlobalCols: GlobalIndices not int.";
591  }
592 #endif
593  long long NumGlobalCols64() const {return(CrsGraphData_->NumGlobalCols_);}
594 
596 
602 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
603  int NumGlobalNonzeros() const {
604  if(RowMap().GlobalIndicesInt())
605  return (int) NumGlobalNonzeros64();
606  throw "Epetra_CrsGraph::NumGlobalNonzeros: GlobalIndices not int.";
607  }
608 #endif
609  long long NumGlobalNonzeros64() const {return(CrsGraphData_->NumGlobalNonzeros_);}
610 
612 
615 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
616  int NumGlobalDiagonals() const {
617  if(RowMap().GlobalIndicesInt())
618  return (int) NumGlobalDiagonals64();
619  throw "Epetra_CrsGraph::NumGlobalDiagonals: GlobalIndices not int.";
620  }
621 #endif
622  long long NumGlobalDiagonals64() const {return(CrsGraphData_->NumGlobalDiagonals_);}
623 
625 
628  int NumMyDiagonals() const {return(CrsGraphData_->NumMyDiagonals_);}
629 
631  int NumMyBlockRows() const {return(CrsGraphData_->NumMyBlockRows_);}
632 
634 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
635  int NumGlobalBlockRows() const {
636  if(RowMap().GlobalIndicesInt())
637  return (int) NumGlobalBlockRows64();
638  throw "Epetra_CrsGraph::NumGlobalBlockRows: GlobalIndices not int.";
639  }
640 #endif
641  long long NumGlobalBlockRows64() const {return(CrsGraphData_->NumGlobalBlockRows_);}
642 
644 
647  int NumMyBlockCols() const {return(CrsGraphData_->NumMyBlockCols_);}
648 
650 
653 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
654  int NumGlobalBlockCols() const {
655  if(RowMap().GlobalIndicesInt())
656  return (int) NumGlobalBlockCols64();
657  throw "Epetra_CrsGraph::NumGlobalBlockCols: GlobalIndices not int.";
658  }
659 #endif
660  long long NumGlobalBlockCols64() const {return(CrsGraphData_->NumGlobalBlockCols_);}
661 
663 
666  int NumMyBlockDiagonals() const {return(CrsGraphData_->NumMyBlockDiagonals_);}
667 
669 
672 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
674  if(RowMap().GlobalIndicesInt())
675  return (int) NumGlobalBlockDiagonals64();
676  throw "Epetra_CrsGraph::NumGlobalBlockDiagonals: GlobalIndices not int.";
677  }
678 #endif
679  long long NumGlobalBlockDiagonals64() const {return(CrsGraphData_->NumGlobalBlockDiagonals_);}
680 
682 
685 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
686  int NumGlobalEntries() const {
687  if(RowMap().GlobalIndicesInt())
688  return (int) NumGlobalEntries64();
689  throw "Epetra_CrsGraph::NumGlobalEntries: GlobalIndices not int.";
690  }
691 #endif
692  long long NumGlobalEntries64() const {return(CrsGraphData_->NumGlobalEntries_);}
693 
695 
698  int NumMyEntries() const {return(CrsGraphData_->NumMyEntries_);}
700 
703  int MaxRowDim() const {return(CrsGraphData_->MaxRowDim_);}
704 
706 
709  int GlobalMaxRowDim() const {return(CrsGraphData_->GlobalMaxRowDim_);}
710 
712 
715  int MaxColDim() const {return(CrsGraphData_->MaxColDim_);}
716 
718 
721  int GlobalMaxColDim() const {return(CrsGraphData_->GlobalMaxColDim_);}
722 
724 
727  int NumMyNonzeros() const {return(CrsGraphData_->NumMyNonzeros_);}
728 
730  int NumGlobalIndices(long long Row) const;
731 
733  int NumAllocatedGlobalIndices(long long Row) const;
734 
736 
739  int MaxNumIndices() const {return(CrsGraphData_->MaxNumIndices_);}
740 
742 
745  int GlobalMaxNumIndices() const {return(CrsGraphData_->GlobalMaxNumIndices_);}
746 
748 
757  int MaxNumNonzeros() const {return(CrsGraphData_->MaxNumNonzeros_);}
758 
760 
764  int GlobalMaxNumNonzeros() const {return(CrsGraphData_->GlobalMaxNumNonzeros_);}
765 
767  int NumMyIndices(int Row) const {if (Row<0 || Row >= NumMyRows()) return(0);
768  if (StorageOptimized()) return(CrsGraphData_->IndexOffset_[Row+1] - CrsGraphData_->IndexOffset_[Row]);
769  else return(CrsGraphData_->NumIndicesPerRow_[Row]);}
770 
772  int NumAllocatedMyIndices(int Row) const {if (Row<0 || Row >= NumMyRows()) return(0);
773  if (StorageOptimized()) return(CrsGraphData_->IndexOffset_[Row+1] - CrsGraphData_->IndexOffset_[Row]);
774  else return(CrsGraphData_->NumAllocatedIndicesPerRow_[Row]);}
775 
777 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
778  int IndexBase() const {
780  if(RowMap().GlobalIndicesInt())
781  return (int) IndexBase64();
782  throw "Epetra_CrsGraph::IndexBase: GlobalIndices not int.";
783  }
784 #endif
785  long long IndexBase64() const {return(CrsGraphData_->IndexBase_);};
786 
788  const Epetra_BlockMap& RowMap() const {return(Epetra_DistObject::Map());}
789 
796  int ReplaceRowMap(const Epetra_BlockMap& newmap);
797 
806  int ReplaceColMap(const Epetra_BlockMap& newmap);
807 
809 
817  int ReplaceDomainMapAndImporter(const Epetra_BlockMap& NewDomainMap, const Epetra_Import * NewImporter);
818 
820 
831  int RemoveEmptyProcessesInPlace(const Epetra_BlockMap * NewMap);
832 
833 
835 
838  const Epetra_BlockMap& ColMap() const {return(CrsGraphData_->ColMap_);}
839 
841 
844  const Epetra_BlockMap& DomainMap() const {return(CrsGraphData_->DomainMap_);}
845 
847 
850  const Epetra_BlockMap& RangeMap() const {return(CrsGraphData_->RangeMap_);}
851 
853  const Epetra_Import* Importer() const {return(CrsGraphData_->Importer_);}
854 
856  const Epetra_Export* Exporter() const {return(CrsGraphData_->Exporter_);}
857 
859  const Epetra_Comm& Comm() const {return(Epetra_DistObject::Comm());}
861 
863 
864 
866 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
867  int LRID(int GRID_in) const {return(RowMap().LID(GRID_in));}
868 #endif
869 
870 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
871  int LRID(long long GRID_in) const {return(RowMap().LID(GRID_in));}
872 #endif
873 
874 #if defined(EPETRA_NO_32BIT_GLOBAL_INDICES) && defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
875  // default implementation so that no compiler/linker error in case neither 32 nor 64
876  // bit indices present.
877  int LRID(long long GRID_in) const {return(RowMap().LID(GRID_in));}
878 #endif
879 
881 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
882  int GRID(int LRID_in) const {
883  if(RowMap().GlobalIndicesInt())
884  return (int) GRID64(LRID_in);
885  throw "Epetra_CrsGraph::GRID: GlobalIndices not int.";
886  }
887 #endif
888  long long GRID64(int LRID_in) const {return(RowMap().GID64(LRID_in));}
889 
891 
894 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
895  int LCID(int GCID_in) const
896  {
897  return( CrsGraphData_->HaveColMap_ ? ColMap().LID(GCID_in) : -1 );
898  }
899 #endif
900 
901 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
902  int LCID(long long GCID_in) const
903  {
904  return( CrsGraphData_->HaveColMap_ ? ColMap().LID(GCID_in) : -1 );
905  }
906 #endif
907 
909 
912 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
913  int GCID(int LCID_in) const {
914  if(RowMap().GlobalIndicesInt())
915  return (int) GCID64(LCID_in);
916  throw "Epetra_CrsGraph::GCID: GlobalIndices not int.";
917  }
918 #endif
919  long long GCID64(int LCID_in) const
920  {
921  return( CrsGraphData_->HaveColMap_ ? ColMap().GID64(LCID_in) : -1 );
922  }
923 
925 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
926  bool MyGRID(int GRID_in) const {return(LRID(GRID_in) != -1);}
927 #endif
928 
929 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
930  bool MyGRID(long long GRID_in) const {return(LRID(GRID_in) != -1);}
931 #endif
932 
934  bool MyLRID(int LRID_in) const {return(GRID64(LRID_in) != IndexBase64() - 1);}
935 
937 
940 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
941  bool MyGCID(int GCID_in) const {return(LCID(GCID_in) != -1);}
942 #endif
943 
944 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
945  bool MyGCID(long long GCID_in) const {return(LCID(GCID_in) != -1);}
946 #endif
947 
949 
952  bool MyLCID(int LCID_in) const {return(GCID64(LCID_in) != IndexBase64() - 1);}
954 
956 
957 
959 
965  inline int* operator[]( int Loc ) {
966  if (StorageOptimized()){ return(CrsGraphData_->data->All_Indices_.Values() + CrsGraphData_->IndexOffset_[Loc]);}
967  else return(CrsGraphData_->data->Indices_[Loc]); }
968 
969  inline int* operator[]( int Loc ) const {
970  if (StorageOptimized()) { return(CrsGraphData_->data->All_Indices_.Values() +CrsGraphData_->IndexOffset_[Loc]);}
971  else return(CrsGraphData_->data->Indices_[Loc]); }
972 
974 
976 
980 
982 
983 
985  virtual void Print(std::ostream& os) const;
986 
987  void PrintGraphData(std::ostream& os) const {CrsGraphData_->Print(os);}
988  void PrintGraphData(std::ostream& os, int level) const {CrsGraphData_->Print(os, level);}
990 
992 
993 
995  const Epetra_BlockMap& ImportMap() const {return(CrsGraphData_->ColMap_);}
996 
998  int TransformToLocal();
999 
1001  int TransformToLocal(const Epetra_BlockMap* DomainMap, const Epetra_BlockMap* RangeMap);
1002 
1004 
1006 
1007 
1009 
1010  int ReferenceCount() const {return(CrsGraphData_->ReferenceCount());}
1011 
1013 
1014  const Epetra_CrsGraphData* DataPtr() const {return(CrsGraphData_);}
1015 
1016 
1018 
1021  Epetra_IntSerialDenseVector& ExpertExtractIndexOffset();
1022 
1024 
1027  Epetra_IntSerialDenseVector& ExpertExtractIndices();
1028 
1029 
1031 
1040  void SortGhostsAssociatedWithEachProcessor(bool Flag) {CrsGraphData_->SortGhostsAssociatedWithEachProcessor_ = Flag;}
1041 
1043 
1044  // functions listed in protected are the ones used by CrsMatrix and VbrMatrix.
1045  // functions listed in private are the ones that are really private.
1046  // (just pretend CrsMatrix and VbrMatrix derive from CrsGraph to understand the distinction.)
1047  friend class Epetra_CrsMatrix;
1048  friend class Epetra_VbrMatrix;
1049  friend class Epetra_FECrsGraph;
1050  friend class Epetra_FECrsMatrix;
1051  friend class Epetra_FEVbrMatrix;
1052  friend class Epetra_OffsetIndex;
1053 
1054  protected:
1055  int *All_Indices() const {
1056  if (!StorageOptimized()) throw ReportError("This method: int *All_Indices() cannot be called when StorageOptimized()==false", -1);
1057  else return(CrsGraphData_->data->All_Indices_.Values());}
1058 #if defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM)
1059  int *All_IndicesPlus1() const;
1060 #endif
1061  int *IndexOffset() const {
1062  if (!StorageOptimized()) throw ReportError("This method: int *IndexOffset() cannot be called when StorageOptimized()==false", -1);
1063  else return(CrsGraphData_->IndexOffset_.Values());}
1064  int* NumIndicesPerRow() const {
1065  if (StorageOptimized()) throw ReportError("This method: int* NumIndicesPerRow() cannot be called when StorageOptimized()==true", -1);
1066  else return(CrsGraphData_->NumIndicesPerRow_.Values());}
1068  if (StorageOptimized()) throw ReportError("This method: int* NumAllocatedIndicesPerRow() cannot be called when StorageOptimized()==true", -1);
1069  else return(CrsGraphData_->NumAllocatedIndicesPerRow_.Values());}
1070  int** Indices() const {
1071  if (StorageOptimized()) throw ReportError("This method: int** Indices() cannot be called when StorageOptimized()==true", -1);
1072  else return(CrsGraphData_->data->Indices_);}
1073  int* Indices(int LocalRow) const {
1074  if (StorageOptimized()) return(CrsGraphData_->data->All_Indices_.Values()+CrsGraphData_->IndexOffset_[LocalRow]);
1075  else return(CrsGraphData_->data->Indices_[LocalRow]);}
1076 
1077  template<typename int_type>
1078  int_type** TIndices() const {
1079  if (StorageOptimized()) throw ReportError("This method: int_type** TIndices() cannot be called when StorageOptimized()==true", -1);
1080  else return(CrsGraphData_->Data<int_type>().Indices_);}
1081 
1082  template<typename int_type>
1083  int_type* TIndices(int LocalRow) const {
1084  if (StorageOptimized()) return(CrsGraphData_->Data<int_type>().All_Indices_.Values()+CrsGraphData_->IndexOffset_[LocalRow]);
1085  else return(CrsGraphData_->Data<int_type>().Indices_[LocalRow]);}
1086 
1087  // If column indices are stored in one long array (via a call to OptimizeStorage),
1088  // IndicesAreContiguous returns true, otherwise it returns false.
1089  bool IndicesAreContiguous() const {return(CrsGraphData_->IndicesAreContiguous_);}
1090  bool StaticProfile() const {return(CrsGraphData_->StaticProfile_);}
1091  bool GlobalConstantsComputed() const;
1092 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1093  bool FindGlobalIndexLoc(int LocalRow, int Index, int Start, int& Loc) const;
1094  bool FindGlobalIndexLoc(int NumIndices, const int* Indices, int Index, int Start, int& Loc) const;
1095 #endif
1096 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1097  bool FindGlobalIndexLoc(int LocalRow, long long Index, int Start, int& Loc) const;
1098  bool FindGlobalIndexLoc(int NumIndices, const long long* Indices, long long Index, int Start, int& Loc) const;
1099 #endif
1100 
1101  bool FindMyIndexLoc(int LocalRow, int Index, int Start, int& Loc) const;
1102  bool FindMyIndexLoc(int NumIndices, const int* Indices, int Index, int Start, int& Loc) const;
1103 
1104  int InsertIndices(int Row, int NumIndices, int* Indices);
1105  int InsertIndicesIntoSorted(int Row, int NumIndices, int* Indices);
1106 
1107  int InsertIndices(int Row, int NumIndices, long long* Indices);
1108  int InsertIndicesIntoSorted(int Row, int NumIndices, long long* Indices);
1109 
1110  int MakeIndicesLocal(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1111  void SetIndicesAreLocal(bool Flag) {CrsGraphData_->IndicesAreLocal_ = Flag;}
1112  void SetIndicesAreGlobal(bool Flag) {CrsGraphData_->IndicesAreGlobal_ = Flag;}
1113  void SetSorted(bool Flag) {CrsGraphData_->Sorted_ = Flag;}
1114 
1115 
1117 
1120  int SortIndices();
1121 
1123  bool Sorted() const {return(CrsGraphData_->Sorted_);}
1124 
1126 
1129  int RemoveRedundantIndices();
1130  int DetermineTriangular();
1131 
1133  bool NoRedundancies() const {return(CrsGraphData_->NoRedundancies_);}
1134 
1135  private:
1136  void SetGlobalConstantsComputed(bool Flag) {CrsGraphData_->GlobalConstantsComputed_ = Flag;}
1137  void SetIndicesAreContiguous(bool Flag) {CrsGraphData_->IndicesAreContiguous_ = Flag;}
1138  void SetNoRedundancies(bool Flag) {CrsGraphData_->NoRedundancies_ = Flag;}
1139  void ComputeIndexState();
1140  int MakeColMap(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1141 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1142  int MakeColMap_int(const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1143 #endif
1144 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1145  int MakeColMap_LL (const Epetra_BlockMap& DomainMap, const Epetra_BlockMap& RangeMap);
1146 #endif
1147  int Allocate(const int* NumIndicesPerRow, int Inc, bool StaticProfile);
1148  //int ReAllocate();
1149  int ComputeGlobalConstants();
1150  void SetFilled(bool Flag) {CrsGraphData_->Filled_ = Flag;}
1151  bool Allocated() const {return(CrsGraphData_->Allocated_);}
1152  void SetAllocated(bool Flag) {CrsGraphData_->Allocated_ = Flag;}
1153 
1154  int CheckSizes(const Epetra_SrcDistObject& A);
1155 
1156  int CopyAndPermute(const Epetra_SrcDistObject& Source,
1157  int NumSameIDs,
1158  int NumPermuteIDs,
1159  int* PermuteToLIDs,
1160  int* PermuteFromLIDs,
1161  const Epetra_OffsetIndex * Indexor,
1162  Epetra_CombineMode CombineMode = Zero);
1163  int CopyAndPermuteRowMatrix(const Epetra_RowMatrix& A,
1164  int NumSameIDs,
1165  int NumPermuteIDs,
1166  int* PermuteToLIDs,
1167  int* PermuteFromLIDs,
1168  const Epetra_OffsetIndex * Indexor,
1169  Epetra_CombineMode CombineMode);
1170 
1171  template<typename int_type>
1172  int CopyAndPermuteRowMatrix(const Epetra_RowMatrix& A,
1173  int NumSameIDs,
1174  int NumPermuteIDs,
1175  int* PermuteToLIDs,
1176  int* PermuteFromLIDs,
1177  const Epetra_OffsetIndex * Indexor,
1178  Epetra_CombineMode CombineMode);
1179 
1180  int CopyAndPermuteCrsGraph(const Epetra_CrsGraph& A,
1181  int NumSameIDs,
1182  int NumPermuteIDs,
1183  int* PermuteToLIDs,
1184  int* PermuteFromLIDs,
1185  const Epetra_OffsetIndex * Indexor,
1186  Epetra_CombineMode CombineMode);
1187 
1188  template<typename int_type>
1189  int CopyAndPermuteCrsGraph(const Epetra_CrsGraph& A,
1190  int NumSameIDs,
1191  int NumPermuteIDs,
1192  int* PermuteToLIDs,
1193  int* PermuteFromLIDs,
1194  const Epetra_OffsetIndex * Indexor,
1195  Epetra_CombineMode CombineMode);
1196 
1197  int PackAndPrepare(const Epetra_SrcDistObject& Source,
1198  int NumExportIDs,
1199  int* ExportLIDs,
1200  int& LenExports,
1201  char*& Exports,
1202  int& SizeOfPacket,
1203  int * Sizes,
1204  bool & VarSizes,
1205  Epetra_Distributor& Distor);
1206  int PackAndPrepareCrsGraph(const Epetra_CrsGraph& A,
1207  int NumExportIDs,
1208  int* ExportLIDs,
1209  int& LenExports,
1210  char*& Exports,
1211  int& SizeOfPacket,
1212  int* Sizes,
1213  bool& VarSizes,
1214  Epetra_Distributor& Distor);
1215  int PackAndPrepareRowMatrix(const Epetra_RowMatrix& A,
1216  int NumExportIDs,
1217  int* ExportLIDs,
1218  int& LenExports,
1219  char*& Exports,
1220  int& SizeOfPacket,
1221  int* Sizes,
1222  bool& VarSizes,
1223  Epetra_Distributor& Distor);
1224 
1225  int UnpackAndCombine(const Epetra_SrcDistObject& Source,
1226  int NumImportIDs,
1227  int* ImportLIDs,
1228  int LenImports,
1229  char* Imports,
1230  int& SizeOfPacket,
1231  Epetra_Distributor& Distor,
1232  Epetra_CombineMode CombineMode,
1233  const Epetra_OffsetIndex * Indexor);
1234 
1235  void CleanupData();
1236 
1238 
1239 private:
1240 
1241  template<typename int_type>
1242  int TAllocate(const int* numIndicesPerRow, int Inc, bool staticProfile);
1243 
1244  template<typename int_type>
1245  int InsertGlobalIndices(int_type GlobalRow, int NumIndices, int_type* Indices);
1246 
1247  template<typename int_type>
1248  int TInsertIndices(int Row, int NumIndices, int_type* Indices);
1249 
1250  template<typename int_type>
1251  int TInsertIndicesIntoSorted(int Row, int NumIndices, int_type* Indices);
1252 
1253  template<typename int_type>
1254  int RemoveGlobalIndices(int_type GlobalRow, int NumIndices, int_type* Indices);
1255 
1256  template<typename int_type>
1257  int TRemoveGlobalIndices(long long Row);
1258 
1259  template<typename int_type>
1260  bool FindGlobalIndexLoc(int LocalRow, int_type Index, int Start, int& Loc) const;
1261 
1262  template<typename int_type>
1263  bool FindGlobalIndexLoc(int NumIndices, const int_type* Indices, int_type Index, int Start, int& Loc) const;
1264 
1265  template<typename int_type>
1266  int ExtractGlobalRowCopy(int_type Row, int LenOfIndices, int& NumIndices, int_type* Indices) const;
1267 
1268  template<typename int_type>
1269  int ExtractMyRowCopy(int Row, int LenOfIndices, int& NumIndices, int_type* targIndices) const;
1270 };
1271 #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.
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:70
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:71
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:83
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:87
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:81
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...