65 TransposeSolve_(false),
68 IsSolverSetup_ =
new bool[1];
69 IsPrecondSetup_ =
new bool[1];
70 IsSolverSetup_[0] =
false;
71 IsPrecondSetup_[0] =
false;
74 ierr += InitializeDefaults();
80 for (
int i = MyRowStart_; i <= MyRowEnd_; i++) {
81 GlobalRowIDs[i-MyRowStart_] = i;
85 int new_value = 0;
int entries = 0;
86 std::set<int> Columns;
90 for(
int i = 0; i < NumMyRows_; i++){
91 ierr += HYPRE_ParCSRMatrixGetRow(ParMatrix_, i+MyRowStart_, &num_entries, &indices, &values);
92 ierr += HYPRE_ParCSRMatrixRestoreRow(ParMatrix_, i+MyRowStart_,&num_entries,&indices,&values);
94 entries = num_entries;
95 for(
int j = 0; j < num_entries; j++){
97 new_value = indices[j];
98 Columns.insert(new_value);
101 int NumMyCols = Columns.size();
104 std::set<int>::iterator it;
106 for (it = Columns.begin(); it != Columns.end(); it++) {
108 GlobalColIDs[counter] = *it;
109 counter = counter + 1;
113 Epetra_Map RowMap(-1, NumMyRows_, &GlobalRowIDs[0], 0, Comm());
114 Epetra_Map ColMap(-1, NumMyCols, &GlobalColIDs[0], 0, Comm());
117 SetMaps(RowMap, ColMap);
122 ierr += HYPRE_ParCSRMatrixGetComm(ParMatrix_, &comm);
125 ierr += HYPRE_IJVectorCreate(comm, MyRowStart_, MyRowEnd_, &X_hypre);
126 ierr += HYPRE_IJVectorSetObjectType(X_hypre, HYPRE_PARCSR);
127 ierr += HYPRE_IJVectorInitialize(X_hypre);
128 ierr += HYPRE_IJVectorAssemble(X_hypre);
129 ierr += HYPRE_IJVectorGetObject(X_hypre, (
void**) &par_x);
132 ierr += HYPRE_IJVectorCreate(comm, MyRowStart_, MyRowEnd_, &Y_hypre);
133 ierr += HYPRE_IJVectorSetObjectType(Y_hypre, HYPRE_PARCSR);
134 ierr += HYPRE_IJVectorInitialize(Y_hypre);
135 ierr += HYPRE_IJVectorAssemble(Y_hypre);
136 ierr += HYPRE_IJVectorGetObject(Y_hypre, (
void**) &par_y);
139 x_vec = (hypre_ParVector *) hypre_IJVectorObject(((hypre_IJVector *) X_hypre));
140 x_local = hypre_ParVectorLocalVector(x_vec);
142 y_vec = (hypre_ParVector *) hypre_IJVectorObject(((hypre_IJVector *) Y_hypre));
143 y_local = hypre_ParVectorLocalVector(y_vec);
146 SolverDestroyPtr_ = &HYPRE_ParCSRPCGDestroy;
147 SolverSetupPtr_ = &HYPRE_ParCSRPCGSetup;
148 SolverSolvePtr_ = &HYPRE_ParCSRPCGSolve;
149 SolverPrecondPtr_ = &HYPRE_ParCSRPCGSetPrecond;
153 PrecondDestroyPtr_ = &HYPRE_EuclidDestroy;
154 PrecondSetupPtr_ = &HYPRE_EuclidSetup;
155 PrecondSolvePtr_ = &HYPRE_EuclidSolve;
157 ComputeNumericConstants();
158 ComputeStructureConstants();
164 ierr += HYPRE_IJVectorDestroy(
X_hypre);
166 ierr += HYPRE_IJVectorDestroy(
Y_hypre);
184 double * Values,
int * Indices)
const
193 NumEntries = num_entries;
195 if(Length < NumEntries){
196 printf(
"The arrays passed in are not large enough. Allocate more space.\n");
200 for(
int i = 0; i < NumEntries; i++){
201 Values[i] = values[i];
215 NumEntries = nentries[0];
285 bool SameVectors =
false;
291 for(
int VecNum = 0; VecNum < NumVectors; VecNum++) {
296 double *x_temp =
x_local->data;
297 double *y_temp =
y_local->data;
301 y_values =
new double[X.
MyLength()];
317 std::vector<double> new_values; new_values.resize(NumEntries);
318 std::vector<int> new_indices; new_indices.resize(NumEntries);
319 for(
int i = 0; i < NumEntries; i++){
320 new_values[i] = y_values[i];
323 EPETRA_CHK_ERR((*Y(VecNum)).ReplaceMyValues(NumEntries, &new_values[0], &new_indices[0]));
566 if(UsePreconditioner ==
false){
600 bool SameVectors =
false;
615 for(
int VecNum = 0; VecNum < NumVectors; VecNum++) {
623 y_values =
new double[X.
MyLength()];
626 double *x_temp =
x_local->data;
629 double *y_temp =
y_local->data;
646 std::vector<double> new_values; new_values.resize(NumEntries);
647 std::vector<int> new_indices; new_indices.resize(NumEntries);
648 for(
int i = 0; i < NumEntries; i++){
649 new_values[i] = y_values[i];
652 EPETRA_CHK_ERR((*Y(VecNum)).ReplaceMyValues(NumEntries, &new_values[0], &new_indices[0]));
674 for(
int j = 0; j < num_entries; j++){
676 new_values[j] = X[i]*values[j];
677 new_indices[j] = indices[j];
681 EPETRA_CHK_ERR(HYPRE_IJMatrixSetValues(
Matrix_, 1, &num_entries, rows, &new_indices[0], &new_values[0]));
706 for(
int j = 0; j < num_entries; j++){
710 new_values[j] = values[j] * Import_Vector[index];
711 new_indices[j] = indices[j];
716 EPETRA_CHK_ERR(HYPRE_IJMatrixSetValues(
Matrix_, 1, &num_entries, rows, &new_indices[0], &new_values[0]));
736 int numRows, numCols;
745 int ColStart, ColEnd;