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