aboutsummaryrefslogtreecommitdiff
path: root/src/Write2D.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-01-21 18:00:59 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-01-21 18:00:59 +0000
commit400e340a12e6019f91ded50e5ba1791ee04edda0 (patch)
treed1e719baf82aa32efd45d36bf6b3ec7aec66713e /src/Write2D.c
parentd58e1c47d498896b0c1f208724c7d138abce6349 (diff)
Added several stuff to IOFlexIO:
- checkpointing/recovery of parameters - made 'out2D_every', 'out2D_vars', 'out3D_every' and 'out3D_vars' steerable - fixed compiler warnings - grdocs git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@78 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/Write2D.c')
-rw-r--r--src/Write2D.c91
1 files changed, 41 insertions, 50 deletions
diff --git a/src/Write2D.c b/src/Write2D.c
index 55334c3..a4f1051 100644
--- a/src/Write2D.c
+++ b/src/Write2D.c
@@ -42,10 +42,6 @@ static char *rcsid = "$Id$";
@author Gabrielle Allen
@desc Writes the 2D data of a variable into separate IEEEIO files
@enddesc
- @calls CCTK_GHExtensionHandle
- CCTK_MyProc
- CCTK_nProcs
- CCTK_WARN
@calledby IOFlexIO_Output2DVarAs
IOFlexIO_TriggerOutput2D
@history
@@ -99,12 +95,10 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias)
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) {
char *fullname = CCTK_FullName (index);
- char *msg = (char *) malloc (80 + strlen (fullname));
- sprintf (msg, "No IOFlexIO 2D output for '%s' (no storage)", fullname);
- CCTK_WARN (2, msg);
+ CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "No IOFlexIO 2D output for '%s' (no storage)", fullname);
free (fullname);
- free (msg);
return;
}
@@ -125,6 +119,38 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias)
#endif
}
+ variable_type = CCTK_VarTypeI (index);
+ switch (variable_type) {
+ case CCTK_VARIABLE_CHAR:
+ ioflex_type = FLEXIO_CHAR;
+ element_size = sizeof (CCTK_CHAR);
+#ifdef MPI
+ mpi_type = PUGH_MPI_CHAR;
+#endif
+ break;
+
+ case CCTK_VARIABLE_INT:
+ ioflex_type = FLEXIO_INT;
+ element_size = sizeof (CCTK_INT);
+#ifdef MPI
+ mpi_type = PUGH_MPI_INT;
+#endif
+ break;
+
+ case CCTK_VARIABLE_REAL:
+ ioflex_type = FLEXIO_REAL;
+ element_size = ioUtilGH->out_single ?
+ sizeof (CCTK_REAL4) : sizeof (CCTK_REAL);
+#ifdef MPI
+ mpi_type = ioUtilGH->out_single ? PUGH_MPI_REAL4 : PUGH_MPI_REAL;
+#endif
+ break;
+
+ default:
+ CCTK_WARN (1, "Unsupported variable type in IOFlexIO_Write2D");
+ return;
+ }
+
/* Open the files on the first trip through if we are proc. 0 */
if (myproc == 0) {
@@ -133,43 +159,40 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias)
if (IEEEfile_2D == NULL) {
int len;
char *fname;
- char *msg;
IEEEfile_2D = (IOFile *) malloc (3 * sizeof (IOFile));
len = strlen (myGH->outdir2D) + strlen (alias);
fname = (char *) malloc (len + 20);
- msg = (char *) malloc (len + 20 + 40);
- assert (IEEEfile_2D && fname && msg);
+ assert (IEEEfile_2D && fname);
/* Create files (open mode "w") */
sprintf (fname, "%s/%s_2d_yz.ieee", myGH->outdir2D, alias);
IEEEfile_2D [0] = IEEEopen (fname, "w");
if (! IOisValid (IEEEfile_2D [0])) {
- sprintf (msg, "Cannot open output file %s", fname);
- CCTK_WARN (1, msg);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Cannot open 2D output file '%s'", fname);
return;
}
sprintf (fname, "%s/%s_2d_xz.ieee", myGH->outdir2D, alias);
IEEEfile_2D [1] = IEEEopen (fname, "w");
if (! IOisValid (IEEEfile_2D [1])) {
- sprintf (msg, "Cannot open output file %s", fname);
- CCTK_WARN (1, msg);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Cannot open 2D output file '%s'", fname);
return;
}
sprintf (fname, "%s/%s_2d_xy.ieee", myGH->outdir2D, alias);
IEEEfile_2D [2] = IEEEopen (fname, "w");
if (! IOisValid (IEEEfile_2D [2])) {
- sprintf (msg, "Cannot open output file %s", fname);
- CCTK_WARN (1, msg);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Cannot open 2D output file '%s'", fname);
return;
}
/* store file desriptors in database */
StoreNamedData (&myGH->filenameList2D, alias, IEEEfile_2D);
- free (msg);
free (fname);
}
}
@@ -182,38 +205,6 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias)
timelevel--;
data = CCTK_VarDataPtrI (GH, timelevel, index);
- variable_type = CCTK_VarTypeI (index);
- switch (variable_type) {
- case CCTK_VARIABLE_CHAR:
- ioflex_type = FLEXIO_CHAR;
- element_size = sizeof (CCTK_CHAR);
-#ifdef MPI
- mpi_type = PUGH_MPI_CHAR;
-#endif
- break;
-
- case CCTK_VARIABLE_INT:
- ioflex_type = FLEXIO_INT;
- element_size = sizeof (CCTK_INT);
-#ifdef MPI
- mpi_type = PUGH_MPI_INT;
-#endif
- break;
-
- case CCTK_VARIABLE_REAL:
- ioflex_type = FLEXIO_REAL;
- element_size = ioUtilGH->out_single ?
- sizeof (CCTK_REAL4) : sizeof (CCTK_REAL);
-#ifdef MPI
- mpi_type = ioUtilGH->out_single ? PUGH_MPI_REAL4 : PUGH_MPI_REAL;
-#endif
- break;
-
- default:
- CCTK_WARN (1, "Unsupported variable type in IOFlexIO_Write2D");
- return;
- }
-
for (dir = 0; dir < 3; dir++) {
npoints = 0;
/* Figure out the number of points */