Ice Sheet System Model  4.18
Code documentation
Data Structures | Functions
ExpToLevelSetx.h File Reference
#include "../../shared/shared.h"
#include "../../classes/classes.h"

Go to the source code of this file.

Data Structures

struct  ExpToLevelSetxThreadStruct
 

Functions

int ExpToLevelSetx (double **pdistance, double *x, double *y, int nods, Contours *contours)
 
void * ExpToLevelSetxt (void *vExpToLevelSetxThreadStruct)
 

Function Documentation

◆ ExpToLevelSetx()

int ExpToLevelSetx ( double **  pdistance,
double *  x,
double *  y,
int  nods,
Contours contours 
)

Definition at line 12 of file ExpToLevelSetx.cpp.

12  {
13 
14  /*output: */
15  double* distance = xNew<double>(nods);
16  for(int i=0;i<nods;i++) distance[i]=1e50;
17 
18  /*initialize thread parameters: */
20  gate.contours = contours;
21  gate.nods = nods;
22  gate.distance = distance;
23  gate.x = x;
24  gate.y = y;
25 
26  /*launch the thread manager with ExpToLevelSetxt as a core: */
27  LaunchThread(ExpToLevelSetxt,(void*)&gate,_NUMTHREADS_);
28 
29  /*Assign output pointers: */
30  *pdistance=distance;
31 
32  return 1;
33 }

◆ ExpToLevelSetxt()

void* ExpToLevelSetxt ( void *  vExpToLevelSetxThreadStruct)

Definition at line 16 of file ExpToLevelSetxt.cpp.

16  {
17 
18  /*gate variables :*/
19  ExpToLevelSetxThreadStruct *gate = NULL;
20  pthread_handle *handle = NULL;
21  int i,i1,i0;
22 
23  /*recover handle and gate: */
24  handle = (pthread_handle*)vpthread_handle;
25  gate = (ExpToLevelSetxThreadStruct*)handle->gate;
26  int my_thread = handle->id;
27  int num_threads = handle->num;
28 
29  /*recover parameters :*/
30  Contours* contours = gate->contours;
31  int nods = gate->nods;
32  double *distance = gate->distance;
33  double *x = gate->x;
34  double *y = gate->y;
35 
36  /*distribute indices across threads :*/
37  PartitionRange(&i0,&i1,nods,num_threads,my_thread);
38 
39  /*Loop through all contours: */
40  for(i=0;i<contours->Size();i++){
41  Contour<double>* contour=(Contour<double>*)contours->GetObjectByOffset(i);
42  ContourToLevelSet(distance,contour->x,contour->y,contour->nods,x,y,i0,i1);
43  }
44 
45  return NULL;
46 }
pthread_handle::id
int id
Definition: issm_threads.h:12
LaunchThread
void LaunchThread(void *function(void *), void *gate, int num_threads)
Definition: LaunchThread.cpp:25
pthread_handle::num
int num
Definition: issm_threads.h:13
Contours
Declaration of Contours class.
Definition: Contours.h:10
ExpToLevelSetxThreadStruct
Definition: ExpToLevelSetx.h:12
Contour
Definition: Contour.h:15
ExpToLevelSetxThreadStruct::x
double * x
Definition: ExpToLevelSetx.h:17
ExpToLevelSetxThreadStruct::distance
double * distance
Definition: ExpToLevelSetx.h:16
ExpToLevelSetxThreadStruct::contours
Contours * contours
Definition: ExpToLevelSetx.h:14
pthread_handle
Definition: issm_threads.h:10
PartitionRange
void PartitionRange(int *pi0, int *pi1, int num_el, int num_threads, int my_thread)
Definition: PartitionRange.cpp:13
ExpToLevelSetxThreadStruct::y
double * y
Definition: ExpToLevelSetx.h:18
Contour::nods
int nods
Definition: Contour.h:20
ExpToLevelSetxThreadStruct::nods
int nods
Definition: ExpToLevelSetx.h:15
Contour::y
doubletype * y
Definition: Contour.h:22
Contour::x
doubletype * x
Definition: Contour.h:21
pthread_handle::gate
void * gate
Definition: issm_threads.h:11
ContourToLevelSet
void ContourToLevelSet(double *distance, double *contourx, double *contoury, int contournods, double *x, double *y, int i0, int i10)
Definition: ExpToLevelSetxt.cpp:48
ExpToLevelSetxt
void * ExpToLevelSetxt(void *vExpToLevelSetxThreadStruct)
Definition: ExpToLevelSetxt.cpp:16