Commit 8a565966 authored by Markus Holzer's avatar Markus Holzer
Browse files

Use other data type

parent 86ce0df5
Pipeline #40098 failed with stages
in 19 minutes and 36 seconds
......@@ -2,21 +2,13 @@ import unittest
import numpy as np
from waLBerla import field, createUniformBlockGrid, AABB
walberla_build_with_double_precision = True
try:
from waLBerla.field import Field_d_1
except ImportError:
walberla_build_with_double_precision = False
field_data_type = np.float64 if walberla_build_with_double_precision else np.float32
class BlockforestModuleTest(unittest.TestCase):
def testMemoryManagement1(self):
"""Testing correct reference counting of block data"""
blocks = createUniformBlockGrid(blocks=(1, 1, 1), cellsPerBlock=(2, 2, 2))
field.addToStorage(blocks, "TestField", field_data_type)
field.addToStorage(blocks, "TestField", np.int64)
f = blocks[0]["TestField"]
strides_before = f.strides
del blocks
......@@ -32,7 +24,7 @@ class BlockforestModuleTest(unittest.TestCase):
"""Testing correct reference counting of block data
Holding only a numpy array pointing to a waLBerla field should still hold the blockstructure alive"""
blocks = createUniformBlockGrid(blocks=(1, 1, 1), cellsPerBlock=(2, 2, 2))
field.addToStorage(blocks, "TestField", field_data_type)
field.addToStorage(blocks, "TestField", np.int64)
npf = field.toArray(blocks[0]["TestField"])
npf[:, :, :] = 42.0
del blocks
......@@ -44,7 +36,7 @@ class BlockforestModuleTest(unittest.TestCase):
def testMemoryManagement3(self):
"""Same as testMemoryManagement2, but with iterators"""
blocks = createUniformBlockGrid(blocks=(1, 1, 1), cellsPerBlock=(2, 2, 2))
field.addToStorage(blocks, "TestField", field_data_type)
field.addToStorage(blocks, "TestField", np.int64)
for block in blocks:
for name in block.fieldNames:
if name == "TestField":
......
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