Menu

#46 Amélioration des bindings python pour le module mfront

3.1
closed
None
2017-05-02
2017-04-03
No
 - add missing metods in the BehaviourDescription class to retrieve information about the material symmetry


 - add missing methods to retrieve information about standard and physical variables' bounds

Discussion

  • Helfer Thomas

    Helfer Thomas - 2017-04-03
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
    
          - add missing metods in the BehaviourDescription class to retrieve information about the material symmetry
    
    
          - add missing methods to retrieve information about standard and physical variables' bounds
    
    • Milestone: 3.0.1 --> 3.1
     
  • Helfer Thomas

    Helfer Thomas - 2017-04-03
    • status: open --> accepted
     
  • Helfer Thomas

    Helfer Thomas - 2017-05-02
    • status: accepted --> closed
     
  • Helfer Thomas

    Helfer Thomas - 2017-05-02

    Fixed in revision 1655. See the example below:

    from tfel.material import ModellingHypothesis
    import mfront
    
    def printBounds(n,b):
        print('Bounds of variable \''+n+'\':')
        if((b.boundsType==mfront.VariableBoundsTypes.LOWER) or
           (b.boundsType==mfront.VariableBoundsTypes.LOWERANDUPPER)):
            print('- lower bound: '+str(b.lowerBound))
        if((b.boundsType==mfront.VariableBoundsTypes.UPPER) or
           (b.boundsType==mfront.VariableBoundsTypes.LOWERANDUPPER)):
            print('- upper bound: '+str(b.upperBound))
            print('')
    
    dsl = mfront.getDSL('Norton.mfront')
    dsl.analyseFile('Norton.mfront',[])
    
    # behaviour description
    bd = dsl.getBehaviourDescription()
    
    if(bd.getSymmetryType()==mfront.BehaviourSymmetryType.ISOTROPIC):
        print 'Isotropic behaviour\n'
    else:
        print 'Orthropic behaviour\n'
    
    if(bd.getElasticSymmetryType()==mfront.BehaviourSymmetryType.ISOTROPIC):
        print 'Isotropic elasticity\n'
    else:
        print 'Orthropic elasticity\n'
    
    # a deeper look at the 3D case
    d = bd.getBehaviourData(ModellingHypothesis.TRIDIMENSIONAL)
    for p in d.getParameters():
        if(p.arraySize==1):
            if(p.hasBounds()):
                printBounds(p.name,p.getBounds())
        else:
            for i in range(p.arraySize):
                if(p.hasBounds(i)):
                    printBounds(p.name+'['+str(i)+']',p.getBounds(i))
    
     

Log in to post a comment.

MongoDB Logo MongoDB