Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Sep 7, 2024
1 parent 908c38d commit 477648e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions Src/EB/AMReX_EB_STL_utils.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public:
RealBox boundingbox;
STLtools::Triangle traiangles[M];
XDim3 trinorm[M];
int ntriangles;
int children[N];
};

Expand Down
27 changes: 18 additions & 9 deletions Src/EB/AMReX_EB_STL_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,14 @@ STLtools::prepare (Gpu::PinnedVector<Triangle>&& a_tri_pts)
void
STLtools::build_bvh (Triangle* begin, Triangle* end)
{
amrex::Abort("xxxxx");

auto ntri = int(end - begin);

if (ntri <= m_bvh_max_size) { return; }
if (ntri <= m_bvh_max_size) {
// xxxxx update boundingbox .....
return;
}

RealVect centmin(std::numeric_limits<Real>::max());
RealVect centmax(std::numeric_limits<Real>::lowest());
Expand All @@ -477,16 +482,20 @@ STLtools::build_bvh (Triangle* begin, Triangle* end)
int tsize = ntri / nsplits;
int nleft = ntri - tsize*nsplits;

for (int isplit = 0; isplit < nsplits; ++isplit) {
int tbegin, tend;
if (isplit < nleft) {
tbegin = isplit * (tsize+1);
tend = tbegin + tsize;
for (int isplit = 0; isplit < m_bvh_max_splits; ++isplit) {
if (isplit < nsplits) {
int tbegin, tend;
if (isplit < nleft) {
tbegin = isplit * (tsize+1);
tend = tbegin + tsize;
} else {
tbegin = isplit * tsize + nleft;
tend = tbegin + tsize - 1;
}
build_bvh(begin+tbegin, begin+tend);
} else {
tbegin = isplit * tsize + nleft;
tend = tbegin + tsize - 1;
// xxxxx
}
build_bvh(begin+tbegin, begin+tend);
}
}

Expand Down

0 comments on commit 477648e

Please sign in to comment.