Flow123d  DF_asm_optimization-d5b8fcb
Public Types | Public Member Functions | List of all members
ComputeIntersection< 1, 2 > Class Reference

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

#include <compute_intersection.hh>

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

Public Types

typedef IntersectionPointAux< 1, 2 > IPAux12
 

Public Member Functions

 ComputeIntersection ()
 Default constructor. Use when this is NOT final intersection object. More...
 
 ComputeIntersection (ElementAccessor< 3 > abscissa, ElementAccessor< 3 > triangle)
 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 (IPAux12 &IP)
 Computes intersection points of line and triangle. More...
 
unsigned int compute_final (std::vector< IPAux12 > &IP12s)
 
unsigned int compute_final_in_plane (std::vector< IPAux12 > &IP12s)
 

Setters and Getters

bool computed_
 Flag 'computed'; is true if intersection has been computed already. More...
 
double scale_line_
 
double scale_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...
 
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...
 
int check_abscissa_topology (IPAux12 &IP)
 
void print_plucker_coordinates (std::ostream &os)
 Prints out all the Plucker coordinates. More...
 
void clear_all ()
 
void compute_plucker_products ()
 
double signed_plucker_product (unsigned int i)
 
bool compute_plucker (IPAux12 &IP, const arma::vec3 &local)
 Computes intersection when nonezero Plucker products are of the same sign. More...
 
bool compute_degenerate (unsigned int side_idx, IPAux12 &IP)
 
void correct_triangle_ip_topology (double t, unsigned int i, std::vector< IPAux12 > &ip)
 After interpolation, the topology information in tetrahedron must be updated. More...
 

Detailed Description

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.

Member Typedef Documentation

◆ IPAux12

Definition at line 67 of file compute_intersection.hh.

Constructor & Destructor Documentation

◆ ComputeIntersection() [1/2]

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

Definition at line 19 of file compute_intersection.cc.

◆ ComputeIntersection() [2/2]

ComputeIntersection< 1, 2 >::ComputeIntersection ( ElementAccessor< 3 >  abscissa,
ElementAccessor< 3 >  triangle 
)

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.

◆ ~ComputeIntersection()

Definition at line 53 of file compute_intersection.cc.

Member Function Documentation

◆ check_abscissa_topology()

int ComputeIntersection< 1, 2 >::check_abscissa_topology ( IPAux12 IP)

Checks the position of IP on abscissa, possibly changes topology to end points. Returns -2, -1, 0, 1, 2; -1. 0 - inside abscissa -2, 2 - outside of abscissa -1, 1 - end points

Definition at line 101 of file compute_intersection.cc.

◆ clear_all()

void ComputeIntersection< 1, 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 67 of file compute_intersection.cc.

◆ compute()

IntersectionResult ComputeIntersection< 1, 2 >::compute ( IPAux12 IP)

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 185 of file compute_intersection.cc.

◆ compute_degenerate()

bool ComputeIntersection< 1, 2 >::compute_degenerate ( unsigned int  side_idx,
IPAux12 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 297 of file compute_intersection.cc.

◆ compute_final()

unsigned int ComputeIntersection< 1, 2 >::compute_final ( std::vector< IPAux12 > &  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 271 of file compute_intersection.cc.

Here is the caller graph for this function:

◆ compute_final_in_plane()

unsigned int ComputeIntersection< 1, 2 >::compute_final_in_plane ( std::vector< IPAux12 > &  IP12s)

Computes final 1d-2d intersection, supposing situation in 2d plane (only degenerate case). (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 409 of file compute_intersection.cc.

Here is the caller graph for this function:

◆ compute_plucker()

bool ComputeIntersection< 1, 2 >::compute_plucker ( IPAux12 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 121 of file compute_intersection.cc.

◆ compute_plucker_products()

void ComputeIntersection< 1, 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 77 of file compute_intersection.cc.

◆ correct_triangle_ip_topology()

void ComputeIntersection< 1, 2 >::correct_triangle_ip_topology ( double  t,
unsigned int  i,
std::vector< IPAux12 > &  ip 
)
private

After interpolation, the topology information in tetrahedron must be updated.

Parameters
ipintersection point to be corrected

TODO:

  1. Try to avoid setting topology from coords. Try to use just topology information.
  2. If can not be done. Use interact method to setup a map mapping 16 possible zeros positions to appropriate topology, remove topology_idx from RefElement.

Definition at line 477 of file compute_intersection.cc.

◆ get_pc_abscissa()

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

Gets the pointer to Plucker coordinates of the abscissa.

Definition at line 126 of file compute_intersection.hh.

◆ get_pc_triangle()

Plucker* ComputeIntersection< 1, 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 133 of file compute_intersection.hh.

◆ get_plucker_product()

double* ComputeIntersection< 1, 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 148 of file compute_intersection.hh.

◆ is_computed()

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

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

Definition at line 152 of file compute_intersection.hh.

◆ print_plucker_coordinates()

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

Prints out all the Plucker coordinates.

Definition at line 512 of file compute_intersection.cc.

◆ set_computed()

void ComputeIntersection< 1, 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 154 of file compute_intersection.hh.

◆ set_pc_abscissa()

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

Sets the pointer to Plucker coordinates of the abscissa.

Definition at line 113 of file compute_intersection.hh.

◆ set_pc_triangle()

void ComputeIntersection< 1, 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 121 of file compute_intersection.hh.

◆ set_plucker_product()

void ComputeIntersection< 1, 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 141 of file compute_intersection.hh.

◆ signed_plucker_product()

double ComputeIntersection< 1, 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 184 of file compute_intersection.hh.

Member Data Documentation

◆ computed_

bool ComputeIntersection< 1, 2 >::computed_
private

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

Definition at line 208 of file compute_intersection.hh.

◆ plucker_coordinates_abscissa_

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

Pointer to plucker coordinates of abscissa.

Definition at line 213 of file compute_intersection.hh.

◆ plucker_coordinates_triangle_

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

Vector of pointers to plucker coordinates of triangle sides.

Definition at line 215 of file compute_intersection.hh.

◆ plucker_products_

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

Pointers to Plucker products of abscissa and triangle side.

Definition at line 217 of file compute_intersection.hh.

◆ scale_line_

double ComputeIntersection< 1, 2 >::scale_line_
private

Definition at line 210 of file compute_intersection.hh.

◆ scale_triangle_

double ComputeIntersection< 1, 2 >::scale_triangle_
private

Definition at line 210 of file compute_intersection.hh.


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