aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOASCII/src
diff options
context:
space:
mode:
authorschnetter <>2001-07-04 10:29:00 +0000
committerschnetter <>2001-07-04 10:29:00 +0000
commitf1aa84c14ac110f5802603b4bf9ceb7923c5b471 (patch)
tree6a45cd17c5c96c90307302e699f521d2c80bd79f /Carpet/CarpetIOASCII/src
parente1cce75b6dc96e7c88ccebff3ee4e03e8fdfc28e (diff)
Broke the file "carpet.cc" into several files.
Broke the file "carpet.cc" into several files. Simplified support for arrays with a dimension different from 3. Added a testing thorn. darcs-hash:20010704102946-07bb3-82132f0c643e91f0de33bbaef93f9c693ce7227f.gz
Diffstat (limited to 'Carpet/CarpetIOASCII/src')
-rw-r--r--Carpet/CarpetIOASCII/src/ioascii.cc288
1 files changed, 84 insertions, 204 deletions
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc
index 674bf9361..348c81630 100644
--- a/Carpet/CarpetIOASCII/src/ioascii.cc
+++ b/Carpet/CarpetIOASCII/src/ioascii.cc
@@ -24,7 +24,7 @@
#include "ioascii.hh"
-static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.13 2001/07/02 13:22:10 schnetter Exp $";
+static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.14 2001/07/04 12:29:49 schnetter Exp $";
@@ -253,229 +253,109 @@ int CarpetIOASCII<outdim>
}
}
- switch (CCTK_GroupDimI(group)) {
-
- case 1: {
- const int dim=1;
-
- // Find the output offset
- vect<int,dim> offset(0);
- switch (outdim) {
- case 1:
- // The offset doesn't matter in this case
+ assert (outdim <= CCTK_GroupDimI(group));
+
+ // Find the output offset
+ vect<int,dim> offset(0);
+ switch (outdim) {
+ case 1:
+ switch (dirs[0]) {
+ case 0:
+ offset[1] = GetGridOffset (cgh, 2,
+ "out%dD_xline_yi", "out_xline_yi",
+ "out%dD_xline_y", "out_xline_y",
+ out_xline_y);
+ offset[2] = GetGridOffset (cgh, 3,
+ "out%dD_xline_zi", "out_xline_zi",
+ "out%dD_xline_z", "out_xline_z",
+ out_xline_z);
break;
- default:
- abort();
- }
-
- // Traverse all components on this refinement and
- // multigrid level
- BEGIN_COMPONENT_LOOP(cgh) {
-
- generic_gf<dim>* ff = 0;
-
- switch (CCTK_GroupTypeI(group)) {
-
- case CCTK_ARRAY:
- assert (var < (int)arrdata[group].data.size());
- ff = (generic_gf<dim>*)arrdata[group].data[var];
- break;
-
- case CCTK_GF:
- assert (var < (int)gfdata[group].data.size());
- ff = (generic_gf<dim>*)gfdata[group].data[var];
- break;
-
- default:
- abort();
- }
-
- const generic_data<dim>* const data
- = (*ff) (tl, reflevel, component, mglevel);
- const bbox<int,dim> ext = data->extent();
- const vect<int,dim> offset1 = offset * ext.stride();
-
- data->write_ascii (filename, cgh->cctk_iteration, offset1, dirs,
- tl, reflevel, component, mglevel);
-
- } END_COMPONENT_LOOP(cgh);
- break;
- }
-
- case 2: {
- const int dim=2;
-
- // Find the output offset
- vect<int,dim> offset(0);
- switch (outdim) {
case 1:
- switch (dirs[0]) {
- case 0:
- offset[1] = GetGridOffset (cgh, 2,
- "out%dD_xline_yi", "out_xline_yi",
- "out%dD_xline_y", "out_xline_y",
- out_xline_y);
- break;
- case 1:
- offset[0] = GetGridOffset (cgh, 1,
- "out%dD_yline_xi", "out_yline_xi",
- "out%dD_yline_x", "out_yline_x",
- out_yline_x);
- break;
- default:
- abort();
- }
+ offset[0] = GetGridOffset (cgh, 1,
+ "out%dD_yline_xi", "out_yline_xi",
+ "out%dD_yline_x", "out_yline_x",
+ out_yline_x);
+ offset[2] = GetGridOffset (cgh, 3,
+ "out%dD_yline_zi", "out_yline_zi",
+ "out%dD_yline_z", "out_yline_z",
+ out_yline_z);
break;
case 2:
- // The offset doesn't matter in this case
+ offset[0] = GetGridOffset (cgh, 1,
+ "out%dD_zline_xi", "out_zline_xi",
+ "out%dD_zline_x", "out_zline_x",
+ out_zline_x);
+ offset[1] = GetGridOffset (cgh, 2,
+ "out%dD_zline_yi", "out_zline_yi",
+ "out%dD_zline_y", "out_zline_y",
+ out_zline_y);
break;
default:
abort();
}
-
- // Traverse all components on this refinement and
- // multigrid level
- BEGIN_COMPONENT_LOOP(cgh) {
-
- generic_gf<dim>* ff = 0;
-
- switch (CCTK_GroupTypeI(group)) {
-
- case CCTK_ARRAY:
- assert (var < (int)arrdata[group].data.size());
- ff = (generic_gf<dim>*)arrdata[group].data[var];
- break;
-
- case CCTK_GF:
- assert (var < (int)gfdata[group].data.size());
- ff = (generic_gf<dim>*)gfdata[group].data[var];
- break;
-
- default:
- abort();
- }
-
- const generic_data<dim>* const data
- = (*ff) (tl, reflevel, component, mglevel);
- const bbox<int,dim> ext = data->extent();
- const vect<int,dim> offset1 = offset * ext.stride();
-
- data->write_ascii (filename, cgh->cctk_iteration, offset1, dirs,
- tl, reflevel, component, mglevel);
-
- } END_COMPONENT_LOOP(cgh);
break;
+ case 2:
+ if (dirs[0]==0 && dirs[1]==1) {
+ offset[2] = GetGridOffset
+ (cgh, 3,
+ "out%dD_xyplane_zi", "out_xyplane_zi",
+ "out%dD_xyplane_z", "out_xyplane_z",
+ out_xyplane_z);
+ } else if (dirs[0]==0 && dirs[1]==2) {
+ offset[1] = GetGridOffset
+ (cgh, 2,
+ "out%dD_xzplane_yi", "out_xzplane_yi",
+ "out%dD_xzplane_y", "out_xzplane_y",
+ out_xzplane_y);
+ } else if (dirs[0]==1 && dirs[1]==2) {
+ offset[0] = GetGridOffset
+ (cgh, 1,
+ "out%dD_yzplane_xi", "out_yzplane_xi",
+ "out%dD_yzplane_x", "out_yzplane_x",
+ out_yzplane_x);
+ } else {
+ abort();
+ }
+ break;
+ case 3:
+ // The offset doesn't matter in this case
+ break;
+ default:
+ abort();
}
+
+ // Traverse all components on this refinement and
+ // multigrid level
+ BEGIN_COMPONENT_LOOP(cgh) {
- case 3: {
- const int dim=3;
+ generic_gf<dim>* ff = 0;
- // Find the output offset
- vect<int,dim> offset(0);
- switch (outdim) {
- case 1:
- switch (dirs[0]) {
- case 0:
- offset[1] = GetGridOffset (cgh, 2,
- "out%dD_xline_yi", "out_xline_yi",
- "out%dD_xline_y", "out_xline_y",
- out_xline_y);
- offset[2] = GetGridOffset (cgh, 3,
- "out%dD_xline_zi", "out_xline_zi",
- "out%dD_xline_z", "out_xline_z",
- out_xline_z);
- break;
- case 1:
- offset[0] = GetGridOffset (cgh, 1,
- "out%dD_yline_xi", "out_yline_xi",
- "out%dD_yline_x", "out_yline_x",
- out_yline_x);
- offset[2] = GetGridOffset (cgh, 3,
- "out%dD_yline_zi", "out_yline_zi",
- "out%dD_yline_z", "out_yline_z",
- out_yline_z);
- break;
- case 2:
- offset[0] = GetGridOffset (cgh, 1,
- "out%dD_zline_xi", "out_zline_xi",
- "out%dD_zline_x", "out_zline_x",
- out_zline_x);
- offset[1] = GetGridOffset (cgh, 2,
- "out%dD_zline_yi", "out_zline_yi",
- "out%dD_zline_y", "out_zline_y",
- out_zline_y);
- break;
- default:
- abort();
- }
- break;
- case 2:
- if (dirs[0]==0 && dirs[1]==1) {
- offset[2] = GetGridOffset
- (cgh, 3,
- "out%dD_xyplane_zi", "out_xyplane_zi",
- "out%dD_xyplane_z", "out_xyplane_z",
- out_xyplane_z);
- } else if (dirs[0]==0 && dirs[1]==2) {
- offset[1] = GetGridOffset
- (cgh, 2,
- "out%dD_xzplane_yi", "out_xzplane_yi",
- "out%dD_xzplane_y", "out_xzplane_y",
- out_xzplane_y);
- } else if (dirs[0]==1 && dirs[1]==2) {
- offset[0] = GetGridOffset
- (cgh, 1,
- "out%dD_yzplane_xi", "out_yzplane_xi",
- "out%dD_yzplane_x", "out_yzplane_x",
- out_yzplane_x);
- } else {
- abort();
- }
+ switch (CCTK_GroupTypeI(group)) {
+
+ case CCTK_ARRAY:
+ assert (var < (int)arrdata[group].data.size());
+ ff = (generic_gf<dim>*)arrdata[group].data[var];
break;
- case 3:
- // The offset doesn't matter in this case
+
+ case CCTK_GF:
+ assert (var < (int)gfdata[group].data.size());
+ ff = (generic_gf<dim>*)gfdata[group].data[var];
break;
+
default:
abort();
}
- // Traverse all components on this refinement and
- // multigrid level
- BEGIN_COMPONENT_LOOP(cgh) {
-
- generic_gf<dim>* ff = 0;
-
- switch (CCTK_GroupTypeI(group)) {
-
- case CCTK_ARRAY:
- assert (var < (int)arrdata[group].data.size());
- ff = (generic_gf<dim>*)arrdata[group].data[var];
- break;
-
- case CCTK_GF:
- assert (var < (int)gfdata[group].data.size());
- ff = (generic_gf<dim>*)gfdata[group].data[var];
- break;
-
- default:
- abort();
- }
-
- const generic_data<dim>* const data
- = (*ff) (tl, reflevel, component, mglevel);
- const bbox<int,dim> ext = data->extent();
- const vect<int,dim> offset1 = offset * ext.stride();
-
- data->write_ascii (filename, cgh->cctk_iteration, offset1, dirs,
- tl, reflevel, component, mglevel);
-
- } END_COMPONENT_LOOP(cgh);
- break;
- }
+ const generic_data<dim>* const data
+ = (*ff) (tl, reflevel, component, mglevel);
+ const bbox<int,dim> ext = data->extent();
+ const vect<int,dim> offset1 = offset * ext.stride();
- default: abort();
+ data->write_ascii (filename, cgh->cctk_iteration, offset1, dirs,
+ tl, reflevel, component, mglevel);
- } // switch (CCTK_GroupDimI(group))
+ } END_COMPONENT_LOOP(cgh);
+ break;
// Append EOL after every complete set of components
if (CCTK_MyProc(cgh)==0) {