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

Last change on this file since 13395 was 13395, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13393

File size: 1.7 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(SeqVec<double>** pin_nod,SeqVec<double>** 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 SeqVec<double>* in_nod=NULL;
33 SeqVec<double>* in_elem=NULL;
34 in_nod = new SeqVec<double>(nods);
35 in_elem = new SeqVec<double>(nel);
36
37 /*initialize thread parameters: */
38 gate.contours=contours;
39 gate.nods=nods;
40 gate.edgevalue=edgevalue;
41 gate.in_nod=in_nod;
42 gate.x=x;
43 gate.y=y;
44
45 /*launch the thread manager with ContourToMeshxt as a core: */
46 LaunchThread(ContourToMeshxt,(void*)&gate,num);
47
48 /*Assemble in_nod: */
49 in_nod->Assemble();
50
51 /*Get in_nod serialised for next operation: */
52 in_nod_serial=in_nod->ToMPISerial();
53
54 /*Take care of the case where an element interpolation has been requested: */
55 if ((strcmp(interptype,"element")==0) || (strcmp(interptype,"element and node")==0)){
56 for (n=0;n<nel;n++){
57 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) ){
58 value=1; in_elem->SetValue(n,value,INS_VAL);
59 }
60 }
61 }
62
63 /*Assemble vectors: */
64 in_elem->Assemble();
65
66 /*Assign output pointers: */
67 *pin_nod=in_nod;
68 *pin_elem=in_elem;
69
70 /*Free ressources:*/
71 xDelete<double>(in_nod_serial);
72
73 return noerr;
74}
Note: See TracBrowser for help on using the repository browser.