Changeset 12112
- Timestamp:
- 04/23/12 23:04:27 (13 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/configs/config-macosx64-larour-nopetsc.sh
r12102 r12112 1 1 #!/bin/sh 2 2 3 pythonversion= 2.73 pythonversion=3.2 4 4 5 5 ./configure \ -
issm/trunk-jpl/src/c/python/io/FetchPythonData.cpp
r12073 r12112 57 57 } 58 58 /*}}}*/ 59 /*FUNCTION FetchData(double** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{1*/ 60 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_matrix){ 61 62 /*output: */ 63 double* matrix=NULL; 64 int M,N; 65 int ndim; 66 npy_intp* dims=NULL; 67 68 /*retrive dimensions: */ 69 ndim=PyArray_NDIM((const PyArrayObject*)py_matrix); 70 if(ndim!=2)_error_("expecting an MxN matrix in input!"); 71 dims=PyArray_DIMS((PyArrayObject*)py_matrix); 72 M=dims[0]; N=dims[1]; 73 74 /*retrieve internal value: */ 75 matrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 76 77 /*output: */ 78 if(pM)*pM=M; 79 if(pN)*pN=N; 80 if(pmatrix)*pmatrix=matrix; 81 } 82 /*}}}*/ 59 83 60 84 /*Python version dependent: */ -
issm/trunk-jpl/src/c/python/io/WritePythonData.cpp
r12017 r12112 64 64 } 65 65 /*}}}*/ 66 /*FUNCTION WriteData(PyObject* py_tuple,int index, double* matrix, int M, int N){{{1*/ 67 void WriteData(PyObject* tuple, int index, double* matrix, int M,int N){ 68 69 npy_intp dims[2]={0,0}; 70 PyObject* array=NULL; 71 72 dims[0]=(npy_intp)M; 73 dims[1]=(npy_intp)N; 74 array=PyArray_SimpleNewFromData(2,dims,NPY_DOUBLE,matrix); 75 76 PyTuple_SetItem(tuple, index, array); 77 78 } -
issm/trunk-jpl/src/c/python/io/pythonio.h
r12011 r12112 21 21 22 22 //void WriteData(PyObject* py_tuple,DataSet* dataset); 23 //void WriteData(PyObject* py_tuple,double* matrix, int M,int N);24 23 //void WriteData(PyObject* py_tuple,int* matrix, int M,int N); 25 24 //void WriteData(PyObject* py_tuple,double* vector, int M); … … 28 27 //void WriteData(PyObject* py_tuple,double scalar); 29 28 //void WriteData(DataHandle* py_tuple,Parameters* parameters); 29 void WriteData(PyObject* py_tuple, int index, double* matrix, int M,int N); 30 30 void WriteData(PyObject* py_tuple, int index, char* string); 31 31 void WriteData(PyObject* py_tuple, int index, Matrix* matrix); … … 34 34 35 35 //void FetchData(DataSet** pdataset,PyObject* py_ref); 36 //void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_ref);37 36 //void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,PyObject* py_ref); 38 37 //void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_ref); … … 47 46 //void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,PyObject* py_ref); 48 47 //void FetchData(Parameters** pparameters, DataHandle py_ref); 48 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_array); 49 49 void FetchData(char** pstring,PyObject* py_unicode); 50 50 void FetchData(double* pscalar,PyObject* py_float); -
issm/trunk-jpl/src/m/model/mesh
- Property svn:ignore
-
old new 1 __pycache__ 1 2 Makefile.in 2 3 Makefile
-
- Property svn:ignore
-
issm/trunk-jpl/src/m/model/mesh/triangle.py
r12102 r12112 1 from TriMesh import *2 1 from numpy import * 2 import TriMesh as tm 3 import NodeConnectivity as nc 4 import ElementConnectivity as ec 3 5 4 6 def triangle(md, domainname, resolution,riftname=''): … … 32 34 33 35 #Mesh using TriMesh 34 [md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]= TriMesh(domainname,riftname,area)36 [md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]=tm.TriMesh(domainname,riftname,area) 35 37 36 38 #Fill in rest of fields: … … 46 48 47 49 #Now, build the connectivity tables for this mesh. 48 print "Node: NodeConnectivity not implemented yet!" 49 #md.mesh.vertexconnectivity = NodeConnectivity((md.mesh.elements), (md.mesh.numberofvertices)) 50 print "Node: ElementConnectivity not implemented yet!" 51 #md.mesh.elementconnectivity = ElementConnectivity((md.mesh.elements), (md.mesh.vertexconnectivity)) 50 [md.mesh.vertexconnectivity]= nc.NodeConnectivity(md.mesh.elements, md.mesh.numberofvertices) 51 [md.mesh.elementconnectivity] = ec.ElementConnectivity(md.mesh.elements, md.mesh.vertexconnectivity) 52 52 53 53 #type of model -
issm/trunk-jpl/src/modules/ElementConnectivity/ElementConnectivity.cpp
r11933 r12112 5 5 #include "./ElementConnectivity.h" 6 6 7 void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){7 WRAPPER(ElementConnectivity){ 8 8 9 9 /*inputs: */ … … 19 19 MODULEBOOT(); 20 20 21 /*checks on arguments on the matlab side: */22 C heckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ElementConnectivityUsage);21 /*checks on arguments: */ 22 CHECKARGUMENTS(NLHS,NRHS,&ElementConnectivityUsage); 23 23 24 24 /*Input datasets: */ … … 32 32 WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3); 33 33 34 /*Free ressources: */35 xfree((void**)&elements);36 xfree((void**)&nodeconnectivity);37 38 34 /*end module: */ 39 35 MODULEEND(); -
issm/trunk-jpl/src/modules/ElementConnectivity/ElementConnectivity.h
r12029 r12112 6 6 #define _ELEMENTCONNECTIVITY_H 7 7 8 /* local prototypes: */ 9 void ElementConnectivityUsage(void); 8 #ifdef HAVE_CONFIG_H 9 #include <config.h> 10 #else 11 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 12 #endif 10 13 14 /*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/ 15 #ifdef _HAVE_PYTHON_ 16 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol 17 #endif 18 19 /*Header files: */ 11 20 #include "../../c/include/globals.h" 21 #include "../../c/toolkits/toolkits.h" 22 #include "../../c/include/include.h" 12 23 #include "../../c/modules/modules.h" 13 24 #include "../../c/Container/Container.h" 14 25 #include "../../c/shared/shared.h" 15 26 #include "../../c/issm-binding.h" 27 #include "../../c/io/io.h" 28 #include "../../c/EnumDefinitions/EnumDefinitions.h" 29 30 #ifdef _HAVE_MATLAB_MODULES_ 31 /* serial input macros: */ 32 /* serial input macros: */ 33 #define ELEMENTS (mxArray*)prhs[0] 34 #define NODECONNECTIVITY (mxArray*)prhs[1] 35 /* serial output macros: */ 36 #define ELEMENTCONNECTIVITY (mxArray**)&plhs[0] 37 #endif 38 39 #ifdef _HAVE_PYTHON_MODULES_ 40 /* serial input macros: */ 41 /* serial input macros: */ 42 #define ELEMENTS PyTuple_GetItem(args,0) 43 #define NODECONNECTIVITY PyTuple_GetItem(args,1) 44 /* serial output macros: */ 45 #define ELEMENTCONNECTIVITY output,0 46 #endif 16 47 17 48 #undef __FUNCT__ 18 49 #define __FUNCT__ "ElementConnectivity" 19 20 /* serial input macros: */21 #define ELEMENTS (mxArray*)prhs[0]22 #define NODECONNECTIVITY (mxArray*)prhs[1]23 24 /* serial output macros: */25 #define ELEMENTCONNECTIVITY (mxArray**)&plhs[0]26 50 27 51 /* serial arg counts: */ … … 31 55 #define NRHS 2 32 56 57 /* local prototypes: */ 58 void ElementConnectivityUsage(void); 59 33 60 #endif /* _ELEMENTCONNECTIVITY_H */ -
issm/trunk-jpl/src/modules/NodeConnectivity/NodeConnectivity.cpp
r12029 r12112 5 5 #include "./NodeConnectivity.h" 6 6 7 void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){7 WRAPPER(NodeConnectivity){ 8 8 9 9 /*inputs: */ 10 10 double* elements=NULL; 11 int nel,nods; 11 int nel; 12 int nods; 12 13 13 14 /*outputs: */ … … 18 19 MODULEBOOT(); 19 20 20 /*checks on arguments on the matlab side: */21 C heckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&NodeConnectivityUsage);21 /*checks on arguments: */ 22 CHECKARGUMENTS(NLHS,NRHS,&NodeConnectivityUsage); 22 23 23 24 /*Input datasets: */ … … 31 32 WriteData(CONNECTIVITY,connectivity,nods,width); 32 33 33 /*Free ressources: */34 xfree((void**)&elements);35 36 34 /*end module: */ 37 35 MODULEEND(); -
issm/trunk-jpl/src/modules/NodeConnectivity/NodeConnectivity.h
r12029 r12112 6 6 #define _NODECONNECTIVITY_H 7 7 8 /* local prototypes: */ 9 void NodeConnectivityUsage(void); 8 #ifdef HAVE_CONFIG_H 9 #include <config.h> 10 #else 11 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 12 #endif 10 13 14 /*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/ 15 #ifdef _HAVE_PYTHON_ 16 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol 17 #endif 18 19 /*Header files: */ 11 20 #include "../../c/include/globals.h" 21 #include "../../c/toolkits/toolkits.h" 22 #include "../../c/include/include.h" 12 23 #include "../../c/modules/modules.h" 13 24 #include "../../c/Container/Container.h" 14 25 #include "../../c/shared/shared.h" 15 26 #include "../../c/issm-binding.h" 27 #include "../../c/io/io.h" 28 #include "../../c/EnumDefinitions/EnumDefinitions.h" 29 30 #ifdef _HAVE_MATLAB_MODULES_ 31 /* serial input macros: */ 32 #define ELEMENTS (mxArray*)prhs[0] 33 #define NUMNODES (mxArray*)prhs[1] 34 /* serial output macros: */ 35 #define CONNECTIVITY (mxArray**)&plhs[0] 36 #endif 37 38 #ifdef _HAVE_PYTHON_MODULES_ 39 /* serial input macros: */ 40 #define ELEMENTS PyTuple_GetItem(args,0) 41 #define NUMNODES PyTuple_GetItem(args,1) 42 /* serial output macros: */ 43 #define CONNECTIVITY output,0 44 #endif 16 45 17 46 #undef __FUNCT__ 18 47 #define __FUNCT__ "NodeConnectivity" 19 20 /* serial input macros: */21 #define ELEMENTS (mxArray*)prhs[0]22 #define NUMNODES (mxArray*)prhs[1]23 24 /* serial output macros: */25 #define CONNECTIVITY (mxArray**)&plhs[0]26 48 27 49 /* serial arg counts: */ … … 31 53 #define NRHS 2 32 54 55 /* local prototypes: */ 56 void NodeConnectivityUsage(void); 57 33 58 #endif /* _NODECONNECTIVITY_H */ -
issm/trunk-jpl/src/modules/TriMesh/TriMesh.cpp
r12098 r12112 26 26 MODULEBOOT(); 27 27 28 /*checks on arguments on the matlab side: */28 /*checks on arguments: */ 29 29 CHECKARGUMENTS(NLHS,NRHS,&TriMeshUsage); 30 30 -
issm/trunk-jpl/src/modules/python/Makefile.am
r12075 r12112 3 3 #Bin programs {{{1 4 4 if MODULES 5 bin_PROGRAMS = TriMesh 5 bin_PROGRAMS = TriMesh \ 6 NodeConnectivity \ 7 ElementConnectivity 6 8 endif 7 9 #}}} … … 26 28 #}}} 27 29 #Bin sources {{{1 30 ElementConnectivity_SOURCES = ../ElementConnectivity/ElementConnectivity.cpp\ 31 ../ElementConnectivity/ElementConnectivity.h 32 33 NodeConnectivity_SOURCES = ../NodeConnectivity/NodeConnectivity.cpp\ 34 ../NodeConnectivity/NodeConnectivity.h 35 28 36 TriMesh_SOURCES = ../TriMesh/TriMesh.cpp\ 29 37 ../TriMesh/TriMesh.h -
issm/trunk-jpl/startup.py
r12102 r12112 83 83 from private import * 84 84 from triangle import * 85 from setmask import * 85 86 86 87 #}}} -
issm/trunk-jpl/test/NightlyRun/test102.py
r12111 r12112 1 1 from model import * 2 2 from triangle import * 3 from setmask import * 3 4 4 5 md=model(); 5 6 md=triangle(md,'../Exp/Square.exp',150000); 7 md=setmask(md,'all','');
Note:
See TracChangeset
for help on using the changeset viewer.