From 114dcd70006baa4151e7848eb14646f8860779cc Mon Sep 17 00:00:00 2001 From: cvs_anon <> Date: Wed, 17 Sep 2003 11:47:00 +0000 Subject: Messed around with this. Still not working. Ran into Carpet problems.[_^?_] Asking Erik&Ian darcs-hash:20030917114700-62b91-94be58492a57149b904308dba06069a97daa3be1.gz --- .../CarpetIOFlexIOCheckpoint/src/ioflexio.cc | 65 ++++++++++++---------- 1 file changed, 37 insertions(+), 28 deletions(-) (limited to 'CarpetAttic/CarpetIOFlexIOCheckpoint/src/ioflexio.cc') 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 do_truncate; vector > 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 && var0)); + 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* ff = 0; - + + assert (var < (int)arrdata[group].data.size()); ff = (ggf*)arrdata[group].data[var]; + CCTK_VInfo (CCTK_THORNSTRING, "bogus reflevel,component,mglevel %d,%d,%d",reflevel,component,mglevel); const gdata* const data = (*ff) (tl, reflevel, component, mglevel); - + CCTK_VInfo (CCTK_THORNSTRING, "bogus2"); + // Make temporary copy on processor 0 bbox ext = data->extent(); vect lo = ext.lower(); vect hi = ext.upper(); vect str = ext.stride(); + + // Ignore ghost zones if desired for (int d=0; d* 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 && n0) 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*)arrdata[group].data[var]; - gdata* const data = (*ff) (tl, reflevel, component, mglevel); + gdata* const data = (*ff) (tl, rl, component, mglevel); // Create temporary data storage on processor 0 const vect str = vect(reflevelfact); const vect lb = vect(amr_origin) * str; - const vect ub = lb + (vect(amr_dims) - 1) * str; + const vect ub + = lb + (vect(amr_dims) - 1) * str; const bbox ext(lb,ub,str); gdata* 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 - - - -- cgit v1.2.3