[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 |
|
---|
| 13 | int 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 |
|
---|
[2591] | 23 | /*threading: */
|
---|
| 24 | ContourToMeshxThreadStruct gate;
|
---|
| 25 | int num=1;
|
---|
| 26 | #ifdef _MULTITHREADING_
|
---|
| 27 | num=_NUMTHREADS_;
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 |
|
---|
[1] | 31 | /*output: */
|
---|
| 32 | Vec in_nod=NULL;
|
---|
| 33 | Vec in_elem=NULL;
|
---|
| 34 |
|
---|
| 35 | in_nod=NewVec(nods);
|
---|
| 36 | in_elem=NewVec(nel);
|
---|
| 37 |
|
---|
[2591] | 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;
|
---|
[1] | 46 |
|
---|
[2591] | 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 |
|
---|
[1] | 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 | }
|
---|