writedata.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: writedata.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 "magpario.h"
00028 #include "util/util.h"
00029 #ifdef ADDONS
00030 #include "addons/addons.h"
00031 #endif
00032 #ifdef PNG
00033 #include "png/writepng.h"
00034 #endif
00035 
00036 int WriteSet(GridData *gdata)
00037 {
00038   MagparFunctionInfoBegin;
00039 
00040   int rank,size;
00041   ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);
00042   ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr);
00043 
00044   /* check if we are supposed to write output data */
00045   if (gdata->inp<0) MagparFunctionInfoReturn(0);
00046   int maxint=10000;
00047   if (gdata->inp>maxint) {
00048     PetscPrintf(PETSC_COMM_WORLD,
00049       "inp number reached maximum: %i\n"
00050       "no output files stored!\n",
00051       maxint
00052     );
00053     MagparFunctionInfoReturn(0);
00054   }
00055 
00056   /* do not evaluate return value of WriteAVS
00057      with "CHKERRQ(ierr);" but keep going
00058      gzopen fails sometimes for unknown reasons
00059   */
00060   WriteAVS(gdata);
00061   ierr = WriteDat(gdata);CHKERRQ(ierr);
00062 #ifdef PNG
00063   ierr = WritePNG(gdata);CHKERRQ(ierr);
00064   ierr = WritePNG2(gdata);CHKERRQ(ierr);
00065 #endif
00066 #ifdef ADDONS
00067   ierr = WriteFld(gdata);CHKERRQ(ierr);
00068 #endif
00069 
00070 /* do this in writelog.c !
00071   ierr = WriteMavg(gdata);CHKERRQ(ierr);
00072 */
00073 
00074 /* do these just during initialization
00075   ierr = WriteFEMAVS(gdata);CHKERRQ(ierr);
00076 */
00077 
00078 
00079   /* increment inp counter and indicate that we just wrote everything */
00080   gdata->inp=-(gdata->inp+1);
00081 
00082   MagparFunctionInfoReturn(0);
00083 }
00084 

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