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 ShadowPetscSOE_h
00038 #define ShadowPetscSOE_h
00039
00040 #include <LinearSOE.h>
00041 #include <Vector.h>
00042 #include <PetscSOE.h>
00043
00044
00045 #include <petsc.h>
00046
00047
00048 class PetscSolver;
00049
00050 class ShadowPetscSOE : public LinearSOE
00051 {
00052 public:
00053 ShadowPetscSOE(PetscSolver &theSolver, int blockSize);
00054
00055 ~ShadowPetscSOE();
00056
00057 int solve(void);
00058
00059 int getNumEqn(void) const;
00060 int setSize(Graph &theGraph);
00061
00062 int addA(const Matrix &, const ID &, double fact = 1.0);
00063 int addB(const Vector &, const ID &, double fact = 1.0);
00064 int setB(const Vector &, double fact = 1.0);
00065
00066 void zeroA(void);
00067 void zeroB(void);
00068
00069 const Vector &getX(void);
00070 const Vector &getB(void);
00071 double normRHS(void);
00072
00073 void setX(int loc, double value);
00074
00075 int setSolver(PetscSolver &newSolver);
00076
00077 int sendSelf(int commitTag, Channel &theChannel);
00078 int recvSelf(int commitTag, Channel &theChannel,
00079 FEM_ObjectBroker &theBroker);
00080
00081 protected:
00082
00083 private:
00084 MPI_Comm theComm;
00085
00086 PetscSOE theSOE;
00087 PetscSolver *theSolver;
00088 int myRank;
00089 int numProcessors;
00090 int sendData[3];
00091 void *sendBuffer;
00092 int blockSize;
00093 };
00094
00095
00096 #endif
00097
00098
00099
00100
00101
00102