2
0
mirror of https://github.com/LCPQ/DEHam synced 2024-12-22 12:23:40 +01:00

now reads local values of eigenvector

This commit is contained in:
vijay gopal chilkuri 2016-12-21 12:17:40 +01:00
parent 39996be82e
commit 42ceea2ae9

View File

@ -28,11 +28,15 @@ int main(int argc,char **argv)
char const* const fileName = argv[1]; char const* const fileName = argv[1];
FILE* file = fopen(fileName, "r"); FILE* file = fopen(fileName, "r");
Data getdata; Data getdata;
PetscInt nlocal;
Data_new(file, &getdata); Data_new(file, &getdata);
nlocal = getdata.n/getdata.npar;
//printf("n=%ld\t nnz=%ld\t npar=%ld\t ntrou=%ld\t isz=%ld\n",getdata.n,getdata.nnz,getdata.npar,getdata.ntrou,getdata.isz); //printf("n=%ld\t nnz=%ld\t npar=%ld\t ntrou=%ld\t isz=%ld\n",getdata.n,getdata.nnz,getdata.npar,getdata.ntrou,getdata.isz);
PetscScalar valxr[nlocal];
PetscInt indxr[nlocal];
//Vec Vr,Vi; //Vec Vr,Vi;
char filename[PETSC_MAX_PATH_LEN]="FIL666"; char filename[PETSC_MAX_PATH_LEN]="FIL666";
PetscViewer viewer; PetscViewer viewer;
@ -220,9 +224,13 @@ int main(int argc,char **argv)
ierr = VecNorm(xr, NORM_2, &norm);CHKERRQ(ierr); ierr = VecNorm(xr, NORM_2, &norm);CHKERRQ(ierr);
PetscPrintf(PETSC_COMM_WORLD," Norm = %18f \n", (double)norm); PetscPrintf(PETSC_COMM_WORLD," Norm = %18f \n", (double)norm);
for (i=Istart; i<Iend; i+=getdata.nnz) { for (i=Istart; i<Iend; i+=1) {
ierr = VecGetValues(xr, 1, i, value);CHKERRQ(ierr) indxr[i-Istart] = i;
PetscPrintf(PETSC_COMM_WORLD," Element # = %d Value = %18f \n", i, value[0]); }
ierr = VecGetValues(xr, nlocal, indxr, valxr);CHKERRQ(ierr);
for (i=Istart; i<Iend; i+=1) {
// PetscPrintf(PETSC_COMM_WORLD," Element # = %d Value = %18f \n", i, valxr[i-Istart]);
printf(" Element # = %d Value = %18f \n", i, valxr[i-Istart]);
} }
ierr = PetscPrintf(PETSC_COMM_WORLD,"\n");CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"\n");CHKERRQ(ierr);