当前位置: 首页>>代码示例>>Python>>正文


Python exodus.exodus函数代码示例

本文整理汇总了Python中exodus.exodus函数的典型用法代码示例。如果您正苦于以下问题:Python exodus函数的具体用法?Python exodus怎么用?Python exodus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exodus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getElemsAndNodes

def getElemsAndNodes(input_file):
    "Gets the number of elements and nodes per elements in `input_file`"
    exo_from = exodus.exodus(input_file,"r",array_type='ctype')
    BLOCK_ID = 1
    _, _, nNodeElm, _ = exo_from.elem_blk_info(BLOCK_ID)
    num_elems = exo_from.num_elems()
    return (num_elems,nNodeElm)
开发者ID:SalvusHub,项目名称:salvus,代码行数:7,代码来源:model.py

示例2: read_element_type

def read_element_type(name_file_exodus):

    file_exodus = exodus(name_file_exodus)
    ids_block = file_exodus.get_elem_blk_ids()
    element_block_info = file_exodus.elem_blk_info(ids_block[0])
    element_type = element_block_info[0]
    file_exodus.close() 
    return element_type
开发者ID:gahansen,项目名称:Albany,代码行数:8,代码来源:write_file_material.py

示例3: initFromExodus

	def initFromExodus(self, fName):
		
		self.fNameIn = fName
		self.template = exodus.exodus(fName, array_type='numpy')
		self.nNode = self.template.numNodes.value
		self.nElem = self.template.numElem.value
		self.x, self.y, _ = np.array(self.template.get_coords())
		self.xMax, self.xMin = np.amax(self.x), np.amin(self.x)
		self.yMax, self.yMin = np.amax(self.y), np.amin(self.y)
开发者ID:michael-afanasiev,项目名称:salvus2,代码行数:9,代码来源:model.py

示例4: read_names_block

def read_names_block(name_file_exodus):

    file_exodus = exodus(name_file_exodus)
    ids_block = file_exodus.get_elem_blk_ids()
    names_block = file_exodus.get_elem_blk_names()
    file_exodus.close()

    for idx in range(len(ids_block)):
        if (names_block[idx] == ""):
            names_block[idx] = "block_" + str(ids_block[idx])

    return names_block
开发者ID:gahansen,项目名称:Albany,代码行数:12,代码来源:write_file_material.py

示例5: read_mesh

    def read_mesh(self, filename):
        """
		Reads the model and saves some generic information.
		"""

        self.filename = filename
        self.mesh = exodus.exodus(filename, array_type="numpy")
        self.nNode = self.mesh.numNodes.value
        self.nElem = self.mesh.numElem.value
        self.x, self.y, _ = np.array(self.mesh.get_coords())
        self.xMax, self.xMin = np.amax(self.x), np.amin(self.x)
        self.yMax, self.yMin = np.amax(self.y), np.amin(self.y)
开发者ID:michael-afanasiev,项目名称:salvus2,代码行数:12,代码来源:model.py

示例6: open_file_exodus

def open_file_exodus(name_file_exodus, mode = 'r', output = os.devnull, verbosity = 0):

    with stdout_redirected(to = output):
        file_exodus = exodus.exodus(name_file_exodus, mode)

    if verbosity > 0:

        # Print database parameters from file_exodus
        print " "
        print "Database version:         " + str(round(file_exodus.version.value,2))
        print "Database title:           " + file_exodus.title()
        print "Database dimensions:      " + str(file_exodus.num_dimensions())
        print "Number of nodes:          " + str(file_exodus.num_nodes())
        print "Number of elements:       " + str(file_exodus.num_elems())
        print "Number of element blocks: " + str(file_exodus.num_blks())
        print "Number of node sets:      " + str(file_exodus.num_node_sets())
        print "Number of side sets:      " + str(file_exodus.num_side_sets())
        print " "

    return file_exodus
开发者ID:timetravellers,项目名称:Albany,代码行数:20,代码来源:lcm_exodus.py

示例7: initialize_genesis

def initialize_genesis(genesis_input=None, genesis_output_name=None):
    if os.path.exists(genesis_output_name):
        os.remove(genesis_output_name)
    num_blocks_input = genesis_input.num_blks()
    if args.combine_blocks == True:
        num_blocks_output = 1
    else:
        num_blocks_output = num_blocks_input
    genesis_output = exodus.exodus(
        genesis_output_name,
       'w',
       'numpy',
       genesis_input.title(),
       genesis_input.num_dimensions(),
       genesis_input.num_nodes(),
       genesis_input.num_elems(),
       num_blocks_output,
       genesis_input.num_node_sets(),
       genesis_input.num_side_sets())
    return genesis_output
开发者ID:gahansen,项目名称:Albany,代码行数:20,代码来源:imprint_orientation_on_mesh.py

示例8: library

#!/usr/bin/python
# Usage:
#      chqa.py <filename>
#
# Simple python script that retrieves and prints to stdout
# the qa records of exodus file <filename>
#
# Note: This requires the exodus python module to be in a
# directory listed in $PYTHONPATH and a dynamic exodus
# library (exodus.so) to be named in exodus.py.

import exodus
import sys

ef = exodus.exodus(sys.argv[1], 'r')
print(ef.get_qa_records())
ef.close()
开发者ID:acochrane,项目名称:goma,代码行数:17,代码来源:chqa.py

示例9: exodus

