[cig-commits] commit: Reformat some files

Mercurial hg at geodynamics.org
Fri Feb 25 14:13:26 PST 2011


changeset:   24:bbb880a9ab82
user:        Walter Landry <wlandry at caltech.edu>
date:        Wed Jan 05 14:26:51 2011 -0800
files:       StokesFACOps/computeCompositeResidualOnLevel.C StokesFACOps/xeqScheduleGhostFill.C
description:
Reformat some files


diff -r b111e7f5295b -r bbb880a9ab82 StokesFACOps/computeCompositeResidualOnLevel.C
--- a/StokesFACOps/computeCompositeResidualOnLevel.C	Sun Jan 02 19:52:18 2011 -0800
+++ b/StokesFACOps/computeCompositeResidualOnLevel.C	Wed Jan 05 14:26:51 2011 -0800
@@ -40,168 +40,163 @@
 #include "SAMRAI/xfer/RefineSchedule.h"
 #include "SAMRAI/xfer/PatchLevelFullFillPattern.h"
 
-namespace SAMRAI {
-  namespace solv {
-
-    /*
+/*
 ********************************************************************
 * FACOperatorStrategy virtual                                *
 * computeCompositeResidualOnLevel function                         *
 ********************************************************************
 */
 
-    void StokesFACOps::computeCompositeResidualOnLevel(
-                                                       SAMRAIVectorReal<double>& residual,
-                                                       const SAMRAIVectorReal<double>& solution,
-                                                       const SAMRAIVectorReal<double>& rhs,
-                                                       int ln,
-                                                       bool error_equation_indicator) {
+void SAMRAI::solv::StokesFACOps::computeCompositeResidualOnLevel
+(SAMRAIVectorReal<double>& residual,
+ const SAMRAIVectorReal<double>& solution,
+ const SAMRAIVectorReal<double>& rhs,
+ int ln,
+ bool error_equation_indicator) {
 
-      t_compute_composite_residual->start();
+  t_compute_composite_residual->start();
 
-      checkInputPatchDataIndices();
+  checkInputPatchDataIndices();
 #ifdef DEBUG_CHECK_ASSERTIONS
-      if (residual.getPatchHierarchy() != d_hierarchy
-          || solution.getPatchHierarchy() != d_hierarchy
-          || rhs.getPatchHierarchy() != d_hierarchy) {
-        TBOX_ERROR(d_object_name << ": Vector hierarchy does not match\n"
-                   "internal hierarchy.");
-      }
+  if (residual.getPatchHierarchy() != d_hierarchy
+      || solution.getPatchHierarchy() != d_hierarchy
+      || rhs.getPatchHierarchy() != d_hierarchy) {
+    TBOX_ERROR(d_object_name << ": Vector hierarchy does not match\n"
+               "internal hierarchy.");
+  }
 #endif
-      tbox::Pointer<hier::PatchLevel> level = d_hierarchy->getPatchLevel(ln);
+  tbox::Pointer<hier::PatchLevel> level = d_hierarchy->getPatchLevel(ln);
 
-      /*
-       * Set up the bc helper so that when we use a refine schedule
-       * to fill ghosts, the correct data is operated on.
-       */
-      const int soln_id = solution.getComponentDescriptorIndex(0);
-      d_bc_helper.setTargetDataId(soln_id);
-      d_bc_helper.setHomogeneousBc(error_equation_indicator);
+  /*
+   * Set up the bc helper so that when we use a refine schedule
+   * to fill ghosts, the correct data is operated on.
+   */
+  const int soln_id = solution.getComponentDescriptorIndex(0);
+  d_bc_helper.setTargetDataId(soln_id);
+  d_bc_helper.setHomogeneousBc(error_equation_indicator);
 
-      const int flux_id = (d_flux_id != -1) ? d_flux_id : d_flux_scratch_id;
+  const int flux_id = (d_flux_id != -1) ? d_flux_id : d_flux_scratch_id;
 
-      /*
-       * Assumptions:
-       * 1. Data does not yet exist in ghost boundaries.
-       * 2. Residual data on next finer grid (if any)
-       *    has been computed already.
-       * 3. Flux data from next finer grid (if any) has
-       *    been computed but has not been coarsened to
-       *    this level.
-       *
-       * Steps:
-       * S1. Fill solution ghost data by refinement
-       *     or setting physical boundary conditions.
-       *     This also brings in information from coarser
-       *     to form the composite grid flux.
-       * S2. Compute flux on ln.
-       * S3. If next finer is available,
-       *     Coarsen flux data on next finer level,
-       *     overwriting flux computed from coarse data.
-       * S4. Compute residual data from flux.
-       */
+  /*
+   * Assumptions:
+   * 1. Data does not yet exist in ghost boundaries.
+   * 2. Residual data on next finer grid (if any)
+   *    has been computed already.
+   * 3. Flux data from next finer grid (if any) has
+   *    been computed but has not been coarsened to
+   *    this level.
+   *
+   * Steps:
+   * S1. Fill solution ghost data by refinement
+   *     or setting physical boundary conditions.
+   *     This also brings in information from coarser
+   *     to form the composite grid flux.
+   * S2. Compute flux on ln.
+   * S3. If next finer is available,
+   *     Coarsen flux data on next finer level,
+   *     overwriting flux computed from coarse data.
+   * S4. Compute residual data from flux.
+   */
 
-      /* S1. Fill solution ghost data. */
-      {
-        tbox::Pointer<xfer::RefineSchedule> ln_refine_schedule;
-        if (ln > d_ln_min) {
-          /* Fill from current, next coarser level and physical boundary */
-          xeqScheduleGhostFill(soln_id, ln);
-        } else {
-          /* Fill from current and physical boundary */
-          xeqScheduleGhostFillNoCoarse(soln_id, ln);
-        }
-      }
+  /* S1. Fill solution ghost data. */
+  {
+    tbox::Pointer<xfer::RefineSchedule> ln_refine_schedule;
+    if (ln > d_ln_min) {
+      /* Fill from current, next coarser level and physical boundary */
+      xeqScheduleGhostFill(soln_id, ln);
+    } else {
+      /* Fill from current and physical boundary */
+      abort();
+      // xeqScheduleGhostFillNoCoarse(soln_id, ln);
+    }
+  }
 
-      /*
-       * For the whole level, make sure the internal
-       * side-centered data is allocated and note
-       * whether that data should be deallocated when done.
-       * We do this for the whole level because the data
-       * undergoes transfer operations which require the
-       * whole level data.
-       */
-      bool deallocate_flux_data_when_done = false;
-      if (flux_id == d_flux_scratch_id) {
-        if (!level->checkAllocated(flux_id)) {
-          level->allocatePatchData(flux_id);
-          deallocate_flux_data_when_done = true;
-        }
-      }
+  /*
+   * For the whole level, make sure the internal
+   * side-centered data is allocated and note
+   * whether that data should be deallocated when done.
+   * We do this for the whole level because the data
+   * undergoes transfer operations which require the
+   * whole level data.
+   */
+  bool deallocate_flux_data_when_done = false;
+  if (flux_id == d_flux_scratch_id) {
+    if (!level->checkAllocated(flux_id)) {
+      level->allocatePatchData(flux_id);
+      deallocate_flux_data_when_done = true;
+    }
+  }
 
-      /*
-       * S2. Compute flux on patches in level.
-       */
-      for (hier::PatchLevel::Iterator pi(*level); pi; pi++) {
-        tbox::Pointer<hier::Patch> patch = *pi;
+  /*
+   * S2. Compute flux on patches in level.
+   */
+  for (hier::PatchLevel::Iterator pi(*level); pi; pi++) {
+    tbox::Pointer<hier::Patch> patch = *pi;
 
-        tbox::Pointer<pdat::CellData<double> >
-          soln_data = solution.getComponentPatchData(0, *patch);
-        tbox::Pointer<pdat::CellData<double> >
-          rhs_data = rhs.getComponentPatchData(0, *patch);
-        tbox::Pointer<pdat::CellData<double> >
-          residual_data = residual.getComponentPatchData(0, *patch);
-        tbox::Pointer<pdat::SideData<double> >
-          flux_data = patch->getPatchData(flux_id);
-        computeFluxOnPatch(
-                           *patch,
-                           level->getRatioToCoarserLevel(),
-                           *soln_data,
-                           *flux_data);
-
-      }
-
-      /*
-       * S3. Coarsen oflux data from next finer level so that
-       * the computed flux becomes the composite grid flux.
-       */
-      if (ln < d_ln_max) {
-        xeqScheduleFluxCoarsen(flux_id, d_oflux_scratch_id, ln);
-      }
-
-      /*
-       * S4. Compute residual on patches in level.
-       */
-      for (hier::PatchLevel::Iterator pi(*level); pi; pi++) {
-        tbox::Pointer<hier::Patch> patch = *pi;
-        tbox::Pointer<pdat::CellData<double> >
-          soln_data = solution.getComponentPatchData(0, *patch);
-        tbox::Pointer<pdat::CellData<double> >
-          rhs_data = rhs.getComponentPatchData(0, *patch);
-        tbox::Pointer<pdat::CellData<double> >
-          residual_data = residual.getComponentPatchData(0, *patch);
-        tbox::Pointer<pdat::SideData<double> >
-          flux_data = patch->getPatchData(flux_id);
-        computeResidualOnPatch(*patch,
-                               *flux_data,
-                               *soln_data,
-                               *rhs_data,
-                               *residual_data);
-
-        if (ln > d_ln_min) {
-          /*
-           * Save outerflux data so that next coarser level
-           *  can compute its coarse-fine composite flux.
-           *  This is not strictly needed in this "compute residual"
-           *  loop through the patches, but we put it here to
-           *  avoid writing another loop for it.
-           */
-          tbox::Pointer<pdat::OutersideData<double> >
-            oflux_data = patch->getPatchData(d_oflux_scratch_id);
-
-          TBOX_ASSERT(oflux_data);
-
-          oflux_data->copy(*flux_data);
-        }
-      }
-
-      if (deallocate_flux_data_when_done) {
-        level->deallocatePatchData(flux_id);
-      }
-
-      t_compute_composite_residual->stop();
-    }
+    tbox::Pointer<pdat::CellData<double> >
+      soln_data = solution.getComponentPatchData(0, *patch);
+    tbox::Pointer<pdat::CellData<double> >
+      rhs_data = rhs.getComponentPatchData(0, *patch);
+    tbox::Pointer<pdat::CellData<double> >
+      residual_data = residual.getComponentPatchData(0, *patch);
+    tbox::Pointer<pdat::SideData<double> >
+      flux_data = patch->getPatchData(flux_id);
+    computeFluxOnPatch(
+                       *patch,
+                       level->getRatioToCoarserLevel(),
+                       *soln_data,
+                       *flux_data);
 
   }
+
+  /*
+   * S3. Coarsen oflux data from next finer level so that
+   * the computed flux becomes the composite grid flux.
+   */
+  if (ln < d_ln_max) {
+    xeqScheduleFluxCoarsen(flux_id, d_oflux_scratch_id, ln);
+  }
+
+  /*
+   * S4. Compute residual on patches in level.
+   */
+  for (hier::PatchLevel::Iterator pi(*level); pi; pi++) {
+    tbox::Pointer<hier::Patch> patch = *pi;
+    tbox::Pointer<pdat::CellData<double> >
+      soln_data = solution.getComponentPatchData(0, *patch);
+    tbox::Pointer<pdat::CellData<double> >
+      rhs_data = rhs.getComponentPatchData(0, *patch);
+    tbox::Pointer<pdat::CellData<double> >
+      residual_data = residual.getComponentPatchData(0, *patch);
+    tbox::Pointer<pdat::SideData<double> >
+      flux_data = patch->getPatchData(flux_id);
+    computeResidualOnPatch(*patch,
+                           *flux_data,
+                           *soln_data,
+                           *rhs_data,
+                           *residual_data);
+
+    if (ln > d_ln_min) {
+      /*
+       * Save outerflux data so that next coarser level
+       *  can compute its coarse-fine composite flux.
+       *  This is not strictly needed in this "compute residual"
+       *  loop through the patches, but we put it here to
+       *  avoid writing another loop for it.
+       */
+      tbox::Pointer<pdat::OutersideData<double> >
+        oflux_data = patch->getPatchData(d_oflux_scratch_id);
+
+      TBOX_ASSERT(oflux_data);
+
+      oflux_data->copy(*flux_data);
+    }
+  }
+
+  if (deallocate_flux_data_when_done) {
+    level->deallocatePatchData(flux_id);
+  }
+
+  t_compute_composite_residual->stop();
 }
 
diff -r b111e7f5295b -r bbb880a9ab82 StokesFACOps/xeqScheduleGhostFill.C
--- a/StokesFACOps/xeqScheduleGhostFill.C	Sun Jan 02 19:52:18 2011 -0800
+++ b/StokesFACOps/xeqScheduleGhostFill.C	Wed Jan 05 14:26:51 2011 -0800
@@ -40,29 +40,21 @@
 #include "SAMRAI/xfer/RefineSchedule.h"
 #include "SAMRAI/xfer/PatchLevelFullFillPattern.h"
 
-namespace SAMRAI {
-  namespace solv {
-
-    void
-    StokesFACOps::xeqScheduleGhostFill(
-                                       int dst_id,
-                                       int dest_ln)
-    {
-      if (!d_ghostfill_refine_schedules[dest_ln]) {
-        TBOX_ERROR("Expected schedule not found.");
-      }
-      xfer::RefineAlgorithm refiner(d_dim);
-      refiner.
-        registerRefine(dst_id,
-                       dst_id,
-                       dst_id,
-                       d_ghostfill_refine_operator);
-      refiner.
-        resetSchedule(d_ghostfill_refine_schedules[dest_ln]);
-      d_ghostfill_refine_schedules[dest_ln]->fillData(0.0);
-      d_ghostfill_refine_algorithm->
-        resetSchedule(d_ghostfill_refine_schedules[dest_ln]);
-    }
-
+void SAMRAI::solv::StokesFACOps::xeqScheduleGhostFill(int dst_id,
+                                                      int dest_ln)
+{
+  if (!d_ghostfill_refine_schedules[dest_ln]) {
+    TBOX_ERROR("Expected schedule not found.");
   }
+  xfer::RefineAlgorithm refiner(d_dim);
+  refiner.
+    registerRefine(dst_id,
+                   dst_id,
+                   dst_id,
+                   d_ghostfill_refine_operator);
+  refiner.
+    resetSchedule(d_ghostfill_refine_schedules[dest_ln]);
+  d_ghostfill_refine_schedules[dest_ln]->fillData(0.0);
+  d_ghostfill_refine_algorithm->
+    resetSchedule(d_ghostfill_refine_schedules[dest_ln]);
 }



More information about the CIG-COMMITS mailing list