aboutsummaryrefslogtreecommitdiff
path: root/CarpetAttic
diff options
context:
space:
mode:
authorcvs_anon <>2003-09-17 11:47:00 +0000
committercvs_anon <>2003-09-17 11:47:00 +0000
commit607789d276677e413c81f0e0fe6d5ae2862264f3 (patch)
treea9c4e172fba590a485953ff7ab9bb9a68a2e7117 /CarpetAttic
parentfca0fa506d22e86e7c028b8c2e7c6e67bca2497c (diff)
Messed around with this. Still not working. Ran into Carpet problems.[_^?_] Asking Erik&Ian
darcs-hash:20030917114700-62b91-94be58492a57149b904308dba06069a97daa3be1.gz
Diffstat (limited to 'CarpetAttic')
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl4
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl2
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl8
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl8
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc53
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc65
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h13
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh4
8 files changed, 93 insertions, 64 deletions
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl b/CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl
index 8cd4f59b5..7be774467 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl
@@ -1,4 +1,4 @@
-# Configuration definitions for thorn CarpetIOFlexIOCheckpoint
-# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl,v 1.1 2003/09/04 16:23:22 tradke Exp $
+# Configuration definitions for thorn CarpetIOFlexIO
+# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/configuration.ccl,v 1.2 2003/09/17 13:47:00 cvs_anon Exp $
Requires Thorns: Carpet CarpetLib FlexIO
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl b/CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl
index 6e161d107..94d56dceb 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl
@@ -1,5 +1,5 @@
# Interface definition for thorn CarpetIOFlexIO
-# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl,v 1.5 2003/09/04 16:23:22 tradke Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/interface.ccl,v 1.6 2003/09/17 13:47:00 cvs_anon Exp $
implements: IOFlexIO
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl b/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl
index eba189d5c..2bbd226de 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl
@@ -1,5 +1,5 @@
# Parameter definitions for thorn CarpetIOFlexIO
-# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl,v 1.1 2003/05/16 14:02:18 hawke Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl,v 1.2 2003/09/17 13:47:00 cvs_anon Exp $
@@ -11,7 +11,7 @@ USES CCTK_INT out_every
-restricted:
+private:
@@ -90,7 +90,6 @@ CCTK_STRING in3D_extension "File extension to use for 3D FlexIO input" STEERABLE
.* :: "A regex which matches everything"
} ""
-
BOOLEAN checkpoint "Do checkpointing with IOFlexIO" STEERABLE = ALWAYS
{
} "no"
@@ -109,6 +108,3 @@ USES BOOLEAN checkpoint_on_terminate
USES KEYWORD recover
USES STRING recover_file
USES KEYWORD verbose
-
-
-
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl b/CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl
index 6ff43773e..99f0fee3f 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl
@@ -1,18 +1,18 @@
# Schedule definitions for thorn CarpetIOFlexIO
-# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl,v 1.1 2003/05/16 14:02:18 hawke Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/schedule.ccl,v 1.2 2003/09/17 13:47:00 cvs_anon Exp $
-schedule CarpetIOFlexIOStartup at STARTUP after IOUtil_Startup
+schedule CarpetIOFlexIO_Startup at STARTUP after IOUtil_Startup
{
LANG: C
} "Startup routine"
-schedule CarpetIOFlexIOReadData at INITIAL
+schedule CarpetIOFlexIO_ReadData at INITIAL
{
LANG: C
OPTIONS: global
} "Read initial data from file"
-schedule CarpetChReEvolutionCheckpoint at CHECKPOINT
+schedule CarpetIOFlexIO_EvolutionCheckpoint at CHECKPOINT
{
LANG: C
OPTIONS: global
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
index 5836b194c..a909d7f78 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
@@ -48,10 +48,13 @@
#include "ioflexio.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.5 2003/07/14 15:41:08 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.6 2003/09/17 13:47:00 cvs_anon Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_checkpointrestart_cc);
}
+
+
+
namespace CarpetCheckpointRestart {
using namespace std;
@@ -60,9 +63,7 @@ namespace CarpetCheckpointRestart {
static int Checkpoint (const cGH* const cgh, int called_from);
-
-
- void CarpetChReEvolutionCheckpoint( const cGH* const cgh){
+ void CarpetIOFlexIO_EvolutionCheckpoint( const cGH* const cgh){
DECLARE_CCTK_PARAMETERS
@@ -77,6 +78,7 @@ namespace CarpetCheckpointRestart {
"iteration %d", cgh->cctk_iteration);
CCTK_INFO ("---------------------------------------------------------");
}
+CCTK_VInfo (CCTK_THORNSTRING, "bogusbefore reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
Checkpoint (cgh, CP_EVOLUTION_DATA);
if (checkpoint_next)
@@ -138,15 +140,13 @@ namespace CarpetCheckpointRestart {
writer->writeAttribute("Cactus version", FLEXIO_CHAR,
strlen (version) + 1, version);
-
-
return 0;
}
static int Checkpoint (const cGH* const cgh, int called_from)
{
- char filename[1024];
+ char cp_filename[1024], cp_tempname[1024];
int myproc, first_vindex, gindex, retval;
char *fullname;
const char *timer_descriptions[3] = {"Time to dump parameters: ",
@@ -164,30 +164,48 @@ namespace CarpetCheckpointRestart {
ioRequest *request;
DECLARE_CCTK_PARAMETERS
-
+ CCTK_VInfo (CCTK_THORNSTRING, "boguscheck reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
+
+
myproc = CCTK_MyProc (cgh);
ioUtilGH = (const ioGH *) CCTK_GHExtension (cgh, "IO");
- IOUtil_PrepareFilename (cgh, NULL, filename, called_from,
+ IOUtil_PrepareFilename (cgh, NULL, cp_filename, called_from,
myproc / ioUtilGH->ioproc_every, ioUtilGH->unchunked);
-
- sprintf(filename, "%s.ieee",filename);
- fprintf(stderr,"%s\n",filename);
+ // Invent a file name
+ const char* extension = 0;
+ if (CCTK_Equals(out3D_format, "IEEE")) {
+ extension = ".raw";
+#ifdef HDF4
+ } else if (CCTK_Equals(out3D_format, "HDF4")) {
+ extension = ".hdf";
+#endif
+#ifdef HDF5
+ } else if (CCTK_Equals(out3D_format, "HDF5")) {
+ extension = ".h5";
+#endif
+ } else {
+ assert (0);
+ }
+
+ sprintf(cp_tempname,"%s.tmp.%s",cp_filename,extension);
+ sprintf(cp_filename,"%s.%s",cp_filename,extension);
+
if (CCTK_MyProc(cgh)==0)
{
if (CCTK_Equals ("verbose", "full"))
{
- CCTK_VInfo (CCTK_THORNSTRING, "Creating file '%s'", filename);
+ CCTK_VInfo (CCTK_THORNSTRING, "Creating temporary checkpoint file '%s'", cp_tempname);
}
- writer = new IEEEIO(filename, IObase::Create);
+ writer = new IEEEIO(cp_tempname, IObase::Create);
if (! (writer->isValid()) )
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Can't open checkpoint file '%s'. Checkpointing is skipped",
- filename);
+ cp_tempname);
return (-1);
}
amrwriter = new AMRwriter(*writer);
@@ -247,7 +265,7 @@ namespace CarpetCheckpointRestart {
request->timelevel++)
{
- if (CCTK_Equals (verbose, "full"))
+ if (verbose)
{
fullname = CCTK_FullName (request->vindex);
CCTK_VInfo (CCTK_THORNSTRING, " %s (timelevel %d)",
@@ -255,7 +273,8 @@ namespace CarpetCheckpointRestart {
free (fullname);
}
// write the var
- retval += WriteVarAs(cgh,writer,amrwriter,request->vindex);
+
+ retval += WriteVarAs(cgh,writer,amrwriter,request->vindex);
}
} /* end of loop over all variables */
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
index c760012eb..32a147dac 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
@@ -27,7 +27,7 @@
#include "IEEEIO.hh"
#include "IO.hh"
-// Hack to stop FlexIO type clash
+// Hack to stop FlexIO data type clash with LAM MPI
#undef BYTE
#undef CHAR
@@ -44,7 +44,7 @@
#include "ioflexio.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc,v 1.4 2003/07/14 15:41:08 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc,v 1.5 2003/09/17 13:47:00 cvs_anon Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_ioflexio_cc);
}
@@ -63,7 +63,9 @@ namespace CarpetIOFlexIO {
vector<bool> do_truncate;
vector<vector<int> > last_output;
- const char* GetStringParameter (const char* const parametername,
+
+
+ static const char* GetStringParameter (const char* const parametername,
const char* const fallback);
static int GetIntParameter (const char* const parametername, int fallback);
static bool CheckForVariable (const cGH* const cgh,
@@ -72,7 +74,7 @@ namespace CarpetIOFlexIO {
- int CarpetIOFlexIOStartup ()
+ int CarpetIOFlexIO_Startup ()
{
CCTK_RegisterBanner ("AMR 3D FlexIO I/O provided by CarpetIOFlexIO");
@@ -120,11 +122,11 @@ namespace CarpetIOFlexIO {
}
return 0;
}
-
-
-
- static IObase::DataType FlexIODataType (int cctk_type){
-
+
+
+static IObase::DataType FlexIODataType (int cctk_type){
+ //we need this to have the FlexIO data types on hand
+ //for WriteVarAs
int retval;
@@ -158,8 +160,6 @@ namespace CarpetIOFlexIO {
break;
}
-
-
return (IObase::DataType)retval;
}
@@ -167,12 +167,15 @@ namespace CarpetIOFlexIO {
+
+
int WriteVarAs (const cGH* const cgh, IObase* writer, AMRwriter* amrwriter, int varindex)
{
DECLARE_CCTK_PARAMETERS;
+ CCTK_VInfo (CCTK_THORNSTRING, "bogusnew reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
/* I have got no idea why this stuff below is needed... ask Erik Schnetter */
@@ -182,9 +185,9 @@ namespace CarpetIOFlexIO {
const int var = varindex - n0;
assert (var>=0 && var<CCTK_NumVars());
const int tl = 0;
-
+ 1,-1,0
const int grouptype = CCTK_GroupTypeI(group);
- assert (! (grouptype != CCTK_GF && reflevel>0));
+ assert (! (grouptype != CCT1,-1,0K_GF && reflevel>0));
if (CCTK_MyProc(cgh)==0) {
@@ -224,7 +227,7 @@ namespace CarpetIOFlexIO {
(gpdim, origin, delta, timestep, maxreflevels);
// Set refinement information
- int interlevel_timerefinement;
+ int interlevel_timerefine1,-1,0ment;
int interlevel_spacerefinement[dim];
int initial_gridplacementrefinement[dim];
interlevel_timerefinement = hh->reffact;
@@ -242,23 +245,30 @@ namespace CarpetIOFlexIO {
// Set current time
amrwriter->setTime (cgh->cctk_iteration);
}
+
+
// Traverse all components on this refinement and multigrid level
BEGIN_COMPONENT_LOOP(cgh, grouptype) {
-
+
const ggf<dim>* ff = 0;
-
+
+
assert (var < (int)arrdata[group].data.size());
ff = (ggf<dim>*)arrdata[group].data[var];
+ CCTK_VInfo (CCTK_THORNSTRING, "bogus reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
const gdata<dim>* const data
= (*ff) (tl, reflevel, component, mglevel);
-
+ CCTK_VInfo (CCTK_THORNSTRING, "bogus2");
+
// Make temporary copy on processor 0
bbox<int,dim> ext = data->extent();
vect<int,dim> lo = ext.lower();
vect<int,dim> hi = ext.upper();
vect<int,dim> str = ext.stride();
+
+
// Ignore ghost zones if desired
for (int d=0; d<dim; ++d) {
@@ -277,6 +287,8 @@ namespace CarpetIOFlexIO {
gdata<dim>* const tmp = data->make_typed ();
tmp->allocate (ext, 0);
tmp->copy_from (data, ext);
+
+
// Write data
if (CCTK_MyProc(cgh)==0) {
@@ -293,7 +305,6 @@ namespace CarpetIOFlexIO {
// Delete temporary copy
delete tmp;
-
} END_COMPONENT_LOOP;
@@ -304,7 +315,7 @@ namespace CarpetIOFlexIO {
int OutputVarAs (const cGH* const cgh, const char* const varname,
const char* const alias) {
DECLARE_CCTK_PARAMETERS;
-
+ CCTK_VInfo (CCTK_THORNSTRING, "bogusnewout reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
const int n = CCTK_VarIndex(varname);
assert (n>=0 && n<CCTK_NumVars());
const int group = CCTK_GroupIndexFromVarI (n);
@@ -424,7 +435,7 @@ namespace CarpetIOFlexIO {
return 0;
}
-
+
int TimeToOutput (const cGH* const cgh, const int vindex) {
DECLARE_CCTK_PARAMETERS;
@@ -520,7 +531,7 @@ namespace CarpetIOFlexIO {
}
const int grouptype = CCTK_GroupTypeI(group);
- if (grouptype != CCTK_GF && reflevel>0) return 0;
+ const int rl = grouptype==CCTK_GF ? reflevel : 0;
// Find the input directory
const char* myindir = GetStringParameter("indir3D", "");
@@ -671,12 +682,13 @@ namespace CarpetIOFlexIO {
assert (var < (int)arrdata[group].data.size());
ff = (ggf<dim>*)arrdata[group].data[var];
- gdata<dim>* const data = (*ff) (tl, reflevel, component, mglevel);
+ gdata<dim>* const data = (*ff) (tl, rl, component, mglevel);
// Create temporary data storage on processor 0
const vect<int,dim> str = vect<int,dim>(reflevelfact);
const vect<int,dim> lb = vect<int,dim>(amr_origin) * str;
- const vect<int,dim> ub = lb + (vect<int,dim>(amr_dims) - 1) * str;
+ const vect<int,dim> ub
+ = lb + (vect<int,dim>(amr_dims) - 1) * str;
const bbox<int,dim> ext(lb,ub,str);
gdata<dim>* const tmp = data->make_typed ();
@@ -700,7 +712,7 @@ namespace CarpetIOFlexIO {
amrgrid = 0;
}
- } // loop over datasets
+ } // loop over datasets
// Close the file
if (CCTK_MyProc(cgh)==0) {
@@ -717,7 +729,7 @@ namespace CarpetIOFlexIO {
- int CarpetIOFlexIOReadData (CCTK_ARGUMENTS)
+ int CarpetIOFlexIO_ReadData (CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
return InputGH(cctkGH);
@@ -782,6 +794,3 @@ namespace CarpetIOFlexIO {
} // namespace CarpetIOFlexIO
-
-
-
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h
index 4c9941e4e..c987c6d21 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h
@@ -1,4 +1,4 @@
-/* $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h,v 1.1 2003/05/16 14:02:18 hawke Exp $ */
+/* $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.h,v 1.2 2003/09/17 13:47:00 cvs_anon Exp $ */
#ifndef CARPETIOFLEXIO_H
#define CARPETIOFLEXIO_H
@@ -13,8 +13,8 @@ namespace CarpetIOFlexIO {
#endif
/* Scheduled functions */
- int CarpetIOFlexIOStartup (void);
- int CarpetIOFlexIOReadData (CCTK_ARGUMENTS);
+ int CarpetIOFlexIO_Startup (void);
+ int CarpetIOFlexIO_ReadData (CCTK_ARGUMENTS);
#ifdef __cplusplus
} /* extern "C" */
} /* namespace CarpetIOFlexIO */
@@ -26,7 +26,7 @@ namespace CarpetCheckpointRestart {
#endif
/* Scheduled functions */
- void CarpetChReEvolutionCheckpoint (const cGH*);
+ void CarpetIOFlexIO_EvolutionCheckpoint (const cGH*);
#ifdef __cplusplus
} /* extern "C" */
} /* namespace CarpetIOFlexIO */
@@ -34,3 +34,8 @@ namespace CarpetCheckpointRestart {
#endif /* !defined(CARPETIOFLEXIO_H) */
+
+
+
+
+
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh
index 858832243..13350bf9f 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh,v 1.2 2003/06/18 18:24:28 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh,v 1.3 2003/09/17 13:47:00 cvs_anon Exp $
#ifndef CARPETIOFLEXIO_HH
#define CARPETIOFLEXIO_HH
@@ -70,7 +70,7 @@ namespace CarpetIOFlexIO {
int InputVarAs (const cGH* const cgh, const char* const varname,
const char* const alias);
- const char* GetStringParameter (const char* const parametername,
+ static const char* GetStringParameter (const char* const parametername,
const char* const fallback);
int WriteVarAs (const cGH* const cgh, IObase* writer,AMRwriter* amrwriter, int varindex);