Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit 790efdf

Browse files
author
Dilawar Singh
committed
Some more progress. Getting a bit more faster than the current API.
1 parent 4e24621 commit 790efdf

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

python/moose/moose.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,22 @@ class PyObjId(_moose._ObjId):
2424
__class__ = ''
2525

2626
def __init__(self, x, ndata=1, **kwargs):
27-
#if isinstance(x, str):
28-
# obj = _moose.element(x) if moose.exists(x) else _moose.create(
29-
# self.__class__, x, ndata)
30-
#elif isinstance(x, _moose._ObjId):
31-
# obj = x
32-
#elif isinstance(x, _moose._Id):
33-
# obj = _moose._ObjId(x)
34-
#else:
35-
# raise RuntimeError("%s is not supported" % x)
36-
37-
# This function is overloaded. x could be string, ObjId, Id.
27+
"""
28+
This function is overloaded. x could be string, ObjId, Id.
29+
30+
It is equivalent to the following:
31+
32+
if isinstance(x, str):
33+
obj = _moose.element(x) if moose.exists(x) else _moose.create(
34+
self.__class__, x, ndata)
35+
elif isinstance(x, _moose._ObjId):
36+
obj = x
37+
elif isinstance(x, _moose._Id):
38+
obj = _moose._ObjId(x)
39+
else:
40+
raise RuntimeError("%s is not supported" % x)
41+
"""
42+
3843
obj = _moose.create(self.__class__, x, ndata)
3944
for k, v in kwargs.items():
4045
obj.setField(k, v)

0 commit comments

Comments
 (0)