'''

import sys
import os
from exodus import exodus
from exodus import copy_mesh
import numpy
import matplotlib.pyplot as plt

inFileName = sys.argv[1]
outFileName = sys.argv[2]


# set i/o units ------------------------------------------------------------------------------------

inFile = exodus(inFileName,"r")
if os.path.isfile(outFileName):
  cmdLine = "rm %s" % outFileName
  os.system(cmdLine)
outFile = copy_mesh(inFileName, outFileName)


# get number of dimensions -------------------------------------------------------------------------
num_dims = inFile.num_dimensions()

print "Dimensions"
print num_dims


# get times ----------------------------------------------------------------------------------------
times = inFile.get_times()
开发者ID:ImmutableLtd,项目名称:Albany,代码行数:31,代码来源:LCM_postprocess.py

示例10: len

    # Remove old version of the exodus file, if it exists
    if os.path.exists(exodusFileName):
        os.remove(exodusFileName)

    # Open the output Exodus file
    exodusNumberOfDimensions = 3
    exodusNumberOfNodes = len(X)
    exodusNumberOfElements = len(X)
    exodusNumberOfBlocks = len(blocks)
    exodusNumberOfNodeSets = len(nodeSets)
    exodusNumberOfSideSets = 0
    exodusFile = exodus.exodus( exodusFileName,
                                'w',
                                'ctype',
                                exodusTitle,
                                exodusNumberOfDimensions,
                                exodusNumberOfNodes,
                                exodusNumberOfElements,
                                exodusNumberOfBlocks,
                                exodusNumberOfNodeSets,
                                exodusNumberOfSideSets )

    # Write the nodal coordinates
    coordNames = ["X", "Y", "Z"]
    exodusFile.put_coord_names(coordNames)
    exodusFile.put_coords(X, Y, Z)

    exodusBlockIds = []
    for key in blocks.keys():
        exodusBlockIds.append(key)

    # Write the element block information
开发者ID:DrRokkam,项目名称:peridigm,代码行数:32,代码来源:text_to_genesis.py

示例11:

#!/usr/bin/env python
from optparse import OptionParser
import sys
import os
module_dir = os.path.dirname(os.path.realpath(__file__))
module_dir += '/modules'
sys.path.append(module_dir)
import exodus

database_path = "baseline.g"

#Test outputing c-type arrays and numpy arrays
array_types = ['ctype', 'numpy']
for array_type in array_types:
    e = exodus.exodus(database_path, array_type = array_type)
    print "Exodus file has title:", e.title()
    print "Exodus file has", e.num_dimensions(), "dimensions"
    print "Exodus file has", e.num_nodes(), "nodes"
    print "Exodus file has", e.num_elems(), "elements"
    print "Exodus file has", e.num_blks(), "blocks"
    print "Exodus file has", e.num_node_sets(), "node sets"
    print "Exodus file has", e.num_side_sets(), "side sets"
    print "Exodus file has", e.num_times(), "time steps"
    if e.num_times() > 0:
      times = e.get_times()
      for time in times:
        print "time = ", time
        
    blocks = e.get_elem_blk_ids()
    for block in blocks:
      print "block id = ", block
开发者ID:milljm,项目名称:seacas,代码行数:31,代码来源:testExo.py

示例12: len

    if len(sys.argv) < 3:
        print "\nUsage:  imprint_orientation_on_mesh.py <mesh.g> <orientations.txt> [options]\n"
        print "Options:\n  --combine_blocks\n"
        sys.exit(1)

    # "rotation matrix" or "euler angles"
    orientation_format = "rotation matrix"

    num_orientation_attributes = 0
    if orientation_format == "rotation matrix":
        num_orientation_attributes = 9
    elif orientation_format == "euler angles":
        num_orientation_attributes = 3

    genesis_input_name = sys.argv[1]
    genesis_input = exodus.exodus(genesis_input_name, mode='r')
    combine_blocks = False
    if len(sys.argv) > 3:
        option = sys.argv[3]
        if option == "--combine_blocks":
            combine_blocks = True

    # Read the orientation data

    orientations_input_name = sys.argv[2]
    orientations_file = open(orientations_input_name, 'r')
    orientations_lines = orientations_file.readlines()
    orientations_file.close()
    orientations = []
    for line in orientations_lines:
        vals = string.splitfields(line)
开发者ID:gahansen,项目名称:Albany,代码行数:31,代码来源:imprint_orientation_on_mesh.py

示例13: len

#    The path above is valid on the CEE LAN.  On other systems, you need to provide a path to a SEACAS build
#    that includes shared libraries.
import sys
sys.path.append('/ascldap/users/djlittl/Albany_TPL/trilinos/trilinos-votd/GCC_4.7.2_OPT/bin')
sys.path.append('/home/glbergel/LCM/trilinos-install-serial-gcc-release/bin')
import exodus
import string

if __name__ == "__main__":

    if len(sys.argv) != 2:
        print "\nUsage:  PostProcess.py <exodus_file_name>\n"
        sys.exit(1)

    inFileName = sys.argv[1]
    inFile = exodus.exodus(inFileName, mode='r')

    outFileLabel = string.splitfields(inFileName, '.')[0] + "_"

    # Print database parameters from inFile
    print " "
    print "Database version:         " + str(round(inFile.version.value,2))
    print "Database title:           " + inFile.title()
    print "Database dimensions:      " + str(inFile.num_dimensions())
    print "Number of nodes:          " + str(inFile.num_nodes())
    print "Number of elements:       " + str(inFile.num_elems())
    print "Number of element blocks: " + str(inFile.num_blks())
    print "Number of node sets:      " + str(inFile.num_node_sets())
    print "Number of side sets:      " + str(inFile.num_side_sets())
    print " "
开发者ID:gahansen,项目名称:Albany,代码行数:30,代码来源:PostProcess.py

示例14: __reload_from_tmp

 def __reload_from_tmp(self):
     self.exodus_template = exodus.exodus(TEMP_EXODUS_FILENAME, array_type='numpy')
开发者ID:gitter-badger,项目名称:salvus,代码行数:2,代码来源:model.py

示例15: exodus

import sys

sys.path.append('/opt/moose/seacas/lib')

from exodus import exodus

e = exodus('xyz.e', mode='r', array_type='numpy')

print e.num_elems()
开发者ID:ZanderUF,项目名称:ExodusWriter,代码行数:9,代码来源:ex_read.py


注:本文中的exodus.exodus函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。