Changeset 19721
- Timestamp:
- 11/16/15 15:54:40 (9 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/array/ArrayOperations.js
r19719 r19721 15 15 function ArrayMin(array){ //{{{ 16 16 return Math.min.apply(null,array); 17 } //}}} 18 function ArraySum(array){ //{{{ 19 var sum=0; 20 for(var i=0;i<array.length;i++)sum+=array[i]; 21 return sum; 17 22 } //}}} 18 23 function ArrayMin2D(array){ //{{{ … … 47 52 var list= new Array(width*length); 48 53 49 for (i=0;i<length;i++){50 for( j=0;j<width;j++){54 for(var i=0;i<length;i++){ 55 for(var j=0;j<width;j++){ 51 56 list[i*width+j]=matrix[i][j]; 52 57 } … … 68 73 for (i=0;i<array.length;i++)notarray[i]=-array[i]; 69 74 return notarray; 75 } //}}} 76 function ArrayAnyNaN(array) { //{{{ 77 78 for(var i=0;i<array.length;i++){ 79 if (isNaN(array[i])) return 1; 80 } 81 return 0; 70 82 } //}}} 71 83 function ArrayAnd(array1,array2) { //{{{ … … 98 110 return indices; 99 111 } //}}} 112 function ArrayFindNot(array,value) { //{{{ 113 114 //find number of indices 115 var count=0; 116 for (i=0;i<array.length;i++)if(array[i]!=value)count++; 117 118 //allocate: 119 var indices= NewArrayFill(count,0); 120 121 //fill in: 122 count=0; 123 for (i=0;i<array.length;i++){ 124 if(array[i]!=value){ 125 indices[count]=i; 126 count++; 127 } 128 } 129 return indices; 130 } //}}} 131 function Create2DArray(rows,cols) { //{{{ 132 var arr = []; 133 134 for (var i=0;i<rows;i++) { 135 arr[i] = new Array(cols); 136 } 137 138 return arr; 139 } //}}} -
issm/trunk-jpl/src/m/classes/mesh2d.js
r19719 r19721 44 44 fielddisplay(this,"epsg","EPSG code (ex: 3413 for UPS Greenland, 3031 for UPS Antarctica)"); 45 45 } //}}} 46 this.domaintype=function (){ // {{{ 47 return '2Dhorizontal'; 48 } // }}} 49 this.dimension = function () { //{{{ 50 return 2; 51 } //}}} 52 this.elementtype = function() {//{{{ 53 return 'Tria'; 54 } // }}} 46 55 //properties 47 56 // {{{ -
issm/trunk-jpl/src/m/geometry/FlagElements.js
r19719 r19721 34 34 for (i=0;i<md.mesh.numberofelements;i++) 35 35 var sum=0; 36 for( j=0;j<md.mesh.elements[0].length;j++){36 for(var j=0;j<md.mesh.elements[0].length;j++){ 37 37 sum += region[md.mesh.element[i][j]-1]; 38 38 } … … 40 40 } 41 41 else{ 42 console.error('Flaglist for region must be of same size as number of elements in model');42 throw Error('Flaglist for region must be of same size as number of elements in model'); 43 43 } 44 44 } 45 45 else{ 46 console.error('Invalid region option');46 throw Error('Invalid region option'); 47 47 } 48 48 return flag; -
issm/trunk-jpl/src/m/mesh/triangle.js
r19716 r19721 50 50 md.mesh.vertexonboundary=new Float64Array(md.mesh.numberofvertices); 51 51 52 for (i=0;i<md.mesh.segments.length;i++) for( j=0;j<2;j++) md.mesh.vertexonboundary[md.mesh.segments[i][j]-1]=1;52 for (i=0;i<md.mesh.segments.length;i++) for(var j=0;j<2;j++) md.mesh.vertexonboundary[md.mesh.segments[i][j]-1]=1; 53 53 54 54 //Now, build the connectivity tables for this mesh. -
issm/trunk-jpl/src/m/miscellaneous/fielddisplay.js
r19710 r19721 85 85 } 86 86 else{ 87 console.error("fielddisplay error message: format for comment not supported yet");87 throw Error("fielddisplay error message: format for comment not supported yet"); 88 88 } 89 89 } -
issm/trunk-jpl/src/m/parameterization/setmask.js
r19719 r19721 26 26 //some checks on list of arguments 27 27 if (!((arguments.length==3) | (arguments.length==5))){ 28 console.error('mask error message: wrong usage.');28 throw Error('mask error message: wrong usage.'); 29 29 } 30 30 … … 34 34 } 35 35 else{ 36 console.error('mask error message: wrong field specified. Only icedomain allowed for now.');36 throw Error('mask error message: wrong field specified. Only icedomain allowed for now.'); 37 37 } 38 38 if (IsArray(icedomain)){ 39 console.error('setmask error message: icedomain should be an array!');39 throw Error('setmask error message: icedomain should be an array!'); 40 40 } 41 41 } … … 59 59 vertexonfloatingice=NewArrayFill(md.mesh.numberofvertices,0); 60 60 vertexongroundedice=NewArrayFill(md.mesh.numberofvertices,0); 61 pos=ArrayFind(elementongroundedice,1); for (i=0;i<pos.length;i++)for( j=0;j<3;j++) vertexongroundedice[md.mesh.elements[i,j]-1]=1;61 pos=ArrayFind(elementongroundedice,1); for (i=0;i<pos.length;i++)for(var j=0;j<3;j++) vertexongroundedice[md.mesh.elements[i,j]-1]=1; 62 62 pos=ArrayFind(vertexongroundedice,0); for (i=0;i<pos.length;i++)vertexonfloatingice[i]=1; 63 63 64 64 //level sets 65 65 groundedice_levelset=vertexongroundedice; 66 pos=ArrayFind(vertexongroundedice,0);for( i=0;i<pos.length;i++) groundedice_levelset[i]=-1;66 pos=ArrayFind(vertexongroundedice,0);for(var i=0;i<pos.length;i++) groundedice_levelset[i]=-1; 67 67 md.mask.groundedice_levelset=groundedice_levelset; 68 68 … … 71 71 //use contourtomesh to set ice values inside ice domain 72 72 [vertexinsideicedomain,elementinsideicedomain]=ContourToMesh(elements,x,y,icedomain,'node',1); 73 pos=ArrayFind(vertexinsideicedomain,1.0);for( i=0;i<pos.length;i++) md.mask.ice_levelset[pos]=-1;73 pos=ArrayFind(vertexinsideicedomain,1.0);for(var i=0;i<pos.length;i++) md.mask.ice_levelset[pos]=-1; 74 74 } 75 75 else{
Note:
See TracChangeset
for help on using the changeset viewer.