24 #ifndef _GEMA_SEGMENT_CELL_INTERSECT_H_ 25 #define _GEMA_SEGMENT_CELL_INTERSECT_H_ 130 assert(i == 0 || i == 1);
140 int border(
int i)
const { assert(i == 0 || i == 1);
return _border[i]; }
151 static_assert(((qint8)0x55 >> 1 == (qint8)0x2A) && ((qint8)0xAA >> 1 == (qint8)0xD5),
"signed right shift is NOT an arithmetic shift");
152 return (qint8)_edgeAndNatSize >> 2;
162 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; }
165 const double*
rawCartCoord(
int i)
const { assert(i == 0 || i == 1);
return &_cartCoord[2*i]; }
170 assert(i == 0 || i == 1);
171 int n = numNatCoordinates();
172 const double* ncptr = _natCoord + hasIntersectionElementId();
175 for(
int j = 0; j < n; j++)
176 v[j] = ncptr[n*i + j];
187 _kindAndFlags |= 0x40;
189 _kindAndFlags &= (~0x40);
202 int intersectionElementId()
const {
return hasIntersectionElementId() ? _natCoord[0] : -1; }
214 void operator delete(
void* ptr);
215 void operator delete(
void* ptr, int, bool);
223 void*
operator new(std::size_t count,
int nnatural,
bool hasIntElementId);
262 double _cartCoord[4];
274 #endif // _GEMA_SEGMENT_CELL_INTERSECT_H_ SegmentId _segmentId
The segment id (discontinuity id + segment index)
Definition: gmSegmentCellIntersection.h:229
GmSegmentCellIntersectionPointKind kind(int i) const
Returns the intersection kind for the given intersection point (0 = first, 1 = second).
Definition: gmSegmentCellIntersection.h:128
Representation for the intersection between a polyline segment and a mesh cell. Can be used both in 2...
Definition: gmSegmentCellIntersection.h:58
GmSegmentCellIntersectionPointKind
Intersection point type between a segment and a 2D or 3D cell.
Definition: gmSegmentCellIntersection.h:32
The intersection occurrs at one of the cell faces (3D only)
Definition: gmSegmentCellIntersection.h:37
int _cellId
The cell id.
Definition: gmSegmentCellIntersection.h:80
IntersectionPoint _out
The data for the second intersection point in the polyline direction.
Definition: gmSegmentCellIntersection.h:84
int _edge
In 2D or 3D, if the segment lies over an edge, stores the edge number. -1 otherwise.
Definition: gmSegmentCellIntersection.h:86
GmSegmentCellIntersectionPointKind _kind
The kind of the intersection point.
Definition: gmSegmentCellIntersection.h:68
GmVector natCoord(int i) const
Returns the natural coordinate for the given intersection point (0 = first, 1 = second).
Definition: gmSegmentCellIntersection.h:168
quint8 _kindAndFlags
The kind enum value for both intersection points compacted at bits 1-3 (first) / 4-6 (second)....
Definition: gmSegmentCellIntersection.h:250
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:140
void setSegmentIntersection()
Mark this intersection as taking part in an inter segments intersection.
Definition: gmSegmentCellIntersection.h:196
The intersection occurrs at one of the cell nodes.
Definition: gmSegmentCellIntersection.h:35
There is no intersection. Used by the default constructor to identify an invalid object.
Definition: gmSegmentCellIntersection.h:34
bool continuous() const
Returns true if this intersection segment start point is the same as the last point for the previous ...
Definition: gmSegmentCellIntersection.h:181
void setContinuous(bool mode)
Updates the continuous flag.
Definition: gmSegmentCellIntersection.h:184
quint8 _edgeAndNatSize
6 most significant bits store the edge number, if the segment lies over an edge, or -1 otherwise....
Definition: gmSegmentCellIntersection.h:259
int _face
In 3D, if the segment lies over a face, stores the face number. -1 otherwise.
Definition: gmSegmentCellIntersection.h:87
bool segmentIntersection() const
Returns true if this intersection segment takes part in an inter segments intersection.
Definition: gmSegmentCellIntersection.h:193
int _border
The local node / edge / face index if _kind is not INTERNAL. -1 if it is.
Definition: gmSegmentCellIntersection.h:69
void print(const GmMatrix &m, const GmLogCategory &logger, GmLogLevel level, int fieldWidth, char format, int precision)
Prints the matrix using the specified logger, level and precision fields.
Definition: gmMatrixUtils.cpp:34
SegmentId segmentId() const
Returns the segment id (discontinuity index in the set + segment index in the intersection list)
Definition: gmSegmentCellIntersection.h:122
Declaration of the GmVector class.
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
int numNatCoordinates() const
Returns the number of entries in a natural coordinate for the element cell type.
Definition: gmSegmentCellIntersection.h:226
QPair< int, int > SegmentId
Discontinuity index, segment index in the intersection list.
Definition: gmSegmentCellIntersection.h:108
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:88
A (much more) compact version of GmSegmentCellIntersection for 2d intersections only....
Definition: gmSegmentCellIntersection.h:105
GmVector _natCoord
The natural coordinate of the intersection point.
Definition: gmSegmentCellIntersection.h:67
GmLogLevel
Available log levels list.
Definition: gmLog.h:36
The number of entries in this enum.
Definition: gmSegmentCellIntersection.h:42
GmVector _cartCoord
The cartesian coordinate of the intersection point.
Definition: gmSegmentCellIntersection.h:66
SegmentId _segmentId
The segment id (discontinuity id + segment index in the original discontinuity info)
Definition: gmSegmentCellIntersection.h:81
Class representing a category with multiple logging levels.
Definition: gmLog.h:58
The intersection occurrs at one of the cell edges.
Definition: gmSegmentCellIntersection.h:36
QPair< int, int > SegmentId
Discontinuity index, segment index in the original discontinuity info.
Definition: gmSegmentCellIntersection.h:61
int cellId() const
Returns the cell id.
Definition: gmSegmentCellIntersection.h:111
IntersectionPoint _in
The data for the first intersection point in the polyline direction.
Definition: gmSegmentCellIntersection.h:83
Definition: gmSegmentCellIntersection.h:64
int edge() const
If the segment lies over an edge, returns the intersected edge number. -1 otherwise.
Definition: gmSegmentCellIntersection.h:143
GmVector cartCoord(int i) const
Returns the cartesian coordinate for the given intersection point (0 = first, 1 = second),...
Definition: gmSegmentCellIntersection.h:162
bool hasIntersectionElementId() const
Returns true if this object was created with the option to store an intersection element id.
Definition: gmSegmentCellIntersection.h:199
int _cellId
The cell id.
Definition: gmSegmentCellIntersection.h:228
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:165
void setIntersectionElementId(int id)
Updates the stored intersection element id. Can only be called if hasIntersectionElementId() returns ...
Definition: gmSegmentCellIntersection.h:205
bool _single
A flag set to true if in & out where collapsed into a single point.
Definition: gmSegmentCellIntersection.h:89
The intersected segment starts or ends inside the cell.
Definition: gmSegmentCellIntersection.h:38
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
void setSegmentIdIndex(int index)
Updates the segment index part of the segment Id.
Definition: gmSegmentCellIntersection.h:125
Declaration of support functions and macros for information logging.