예제 #1
0
 def collection(self):
     # Read is very slow, so many tests operate on the same mesh collection.
     # TODO: separate these tests by reading once and then operating on copies of original
     if TestMeshCollection._collection is None and TestMeshCollection._okay_to_read:
         TestMeshCollection._collection = gems.KvlMeshCollection()
         print('reading mesh collection...')
         TestMeshCollection._collection.read(MESH_COLLECTION_TEST_FILE_NAME)
         print('..done reading mesh collection')
     return TestMeshCollection._collection
예제 #2
0
 def test_bad_construction_domain_size(self):
     mesh_collection = gems.KvlMeshCollection()
     mesh_size = (3, 5, 7)
     domain_size = (10, 11, 13, 14)  # not 3d
     stiffness = 0.25
     number_of_classes = 6
     number_of_meshes = 3
     with pytest.raises(Exception):
         mesh_collection.construct(mesh_size, domain_size, stiffness,
                                   number_of_classes, number_of_meshes)
예제 #3
0
def make_a_test_mesh_collection(number_of_meshes):
    mesh_collection = gems.KvlMeshCollection()
    mesh_collection.construct(CONSTRUCTED_MESH_SIZE, CONSTRUCTED_DOMAIN_SIZE,
                              CONSTRUCTED_STIFFNESS,
                              CONSTRUCTED_NUMBER_OF_CLASSES, number_of_meshes)
    return mesh_collection
예제 #4
0
 def test_empty_write(self, writeable_mesh_file_name):
     empty_collection = gems.KvlMeshCollection()
     with pytest.raises(Exception):
         empty_collection.write(writeable_mesh_file_name)
예제 #5
0
 def test_bad_read(self):
     with pytest.raises(Exception):
         bad_collection = gems.KvlMeshCollection()
         bad_collection.read('nada_nada_nada')
예제 #6
0
def mesh_collection_fixture():
    collection = gems.KvlMeshCollection()
    collection.read(MESHCOLLECTION_PATH)
    return collection