44 #include <Epetra_CrsMatrix.h> 45 #include <Epetra_Map.h> 46 #include <Epetra_Import.h> 47 #include <Epetra_IntSerialDenseVector.h> 48 #include <Epetra_LongLongSerialDenseVector.h> 49 #include <Epetra_GIDTypeSerialDenseVector.h> 60 template<
typename int_type>
68 assert( orig.Filled() );
71 const Epetra_Map & oRowMap = orig.RowMap();
72 const Epetra_Map & oColMap = orig.ColMap();
74 int oNumRows = oRowMap.NumMyElements();
76 int oNumCols = oColMap.NumMyElements();
77 int nNumRows = newRowMap_.NumMyElements();
78 int nNumDomain = newDomainMap_.NumMyElements();
83 for(
int i = 0; i < nNumRows; ++i )
84 matched = matched && ( oRowMap.MyGID(newRowMap_.GID64(i)) );
85 if( !matched ) std::cerr <<
"EDT_CrsMatrix_SubCopy: Bad new_row_Map. GIDs of new row map must be GIDs of the original row map on the same processor.\n";
88 if( !newRangeMap_.SameAs(newDomainMap_) ) {
89 Epetra_IntSerialDenseVector pidList(nNumDomain);
90 int_type* newDomainMap_MyGlob = 0;
91 newDomainMap_.MyGlobalElementsPtr(newDomainMap_MyGlob);
92 oColMap.RemoteIDList(newDomainMap_.NumMyElements(), newDomainMap_MyGlob, pidList.Values(), 0);
93 for(
int i = 0; i < nNumDomain; ++i )
94 matched = matched && ( pidList[i]>=0 );
97 if( !matched ) std::cout <<
"EDT_CrsMatrix_SubCopy: Bad newDomainMap. One or more GIDs in new domain map are not part of original domain map.\n";
102 Epetra_IntSerialDenseVector pidList(oNumCols);
103 Epetra_IntSerialDenseVector lidList(oNumCols);
104 Epetra_IntSerialDenseVector sizeList(oNumCols);
105 int_type* oColMap_MyGlob = 0;
106 oColMap.MyGlobalElementsPtr(oColMap_MyGlob);
107 newDomainMap_.RemoteIDList(oColMap.NumMyElements(), oColMap_MyGlob, pidList.Values(), 0);
109 typename Epetra_GIDTypeSerialDenseVector<int_type>::impl newColMapGidList(oNumCols);
110 int_type * origColGidList = 0;
111 oColMap.MyGlobalElementsPtr(origColGidList);
112 for(
int i = 0; i < oNumCols; ++i )
114 newColMapGidList[numNewCols++]= origColGidList[i];
115 newColMap_ = Epetra_Map(-1, numNewCols, newColMapGidList.Values(), 0, oColMap.Comm());
117 importer_ =
new Epetra_Import(newRowMap_, oRowMap);
119 Epetra_CrsMatrix * newMatrix =
new Epetra_CrsMatrix(Copy, newRowMap_, newColMap_, 0);
136 const Epetra_Map & oRowMap = orig.RowMap();
137 const Epetra_Map & oColMap = orig.ColMap();
139 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 140 if(oRowMap.GlobalIndicesInt() && oColMap.GlobalIndicesInt()) {
141 return transform<int>(orig);
145 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 146 if(oRowMap.GlobalIndicesLongLong() && oColMap.GlobalIndicesLongLong()) {
147 return transform<long long>(orig);
151 throw "CrsMatrix_SubCopy::operator(): GlobalIndices type unknown";
171 if (!
newObj_->Filled())
return(
false);
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
bool rvs()
Reverse transfer of data from new object created in the operator() method call to the orig object inp...
bool fwd()
Forward transfer of data from orig object input in the operator() method call to the new object creat...
~CrsMatrix_SubCopy()
Destructor.
NewTypeRef operator()(OriginalTypeRef orig)
Transformation Operator.