source: issm/trunk/src/c/ContourToMeshx/ContourToMeshx.cpp@ 3332

Last change on this file since 3332 was 3332, checked in by Mathieu Morlighem, 15 years ago

Do not use throw ErrorException -> ISSMERROR macro
Removed all FUNCT definitions (now useless)

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