24#ifndef _GEMA_SEGMENT_CELL_INTERSECT_H_
25#define _GEMA_SEGMENT_CELL_INTERSECT_H_
133 assert(i == 0 || i == 1);
143 int border(
int i)
const { assert(i == 0 || i == 1);
return _border[i]; }
154 static_assert(((qint8)0x55 >> 1 == (qint8)0x2A) && ((qint8)0xAA >> 1 == (qint8)0xD5),
"signed right shift is NOT an arithmetic shift");
155 return (qint8)_edgeAndNatSize >> 2;
165 GmVector cartCoord(
int i)
const { assert(i == 0 || i == 1);
GmVector v(2); v[0] = _cartCoord[2*i]; v[1] = _cartCoord[2*i+1];
return v; }
168 const double*
rawCartCoord(
int i)
const { assert(i == 0 || i == 1);
return &_cartCoord[2*i]; }
173 assert(i == 0 || i == 1);
174 int n = numNatCoordinates();
175 const double* ncptr = _natCoord + hasIntersectionElementId();
178 for(
int j = 0; j < n; j++)
179 v[j] = ncptr[n*i + j];
192 _kindAndFlags |= 0x40;
194 _kindAndFlags &= (~0x40);
207 int intersectionElementId()
const {
return hasIntersectionElementId() ? _natCoord[0] : -1; }
219 size_t elemIdSize = hasIntersectionElementId() ? 1 : 0;
225 void operator delete(
void* ptr);
226 void operator delete(
void* ptr, int, bool);
234 void*
operator new(std::size_t count,
int nnatural,
bool hasIntElementId);
276 double _cartCoord[4];
A (much more) compact version of GmSegmentCellIntersection for 2d intersections only....
Definition gmSegmentCellIntersection.h:109
bool hasIntersectionElementId() const
Returns true if this object was created with the option to store an intersection element id.
Definition gmSegmentCellIntersection.h:204
void setSegmentIdIndex(int index)
Updates the segment index part of the segment Id.
Definition gmSegmentCellIntersection.h:128
int _cellId
The cell id.
Definition gmSegmentCellIntersection.h:242
bool continuous() const
Returns true if this intersection segment start point is the same as the last point for the previous ...
Definition gmSegmentCellIntersection.h:186
quint8 _edgeAndNatSize
6 most significant bits store the edge number, if the segment lies over an edge, or -1 otherwise....
Definition gmSegmentCellIntersection.h:273
GmSegmentCellIntersectionPointKind kind(int i) const
Returns the intersection kind for the given intersection point (0 = first, 1 = second).
Definition gmSegmentCellIntersection.h:131
int numNatCoordinates() const
Returns the number of entries in a natural coordinate for the element cell type.
Definition gmSegmentCellIntersection.h:240
quint8 _kindAndFlags
The kind enum value for both intersection points compacted at bits 1-3 (first) / 4-6 (second)....
Definition gmSegmentCellIntersection.h:264
SegmentId segmentId() const
Returns the segment id (discontinuity index in the set + segment index in the intersection list)
Definition gmSegmentCellIntersection.h:125
int border(int i) const
If kind(i) is not INTERNAL, returns the local node / edge index for the given intersection point (0 =...
Definition gmSegmentCellIntersection.h:143
void setIntersectionElementId(int id)
Updates the stored intersection element id. Can only be called if hasIntersectionElementId() returns ...
Definition gmSegmentCellIntersection.h:210
bool segmentIntersection() const
Returns true if this intersection segment takes part in an inter segments intersection.
Definition gmSegmentCellIntersection.h:198
const double * rawCartCoord(int i) const
Same as cartCoord(i) but returning a pointer to the internal buffer. No cdata copy to construct a GmV...
Definition gmSegmentCellIntersection.h:168
QPair< int, int > SegmentId
Discontinuity index, segment index in the intersection list.
Definition gmSegmentCellIntersection.h:111
int cellId() const
Returns the cell id.
Definition gmSegmentCellIntersection.h:114
SegmentId _segmentId
The segment id (discontinuity id + segment index)
Definition gmSegmentCellIntersection.h:243
size_t memSize() const
Returns the (computed) memory size allocated for this class when ::instace was called.
Definition gmSegmentCellIntersection.h:218
GmVector cartCoord(int i) const
Returns the cartesian coordinate for the given intersection point (0 = first, 1 = second),...
Definition gmSegmentCellIntersection.h:165
void setSegmentIntersection()
Mark this intersection as taking part in an inter segments intersection.
Definition gmSegmentCellIntersection.h:201
GmVector natCoord(int i) const
Returns the natural coordinate for the given intersection point (0 = first, 1 = second).
Definition gmSegmentCellIntersection.h:171
int edge() const
If the segment lies over an edge, returns the intersected edge number. -1 otherwise.
Definition gmSegmentCellIntersection.h:146
void setContinuous(bool mode)
Updates the continuous flag.
Definition gmSegmentCellIntersection.h:189
Class representing a category with multiple logging levels.
Definition gmLog.h:58
Base interface class for Partition-Color-Renumber object plugins.
Definition gmPCR.h:54
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of support functions and macros for information logging.
GmLogLevel
Available log levels list.
Definition gmLog.h:36
GmSegmentCellIntersectionPointKind
Intersection point type between a segment and a 2D or 3D cell.
Definition gmSegmentCellIntersection.h:35
@ GM_NODE_INTERSECTION
The intersection occurrs at one of the cell nodes.
Definition gmSegmentCellIntersection.h:37
@ GM_INTERNAL_INTERSECTION
The intersected segment starts or ends inside the cell.
Definition gmSegmentCellIntersection.h:40
@ GM_FACE_INTERSECTION
The intersection occurrs at one of the cell faces (3D only)
Definition gmSegmentCellIntersection.h:39
@ GM_NUM_INTERSECTION_POINT_KIND
The number of entries in this enum.
Definition gmSegmentCellIntersection.h:44
@ GM_NO_INTERSECTION
There is no intersection. Used by the default constructor to identify an invalid object.
Definition gmSegmentCellIntersection.h:36
@ GM_EDGE_INTERSECTION
The intersection occurrs at one of the cell edges.
Definition gmSegmentCellIntersection.h:38
Declaration of the GmVector class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
Definition gmSegmentCellIntersection.h:67
int _border
The local node / edge / face index if _kind is not INTERNAL. -1 if it is.
Definition gmSegmentCellIntersection.h:71
GmVector _cartCoord
The cartesian coordinate of the intersection point.
Definition gmSegmentCellIntersection.h:68
GmSegmentCellIntersectionPointKind _kind
The kind of the intersection point.
Definition gmSegmentCellIntersection.h:70
GmVector _natCoord
The natural coordinate of the intersection point.
Definition gmSegmentCellIntersection.h:69
Representation for the intersection between a polyline segment and a mesh cell. Can be used both in 2...
Definition gmSegmentCellIntersection.h:61
int _cellId
The cell id.
Definition gmSegmentCellIntersection.h:82
int _face
In 3D, if the segment lies over a face, stores the face number. -1 otherwise.
Definition gmSegmentCellIntersection.h:89
GmVector _normal
Approximated normal from original segment.
Definition gmSegmentCellIntersection.h:92
IntersectionPoint _out
The data for the second intersection point in the polyline direction.
Definition gmSegmentCellIntersection.h:86
bool _continuous
A flag set to true if this intersection segment start point is the same as the last point for the pre...
Definition gmSegmentCellIntersection.h:90
bool _single
A flag set to true if in & out where collapsed into a single point.
Definition gmSegmentCellIntersection.h:91
IntersectionPoint _in
The data for the first intersection point in the polyline direction.
Definition gmSegmentCellIntersection.h:85
int _edge
In 2D or 3D, if the segment lies over an edge, stores the edge number. -1 otherwise.
Definition gmSegmentCellIntersection.h:88
SegmentId _segmentId
The segment id (discontinuity id + segment index in the original discontinuity info)
Definition gmSegmentCellIntersection.h:83
QPair< int, int > SegmentId
Discontinuity index, segment index in the original discontinuity info.
Definition gmSegmentCellIntersection.h:63