Domain Setup


The DomainSetup class defines the geometric grid configuration for a simulation domain in ViennaPS. It stores bounds, boundary conditions, and grid resolution (gridDelta) and is used internally by the Domain class to initialize the underlying hrleGrid.


Features

  • Manage domain extents and resolution
  • Configure boundary conditions
  • Create and store an hrle::Grid based on bounds and resolution
  • Validate and print domain setup parameters
  • Support halving geometries for symmetry exploitation

Constructors

DomainSetup();
DomainSetup(double bounds[2 * D], BoundaryType boundaryCons[D], double gridDelta);
DomainSetup(double gridDelta, double xExtent, double yExtent, BoundaryType boundary);
  • Default constructor initializes all bounds to zero with INFINITE_BOUNDARY.
  • Bounding box constructor accepts explicit bounds and boundary conditions.
  • Extent constructor simplifies setup by placing bounds at plus/minus half of the supplied full x and y extents and applies default or specified boundary types.

Member Functions

Accessors

auto& grid() const;
double gridDelta() const;
std::array<double, 2 * D> bounds() const;
std::array<BoundaryType, D> boundaryCons() const;
double xExtent() const;
double yExtent() const;

Access the internal grid, resolution, and geometric/boundary parameters.


Geometry Modification

void halveXAxis();
void halveYAxis();

Modify the domain to simulate only half the geometry (along x or y), useful for symmetry. These operations are not allowed if periodic boundaries are used.


Initialization

void init();
void init(viennahrle::Grid<D> grid);

Construct or update the internal HRLE grid from the configured bounds, resolution, and boundary types.


Debugging

void print() const;

Prints all configured parameters to stdout, including grid delta, extents, and boundary configuration.


Example

using Setup = viennaps::DomainSetup<3>;
BoundaryType boundaries[3] = {
    BoundaryType::REFLECTIVE_BOUNDARY,
    BoundaryType::REFLECTIVE_BOUNDARY,
    BoundaryType::INFINITE_BOUNDARY
};
double bounds[6] = {-5.0, 5.0, -5.0, 5.0, -1.0, 1.0};

Setup setup(bounds, boundaries, 0.5);
setup.print();

Notes

  • In 2D, the yExtent() function still exists but returns the fixed height of the domain.
  • Grid cells are computed as integer multiples of gridDelta, ensuring alignment with HRLE.
  • The extent constructor sets the primary direction (y in 2D, z in 3D) to INFINITE_BOUNDARY. The bounding-box constructor preserves the supplied boundary conditions.