@@ -25,46 +25,68 @@ public:
2525 CPPUNIT_TEST_SUITE_END ();
2626
2727private :
28+ template < typename T >
2829 void test (const std ::string in_file , const std ::string gold_file , bool move_nodes )
2930 {
3031 // load input mesh
31- ReplicatedMesh in_mesh (* TestCommWorld );
32- ExodusII_IO exii (in_mesh );
32+ T in_mesh (* TestCommWorld );
33+ ExodusII_IO in_exii (in_mesh );
3334 if (in_mesh .processor_id () == 0 )
34- exii .read (in_file );
35+ in_exii .read (in_file );
3536 MeshCommunication ().broadcast (in_mesh );
37+ in_mesh .skip_partitioning (true);
38+ in_mesh .allow_renumbering (false);
3639 in_mesh .prepare_for_use ();
3740
3841 // load gold file
39- ReplicatedMesh gold_mesh (* TestCommWorld );
40- ExodusII_IO exii (gold_mesh );
42+ T gold_mesh (* TestCommWorld );
43+ ExodusII_IO gold_exii (gold_mesh );
4144 if (gold_mesh .processor_id () == 0 )
42- exii .read (gold_file );
45+ gold_exii .read (gold_file );
4346 MeshCommunication ().broadcast (gold_mesh );
47+ gold_mesh .skip_partitioning (true);
48+ gold_mesh .allow_renumbering (false);
4449 gold_mesh .prepare_for_use ();
4550
4651 // run mesh smoother for 100 iterations
4752 LaplaceMeshSmoother lms (static_cast < UnstructuredMesh & > (in_mesh ), move_nodes );
4853 lms .smooth (100 );
4954
5055 // compare node positions
51- for (const auto & node : in_mesh .node_ref_range ())
52- {
53- Point a = node ;
54- Point b = gold_mesh .node_ref (node -> id ());
55- CPPUNIT_ASSERT ((a - b ).norm () < 1e-6 );
56- }
56+ for (const auto & node : in_mesh .node_ptr_range ())
57+ {
58+ Point a = * node ;
59+ Point b = gold_mesh .node_ref (node -> id ());
60+ // std::cout << node->id() << ": " << a << " == " << b << " (" << (a - b).norm() << ")\n";
61+ CPPUNIT_ASSERT ((a - b ).norm () < 1e-6 );
62+ }
5763 }
5864
5965public :
6066 void setUp () {}
6167
6268 void tearDown () {}
6369
64- void laplace_smooth_2d_fixed_boundary_nodes () { LOG_UNIT_TEST ; test ("meshes/smooth2d_in.e" , "smooth2d_nomove.e" , false); }
65- void laplace_smooth_2d_movable_boundary_nodes () { LOG_UNIT_TEST ; test ("meshes/smooth2d_in.e" , "smooth2d_move.e" , true); }
66- void laplace_smooth_3d_fixed_boundary_nodes () { LOG_UNIT_TEST ; test ("meshes/smooth3d_in.e" , "smooth3d_nomove.e" , false); }
67- void laplace_smooth_3d_movable_boundary_nodes () { LOG_UNIT_TEST ; test ("meshes/smooth3d_in.e" , "smooth3d_move.e" , true); }
70+ void laplace_smooth_2d_fixed_boundary_nodes ()
71+ {
72+ LOG_UNIT_TEST ;
73+ test < DistributedMesh > ("meshes/smooth2d_in.e" , "meshes/smooth2d_nomove.e" , false);
74+ }
75+ void laplace_smooth_2d_movable_boundary_nodes ()
76+ {
77+ LOG_UNIT_TEST ;
78+ test < DistributedMesh > ("meshes/smooth2d_in.e" , "meshes/smooth2d_move.e" , true);
79+ }
80+ void laplace_smooth_3d_fixed_boundary_nodes ()
81+ {
82+ LOG_UNIT_TEST ;
83+ test < DistributedMesh > ("meshes/smooth3d_in.e" , "meshes/smooth3d_nomove.e" , false);
84+ }
85+ void laplace_smooth_3d_movable_boundary_nodes ()
86+ {
87+ LOG_UNIT_TEST ;
88+ test < DistributedMesh > ("meshes/smooth3d_in.e" , "meshes/smooth3d_move.e" , true);
89+ }
6890};
6991
70- CPPUNIT_TEST_SUITE_REGISTRATION (CopyNodesAndElementsTest );
92+ CPPUNIT_TEST_SUITE_REGISTRATION (SmoothMeshTest );
0 commit comments