def test_mixedset_cache_hit(self, base_set): ms = op2.MixedSet([base_set, base_set]) ms2 = op2.MixedSet([base_set, base_set]) assert ms is ms2 assert not ms != ms2 assert ms == ms2
def test_mixedset_cache_miss(self, base_set, base_set2): ms = op2.MixedSet([base_set, base_set2]) ms2 = op2.MixedSet([base_set2, base_set]) assert ms is not ms2 assert ms != ms2 assert not ms == ms2 ms3 = op2.MixedSet([base_set, base_set2]) assert ms is ms3 assert not ms != ms3 assert ms == ms3
def node_set(self): r"""A :class:`pyop2.MixedSet` containing the nodes of this :class:`MixedFunctionSpace`. This is composed of the :attr:`FunctionSpace.node_set`\s of the underlying :class:`FunctionSpace`\s this :class:`MixedFunctionSpace` is composed of one or (for VectorFunctionSpaces) more degrees of freedom are stored at each node.""" return op2.MixedSet(s.node_set for s in self._spaces)
def test_sparsity_cache_hit(self, base_set, base_map): dsets = (base_set, base_set) maps = (base_map, base_map) sp = op2.Sparsity(dsets, maps) sp2 = op2.Sparsity(dsets, maps) assert sp is sp2 assert not sp != sp2 assert sp == sp2 dsets = op2.MixedSet([base_set, base_set]) maps = op2.MixedMap([base_map, base_map]) sp = op2.Sparsity(dsets, maps) dsets2 = op2.MixedSet([base_set, base_set]) maps2 = op2.MixedMap([base_map, base_map]) sp2 = op2.Sparsity(dsets2, maps2) assert sp is sp2 assert not sp != sp2 assert sp == sp2
def test_sparsity_cache_miss(self, base_set, base_set2, base_map, base_map2): dsets = (base_set, base_set) maps = (base_map, base_map) sp = op2.Sparsity(dsets, maps, iteration_regions=[(op2.ALL, )]) dsets2 = op2.MixedSet([base_set, base_set]) maps2 = op2.MixedMap([base_map, base_map]) sp2 = op2.Sparsity(dsets2, maps2, iteration_regions=[(op2.ALL, )]) assert sp is not sp2 assert sp != sp2 assert not sp == sp2 dsets2 = (base_set, base_set2) maps2 = (base_map, base_map2) sp2 = op2.Sparsity(dsets2, maps2, iteration_regions=[(op2.ALL, )]) assert sp is not sp2 assert sp != sp2 assert not sp == sp2
def test_mixed_vec_access(self): s = op2.Set(1) ms = op2.MixedSet([s, s]) d = op2.MixedDat(ms) d.data[0][:] = 1.0 d.data[1][:] = 2.0 with d.vec_ro as v: assert np.allclose(v.array_r, [1.0, 2.0]) d.data[0][:] = 0.0 d.data[0][:] = 0.0 with d.vec_wo as v: assert np.allclose(v.array_r, [1.0, 2.0]) v.array[:] = 1 assert d.data[0][0] == 1 assert d.data[1][0] == 1
def test_sparsity_cache_miss(self, base_set, base_set2, base_map, base_map2): dsets = (base_set, base_set) maps = (base_map, base_map) sp = op2.Sparsity(dsets, maps) dsets2 = op2.MixedSet([base_set, base_set]) maps2 = op2.MixedMap([base_map, base_map]) maps2 = op2.DecoratedMap(maps2, [op2.ALL]) sp2 = op2.Sparsity(dsets2, maps2) assert sp is not sp2 assert sp != sp2 assert not sp == sp2 dsets2 = (base_set, base_set2) maps2 = (base_map, base_map2) sp2 = op2.Sparsity(dsets2, maps2) assert sp is not sp2 assert sp != sp2 assert not sp == sp2
def mset(): return op2.MixedSet((op2.Set(3), op2.Set(4)))
def mset(indset, unitset): return op2.MixedSet((indset, unitset))