[1105] | 1 | /*! \file ContourToNodesx.c
|
---|
| 2 | */
|
---|
| 3 |
|
---|
| 4 | #include "./ContourToNodesx.h"
|
---|
| 5 |
|
---|
[14656] | 6 | int ContourToNodesx(IssmSeqVec<IssmPDouble>** pflags,double* x, double* y, int nods, Contour<IssmPDouble>** contours,int numcontours,int edgevalue){
|
---|
[1105] | 7 |
|
---|
| 8 | int i;
|
---|
| 9 |
|
---|
| 10 | /*Contour:*/
|
---|
[13220] | 11 | Contour<IssmPDouble>* contouri=NULL;
|
---|
[8303] | 12 | int numnodes;
|
---|
[1105] | 13 | double* xc=NULL;
|
---|
| 14 | double* yc=NULL;
|
---|
| 15 |
|
---|
| 16 | /*output: */
|
---|
[14656] | 17 | IssmSeqVec<IssmPDouble>* flags=NULL;
|
---|
| 18 | flags=new IssmSeqVec<IssmPDouble>(nods);
|
---|
[1105] | 19 |
|
---|
| 20 | /*Loop through all contours: */
|
---|
| 21 | for (i=0;i<numcontours;i++){
|
---|
| 22 | contouri=*(contours+i);
|
---|
[8303] | 23 | numnodes=contouri->nods;
|
---|
[1105] | 24 | xc=contouri->x;
|
---|
| 25 | yc=contouri->y;
|
---|
[8303] | 26 | IsInPoly(flags,xc,yc,numnodes,x,y,0,nods,edgevalue);
|
---|
[1105] | 27 | }
|
---|
| 28 |
|
---|
| 29 | /*Assemble vector: */
|
---|
[11695] | 30 | flags->Assemble();
|
---|
[1105] | 31 |
|
---|
| 32 | /*Assign output pointers: */
|
---|
| 33 | *pflags=flags;
|
---|
[11401] | 34 | return 1;
|
---|
[1105] | 35 | }
|
---|
[12121] | 36 |
|
---|
[14656] | 37 | int ContourToNodesx(IssmSeqVec<IssmPDouble>** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue){
|
---|
[12121] | 38 |
|
---|
| 39 | /*Contour:*/
|
---|
[13220] | 40 | Contour<IssmPDouble>* contouri=NULL;
|
---|
[12121] | 41 | double* xc=NULL;
|
---|
| 42 | double* yc=NULL;
|
---|
| 43 |
|
---|
| 44 | /*output: */
|
---|
[14656] | 45 | IssmSeqVec<IssmPDouble>* flags=NULL;
|
---|
| 46 | flags=new IssmSeqVec<IssmPDouble>(nods);
|
---|
[12121] | 47 |
|
---|
| 48 | /*Loop through all contours: */
|
---|
| 49 | if(contours){
|
---|
[13762] | 50 | for(int i=0;i<contours->Size();i++){
|
---|
[13220] | 51 | Contour<IssmPDouble>* contour=(Contour<IssmPDouble>*)contours->GetObjectByOffset(i);
|
---|
[12121] | 52 | IsInPoly(flags,contour->x,contour->y,contour->nods,x,y,0,nods,edgevalue);
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | /*Assemble vector: */
|
---|
| 57 | flags->Assemble();
|
---|
| 58 |
|
---|
| 59 | /*Assign output pointers: */
|
---|
| 60 | *pflags=flags;
|
---|
| 61 | return 1;
|
---|
| 62 | }
|
---|