Flow123d  release_2.2.0-914-gf1a3a4f
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ComputeIntersection< Simplex< 1 >, Simplex< 2 > > Class Template Reference

Class for 1D-2D intersections. More...

#include <compute_intersection.hh>

Collaboration diagram for ComputeIntersection< Simplex< 1 >, Simplex< 2 > >:
Collaboration graph
[legend]

Public Member Functions

 ComputeIntersection ()
 Default constructor. Use when this is NOT final intersection object. More...
 
 ComputeIntersection (Simplex< 1 > &abscissa, Simplex< 2 > &triangle, Mesh *mesh)
 Constructor, sets abscissa and triangle object. Use when this is final intersection object. It allocates memory, computes plucker coordinates and products. More...
 
 ~ComputeIntersection ()
 
IntersectionResult compute (std::vector< IntersectionPointAux< 1, 2 >> &IP12s)
 Computes intersection points of line and triangle. More...
 
unsigned int compute_final (std::vector< IntersectionPointAux< 1, 2 >> &IP12s)
 
void print_plucker_coordinates (std::ostream &os)
 Prints out all the Plucker coordinates. More...
 
void clear_all ()
 
Setters and Getters
void set_data (Simplex< 1 > &abscissa, Simplex< 2 > &triangle)
 Sets the abscissa and triangle. More...
 
void set_pc_abscissa (Plucker *p)
 Sets the pointer to Plucker coordinates of the abscissa. More...
 
void set_pc_triangle (Plucker *p, unsigned int side_idx)
 Sets the pointer to Plucker coordinates of the triangle side. More...
 
Pluckerget_pc_abscissa ()
 Gets the pointer to Plucker coordinates of the abscissa. More...
 
Pluckerget_pc_triangle (unsigned int side_idx)
 Gets the pointer to Plucker coordinates of the triangle side. More...
 
void set_plucker_product (double *number, unsigned int side_idx)
 Sets the Plucker product of abscissa and triangle side (use if computed before). More...
 
double * get_plucker_product (unsigned int side_idx)
 Getter for Plucker product of abscissa and triangle side. More...
 
bool is_computed ()
 Gets true if the intersection has been computed already (e.g. in case of IP in vertex). More...
 
void set_computed ()
 Sets the 'computed' flag true. Means that intersection has been computed already (e.g. in case of IP in vertex). More...
 

Private Member Functions

void compute_plucker_products ()
 
double signed_plucker_product (unsigned int i)
 
bool compute_plucker (IntersectionPointAux< 1, 2 > &IP, const arma::vec3 &local)
 Computes intersection when nonezero Plucker products are of the same sign. More...
 
bool compute_degenerate (unsigned int side_idx, IntersectionPointAux< 1, 2 > &IP)
 

Private Attributes

bool computed_
 Flag 'computed'; is true if intersection has been computed already. More...
 
double scale_line_
 
double scale_triangle_
 
Simplex< 1 > * abscissa_
 
Simplex< 2 > * triangle_
 
Pluckerplucker_coordinates_abscissa_
 Pointer to plucker coordinates of abscissa. More...
 
std::vector< Plucker * > plucker_coordinates_triangle_
 Vector of pointers to plucker coordinates of triangle sides. More...
 
std::vector< double * > plucker_products_
 Pointers to Plucker products of abscissa and triangle side. More...
 

Detailed Description

template<>
class ComputeIntersection< Simplex< 1 >, Simplex< 2 > >

Class for 1D-2D intersections.

Computes the intersection of an abscissa and a triangle. Can be used both as sub-algorithm to higher dimnesional intersection and also for 1D-2D intersection as a result.

Definition at line 65 of file compute_intersection.hh.

Constructor & Destructor Documentation

Default constructor. Use when this is NOT final intersection object.

Definition at line 20 of file compute_intersection.cc.

ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::ComputeIntersection ( Simplex< 1 > &  abscissa,
Simplex< 2 > &  triangle,
Mesh mesh 
)

Constructor, sets abscissa and triangle object. Use when this is final intersection object. It allocates memory, computes plucker coordinates and products.

Definition at line 28 of file compute_intersection.cc.

Definition at line 46 of file compute_intersection.cc.

Member Function Documentation

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::clear_all ( )

Resets Plucker products to 'nullptr'. Use this CAREFULLY as it does not destroy the objects. It is intended to be used only from higher dimensions when before destroying.

Definition at line 60 of file compute_intersection.cc.

Computes intersection points of line and triangle.

If Plucker products are non-zero and with the same sign, then IP is inside the triangle. If some of the Plucker products are zero: 1 zero product -> IP is on the triangle side 2 zero products -> IP is at the vertex of triangle (there is no other IP) 3 zero products: -> line and triangle are coplanar

IP is intersection of triangle and whole line (bisector).

