Ice Sheet System Model  4.18
Code documentation
ContourToMeshx.cpp
Go to the documentation of this file.
1 
4 #ifdef HAVE_CONFIG_H
5  #include <config.h>
6 #else
7 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
8 #endif
9 
10 #include "./ContourToMeshx.h"
11 
12 int ContourToMeshx(double** pin_nod,double** pin_elem, double* index, double* x, double* y,Contours* contours,char* interptype,int nel,int nods, int edgevalue) {
13 
14  /*Contour:*/
15  double value;
16 
17  /*output: */
18  double* in_nod;
19  double* in_elem;
20  in_nod = xNewZeroInit<double>(nods);
21  in_elem = xNewZeroInit<double>(nel);
22 
23  /*initialize thread parameters: */
25  gate.contours = contours;
26  gate.nods = nods;
27  gate.edgevalue = edgevalue;
28  gate.in_nod = in_nod;
29  gate.x = x;
30  gate.y = y;
31 
32  /*launch the thread manager with ContourToMeshxt as a core: */
33  LaunchThread(ContourToMeshxt,(void*)&gate,_NUMTHREADS_);
34 
35  /*Take care of the case where an element interpolation has been requested: */
36  if ((strcmp(interptype,"element")==0) || (strcmp(interptype,"element and node")==0)){
37  for(int n=0;n<nel;n++){
38  if ( (in_nod[ (int)*(index+3*n+0) -1] == 1) && (in_nod[ (int)*(index+3*n+1) -1] == 1) && (in_nod[ (int)*(index+3*n+2) -1] == 1) ){
39  value=1.; in_elem[n]=value;
40  }
41  }
42  }
43 
44  /*Assign output pointers: */
45  *pin_nod=in_nod;
46  *pin_elem=in_elem;
47 
48  return 1;
49 }
ContourToMeshxt
void * ContourToMeshxt(void *vContourToMeshxThreadStruct)
Definition: ContourToMeshxt.cpp:13
ContourToMeshxThreadStruct::contours
Contours * contours
Definition: ContourToMeshx.h:14
LaunchThread
void LaunchThread(void *function(void *), void *gate, int num_threads)
Definition: LaunchThread.cpp:25
ContourToMeshx
int ContourToMeshx(double **pin_nod, double **pin_elem, double *index, double *x, double *y, Contours *contours, char *interptype, int nel, int nods, int edgevalue)
Definition: ContourToMeshx.cpp:12
Contours
Declaration of Contours class.
Definition: Contours.h:10
ContourToMeshx.h
ContourToMeshxThreadStruct
Definition: ContourToMeshx.h:12
ContourToMeshxThreadStruct::edgevalue
int edgevalue
Definition: ContourToMeshx.h:16
ContourToMeshxThreadStruct::nods
int nods
Definition: ContourToMeshx.h:15
ContourToMeshxThreadStruct::x
double * x
Definition: ContourToMeshx.h:18
ContourToMeshxThreadStruct::y
double * y
Definition: ContourToMeshx.h:19
ContourToMeshxThreadStruct::in_nod
double * in_nod
Definition: ContourToMeshx.h:17