13#ifndef CD_SCANSHOPIMPLEM_H
14#define CD_SCANSHOPIMPLEM_H
21#include <CD_NamespaceHeader.H>
33 int skip =
static_cast<int>(a_slack / a_dx);
35 if (skip * a_dx >= a_slack) {
39 return std::max(skip, 0);
45 CH_TIME(
"ScanShop::isRegular(Box, RealVect, Real)");
49 const Real halfDiagonal = 0.5 * a_dx * sqrt(SpaceDim);
52 for (
int k = a_box.smallEnd(2); k <= a_box.bigEnd(2); k++) {
54 for (
int j = a_box.smallEnd(1); j <= a_box.bigEnd(1); j++) {
55 for (
int i = a_box.smallEnd(0); i <= a_box.bigEnd(0); i++) {
56 const RealVect point = a_probLo + a_dx * (0.5 * RealVect::Unit + RealVect(IntVect(D_DECL(i, j, k))));
57 const Real value =
m_baseIF->value(point);
59 if (value >= -halfDiagonal) {
63 i += this->
getScanSkip(-value - halfDiagonal, a_dx);
76 CH_TIME(
"ScanShop::isCovered(Box, RealVect, Real)");
80 const Real halfDiagonal = 0.5 * a_dx * sqrt(SpaceDim);
83 for (
int k = a_box.smallEnd(2); k <= a_box.bigEnd(2); k++) {
85 for (
int j = a_box.smallEnd(1); j <= a_box.bigEnd(1); j++) {
86 for (
int i = a_box.smallEnd(0); i <= a_box.bigEnd(0); i++) {
87 const RealVect point = a_probLo + a_dx * (0.5 * RealVect::Unit + RealVect(IntVect(D_DECL(i, j, k))));
88 const Real value =
m_baseIF->value(point);
90 if (value <= halfDiagonal) {
104inline std::vector<std::pair<Box, int>>
108 std::vector<std::pair<Box, int>> sortedBoxesAndTypes;
110 for (
int i = 0; i < a_boxes.size(); i++) {
111 sortedBoxesAndTypes.emplace_back(std::make_pair(a_boxes[i], a_types[i]));
114 auto comparator = [](
const std::pair<Box, int>& a,
const std::pair<Box, int>& b) ->
bool {
115 return a.first < b.first;
118 std::sort(sortedBoxesAndTypes.begin(), sortedBoxesAndTypes.end(), comparator);
120 return sortedBoxesAndTypes;
125#include <CD_NamespaceFooter.H>
Declare a class geometry generation (ScanShop) that uses the signed distance function for optimizatio...
bool m_distanceSkip
Whether or not the box scan may skip cells using the implicit function value as a distance.
Definition CD_ScanShop.H:179
int getScanSkip(Real a_slack, Real a_dx) const
Number of cells along the scan line that can be passed over without evaluating the implicit function.
Definition CD_ScanShopImplem.H:24
bool isRegular(Box a_box, const RealVect &a_probLo, Real a_dx) const
Check if every point in input box is regular.
Definition CD_ScanShopImplem.H:43
std::vector< std::pair< Box, int > > getSortedBoxesAndTypes(const Vector< Box > &a_boxes, const Vector< int > &a_types) const
Sort boxes lexicographically.
Definition CD_ScanShopImplem.H:105
const BaseIF * m_baseIF
Implicit function used to generate geometries.
Definition CD_ScanShop.H:199
bool isCovered(Box a_box, const RealVect &a_probLo, Real a_dx) const
Check if every point in box is covered.
Definition CD_ScanShopImplem.H:74