@@ -1274,46 +1274,10 @@ void DofMap::distribute_local_dofs_node_major(dof_id_type & next_free_dof,
12741274 }
12751275 }
12761276
1277- // Finally, count up the SCALAR dofs
1278- this -> _n_SCALAR_dofs = 0 ;
1279- for (unsigned vg = 0 ; vg < n_var_groups ; vg ++ )
1280- {
1281- const VariableGroup & vg_description (this -> variable_group (vg ));
1282-
1283- if (vg_description .type ().family == SCALAR )
1284- {
1285- this -> _n_SCALAR_dofs += (vg_description .n_variables ()*
1286- vg_description .type ().order .get_order ());
1287- continue ;
1288- }
1289- }
1290-
1291- // Only increment next_free_dof if we're on the processor
1292- // that holds this SCALAR variable
1293- if (this -> processor_id () == (this -> n_processors ()- 1 ))
1294- next_free_dof += _n_SCALAR_dofs ;
1277+ this -> distribute_scalar_dofs (next_free_dof );
12951278
12961279#ifdef DEBUG
1297- {
1298- // libMesh::out << "next_free_dof=" << next_free_dof << std::endl
1299- // << "_n_SCALAR_dofs=" << _n_SCALAR_dofs << std::endl;
1300-
1301- // Make sure we didn't miss any nodes
1302- MeshTools ::libmesh_assert_valid_procids < Node > (mesh );
1303-
1304- for (auto & node : mesh .local_node_ptr_range ())
1305- {
1306- unsigned int n_var_g = node -> n_var_groups (this -> sys_number ());
1307- for (unsigned int vg = 0 ; vg != n_var_g ; ++ vg )
1308- {
1309- unsigned int n_comp_g =
1310- node -> n_comp_group (this -> sys_number (), vg );
1311- dof_id_type my_first_dof = n_comp_g ?
1312- node -> vg_dof_base (this -> sys_number (), vg ) : 0 ;
1313- libmesh_assert_not_equal_to (my_first_dof , DofObject ::invalid_id );
1314- }
1315- }
1316- }
1280+ this -> assert_no_nodes_missed (mesh );
13171281#endif // DEBUG
13181282}
13191283
@@ -1405,9 +1369,19 @@ void DofMap::distribute_local_dofs_var_major(dof_id_type & next_free_dof,
14051369 }
14061370 } // end loop on variable groups
14071371
1408- // Finally, count up the SCALAR dofs
1372+ this -> distribute_scalar_dofs (next_free_dof );
1373+
1374+ #ifdef DEBUG
1375+ this -> assert_no_nodes_missed (mesh );
1376+ #endif
1377+ }
1378+
1379+
1380+
1381+ void DofMap ::distribute_scalar_dofs (dof_id_type & next_free_dof )
1382+ {
14091383 this -> _n_SCALAR_dofs = 0 ;
1410- for (unsigned vg = 0 ; vg < n_var_groups ; vg ++ )
1384+ for (auto vg : make_range ( this -> n_variable_groups ()) )
14111385 {
14121386 const VariableGroup & vg_description (this -> variable_group (vg ));
14131387
@@ -1423,28 +1397,29 @@ void DofMap::distribute_local_dofs_var_major(dof_id_type & next_free_dof,
14231397 // that holds this SCALAR variable
14241398 if (this -> processor_id () == (this -> n_processors ()- 1 ))
14251399 next_free_dof += _n_SCALAR_dofs ;
1400+ }
1401+
1402+
14261403
14271404#ifdef DEBUG
1428- {
1429- // Make sure we didn't miss any nodes
1430- MeshTools ::libmesh_assert_valid_procids < Node > (mesh );
1405+ void DofMap :: assert_no_nodes_missed ( MeshBase & mesh )
1406+ {
1407+ MeshTools ::libmesh_assert_valid_procids < Node > (mesh );
14311408
1432- for (auto & node : mesh .local_node_ptr_range ())
1433- {
1434- unsigned int n_var_g = node -> n_var_groups (this -> sys_number ());
1435- for (unsigned int vg = 0 ; vg != n_var_g ; ++ vg )
1436- {
1437- unsigned int n_comp_g =
1438- node -> n_comp_group (this -> sys_number (), vg );
1439- dof_id_type my_first_dof = n_comp_g ?
1440- node -> vg_dof_base (this -> sys_number (), vg ) : 0 ;
1441- libmesh_assert_not_equal_to (my_first_dof , DofObject ::invalid_id );
1442- }
1443- }
1444- }
1445- #endif // DEBUG
1409+ for (auto & node : mesh .local_node_ptr_range ())
1410+ {
1411+ unsigned int n_var_g = node -> n_var_groups (this -> sys_number ());
1412+ for (unsigned int vg = 0 ; vg != n_var_g ; ++ vg )
1413+ {
1414+ unsigned int n_comp_g =
1415+ node -> n_comp_group (this -> sys_number (), vg );
1416+ dof_id_type my_first_dof = n_comp_g ?
1417+ node -> vg_dof_base (this -> sys_number (), vg ) : 0 ;
1418+ libmesh_assert_not_equal_to (my_first_dof , DofObject ::invalid_id );
1419+ }
1420+ }
14461421}
1447-
1422+ #endif // DEBUG
14481423
14491424
14501425void
0 commit comments