source: issm/trunk/src/c/modules/ContourToMeshx/ContourToMeshx.cpp

Last change on this file was 16560, checked in by Mathieu Morlighem, 11 years ago

merged trunk-jpl and trunk for revision 16554

File size: 1.3 KB
Line 
1/*! \file ContourToMeshx.c
2 */
3
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
12int 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: */
24 ContourToMeshxThreadStruct gate;
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}
Note: See TracBrowser for help on using the repository browser.