| 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 | #include "./ContourToMeshx.h"
|
|---|
| 11 |
|
|---|
| 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) {
|
|---|
| 13 |
|
|---|
| 14 | /*Contour:*/
|
|---|
| 15 | double* in_nod_serial;
|
|---|
| 16 | double value;
|
|---|
| 17 |
|
|---|
| 18 | /*threading: */
|
|---|
| 19 | ContourToMeshxThreadStruct gate;
|
|---|
| 20 | int num=1;
|
|---|
| 21 | #ifdef _MULTITHREADING_
|
|---|
| 22 | num=_NUMTHREADS_;
|
|---|
| 23 | #endif
|
|---|
| 24 |
|
|---|
| 25 | /*output: */
|
|---|
| 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);
|
|---|
| 30 |
|
|---|
| 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;
|
|---|
| 38 |
|
|---|
| 39 | /*launch the thread manager with ContourToMeshxt as a core: */
|
|---|
| 40 | LaunchThread(ContourToMeshxt,(void*)&gate,num);
|
|---|
| 41 |
|
|---|
| 42 | /*Assemble in_nod: */
|
|---|
| 43 | in_nod->Assemble();
|
|---|
| 44 |
|
|---|
| 45 | /*Get in_nod serialised for next operation: */
|
|---|
| 46 | in_nod_serial=in_nod->ToMPISerial();
|
|---|
| 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)){
|
|---|
| 50 | for(int n=0;n<nel;n++){
|
|---|
| 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) ){
|
|---|
| 52 | value=1; in_elem->SetValue(n,value,INS_VAL);
|
|---|
| 53 | }
|
|---|
| 54 | }
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | /*Assemble vectors: */
|
|---|
| 58 | in_elem->Assemble();
|
|---|
| 59 |
|
|---|
| 60 | /*Assign output pointers: */
|
|---|
| 61 | *pin_nod=in_nod;
|
|---|
| 62 | *pin_elem=in_elem;
|
|---|
| 63 |
|
|---|
| 64 | /*Free ressources:*/
|
|---|
| 65 | xDelete<double>(in_nod_serial);
|
|---|
| 66 |
|
|---|
| 67 | return 1;
|
|---|
| 68 | }
|
|---|