forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…ect#1155) * Add geo setup * Add find_sorted * Refactor `build_postfix` into a function that takes a remapping function * Further refactor postfix construction to split faces from logic * Explicitly use node type for csg tree size for documentation * Rename exterior volume name and add global universe * Add exterior bounding box helper * Move postfix builder to a separate file * Add internal surface mapper
- Loading branch information
Showing
23 changed files
with
893 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
//----------------------------------*-C++-*----------------------------------// | ||
// Copyright 2024 UT-Battelle, LLC, and other Celeritas developers. | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
//---------------------------------------------------------------------------// | ||
//! \file orange/orangeinp/detail/InternalSurfaceFlagger.cc | ||
//---------------------------------------------------------------------------// | ||
#include "InternalSurfaceFlagger.hh" | ||
|
||
namespace celeritas | ||
{ | ||
namespace orangeinp | ||
{ | ||
namespace detail | ||
{ | ||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Construct from a tree. | ||
*/ | ||
InternalSurfaceFlagger::InternalSurfaceFlagger(CsgTree const& tree) | ||
: tree_{tree}, cache_(tree.size(), Status::unknown) | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Visit a node, using the cache, to determine its flag. | ||
*/ | ||
bool InternalSurfaceFlagger::operator()(NodeId const& n) | ||
{ | ||
CELER_EXPECT(n < cache_.size()); | ||
Status& status = cache_[n.get()]; | ||
if (status == Status::unknown) | ||
{ | ||
Node const& node = tree_[n]; | ||
CELER_ASSUME(!node.valueless_by_exception()); | ||
status = static_cast<Status>(std::visit(*this, node)); | ||
} | ||
CELER_ENSURE(status >= 0); | ||
return status; | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Aliased nodes forward to the aliased node. | ||
*/ | ||
bool InternalSurfaceFlagger::operator()(Aliased const& n) | ||
{ | ||
return (*this)(n.node); | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Visit a negated node. | ||
* | ||
* Negated "and" nodes are *not* simple. Negated "or" nodes might be, but we | ||
* ignore that for now. | ||
*/ | ||
bool InternalSurfaceFlagger::operator()(Negated const& n) | ||
{ | ||
if (auto* j = std::get_if<Joined>(&tree_[n.node])) | ||
{ | ||
// Pointee is a "joined" node | ||
CELER_DISCARD(j); | ||
return Status::internal; | ||
} | ||
|
||
// Otherwise forward on the result (for simplified trees, this should just | ||
// be a surface or "true") | ||
return (*this)(n.node); | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Intersections of "simple" nodes are simple; unions are never. | ||
*/ | ||
bool InternalSurfaceFlagger::operator()(Joined const& n) | ||
{ | ||
CELER_EXPECT(n.nodes.size() > 1); | ||
|
||
if (n.op == op_or) | ||
{ | ||
return Status::internal; | ||
} | ||
|
||
for (NodeId const& d : n.nodes) | ||
{ | ||
if ((*this)(d) == Status::internal) | ||
{ | ||
return Status::internal; | ||
} | ||
} | ||
|
||
return Status::simple; | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
} // namespace detail | ||
} // namespace orangeinp | ||
} // namespace celeritas |
Oops, something went wrong.