@@ -25,46 +25,68 @@ public:
25
25
CPPUNIT_TEST_SUITE_END ();
26
26
27
27
private :
28
+ template < typename T >
28
29
void test (const std ::string in_file , const std ::string gold_file , bool move_nodes )
29
30
{
30
31
// 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 );
33
34
if (in_mesh .processor_id () == 0 )
34
- exii .read (in_file );
35
+ in_exii .read (in_file );
35
36
MeshCommunication ().broadcast (in_mesh );
37
+ in_mesh .skip_partitioning (true);
38
+ in_mesh .allow_renumbering (false);
36
39
in_mesh .prepare_for_use ();
37
40
38
41
// 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 );
41
44
if (gold_mesh .processor_id () == 0 )
42
- exii .read (gold_file );
45
+ gold_exii .read (gold_file );
43
46
MeshCommunication ().broadcast (gold_mesh );
47
+ gold_mesh .skip_partitioning (true);
48
+ gold_mesh .allow_renumbering (false);
44
49
gold_mesh .prepare_for_use ();
45
50
46
51
// run mesh smoother for 100 iterations
47
52
LaplaceMeshSmoother lms (static_cast < UnstructuredMesh & > (in_mesh ), move_nodes );
48
53
lms .smooth (100 );
49
54
50
55
// 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
+ }
57
63
}
58
64
59
65
public :
60
66
void setUp () {}
61
67
62
68
void tearDown () {}
63
69
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
+ }
68
90
};
69
91
70
- CPPUNIT_TEST_SUITE_REGISTRATION (CopyNodesAndElementsTest );
92
+ CPPUNIT_TEST_SUITE_REGISTRATION (SmoothMeshTest );
0 commit comments