Changeset 27841
- Timestamp:
- 07/20/23 11:25:51 (20 months ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/mesh/roundmesh.m
r26953 r27841 11 11 12 12 %First we have to create the domain outline 13 if nargin<4 13 if nargin>=4: 14 expname = varargin{1}; 15 else 14 16 expname = [tempname() '.exp']; 15 else16 expname = varargin{1};17 17 end 18 18 … … 20 20 pointsonedge=floor((2.*pi*radius) / resolution)+1; %+1 to close the outline 21 21 22 %Calculate the cartesianscoordinates of the points22 %Calculate the Cartesian coordinates of the points 23 23 theta=linspace(0,2*pi,pointsonedge)'; 24 24 x_list=roundsigfig(radius*cos(theta),12); -
issm/trunk-jpl/src/m/mesh/roundmesh.py
r26982 r27841 3 3 from collections import OrderedDict 4 4 from expwrite import expwrite 5 from MatlabFuncs import tempname 5 6 from triangle import triangle 6 7 7 8 8 def roundmesh(md, radius, resolution): 9 """ 10 ROUNDMESH - create an unstructured round mesh 9 def roundmesh(md, radius, resolution, *args): 10 """roundmesh - create an unstructured round mesh 11 11 12 13 - radius : specifies the radius of the circle in meters14 - resolution : specifies the resolution in meters12 This script will generate a structured round mesh 13 - radius : specifies the radius of the circle in meters 14 - resolution : specifies the resolution in meters 15 15 16 Usage: 17 md = roundmesh(md, radius, resolution) 16 Usage: 17 md = roundmesh(md, radius, resolution) 18 md = roundmesh(md, radius, resolution, 'domain.exp') 18 19 """ 19 20 # First we have to create the domain outline 21 if len(args): 22 expname = args[0] 23 else: 24 expname = tempname() + '.exp' 25 print(expname) 26 exit() 27 20 28 # Get number of points on the circle 21 pointsonedge = int(np.floor((2. * np.pi * radius) / resolution) + 1) # + 29 pointsonedge = int(np.floor((2. * np.pi * radius) / resolution) + 1) # +1 to close the outline 22 30 23 # Calculate the cartesianscoordinates of the points31 # Calculate the Cartesian coordinates of the points 24 32 theta = np.linspace(0., 2. * np.pi, pointsonedge) 25 33 x_list = roundsigfig(radius * np.cos(theta), 12) … … 29 37 A['y'] = y_list 30 38 A['density'] = 1. 31 expwrite(A, 'RoundDomainOutline.exp')39 expwrite(A, expname) 32 40 33 41 # Call Bamg 34 md = triangle(md, 'RoundDomainOutline.exp', resolution)42 md = triangle(md, expname, resolution) 35 43 # md = bamg(md, 'domain', 'RoundDomainOutline.exp', 'hmin', resolution) 36 44 37 # move the closest node to the center45 # Move the closest node to the center 38 46 pos = np.argmin(md.mesh.x**2 + md.mesh.y**2) 39 47 md.mesh.x[pos] = 0. 40 48 md.mesh.y[pos] = 0. 41 49 42 # delete domain43 os.remove( 'RoundDomainOutline.exp')50 # Delete domain 51 os.remove(expname) 44 52 45 53 return md … … 47 55 48 56 def roundsigfig(x, n): 49 50 57 nonzeros = np.where(x != 0) 51 58 digits = np.ceil(np.log10(np.abs(x[nonzeros]))) -
issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py
r27458 r27841 372 372 return False 373 373 # }}} 374 375 def tempname(): # {{{ 376 import random 377 import string 378 379 alphanumlist = string.ascii_lowercase + string.digits 380 return '/tmp/tp' + ''.join(random.choices(alphanumlist, k=8)) + '_' + ''.join(random.choices(alphanumlist, k=4)) + '_' + ''.join(random.choices(alphanumlist, k=4)) + '_' + ''.join(random.choices(alphanumlist, k=4)) + '_' + ''.join(random.choices(alphanumlist, k=12)) 381 # }}} -
issm/trunk-jpl/src/wrappers/Triangle/Triangle.h
r26036 r27841 19 19 #ifdef _HAVE_JAVASCRIPT_MODULES_ 20 20 #undef _DO_NOT_LOAD_GLOBALS_ /*only module where this needs to be undefined, so as to 21 not include IssmComm several times in the javascript Modle construct.*/21 not include IssmComm several times in the JavaScript module construct.*/ 22 22 #endif 23 23
Note:
See TracChangeset
for help on using the changeset viewer.