source: issm/oecreview/Archive/20496-20544/ISSM-20502-20503.diff

Last change on this file was 20545, checked in by Mathieu Morlighem, 9 years ago

CHG: new quick sync to fix examples in trunk

File size: 7.2 KB
  • ../trunk-jpl/src/c/modules/TriaSearchx/TriaSearchx.cpp

     
    1 /*!\file TriaSearchx
    2  */
    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 coordinates
    34                 r.x=x0[i]; r.y=y0[i];
    35 
    36                 I=Th.R2ToI2(r);
    37 
    38                 //Find triangle holding r/I
    39                 Triangle &tb=*Th.TriangleFindFromCoord(I,dete);
    40 
    41                 // internal point
    42                 if (Th.GetId(tb)<nel)tria[i]=(double)Th.GetId(tb);
    43                 //external point
    44                 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.h
    2  * \brief header file for Bamg module
    3  */
    4 
    5 #ifndef _TRIASEARCHX_H
    6 #define _TRIASEARCHX_H
    7 
    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

     
    8888#include "./SystemMatricesx/SystemMatricesx.h"
    8989#include "./SpcNodesx/SpcNodesx.h"
    9090#include "./SurfaceAreax/SurfaceAreax.h"
    91 #include "./TriaSearchx/TriaSearchx.h"
    9291#include "./TriMeshx/TriMeshx.h"
    9392#include "./TriMeshProcessRiftsx/TriMeshProcessRiftsx.h"
    9493#include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h"
  • ../trunk-jpl/src/c/Makefile.am

     
    533533                        ./shared/TriMesh/OrderSegments.cpp\
    534534                        ./shared/TriMesh/SplitMeshForRifts.cpp\
    535535                        ./shared/TriMesh/TriMeshUtils.cpp\
    536                         ./modules/TriaSearchx/TriaSearchx.cpp\
    537536                        ./modules/TriMeshx/TriMeshx.cpp\
    538537                        ./modules/TriMeshProcessRiftsx/TriMeshProcessRiftsx.cpp\
    539538                        ./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp\
  • ../trunk-jpl/src/wrappers/TriaSearch/TriaSearch.h

     
    1 /*!\file TriaSearch.h
    2  */
    3 
    4 #ifndef _TRIASEARCH_H
    5 #define _TRIASEARCH_H
    6 
    7 #ifdef HAVE_CONFIG_H
    8         #include <config.h>
    9 #else
    10         #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    11 #endif
    12 
    13 /*For python modules: needs to come before header files inclusion*/
    14 #ifdef _HAVE_PYTHON_
    15 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
    16 #endif
    17 
    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 #endif
    37 
    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,0
    48 #endif
    49 
    50 /* serial arg counts: */
    51 #undef NLHS
    52 #define NLHS  1
    53 #undef NRHS
    54 #define NRHS  5
    55 
    56 #endif
  • ../trunk-jpl/src/wrappers/TriaSearch/TriaSearch.cpp

     
    1 /*\file TriaSearch.c
    2  *\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

     
    6060                                                 PointCloudFindNeighbors.la\
    6161                                                 PropagateFlagsFromConnectivity.la\
    6262                                                 StringToEnum.la\
    63                                                  TriaSearch.la\
    6463                                                 TriMesh.la\
    6564                                                 TriMeshProcessRifts.la\
    6665                                                 Scotch.la\
     
    249248Shp2Kml_la_SOURCES = ../Shp2Kml/Shp2Kml.cpp
    250249Shp2Kml_la_LIBADD = ${deps} $(SHAPELIBLIB) $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
    251250
    252 TriaSearch_la_SOURCES = ../TriaSearch/TriaSearch.cpp
    253 TriaSearch_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(PROJ4LIB)
    254 
    255251TriMesh_la_SOURCES = ../TriMesh/TriMesh.cpp
    256252TriMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(TRIANGLELIB) $(GSLLIB) $(PROJ4LIB)
    257253
Note: See TracBrowser for help on using the repository browser.