source:
issm/oecreview/Archive/20496-20544/ISSM-20502-20503.diff
Last change on this file was 20545, checked in by , 9 years ago | |
---|---|
File size: 7.2 KB |
-
../trunk-jpl/src/c/modules/TriaSearchx/TriaSearchx.cpp
1 /*!\file TriaSearchx2 */3 4 #include "./TriaSearchx.h"5 6 #include "../../shared/shared.h"7 #include "../../toolkits/toolkits.h"8 #include "../../bamg/bamgobjects.h"9 10 using namespace bamg;11 using namespace std;12 13 void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes){14 15 /*Output*/16 double* tria=NULL;17 18 /*allocate: */19 tria=xNew<double>(numberofnodes);20 21 /*Intermediary*/22 R2 r;23 I2 I;24 int i;25 Icoor2 dete[3];26 27 /* read background mesh */28 Mesh Th(index,x,y,nods,nel);29 Th.CreateSingleVertexToTriangleConnectivity();30 31 for(i=0;i<numberofnodes;i++){32 33 //Get current point coordinates34 r.x=x0[i]; r.y=y0[i];35 36 I=Th.R2ToI2(r);37 38 //Find triangle holding r/I39 Triangle &tb=*Th.TriangleFindFromCoord(I,dete);40 41 // internal point42 if (Th.GetId(tb)<nel)tria[i]=(double)Th.GetId(tb);43 //external point44 else tria[i]=NAN;45 }46 47 /*Assign output pointers:*/48 *ptria=tria;49 } -
../trunk-jpl/src/c/modules/TriaSearchx/TriaSearchx.h
1 /*!\file: TriaSearchx.h2 * \brief header file for Bamg module3 */4 5 #ifndef _TRIASEARCHX_H6 #define _TRIASEARCHX_H7 8 #include "../../classes/classes.h"9 10 /* local prototypes: */11 void TriaSearchx(double** ptria,int* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofnodes);12 13 #endif -
../trunk-jpl/src/c/modules/modules.h
88 88 #include "./SystemMatricesx/SystemMatricesx.h" 89 89 #include "./SpcNodesx/SpcNodesx.h" 90 90 #include "./SurfaceAreax/SurfaceAreax.h" 91 #include "./TriaSearchx/TriaSearchx.h"92 91 #include "./TriMeshx/TriMeshx.h" 93 92 #include "./TriMeshProcessRiftsx/TriMeshProcessRiftsx.h" 94 93 #include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h" -
../trunk-jpl/src/c/Makefile.am
533 533 ./shared/TriMesh/OrderSegments.cpp\ 534 534 ./shared/TriMesh/SplitMeshForRifts.cpp\ 535 535 ./shared/TriMesh/TriMeshUtils.cpp\ 536 ./modules/TriaSearchx/TriaSearchx.cpp\537 536 ./modules/TriMeshx/TriMeshx.cpp\ 538 537 ./modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.cpp\ 539 538 ./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp\ -
../trunk-jpl/src/wrappers/TriaSearch/TriaSearch.h
1 /*!\file TriaSearch.h2 */3 4 #ifndef _TRIASEARCH_H5 #define _TRIASEARCH_H6 7 #ifdef HAVE_CONFIG_H8 #include <config.h>9 #else10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"11 #endif12 13 /*For python modules: needs to come before header files inclusion*/14 #ifdef _HAVE_PYTHON_15 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol16 #endif17 18 #include "../bindings.h"19 #include "../../c/main/globals.h"20 #include "../../c/modules/modules.h"21 #include "../../c/shared/shared.h"22 23 #undef __FUNCT__24 #define __FUNCT__ "TriaSearch"25 26 #ifdef _HAVE_MATLAB_MODULES_27 /* serial input macros: */28 #define INDEXHANDLE prhs[0]29 #define XHANDLE prhs[1]30 #define YHANDLE prhs[2]31 #define X0HANDLE prhs[3]32 #define Y0HANDLE prhs[4]33 34 /* serial output macros: */35 #define TRIA (mxArray**)&plhs[0]36 #endif37 38 #ifdef _HAVE_PYTHON_MODULES_39 /* serial input macros: */40 #define INDEXHANDLE PyTuple _GetItem(args,0)41 #define XHANDLE PyTuple _GetItem(args,1)42 #define YHANDLE PyTuple _GetItem(args,2)43 #define X0HANDLE PyTuple _GetItem(args,3)44 #define Y0HANDLE PyTuple _GetItem(args,4)45 46 /* serial output macros: */47 #define TRIA output,048 #endif49 50 /* serial arg counts: */51 #undef NLHS52 #define NLHS 153 #undef NRHS54 #define NRHS 555 56 #endif -
../trunk-jpl/src/wrappers/TriaSearch/TriaSearch.cpp
1 /*\file TriaSearch.c2 *\brief: TriaSearch module. See TriaSearchx for more details.3 */4 #include "./TriaSearch.h"5 6 void TriaSearchUsage(void){/*{{{*/7 _printf0_("TriaSearch- find triangle holding a point (x0,y0) in a mesh\n");8 _printf0_("\n");9 _printf0_(" Usage:\n");10 _printf0_(" tria=TriaSearch(index,x,y,x0,y0);\n");11 _printf0_(" index,x,y: mesh triangulatrion\n");12 _printf0_(" x0,y0: coordinates of the point for which we are trying to find a triangle\n");13 _printf0_(" x0,y0 can be an array of points\n");14 _printf0_("\n");15 }/*}}}*/16 WRAPPER(TriaSearch){17 18 int i;19 20 /*input: */21 int* index=NULL;22 int nel;23 int dummy;24 25 double* x=NULL;26 double* y=NULL;27 int nods;28 29 double* x0=NULL;30 double* y0=NULL;31 int numberofnodes;32 33 /* output: */34 double* tria=NULL;35 36 /*Boot module: */37 MODULEBOOT();38 39 /*checks on arguments on the matlab side: */40 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&TriaSearchUsage);41 42 /*Input datasets: */43 FetchData(&index,&nel,&dummy,INDEXHANDLE);44 FetchData(&x,&nods,XHANDLE);45 FetchData(&y,&nods,YHANDLE);46 FetchData(&x0,&numberofnodes,X0HANDLE);47 FetchData(&y0,&numberofnodes,Y0HANDLE);48 49 /* Run core computations: */50 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes);51 52 /* c to matlab: */53 for(i=0;i<numberofnodes;i++)tria[i]++;54 55 /*Write data: */56 WriteData(TRIA,tria,numberofnodes);57 58 /*Cleanup*/59 xDelete<int>(index);60 xDelete<double>(x);61 xDelete<double>(y);62 xDelete<double>(x0);63 xDelete<double>(y0);64 xDelete<double>(tria);65 66 /*end module: */67 MODULEEND();68 } -
../trunk-jpl/src/wrappers/matlab/Makefile.am
60 60 PointCloudFindNeighbors.la\ 61 61 PropagateFlagsFromConnectivity.la\ 62 62 StringToEnum.la\ 63 TriaSearch.la\64 63 TriMesh.la\ 65 64 TriMeshProcessRifts.la\ 66 65 Scotch.la\ … … 249 248 Shp2Kml_la_SOURCES = ../Shp2Kml/Shp2Kml.cpp 250 249 Shp2Kml_la_LIBADD = ${deps} $(SHAPELIBLIB) $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB) 251 250 252 TriaSearch_la_SOURCES = ../TriaSearch/TriaSearch.cpp253 TriaSearch_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)254 255 251 TriMesh_la_SOURCES = ../TriMesh/TriMesh.cpp 256 252 TriMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(TRIANGLELIB) $(GSLLIB) $(PROJ4LIB) 257 253
Note:
See TracBrowser
for help on using the repository browser.