Ejemplo n.º 1
0
def InputReader( argv ):

  options, remainder = getopt.getopt( argv , 'a:k:v', ['all','author='])

  proFileName  = argv[1]
  props        = fileParser( proFileName )

  dataFileName = props.input

  nodes = NodeSet()
  nodes.readFromFile( dataFileName )
  
  elems = ElementSet( nodes , props )
  elems.readFromFile( dataFileName )
  
  dofs = DofSpace( elems )
  dofs.readFromFile( dataFileName )

  globdat = GlobalData( nodes, elems, dofs ) 

  globdat.readFromFile( dataFileName )

  globdat.active = True
  globdat.cycle  = 0
  globdat.prefix = os.path.splitext(proFileName)[0]
	
  return props,globdat
Ejemplo n.º 2
0
def InputReader(argv):

    options, remainder = getopt.getopt(argv, 'a:k:v', ['all', 'author='])

    proFileName = argv[1]
    props = fileParser(proFileName)

    dataFileName = props.input

    nodes = NodeSet()
    nodes.readFromFile(dataFileName)

    elems = ElementSet(nodes, props)
    elems.readFromFile(dataFileName)

    dofs = DofSpace(elems)
    dofs.readFromFile(dataFileName)

    globdat = GlobalData(nodes, elems, dofs)

    globdat.readFromFile(dataFileName)

    globdat.active = True
    globdat.cycle = 0
    globdat.prefix = os.path.splitext(proFileName)[0]

    return props, globdat
Ejemplo n.º 3
0
def InputRead( fname , dname = None , parameters = None ):

  if dname is not None:
    with open(dname, 'rb') as f:
      data = pickle.load(f)
      props = data["props"]
  
  if fname is not None:
    if fname[-4:] == '.pro':
      props        = fileParser( fname )
    else:
      props        = fileParser( fname+'.pro')
    
  if parameters is not None:  
    for p in parameters:
      x = p.split("=")
      props.store(x[0],x[1])
      
  if dname is not None:
    return props,data["globdat"]

  dataFileName = props.input

  logger = setLogger( props )

  nodes = NodeSet()
  nodes.readFromFile( dataFileName )
  logger.info(nodes)
  
  elems = ElementSet( nodes , props )
  elems.readFromFile( dataFileName )
  logger.info(elems)  
  
  dofs = DofSpace( elems )
  dofs.readFromFile( dataFileName )

  globdat = GlobalData( nodes, elems, dofs ) 

  globdat.readFromFile( dataFileName )

  globdat.active = True
  globdat.prefix = os.path.splitext(fname)[0]
  
  globdat.contact = Contact( props )
  	
  return props,globdat
Ejemplo n.º 4
0
nodes.add(3, [10., 0.])  #Right support
nodes.add(4, [0., 0.5])  #Loading point

#ElementSet
from pyfem.fem.ElementSet import ElementSet

elements = ElementSet(nodes, props)

elements.add(1, 'TrussElem', [2, 4])
elements.add(2, 'TrussElem', [3, 4])
elements.add(3, 'SpringElem', [1, 4])

#DofSpace
from pyfem.fem.DofSpace import DofSpace

dofs = DofSpace(elements)

dofs.constrain(1, ['u', 'v'])
dofs.constrain(2, ['u', 'v'])
dofs.constrain(3, ['u', 'v'])

###################################
# Store in global data dictionary #
###################################

from pyfem.util.dataStructures import GlobalData

globdat = GlobalData(nodes, elements, dofs)

################################
# Solution procedure (Box 2.3) #
Ejemplo n.º 5
0
nodes.add( 3, [ 10.,0.  ] ) #Right support
nodes.add( 4, [ 0. ,0.5 ] ) #Loading point

#ElementSet
from pyfem.fem.ElementSet import ElementSet

elements = ElementSet( nodes , props )

elements.add( 1, 'TrussElem'  , [2,4]  )
elements.add( 2, 'TrussElem'  , [3,4]  )
elements.add( 3, 'SpringElem' , [1,4]  )

#DofSpace
from pyfem.fem.DofSpace import DofSpace

dofs = DofSpace( elements )

dofs.constrain( 1, ['u','v'] )
dofs.constrain( 2, ['u','v'] )
dofs.constrain( 3, ['u','v'] )

###################################
# Store in global data dictionary #
###################################

from pyfem.util.dataStructures import GlobalData

globdat = GlobalData( nodes, elements, dofs )

################################
# Solution procedure (Box 2.3) #