00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef PetscSOE_h
00038 #define PetscSOE_h
00039
00040 #include <LinearSOE.h>
00041 #include <Vector.h>
00042
00043
00044 #include <petscksp.h>
00045
00046
00047 class PetscSolver;
00048
00049 class PetscSOE : public LinearSOE
00050 {
00051 public:
00052 PetscSOE(PetscSolver &theSolver, int blockSize=1);
00053
00054 ~PetscSOE();
00055
00056 int getNumEqn(void) const;
00057 int setSize(Graph &theGraph);
00058
00059 int addA(const Matrix &, const ID &, double fact = 1.0);
00060 int addB(const Vector &, const ID &, double fact = 1.0);
00061 int setB(const Vector &, double fact = 1.0);
00062
00063 void zeroA(void);
00064 void zeroB(void);
00065
00066 const Vector &getX(void);
00067 const Vector &getB(void);
00068 double normRHS(void);
00069
00070 void setX(int loc, double value);
00071 void setX(const Vector &x);
00072
00073 int setSolver(PetscSolver &newSolver);
00074
00075 int sendSelf(int commitTag, Channel &theChannel);
00076 int recvSelf(int commitTag, Channel &theChannel,
00077 FEM_ObjectBroker &theBroker);
00078
00079 friend class PetscSolver;
00080 friend class ActorPetscSOE;
00081 friend class ShadowPetscSOE;
00082
00083 protected:
00084 int setChannels(int nChannels, Channel **theChannels);
00085
00086 private:
00087 int isFactored;
00088 int size;
00089 int processID;
00090 int numProcesses;
00091
00092 double *B, *X;
00093 int *indices;
00094 Vector *vectX;
00095 Vector *vectB;
00096 Mat A;
00097 Vec x, b;
00098 int blockSize;
00099 PetscTruth flg;
00100
00101 int numChannels;
00102 Channel **theChannels;
00103 ID **localCol;
00104
00105 int startRow, endRow;
00106 };
00107
00108
00109 #endif
00110