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
RevLine 
[1]1/*! \file ContourToMeshx.c
2 */
3
[2591]4#ifdef HAVE_CONFIG_H
[9320]5 #include <config.h>
[2591]6#else
7#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
8#endif
9
10
[1]11#include "./ContourToMeshx.h"
12
[13395]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) {
[1]14
15 int noerr=1;
16 int i;
17 int m,n;
18
19 /*Contour:*/
20 double* in_nod_serial;
21 double value;
22
[2591]23 /*threading: */
24 ContourToMeshxThreadStruct gate;
25 int num=1;
26 #ifdef _MULTITHREADING_
27 num=_NUMTHREADS_;
28 #endif
29
30
[1]31 /*output: */
[13395]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);
[1]36
[2591]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;
[1]44
[2591]45 /*launch the thread manager with ContourToMeshxt as a core: */
46 LaunchThread(ContourToMeshxt,(void*)&gate,num);
47
48 /*Assemble in_nod: */
[11995]49 in_nod->Assemble();
[2591]50
[1]51 /*Get in_nod serialised for next operation: */
[11995]52 in_nod_serial=in_nod->ToMPISerial();
[1]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) ){
[11995]58 value=1; in_elem->SetValue(n,value,INS_VAL);
[1]59 }
60 }
61 }
62
63 /*Assemble vectors: */
[11995]64 in_elem->Assemble();
[1]65
66 /*Assign output pointers: */
67 *pin_nod=in_nod;
68 *pin_elem=in_elem;
69
70 /*Free ressources:*/
[12706]71 xDelete<double>(in_nod_serial);
[1]72
73 return noerr;
74}
Note: See TracBrowser for help on using the repository browser.