destroyinit.c

Go to the documentation of this file.
00001 /*
00002     This file is part of magpar.
00003 
00004     Copyright (C) 2002-2010 Werner Scholz
00005 
00006     www:   http://www.magpar.net/
00007     email: magpar(at)magpar.net
00008 
00009     magpar is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     magpar is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with magpar; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 static char const Id[] = "$Id: destroyinit.c 2962 2010-02-04 19:50:44Z scholz $\n\n";
00025 static char const Td[] = "$Today: " __FILE__ "  " __DATE__ "  "  __TIME__  " $\n\n";
00026 
00027 #include "init.h"
00028 
00029 int DataDestroyInit(GridData *gdata)
00030 {
00031   MagparFunctionLogBegin;
00032 
00033   int rank,size;
00034   ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);
00035   ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr);
00036 
00037   ierr = PetscFree(gdata->bndfacvert);CHKERRQ(ierr);
00038   gdata->bndfacvert=PETSC_NULL;
00039   ierr = PetscFree(gdata->vertbndg2bnd);CHKERRQ(ierr);
00040   gdata->vertbndg2bnd=PETSC_NULL;
00041 
00042 #ifdef HAVE_ELEVERTALL
00043   if (size>1) {
00044     ierr = PetscFree(gdata->elevertall);CHKERRQ(ierr);
00045   }
00046 #ifdef HAVE_M2IJ
00047   ierr = PetscFree(gdata->mesh2nodal_ia);CHKERRQ(ierr);
00048   ierr = PetscFree(gdata->mesh2nodal_ja);CHKERRQ(ierr);
00049   ierr = PetscFree(gdata->mesh2dual_ia);CHKERRQ(ierr);
00050   ierr = PetscFree(gdata->mesh2dual_ja);CHKERRQ(ierr);
00051 #endif
00052 #endif
00053 
00054   /* Don't destroy vertvol array because FieldSmoothInit needs it and
00055    * FieldSmoothInit can be called after DataDestroyInit when
00056    * Hdemag==off and Emini is used (eminisolve.c calls FieldSmoothApply)
00057    * e.g. in example iface
00058 
00059   ierr = VecDestroy(gdata->vertvol);CHKERRQ(ierr);
00060   gdata->vertvol=PETSC_NULL;
00061   */
00062 
00063   MagparFunctionLogReturn(0);
00064 }

magpar - Parallel Finite Element Micromagnetics Package
Copyright (C) 2002-2010 Werner Scholz