void TestAnyNonZeroNeumannConditionsAndApplyNeumannToMeshBoundary() { // Load a 2D square mesh with 1 central non-boundary node TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/square_4_elements"); TetrahedralMesh<2,2> mesh; mesh.ConstructFromMeshReader(mesh_reader); BoundaryConditionsContainer<2,2,1> bcc; BoundaryConditionsContainer<2,2,2> bcc_2unknowns; TS_ASSERT_EQUALS(bcc.AnyNonZeroNeumannConditions(), false); bcc.DefineZeroNeumannOnMeshBoundary(&mesh); TetrahedralMesh<2,2>::BoundaryElementIterator iter; iter = mesh.GetBoundaryElementIteratorBegin(); while (iter != mesh.GetBoundaryElementIteratorEnd()) { TS_ASSERT(bcc.HasNeumannBoundaryCondition(*iter)); double value = bcc.GetNeumannBCValue(*iter, (*iter)->GetNode(0)->GetPoint()); TS_ASSERT_DELTA(value, 0.0, 1e-8); iter++; } TS_ASSERT_EQUALS(bcc.AnyNonZeroNeumannConditions(), false); iter = mesh.GetBoundaryElementIteratorBegin(); ConstBoundaryCondition<2>* p_boundary_condition2 = new ConstBoundaryCondition<2>(-1); bcc_2unknowns.AddNeumannBoundaryCondition(*iter, p_boundary_condition2); TS_ASSERT_EQUALS(bcc_2unknowns.AnyNonZeroNeumannConditions(), true); }