Changeset 12061
- Timestamp:
- 04/19/12 16:20:00 (13 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r12056 r12061 799 799 ./modules/TriMeshx/TriMeshx.h\ 800 800 ./modules/TriMeshx/TriMeshx.cpp\ 801 ./modules/TriMeshRiftsx/TriMeshRiftsx.h\ 802 ./modules/TriMeshRiftsx/TriMeshRiftsx.cpp\ 801 803 ./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h\ 802 804 ./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp\ … … 929 931 libISSMModules_a_SOURCES += $(kml_sources) 930 932 libISSMModules_a_CXXFLAGS = $(ALLCXXFLAGS) 931 endif932 933 933 934 if PYTHON … … 941 942 libISSMMatlab_a_CXXFLAGS= $(ALLCXXFLAGS) 942 943 endif 943 944 endif 944 945 #}}} 945 946 #Overload library, to overload any non-standard symbols. {{{1 -
issm/trunk-jpl/src/c/modules/TriMeshRiftsx/TriMeshRiftsx.cpp
r12060 r12061 1 /*!\file TriMesh x1 /*!\file TriMeshRiftsx 2 2 * \brief: x code for TriMesh mesher 3 3 */ 4 4 5 5 /*Header files: {{{*/ 6 #include "./TriMesh x.h"6 #include "./TriMeshRiftsx.h" 7 7 #include "../../shared/shared.h" 8 8 #include "../../include/include.h" … … 20 20 /*}}}*/ 21 21 22 23 void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order){ 22 void TriMeshRiftsx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order){ 24 23 25 24 /*indexing: */ … … 73 72 for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0; 74 73 75 76 74 /*Build segments. First figure out number of segments: holes and closed outlines have as many segments as vertices: */ 77 75 in.numberofsegments=0; … … 100 98 backcounter=counter; 101 99 } 102 103 100 104 101 /*Build regions: */ … … 116 113 117 114 /* Make necessary initializations so that Triangle can return a triangulation in `out': */ 118 119 out.pointlist = (REAL *) NULL; 120 out.pointattributelist = (REAL *) NULL; 121 out.pointmarkerlist = (int *) NULL; 122 out.trianglelist = (int *) NULL; 123 out.triangleattributelist = (REAL *) NULL; 124 out.neighborlist = (int *) NULL; 125 out.segmentlist = (int *) NULL; 126 out.segmentmarkerlist = (int *) NULL; 127 out.edgelist = (int *) NULL; 128 out.edgemarkerlist = (int *) NULL; 115 out.pointlist = (REAL*)NULL; 116 out.pointattributelist = (REAL*)NULL; 117 out.pointmarkerlist = (int *)NULL; 118 out.trianglelist = (int *)NULL; 119 out.triangleattributelist = (REAL*)NULL; 120 out.neighborlist = (int *)NULL; 121 out.segmentlist = (int *)NULL; 122 out.segmentmarkerlist = (int *)NULL; 123 out.edgelist = (int *)NULL; 124 out.edgemarkerlist = (int *)NULL; 129 125 130 126 /* Triangulate the points:. Switches are chosen to read and write a */ … … 133 129 /* produce an edge list (e), a Voronoi diagram (v), and a triangle */ 134 130 /* neighbor list (n). */ 135 136 131 sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/ 137 138 139 132 triangulate(options, &in, &out, NULL); 140 141 133 /*report(&out, 0, 1, 1, 1, 1, 0);*/ 142 143 134 144 135 /*Allocate index, x and y: */ … … 149 140 segmentmarkerlist=(double*)xmalloc(out.numberofsegments*sizeof(double)); 150 141 151 for (i = 0; i 142 for (i = 0; i< out.numberoftriangles; i++) { 152 143 for (j = 0; j < out.numberofcorners; j++) { 153 *(index+3*i+j)=(double)out.trianglelist[i * out.numberofcorners +j]+1;144 index[3*i+j]=(double)out.trianglelist[i*out.numberofcorners+j]+1; 154 145 } 155 146 } 156 for (i = 0; i < out.numberofpoints; i++){157 x[i]=out.pointlist[i * 2 +0];158 y[i]=out.pointlist[i * 2 +1];147 for (i = 0; i< out.numberofpoints; i++){ 148 x[i]=out.pointlist[i*2+0]; 149 y[i]=out.pointlist[i*2+1]; 159 150 } 160 161 for (i = 0; i < out.numberofsegments; i++) { 151 for (i = 0; i<out.numberofsegments;i++){ 162 152 segments[3*i+0]=(double)out.segmentlist[i*2+0]+1; 163 153 segments[3*i+1]=(double)out.segmentlist[i*2+1]+1; 164 154 segmentmarkerlist[i]=(double)out.segmentmarkerlist[i]; 165 155 } 166 167 168 156 169 157 /*Associate elements with segments: */ … … 174 162 OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles); 175 163 } 176 177 164 178 165 /*Output : */ … … 187 174 *py=new Vector(y,out.numberofpoints); 188 175 *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments); 189 190 176 } -
issm/trunk-jpl/src/c/modules/TriMeshRiftsx/TriMeshRiftsx.h
r12060 r12061 1 /*!\file: TriMesh x.h2 * \brief header file for TriMesh x module1 /*!\file: TriMeshRiftsx.h 2 * \brief header file for TriMeshRiftsx module 3 3 */ 4 4 5 #ifndef _TRIMESH X_H_6 #define _TRIMESH X_H_5 #ifndef _TRIMESHRIFTSX_H_ 6 #define _TRIMESHRIFTSX_H_ 7 7 8 8 #include "string.h" 9 10 9 #include "../../Container/Container.h" 11 10 #include "../../objects/objects.h" 12 11 13 12 /* local prototypes: */ 14 void TriMesh x(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order);13 void TriMeshRiftsx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order); 15 14 16 15 #endif /* _TRIMESHX_H */ -
issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp
r12056 r12061 19 19 #endif 20 20 /*}}}*/ 21 22 21 23 22 void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order){ … … 73 72 for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0; 74 73 75 76 74 /*Build segments. First figure out number of segments: holes and closed outlines have as many segments as vertices: */ 77 75 in.numberofsegments=0; … … 100 98 backcounter=counter; 101 99 } 102 103 100 104 101 /*Build regions: */ … … 116 113 117 114 /* Make necessary initializations so that Triangle can return a triangulation in `out': */ 118 119 out.pointlist = (REAL *) NULL; 120 out.pointattributelist = (REAL *) NULL; 121 out.pointmarkerlist = (int *) NULL; 122 out.trianglelist = (int *) NULL; 123 out.triangleattributelist = (REAL *) NULL; 124 out.neighborlist = (int *) NULL; 125 out.segmentlist = (int *) NULL; 126 out.segmentmarkerlist = (int *) NULL; 127 out.edgelist = (int *) NULL; 128 out.edgemarkerlist = (int *) NULL; 115 out.pointlist = (REAL*)NULL; 116 out.pointattributelist = (REAL*)NULL; 117 out.pointmarkerlist = (int *)NULL; 118 out.trianglelist = (int *)NULL; 119 out.triangleattributelist = (REAL*)NULL; 120 out.neighborlist = (int *)NULL; 121 out.segmentlist = (int *)NULL; 122 out.segmentmarkerlist = (int *)NULL; 123 out.edgelist = (int *)NULL; 124 out.edgemarkerlist = (int *)NULL; 129 125 130 126 /* Triangulate the points:. Switches are chosen to read and write a */ … … 133 129 /* produce an edge list (e), a Voronoi diagram (v), and a triangle */ 134 130 /* neighbor list (n). */ 135 136 131 sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/ 137 138 139 132 triangulate(options, &in, &out, NULL); 140 141 133 /*report(&out, 0, 1, 1, 1, 1, 0);*/ 142 143 134 144 135 /*Allocate index, x and y: */ … … 149 140 segmentmarkerlist=(double*)xmalloc(out.numberofsegments*sizeof(double)); 150 141 151 for (i = 0; i 142 for (i = 0; i< out.numberoftriangles; i++) { 152 143 for (j = 0; j < out.numberofcorners; j++) { 153 *(index+3*i+j)=(double)out.trianglelist[i * out.numberofcorners +j]+1;144 index[3*i+j]=(double)out.trianglelist[i*out.numberofcorners+j]+1; 154 145 } 155 146 } 156 for (i = 0; i < out.numberofpoints; i++){157 x[i]=out.pointlist[i * 2 +0];158 y[i]=out.pointlist[i * 2 +1];147 for (i = 0; i< out.numberofpoints; i++){ 148 x[i]=out.pointlist[i*2+0]; 149 y[i]=out.pointlist[i*2+1]; 159 150 } 160 161 for (i = 0; i < out.numberofsegments; i++) { 151 for (i = 0; i<out.numberofsegments;i++){ 162 152 segments[3*i+0]=(double)out.segmentlist[i*2+0]+1; 163 153 segments[3*i+1]=(double)out.segmentlist[i*2+1]+1; 164 154 segmentmarkerlist[i]=(double)out.segmentmarkerlist[i]; 165 155 } 166 167 168 156 169 157 /*Associate elements with segments: */ … … 174 162 OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles); 175 163 } 176 177 164 178 165 /*Output : */ … … 187 174 *py=new Vector(y,out.numberofpoints); 188 175 *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments); 189 190 176 }
Note:
See TracChangeset
for help on using the changeset viewer.