yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #26899
Re: [Question #700165]: Functions in FEM-DEM
Question #700165 on Yade changed:
https://answers.launchpad.net/yade/+question/700165
Status: Open => Answered
Jan Stránský proposed the following answer:
Hi Nima,
thanks for more information.
> FEM-DEM
what does this exactly mean? [1]? [2]? something other 3rd party?
Something yours?
What is the difference in running pure DEM and DEM-FEM?
> FUNCTION HAS NOT BEEN DEFINED
Ok, it might be some scope problem e.g. if you do not use Yade executable but pure python. In this case, "saving" the functions as "global" might help, using "builtin(s)" module.
What Python version do you use?
### python 2
import __builtin__
...
def someFunction(...):
...
__builtin__.someFunction = someFunction
###
### python 3
import builtins
...
def someFunction(...):
...
builtins.someFunction = someFunction
###
The same approach can be used for other functions or variables.
Putting them into "builtin", they are "visible" also outside their scope.
Have a try. Be careful not to overwrite some important names (like
'list' or 'dict'), but seeing the functions names it should not be the
case here.
Cheers
Jan
[1] https://github.com/stranskyjan/dem-fem-coupling
[2] https://yade-dem.org/doc/FEMxDEM.html
--
You received this question notification because your team yade-users is
an answer contact for Yade.