void TestExceptions() { TrianglesMeshReader<1,1> mesh_reader("mesh/test/data/1D_0_to_10_100_elements"); TetrahedralMesh<1,1> mesh; mesh.ConstructFromMeshReader(mesh_reader); TS_ASSERT_THROWS_THIS(mesh.RotateZ(1.4),"This rotation is not valid in less than 2D"); TS_ASSERT_THROWS_THIS(mesh.RotateY(0.3),"This rotation is only valid in 3D"); TS_ASSERT_THROWS_THIS(mesh.RotateX(0.7),"This rotation is only valid in 3D"); }
void TestYaxisRotation3DWithMethod() { TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/cube_136_elements"); TetrahedralMesh<3,3> mesh; mesh.ConstructFromMeshReader(mesh_reader); double mesh_volume = mesh.GetVolume(); mesh.RotateY(M_PI/2.0); double new_mesh_volume = mesh.GetVolume(); TS_ASSERT_DELTA(mesh_volume, new_mesh_volume, 1e-6); ChastePoint<3> corner_after = mesh.GetNode(6)->GetPoint(); TS_ASSERT_DELTA(corner_after[0], -1.0, 1e-7); TS_ASSERT_DELTA(corner_after[1], 1.0, 1e-7); TS_ASSERT_DELTA(corner_after[2], 1.0, 1e-7); }
void TestGeneralConvolution3DWithMethod() { TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/cube_136_elements"); TetrahedralMesh<3,3> mesh; mesh.ConstructFromMeshReader(mesh_reader); double mesh_volume = mesh.GetVolume(); mesh.Translate(2.3, 3.1, 1.7); mesh.RotateZ(1.4); mesh.RotateY(0.3); mesh.RotateX(0.7); double new_mesh_volume = mesh.GetVolume(); TS_ASSERT_DELTA(mesh_volume, new_mesh_volume, 1e-6); ChastePoint<3> corner_after = mesh.GetNode(6)->GetPoint(); TS_ASSERT_DELTA(corner_after[0], 3.59782, 5e-5); TS_ASSERT_DELTA(corner_after[1], 0.583418, 5e-5); TS_ASSERT_DELTA(corner_after[2], 4.65889, 5e-5); }