Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/jennyhelyanwe/post_MI_postprocessing
06 December 2024, 10:21:48 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
Revision 4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9 authored by Jenny Wang on 15 December 2022, 15:53:27 UTC, committed by Jenny Wang on 15 December 2022, 15:53:27 UTC
First commit
0 parent
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9
    No releases to show
  • 4575c79
  • /
  • generate_local_stress_strain.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9
origin badgedirectory badge
swh:1:dir:4575c7954cf67361d014d653628076424a446977
origin badgecontent badge
swh:1:cnt:7afbddb7885aa1339c416e9db8cd1febca1a15d2
origin badgesnapshot badge
swh:1:snp:186a3806b6eb2061558f5264a47b071c2be0e794

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9 authored by Jenny Wang on 15 December 2022, 15:53:27 UTC
First commit
Tip revision: 4ce4daa
generate_local_stress_strain.py
import numpy
import pickle
import struct
import sys

t_start = float(sys.argv[1])
t_end = float(sys.argv[2])
f = open('heart_remeshed_3D.ensi.case', 'r')
line = f.readline()
while line != 'TIME\n':
    line = f.readline()
line = f.readline()
time_set = line.split()[-1]
line = f.readline()
number_of_steps = float(line.split()[-1])
line = f.readline()
file_numbers = []
while len(file_numbers) < number_of_steps:
    line = f.readline()
    for i in range(0, len(line.split())):
        file_numbers.append(int(line.split()[i]))
junk = f.readline()
times = []
while len(times) < number_of_steps:
    line = f.readline()
    for i in range(0, len(line.split())):
        times.append(float(line.split()[i]))
times = numpy.array(times)
file_numbers = numpy.array(file_numbers)


def read_scalar_per_node(filename):
    with open(filename, 'rb') as f:
		data = f.read() 

    out = []
    for i in numpy.arange(244, len(data), 4):
        out.append(struct.unpack("f", data[i:(i+4)])[0])
    out = numpy.array(out)
    return out

start_idx = numpy.where(times > t_start)[0][0]
end_idx = numpy.where(times < t_end)[0][-1]
meshname = 'heart_remeshed_3D'
local = pickle.load(open('local.p', 'r'))

for i in range(start_idx, end_idx):
    exx = read_scalar_per_node(meshname + '.ensi.EPSXX-'+str(file_numbers[i]).zfill(6))
    eyy = read_scalar_per_node(meshname + '.ensi.EPSYY-'+str(file_numbers[i]).zfill(6))
    ezz = read_scalar_per_node(meshname + '.ensi.EPSZZ-'+str(file_numbers[i]).zfill(6))
    exy = read_scalar_per_node(meshname + '.ensi.EPSXY-'+str(file_numbers[i]).zfill(6))
    eyz = read_scalar_per_node(meshname + '.ensi.EPSYZ-'+str(file_numbers[i]).zfill(6))
    exz = read_scalar_per_node(meshname + '.ensi.EPSXZ-'+str(file_numbers[i]).zfill(6))

    elong = meshname + '.ensi.EPSLO-'+str(file_numbers[i]).zfill(6)
    ecirc = meshname + '.ensi.EPSCI-'+str(file_numbers[i]).zfill(6)
    erad = meshname + '.ensi.EPSRA-'+str(file_numbers[i]).zfill(6)
    print 'Writing to', elong, ecirc, erad
    fid_long = open(str(elong),'w')
    fid_long.write('Alya Ensight Gold --- Scalar per-node variables file\npart\n   1\ncoordinates\n')

    fid_circ = open(str(ecirc),'w')
    fid_circ.write('Alya Ensight Gold --- Scalar per-node variables file\npart\n   1\ncoordinates\n')

    fid_rad = open(str(erad),'w')
    fid_rad.write('Alya Ensight Gold --- Scalar per-node variables file\npart\n   1\ncoordinates\n')

    for n in range(0, len(exx)):
        e_tensor = numpy.array([[exx[n], exy[n],exz[n]], 
                                [exy[n], eyy[n],eyz[n]],
                                [exz[n], eyz[n],ezz[n]]])
        circ = local[n][0:3]
        longi = local[n][3:6]
        rad = local[n][6:9]
        e_circ = numpy.dot(numpy.dot(e_tensor,circ),circ)
        e_long = numpy.dot(numpy.dot(e_tensor,longi),longi)
        e_rad = numpy.dot(numpy.dot(e_tensor,rad),rad)
        fid_circ.write(str(e_circ)+'\n')
        fid_long.write(str(e_long)+'\n')
        fid_rad.write(str(e_rad)+'\n')
    fid_circ.close()
    fid_long.close()
    fid_rad.close()

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API