43 #ifndef _fei_Aztec_LinSysCore_hpp_
44 #define _fei_Aztec_LinSysCore_hpp_
47 #include <fei_macros.hpp>
49 #include <fei_Data.hpp>
50 #include <fei_LinearSystemCore.hpp>
51 #include <fei_SharedPtr.hpp>
57 #include <fei_AztecDMSR_Matrix.hpp>
62 namespace fei_trilinos {
67 class AztecDMSR_Matrix;
68 class AztecDVBR_Matrix;
72 Aztec_LinSysCore(MPI_Comm comm);
73 virtual ~Aztec_LinSysCore();
82 int parameters(
int numParams,
const char*
const * params);
84 int setLookup(
Lookup& lookup);
86 int setGlobalOffsets(
int len,
int* nodeOffsets,
int* eqnOffsets,
89 int setConnectivities(GlobalID elemBlock,
92 const GlobalID* elemIDs,
93 const int*
const* connNodes) ;
95 int setStiffnessMatrices(GlobalID,
98 const double *
const *
const *,
103 int setLoadVectors(GlobalID,
106 const double *
const *,
111 int setMatrixStructure(
int** ptColIndices,
115 int* ptRowsPerBlkRow) ;
117 int setMultCREqns(
int,
124 int setPenCREqns(
int,
134 int resetMatrixAndVector(
double s);
135 int resetMatrix(
double s);
136 int resetRHSVector(
double s);
143 int sumIntoSystemMatrix(
int numPtRows,
const int* ptRows,
144 int numPtCols,
const int* ptCols,
145 int numBlkRows,
const int* blkRows,
146 int numBlkCols,
const int* blkCols,
147 const double*
const* values);
149 int sumIntoSystemMatrix(
int numPtRows,
const int* ptRows,
150 int numPtCols,
const int* ptCols,
151 const double*
const* values);
152 int putIntoSystemMatrix(
int numPtRows,
const int* ptRows,
153 int numPtCols,
const int* ptCols,
154 const double*
const* values);
156 int getMatrixRowLength(
int row,
int& length);
158 int getMatrixRow(
int row,
double* coefs,
int* indices,
159 int len,
int& rowLength);
164 int sumIntoRHSVector(
int num,
165 const double* values,
167 int putIntoRHSVector(
int num,
168 const double* values,
170 int getFromRHSVector(
int num,
177 int matrixLoadComplete();
180 int enforceEssentialBC(
int* globalEqn,
182 double* gamma,
int len);
184 int enforceBlkEssentialBC(
int* blkEqn,
int* blkOffset,
185 double* alpha,
double* gamma,
188 int enforceRemoteEssBCs(
int numEqns,
int* globalEqns,
189 int** colIndices,
int* colIndLen,
192 int enforceBlkRemoteEssBCs(
int numEqns,
int* blkEqns,
193 int** blkColInds,
int** blkColOffsets,
194 int* blkColLens,
double** remEssBCCoefs);
202 int getMatrixPtr(
Data& data);
208 int copyInMatrix(
double scalar,
const Data& data);
214 int copyOutMatrix(
double scalar,
Data& data);
220 int sumInMatrix(
double scalar,
const Data& data);
225 int getRHSVectorPtr(
Data& data);
230 int copyInRHSVector(
double scalar,
const Data& data);
231 int copyOutRHSVector(
double scalar,
Data& data);
232 int sumInRHSVector(
double scalar,
const Data& data);
237 int destroyMatrixData(
Data& data);
238 int destroyVectorData(
Data& data);
241 int setNumRHSVectors(
int numRHSs,
const int* rhsIDs);
245 int setRHSID(
int rhsID);
251 int putInitialGuess(
const int* eqnNumbers,
const double* values,
255 int getSolution(
double* answers,
int len);
259 int getSolnEntry(
int eqnNumber,
double& answer);
263 int formResidual(
double* values,
int len);
266 int launchSolver(
int& solveStatus,
int& iterations);
268 int putNodalFieldData(
int,
int,
int*,
int,
const double*)
271 int writeSystem(
const char* name);
273 double* getMatrixBeginPointer() {
return A_ptr_->getBeginPointer(); }
275 int getMatrixOffset(
int row,
int col) {
return A_ptr_->getOffset(row,col); }
279 int createMiscStuff();
281 int allocateMatrix(
int** ptColIndices,
int* ptRowLengths,
282 int** blkColIndices,
int* blkRowLengths,
283 int* ptRowsPerBlkRow);
285 int VBRmatPlusScaledMat(AztecDVBR_Matrix* A,
double scalar,
286 AztecDVBR_Matrix* source);
288 int MSRmatPlusScaledMat(AztecDMSR_Matrix* A,
double scalar,
289 AztecDMSR_Matrix* source);
291 int createBlockMatrix(
int** blkColIndices,
293 int* ptRowsPerBlkRow);
295 int sumIntoBlockRow(
int numBlkRows,
const int* blkRows,
296 int numBlkCols,
const int* blkCols,
297 const double*
const* values,
299 bool overwriteInsteadOfAccumulate);
301 int copyBlockRow(
int i,
const int* blkRows,
302 int numBlkCols,
const int* blkCols,
303 const double*
const* values,
306 int modifyRHSforBCs();
308 int explicitlySetDirichletBCs();
310 int blockRowToPointRow(
int blkRow);
312 int getBlockRow(
int blkRow,
double*& val,
int& valLen,
313 int*& blkColInds,
int& blkColIndLen,
314 int& numNzBlks,
int& numNNZ);
316 int getBlkEqnsAndOffsets(
int* ptEqns,
int* blkEqns,
int* blkOffsets,
319 int getBlockSize(
int blkInd);
321 int sumIntoPointRow(
int numPtRows,
const int* ptRows,
322 int numPtCols,
const int* ptColIndices,
323 const double*
const* values,
324 bool overwriteInsteadOfAccumulate);
326 int sumPointIntoBlockRow(
int blkRow,
int rowOffset,
327 int blkCol,
int colOffset,
double value);
329 int setMatrixType(
const char* name);
330 int selectSolver(
const char* name);
331 int selectPreconditioner(
const char* name);
332 void setSubdomainSolve(
const char* name);
333 void setScalingOption(
const char* param);
334 void setConvTest(
const char* param);
335 void setPreCalc(
const char* param);
336 void setTypeOverlap(
const char* param);
337 void setOverlap(
const char* param);
338 void setOrthog(
const char* param);
339 void setAuxVec(
const char* param);
340 void setAZ_output(
const char* param);
342 void recordUserParams();
344 void checkForParam(
const char* paramName,
int numParams_,
348 void recordUserOptions();
350 void checkForOption(
const char* paramName,
int numParams_,
354 int blkRowEssBCMod(
int blkEqn,
int blkOffset,
double* val,
int* blkCols,
355 int numCols,
int numPtNNZ,
double alpha,
double gamma);
357 int blkColEssBCMod(
int blkRow,
int blkEqn,
int blkOffset,
double* val,
359 int numCols,
int numPtNNZ,
double alpha,
double gamma);
361 void setDebugOutput(
const char* path,
const char* name);
363 void debugOutput(
const char* msg)
const;
365 int writeA(
const char* name);
366 int writeVec(Aztec_LSVector* v,
const char* name);
368 int messageAbort(
const char* msg)
const;
383 AztecDMSR_Matrix *A_;
384 AztecDMSR_Matrix *A_ptr_;
385 Aztec_LSVector *x_, **b_, *bc_;
389 bool explicitDirichletBCs_;
390 bool BCenforcement_no_column_mod_;
391 Aztec_LSVector *b_ptr_;
392 bool matrixAllocated_;
393 bool vectorsAllocated_;
394 bool blkMatrixAllocated_;
397 bool needNewPreconditioner_;
399 bool tooLateToChooseBlock_;
402 AztecDVBR_Matrix *blkA_;
403 AztecDVBR_Matrix *blkA_ptr_;
408 bool precondCreated_;
410 bool scalingCreated_;
413 double *aztec_params_;
414 double *aztec_status_;
420 bool tmp_b_allocated_;
434 int numGlobalEqnBlks_;
436 int numLocalEqnBlks_;
437 int* localBlockSizes_;
439 int numNonzeroBlocks_;
443 char** paramStrings_;
447 int debugFileCounter_;
449 char* debugFileName_;
452 std::map<std::string,unsigned>& named_solve_counter_;