Skip to content

Commit

Permalink
add a new Geometry constructor for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Feb 25, 2019
1 parent 90c6cdc commit 0f6bceb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Src/Base/AMReX_Geometry.H
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public:
explicit Geometry (const Box& dom,
const RealBox* rb = nullptr,
int coord = -1,
int* is_per = nullptr);
int const* is_per = nullptr);
Geometry (const Box& dom, const RealBox& rb, int coord,
Array<int,AMREX_SPACEDIM> const& is_per);

~Geometry () = default;
Geometry (const Geometry& rhs) = default;
Expand All @@ -92,9 +94,9 @@ public:

static void Finalize ();
//! Read static values from ParmParse database.
static void Setup (const RealBox* rb = nullptr, int coord = -1, int* is_per = nullptr);
static void Setup (const RealBox* rb = nullptr, int coord = -1, int const* is_per = nullptr);
//! Set the rectangular domain after using default constructor.
void define (const Box& dom, const RealBox* rb = 0, int coord = -1, int* is_per = 0);
void define (const Box& dom, const RealBox* rb = 0, int coord = -1, int const* is_per = nullptr);
//! Returns the problem domain.
static const RealBox& ProbDomain () { return prob_domain; }
//! Sets the problem domain.
Expand Down
12 changes: 9 additions & 3 deletions Src/Base/AMReX_Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ Geometry::Geometry () {}
Geometry::Geometry (const Box& dom,
const RealBox* rb,
int coord,
int* is_per)
int const* is_per)
{
define(dom,rb,coord,is_per);
}

Geometry::Geometry (const Box& dom, const RealBox& rb, int coord,
Array<int,AMREX_SPACEDIM> const& is_per)
{
define(dom, &rb, coord, is_per.data());
}

void
Geometry::define (const Box& dom,
const RealBox* rb,
int coord,
int* is_per)
int const* is_per)
{
if (c_sys == undef)
Setup(rb,coord,is_per);
Expand Down Expand Up @@ -102,7 +108,7 @@ Geometry::Finalize ()
}

void
Geometry::Setup (const RealBox* rb, int coord, int* isper)
Geometry::Setup (const RealBox* rb, int coord, int const* isper)
{
#ifdef _OPENMP
BL_ASSERT(!omp_in_parallel());
Expand Down

0 comments on commit 0f6bceb

Please sign in to comment.