1#ifndef AMREX_EB_STL_UTILS_H_
2#define AMREX_EB_STL_UTILS_H_
4#include <AMReX_Config.H>
33 [[nodiscard]]
Real cent (
int d)
const
35 static_assert(
sizeof(
XDim3) ==
sizeof(
Real)*3);
36 return Real(1./3.)*((&v1.
x)[d] + (&v2.
x)[d] + (&v3.
x)[d]);
39 [[nodiscard]] std::pair<Real,Real> minmax (
int d)
const
41 static_assert(
sizeof(
XDim3) ==
sizeof(
Real)*3);
42 return std::minmax({(&v1.
x)[d], (&v2.
x)[d], (&v3.
x)[d]});
48 template <
int M,
int N>
52 std::numeric_limits<Real>::max(),
53 std::numeric_limits<Real>::max()),
55 std::numeric_limits<Real>::lowest(),
56 std::numeric_limits<Real>::lowest())};
57 STLtools::Triangle triangles[M];
60 std::int8_t ntriangles = 0;
61 std::int8_t nchildren = 0;
70 using Node = BVHNodeT<m_bvh_max_size,m_bvh_max_splits>;
80 "STLtools: BVH optimization must be enabled before reading the STL file");
81 m_bvh_optimization = flag;
99 Real outside_value = -1._rt,
Real inside_value = 1._rt)
const;
104 static constexpr bool isGPUable () noexcept {
return true; }
108 Box const& bounding_box)
const;
114 Box const& bounding_box)
const;
129 bool m_bvh_optimization =
true;
144 bool m_boundry_is_outside;
146 void read_ascii_stl_file (std::string
const& fname,
Real scale,
149 void read_binary_stl_file (std::string
const& fname,
Real scale,
154 static void bvh_size (
int ntri, std::size_t& nnodes);
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
Simple structs for 3-component integer and real-valued tuples.
Problem-domain geometry: maps between index space and physical space.
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:222
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:87
A collection (stored as an array) of FArrayBox objects.
Definition AMReX_MultiFab.H:40
A Box with real dimensions.
Definition AMReX_RealBox.H:28
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
ArrayND< T, 4, true > Array4
Convenient alias for a 4D ArrayND with three spatial dimensions plus a component dimension.
Definition AMReX_Array4.H:1340
PODVector< T, PinnedArenaAllocator< T > > PinnedVector
A PODVector that uses the pinned memory arena.
Definition AMReX_GpuContainers.H:48
std::array< T, N > Array
Definition AMReX_Array.H:31
PODVector< T, ArenaAllocator< T > > DeviceVector
A PODVector that uses the standard memory Arena. Note that the memory might or might not be managed d...
Definition AMReX_GpuContainers.H:24
Definition AMReX_Amr.cpp:50
RunOn
Definition AMReX_GpuControl.H:65
__host__ __device__ Dim3 begin(BoxND< dim > const &box) noexcept
Return the iterator begin coordinate of box as Dim3.
Definition AMReX_Box.H:2241
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:35
__host__ __device__ constexpr IntVectND< dim > scale(const IntVectND< dim > &p, int s) noexcept
Returns a IntVectND obtained by multiplying each of the components of this IntVectND by s.
Definition AMReX_IntVect.H:1128
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
__host__ __device__ Dim3 end(BoxND< dim > const &box) noexcept
Return the iterator end coordinate of box as Dim3.
Definition AMReX_Box.H:2259
@ levelset
Definition AMReX_EBData.H:20
Fixed-size array that can be used on GPU.
Definition AMReX_Array.H:52
A simple struct holding 3 Real values for a 3D coordinate.
Definition AMReX_Dim3.H:32
Real x
Definition AMReX_Dim3.H:32