Changeset 24304
- Timestamp:
- 10/31/19 12:37:11 (5 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/jenkins/linux64_ross_javascript
r23166 r24304 5 5 6 6 #ISSM CONFIGURATION 7 ISSM_CONFIG='--prefix="$ISSM_DIR" \ 7 ISSM_CONFIG='\ 8 --prefix="${ISSM_DIR}" \ 8 9 --disable-shared \ 9 10 --with-javascript \ 10 --with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install-javascript" \11 --with-gsl-dir="$ISSM_DIR/externalpackages/gsl/install-javascript" \12 11 --without-Love \ 13 12 --without-kml \ 14 13 --without-kriging \ 15 --with- cxxoptflags="-O2" \16 CXXFLAGS="-O2"\17 CFLAGS="-O2"'14 --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install-javascript" \ 15 --with-gsl-dir="$ISSM_DIR/externalpackages/gsl/install-javascript"\ 16 ' 18 17 19 18 #PYTHON and MATLAB testing … … 21 20 PYTHON_TEST=0 22 21 JAVASCRIPT_TEST=1 22 23 # Environment 24 #export EMCC_DEBUG=1 # Uncomment to enable debugging 25 export EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" # Required after v1.38.14 23 26 24 27 #-----------------------------------# -
issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.h
r24011 r24304 22 22 #include "../bindings.h" 23 23 24 #undef __FUNCT__ 24 #undef __FUNCT__ 25 25 #define __FUNCT__ "BamgMesher" 26 26 … … 49 49 #define BAMGMESHIN VerticesSize_mesh_in, Vertices_mesh_in, EdgesSize_mesh_in, Edges_mesh_in, TrianglesSize_mesh_in, Triangles_mesh_in, CrackedEdgesSize_mesh_in, CrackedEdges_mesh_in, VerticesOnGeomEdgeSize_mesh_in, VerticesOnGeomEdge_mesh_in, VerticesOnGeomVertexSize_mesh_in, VerticesOnGeomVertex_mesh_in, EdgesOnGeomEdgeSize_mesh_in, EdgesOnGeomEdge_mesh_in, IssmSegmentsSize_mesh_in, IssmSegments_mesh_in 50 50 #define BAMGGEOMIN VerticesSize_geom_in, Vertices_geom_in, EdgesSize_geom_in, Edges_geom_in, CornersSize_geom_in, Corners_geom_in, RequiredVerticesSize_geom_in, RequiredVertices_geom_in, RequiredEdgesSize_geom_in, RequiredEdges_geom_in, CrackedEdgesSize_geom_in, CrackedEdges_geom_in, SubDomainsSize_geom_in, SubDomains_geom_in 51 #define BAMGOPTIONS anisomax, cutoff, coeff, errg, gradation, Hessiantype, maxnbv, maxsubdiv, Metrictype, nbjacobi, nbsmooth, omega, power, verbose, Crack, KeepVertices, splitcorners, hmin, hmax, hminVerticesSize, hminVertices, hmaxVerticesSize, hmaxVertices, hVertices Size, hVertices, metricSize, metric, fieldSize, field, errSize, err51 #define BAMGOPTIONS anisomax, cutoff, coeff, errg, gradation, Hessiantype, maxnbv, maxsubdiv, Metrictype, nbjacobi, nbsmooth, omega, power, verbose, Crack, KeepVertices, splitcorners, hmin, hmax, hminVerticesSize, hminVertices, hmaxVerticesSize, hmaxVertices, hVerticesLength, hVertices, metricSize, metric, fieldSize, field, errSize, err 52 52 /* serial output macros: */ 53 53 #define BAMGMESHOUT VerticesSize_mesh_out, Vertices_mesh_out, EdgesSize_mesh_out, Edges_mesh_out, TrianglesSize_mesh_out, Triangles_mesh_out, IssmEdgesSize_mesh_out, IssmEdges_mesh_out, IssmSegmentsSize_mesh_out, IssmSegments_mesh_out, VerticesOnGeomVertexSize_mesh_out, VerticesOnGeomVertex_mesh_out, VerticesOnGeomEdgeSize_mesh_out, VerticesOnGeomEdge_mesh_out, EdgesOnGeomEdgeSize_mesh_out, EdgesOnGeomEdge_mesh_out, SubDomainsSize_mesh_out, SubDomains_mesh_out, SubDomainsFromGeomSize_mesh_out, SubDomainsFromGeom_mesh_out, ElementConnectivitySize_mesh_out, ElementConnectivity_mesh_out, NodalConnectivitySize_mesh_out, NodalConnectivity_mesh_out, NodalElementConnectivitySize_mesh_out, NodalElementConnectivity_mesh_out, CrackedVerticesSize_mesh_out, CrackedVertices_mesh_out, CrackedEdgesSize_mesh_out, CrackedEdges_mesh_out, PreviousNumberingSize_mesh_out, PreviousNumbering_mesh_out 54 54 #define BAMGGEOMOUT VerticesSize_geom_out, Vertices_geom_out, EdgesSize_geom_out, Edges_geom_out, CornersSize_geom_out, Corners_geom_out, RequiredVerticesSize_geom_out, RequiredVertices_geom_out, RequiredEdgesSize_geom_out, RequiredEdges_geom_out, CrackedEdgesSize_geom_out, CrackedEdges_geom_out, SubDomainsSize_geom_out, SubDomains_geom_out 55 #define WRAPPER(modulename) extern "C" { int BamgMesherModule(int** VerticesSize_mesh_out, double** Vertices_mesh_out, int** EdgesSize_mesh_out, double** Edges_mesh_out, int** TrianglesSize_mesh_out, double** Triangles_mesh_out, int** IssmEdgesSize_mesh_out, double** IssmEdges_mesh_out, int** IssmSegmentsSize_mesh_out, double** IssmSegments_mesh_out, int** VerticesOnGeomVertexSize_mesh_out, double** VerticesOnGeomVertex_mesh_out, int** VerticesOnGeomEdgeSize_mesh_out, double** VerticesOnGeomEdge_mesh_out, int** EdgesOnGeomEdgeSize_mesh_out, double** EdgesOnGeomEdge_mesh_out, int** SubDomainsSize_mesh_out, double** SubDomains_mesh_out, int** SubDomainsFromGeomSize_mesh_out, double** SubDomainsFromGeom_mesh_out, int** ElementConnectivitySize_mesh_out, double** ElementConnectivity_mesh_out, int** NodalConnectivitySize_mesh_out, double** NodalConnectivity_mesh_out, int** NodalElementConnectivitySize_mesh_out, double** NodalElementConnectivity_mesh_out, int** CrackedVerticesSize_mesh_out, double** CrackedVertices_mesh_out, int** CrackedEdgesSize_mesh_out, double** CrackedEdges_mesh_out, int** PreviousNumberingSize_mesh_out, double** PreviousNumbering_mesh_out, int** VerticesSize_geom_out, double** Vertices_geom_out, int** EdgesSize_geom_out, double** Edges_geom_out, int** CornersSize_geom_out, double** Corners_geom_out, int** RequiredVerticesSize_geom_out, double** RequiredVertices_geom_out, int** RequiredEdgesSize_geom_out, double** RequiredEdges_geom_out, int** CrackedEdgesSize_geom_out, double** CrackedEdges_geom_out, int** SubDomainsSize_geom_out, double** SubDomains_geom_out, int* VerticesSize_mesh_in, double* Vertices_mesh_in, int* EdgesSize_mesh_in, double* Edges_mesh_in, int* TrianglesSize_mesh_in, double* Triangles_mesh_in, int* CrackedEdgesSize_mesh_in, double* CrackedEdges_mesh_in, int* VerticesOnGeomEdgeSize_mesh_in, double* VerticesOnGeomEdge_mesh_in, int* VerticesOnGeomVertexSize_mesh_in, double* VerticesOnGeomVertex_mesh_in, int* EdgesOnGeomEdgeSize_mesh_in, double* EdgesOnGeomEdge_mesh_in, int* IssmSegmentsSize_mesh_in, double* IssmSegments_mesh_in, int* VerticesSize_geom_in, double* Vertices_geom_in, int* EdgesSize_geom_in, double* Edges_geom_in, int* CornersSize_geom_in, double* Corners_geom_in, int* RequiredVerticesSize_geom_in, double* RequiredVertices_geom_in, int* RequiredEdgesSize_geom_in, double* RequiredEdges_geom_in, int* CrackedEdgesSize_geom_in, double* CrackedEdges_geom_in, int* SubDomainsSize_geom_in, double* SubDomains_geom_in, double anisomax, double cutoff, double coeff, double errg, double gradation, int Hessiantype, int maxnbv, double maxsubdiv, int Metrictype, int nbjacobi, int nbsmooth, double omega, double power, int verbose, int Crack, int KeepVertices, int splitcorners, double hmin, double hmax, int* hminVerticesSize, double* hminVertices, int* hmaxVerticesSize, double* hmaxVertices, int * hVerticesSize, double* hVertices, int* metricSize, double* metric, int* fieldSize, double* field, int* errSize, double* err)55 #define WRAPPER(modulename) extern "C" { int BamgMesherModule(int** VerticesSize_mesh_out, double** Vertices_mesh_out, int** EdgesSize_mesh_out, double** Edges_mesh_out, int** TrianglesSize_mesh_out, double** Triangles_mesh_out, int** IssmEdgesSize_mesh_out, double** IssmEdges_mesh_out, int** IssmSegmentsSize_mesh_out, double** IssmSegments_mesh_out, int** VerticesOnGeomVertexSize_mesh_out, double** VerticesOnGeomVertex_mesh_out, int** VerticesOnGeomEdgeSize_mesh_out, double** VerticesOnGeomEdge_mesh_out, int** EdgesOnGeomEdgeSize_mesh_out, double** EdgesOnGeomEdge_mesh_out, int** SubDomainsSize_mesh_out, double** SubDomains_mesh_out, int** SubDomainsFromGeomSize_mesh_out, double** SubDomainsFromGeom_mesh_out, int** ElementConnectivitySize_mesh_out, double** ElementConnectivity_mesh_out, int** NodalConnectivitySize_mesh_out, double** NodalConnectivity_mesh_out, int** NodalElementConnectivitySize_mesh_out, double** NodalElementConnectivity_mesh_out, int** CrackedVerticesSize_mesh_out, double** CrackedVertices_mesh_out, int** CrackedEdgesSize_mesh_out, double** CrackedEdges_mesh_out, int** PreviousNumberingSize_mesh_out, double** PreviousNumbering_mesh_out, int** VerticesSize_geom_out, double** Vertices_geom_out, int** EdgesSize_geom_out, double** Edges_geom_out, int** CornersSize_geom_out, double** Corners_geom_out, int** RequiredVerticesSize_geom_out, double** RequiredVertices_geom_out, int** RequiredEdgesSize_geom_out, double** RequiredEdges_geom_out, int** CrackedEdgesSize_geom_out, double** CrackedEdges_geom_out, int** SubDomainsSize_geom_out, double** SubDomains_geom_out, int* VerticesSize_mesh_in, double* Vertices_mesh_in, int* EdgesSize_mesh_in, double* Edges_mesh_in, int* TrianglesSize_mesh_in, double* Triangles_mesh_in, int* CrackedEdgesSize_mesh_in, double* CrackedEdges_mesh_in, int* VerticesOnGeomEdgeSize_mesh_in, double* VerticesOnGeomEdge_mesh_in, int* VerticesOnGeomVertexSize_mesh_in, double* VerticesOnGeomVertex_mesh_in, int* EdgesOnGeomEdgeSize_mesh_in, double* EdgesOnGeomEdge_mesh_in, int* IssmSegmentsSize_mesh_in, double* IssmSegments_mesh_in, int* VerticesSize_geom_in, double* Vertices_geom_in, int* EdgesSize_geom_in, double* Edges_geom_in, int* CornersSize_geom_in, double* Corners_geom_in, int* RequiredVerticesSize_geom_in, double* RequiredVertices_geom_in, int* RequiredEdgesSize_geom_in, double* RequiredEdges_geom_in, int* CrackedEdgesSize_geom_in, double* CrackedEdges_geom_in, int* SubDomainsSize_geom_in, double* SubDomains_geom_in, double anisomax, double cutoff, double coeff, double errg, double gradation, int Hessiantype, int maxnbv, double maxsubdiv, int Metrictype, int nbjacobi, int nbsmooth, double omega, double power, int verbose, int Crack, int KeepVertices, int splitcorners, double hmin, double hmax, int* hminVerticesSize, double* hminVertices, int* hmaxVerticesSize, double* hmaxVertices, int hVerticesLength, double* hVertices, int* metricSize, double* metric, int* fieldSize, double* field, int* errSize, double* err) 56 56 57 57 #endif -
issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.js
r22906 r24304 1 1 function doublesToHeap(array) { 2 2 var doubleArray = new Float64Array(array); 3 3 var numBytes = doubleArray.length * doubleArray.BYTES_PER_ELEMENT; 4 4 var doubleArrayPtr = Module._malloc(numBytes); 5 5 var doubleArrayHeap = new Uint8Array(Module.HEAPU8.buffer, doubleArrayPtr, numBytes); 6 6 doubleArrayHeap.set(new Uint8Array(doubleArray.buffer)); 7 7 return doubleArrayHeap.byteOffset; 8 8 } 9 9 function intsToHeap(array) { 10 10 var intArray = new Int32Array(array); 11 11 var numBytes = intArray.length * intArray.BYTES_PER_ELEMENT; 12 12 var intArrayPtr = Module._malloc(numBytes); 13 13 var intArrayHeap = new Uint8Array(Module.HEAPU8.buffer, intArrayPtr, numBytes); 14 14 intArrayHeap.set(new Uint8Array(intArray.buffer)); 15 15 return intArrayHeap.byteOffset; 16 16 } 17 17 function heapToDoubles(pptr, size) { 18 19 20 18 var ptr = Module.getValue(pptr,'i32'); 19 var array = Module.HEAPF64.slice(ptr / 8, ptr / 8 + size[0] * size[1]); 20 return ListToMatrix(array, size[1]); 21 21 } 22 22 function heapToInts(pptr, nods) { 23 24 23 var ptr = Module.getValue(pptr,'i32'); 24 return Module.HEAPU32.slice(ptr / 4, ptr / 4 + nods); 25 25 } 26 26 function size2d(array) { … … 40 40 function BamgMesher(bamgmesh_in, bamggeom_in, bamgopts) { 41 41 /* 42 43 44 and index,x,y defines a triangulation, segments is an array made 45 of exterior segments to the mesh domain outline, segmentmarkers is an array 46 flagging each segment, domain a js array defining the domain outline (sames for 47 48 49 Ok, for now, we are not dealing with rifts. Also, the domain is made of only one 50 profile, this to avoid passing a double** pointer to js. 42 usage: var array = Triangle(domain,rifts,area); 43 where: array is made of [index,x,y,segments,segmentmarkers] 44 and index,x,y defines a triangulation, segments is an array made 45 of exterior segments to the mesh domain outline, segmentmarkers is an array 46 flagging each segment, domain a js array defining the domain outline (sames for 47 rifts) and area is the maximum area desired for any element of the resulting mesh. 48 49 Ok, for now, we are not dealing with rifts. Also, the domain is made of only one 50 profile, this to avoid passing a double** pointer to js. 51 51 */ 52 52 53 54 //Retrieve domain arrays, and allocate on Module heap: 53 //Dynamic allocations: {{{ 54 //Retrieve domain arrays, and allocate on Module heap: 55 55 //For each property, calculate the size and fill with 0 if the 2nd dimension is undefined, then use the int size array to init the double array. 56 56 //input 57 57 var pVerticesSize_mesh_in = intsToHeap(size2d(bamgmesh_in.Vertices)); 58 58 var pVertices_mesh_in = doublesToHeap(Array.prototype.concat.apply([], bamgmesh_in.Vertices)); … … 110 110 var phmaxVerticesSize = intsToHeap(size2d(bamgopts.hmaxVertices)); 111 111 var phmaxVertices = doublesToHeap(Array.prototype.concat.apply([], bamgopts.hmaxVertices)); 112 var phVerticesSize = intsToHeap(size2d(bamgopts.hVertices));112 var hVerticesLength = bamgopts.hVerticesLength; 113 113 var phVertices = doublesToHeap(Array.prototype.concat.apply([], bamgopts.hVertices)); 114 114 var pmetricSize = intsToHeap(size2d(bamgopts.metric)); … … 118 118 var perrSize = intsToHeap(size2d([[bamgopts.err]])); 119 119 var perr = doublesToHeap(Array.prototype.concat.apply([], [[bamgopts.err]])); 120 121 122 var pVerticesSize_mesh_out = Module._malloc(4); 123 var pVertices_mesh_out = Module._malloc(4); 124 var pEdgesSize_mesh_out = Module._malloc(4); 125 var pEdges_mesh_out = Module._malloc(4); 126 var pTrianglesSize_mesh_out = Module._malloc(4); 127 var pTriangles_mesh_out = Module._malloc(4); 128 var pIssmEdgesSize_mesh_out = Module._malloc(4); 129 var pIssmEdges_mesh_out = Module._malloc(4); 130 var pIssmSegmentsSize_mesh_out = Module._malloc(4); 131 var pIssmSegments_mesh_out = Module._malloc(4); 132 var pVerticesOnGeomVertexSize_mesh_out = Module._malloc(4); 133 var pVerticesOnGeomVertex_mesh_out = Module._malloc(4); 134 var pVerticesOnGeomEdgeSize_mesh_out = Module._malloc(4); 135 var pVerticesOnGeomEdge_mesh_out = Module._malloc(4); 136 var pEdgesOnGeomEdgeSize_mesh_out = Module._malloc(4); 137 var pEdgesOnGeomEdge_mesh_out = Module._malloc(4); 138 var pSubDomainsSize_mesh_out = Module._malloc(4); 139 var pSubDomains_mesh_out = Module._malloc(4); 140 var pSubDomainsFromGeomSize_mesh_out = Module._malloc(4); 141 var pSubDomainsFromGeom_mesh_out = Module._malloc(4); 142 var pElementConnectivitySize_mesh_out = Module._malloc(4); 143 var pElementConnectivity_mesh_out = Module._malloc(4); 144 var pNodalConnectivitySize_mesh_out = Module._malloc(4); 145 var pNodalConnectivity_mesh_out = Module._malloc(4); 146 var pNodalElementConnectivitySize_mesh_out = Module._malloc(4); 147 var pNodalElementConnectivity_mesh_out = Module._malloc(4); 148 var pCrackedVerticesSize_mesh_out = Module._malloc(4); 149 var pCrackedVertices_mesh_out = Module._malloc(4); 150 var pCrackedEdgesSize_mesh_out = Module._malloc(4); 151 var pCrackedEdges_mesh_out = Module._malloc(4); 152 var pPreviousNumberingSize_mesh_out = Module._malloc(4); 153 var pPreviousNumbering_mesh_out = Module._malloc(4); 154 155 var pVerticesSize_geom_out = Module._malloc(4); 120 121 //output 122 var pVerticesSize_mesh_out = Module._malloc(4); 123 var pVertices_mesh_out = Module._malloc(4); 124 var pEdgesSize_mesh_out = Module._malloc(4); 125 var pEdges_mesh_out = Module._malloc(4); 126 var pTrianglesSize_mesh_out = Module._malloc(4); 127 var pTriangles_mesh_out = Module._malloc(4); 128 var pIssmEdgesSize_mesh_out = Module._malloc(4); 129 var pIssmEdges_mesh_out = Module._malloc(4); 130 var pIssmSegmentsSize_mesh_out = Module._malloc(4); 131 var pIssmSegments_mesh_out = Module._malloc(4); 132 var pVerticesOnGeomVertexSize_mesh_out = Module._malloc(4); 133 var pVerticesOnGeomVertex_mesh_out = Module._malloc(4); 134 var pVerticesOnGeomEdgeSize_mesh_out = Module._malloc(4); 135 var pVerticesOnGeomEdge_mesh_out = Module._malloc(4); 136 var pEdgesOnGeomEdgeSize_mesh_out = Module._malloc(4); 137 var pEdgesOnGeomEdge_mesh_out = Module._malloc(4); 138 var pSubDomainsSize_mesh_out = Module._malloc(4); 139 var pSubDomains_mesh_out = Module._malloc(4); 140 var pSubDomainsFromGeomSize_mesh_out = Module._malloc(4); 141 var pSubDomainsFromGeom_mesh_out = Module._malloc(4); 142 var pElementConnectivitySize_mesh_out = Module._malloc(4); 143 var pElementConnectivity_mesh_out = Module._malloc(4); 144 var pNodalConnectivitySize_mesh_out = Module._malloc(4); 145 var pNodalConnectivity_mesh_out = Module._malloc(4); 146 var pNodalElementConnectivitySize_mesh_out = Module._malloc(4); 147 var pNodalElementConnectivity_mesh_out = Module._malloc(4); 148 var pCrackedVerticesSize_mesh_out = Module._malloc(4); 149 var pCrackedVertices_mesh_out = Module._malloc(4); 150 var pCrackedEdgesSize_mesh_out = Module._malloc(4); 151 var pCrackedEdges_mesh_out = Module._malloc(4); 152 var pPreviousNumberingSize_mesh_out = Module._malloc(4); 153 var pPreviousNumbering_mesh_out = Module._malloc(4); 154 155 var pVerticesSize_geom_out = Module._malloc(4); 156 156 var pVertices_geom_out = Module._malloc(4); 157 var pEdgesSize_geom_out = Module._malloc(4); 158 var pEdges_geom_out = Module._malloc(4); 159 var pCornersSize_geom_out = Module._malloc(4); 160 var pCorners_geom_out = Module._malloc(4); 161 var pRequiredVerticesSize_geom_out = Module._malloc(4); 162 var pRequiredVertices_geom_out = Module._malloc(4); 163 var pRequiredEdgesSize_geom_out = Module._malloc(4); 164 var pRequiredEdges_geom_out = Module._malloc(4); 165 var pCrackedEdgesSize_geom_out = Module._malloc(4); 166 var pCrackedEdges_geom_out = Module._malloc(4); 167 var pSubDomainsSize_geom_out = Module._malloc(4); 168 var pSubDomains_geom_out = Module._malloc(4); 169 170 171 //Declare BamgMesher module: 172 157 var pEdgesSize_geom_out = Module._malloc(4); 158 var pEdges_geom_out = Module._malloc(4); 159 var pCornersSize_geom_out = Module._malloc(4); 160 var pCorners_geom_out = Module._malloc(4); 161 var pRequiredVerticesSize_geom_out = Module._malloc(4); 162 var pRequiredVertices_geom_out = Module._malloc(4); 163 var pRequiredEdgesSize_geom_out = Module._malloc(4); 164 var pRequiredEdges_geom_out = Module._malloc(4); 165 var pCrackedEdgesSize_geom_out = Module._malloc(4); 166 var pCrackedEdges_geom_out = Module._malloc(4); 167 var pSubDomainsSize_geom_out = Module._malloc(4); 168 var pSubDomains_geom_out = Module._malloc(4); 169 //}}} 170 171 //Declare BamgMesher module: 172 BamgMesherModule = Module.cwrap('BamgMesherModule', 'number',[ 173 173 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 174 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 175 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 176 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 174 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 175 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 176 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 177 177 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number']); 178 179 //Call BamgMesher module: 180 181 178 179 //Call BamgMesher module: 180 181 BamgMesherModule( 182 182 pVerticesSize_mesh_out, pVertices_mesh_out, pEdgesSize_mesh_out, pEdges_mesh_out, pTrianglesSize_mesh_out, pTriangles_mesh_out, pIssmEdgesSize_mesh_out, pIssmEdges_mesh_out, pIssmSegmentsSize_mesh_out, pIssmSegments_mesh_out, pVerticesOnGeomVertexSize_mesh_out, pVerticesOnGeomVertex_mesh_out, pVerticesOnGeomEdgeSize_mesh_out, pVerticesOnGeomEdge_mesh_out, pEdgesOnGeomEdgeSize_mesh_out, pEdgesOnGeomEdge_mesh_out, pSubDomainsSize_mesh_out, pSubDomains_mesh_out, pSubDomainsFromGeomSize_mesh_out, pSubDomainsFromGeom_mesh_out, pElementConnectivitySize_mesh_out, pElementConnectivity_mesh_out, pNodalConnectivitySize_mesh_out, pNodalConnectivity_mesh_out, pNodalElementConnectivitySize_mesh_out, pNodalElementConnectivity_mesh_out, pCrackedVerticesSize_mesh_out, pCrackedVertices_mesh_out, pCrackedEdgesSize_mesh_out, pCrackedEdges_mesh_out, pPreviousNumberingSize_mesh_out, pPreviousNumbering_mesh_out, 183 pVerticesSize_geom_out, pVertices_geom_out, pEdgesSize_geom_out, pEdges_geom_out, pCornersSize_geom_out, pCorners_geom_out, pRequiredVerticesSize_geom_out, pRequiredVertices_geom_out, pRequiredEdgesSize_geom_out, pRequiredEdges_geom_out, pCrackedEdgesSize_geom_out, pCrackedEdges_geom_out, pSubDomainsSize_geom_out, pSubDomains_geom_out, 184 pVerticesSize_mesh_in, pVertices_mesh_in, pEdgesSize_mesh_in, pEdges_mesh_in, pTrianglesSize_mesh_in, pTriangles_mesh_in, pCrackedEdgesSize_mesh_in, pCrackedEdges_mesh_in, pVerticesOnGeomEdgeSize_mesh_in, pVerticesOnGeomEdge_mesh_in, pVerticesOnGeomVertexSize_mesh_in, pVerticesOnGeomVertex_mesh_in, pEdgesOnGeomEdgeSize_mesh_in, pEdgesOnGeomEdge_mesh_in, pIssmSegmentsSize_mesh_in, pIssmSegments_mesh_in, 185 pVerticesSize_geom_in, pVertices_geom_in, pEdgesSize_geom_in, pEdges_geom_in, pCornersSize_geom_in, pCorners_geom_in, pRequiredVerticesSize_geom_in, pRequiredVertices_geom_in, pRequiredEdgesSize_geom_in, pRequiredEdges_geom_in, pCrackedEdgesSize_geom_in, pCrackedEdges_geom_in, pSubDomainsSize_geom_in, pSubDomains_geom_in, 186 anisomax, cutoff, coeff, errg, gradation, Hessiantype, maxnbv, maxsubdiv, Metrictype, nbjacobi, nbsmooth, omega, power, verbose, Crack, KeepVertices, splitcorners, hmin, hmax, phminVerticesSize, phminVertices, phmaxVerticesSize, phmaxVertices, phVerticesSize, phVertices, pmetricSize, pmetric, pfieldSize, pfield, perrSize, perr);187 188 189 //recover mesh: 183 pVerticesSize_geom_out, pVertices_geom_out, pEdgesSize_geom_out, pEdges_geom_out, pCornersSize_geom_out, pCorners_geom_out, pRequiredVerticesSize_geom_out, pRequiredVertices_geom_out, pRequiredEdgesSize_geom_out, pRequiredEdges_geom_out, pCrackedEdgesSize_geom_out, pCrackedEdges_geom_out, pSubDomainsSize_geom_out, pSubDomains_geom_out, 184 pVerticesSize_mesh_in, pVertices_mesh_in, pEdgesSize_mesh_in, pEdges_mesh_in, pTrianglesSize_mesh_in, pTriangles_mesh_in, pCrackedEdgesSize_mesh_in, pCrackedEdges_mesh_in, pVerticesOnGeomEdgeSize_mesh_in, pVerticesOnGeomEdge_mesh_in, pVerticesOnGeomVertexSize_mesh_in, pVerticesOnGeomVertex_mesh_in, pEdgesOnGeomEdgeSize_mesh_in, pEdgesOnGeomEdge_mesh_in, pIssmSegmentsSize_mesh_in, pIssmSegments_mesh_in, 185 pVerticesSize_geom_in, pVertices_geom_in, pEdgesSize_geom_in, pEdges_geom_in, pCornersSize_geom_in, pCorners_geom_in, pRequiredVerticesSize_geom_in, pRequiredVertices_geom_in, pRequiredEdgesSize_geom_in, pRequiredEdges_geom_in, pCrackedEdgesSize_geom_in, pCrackedEdges_geom_in, pSubDomainsSize_geom_in, pSubDomains_geom_in, 186 anisomax, cutoff, coeff, errg, gradation, Hessiantype, maxnbv, maxsubdiv, Metrictype, nbjacobi, nbsmooth, omega, power, verbose, Crack, KeepVertices, splitcorners, hmin, hmax, phminVerticesSize, phminVertices, phmaxVerticesSize, phmaxVertices, hVerticesLength, phVertices, pmetricSize, pmetric, pfieldSize, pfield, perrSize, perr); 187 188 /*Dynamic copying from heap: {{{*/ 189 //recover mesh: 190 190 var bamgmeshout = new bamgmesh(); 191 191 var bamggeomout = new bamggeom(); 192 192 193 193 bamgmeshout.VerticesSize = heapToInts(pVerticesSize_mesh_out, 2); 194 194 bamgmeshout.Vertices = heapToDoubles(pVertices_mesh_out, bamgmeshout.VerticesSize); 195 195 bamgmeshout.EdgesSize = heapToInts(pEdgesSize_mesh_out, 2); 196 196 bamgmeshout.Edges = heapToDoubles(pEdges_mesh_out, bamgmeshout.EdgesSize); 197 197 bamgmeshout.TrianglesSize = heapToInts(pTrianglesSize_mesh_out, 2); 198 198 bamgmeshout.Triangles = heapToDoubles(pTriangles_mesh_out, bamgmeshout.TrianglesSize); 199 199 bamgmeshout.IssmEdgesSize = heapToInts(pIssmEdgesSize_mesh_out, 2); 200 200 bamgmeshout.IssmEdges = heapToDoubles(pIssmEdges_mesh_out, bamgmeshout.IssmEdgesSize); 201 201 bamgmeshout.IssmSegmentsSize = heapToInts(pIssmSegmentsSize_mesh_out, 2); 202 202 bamgmeshout.IssmSegments = heapToDoubles(pIssmSegments_mesh_out, bamgmeshout.IssmSegmentsSize); 203 203 bamgmeshout.VerticesOnGeomVertexSize = heapToInts(pVerticesOnGeomVertexSize_mesh_out, 2); 204 204 bamgmeshout.VerticesOnGeomVertex = heapToDoubles(pVerticesOnGeomVertex_mesh_out, bamgmeshout.VerticesOnGeomVertexSize); 205 205 bamgmeshout.VerticesOnGeomEdgeSize = heapToInts(pVerticesOnGeomEdgeSize_mesh_out, 2); 206 206 bamgmeshout.VerticesOnGeomEdge = heapToDoubles(pVerticesOnGeomEdge_mesh_out, bamgmeshout.VerticesOnGeomEdgeSize); 207 207 bamgmeshout.EdgesOnGeomEdgeSize = heapToInts(pEdgesOnGeomEdgeSize_mesh_out, 2); 208 208 bamgmeshout.EdgesOnGeomEdge = heapToDoubles(pEdgesOnGeomEdge_mesh_out, bamgmeshout.EdgesOnGeomEdgeSize); 209 209 bamgmeshout.SubDomainsSize = heapToInts(pSubDomainsSize_mesh_out, 2); 210 210 bamgmeshout.SubDomains = heapToDoubles(pSubDomains_mesh_out, bamgmeshout.SubDomainsSize); 211 211 bamgmeshout.SubDomainsFromGeomSize = heapToInts(pSubDomainsFromGeomSize_mesh_out, 2); 212 212 bamgmeshout.SubDomainsFromGeom = heapToDoubles(pSubDomainsFromGeom_mesh_out, bamgmeshout.SubDomainsFromGeomSize); 213 213 bamgmeshout.ElementConnectivitySize = heapToInts(pElementConnectivitySize_mesh_out, 2); 214 214 bamgmeshout.ElementConnectivity = heapToDoubles(pElementConnectivity_mesh_out, bamgmeshout.ElementConnectivitySize); 215 215 bamgmeshout.NodalConnectivitySize = heapToInts(pNodalConnectivitySize_mesh_out, 2); 216 216 bamgmeshout.NodalConnectivity = heapToDoubles(pNodalConnectivity_mesh_out, bamgmeshout.NodalConnectivitySize); 217 217 bamgmeshout.NodalElementConnectivitySize = heapToInts(pNodalElementConnectivitySize_mesh_out, 2); 218 218 bamgmeshout.NodalElementConnectivity = heapToDoubles(pNodalElementConnectivity_mesh_out, bamgmeshout.NodalElementConnectivitySize); 219 219 bamgmeshout.CrackedVerticesSize = heapToInts(pCrackedVerticesSize_mesh_out, 2); 220 220 bamgmeshout.CrackedVertices = heapToDoubles(pCrackedVertices_mesh_out, bamgmeshout.CrackedVerticesSize); 221 221 bamgmeshout.CrackedEdgesSize = heapToInts(pCrackedEdgesSize_mesh_out, 2); 222 222 bamgmeshout.CrackedEdges = heapToDoubles(pCrackedEdges_mesh_out, bamgmeshout.CrackedEdgesSize); 223 223 bamgmeshout.PreviousNumberingSize = heapToInts(pPreviousNumberingSize_mesh_out, 2); … … 238 238 bamggeomout.SubDomainsSize = heapToInts(pSubDomainsSize_geom_out, 2); 239 239 bamggeomout.SubDomains = heapToDoubles(pSubDomains_geom_out, bamggeomout.SubDomainsSize); 240 241 242 243 244 245 Module._free(pVerticesSize_mesh_out); 246 Module._free(pVertices_mesh_out); 247 Module._free(pEdgesSize_mesh_out); 248 Module._free(pEdges_mesh_out); 249 Module._free(pTrianglesSize_mesh_out); 250 Module._free(pTriangles_mesh_out); 251 Module._free(pIssmEdgesSize_mesh_out); 252 Module._free(pIssmEdges_mesh_out); 253 Module._free(pIssmSegmentsSize_mesh_out); 254 Module._free(pIssmSegments_mesh_out); 255 Module._free(pVerticesOnGeomVertexSize_mesh_out); 256 Module._free(pVerticesOnGeomVertex_mesh_out); 257 Module._free(pVerticesOnGeomEdgeSize_mesh_out); 258 Module._free(pVerticesOnGeomEdge_mesh_out); 259 Module._free(pEdgesOnGeomEdgeSize_mesh_out); 260 Module._free(pEdgesOnGeomEdge_mesh_out); 261 Module._free(pSubDomainsSize_mesh_out); 262 Module._free(pSubDomains_mesh_out); 263 Module._free(pSubDomainsFromGeomSize_mesh_out); 264 Module._free(pSubDomainsFromGeom_mesh_out); 265 Module._free(pElementConnectivitySize_mesh_out); 266 Module._free(pElementConnectivity_mesh_out); 267 Module._free(pNodalConnectivitySize_mesh_out); 268 Module._free(pNodalConnectivity_mesh_out); 269 Module._free(pNodalElementConnectivitySize_mesh_out); 270 Module._free(pNodalElementConnectivity_mesh_out); 271 Module._free(pCrackedVerticesSize_mesh_out); 272 Module._free(pCrackedVertices_mesh_out); 273 Module._free(pCrackedEdgesSize_mesh_out); 274 Module._free(pCrackedEdges_mesh_out); 275 Module._free(pPreviousNumberingSize_mesh_out); 276 Module._free(pPreviousNumbering_mesh_out); 240 /*}}}*/ 241 242 var return_array=[bamgmeshout, bamggeomout]; 243 244 /*Free ressources: */ 245 Module._free(pVerticesSize_mesh_out); 246 Module._free(pVertices_mesh_out); 247 Module._free(pEdgesSize_mesh_out); 248 Module._free(pEdges_mesh_out); 249 Module._free(pTrianglesSize_mesh_out); 250 Module._free(pTriangles_mesh_out); 251 Module._free(pIssmEdgesSize_mesh_out); 252 Module._free(pIssmEdges_mesh_out); 253 Module._free(pIssmSegmentsSize_mesh_out); 254 Module._free(pIssmSegments_mesh_out); 255 Module._free(pVerticesOnGeomVertexSize_mesh_out); 256 Module._free(pVerticesOnGeomVertex_mesh_out); 257 Module._free(pVerticesOnGeomEdgeSize_mesh_out); 258 Module._free(pVerticesOnGeomEdge_mesh_out); 259 Module._free(pEdgesOnGeomEdgeSize_mesh_out); 260 Module._free(pEdgesOnGeomEdge_mesh_out); 261 Module._free(pSubDomainsSize_mesh_out); 262 Module._free(pSubDomains_mesh_out); 263 Module._free(pSubDomainsFromGeomSize_mesh_out); 264 Module._free(pSubDomainsFromGeom_mesh_out); 265 Module._free(pElementConnectivitySize_mesh_out); 266 Module._free(pElementConnectivity_mesh_out); 267 Module._free(pNodalConnectivitySize_mesh_out); 268 Module._free(pNodalConnectivity_mesh_out); 269 Module._free(pNodalElementConnectivitySize_mesh_out); 270 Module._free(pNodalElementConnectivity_mesh_out); 271 Module._free(pCrackedVerticesSize_mesh_out); 272 Module._free(pCrackedVertices_mesh_out); 273 Module._free(pCrackedEdgesSize_mesh_out); 274 Module._free(pCrackedEdges_mesh_out); 275 Module._free(pPreviousNumberingSize_mesh_out); 276 Module._free(pPreviousNumbering_mesh_out); 277 277 278 278 Module._free(pVerticesSize_geom_out); … … 327 327 Module._free(phmaxVerticesSize); 328 328 Module._free(phmaxVertices); 329 Module._free(phVerticesSize);330 329 Module._free(phVertices); 331 330 Module._free(pmetricSize); … … 336 335 Module._free(perr); 337 336 338 339 } 337 return return_array; 338 } -
issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp
r24301 r24304 15 15 /*FUNCTION FetchData(char** pstring, char* string){{{*/ 16 16 void FetchData(char** pstring, char* stringin){ 17 18 char* string=xNew<char>(strlen(stringin)+1); 19 xMemCpy<char>(string,stringin,strlen(stringin)+1);17 char* string=NULL; 18 19 string=xNew<char>(strlen(stringin)+1); xMemCpy<char>(string,stringin,strlen(stringin)+1); 20 20 21 21 *pstring=string; 22 22 } 23 23 /*}}}*/ 24 /*FUNCTION FetchData(int* pinteger,int integer){{{*/ 25 void FetchData(int* pinteger,int integer){ 26 27 *pinteger = integer; 28 } 29 /*}}}*/ 30 /*FUNCTION FetchData(double* pscalar,double scalar){{{*/ 31 void FetchData(double* pscalar,double scalar){ 32 33 *pscalar = scalar; 24 /*FUNCTION FetchData(int* pinteger, int integer){{{*/ 25 void FetchData(int* pinteger, int integer){ 26 *pinteger=integer; 27 } 28 /*}}}*/ 29 /*FUNCTION FetchData(double* pscalar, double scalar){{{*/ 30 void FetchData(double* pscalar, double scalar){ 31 *pscalar=scalar; 34 32 } 35 33 /*}}}*/ 36 34 /*FUNCTION FetchData(double **pvector, double* vectorin, int nods){{{*/ 37 35 void FetchData(double** pvector, double* vectorin, int nods){ 38 39 36 double* vector=NULL; 40 37 … … 46 43 /*FUNCTION FetchData(double **pvector, int* pnods, double* vectorin, int nods){{{*/ 47 44 void FetchData(double** pvector, int* pnods, double* vectorin, int nods){ 48 49 45 double* vector=NULL; 50 46 … … 57 53 /*FUNCTION FetchData(double **pmatrix, int* pM, int* pN, int* matrix, int M, int N){{{*/ 58 54 void FetchData(double **pmatrix, int* pM, int* pN, int* matrixin, int M, int N){ 59 60 55 double* outmatrix=NULL; 61 int outmatrix_rows, outmatrix_cols;56 int outmatrix_rows, outmatrix_cols; 62 57 63 58 if(M == 0 || N == 0){ … … 71 66 outmatrix_cols=N; 72 67 outmatrix=xNew<IssmPDouble>(M*N); 73 for(int i=0;i<M*N;i++) outmatrix[i]=(IssmPDouble)matrixin[i];68 for(int i=0;i<M*N;i++){outmatrix[i]=(IssmPDouble)matrixin[i];} 74 69 } 75 70 76 71 /*Assign output pointers:*/ 77 72 *pmatrix=outmatrix; 78 if (pM) *pM=outmatrix_rows;79 if (pN) *pN=outmatrix_cols;73 if (pM){*pM=outmatrix_rows;} 74 if (pN){*pN=outmatrix_cols;} 80 75 } 81 76 /*}}}*/ 82 77 /*FUNCTION FetchData(double **pmatrix, int* pM, int* pN, double* matrix, int M, int N){{{*/ 83 78 void FetchData(double **pmatrix, int* pM, int* pN, double* matrixin, int M, int N){ 84 85 79 double* outmatrix=NULL; 86 int outmatrix_rows, outmatrix_cols;80 int outmatrix_rows, outmatrix_cols; 87 81 88 82 if(M == 0 || N == 0){ … … 100 94 /*Assign output pointers:*/ 101 95 *pmatrix=outmatrix; 102 if (pM) *pM=outmatrix_rows;103 if (pN) *pN=outmatrix_cols;96 if (pM){*pM=outmatrix_rows;} 97 if (pN){*pN=outmatrix_cols;} 104 98 } 105 99 /*}}}*/ 106 100 /*FUNCTION FetchData(int **pmatrix, int* pM, int* pN, int* matrix, int M, int N){{{*/ 107 101 void FetchData(int **pmatrix, int* pM, int* pN, int* matrixin, int M, int N){ 108 109 102 int* outmatrix=NULL; 110 int outmatrix_rows, outmatrix_cols;103 int outmatrix_rows, outmatrix_cols; 111 104 112 105 if(M == 0 || N == 0){ … … 124 117 /*Assign output pointers:*/ 125 118 *pmatrix=outmatrix; 126 if (pM) *pM=outmatrix_rows;127 if (pN) *pN=outmatrix_cols;119 if (pM){*pM=outmatrix_rows;} 120 if (pN){*pN=outmatrix_cols;} 128 121 } 129 122 /*}}}*/ 130 123 /*ISSM objects*/ 131 /*FUNCTION FetchData(Contours** pcontours,double* x, double* y, int nods){{{*/ 132 void FetchData(Contours** pcontours,double* x, double* y, int nods){ 133 134 int numcontours,index,test1,test2; 124 /*FUNCTION FetchData(Contours** pcontours, double* x, double* y, int nods){{{*/ 125 void FetchData(Contours** pcontours, double* x, double* y, int nods){ 126 int numcontours, index, test1, test2; 135 127 char *contourname = NULL; 136 128 Contours *contours = NULL; … … 141 133 142 134 if (nods){ 143 144 135 contouri=new Contour<double>(); 145 136 contouri->nods=nods; 146 137 contouri->x=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(contouri->x,x,nods); 147 138 contouri->y=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(contouri->y,y,nods); 148 149 139 contours->AddObject(contouri); 150 140 } … … 157 147 158 148 /*Initialize output*/ 159 BamgGeom* bamggeom =new BamgGeom();149 BamgGeom* bamggeom=new BamgGeom(); 160 150 161 151 /*Fetch all fields*/ … … 169 159 170 160 /*Assign output pointers:*/ 171 *pbamggeom =bamggeom;161 *pbamggeom=bamggeom; 172 162 } 173 163 /*}}}*/ … … 176 166 177 167 /*Initialize output*/ 178 BamgMesh* bamgmesh =new BamgMesh();168 BamgMesh* bamgmesh=new BamgMesh(); 179 169 180 170 /*Fetch all fields*/ … … 189 179 190 180 /*Assign output pointers:*/ 191 *pbamgmesh =bamgmesh;181 *pbamgmesh=bamgmesh; 192 182 } 193 183 /*}}}*/ … … 232 222 233 223 /*Assign output pointers:*/ 234 *pbamgopts =bamgopts;235 } 236 /*}}}*/ 237 /*FUNCTION FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){{{*/238 void FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){224 *pbamgopts=bamgopts; 225 } 226 /*}}}*/ 227 /*FUNCTION FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){{{*/ 228 void FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){ 239 229 240 230 /*Initialize output*/ … … 242 232 243 233 /*check and parse the name */ 244 GenericOption<double> *odouble =new GenericOption<double>();234 GenericOption<double> *odouble=new GenericOption<double>(); 245 235 odouble=new GenericOption<double>(); 246 odouble->name 236 odouble->name=xNew<char>(strlen(optionname)+1); 247 237 memcpy(odouble->name,optionname,(strlen(optionname)+1)*sizeof(char)); 248 238 odouble->value=optionvalue;
Note:
See TracChangeset
for help on using the changeset viewer.