Skip to content

Commit

Permalink
For certain 2D EB geometries, fix out of bounds access in Print
Browse files Browse the repository at this point in the history
statement
  • Loading branch information
cgilet committed Oct 8, 2024
1 parent e8f071a commit eaa1111
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
14 changes: 10 additions & 4 deletions src/embedded_boundaries/eb_annulus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,16 @@ void incflo::make_eb_annulus()
amrex::Print() << " Direction: " << direction << std::endl;
amrex::Print() << " Outer radius: " << outer_radius << std::endl;
amrex::Print() << " Inner radius: " << inner_radius << std::endl;
amrex::Print() << " Outer center: "
<< outer_center[0] << ", " << outer_center[1] << ", " << outer_center[2] << std::endl;
amrex::Print() << " Inner center: "
<< inner_center[0] << ", " << inner_center[1] << ", " << inner_center[2] << std::endl;
amrex::Print() << " Outer center: " << outer_center[0] << ", " << outer_center[1]
#if (AMREX_SPACEDIM ==3)
<< ", " << outer_center[2]
#endif
<< std::endl;
amrex::Print() << " Inner center: " << inner_center[0] << ", " << inner_center[1]
#if (AMREX_SPACEDIM ==3)
<< ", " << inner_center[2]
#endif
<< std::endl;
amrex::Print() << " Offset: " << offset << std::endl;
amrex::Print() << " Smallest gap: " << smallest_gap_width << std::endl;
amrex::Print() << " Standoff: " << standoff << std::endl;
Expand Down
14 changes: 10 additions & 4 deletions src/embedded_boundaries/eb_cyl_tuscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@ void incflo::make_eb_cyl_tuscan()
amrex::Print() << " Direction: " << direction1 << std::endl;
amrex::Print() << " Height: " << height1 << std::endl;
amrex::Print() << " Radius: " << radius1 << std::endl;
amrex::Print() << " Center: "
<< center1[0] << ", " << center1[1] << ", " << center1[2] << std::endl;
amrex::Print() << " Center: " << center1[0] << ", " << center1[1]
#if (AMREX_SPACEDIM == 3)
<< ", " << center1[2]
#endif
<< std::endl;

amrex::Print() << " CYLINDER 2" << std::endl;
amrex::Print() << " Direction: " << direction2 << std::endl;
amrex::Print() << " Height: " << height2 << std::endl;
amrex::Print() << " Radius: " << radius2 << std::endl;
amrex::Print() << " Center: "
<< center2[0] << ", " << center2[1] << ", " << center2[2] << std::endl;
amrex::Print() << " Center: " << center2[0] << ", " << center2[1]
#if (AMREX_SPACEDIM == 3)
<< ", " << center2[2]
#endif
<< std::endl;

// Build the implicit function as a union of two cylinders
EB2::CylinderIF cyl1(radius1, height1, direction1, center1, true);
Expand Down
5 changes: 4 additions & 1 deletion src/embedded_boundaries/eb_sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ void incflo::make_eb_sphere()
amrex::Print() << " " << std::endl;
amrex::Print() << " Internal Flow: " << inside << std::endl;
amrex::Print() << " Radius: " << radius << std::endl;
amrex::Print() << " Center: " << center[0] << ", " << center[1] << ", " << center[2]
amrex::Print() << " Center: " << center[0] << ", " << center[1]
#if (AMREX_SPACEDIM == 3)
<< ", " << center[2]
#endif
<< std::endl;

// Build the sphere implicit function
Expand Down

0 comments on commit eaa1111

Please sign in to comment.