void TestDeleteFirstOrder() throw(Exception) { #ifdef CHASTE_VTK VtkMeshReader<1,3> mesh_reader("lung/test/data/TestSubject002MajorAirways.vtu"); MutableMesh<1,3> mesh; mesh.ConstructFromMeshReader(mesh_reader); //Assign valid radii for(unsigned node_index = 0; node_index < mesh.GetNumNodes(); ++node_index) { mesh.GetNode(node_index)->AddNodeAttribute(1.0); } TS_ASSERT_EQUALS(mesh.GetNumNodes(), 12065u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 12064u); MajorAirwaysCentreLinesCleaner cleaner(mesh, 0u); cleaner.CleanUsingHorsfieldOrder(1u); NodeMap node_map(mesh.GetNumAllNodes()); mesh.ReIndex(node_map); //Confirmed visually to be correct TS_ASSERT_EQUALS(mesh.GetNumNodes(), 3683u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 3682u); // Uncomment to visualise // VtkMeshWriter<1,3> mesh_writer("TestMajorAirwaysCentreLinesCleaner", "Novartis002Trimmed"); // mesh_writer.WriteFilesUsingMesh(mesh); #endif //CHASTE_VTK }
void TestDeleteOrderSimpleMesh() throw(Exception) { TrianglesMeshReader<1,3> mesh_reader("lung/test/airway_generation/data/test_major_airways_mesh"); MutableMesh<1,3> mesh; mesh.ConstructFromMeshReader(mesh_reader); //Assign valid radii for(unsigned node_index = 0; node_index < mesh.GetNumNodes(); ++node_index) { mesh.GetNode(node_index)->rGetNodeAttributes()[0] = 1.0; } TS_ASSERT_EQUALS(mesh.GetNumNodes(), 6u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 5u); MajorAirwaysCentreLinesCleaner cleaner(mesh, 0u); cleaner.CleanUsingHorsfieldOrder(1u); NodeMap node_map(mesh.GetNumAllNodes()); mesh.ReIndex(node_map); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 2u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 1u); TS_ASSERT_DELTA(mesh.GetNode(0u)->rGetLocation()[0], 0.0, 1e-6); TS_ASSERT_DELTA(mesh.GetNode(0u)->rGetLocation()[1], 0.0, 1e-6); TS_ASSERT_DELTA(mesh.GetNode(0u)->rGetLocation()[2], -2.0, 1e-6); TS_ASSERT_DELTA(mesh.GetNode(1u)->rGetLocation()[0], 0.0, 1e-6); TS_ASSERT_DELTA(mesh.GetNode(1u)->rGetLocation()[1], 0.0, 1e-6); TS_ASSERT_DELTA(mesh.GetNode(1u)->rGetLocation()[2], 0.0, 1e-6); }