Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add numBlob to the parameters for the ex_init_params method. #543

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions packages/seacas/scripts/exodus3.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,12 @@ class ex_options(Enum):
if os.name == 'nt':
so_prefix = ''
so_suffix = 'dll'
elif os.uname()[0] == 'Darwin':
so_prefix = 'lib'
so_suffix = 'dylib'
else:
if os.uname()[0] == 'Darwin':
so_prefix = 'lib'
so_suffix = 'dylib'
else:
so_prefix = 'lib'
so_suffix = 'so'
so_prefix = 'lib'
so_suffix = 'so'
pip_path = os.path.dirname(__file__)
pip_so_path = os.path.join(pip_path, f"{so_prefix}exodus.{so_suffix}")
try:
Expand Down Expand Up @@ -673,7 +672,7 @@ def __init__(self, file, mode=None, array_type='ctype', title=None,


>>> ex_pars = ex_init_params(num_dim=numDims, num_nodes=numNodes,
... num_elem=numElems, num_elem_blk=numElemBlocks, num_assembly=numAssembly)
... num_elem=numElems, num_elem_blk=numElemBlocks, num_assembly=numAssembly, num_blob=numBlob)
>>> exo = exodus(file_name, mode=mode, title=title,
... array_type=array_type, init_params=ex_pars)
>>> with exodus(file_name, mode=mode, title=title,\
Expand Down Expand Up @@ -729,7 +728,10 @@ def __init__(self, file, mode=None, array_type='ctype', title=None,
numElems = 0
if numBlocks is None:
numBlocks = 0

if numBlob is None:
numBlob = 0
if numAssembly is None:
numAssembly = 0
info = [title, numDims, numNodes, numElems, numBlocks,
numNodeSets, numSideSets]
if None not in info:
Expand Down Expand Up @@ -842,6 +844,7 @@ def put_info_ext(self, p):
self.numNodeSets = ctypes.c_longlong(p.num_node_sets)
self.numSideSets = ctypes.c_longlong(p.num_side_sets)
self.numAssembly = ctypes.c_longlong(p.num_assembly)
self.numBlob = ctypes.c_longlong(p.num_blob)

EXODUS_LIB.ex_put_init_ext(self.fileId, ctypes.byref(p))
return True
Expand Down
14 changes: 14 additions & 0 deletions packages/seacas/scripts/tests/test_exodus3.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

ACCESS = os.getenv("ACCESS", "@ACCESSDIR@")
sys.path.append(os.path.join(ACCESS, "lib"))
sys.path.append(os.path.join(ACCESS, "lib64"))
import exodus as exo


Expand Down Expand Up @@ -59,6 +60,19 @@ def test_exodus_context_manager_reraises_exceptions(self):
with exo.exodus(self.temp_exo_path, mode="r"):
self.assertFalse(True)

def test_ex_init_params(self):
ex_pars = exo.ex_init_params(
num_dim=2,
num_nodes=9,
num_elem=4,
num_elem_blk=1,
num_assembly=0,
num_blob=0,
)
new_temp_exo_path = os.path.join(self.tempdir.name, "newexodusfile.e")
with exo.exodus(new_temp_exo_path, mode="w+", init_params=ex_pars) as exo_file:
exo_file.summarize()

def test_copy_opened_in_append_mode(self):
new = exo.assembly(
name="Unit_test", type=exo.ex_entity_type.EX_ASSEMBLY, id=444
Expand Down
Loading