@@ -479,12 +479,6 @@ void AbaqusIO::read_nodes(std::string nset_name)
479479 char c ;
480480 std ::string line ;
481481
482- // Defines the sequential node numbering used by libmesh. Since
483- // there can be multiple *NODE sections in an Abaqus file, we always
484- // start our numbering with the number of nodes currently in the
485- // Mesh.
486- dof_id_type libmesh_node_id = the_mesh .n_nodes ();
487-
488482 // We need to duplicate some of the read_ids code if this *NODE
489483 // section also defines an NSET. We'll set up the id_storage
490484 // pointer and push back IDs into this vector in the loop below...
@@ -527,13 +521,17 @@ void AbaqusIO::read_nodes(std::string nset_name)
527521 if (id_storage )
528522 id_storage -> push_back (abaqus_node_id );
529523
530- // Set up the abaqus -> libmesh node mapping. This is usually just the
531- // "off-by-one" map, but it doesn't have to be.
532- _abaqus_to_libmesh_node_mapping [abaqus_node_id ] = libmesh_node_id ;
524+ // Convert from Abaqus 1-based to libMesh 0-based numbering
525+ libmesh_error_msg_if (abaqus_node_id < 1 ,
526+ "Invalid Abaqus node ID found" );
527+ const dof_id_type libmesh_node_id = abaqus_node_id - 1 ;
528+
529+ libmesh_error_msg_if (the_mesh .query_node_ptr (libmesh_node_id ),
530+ "Duplicate Abaqus node ID found" );
533531
534532 // Add the point to the mesh using libmesh's numbering,
535533 // and post-increment the libmesh node counter.
536- the_mesh .add_point (Point (x ,y ,z ), libmesh_node_id ++ );
534+ the_mesh .add_point (Point (x ,y ,z ), libmesh_node_id );
537535 } // while
538536}
539537
@@ -678,12 +676,12 @@ void AbaqusIO::read_elements(std::string upper, std::string elset_name)
678676 char c ;
679677 _in >> abaqus_elem_id >> c ;
680678
681- // Add an element of the appropriate type to the Mesh.
682- Elem * elem = the_mesh .add_elem (Elem ::build (elem_type ));
679+ // Add an element of the appropriate type to the Mesh, with the
680+ // abaqus element ID.
681+ std ::unique_ptr < Elem > new_elem = Elem ::build (elem_type );
682+ new_elem -> set_id () = abaqus_elem_id ;
683683
684- // Associate the ID returned from libmesh with the abaqus element ID
685- //_libmesh_to_abaqus_elem_mapping[elem->id()] = abaqus_elem_id;
686- _abaqus_to_libmesh_elem_mapping [abaqus_elem_id ] = elem -> id ();
684+ Elem * elem = the_mesh .add_elem (std ::move (new_elem ));
687685
688686 // The count of the total number of IDs read for the current element.
689687 unsigned id_count = 0 ;
@@ -707,8 +705,10 @@ void AbaqusIO::read_elements(std::string upper, std::string elset_name)
707705
708706 if (success )
709707 {
710- // Use the global node number mapping to determine the corresponding libmesh global node id
711- dof_id_type libmesh_global_node_id = _abaqus_to_libmesh_node_mapping [abaqus_global_node_id ];
708+ // Map the id'th element ID (Abaqus 1-based numbering) to LibMesh numbering
709+ libmesh_error_msg_if (abaqus_global_node_id < 1 ,
710+ "Invalid Abaqus node ID found" );
711+ const dof_id_type libmesh_global_node_id = abaqus_global_node_id - 1 ;
712712
713713 // Grab the node pointer from the mesh for this ID
714714 Node * node = the_mesh .node_ptr (libmesh_global_node_id );
@@ -993,8 +993,10 @@ void AbaqusIO::assign_subdomain_ids()
993993 // Loop over this vector
994994 for (const auto & id : id_vector )
995995 {
996- // Map the id'th element ID (Abaqus numbering) to LibMesh numbering
997- dof_id_type libmesh_elem_id = _abaqus_to_libmesh_elem_mapping [id ];
996+ // Map the id'th element ID (Abaqus 1-based numbering) to LibMesh numbering
997+ libmesh_error_msg_if (id < 1 ,
998+ "Invalid Abaqus element ID found ");
999+ const dof_id_type libmesh_elem_id = id - 1 ;
9981000
9991001 // Get reference to that element
10001002 Elem & elem = the_mesh .elem_ref (libmesh_elem_id );
@@ -1047,8 +1049,10 @@ void AbaqusIO::assign_boundary_node_ids()
10471049
10481050 for (const auto & id : nodeset_ids )
10491051 {
1050- // Map the Abaqus global node ID to the libmesh node ID
1051- dof_id_type libmesh_global_node_id = _abaqus_to_libmesh_node_mapping [id ];
1052+ // Map the id'th element ID (Abaqus 1-based numbering) to LibMesh numbering
1053+ libmesh_error_msg_if (id < 1 ,
1054+ "Invalid Abaqus node ID found ");
1055+ const dof_id_type libmesh_global_node_id = id - 1 ;
10521056
10531057 // Get node pointer from the mesh
10541058 Node * node = the_mesh .node_ptr (libmesh_global_node_id );
@@ -1087,8 +1091,10 @@ void AbaqusIO::assign_sideset_ids()
10871091
10881092 for (const auto & [abaqus_elem_id , abaqus_side_number ] : sideset_ids )
10891093 {
1090- // Map the Abaqus element ID to LibMesh numbering
1091- dof_id_type libmesh_elem_id = _abaqus_to_libmesh_elem_mapping [ abaqus_elem_id ];
1094+ // Map the id'th element ID (Abaqus 1-based numbering) to LibMesh numbering
1095+ libmesh_error_msg_if (abaqus_elem_id < 1 ,
1096+ "Invalid Abaqus element ID found ");
1097+ const dof_id_type libmesh_elem_id = abaqus_elem_id - 1 ;
10921098
10931099 // Get a reference to that element
10941100 Elem & elem = the_mesh .elem_ref (libmesh_elem_id );
@@ -1143,8 +1149,10 @@ void AbaqusIO::assign_sideset_ids()
11431149 // Loop over this vector
11441150 for (const auto & id : id_vector )
11451151 {
1146- // Map the id_vector[i]'th element ID (Abaqus numbering) to LibMesh numbering
1147- dof_id_type libmesh_elem_id = _abaqus_to_libmesh_elem_mapping [id ];
1152+ // Map the id'th element ID (Abaqus 1-based numbering) to LibMesh numbering
1153+ libmesh_error_msg_if (id < 1 ,
1154+ "Invalid Abaqus element ID found ");
1155+ const dof_id_type libmesh_elem_id = id - 1 ;
11481156
11491157 // Get a reference to that element
11501158 Elem & elem = the_mesh .elem_ref (libmesh_elem_id );
0 commit comments