Changeset 10205
- Timestamp:
- 10/13/11 16:47:11 (13 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 6 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r10188 r10205 684 684 ./modules/BamgConvertMeshx/BamgConvertMeshx.cpp\ 685 685 ./modules/BamgConvertMeshx/BamgConvertMeshx.h\ 686 ./modules/BamgTriangulatex/BamgTriangulatex.cpp\ 687 ./modules/BamgTriangulatex/BamgTriangulatex.h\ 686 688 ./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp\ 687 689 ./modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h\ -
issm/trunk/src/c/io/Matlab/WriteMatlabData.cpp
r9320 r10205 81 81 } 82 82 /*}}}*/ 83 /*FUNCTION WriteMatlabData(mxArray** pdataref,int* matrix, int M,int N){{{1*/ 84 void WriteMatlabData(mxArray** pdataref,int* matrix, int M,int N){ 85 86 mxArray* dataref=NULL; 87 mxArray* tdataref=NULL; 88 89 if(matrix){ 90 91 /*convert to double matrix*/ 92 double* doublematrix=(double*)xmalloc(M*N*sizeof(double)); 93 for(int i=0;i<M*N;i++) doublematrix[i]=(double)matrix[i]; 94 95 /*data is a double* pointer. Copy into a matrix: */ 96 tdataref = mxCreateDoubleMatrix(0,0,mxREAL); 97 mxSetM(tdataref,(mwSize)N); 98 mxSetN(tdataref,(mwSize)M); 99 mxSetPr(tdataref,(double*)doublematrix); 100 101 //transpose 102 mexCallMATLAB(1,&dataref,1,&tdataref, "transpose"); 103 } 104 else{ 105 dataref = mxCreateDoubleMatrix(0,0,mxREAL); 106 } 107 *pdataref=dataref; 108 } 109 /*}}}*/ 83 110 /*FUNCTION WriteMatlabData(mxArray** pdataref,Vec vector){{{1*/ 84 111 void WriteMatlabData(mxArray** pdataref,Vec vector){ -
issm/trunk/src/c/io/Matlab/matlabio.h
r8910 r10205 18 18 void WriteMatlabData(mxArray** pdataref,Mat matrix); 19 19 void WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N); 20 void WriteMatlabData(mxArray** pdataref,int* matrix, int M,int N); 20 21 void WriteMatlabData(mxArray** pdataref,Vec vector); 21 22 void WriteMatlabData(mxArray** pdataref,double* vector, int M); -
issm/trunk/src/c/modules/modules.h
r9880 r10205 12 12 #include "./Bamgx/Bamgx.h" 13 13 #include "./BamgConvertMeshx/BamgConvertMeshx.h" 14 #include "./BamgTriangulatex/BamgTriangulatex.h" 14 15 #include "./Chacox/Chacox.h" 15 16 #include "./ComputeBasalStressx/ComputeBasalStressx.h" -
issm/trunk/src/c/objects/Bamg/Mesh.cpp
r9309 r10205 48 48 SetIntCoor(); 49 49 ReconstructExistingMesh(); 50 } 51 /*}}}1*/ 52 /*FUNCTION Mesh::Mesh(double* x,double* y,int nods){{{1*/ 53 Mesh::Mesh(double* x,double* y,int nods):Gh(*(new Geometry())),BTh(*this){ 54 Triangulate(x,y,nods); 50 55 } 51 56 /*}}}1*/ … … 998 1003 bamgopts->metric[i*3+2]=vertices[i].m.a22; 999 1004 } 1005 } 1006 /*}}}1*/ 1007 /*FUNCTION Mesh::WriteIndex{{{1*/ 1008 void Mesh::WriteIndex(int** pindex,int* pnels){ 1009 1010 /*Intermediary*/ 1011 int i,k,num; 1012 int verbose=0; 1013 1014 /*output*/ 1015 int* index=NULL; 1016 1017 /*Get number of triangles*/ 1018 k=0; 1019 for (i=0;i<nbt;i++){ 1020 Triangle &t=triangles[i]; 1021 if(t.det>0) k++; 1022 } 1023 1024 if (k){ 1025 index=(int*)xmalloc(3*k*sizeof(double)); 1026 num=0; 1027 for (i=0;i<nbt;i++){ 1028 Triangle &t=triangles[i]; 1029 if (t.det>0 && !(t.Hidden(0)||t.Hidden(1) || t.Hidden(2) )){ 1030 index[num*3+0]=GetId(t[0])+1; //back to M indexing 1031 index[num*3+1]=GetId(t[1])+1; //back to M indexing 1032 index[num*3+2]=GetId(t[2])+1; //back to M indexing 1033 num=num+1; 1034 } 1035 } 1036 } 1037 1038 /*Assign output pointers*/ 1039 *pindex=index; 1040 *pnels=k; 1000 1041 } 1001 1042 /*}}}1*/ … … 4888 4929 } 4889 4930 /*}}}1*/ 4931 /*FUNCTION Mesh::Triangulate{{{1*/ 4932 void Mesh::Triangulate(double* x,double* y,int nods){ 4933 4934 int verbose=0; 4935 int i; 4936 Metric M1(1); 4937 4938 /*Initialize mesh*/ 4939 Init(nods);//this resets nbv to 0 4940 nbv=nods; 4941 4942 //Vertices 4943 if(verbose) printf("Reading vertices (%i)\n",nbv); 4944 for (i=0;i<nbv;i++){ 4945 vertices[i].r.x=x[i]; 4946 vertices[i].r.y=y[i]; 4947 vertices[i].ReferenceNumber=1; 4948 vertices[i].DirOfSearch =NoDirOfSearch; 4949 vertices[i].m=M1; 4950 vertices[i].color=0; 4951 } 4952 maxnbt=2*maxnbv-2; // for filling The Holes and quadrilaterals 4953 4954 /*Insert Vertices*/ 4955 Insert(); 4956 } 4957 /*}}}1*/ 4890 4958 /*FUNCTION Mesh::TriangulateFromGeom0{{{1*/ 4891 4959 void Mesh::TriangulateFromGeom0(BamgOpts* bamgopts){ … … 4900 4968 const int MaxSubEdge = 10; 4901 4969 4902 R2 4970 R2 AB; 4903 4971 GeomVertex *a, *b; 4904 BamgVertex *va,*vb;4972 BamgVertex *va,*vb; 4905 4973 GeomEdge *e; 4906 4974 -
issm/trunk/src/c/objects/Bamg/Mesh.h
r8722 r10205 57 57 //Constructors/Destructors 58 58 Mesh(BamgGeom* bamggeom,BamgMesh* bamgmesh,BamgOpts* bamgopts); 59 Mesh(double* index,double* x,double* y,int nods,int nels); 59 Mesh(double* index,double* x,double* y,int nods,int nels);/*MeshConvert*/ 60 Mesh(double* x,double* y,int nods); /*BamgTriangulate*/ 60 61 Mesh(Mesh &,Geometry * pGh=0,Mesh* pBTh=0,long maxnbv_in=0 ); //copy operator 61 62 Mesh(const Mesh &,const int *flag,const int *bb,BamgOpts* bamgopts); // truncature … … 114 115 void ReadMetric(const BamgOpts* bamgopts); 115 116 void WriteMetric(BamgOpts* bamgopts); 117 void WriteIndex(int** pindex,int* pnels); 116 118 void AddMetric(BamgOpts* bamgopts); 117 119 void BuildMetric0(BamgOpts* bamgopts); … … 146 148 void TriangulateFromGeom1(BamgOpts* bamgopts,int KeepVertices=1);// the real constructor mesh adaption 147 149 void TriangulateFromGeom0(BamgOpts* bamgopts);// the real constructor mesh generator 150 void Triangulate(double* x,double* y,int nods); 148 151 void Init(long); 149 152 }; -
issm/trunk/src/mex/Makefile.am
r9788 r10205 10 10 BamgMesher\ 11 11 BamgConvertMesh\ 12 BamgTriangulate\ 12 13 Chaco\ 13 14 ComputeBasalStress\ … … 128 129 BamgConvertMesh/BamgConvertMesh.h 129 130 131 BamgTriangulate_SOURCES = BamgTriangulate/BamgTriangulate.cpp\ 132 BamgTriangulate/BamgTriangulate.h 133 130 134 Chaco_SOURCES = Chaco/Chaco.cpp\ 131 135 Chaco/Chaco.h -
issm/trunk/src/mex/Test/Test.cpp
r8247 r10205 7 7 void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){ 8 8 9 Options *options = NULL; 10 double test; 11 char *name = NULL; 12 bool logical; 13 double *matrix = NULL; 14 int numel; 9 char *string = NULL; 10 PetscErrorCode ierr; 15 11 16 MODULEBOOT(); 17 MODULEEND(); 12 FetchMatlabData(&string,STRING); 13 14 if (!strcmp(string,"Init")){ 15 ierr=PetscInitializeNoArguments(); 16 ierr=PetscPopSignalHandler(); 17 } 18 else if(!strcmp(string,"Finalize")) { 19 ierr=PetscFinalize(); 20 } 21 else{ 22 printf("NOTHING to be done\n"); 23 } 18 24 } 19 25 -
issm/trunk/src/mex/Test/Test.h
r4236 r10205 14 14 15 15 /* serial input macros: */ 16 #define DATASET(mxArray*)prhs[0]16 #define STRING (mxArray*)prhs[0] 17 17 18 18 /* serial arg counts: */
Note:
See TracChangeset
for help on using the changeset viewer.