Flow123d  release_3.0.0-1166-g21aa698
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ComputeIntersection< 1, 2 > Class Template 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, 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 (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)
 
int check_abscissa_topology (IPAux12 &IP)
 
void print_plucker_coordinates (std::ostream &os)
 Prints out all the Plucker coordinates. More...
 
void clear_all ()
 
Setters and Getters
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 (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...
 

Private Attributes

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...
 

Detailed Description

template<>
class ComputeIntersection< 1, 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 67 of file compute_intersection.hh.

Member Typedef Documentation

Definition at line 69 of file compute_intersection.hh.

Constructor & Destructor Documentation

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

Definition at line 21 of file compute_intersection.cc.

ComputeIntersection< 1, 2 >::ComputeIntersection ( ElementAccessor< 3 >  abscissa,
ElementAccessor< 3 >  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 30 of file compute_intersection.cc.

Definition at line 55 of file compute_intersection.cc.

Member Function Documentation

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

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

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

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

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

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

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

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

Gets the pointer to Plucker coordinates of the abscissa.

Definition at line 128 of file compute_intersection.hh.

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 135 of file compute_intersection.hh.

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 150 of file compute_intersection.hh.

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 154 of file compute_intersection.hh.

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

Prints out all the Plucker coordinates.

Definition at line 514 of file compute_intersection.cc.

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 156 of file compute_intersection.hh.

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

Sets the pointer to Plucker coordinates of the abscissa.

Definition at line 115 of file compute_intersection.hh.

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 123 of file compute_intersection.hh.

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 143 of file compute_intersection.hh.

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 186 of file compute_intersection.hh.

Member Data Documentation

bool ComputeIntersection< 1, 2 >::computed_
private

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

Definition at line 210 of file compute_intersection.hh.

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

Pointer to plucker coordinates of abscissa.

Definition at line 215 of file compute_intersection.hh.

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

Vector of pointers to plucker coordinates of triangle sides.

Definition at line 217 of file compute_intersection.hh.

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

Pointers to Plucker products of abscissa and triangle side.

Definition at line 219 of file compute_intersection.hh.

double ComputeIntersection< 1, 2 >::scale_line_
private

Definition at line 212 of file compute_intersection.hh.

double ComputeIntersection< 1, 2 >::scale_triangle_
private

Definition at line 212 of file compute_intersection.hh.


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