XDG Interface

namespace xdg
class XDG

Public Functions

XDG() = default
inline XDG(
std::shared_ptr<MeshManager> mesh_manager,
RTLibrary ray_tracing_lib = RTLibrary::EMBREE,
)
void prepare_raytracer()
void prepare_volume_for_raytracing(MeshID volume)
MeshID find_volume(const Position &point, const Direction &direction) const
bool point_in_volume(
MeshID volume,
const Position point,
const Direction *direction = nullptr,
const std::vector<MeshID> *exclude_primitives = nullptr,
) const
std::pair<double, MeshID> ray_fire(
MeshID volume,
const Position &origin,
const Direction &direction,
const double dist_limit = INFTY,
HitOrientation orientation = HitOrientation::EXITING,
std::vector<MeshID> *const exclude_primitives = nullptr,
) const
void closest(
MeshID volume,
const Position &origin,
double &dist,
MeshID &triangle,
) const
void closest(MeshID volume, const Position &origin, double &dist) const
bool occluded(
MeshID volume,
const Position &origin,
const Direction &direction,
double &dist,
) const
Direction surface_normal(
MeshID surface,
Position point,
const std::vector<MeshID> *exclude_primitives = nullptr,
) const
double measure_volume(MeshID volume) const
double measure_surface_area(MeshID surface) const
double measure_volume_area(MeshID surface) const
inline void set_mesh_manager_interface(
std::shared_ptr<MeshManager> mesh_manager,
)
inline void set_ray_tracing_interface(
std::shared_ptr<RayTracer> ray_tracing_interface,
)
inline const std::shared_ptr<RayTracer> &ray_tracing_interface() const
inline const std::shared_ptr<MeshManager> &mesh_manager() const

Public Static Functions

static std::shared_ptr<XDG> create(
MeshLibrary mesh_lib = MeshLibrary::MOAB,
RTLibrary ray_tracing_lib = RTLibrary::EMBREE,
)

Private Functions

double _triangle_volume_contribution(const PrimitiveRef &triangle) const
double _triangle_area_contribution(const PrimitiveRef &triangle) const

Private Members

std::shared_ptr<RayTracer> ray_tracing_interface_ = {nullptr}
std::shared_ptr<MeshManager> mesh_manager_ = {nullptr}
std::unordered_map<MeshID, TreeID> volume_to_scene_map_
std::unordered_map<MeshID, TreeID> surface_to_tree_map_
std::unordered_map<MeshID, RTCGeometry> surface_to_geometry_map_
TreeID global_scene_
namespace xdg
class MeshManager

Subclassed by xdg::LibMeshManager, xdg::MOABMeshManager

Public Functions

virtual void load_file(const std::string &filepath) = 0
virtual void init() = 0
virtual int num_volumes() const = 0
virtual int num_surfaces() const = 0
virtual int num_ents_of_dimension(int dim) const = 0
virtual int num_volume_elements(MeshID volume) const = 0
virtual int num_volume_faces(MeshID volume) const = 0
virtual int num_surface_faces(MeshID surface) const = 0
virtual std::vector<MeshID> get_volume_elements(MeshID volume) const = 0
std::vector<MeshID> get_volume_faces(MeshID volume) const
virtual std::vector<MeshID> get_surface_faces(MeshID surface) const = 0
virtual std::vector<Vertex> element_vertices(MeshID element) const = 0
virtual std::array<Vertex, 3> face_vertices(MeshID element) const = 0
BoundingBox element_bounding_box(MeshID element) const
BoundingBox face_bounding_box(MeshID element) const
BoundingBox volume_bounding_box(MeshID volume) const
BoundingBox surface_bounding_box(MeshID surface) const
Direction face_normal(MeshID element) const
std::pair<MeshID, MeshID> get_parent_volumes(MeshID surface) const
virtual std::vector<MeshID> get_volume_surfaces(MeshID volume) const = 0
virtual std::pair<MeshID, MeshID> surface_senses(MeshID surface) const = 0
virtual Sense surface_sense(MeshID surface, MeshID volume) const = 0
virtual MeshID create_volume() = 0
virtual void add_surface_to_volume(
MeshID volume,
MeshID surface,
Sense sense,
bool overwrite = false,
) = 0
MeshID next_volume(MeshID current_volume, MeshID surface) const
MeshID next_volume_id() const
MeshID next_surface_id() const
MeshID create_implicit_complement()
virtual void parse_metadata() = 0
bool volume_has_property(MeshID volume, PropertyType type) const
bool surface_has_property(MeshID surface, PropertyType type) const
Property get_volume_property(MeshID volume, PropertyType type) const
Property get_surface_property(MeshID surface, PropertyType type) const
inline const std::vector<MeshID> &volumes() const
inline std::vector<MeshID> &volumes()
inline const std::vector<MeshID> &surfaces() const
inline std::vector<MeshID> &surfaces()
inline MeshID implicit_complement() const
virtual MeshLibrary mesh_library() const = 0