Parameters
IP12s- input/output vector of IPs. If IP found, it is pushed back. Should be empty on start.
Returns
Orientation flag (0,1 sign of product if get intersection, 2 - three zero products (degenerated), 3 - no intersection

NOTE: Why this is not done in constructor? Because default constructor is called in 1d-3d, 2d-3d and compute() is called later.

Definition at line 293 of file compute_intersection.cc.

bool ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::compute_degenerate ( unsigned int  side_idx,
IntersectionPointAux< 1, 2 > &  IP 
)
private

Computes intersection of abscissa and triangle side in degenerate case (all products are zero). Inspects also topology.

Parameters
side_idxis the local index of the triangle side
IPis the intersection point (if found)
Returns
true, if intersection is found; false otherwise

Definition at line 181 of file compute_intersection.cc.

unsigned int ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::compute_final ( std::vector< IntersectionPointAux< 1, 2 >> &  IP12s)

Computes final 1d-2d intersection. (Use when this is the resulting dimension object).

Parameters
IP12sinput/output vector of IPs. If IP found, it is pushed back. Should be empty on start.
Returns
number of intersection points found

Definition at line 380 of file compute_intersection.cc.

bool ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::compute_plucker ( IntersectionPointAux< 1, 2 > &  IP,
const arma::vec3 local 
)
private

Computes intersection when nonezero Plucker products are of the same sign.

Parameters
IPintersection point (if found)
locallocal coordinates of IP (got from Plucker products)
Returns
true, if intersection is found; false otherwise

Definition at line 107 of file compute_intersection.cc.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::compute_plucker_products ( )
private

Computes Plucker coordinates (abscissa, triangle lines) and Plucker products, if not computed already, or set from outside.

Definition at line 70 of file compute_intersection.cc.

Plucker* ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::get_pc_abscissa ( )
inline

Gets the pointer to Plucker coordinates of the abscissa.

Definition at line 125 of file compute_intersection.hh.

Plucker* ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::get_pc_triangle ( unsigned int  side_idx)
inline

Gets the pointer to Plucker coordinates of the triangle side.

Parameters
side_idxlocal index of a side of triangle

Definition at line 132 of file compute_intersection.hh.

double* ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::get_plucker_product ( unsigned int  side_idx)
inline

Getter for Plucker product of abscissa and triangle side.

Parameters
side_idxlocal index of a side of triangle
Returns
pointer to Plucker product

Definition at line 147 of file compute_intersection.hh.

bool ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::is_computed ( )
inline

Gets true if the intersection has been computed already (e.g. in case of IP in vertex).

Definition at line 151 of file compute_intersection.hh.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::print_plucker_coordinates ( std::ostream &  os)

Prints out all the Plucker coordinates.

Definition at line 437 of file compute_intersection.cc.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::set_computed ( )
inline

Sets the 'computed' flag true. Means that intersection has been computed already (e.g. in case of IP in vertex).

Definition at line 153 of file compute_intersection.hh.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::set_data ( Simplex< 1 > &  abscissa,
Simplex< 2 > &  triangle 
)

Sets the abscissa and triangle.

Use mostly when this is not final intersection computation.

Parameters
abscissaintersecting line
triangleintersecting triangle

Definition at line 99 of file compute_intersection.cc.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::set_pc_abscissa ( Plucker p)
inline

Sets the pointer to Plucker coordinates of the abscissa.

Definition at line 112 of file compute_intersection.hh.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::set_pc_triangle ( Plucker p,
unsigned int  side_idx 
)
inline

Sets the pointer to Plucker coordinates of the triangle side.

Parameters
ppointer to Plucker coordinates
side_idxlocal index of a side of triangle

Definition at line 120 of file compute_intersection.hh.

void ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::set_plucker_product ( double *  number,
unsigned int  side_idx 
)
inline

Sets the Plucker product of abscissa and triangle side (use if computed before).

Parameters
valuevalue of the Plucker product
side_idxlocal index of a side of triangle

Definition at line 140 of file compute_intersection.hh.

double ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::signed_plucker_product ( unsigned int  i)
inlineprivate

Auxiliary function providing correctly signed Plucker product according to the triangle side orientation.

Parameters
ilocal index of a side of triangle.

Definition at line 175 of file compute_intersection.hh.

Member Data Documentation

Simplex<1>* ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::abscissa_
private

Definition at line 198 of file compute_intersection.hh.

bool ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::computed_
private

Flag 'computed'; is true if intersection has been computed already.

Definition at line 194 of file compute_intersection.hh.

Plucker* ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::plucker_coordinates_abscissa_
private

Pointer to plucker coordinates of abscissa.

Definition at line 202 of file compute_intersection.hh.

std::vector<Plucker *> ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::plucker_coordinates_triangle_
private

Vector of pointers to plucker coordinates of triangle sides.

Definition at line 204 of file compute_intersection.hh.

std::vector<double *> ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::plucker_products_
private

Pointers to Plucker products of abscissa and triangle side.

Definition at line 206 of file compute_intersection.hh.

double ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::scale_line_
private

Definition at line 196 of file compute_intersection.hh.

double ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::scale_triangle_
private

Definition at line 196 of file compute_intersection.hh.

Simplex<2>* ComputeIntersection< Simplex< 1 >, Simplex< 2 > >::triangle_
private

Definition at line 199 of file compute_intersection.hh.


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