source: issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp@ 13787

Last change on this file since 13787 was 13787, checked in by Mathieu Morlighem, 12 years ago

CHG: more problems reported by cppcheck

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