[cig-commits] commit: Rename d_comp_soln_id etc. to p_id
Mercurial
hg at geodynamics.org
Fri Feb 25 14:12:24 PST 2011
changeset: 6:f0902491f490
user: Walter Landry <wlandry at caltech.edu>
date: Fri Dec 31 07:18:40 2010 -0800
files: FACStokes.C FACStokes.h
description:
Rename d_comp_soln_id etc. to p_id
diff -r fe9d63509c19 -r f0902491f490 FACStokes.C
--- a/FACStokes.C Fri Dec 31 07:12:28 2010 -0800
+++ b/FACStokes.C Fri Dec 31 07:18:40 2010 -0800
@@ -88,7 +88,7 @@ FACStokes::FACStokes(
tbox::Pointer<pdat::CellVariable<double> > comp_soln(
new pdat::CellVariable<double>(dim, object_name + ":computed solution", 1));
- d_comp_soln_id =
+ p_id =
vdb->registerVariableAndContext(
comp_soln,
d_context,
@@ -96,7 +96,7 @@ FACStokes::FACStokes(
tbox::Pointer<pdat::CellVariable<double> > exact_solution(
new pdat::CellVariable<double>(dim, object_name + ":exact solution"));
- d_exact_id =
+ p_exact_id =
vdb->registerVariableAndContext(
exact_solution,
d_context,
@@ -107,7 +107,7 @@ FACStokes::FACStokes(
dim,
object_name
+ ":linear system right hand side"));
- d_rhs_id =
+ p_rhs_id =
vdb->registerVariableAndContext(
rhs_variable,
d_context,
@@ -161,9 +161,9 @@ void FACStokes::initializeLevelData(
hierarchy->getPatchLevel(level_number);
if (allocate_data) {
- level->allocatePatchData(d_comp_soln_id);
- level->allocatePatchData(d_rhs_id);
- level->allocatePatchData(d_exact_id);
+ level->allocatePatchData(p_id);
+ level->allocatePatchData(p_rhs_id);
+ level->allocatePatchData(p_exact_id);
}
/*
@@ -182,9 +182,9 @@ void FACStokes::initializeLevelData(
patch->getPatchGeometry();
tbox::Pointer<pdat::CellData<double> > exact_data =
- patch->getPatchData(d_exact_id);
+ patch->getPatchData(p_exact_id);
tbox::Pointer<pdat::CellData<double> > rhs_data =
- patch->getPatchData(d_rhs_id);
+ patch->getPatchData(p_rhs_id);
/*
* Set source function and exact solution.
@@ -257,7 +257,7 @@ int FACStokes::solveStokes()
for ( ; ip; ip++) {
tbox::Pointer<hier::Patch> patch = *ip;
tbox::Pointer<pdat::CellData<double> > data = patch->getPatchData(
- d_comp_soln_id);
+ p_id);
data->fill(0.0);
}
}
@@ -273,16 +273,16 @@ int FACStokes::solveStokes()
d_stokes_fac_solver.setCConstant(0.0);
d_stokes_fac_solver.initializeSolverState(
- d_comp_soln_id,
- d_rhs_id,
+ p_id,
+ p_rhs_id,
d_hierarchy,
0,
d_hierarchy->getFinestLevelNumber());
tbox::plog << "solving..." << std::endl;
int solver_ret;
- solver_ret = d_stokes_fac_solver.solveSystem(d_comp_soln_id,
- d_rhs_id);
+ solver_ret = d_stokes_fac_solver.solveSystem(p_id,
+ p_rhs_id);
/*
* Present data on the solve.
*/
@@ -319,16 +319,16 @@ int FACStokes::setupPlotter(
}
plotter.registerPlotQuantity("Computed solution",
"SCALAR",
- d_comp_soln_id);
+ p_id);
plotter.registerDerivedPlotQuantity("Error",
"SCALAR",
(appu::VisDerivedDataStrategy *)this);
plotter.registerPlotQuantity("Exact solution",
"SCALAR",
- d_exact_id);
+ p_exact_id);
plotter.registerPlotQuantity("Stokes source",
"SCALAR",
- d_rhs_id);
+ p_rhs_id);
return 0;
}
@@ -352,9 +352,9 @@ bool FACStokes::packDerivedDataIntoDoubl
if (variable_name == "Error") {
tbox::Pointer<pdat::CellData<double> > current_solution_ =
- patch.getPatchData(d_comp_soln_id);
+ patch.getPatchData(p_id);
tbox::Pointer<pdat::CellData<double> > exact_solution_ =
- patch.getPatchData(d_exact_id);
+ patch.getPatchData(p_exact_id);
pdat::CellData<double>& current_solution = *current_solution_;
pdat::CellData<double>& exact_solution = *exact_solution_;
for ( ; icell; icell++) {
diff -r fe9d63509c19 -r f0902491f490 FACStokes.h
--- a/FACStokes.h Fri Dec 31 07:12:28 2010 -0800
+++ b/FACStokes.h Fri Dec 31 07:18:40 2010 -0800
@@ -27,184 +27,157 @@
namespace SAMRAI {
-/*!
- * @brief Class to solve a sample Stokes equation on a SAMR grid.
- *
- * This class demonstrates how use the FAC Stokes solver
- * class to solve Stokes's equation on a single level
- * within a hierarchy.
- *
- * We set up and solve the following problem:
- *
- * 2d: div(grad(u)) = -2 (pi^2) sin(pi x) sin(pi y)
- *
- * 3d: div(grad(u)) = -3 (pi^2) sin(pi x) sin(pi y) sin(pi z)
- *
- * which has the exact solution
- *
- * 2d: u = sin(pi x) sin(pi y)
- *
- * 3d: u = sin(pi x) sin(pi y) sin(pi z)
- *
- * This class inherits and implements virtual functions from
- * - mesh::StandardTagAndInitStrategy to initialize data
- * on the SAMR grid.
- * - appu::VisDerivedDataStrategy to write out certain data
- * in a vis file, such as the error of the solution.
- *
- * Inputs: The only input parameter for this class is
- * "fac_stokes", the input database for the solv::CellStokesFACSolver
- * object. See the documentation for solv::CellStokesFACSolver
- * for its input parameters.
- */
-class FACStokes:
- public mesh::StandardTagAndInitStrategy,
- public appu::VisDerivedDataStrategy
-{
+ /*!
+ * @brief Class to solve a sample Stokes equation on a SAMR grid.
+ */
+ class FACStokes:
+ public mesh::StandardTagAndInitStrategy,
+ public appu::VisDerivedDataStrategy
+ {
-public:
- /*!
- * @brief Constructor.
- *
- * If you want standard output and logging,
- * pass in valid pointers for those streams.
- *
- * @param object_name Ojbect name
- * @param database Input database (may be NULL)
- */
- FACStokes(
- const std::string& object_name,
- const tbox::Dimension& dim,
- tbox::Pointer<tbox::Database> database =
- tbox::Pointer<tbox::Database>(NULL));
+ public:
+ /*!
+ * @brief Constructor.
+ *
+ * If you want standard output and logging,
+ * pass in valid pointers for those streams.
+ *
+ * @param object_name Ojbect name
+ * @param database Input database (may be NULL)
+ */
+ FACStokes(
+ const std::string& object_name,
+ const tbox::Dimension& dim,
+ tbox::Pointer<tbox::Database> database =
+ tbox::Pointer<tbox::Database>(NULL));
- virtual ~FACStokes();
+ virtual ~FACStokes();
- //@{ @name mesh::StandardTagAndInitStrategy virtuals
+ //@{ @name mesh::StandardTagAndInitStrategy virtuals
- /*!
- * @brief Allocate and initialize data for a new level
- * in the patch hierarchy.
- *
- * This is where you implement the code for initialize data on
- * the grid. All the information needed to initialize the grid
- * are in the arguments.
- *
- * @see mesh::StandardTagAndInitStrategy::initializeLevelData()
- */
- virtual void
- initializeLevelData(
- const tbox::Pointer<hier::BasePatchHierarchy> hierarchy,
- const int level_number,
- const double init_data_time,
- const bool can_be_refined,
- const bool initial_time,
- const tbox::Pointer<hier::BasePatchLevel> old_level,
- const bool allocate_data);
+ /*!
+ * @brief Allocate and initialize data for a new level
+ * in the patch hierarchy.
+ *
+ * This is where you implement the code for initialize data on
+ * the grid. All the information needed to initialize the grid
+ * are in the arguments.
+ *
+ * @see mesh::StandardTagAndInitStrategy::initializeLevelData()
+ */
+ virtual void
+ initializeLevelData(
+ const tbox::Pointer<hier::BasePatchHierarchy> hierarchy,
+ const int level_number,
+ const double init_data_time,
+ const bool can_be_refined,
+ const bool initial_time,
+ const tbox::Pointer<hier::BasePatchLevel> old_level,
+ const bool allocate_data);
- /*!
- * @brief Reset any internal hierarchy-dependent information.
- */
- virtual void
- resetHierarchyConfiguration(
- tbox::Pointer<hier::BasePatchHierarchy> new_hierarchy,
- int coarsest_level,
- int finest_level);
+ /*!
+ * @brief Reset any internal hierarchy-dependent information.
+ */
+ virtual void
+ resetHierarchyConfiguration(
+ tbox::Pointer<hier::BasePatchHierarchy> new_hierarchy,
+ int coarsest_level,
+ int finest_level);
- //@}
+ //@}
- //@{ @name appu::VisDerivedDataStrategy virtuals
+ //@{ @name appu::VisDerivedDataStrategy virtuals
- virtual bool
- packDerivedDataIntoDoubleBuffer(
- double* buffer,
- const hier::Patch& patch,
- const hier::Box& region,
- const std::string& variable_name,
- int depth_id) const;
+ virtual bool
+ packDerivedDataIntoDoubleBuffer(
+ double* buffer,
+ const hier::Patch& patch,
+ const hier::Box& region,
+ const std::string& variable_name,
+ int depth_id) const;
- //@}
+ //@}
- /*!
- * @brief Solve using HYPRE Stokes solver
- *
- * Set up the linear algebra problem and use a
- * solv::CellStokesFACSolver object to solve it.
- * -# Set initial guess
- * -# Set boundary conditions
- * -# Specify Stokes equation parameters
- * -# Call solver
- */
- int
- solveStokes();
+ /*!
+ * @brief Solve using HYPRE Stokes solver
+ *
+ * Set up the linear algebra problem and use a
+ * solv::CellStokesFACSolver object to solve it.
+ * -# Set initial guess
+ * -# Set boundary conditions
+ * -# Specify Stokes equation parameters
+ * -# Call solver
+ */
+ int
+ solveStokes();
#ifdef HAVE_HDF5
- /*!
- * @brief Set up external plotter to plot internal
- * data from this class.
- *
- * After calling this function, the external
- * data writer may be used to write the
- * viz file for this object.
- *
- * The internal hierarchy is used and must be
- * established before calling this function.
- * (This is commonly done by building a hierarchy
- * with the mesh::StandardTagAndInitStrategy virtual
- * functions implemented by this class.)
- *
- * @param viz_writer VisIt writer
- */
- int
- setupPlotter(
- appu::VisItDataWriter& plotter) const;
+ /*!
+ * @brief Set up external plotter to plot internal
+ * data from this class.
+ *
+ * After calling this function, the external
+ * data writer may be used to write the
+ * viz file for this object.
+ *
+ * The internal hierarchy is used and must be
+ * established before calling this function.
+ * (This is commonly done by building a hierarchy
+ * with the mesh::StandardTagAndInitStrategy virtual
+ * functions implemented by this class.)
+ *
+ * @param viz_writer VisIt writer
+ */
+ int
+ setupPlotter(
+ appu::VisItDataWriter& plotter) const;
#endif
-private:
- std::string d_object_name;
+ private:
+ std::string d_object_name;
- const tbox::Dimension d_dim;
+ const tbox::Dimension d_dim;
- tbox::Pointer<hier::PatchHierarchy> d_hierarchy;
+ tbox::Pointer<hier::PatchHierarchy> d_hierarchy;
- //@{
- /*!
- * @name Major algorithm objects.
- */
+ //@{
+ /*!
+ * @name Major algorithm objects.
+ */
- /*!
- * @brief FAC stokes solver.
- */
- solv::CellStokesFACSolver d_stokes_fac_solver;
+ /*!
+ * @brief FAC stokes solver.
+ */
+ solv::CellStokesFACSolver d_stokes_fac_solver;
- /*!
- * @brief Boundary condition coefficient implementation.
- */
- solv::LocationIndexRobinBcCoefs d_bc_coefs;
+ /*!
+ * @brief Boundary condition coefficient implementation.
+ */
+ solv::LocationIndexRobinBcCoefs d_bc_coefs;
- //@}
+ //@}
- //@{
+ //@{
- /*!
- * @name Private state variables for solution.
- */
+ /*!
+ * @name Private state variables for solution.
+ */
- /*!
- * @brief Context owned by this object.
- */
- tbox::Pointer<hier::VariableContext> d_context;
+ /*!
+ * @brief Context owned by this object.
+ */
+ tbox::Pointer<hier::VariableContext> d_context;
+
+ /*!
+ * @brief Descriptor indices of internal data.
+ *
+ * These are initialized in the constructor and never change.
+ */
+ int p_id, p_exact_id, p_rhs_id, v_id, v_rhs_id;
- /*!
- * @brief Descriptor indices of internal data.
- *
- * These are initialized in the constructor and never change.
- */
- int d_comp_soln_id, d_exact_id, d_rhs_id;
+ //@}
- //@}
-
-};
+ };
}
More information about the CIG-COMMITS
mailing list