Giter Club home page Giter Club logo

Comments (2)

gsjaardema avatar gsjaardema commented on September 28, 2024

Your intermediate solution is the correct way to handle this. It is not possible to modify the number of variables in an existing file; you must create a new file with the correct number of variables and then copy the old variables and add the new variables to the new file.

from seacas.

gsjaardema avatar gsjaardema commented on September 28, 2024

There is a copyTransfer routine that may do what you want:

def copyTransfer(fromFileName, toFileName, array_type='ctype', \
    additionalGlobalVariables=[], additionalNodalVariables=[], \
    additionalElementVariables=[], additionalElementAttributes=[]):
  """
    This function creates an exodus file toFileName and copies
    everything from exodus file fromFileName returning a file handle
    to toFileName.

    Additional space is allocated for additionalGlobalVariables,
    additionalNodalVariables and additionalElementVariables if
    specified.

    additionalGlobalVariables: list of global variable names to add.

    additionalNodalVaraibles: list of nodal variable names to add.

    additionalElementVariables: should be a list of element variable
    names to add to all blocks or tuples (name, blkIds) where name is
    the element variable to add and blkIds is a list of blkIds to add
    it to.
                                
    additionalElementAttributes: list of element attribute names to
    add to all blocks or tuples ( name, blkIds ) where name is the
    element attribute to add and blkIds is a list of blkIds to add it
    to.  Usage:

    fromFileName = "input.e"
    toFileName = "output.e"
    addGlobalVariables = [] ## Do not add any new global variables
    addNodeVariables = ["node_dummy1", "node_dummy2"] ## Add node_dummy1 and node_dummy2 as new node variables
    addElementVariables = [ ("elem_dummy1", [1, 2, 3]), "elem_dummy2" ] ## Add elem_dummy1 on blkIds 1, 2, 3 and elem_dummy2 on all blocks
    addElementAttributes = [ ("elem_attr_dummy1",[1,2,3]), "elem_attr_dummy2" ] ## Add elem_attr_dummy1 on blkIds 1,2,3 and elem_attr_dummy2 on all blocks

    toFileHandle = copyTranfer(fromFileName,toFileName,addGlobalVariables,addNodeVariables,addElementVariables,addElementAttributes)

    ## Fill in new variables

    toFileHandle.close()

  """

from seacas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.