[13394] | 1 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.py
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.py (revision 13027)
|
---|
| 4 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.py (revision 13028)
|
---|
| 5 | @@ -1,31 +1,13 @@
|
---|
| 6 | import numpy
|
---|
| 7 | from model import *
|
---|
| 8 | from pairoptions import *
|
---|
| 9 | -from recover_areas import *
|
---|
| 10 | from MatlabFuncs import *
|
---|
| 11 | from FlagElements import *
|
---|
| 12 |
|
---|
| 13 | -def recover_areas(md,*args): # {{{
|
---|
| 14 | - """
|
---|
| 15 | - RECOVER_AREAS - flag the element depending on the physical model that is assigned to them
|
---|
| 16 |
|
---|
| 17 | - This routine is called by setelementstype, do not use
|
---|
| 18 | + #recover elements distribution
|
---|
| 19 |
|
---|
| 20 | - Usage:
|
---|
| 21 | - [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
|
---|
| 22 | - """
|
---|
| 23 |
|
---|
| 24 | - #go through varargin, extract options and plug them into subtype options, by order of appearance
|
---|
| 25 | - options=pairoptions(*args)
|
---|
| 26 | -# options=deleteduplicates(options,1);
|
---|
| 27 | -
|
---|
| 28 | - #recover elements distribution
|
---|
| 29 | - hutterflag =FlagElements(md,options.getfieldvalue('hutter',''))
|
---|
| 30 | - macayealflag=FlagElements(md,options.getfieldvalue('macayeal',''))
|
---|
| 31 | - pattynflag =FlagElements(md,options.getfieldvalue('pattyn',''))
|
---|
| 32 | - stokesflag =FlagElements(md,options.getfieldvalue('stokes',''))
|
---|
| 33 | - filltype =options.getfieldvalue('fill','none')
|
---|
| 34 | -
|
---|
| 35 | return hutterflag,macayealflag,pattynflag,stokesflag,filltype
|
---|
| 36 | #}}}
|
---|
| 37 | def setflowequation(md,*args):
|
---|
| 38 | @@ -33,7 +15,7 @@
|
---|
| 39 | SETELEMENTSTYPE - associate a solution type to each element
|
---|
| 40 |
|
---|
| 41 | This routine works like plotmodel: it works with an even number of inputs
|
---|
| 42 | - 'hutter','macayeal','pattyn','stokes' and 'fill' are the possible options
|
---|
| 43 | + 'hutter','macayeal','pattyn','l1l2','stokes' and 'fill' are the possible options
|
---|
| 44 | that must be followed by the corresponding exp file or flags list
|
---|
| 45 | It can either be a domain file (argus type, .exp extension), or an array of element flags.
|
---|
| 46 | If user wants every element outside the domain to be
|
---|
| 47 | @@ -54,13 +36,22 @@
|
---|
| 48 | if not isinstance(md,model) or not len(args):
|
---|
| 49 | raise TypeError("setflowequation error message")
|
---|
| 50 |
|
---|
| 51 | + #process options
|
---|
| 52 | + options=pairoptions(*args)
|
---|
| 53 | +# options=deleteduplicates(options,1);
|
---|
| 54 | +
|
---|
| 55 | #Find_out what kind of coupling to use
|
---|
| 56 | - options=pairoptions(*args)
|
---|
| 57 | coupling_method=options.getfieldvalue('coupling','tiling')
|
---|
| 58 | if not strcmpi(coupling_method,'tiling') and not strcmpi(coupling_method,'penalties'):
|
---|
| 59 | raise TypeError("coupling type can only be: tiling or penalties")
|
---|
| 60 |
|
---|
| 61 | - hutterflag,macayealflag,pattynflag,stokesflag,filltype=recover_areas(md,*args)
|
---|
| 62 | + #recover elements distribution
|
---|
| 63 | + hutterflag = FlagElements(md,options.getfieldvalue('hutter',''))
|
---|
| 64 | + macayealflag = FlagElements(md,options.getfieldvalue('macayeal',''))
|
---|
| 65 | + pattynflag = FlagElements(md,options.getfieldvalue('pattyn',''))
|
---|
| 66 | + l1l2flag = FlagElements(md,options.getfieldvalue('l1l2',''))
|
---|
| 67 | + stokesflag = FlagElements(md,options.getfieldvalue('stokes',''))
|
---|
| 68 | + filltype = options.getfieldvalue('fill','none')
|
---|
| 69 |
|
---|
| 70 | #Flag the elements that have not been flagged as filltype
|
---|
| 71 | if strcmpi(filltype,'hutter'):
|
---|
| 72 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.m
|
---|
| 73 | ===================================================================
|
---|
| 74 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.m (revision 13027)
|
---|
| 75 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/parameterization/setflowequation.m (revision 13028)
|
---|
| 76 | @@ -23,14 +23,23 @@
|
---|
| 77 | error('setflowequation error message');
|
---|
| 78 | end
|
---|
| 79 |
|
---|
| 80 | +%Process options
|
---|
| 81 | +options=pairoptions(varargin{:});
|
---|
| 82 | +options=deleteduplicates(options,1);
|
---|
| 83 | +
|
---|
| 84 | %Find_out what kind of coupling to use
|
---|
| 85 | -options=pairoptions(varargin{:});
|
---|
| 86 | coupling_method=getfieldvalue(options,'coupling','tiling');
|
---|
| 87 | if (~strcmpi(coupling_method,'tiling') & ~strcmpi(coupling_method,'penalties')),
|
---|
| 88 | error('coupling type can only be: tiling or penalties');
|
---|
| 89 | end
|
---|
| 90 |
|
---|
| 91 | -[hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin{:});
|
---|
| 92 | +%recover elements distribution
|
---|
| 93 | +hutterflag = FlagElements(md,getfieldvalue(options,'hutter',''));
|
---|
| 94 | +macayealflag = FlagElements(md,getfieldvalue(options,'macayeal',''));
|
---|
| 95 | +pattynflag = FlagElements(md,getfieldvalue(options,'pattyn',''));
|
---|
| 96 | +l1l2flag = FlagElements(md,getfieldvalue(options,'l1l2',''));
|
---|
| 97 | +stokesflag = FlagElements(md,getfieldvalue(options,'stokes',''));
|
---|
| 98 | +filltype = getfieldvalue(options,'fill','none');
|
---|
| 99 |
|
---|
| 100 | %Flag the elements that have not been flagged as filltype
|
---|
| 101 | if strcmpi(filltype,'hutter'),
|
---|
| 102 | @@ -279,25 +288,3 @@
|
---|
| 103 | if any(md.flowequation.borderstokes) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.borderstokes~=1),
|
---|
| 104 | error('error coupling domain too irregular');
|
---|
| 105 | end
|
---|
| 106 | -end
|
---|
| 107 | -
|
---|
| 108 | -function [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin); % {{{
|
---|
| 109 | -%RECOVER_AREAS - flag the element depending on the physical model that is assigned to them
|
---|
| 110 | -%
|
---|
| 111 | -% This routine is called by setelementstype, do not use
|
---|
| 112 | -%
|
---|
| 113 | -% Usage:
|
---|
| 114 | -% [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
|
---|
| 115 | -
|
---|
| 116 | - %go through varargin, extract options and plug them into subtype options, by order of appearance
|
---|
| 117 | - options=pairoptions(varargin{:});
|
---|
| 118 | - options=deleteduplicates(options,1);
|
---|
| 119 | -
|
---|
| 120 | - %recover elements distribution
|
---|
| 121 | - hutterflag =FlagElements(md,getfieldvalue(options,'hutter',''));
|
---|
| 122 | - macayealflag=FlagElements(md,getfieldvalue(options,'macayeal',''));
|
---|
| 123 | - pattynflag =FlagElements(md,getfieldvalue(options,'pattyn',''));
|
---|
| 124 | - stokesflag =FlagElements(md,getfieldvalue(options,'stokes',''));
|
---|
| 125 | - filltype =getfieldvalue(options,'fill','none');
|
---|
| 126 | -
|
---|
| 127 | -end %end function }}}
|
---|