This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pymoab as mb | |
def load_model(filename): | |
mbcore = mb.core.Core() | |
mbcore.load_file(filename) | |
return mbcore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
num_blocks = 64 | |
lines_in_block = 300 | |
skip_lines = 1 | |
data_offset = { 'up' : 0, 'down' : 17 } | |
names = ['block',' energy', 's_up', 'p_up', 'd_up', 'f_up', 's_down', 'p_down', 'd_down', 'f_down'] | |
formats = ['i8', 'f8', 'f8', '3f8', '5f8', '7f8', 'f8', '3f8', '5f8', '7f8'] | |
rec_type = np.dtype({'names':names, 'formats': formats}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_blocks = 64 | |
lines_in_block = 300 | |
skip_lines = 1 | |
data_offset = { 'up' : 0, 'down' : 17 } | |
# This could be even more compact, although arguably less readable, | |
# if you just immediately wrote everything to the output file rather | |
# that storing in variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/cmake | |
-- The C compiler identification is GNU 4.8.4 | |
-- The CXX compiler identification is GNU 4.8.4 | |
-- Check for working C compiler: /usr/bin/cc | |
-- Check for working C compiler: /usr/bin/cc -- works | |
-- Detecting C compiler ABI info | |
-- Detecting C compiler ABI info - done | |
-- Check for working CXX compiler: /usr/bin/c++ | |
-- Check for working CXX compiler: /usr/bin/c++ -- works | |
-- Detecting CXX compiler ABI info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake: /root/miniconda/lib/liblzma.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libarchive.so.13) | |
cmake: /root/miniconda/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4) | |
cmake: /root/miniconda/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4) | |
cmake: /root/miniconda/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4) | |
cmake: /root/miniconda/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4) | |
-- The C compiler identification is GNU 5.2.1 | |
-- The CXX compiler identification is GNU 5.2.1 | |
-- Check for working C compiler: /usr/bin/cc | |
-- Check for working C compiler: /usr/bin/cc -- works | |
-- Detecting C compiler ABI info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\[\e[33m\]\w\[\e[1;$(get_git_color)m\] $(parse_git_branch)\[\e[0m\]\n> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Range siblings; | |
Range::iterator cn; | |
EntityHandle parent; | |
siblings.clear() | |
siblings.insert(head); | |
cn = siblings.begin(); | |
insertion = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put the following into your bash startup files | |
function parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
function get_git_color() { | |
isred=`git status -s 2> /dev/null | egrep "^.[^? ]" | wc | awk '{print $1}'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mat_lib = MaterialLibrary( | |
{ | |
'Water': Material( | |
density=1.0, | |
comp={1000: 11.11, 8000: 88.89} | |
) | |
}) | |
{'Water' : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
given: p(k) for k = 1..n such that sum(p(k)) = 1, p(k) >= 0 | |
# multiply entire vector by n | |
p *= n | |
# initialize pair to -1 | |
pair = -1 | |
for k=1..n | |
if p(k) <= 1 | |
small_list.append(k) |