aboutsummaryrefslogtreecommitdiff
path: root/CarpetAttic
diff options
context:
space:
mode:
authorcvs_anon <>2003-09-30 11:33:00 +0000
committercvs_anon <>2003-09-30 11:33:00 +0000
commit1c9e8f9a40e2b0146ace6cef2d77ec716f88009e (patch)
tree544a3ce524159545dae156a4862dfee9aa86298f /CarpetAttic
parent5ce91891bcaef1e9db4115659dbe20ab4ba98e64 (diff)
Another update. Fixed minor bugs, found another problem concerning HDF5.
darcs-hash:20030930113319-62b91-5d49edeeb92f9ef9287df8ae3d9a173d0a9ad6e0.gz
Diffstat (limited to 'CarpetAttic')
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc40
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc20
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc34
3 files changed, 59 insertions, 35 deletions
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
index 192167b9f..934e738d1 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
@@ -48,13 +48,11 @@
#include "ioflexio.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.9 2003/09/25 08:38:04 cvs_anon Exp $";
+ 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 $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_checkpointrestart_cc);
}
-
-
namespace CarpetCheckpointRestart {
using namespace std;
@@ -62,7 +60,7 @@ namespace CarpetCheckpointRestart {
using namespace CarpetIOFlexIO;
using namespace CarpetIOFlexIOUtil;
- static int Checkpoint (const cGH* const cgh, int called_from);
+ int Checkpoint (const cGH* const cgh, int called_from);
@@ -100,22 +98,24 @@ namespace CarpetCheckpointRestart {
********************************************************************/
- static int DumpParams (const cGH* const cgh, int all, IObase* writer){
+ int DumpParams (const cGH* const cgh, int all, IObase* writer){
char *parameters;
parameters = IOUtil_GetAllParameters(cgh,all);
-
+
if(parameters)
{
writer->writeAttribute("global_parameters",IObase::Char,
strlen(parameters)+1,parameters);
free(parameters);
}
+ fprintf(stderr,"\nFINISHED WRITING PARAMETERS\n");
return 0;
}
- static int DumpGHExtensions (const cGH* const cgh, IObase* writer){
+
+ int DumpGHExtensions (const cGH* const cgh, IObase* writer){
CCTK_INT4 itmp;
CCTK_REAL dtmp;
@@ -149,7 +149,7 @@ namespace CarpetCheckpointRestart {
}
- static int Checkpoint (const cGH* const cgh, int called_from)
+ int Checkpoint (const cGH* const cgh, int called_from)
{
char cp_filename[1024], cp_tempname[1024];
int myproc, first_vindex, gindex, retval;
@@ -241,11 +241,15 @@ namespace CarpetCheckpointRestart {
}
amrwriter = new AMRwriter(*writer);
+
+
// dump parameters
+ fprintf(stderr,"\nSTARTED WRITING1\n");
DumpParams (cgh, 1, writer);
+ fprintf(stderr,"\nSTARTED WRITING2\n");
// dump GH extentions
DumpGHExtensions(cgh,writer);
-
+ fprintf(stderr,"\nSTARTED WRITING3\n");
}
@@ -261,11 +265,18 @@ namespace CarpetCheckpointRestart {
for (group = CCTK_NumGroups () - 1; group >= 0; group--)
{
/* only dump groups which have storage assigned */
+
if (CCTK_QueryGroupStorageI (cgh, group) <= 0)
{
continue;
}
-
+
+ const int grouptype = CCTK_GroupTypeI(group);
+
+ /* scalars and grid arrays only have 1 reflevel: */
+ if ( (grouptype != CCTK_GF) && (reflevel != 0) )
+ continue;
+
/* get the number of allocated timelevels */
CCTK_GroupData (gindex, &gdata);
gdata.numtimelevels = 0;
@@ -281,7 +292,7 @@ namespace CarpetCheckpointRestart {
int first_vindex = CCTK_FirstVarIndexI (group);
- const int grouptype = CCTK_GroupTypeI(group);
+
/* get the default I/O request for this group */
request = IOUtil_DefaultIORequest (cgh, first_vindex, 1);
@@ -314,12 +325,15 @@ namespace CarpetCheckpointRestart {
free (fullname);
}
// write the var
-
+
+ //#if 1
if (grouptype == CCTK_SCALAR)
{
retval += WriteGS(cgh,writer,request);
}
- else if (grouptype == CCTK_ARRAY || grouptype == CCTK_GF)
+ else
+ //#endif
+ if (grouptype == CCTK_ARRAY || grouptype == CCTK_GF)
//else if (grouptype == CCTK_GF)
{
char* fullname = CCTK_FullName (request->vindex);
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc
index 5380a5fc3..44d16a009 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.8 2003/09/25 08:38:04 cvs_anon Exp $";
+ 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 $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_ioflexio_cc);
}
@@ -154,9 +154,8 @@ namespace CarpetIOFlexIO {
DECLARE_CCTK_PARAMETERS;
-
/* I have got no idea why this stuff below is needed... ask Erik Schnetter */
-
+#warning "this should work now also for scalars - try it!"
const int varindex = request->vindex;
const int group = CCTK_GroupIndexFromVarI (varindex);
@@ -167,8 +166,9 @@ namespace CarpetIOFlexIO {
const int tl = 0;
const int grouptype = CCTK_GroupTypeI(group);
- assert (! ( (grouptype != CCTK_GF && grouptype != CCTK_ARRAY) && reflevel>0));
-
+ assert (! ( (grouptype != CCTK_GF) && reflevel>0));
+ fprintf(stderr,"\nSTARTED WRITING\n");
+
if (CCTK_MyProc(cgh)==0) {
// Set datatype
@@ -179,8 +179,6 @@ namespace CarpetIOFlexIO {
&& CCTK_VarTypeI(varindex) == CCTK_VARIABLE_REAL));
*/
amrwriter->setType (FlexIODataType(CCTK_VarTypeI(varindex)));
- // Set name information
-
@@ -235,19 +233,16 @@ namespace CarpetIOFlexIO {
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 || component !=0)
+ if(reflevel !=0)
return 0;
}
else
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];
@@ -266,6 +261,7 @@ namespace CarpetIOFlexIO {
vect<int,dim> str = ext.stride();
// Ignore ghost zones if desired
+#warning "need to check size of gdyndata.bbox"
for (int d=0; d<dim; ++d) {
const int max_lower_ghosts = (gdyndata.bbox[2*d ] && !out3D_output_outer_boundary) ? -1 : out3D_max_num_lower_ghosts;
const int max_upper_ghosts = (gdyndata.bbox[2*d+1] && !out3D_output_outer_boundary) ? -1 : out3D_max_num_upper_ghosts;
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc
index 8d9af6b5b..750d45e19 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexioUtil.cc
@@ -98,31 +98,38 @@ void DumpCommonAttributes (const cGH *cgh, IObase* writer, ioRequest* request)
char coord_system_name[20];
DECLARE_CCTK_PARAMETERS
- int varindex = request->vindex;
-
/* attributes describing the variable */
- char* groupname = CCTK_GroupNameFromVarI (varindex);
+ char* groupname = CCTK_GroupNameFromVarI (request->vindex);
- //DEBUG
- //CCTK_VInfo (CCTK_THORNSTRING, "DUMPATTRIB reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel);
- writer->writeAttribute("groupname",IObase::Char,strlen(groupname)+1,groupname);
+//
+ char *name = CCTK_FullName (request->vindex);
+ writer->writeAttribute("name",IObase::Char,strlen(name)+1,name);
+ free(name);
+
+ //CCTK_VInfo (CCTK_THORNSTRING, "DUMPATTRIB");
+ //fprintf(stderr,"\nattrib %s\n",groupname);
+ writer->writeAttribute("groupname",IObase::String,strlen(groupname)+1,groupname);
free (groupname);
- CCTK_INT attr_int = CCTK_GroupTypeFromVarI (varindex);
+ CCTK_INT attr_int = CCTK_GroupTypeFromVarI (request->vindex);
writer->writeAttribute("grouptype",FlexIODataType(CCTK_VARIABLE_INT),1,&attr_int);
writer->writeAttribute("reflevel",FlexIODataType(CCTK_VARIABLE_INT),1,&reflevel);
writer->writeAttribute("component",FlexIODataType(CCTK_VARIABLE_INT),1,&component);
writer->writeAttribute("mglevel",FlexIODataType(CCTK_VARIABLE_INT),1,&mglevel);
- attr_int = CCTK_MaxTimeLevelsVI (varindex);
+ attr_int = CCTK_MaxTimeLevelsVI (request->vindex);
writer->writeAttribute("ntimelevels",FlexIODataType(CCTK_VARIABLE_INT),1,&attr_int);
writer->writeAttribute("timelevel",FlexIODataType(CCTK_VARIABLE_INT),1,&request->timelevel);
writer->writeAttribute("global_size",FlexIODataType(CCTK_VARIABLE_INT),request->hdim,request->hsize);
- writer->writeAttribute("time",FlexIODataType(CCTK_VARIABLE_REAL),1,&cgh->cctk_time);
+
+ // 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);
+
/* attributes describing the underlying grid
These are only stored for CCTK_GF variables if they are associated
@@ -132,6 +139,10 @@ void DumpCommonAttributes (const cGH *cgh, IObase* writer, ioRequest* request)
system which is associated with the variable. */
vdim = CCTK_GroupDimFromVarI (request->vindex);
sprintf (coord_system_name, "cart%dd", vdim);
+
+ /* this is already dumped by amrwriter or */
+#if 0
+ /*
if (CCTK_GroupTypeFromVarI (request->vindex) == CCTK_GF &&
CCTK_CoordSystemHandle (coord_system_name) >= 0)
{
@@ -155,8 +166,11 @@ void DumpCommonAttributes (const cGH *cgh, IObase* writer, ioRequest* request)
writer->writeAttribute ("max_ext", FlexIODataType(CCTK_VARIABLE_REAL), vdim, attr_real+vdim);
writer->writeAttribute ("delta", FlexIODataType(CCTK_VARIABLE_REAL), vdim, attr_real+2*vdim);
free (attr_real);
+ }
+ */
+#endif
+
}
-}
} // namespace CarpetIOFlexIOUtil