• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python exodus.exodus函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: follows

#    The file exodus.py is in this directory.
# 2) Edit exodus.py as follows (approximately line 71):
#    accessPth = "/projects/seacas/linux_rhel6/current"
#    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")
import exodus

import string

if __name__ == "__main__":

    inFileName = "OBC_PatchTest.e"
    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:arashafshar,项目名称:Albany,代码行数:30,代码来源:OBC_PatchTest_PostProcess.py


示例17:

import sys
import exodus
import numpy
import matplotlib.pyplot as plt

file_name_exp = "SingleSlipPlaneHard_Explicit.exo"
exo_file_exp = exodus.exodus(file_name_exp,"r")

file_name_imp = "SingleSlipPlaneHard_Implicit.exo"
exo_file_imp = exodus.exodus(file_name_imp,"r")

inp_var_name = "gamma_1_1"
dep_var_name = "tau_hard_1_1"
dep_var_name_2 = "tau_1_1"
dep_var_name_3 =  "CP_Residual_1"

int_pt = 1
block_id = 2

output_file_name = "SingleSlipPlaneHard_" + dep_var_name + ".pdf"
output_file_name_2 = "SingleSlipPlaneHard_" + dep_var_name_2 + ".pdf"
output_file_name_3 = "SingleSlipPlaneHard_" + dep_var_name_3 + ".pdf"

output_file_name_png = "SingleSlipPlaneHard_" + dep_var_name + ".png"
output_file_name_2_png = "SingleSlipPlaneHard_" + dep_var_name_2 + ".png"
output_file_name_3_png = "SingleSlipPlaneHard_" + dep_var_name_3 + ".png"


############### explicit
n_steps_exp = exo_file_exp.num_times()
time_vals_exp = exo_file_exp.get_times()
开发者ID:Sam-MSU,项目名称:Albany,代码行数:31,代码来源:plot_hard_all.py


示例18: len

            basename = args.rotfile.replace('_Rotations.txt','')
            args.meshfile = basename + '.g'
        else:
            names_file = os.walk('.').next()[2]
            names_potential = [n for n in names_file if n.endswith('_Rotations.txt')]
            if len(names_potential) is 1:
                basename = names_potential[0].replace('_Rotations.txt','')
                args.rotfile = basename + '_Rotations.txt'
                args.meshfile = basename + '.g'
            else:
                raise InputError('Non-unique or missing assumed base file name')

    assert(os.path.isfile(args.meshfile))
    assert(os.path.isfile(args.rotfile))

    genesis_input = exodus.exodus(args.meshfile, mode='r', array_type='numpy')

    # Read the orientation data
    orientations = np.loadtxt(args.rotfile, ndmin=2)
    num_orientations = orientations.shape[0]
    num_dims = int(np.sqrt(orientations.shape[1]))
    assert(num_dims**2 == orientations.shape[1])

    # Print database parameters from genesis_input
    print_info(genesis_input=genesis_input)

    genesis_output_name = os.path.splitext(
        genesis_input_name)[0] + '_orientation.g'

    genesis_output = transfer_genesis(
        genesis_input=genesis_input, genesis_output_name=genesis_output_name)
开发者ID:gahansen,项目名称:Albany,代码行数:31,代码来源:imprint_orientation_on_mesh.py


示例19: write_file_exodus

def write_file_exodus(domain = None, name_file_input = None, name_file_output = None):

    times = domain.times
    num_dims = domain.num_dims

    if os.path.isfile(name_file_output):
        cmd_line = "rm %s" % name_file_output
        os.system(cmd_line)

    with stdout_redirected():
        file_input = exodus(name_file_input)
        file_output = file_input.copy(name_file_output)

    # write times to file_output
    for step in range(len(times)):
       file_output.put_time(step + 1, times[step])

    #
    # write out displacement vector
    #
    file_output.set_node_variable_number(file_input.get_node_variable_number())

    count = 0
    for key, value in domain.names_variable_node.items():
        
        for suffix in value:

            count += 1
            name_variable = key + '_' + suffix
            file_output.put_node_variable_name(name_variable, count)

            for step in range(len(times)):

                file_output.put_node_variable_values(
                    name_variable,
                    step + 1,
                    file_input.get_node_variable_values(name_variable, step + 1))

    #
    # create variables in output file
    #
    file_output.set_element_variable_number(3 * num_dims**2 + 3)

    for dim_i in range(num_dims):

        for dim_j in range(num_dims):

            name_stress = 'Cauchy_Stress_' + str(dim_i + 1) + str(dim_j + 1)

            file_output.put_element_variable_name(
                name_stress, 
                dim_i * num_dims + dim_j + 1)

            name_def_grad = 'F_' + str(dim_i + 1) + str(dim_j + 1)

            file_output.put_element_variable_name(
                name_def_grad, 
                num_dims**2 + dim_i * num_dims + dim_j + 1)

            name_strain = 'Log_Strain_' + str(dim_i + 1) + str(dim_j + 1)

            file_output.put_element_variable_name(
                name_strain, 
                2 * num_dims**2 + dim_i * num_dims + dim_j + 1)

            for key_block in domain.blocks:

                block = domain.blocks[key_block]

                for step in range(len(times)):

                    file_output.put_element_variable_values(
                        key_block,
                        name_stress,
                        step + 1,
                        [block.elements[key_element].variables['Cauchy_Stress'][times[step]][dim_i][dim_j] for key_element in block.elements])

                    file_output.put_element_variable_values(
                        key_block,
                        name_def_grad,
                        step + 1,
                        [block.elements[key_element].variables['F'][times[step]][dim_i][dim_j] for key_element in block.elements])

                    file_output.put_element_variable_values(
                        key_block,
                        name_strain,
                        step + 1,
                        [block.elements[key_element].variables['Log_Strain'][times[step]][dim_i][dim_j] for key_element in block.elements])

    file_output.put_element_variable_name(
        'Mises_Stress', 
        3 * num_dims**2 + 1)

    for key_block in domain.blocks:

        block = domain.blocks[key_block]

        for step in range(len(times)):

            file_output.put_element_variable_values(
#.........这里部分代码省略.........
开发者ID:timetravellers,项目名称:Albany,代码行数:101,代码来源:write_file_exodus.py


示例20: len

    mat_file.close()

    print "\nMaterials file written to", file_name

    return

if __name__ == "__main__":

    if len(sys.argv) != 4:
        print "\nUsage: python -m lcm_preprocess.write_file_material <mat_props.txt> <rotation_matrices.txt> <mesh_filename>\n"
        sys.exit(1)

    mat_params_file_name = sys.argv[1]
    rotations_file_name = sys.argv[2]
    name_file_exodus = sys.argv[3]
    file_exodus = exodus(name_file_exodus)
    ids_block = file_exodus.get_elem_blk_ids()
    names_block = file_exodus.get_elem_blk_names()

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

    # List of material parameters that are expected to be in the input file
    # If it's set to None, then it is a required parameter
    mat_params = {}

    mat_params["crystal_structure"] = "fcc"
    mat_params["slip_families"] = "unspecified"
    mat_params["ratio_c_a"] = "unspecified"
开发者ID:timetravellers,项目名称:Albany,代码行数:30,代码来源:write_file_material.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python HIVGraph.HIVGraph类代码示例发布时间:2022-05-24
下一篇:
Python exit.err_exit函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap