|
| 1 | +function Bars = addbars(Bars,ibar,inode1,inode2) |
| 2 | +% |
| 3 | +% Name: addbars |
| 4 | +% |
| 5 | +% Usage: Bars = addbars(Bars,ibar,inode1,inode2) |
| 6 | +% |
| 7 | +% Description: |
| 8 | +% Updates Bars list -- called |
| 9 | +% from GUI geometry definition function |
| 10 | +% 'generategeom' |
| 11 | + |
| 12 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 13 | +% This matlab source code was originally % |
| 14 | +% developed as part of "DIAMOND" at % |
| 15 | +% Los Alamos National Laboratory. It may % |
| 16 | +% be copied, modified, and distributed in % |
| 17 | +% any form, provided: % |
| 18 | +% a) This notice accompanies the files and % |
| 19 | +% appears near the top of all source % |
| 20 | +% code files. % |
| 21 | +% b) No payment or commercial services are % |
| 22 | +% received in exchange for the code. % |
| 23 | +% % |
| 24 | +% Original copyright is reserved by the % |
| 25 | +% Regents of the University of California, % |
| 26 | +% in addition to Scott W. Doebling, Phillip % |
| 27 | +% J. Cornwell, Erik G. Straser, and Charles % |
| 28 | +% R. Farrar. % |
| 29 | +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 30 | + |
| 31 | +if ~isempty(Bars), |
| 32 | + |
| 33 | + ribar = find(Bars(:,1) == ibar); |
| 34 | + |
| 35 | +else |
| 36 | + |
| 37 | + ribar = []; |
| 38 | + |
| 39 | +end |
| 40 | + |
| 41 | +if isempty(ribar), |
| 42 | + |
| 43 | +% This is a new bar element |
| 44 | + |
| 45 | + Bars= [Bars; ibar, inode1, inode2]; |
| 46 | + |
| 47 | +else |
| 48 | + |
| 49 | +% Replace an existing bar element |
| 50 | + |
| 51 | + Bars(ribar,:) = [ibar, inode1, inode2]; |
| 52 | + |
| 53 | +end |
| 54 | + |
| 55 | +return |
0 commit comments