Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
moab::GeomQueryTool::RayHistory Class Reference

#include <GeomQueryTool.hpp>

+ Collaboration diagram for moab::GeomQueryTool::RayHistory:

Public Member Functions

void reset ()
 
void reset_to_last_intersection ()
 
void rollback_last_intersection ()
 
ErrorCode get_last_intersection (EntityHandle &last_facet_hit) const
 
int size () const
 
bool in_history (EntityHandle ent) const
 
void add_entity (EntityHandle ent)
 

Private Attributes

std::vector< EntityHandleprev_facets
 

Friends

class GeomQueryTool
 

Detailed Description

Definition at line 61 of file GeomQueryTool.hpp.

Member Function Documentation

◆ add_entity()

void moab::GeomQueryTool::RayHistory::add_entity ( EntityHandle  ent)

Add entity to the RayHistory

Definition at line 723 of file GeomQueryTool.cpp.

724 {
725  prev_facets.push_back( ent );
726 }

◆ get_last_intersection()

ErrorCode moab::GeomQueryTool::RayHistory::get_last_intersection ( EntityHandle last_facet_hit) const

Get the last intersection in the RayHistory. This will return a null EntityHandle (0) if the history is empty.

Definition at line 705 of file GeomQueryTool.cpp.

706 {
707  if( prev_facets.size() > 0 )
708  {
709  last_facet_hit = prev_facets.back();
710  return MB_SUCCESS;
711  }
712  else
713  {
714  return MB_ENTITY_NOT_FOUND;
715  }
716 }

References MB_ENTITY_NOT_FOUND, and MB_SUCCESS.

◆ in_history()

bool moab::GeomQueryTool::RayHistory::in_history ( EntityHandle  ent) const
Returns
Boolean indicating if this entity is in the RayHistory

Definition at line 718 of file GeomQueryTool.cpp.

719 {
720  return std::find( prev_facets.begin(), prev_facets.end(), ent ) != prev_facets.end();
721 }

◆ reset()

void moab::GeomQueryTool::RayHistory::reset ( )

Clear this entire history– logically equivalent to creating a new history, but probably more efficient.

Definition at line 685 of file GeomQueryTool.cpp.

686 {
687  prev_facets.clear();
688 }

References prev_facets.

◆ reset_to_last_intersection()

void moab::GeomQueryTool::RayHistory::reset_to_last_intersection ( )

Clear the history up to the most recent intersection. This should be called when a ray changes direction at the site of a surface crossing, a situation that most commonly occurs at a reflecting boundary.

Definition at line 690 of file GeomQueryTool.cpp.

691 {
692 
693  if( prev_facets.size() > 1 )
694  {
695  prev_facets[0] = prev_facets.back();
696  prev_facets.resize( 1 );
697  }
698 }

◆ rollback_last_intersection()

void moab::GeomQueryTool::RayHistory::rollback_last_intersection ( )

Remove the most recent intersection. This allows a subsequent call along the same ray to return the same intersection.

Definition at line 700 of file GeomQueryTool.cpp.

701 {
702  if( prev_facets.size() ) prev_facets.pop_back();
703 }

◆ size()

int moab::GeomQueryTool::RayHistory::size ( ) const
inline
Returns
the number of surface crossings currently represented by this ray history

Definition at line 93 of file GeomQueryTool.hpp.

94  {
95  return prev_facets.size();
96  }

References prev_facets.

Friends And Related Function Documentation

◆ GeomQueryTool

friend class GeomQueryTool
friend

Definition at line 111 of file GeomQueryTool.hpp.

Member Data Documentation

◆ prev_facets

std::vector< EntityHandle > moab::GeomQueryTool::RayHistory::prev_facets
private

The documentation for this class was generated from the following files: