openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
Macros | Functions | Variables
filament.cc File Reference
#include "FMatrix.h"
#include "filament.h"
Include dependency graph for filament.cc:

Go to the source code of this file.

Macros

#define FIL_PTS_FILE   0
 
#define FIL_ELEM_FILE   1
 
#define FIL_DATA_FILE   2
 

Functions

void output_filaments (filament *f, FILE *fh[])
 
bool fl_chkIso (float *d, float th, Elem *e)
 
bool fl_IsoTagFaces (float *d, float th, Elem *e, bool *faceTags)
 
bool fl_IsoTagTetFaces (float *d, float th, bool *faceTags)
 
bool fl_IsoTagTriFaces (float *d, float th, bool *faceTags)
 
bool fl_IsoTagTriangle (float *d, float th, const int idx[])
 
bool fl_findIsoIntersect (float *d0, float *d1, float th, Point *p, Elem *e)
 
int fl_FindFilament (float *d0, float *d1, float th, Point *lp, Elem *e, singularity *sng)
 
bool fl_triFindPS (float *d0, float *d1, float th, Point *p, Point *PS, int meth)
 
bool fl_triFindPS_Lines (float *d0, float *d1, float th, Point *p, Point *PS)
 
bool fl_triFindPS_ShpFnc (float *d0, float *d1, float th, Point *p, Point *PS)
 
bool fl_findEdgeSection (float d_p0, float d_p1, float th, Point *p0, Point *p1, Point *pSec)
 
void interpoate_vm (int numNodes, float **d, int M, float **rd, float rDist)
 
void interpolateTBuffer (tbuffer *tbf)
 
float fl_triArea (Point *pts)
 
bool SameSideOfLine (Point pTest, Point p0, Point p1, Point p2)
 
bool PointInTriangle (Point pTest, Point p0, Point p1, Point p2)
 
bool PointInTriangleBarycentric (Point pTest, Point p0, Point p1, Point p2)
 
bool PointInTriangleBarycentric (Point pTest, Point p0, Point p1, Point p2, Point &bcc)
 
bool PtInTriangleBarycentricSP (Point pTest, Point p1, Point p2)
 
bool PtInTriangleBarycentricSP (Point pTest, Point p1, Point p2, Point &bcc)
 
Point UnTransformPoint (Point PTs, Point *opts, Point *spts)
 
Point fl_triNormalLocal (Point *pts, bool u)
 
void interpolate_vm (int numNodes, float **d, int M, float **rd, float rdist)
 
bool compute_filament (float *d0, float *d1, float vth, ElemList *elst, NodeList *nlst, filament *f, SingularityDetector_t meth)
 
int init_filament_IO (const char *meshname, int numT, FILE *fh[])
 
int write_connections (ElemList *elst, NodeList *nlst, filament *f, FILE *filHdls[], float t)
 
void write_filaments (filament *f, FILE *filHdls[], float t)
 
void close_filament_IO (FILE *fh[])
 

Variables

const int MAX_ELEM_NODES = 8
 
const int MAX_ELEM_FACES = 6
 

Macro Definition Documentation

◆ FIL_DATA_FILE

#define FIL_DATA_FILE   2

Definition at line 28 of file filament.cc.

◆ FIL_ELEM_FILE

#define FIL_ELEM_FILE   1

Definition at line 27 of file filament.cc.

◆ FIL_PTS_FILE

#define FIL_PTS_FILE   0

Definition at line 26 of file filament.cc.

Function Documentation

◆ close_filament_IO()

void close_filament_IO ( FILE *  fh[])

Close filaments I/O

Parameters
fhfile handles for writing filament data

Definition at line 414 of file filament.cc.

Here is the caller graph for this function:

◆ compute_filament()

bool compute_filament ( float *  d0,
float *  d1,
float  vth,
ElemList elst,
NodeList nlst,
filament f,
SingularityDetector_t  meth 
)

interpolate data onto a data point at rDist from central sample

Parameters
d0data at instant t-dt/2
d1data at instant t+dt/2
vthvoltage threshold for isolines
elstelement list
nlstnode list
ffilament array
methdetection method
Postcondition
filament structure filled with detected filament segments or phase singularities
Returns
true if filaments detected, false otherwise

Definition at line 171 of file filament.cc.

Here is the caller graph for this function:

◆ fl_chkIso()

bool fl_chkIso ( float *  d,
float  th,
Elem e 
)

Quick check whether an element possibly owns an isoline/isosurface

Parameters
ddata on element nodes
ththreshold for isoline
eelement

\ret true, if singularity is possible, false otherwise

Definition at line 429 of file filament.cc.

Here is the caller graph for this function:

◆ fl_findEdgeSection()

bool fl_findEdgeSection ( float  d_p0,
float  d_p1,
float  th,
Point *  p0,
Point *  p1,
Point *  pSec 
)

Find intersection of isoline with an edge of an element

Parameters
d0data value on triangle nodes at t0
d1data value on triangle nodes at t1
thisoline threshold
p0starting point of edge
p1end point of edge
pSecintersection point with isoline along edge p0-p1

\ret true, if there is an intersection, false otherwise

Definition at line 912 of file filament.cc.

Here is the caller graph for this function:

◆ fl_FindFilament()

int fl_FindFilament ( float *  d0,
float *  d1,
float  th,
Point *  lp,
Elem e,
singularity sng 
)

Find a filament segment or a phase singularity

Parameters
d0data value on nodes spanning the element at t0
d1data value on nodes spanning the element at t1
thisoline threshold
lplist of points in local ordering (no global indices)
eelement
sngsingularity data
Returns
0->No singularity found, 1->phase singularity, 2->filament segment

Definition at line 548 of file filament.cc.

Here is the caller graph for this function:

◆ fl_findIsoIntersect()

bool fl_findIsoIntersect ( float *  d0,
float *  d1,
float  th,
Point *  p,
Elem e 
)

Find intersection of two isosurfaces with the faces of a tetrahedron

Parameters
plocal node list
d0values at each node at time t0
d1values at each node at time t1
dfvalues at each node to span face hyperplane

Definition at line 946 of file filament.cc.

◆ fl_IsoTagFaces()

bool fl_IsoTagFaces ( float *  d,
float  th,
Elem e,
bool *  faceTags 
)

Tag all faces of an element which hold an isoline

Parameters
ddata on element nodes
ththreshold for isoline
eelement
faceTagslist of tags for each face of an element

\ret true, if any of the faces is tagged, false if none is tagged

Definition at line 456 of file filament.cc.

Here is the caller graph for this function:

◆ fl_IsoTagTetFaces()

bool fl_IsoTagTetFaces ( float *  d,
float  th,
bool *  faceTags 
)

Tag those faces of a tet which have an isoline

Parameters
dset of vectors
thset of transformed vectors
faceTagsnumber of vectors in set
Postcondition
faceTags array filled with tags
Returns
number of tagged faces

Definition at line 483 of file filament.cc.

Here is the caller graph for this function:

◆ fl_IsoTagTriangle()

bool fl_IsoTagTriangle ( float *  d,
float  th,
const int  idx[] 
)

Tag triangle

Parameters
ddata value on nodes spanning the triangle
thisoline threshold
Returns
true, if isoline on triangle, false otherwise

Definition at line 523 of file filament.cc.

Here is the caller graph for this function:

◆ fl_IsoTagTriFaces()

bool fl_IsoTagTriFaces ( float *  d,
float  th,
bool *  faceTags 
)

Tag triangle if it has an isoline

Parameters
dset of vectors
thset of transformed vectors
faceTagsnumber of vectors in set
Postcondition
faceTags array filled with tags
Returns
number of tagged faces

Definition at line 504 of file filament.cc.

Here is the caller graph for this function:

◆ fl_triArea()

float fl_triArea ( Point *  pts)
inline

return area of a triangle

Parameters
ptspoint list
Note
pts list must be in element local ordering
Returns
triangle area

Definition at line 92 of file filament.cc.

Here is the caller graph for this function:

◆ fl_triFindPS()

bool fl_triFindPS ( float *  d0,
float *  d1,
float  th,
Point *  lp,
Point *  PhaseS,
int  meth 
)

Find a phase singularity on a triangle

Parameters
d0data value on triangle nodes at t0
d1data value on triangle nodes at t1
thisoline threshold
lplist of points in local ordering (no global indices)
PScoordinate of phase singularity
methpick the detection method
Returns
true if singularity found, false otherwise

Definition at line 607 of file filament.cc.

Here is the caller graph for this function:

◆ fl_triFindPS_Lines()

bool fl_triFindPS_Lines ( float *  d0,
float *  d1,
float  th,
Point *  lp,
Point *  PhaseS 
)

Find a phase singularity on a triangle by transforming a triangle into a 2D plane and using parameterized lines to find the point of intersection

Parameters
d0data value on triangle nodes at t0
d1data value on triangle nodes at t1
thisoline threshold
lplist of points in local ordering (no global indices)
PScoordinate of phase singularity
Returns
true if singularity found, false otherwise

Definition at line 652 of file filament.cc.

Here is the caller graph for this function:

◆ fl_triFindPS_ShpFnc()

bool fl_triFindPS_ShpFnc ( float *  d0,
float *  d1,
float  th,
Point *  lp,
Point *  PhaseS 
)

Find a phase singularity on a triangle using isoparametric shape functions

Parameters
d0data value on triangle nodes at t0
d1data value on triangle nodes at t1
thisoline threshold
lplist of points in local ordering (no global indices)
PScoordinate of phase singularity
Returns
true ifsingularity found, false otherwise

Definition at line 634 of file filament.cc.

Here is the caller graph for this function:

◆ fl_triNormalLocal()

Point fl_triNormalLocal ( Point *  pts,
bool  u 
)

return normal of a triangle

Parameters
ptspoint list
utrue for unit vector
Note
pts list must be in element local ordering
Returns
triangle normal

Definition at line 108 of file filament.cc.

Here is the caller graph for this function:

◆ init_filament_IO()

int init_filament_IO ( const char *  meshname,
int  numT,
FILE *  fh[] 
)

interpolate data onto a data point at rDist from central sample

Parameters
meshnamebase name of mesh to derive names for filament files
numTnumber of time slices at which filaments are detected
fhfile handles for filament IO
Postcondition
file handle array filled with file pointers
Returns
1 if file open was successful, -1 otherwise

Definition at line 270 of file filament.cc.

Here is the caller graph for this function:

◆ interpoate_vm()

void interpoate_vm ( int  numNodes,
float **  d,
int  M,
float **  rd,
float  rDist 
)

◆ interpolate_vm()

void interpolate_vm ( int  numNodes,
float **  d,
int  M,
float **  rd,
float  rdist 
)

interpolate data onto a data point at rDist from central sample

Parameters
numNodesnumber of data items in vector
ddata vectors at input dt sampling
Mnumber of vectors in d
rdresampled data at +/- rDist
rdistrelative distance from central sample
Postcondition
rd[0] filled with data on -rdist, rd[1] with data at +rdist

Definition at line 147 of file filament.cc.

Here is the caller graph for this function:

◆ interpolateTBuffer()

void interpolateTBuffer ( tbuffer tbf)

interpolate data from time slice buffer wrapper function for interpolate_vm

Parameters
tbuffertime slice buffer
Postcondition
tbuffer->dr[0] filled with data on -tbf->rdist, tbuffer->dr[1] with data at + tbf->rdist

Definition at line 124 of file filament.cc.

Here is the caller graph for this function:

◆ output_filaments()

void output_filaments ( filament f,
FILE *  filHdls[] 
)

Output filaments to file

Parameters
filamentfilament data for current time slice
filHdlsfile handles for writing filament data
tcurrent time slice

Definition at line 375 of file filament.cc.

Here is the caller graph for this function:

◆ PointInTriangle()

bool PointInTriangle ( Point  pTest,
Point  p0,
Point  p1,
Point  p2 
)

Figure out whether a test point is inside a given triangle or not using the same side testing method

Parameters
pTestdata value on triangle nodes at t0
p0data value on triangle nodes at t1
p1isoline threshold
p2list of points in local ordering (no global indices)
Returns
true if pTest inside triangle, false otherwise

Definition at line 804 of file filament.cc.

◆ PointInTriangleBarycentric() [1/2]

bool PointInTriangleBarycentric ( Point  pTest,
Point  p0,
Point  p1,
Point  p2 
)

Definition at line 857 of file filament.cc.

◆ PointInTriangleBarycentric() [2/2]

bool PointInTriangleBarycentric ( Point  pTest,
Point  p0,
Point  p1,
Point  p2,
Point &  bcc 
)

Figure out whether a test point is inside a given triangle or not using the barycentric method

Parameters
[in]pTestdata value on triangle nodes at t0
[in]p0triangle vertex
[in]p1triangle vertex
[in]p2triangle vertex
[out]bccbarycenter coordinates
Returns
true iff pTest inside triangle

Definition at line 875 of file filament.cc.

◆ PtInTriangleBarycentricSP() [1/2]

bool PtInTriangleBarycentricSP ( Point  pTest,
Point  p1,
Point  p2 
)

points are in standard position

Definition at line 816 of file filament.cc.

Here is the caller graph for this function:

◆ PtInTriangleBarycentricSP() [2/2]

bool PtInTriangleBarycentricSP ( Point  v2,
Point  v1,
Point  v0,
Point &  bcc 
)

Figure out whether a test point is inside a given triangle or not using the barycentric method with triangle in standard position

Parameters
[in]v2test point
[in]p1triangle vertex on x-axis (p1)
[in]p2triangle vertex off axis (p2)
[out]bccbarycenter coordinates
Note
ignore p0 which is at the origin
Returns
true iff pTest inside triangle

Definition at line 835 of file filament.cc.

◆ SameSideOfLine()

bool SameSideOfLine ( Point  pTest,
Point  p0,
Point  p1,
Point  p2 
)

Figure out whether a test point lies on the same side of a given line as another point. The line is given by points p0 and p1.

Parameters
pTestdata value on triangle nodes at t0
p0data value on triangle nodes at t1
p1isoline threshold
p2list of points in local ordering (no global indices)
Note
underlying operations are executed with double precision
Returns
true if pTest and p2 are on the same side of the line p0-p1, false otherwise

Definition at line 785 of file filament.cc.

Here is the caller graph for this function:

◆ UnTransformPoint()

Point UnTransformPoint ( Point  PTs,
Point *  opts,
Point *  spts 
)

convert back from transformation to standard positon

Parameters
PTs[in]point to convert in standardized position
opts[in]triangle nodes in original space
spts[in]triangle nodes in standardized position
Note
PTs is located within the triangle

Definition at line 69 of file filament.cc.

◆ write_connections()

int write_connections ( ElemList elst,
NodeList nlst,
filament f,
FILE *  filHdls[],
float  t 
)

Definition at line 309 of file filament.cc.

◆ write_filaments()

void write_filaments ( filament f,
FILE *  filHdls[],
float  t 
)

Output filaments to file

Parameters
filamentfilament data for current time slice
filHdlsfile handles for writing filament data
tcurrent time slice
Returns
number of filaments written

Definition at line 348 of file filament.cc.

Here is the caller graph for this function:

Variable Documentation

◆ MAX_ELEM_FACES

const int MAX_ELEM_FACES = 6

Definition at line 31 of file filament.cc.

◆ MAX_ELEM_NODES

const int MAX_ELEM_NODES = 8

Definition at line 30 of file filament.cc.