def runTest(self): for cls in self.clss: m = (cls().refined(2).with_boundaries({ 'down': lambda x: x[0] == 0, }).with_subdomains({'up': lambda x: x[0] > 0.5})) M = from_dict(cls, to_dict(m)) self.assertTrue(np.sum(m.p - M.p) < 1e-13) self.assertTrue(np.sum(m.t - M.t) < 1e-13) for k in m.boundaries: self.assertTrue((m.boundaries[k] == M.boundaries[k]).all()) for k in m.subdomains: self.assertTrue((m.subdomains[k] == M.subdomains[k]).all())
def to_dict(self): from skfem.io.json import to_dict return to_dict(self)