|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
00001 // Copyright (C) 2009-2011 Ed Bueler 00002 // 00003 // This file is part of PISM. 00004 // 00005 // PISM is free software; you can redistribute it and/or modify it under the 00006 // terms of the GNU General Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or (at your option) any later 00008 // version. 00009 // 00010 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with PISM; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 #ifndef __columnSystem_hh 00020 #define __columnSystem_hh 00021 00022 #include <string> 00023 #include <petsc.h> 00024 #include "iceModelVec.hh" 00025 00027 00039 class columnSystemCtx { 00040 00041 public: 00042 columnSystemCtx(PetscInt my_nmax, string my_prefix); 00043 ~columnSystemCtx(); 00044 00045 PetscErrorCode setIndicesAndClearThisColumn(PetscInt i, PetscInt j, PetscInt ks); 00046 00047 PetscScalar norm1(const PetscInt n) const; 00048 PetscScalar ddratio(const PetscInt n) const; 00049 00050 PetscErrorCode viewVectorValues(PetscViewer viewer, 00051 PetscScalar *v, PetscInt m, const char* info) const; 00052 PetscErrorCode viewMatrix(PetscViewer viewer, const char* info) const; 00053 PetscErrorCode viewSystem(PetscViewer viewer) const; 00054 00055 PetscErrorCode reportColumnZeroPivotErrorMFile(const PetscErrorCode errindex); 00056 PetscErrorCode viewColumnInfoMFile(PetscScalar *x, PetscInt n); 00057 PetscErrorCode viewColumnInfoMFile(char *filename, PetscScalar *x, PetscInt n); 00058 00059 protected: 00060 PetscInt nmax; 00061 PetscScalar *L, *Lp, *D, *U, *rhs, *work; // vectors for tridiagonal system 00062 00063 PetscInt i, j, ks; 00064 00065 // deliberately protected so only derived classes can use 00066 PetscErrorCode solveTridiagonalSystem(const PetscInt n, PetscScalar **x); 00067 00068 private: 00069 bool indicesValid; 00070 string prefix; 00071 PetscErrorCode resetColumn(); 00072 }; 00073 00074 #endif /* __columnSystem_hh */ 00075
1.7.3