aboutsummaryrefslogtreecommitdiff
path: root/CarpetAttic
diff options
context:
space:
mode:
authorcvs_anon <>2003-10-02 09:34:00 +0000
committercvs_anon <>2003-10-02 09:34:00 +0000
commit18a88466319276ac198f10d99df92212ceb86967 (patch)
tree0c7a9d1c8915da03e82f5cb7b638de253f69f1a5 /CarpetAttic
parent1c9e8f9a40e2b0146ace6cef2d77ec716f88009e (diff)
Writing Checkpoint files works now, but requires some small changes to Carpet/Carpet/src/Evolve.cc.
darcs-hash:20031002093403-62b91-40b3a80a6c90098980848decc15a2aec8d7fd5cc.gz
Diffstat (limited to 'CarpetAttic')
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl22
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc39
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc23
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh4
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc5
5 files changed, 52 insertions, 41 deletions
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl b/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl
index 2bbd226de..079ebb72c 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl
@@ -1,24 +1,19 @@
# Parameter definitions for thorn CarpetIOFlexIO
-# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl,v 1.2 2003/09/17 13:47:00 cvs_anon Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/param.ccl,v 1.3 2003/10/02 11:34:03 cvs_anon Exp $
-shares: IO
-
-USES STRING out_dir
+#shares: IO
+#shares: Carpet
-USES CCTK_INT out_every
private:
-
-
-#BOOLEAN verbose "Produce log output"
-#{
-#} "no"
-
+BOOLEAN verbose "verbose info output"
+{
+} "no"
CCTK_STRING out3D_dir "Name of 3D FlexIO output directory, overrides out_dir" STEERABLE = ALWAYS
@@ -107,4 +102,7 @@ USES BOOLEAN recover_and_remove
USES BOOLEAN checkpoint_on_terminate
USES KEYWORD recover
USES STRING recover_file
-USES KEYWORD verbose
+USES STRING out_dir
+USES CCTK_INT out_every
+
+
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
index 934e738d1..fdd91c5c9 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
@@ -48,7 +48,7 @@
#include "ioflexio.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.10 2003/09/30 13:33:19 cvs_anon Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.11 2003/10/02 11:34:03 cvs_anon Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_checkpointrestart_cc);
}
@@ -69,12 +69,11 @@ namespace CarpetCheckpointRestart {
DECLARE_CCTK_PARAMETERS
- CCTK_VInfo (CCTK_THORNSTRING, "CHECKPOINT? cgh->cctk_iteration %d, cgh->cctk_iteration mod checkpoint_every = %d, checkpoint = %d, checkpoint_next = %d", cgh->cctk_iteration, cgh->cctk_iteration % checkpoint_every,checkpoint,checkpoint_next);
if (checkpoint &&
((checkpoint_every > 0 && cgh->cctk_iteration % checkpoint_every == 0) ||
checkpoint_next))
{
- if (! CCTK_Equals ("verbose", "none"))
+ if (verbose)
{
CCTK_INFO ("---------------------------------------------------------");
CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint at "
@@ -110,7 +109,7 @@ namespace CarpetCheckpointRestart {
strlen(parameters)+1,parameters);
free(parameters);
}
- fprintf(stderr,"\nFINISHED WRITING PARAMETERS\n");
+
return 0;
}
@@ -170,7 +169,6 @@ namespace CarpetCheckpointRestart {
ioRequest *request;
DECLARE_CCTK_PARAMETERS
- // CCTK_VInfo (CCTK_THORNSTRING, "boguscheck reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
CarpetIOFlexIOGH *myGH;
myGH = (CarpetIOFlexIOGH *) CCTK_GHExtension (cgh, "CarpetIOFlexIO");
@@ -206,12 +204,14 @@ namespace CarpetCheckpointRestart {
}
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"))
+ if (verbose)
{
CCTK_VInfo (CCTK_THORNSTRING, "Creating temporary checkpoint file '%s'", cp_tempname);
}
@@ -239,17 +239,24 @@ namespace CarpetCheckpointRestart {
cp_tempname);
return (-1);
}
+
amrwriter = new AMRwriter(*writer);
+ /* now we are writing a first (bogus) dataset to which
+ we will attach all parameters and GHextensions as Attributes
+ */
+
+ CCTK_REAL startdata = 666.66;
+ writer->write(FLEXIO_REAL,0,0,&startdata);
-
- // dump parameters
- fprintf(stderr,"\nSTARTED WRITING1\n");
+
+ /* now dump parameters */
DumpParams (cgh, 1, writer);
- fprintf(stderr,"\nSTARTED WRITING2\n");
- // dump GH extentions
+
+
+ /* and now dump GH extentions */
DumpGHExtensions(cgh,writer);
- fprintf(stderr,"\nSTARTED WRITING3\n");
+
}
@@ -258,7 +265,7 @@ namespace CarpetCheckpointRestart {
BEGIN_MGLEVEL_LOOP(cgh) {
- if (CCTK_Equals ("verbose", "full"))
+ if (verbose)
{
CCTK_INFO ("Dumping Grid Variables ...");
}
@@ -329,7 +336,8 @@ namespace CarpetCheckpointRestart {
//#if 1
if (grouptype == CCTK_SCALAR)
{
- retval += WriteGS(cgh,writer,request);
+ // retval += WriteGS(cgh,writer,request);
+ retval += WriteGF(cgh,writer,amrwriter,request);
}
else
//#endif
@@ -337,7 +345,8 @@ namespace CarpetCheckpointRestart {
//else if (grouptype == CCTK_GF)
{
char* fullname = CCTK_FullName (request->vindex);
- CCTK_VInfo (CCTK_THORNSTRING,"%s:: reflevel: %d component: %d grouptype: %d ",fullname,reflevel,component,grouptype);
+ if (verbose)
+ CCTK_VInfo (CCTK_THORNSTRING,"%s:: reflevel: %d component: %d grouptype: %d ",fullname,reflevel,component,grouptype);
free(fullname);
retval += WriteGF(cgh,writer,amrwriter,request);
}
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
index 44d16a009..21b3b26ad 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
@@ -45,7 +45,7 @@
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc,v 1.9 2003/09/30 13:33:19 cvs_anon Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc,v 1.10 2003/10/02 11:34:03 cvs_anon Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_ioflexio_cc);
}
@@ -167,7 +167,7 @@ namespace CarpetIOFlexIO {
const int grouptype = CCTK_GroupTypeI(group);
assert (! ( (grouptype != CCTK_GF) && reflevel>0));
- fprintf(stderr,"\nSTARTED WRITING\n");
+
if (CCTK_MyProc(cgh)==0) {
@@ -230,18 +230,18 @@ namespace CarpetIOFlexIO {
BEGIN_COMPONENT_LOOP(cgh, grouptype) {
const ggf<dim>* ff = 0;
-
-
+#if 0
if (grouptype == CCTK_ARRAY){
-#warning "additional if outside component loop"
// this is a DIRTY hack to fix problems caused by the fact that I am to lazy to write a more
// general output routine...
- CCTK_VInfo (CCTK_THORNSTRING, "ARRAY reflevel: %d component: %d grouptype: %d ",reflevel,component,grouptype);
if(reflevel !=0)
return 0;
}
else
- CCTK_VInfo (CCTK_THORNSTRING, "GF reflevel: %d component: %d grouptype: %d",reflevel,component,grouptype);
+#endif
+
+ if (verbose) CCTK_VInfo (CCTK_THORNSTRING, "GF reflevel: %d component: %d grouptype: %d",reflevel,component,grouptype);
+
assert (var < (int)arrdata[group].data.size());
ff = (ggf<dim>*)arrdata[group].data[var];
@@ -310,7 +310,7 @@ namespace CarpetIOFlexIO {
int WriteGS (const cGH* const cgh, IObase* writer, ioRequest* request)
{
-
+#warning This function should be obsolete by now!!!
// writes out a grid scalar
DECLARE_CCTK_PARAMETERS;
@@ -381,8 +381,9 @@ namespace CarpetIOFlexIO {
// same on all components. in fact, the loop is not being
// executed for scalars; see macro definition.
+ if (verbose)
+ CCTK_VInfo (CCTK_THORNSTRING, "SCALAR reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
- CCTK_VInfo (CCTK_THORNSTRING, "SCALAR reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
writer->write(FlexIODataType(CCTK_VarTypeI(varindex)),1,&dim,buffer);
/* scalars have size 0 */
request->hsize[0] = 0;
@@ -400,7 +401,6 @@ 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);
@@ -609,7 +609,8 @@ namespace CarpetIOFlexIO {
assert (n0>=0 && n0<CCTK_NumVars());
const int var = n - n0;
assert (var>=0 && var<CCTK_NumVars());
- const int tl = 0;
+ const int tl = 0; // CCTK_VInfo (CCTK_THORNSTRING, "boguscheck reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
+
// Check for storage
if (! CCTK_QueryGroupStorageI(cgh, group)) {
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh
index 5719ef0f6..9bd9d2c40 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.5 2003/09/25 08:38:04 cvs_anon Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.hh,v 1.6 2003/10/02 11:34:03 cvs_anon Exp $
#ifndef CARPETIOFLEXIO_HH
#define CARPETIOFLEXIO_HH
@@ -78,7 +78,7 @@ namespace CarpetIOFlexIO {
static const char* GetStringParameter (const char* const parametername,
const char* const fallback);
- int WriteGF (const cGH* const cgh, IObase* writer,AMRwriter* amrwriter, ioRequest* request);
+ int WriteGF (const cGH* const cgh, IObase* writer, AMRwriter* amrwriter, ioRequest* request);
int WriteGS (const cGH* const cgh, IObase* writer, ioRequest* request);
} // namespace CarpetIOFlexIO
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc
index 750d45e19..0dfb0f7cb 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc
@@ -126,10 +126,13 @@ void DumpCommonAttributes (const cGH *cgh, IObase* writer, ioRequest* request)
writer->writeAttribute("global_size",FlexIODataType(CCTK_VARIABLE_INT),request->hdim,request->hsize);
+
+#if 0
// already dumped by amrwriter if we are dealing with a grid function or a grid array:
+
if (CCTK_GroupTypeFromVarI (request->vindex) == CCTK_SCALAR)
writer->writeAttribute("time",FlexIODataType(CCTK_VARIABLE_REAL),1,&cgh->cctk_time);
-
+#endif
/* attributes describing the underlying grid
These are only stored for CCTK_GF variables if they are associated