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

Last change on this file since 12706 was 12706, checked in by Mathieu Morlighem, 13 years ago

merged trunk-jpl and trunk for revision 12703

File size: 1.6 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
11#include "./ContourToMeshx.h"
12
13int ContourToMeshx( Vector** pin_nod,Vector** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue) {
14
15 int noerr=1;
16 int i;
17 int m,n;
18
19 /*Contour:*/
20 double* in_nod_serial;
21 double value;
22
23 /*threading: */
24 ContourToMeshxThreadStruct gate;
25 int num=1;
26 #ifdef _MULTITHREADING_
27 num=_NUMTHREADS_;
28 #endif
29
30
31 /*output: */
32 Vector* in_nod=NULL;
33 Vector* in_elem=NULL;
34
35 in_nod=new Vector(nods);
36 in_elem=new Vector(nel);
37
38 /*initialize thread parameters: */
39 gate.contours=contours;
40 gate.nods=nods;
41 gate.edgevalue=edgevalue;
42 gate.in_nod=in_nod;
43 gate.x=x;
44 gate.y=y;
45
46 /*launch the thread manager with ContourToMeshxt as a core: */
47 LaunchThread(ContourToMeshxt,(void*)&gate,num);
48
49 /*Assemble in_nod: */
50 in_nod->Assemble();
51
52 /*Get in_nod serialised for next operation: */
53 in_nod_serial=in_nod->ToMPISerial();
54
55 /*Take care of the case where an element interpolation has been requested: */
56 if ((strcmp(interptype,"element")==0) || (strcmp(interptype,"element and node")==0)){
57 for (n=0;n<nel;n++){
58 if ( (in_nod_serial[ (int)*(index+3*n+0) -1] == 1) && (in_nod_serial[ (int)*(index+3*n+1) -1] == 1) && (in_nod_serial[ (int)*(index+3*n+2) -1] == 1) ){
59 value=1; in_elem->SetValue(n,value,INS_VAL);
60 }
61 }
62 }
63
64 /*Assemble vectors: */
65 in_elem->Assemble();
66
67 /*Assign output pointers: */
68 *pin_nod=in_nod;
69 *pin_elem=in_elem;
70
71 /*Free ressources:*/
72 xDelete<double>(in_nod_serial);
73
74 return noerr;
75}
Note: See TracBrowser for help on using the repository browser.