Protected Attributes

std::map<std::pair<MeshID, PropertyType>, Property> volume_metadata_
std::map<std::pair<MeshID, PropertyType>, Property> surface_metadata_
std::vector<MeshID> volumes_
std::vector<MeshID> surfaces_
MeshID implicit_complement_ = {ID_NONE}
namespace xdg
class RayTracer

Subclassed by xdg::EmbreeRayTracer

Public Functions

virtual ~RayTracer()
virtual void init() = 0
virtual TreeID register_volume(
const std::shared_ptr<MeshManager> mesh_manager,
MeshID volume,
) = 0
virtual bool point_in_volume(
TreeID tree,
const Position &point,
const Direction *direction = nullptr,
const std::vector<MeshID> *exclude_primitives = nullptr,
) const = 0
virtual std::pair<double, MeshID> ray_fire(
TreeID tree,
const Position &origin,
const Direction &direction,
const double dist_limit = INFTY,
HitOrientation orientation = HitOrientation::EXITING,
std::vector<MeshID> *const exclude_primitives = nullptr,
) = 0
virtual void closest(
TreeID tree,
const Position &origin,
double &dist,
MeshID &triangle,
) = 0
virtual void closest(TreeID tree, const Position &origin, double &dist) = 0
virtual bool occluded(
TreeID tree,
const Position &origin,
const Direction &direction,
double &dist,
) const = 0
inline int num_registered_trees() const
inline const std::vector<MeshID> &trees() const
virtual const std::shared_ptr<GeometryUserData> &geometry_data(
MeshID surface,
) const = 0

Protected Functions

const double bounding_box_bump(
const std::shared_ptr<MeshManager> mesh_manager,
MeshID volume_id,
)
TreeID next_tree_id() const

Protected Attributes

TreeID global_tree_
std::map<MeshID, TreeID> surface_to_tree_map_
std::vector<TreeID> trees_
double numerical_precision_ = {1e-3}
namespace xdg
struct RTCDHit : public RTCHit
#include <ray.h>

Structure extending Embree's RayHit to include a double precision version of the primitive normal

Public Functions

inline RTCDHit()

Public Members

const PrimitiveRef *primitive_ref = {nullptr}

Pointer to the primitive reference for this hit.

MeshID surface = {ID_NONE}

ID of the surface this hit belongs to.

Vec3da dNg

Double precision version of the primitive normal.

struct RTCDPointQuery : public RTCPointQuery
#include <ray.h>

Structure extending Embree's RTCPointQuery to include double precision values

Public Functions

inline RTCDPointQuery()
inline void set_radius(double rad)

Set both the single and double precision versions of the query radius.

inline void set_point(const double xyz[3])

Set both the single and double precision versions of the query location.

inline void set_point(const Position &xyz)

Public Members

unsigned int primID = RTC_INVALID_GEOMETRY_ID
unsigned int geomID = RTC_INVALID_GEOMETRY_ID
double dblx
double dbly
double dblz
const PrimitiveRef *primitive_ref = {nullptr}

Pointer to the primitive reference for this hit.

double dradius

Double precision version of the query distance.

struct RTCDRay : public RTCRay
#include <ray.h>

Stucture that is an extension of Embree's RTCRay with double precision versions of the origin, direction and intersection distance.

Public Functions

inline RTCDRay()
inline void set_org(double o[3])

Set both the single and double precision versions of the ray origin.

inline void set_org(const double o[3])

Set both the single and double precision versions of the ray origin.

inline void set_org(const Vec3da &o)

Set both the single and double precision versions of the ray origin.

inline void set_dir(double o[3])

Set both the single and double precision versions of the ray direction.

inline void set_dir(const double o[3])

Set both the single and double precision versions of the ray direction.

inline void set_dir(const Vec3da &o)

Set both the single and double precision versions of the ray direction.

inline void set_tfar(double d)

Set both the single and double precision versions of the ray max distance.

inline void set_tnear(double d)

Set both the single and double precision versions of the ray near distance.

Public Members

RayFireType rf_type

Enum indicating the type of query this ray is used for.

Vec3da dorg
Vec3da ddir

double precision versions of the origin and ray direction

double dtfar

double precision version of the ray far distance

HitOrientation orientation

Enum indicating what hits to accept based on orientation.

const std::vector<MeshID> *exclude_primitives = {nullptr}
struct RTCDRayHit
#include <ray.h>

Stucture combining the ray and ray-hit structures to be passed to Embree queries

Public Functions

inline double dot_prod()

Compute the dot product of the ray direction and current hit normal.

Public Members

struct RTCDRay ray
struct RTCDHit hit
namespace fmt
template<>
struct formatter<xdg::Vec3da> : public formatter<std::string>

Public Functions

template<typename FormatContext>
inline auto format(
const xdg::Vec3da &v,
FormatContext &ctx,
)