Changeset 27632
- Timestamp:
- 03/06/23 19:46:15 (2 years ago)
- Location:
- issm/trunk-jpl/src/m/mesh/planet/gmsh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m
r27560 r27632 1 1 function mesh=gmshplanet(varargin) 2 %GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo2 %GMSHPLANET - mesh generation for a sphere. Very specific code for Gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo 3 3 % 4 4 % Available options (for more details see ISSM website http://issm.jpl.nasa.gov/): … … 16 16 17 17 %Find path to gmsh 18 paths ={19 [getenv('ISSM_EXT_DIR') '/shared/gmsh/install/bin /gmsh'],...20 [getenv('ISSM_EXT_DIR') '/static/gmsh/install/bin /gmsh'],...21 [getenv('ISSM_EXT_DIR') '/gmsh/install/bin /gmsh'],...22 [issmdir() ' externalpackages/gmsh/install/bin/gmsh'],...23 [issmdir() ' bin/gmsh'],...24 ['/usr/bin /gmsh']...18 paths={ 19 [getenv('ISSM_EXT_DIR') '/shared/gmsh/install/bin'],... 20 [getenv('ISSM_EXT_DIR') '/static/gmsh/install/bin'],... 21 [getenv('ISSM_EXT_DIR') '/gmsh/install/bin'],... 22 [issmdir() '/externalpackages/gmsh/install/bin'],... 23 [issmdir() '/bin'],... 24 ['/usr/bin']... 25 25 }; 26 gmshpath ='';26 gmshpath=''; 27 27 for i=paths 28 if exist( i{1},'file'),28 if exist([i{1} '/gmsh'],'file'), 29 29 gmshpath = i{1}; 30 30 break; … … 32 32 end 33 33 if isempty(gmshpath), 34 error('Gmsh not found, make sure it is properly installed'); 35 end 34 error('gmshplanet: gmsh executable not found!'); 35 end 36 37 setenv('PATH', [gmshpath ':' getenv('PATH')]); 36 38 37 39 % Get Gmsh version … … 39 41 if s~=0 || contains(r, 'dyld'), 40 42 error(['gmshplanet: ' r]); 41 elseif isempty(r),42 % If this function is called from one of our distributable packages, we43 % need to do a bit more to find the Gmsh executable44 [filepath,name,ext]=fileparts(which('gmsh.'));45 setenv('PATH',[filepath ':' getenv('PATH')]);46 [s,r]=system(['gmsh -info | command grep ''Version'' | sed -e ''s/Version[[:blank:]]*:[[:blank:]]//'' | cut -d ''.'' -f1']);47 if s~=0 || contains(r, 'dyld'),48 error(['gmshplanet: ' r]);49 elseif isempty(r),50 error('gmshplanet: Gmsh executable not found!');51 end52 43 end 53 44 gmshmajorversion=str2num(r); -
issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py
r27458 r27632 1 import os 1 2 import subprocess 2 3 import numpy as np 4 from issmdir import issmdir 3 5 from MatlabFuncs import * 4 6 from mesh3dsurface import * … … 7 9 8 10 def gmshplanet(*args): 9 """ GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo11 """gmshplanet - mesh generation for a sphere. Very specific code for Gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo 10 12 11 13 Available options (for more details see ISSM website http://issm.jpl.nasa.gov/): … … 21 23 md.mesh = gmshplanet('radius', 6000, 'resolution', 100); 22 24 """ 25 26 # Find path to gmsh 27 paths = [ 28 os.environ.get('ISSM_EXT_DIR') + '/shared/gmsh/install/bin', 29 os.environ.get('ISSM_EXT_DIR') + '/static/gmsh/install/bin', 30 os.environ.get('ISSM_EXT_DIR') + '/gmsh/install/bin', 31 issmdir() + '/externalpackages/gmsh/install/bin', 32 issmdir() + '/bin', 33 '/usr/bin' 34 ] 35 gmshpath = '' 36 for path in paths: 37 if exists(path + '/gmsh'): 38 gmshpath = path 39 break 40 if gmshpath == '': 41 error('gmshplanet: gmsh executable not found!') 42 43 os.environ['PATH'] = gmshpath ':' os.environ.get['PATH'] 23 44 24 45 # Get Gmsh version … … 195 216 196 217 # A little technicality here. The mesh is not exactly on the sphere. We 197 # create lat,long coordi antes, and reproject onto an exact sphere.218 # create lat,long coordinates, and reproject onto an exact sphere. 198 219 mesh.r = np.sqrt(mesh.x ** 2 + mesh.y ** 2 + mesh.z ** 2) 199 220
Note:
See TracChangeset
for help on using the changeset viewer.