Commit ec7ebd18 authored by Martin Bauer's avatar Martin Bauer
Browse files

Workaround for bug in joblib caching

see https://github.com/joblib/joblib/pull/568
parent baf5399f
import sympy as sp
from collections import OrderedDict, Sequence
from collections import OrderedDict
from lbmpy.methods.abstractlbmethod import AbstractLbMethod, LbmCollisionRule, RelaxationInfo
from lbmpy.methods.conservedquantitycomputation import AbstractConservedQuantityComputation
......@@ -32,16 +32,6 @@ class MomentBasedLbMethod(AbstractLbMethod):
self._conservedQuantityComputation = conservedQuantityComputation
self._weights = None
equilibriumMoments = []
for moment, relaxInfo in momentToRelaxationInfoDict.items():
equilibriumMoments.append(relaxInfo.equilibriumValue)
conservedQuantities = set()
for v in self._conservedQuantityComputation.definedSymbols().values():
if isinstance(v, Sequence):
conservedQuantities.update(v)
else:
conservedQuantities.add(v)
@property
def forceModel(self):
return self._forceModel
......@@ -126,6 +116,11 @@ class MomentBasedLbMethod(AbstractLbMethod):
def momentMatrix(self):
return momentMatrix(self.moments, self.stencil)
def __getstate__(self):
# Workaround for a bug in joblib
self._momentToRelaxationInfoDictToPickle = [i for i in self._momentToRelaxationInfoDict.items()]
return self.__dict__
def _repr_html_(self):
table = """
<table style="border:none; width: 100%">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment