libMesh
|
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format. More...
#include <abaqus_io.h>
Public Member Functions | |
AbaqusIO (MeshBase &mesh) | |
Constructor. More... | |
virtual | ~AbaqusIO () |
Destructor. More... | |
virtual void | read (const std::string &name) override |
This method implements reading a mesh from a specified file. More... | |
bool | is_parallel_format () const |
Returns true iff this mesh file format and input class are parallelized, so that all processors can read their share of the data at once. More... | |
Public Attributes | |
bool | build_sidesets_from_nodesets |
Default false. More... | |
Protected Types | |
typedef std::map< std::string, std::vector< dof_id_type > > | container_t |
The type of data structure used to store Node and Elemset IDs. More... | |
typedef std::map< std::string, std::vector< std::pair< dof_id_type, unsigned > > > | sideset_container_t |
Type of the data structure for storing the (elem ID, side) pairs defining sidesets. More... | |
Protected Member Functions | |
void | read_nodes (std::string nset_name) |
This function parses a block of nodes in the Abaqus file once such a block has been found. More... | |
void | read_elements (std::string upper, std::string elset_name) |
This function parses a block of elements in the Abaqus file. More... | |
std::string | parse_label (std::string line, std::string label_name) const |
This function parses a label of the form foo=bar from a comma-delimited line of the form ..., foo=bar, ... More... | |
bool | detect_generated_set (std::string upper) const |
void | read_ids (std::string set_name, container_t &container) |
This function reads all the IDs for the current node or element set of the given name, storing them in the passed map using the name as key. More... | |
void | generate_ids (std::string set_name, container_t &container) |
This function handles "generated" nset and elset sections. More... | |
void | assign_subdomain_ids () |
This function is called after all the elements have been read and assigns element subdomain IDs. More... | |
void | read_sideset (const std::string &sideset_name, const std::string &sideset_type, sideset_container_t &container) |
This function reads a sideset from the input file. More... | |
void | assign_boundary_node_ids () |
This function assigns boundary IDs to node sets based on the alphabetical order in which the sets are labeled in the Abaqus file. More... | |
void | assign_sideset_ids () |
Called at the end of the read() function, assigns any sideset IDs found when reading the file to the BoundaryInfo object. More... | |
void | process_and_discard_comments () |
Any of the various sections can start with some number of lines of comments, which start with "**". More... | |
unsigned char | max_elem_dimension_seen () |
bool | string_to_num (const std::string &input, dof_id_type &output) const |
Attempts to convert the input string to a numerical value using strtol. More... | |
void | strip_ws (std::string &line) const |
Removes all whitespace characters from "line". More... | |
virtual void | extended_parsing (const std::string &) |
Override this callback to implement support for more sections in derived classes. More... | |
MeshBase & | mesh () |
void | set_n_partitions (unsigned int n_parts) |
Sets the number of partitions in the mesh. More... | |
void | skip_comment_lines (std::istream &in, const char comment_start) |
Reads input from in , skipping all the lines that start with the character comment_start . More... | |
Protected Attributes | |
container_t | _nodeset_ids |
Abaqus writes nodesets and elemsets with labels. More... | |
container_t | _elemset_ids |
sideset_container_t | _sideset_ids |
std::unique_ptr< std::istream > | _in |
Stream object used to interact with the file. More... | |
std::set< ElemType > | _elem_types |
A set of the different geometric element types detected when reading the mesh. More... | |
bool | _already_seen_part |
This flag gets set to true after the first "*PART" section we see. More... | |
std::vector< bool > | elems_of_dimension |
A vector of bools describing what dimension elements have been encountered when reading a mesh. More... | |
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format.
Definition at line 41 of file abaqus_io.h.
|
protected |
The type of data structure used to store Node and Elemset IDs.
Definition at line 73 of file abaqus_io.h.
|
protected |
Type of the data structure for storing the (elem ID, side) pairs defining sidesets.
These come from the *Surface sections of the input file.
Definition at line 80 of file abaqus_io.h.
|
explicit |
Constructor.
Takes a writable reference to a mesh object.
Definition at line 214 of file abaqus_io.C.
|
virtualdefault |
Destructor.
|
protected |
This function assigns boundary IDs to node sets based on the alphabetical order in which the sets are labeled in the Abaqus file.
We choose the alphabetical ordering simply because Abaqus does not provide a numerical one within the file.
Definition at line 1050 of file abaqus_io.C.
References _nodeset_ids, libMesh::BoundaryInfo::add_node(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshBase::node_ptr(), and libMesh::BoundaryInfo::nodeset_name().
Referenced by read().
|
protected |
Called at the end of the read() function, assigns any sideset IDs found when reading the file to the BoundaryInfo object.
Definition at line 1088 of file abaqus_io.C.
References _elemset_ids, _sideset_ids, libMesh::BoundaryInfo::add_side(), libMesh::as_range(), libMesh::Elem::dim(), libMesh::MeshBase::elem_ref(), libMesh::Utility::enum_to_string(), libMesh::MeshBase::get_boundary_info(), libMesh::Elem::key(), max_elem_dimension_seen(), libMesh::MeshInput< MT >::mesh(), libMesh::BoundaryInfo::sideset_name(), and libMesh::Elem::type().
Referenced by read().
|
protected |
This function is called after all the elements have been read and assigns element subdomain IDs.
The IDs are simply chosen in the order in which the elset labels are stored in the map (roughly alphabetically). To make this easy on people who are planning to use Exodus output, we'll assign different geometric elements to different (but related) subdomains, i.e. assuming there are E elemsets:
Elemset 0, Geometric Type 0: ID 0 Elemset 0, Geometric Type 1: ID 0+E ...
Elemset 1, Geometric Type 0: ID 1 Elemset 1, Geometric Type 1: ID 1+E ... Elemset 1, Geometric Type N: ID 1+N*E etc.
Definition at line 979 of file abaqus_io.C.
References _elem_types, _elemset_ids, libMesh::Elem::dim(), libMesh::MeshBase::elem_ref(), libMesh::Utility::enum_to_string(), max_elem_dimension_seen(), libMesh::MeshInput< MT >::mesh(), libMesh::Elem::subdomain_id(), libMesh::MeshBase::subdomain_name(), and libMesh::Elem::type().
Referenced by read().
|
protected |
true
if the input string is a generated elset or nset, false otherwise.The input string is assumed to already be in all upper case. Generated nsets are assumed to have the following format: *Nset, nset=Set-1, generate
Definition at line 821 of file abaqus_io.C.
References strip_ws().
Referenced by read().
|
inlineprotectedvirtual |
Override this callback to implement support for more sections in derived classes.
Definition at line 241 of file abaqus_io.h.
Referenced by read().
|
protected |
This function handles "generated" nset and elset sections.
These are denoted by having the comma-separated "GENERATE" keyword in their definition, e.g. *Nset, nset=Set-1, generate
Definition at line 871 of file abaqus_io.C.
References _in, and strip_ws().
Referenced by read().
|
inlineinherited |
Returns true iff this mesh file format and input class are parallelized, so that all processors can read their share of the data at once.
Definition at line 87 of file mesh_input.h.
References libMesh::MeshInput< MT >::_is_parallel_format.
|
protected |
Only valid after the elements have been read in and the elems_of_dimension array has been populated.
Definition at line 1281 of file abaqus_io.C.
References libMesh::MeshInput< MeshBase >::elems_of_dimension.
Referenced by assign_sideset_ids(), assign_subdomain_ids(), and read().
|
inlineprotectedinherited |
Definition at line 178 of file mesh_input.h.
Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::VTKIO::cells_to_vtk(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::elements_out(), libMesh::VTKIO::get_local_node_values(), libMesh::ExodusII_IO::get_sideset_data_indices(), libMesh::UNVIO::groups_in(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::nodes_in(), libMesh::UNVIO::nodes_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::GMVIO::read(), libMesh::STLIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read(), libMesh::VTKIO::read(), libMesh::STLIO::read_ascii(), libMesh::CheckpointIO::read_bcs(), libMesh::STLIO::read_binary(), libMesh::CheckpointIO::read_connectivity(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::DynaIO::read_mesh(), libMesh::CheckpointIO::read_nodes(), libMesh::CheckpointIO::read_nodesets(), libMesh::CheckpointIO::read_remote_elem(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::ExodusII_IO::read_sideset_data(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::CheckpointIO::read_subdomain_names(), libMesh::STLIO::write(), libMesh::TetGenIO::write(), libMesh::Nemesis_IO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::ExodusII_IO::write(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::Nemesis_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO::write_elemsets(), libMesh::UCDIO::write_header(), libMesh::UCDIO::write_implementation(), libMesh::UCDIO::write_interior_elems(), libMesh::GmshIO::write_mesh(), libMesh::UCDIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::UCDIO::write_nodes(), libMesh::CheckpointIO::write_nodesets(), libMesh::XdrIO::write_parallel(), libMesh::GmshIO::write_post(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::ExodusII_IO::write_sideset_data(), libMesh::UCDIO::write_soln(), and libMesh::CheckpointIO::write_subdomain_names().
|
protected |
This function parses a label of the form foo=bar from a comma-delimited line of the form ..., foo=bar, ...
The input to the function in this case would be foo, the output would be bar
Definition at line 776 of file abaqus_io.C.
References strip_ws().
Referenced by read().
|
protected |
Any of the various sections can start with some number of lines of comments, which start with "**".
This function discards any lines of comments that it finds from the stream, leaving trailing data intact.
Definition at line 1238 of file abaqus_io.C.
References _in.
Referenced by read().
|
overridevirtual |
This method implements reading a mesh from a specified file.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 227 of file abaqus_io.C.
References _already_seen_part, _elemset_ids, _in, _nodeset_ids, _sideset_ids, assign_boundary_node_ids(), assign_sideset_ids(), assign_subdomain_ids(), libMesh::BoundaryInfo::build_side_list_from_node_list(), build_sidesets_from_nodesets, libMesh::MeshBase::clear(), libMesh::MeshBase::delete_elem(), detect_generated_set(), libMesh::MeshInput< MeshBase >::elems_of_dimension, extended_parsing(), generate_ids(), libMesh::MeshBase::get_boundary_info(), libMesh::libmesh_assert(), max_elem_dimension_seen(), libMesh::MeshInput< MT >::mesh(), libMesh::BoundaryInfo::n_boundary_conds(), parse_label(), process_and_discard_comments(), read_elements(), read_ids(), read_nodes(), read_sideset(), libMesh::MeshBase::set_mesh_dimension(), and libMesh::Utility::unzip_file().
Referenced by libMesh::NameBasedIO::read(), and MeshInputTest::testAbaqusRead().
|
protected |
This function parses a block of elements in the Abaqus file.
You must pass it an upper-cased version of the string declaring this section, which is typically something like: *ELEMENT, TYPE=CPS3 so that it can determine the type of elements to read.
Definition at line 561 of file abaqus_io.C.
References _elem_types, _elemset_ids, _in, libMesh::MeshBase::add_elem(), libMesh::Elem::build(), libMesh::EDGE2, libMesh::EDGE3, libMesh::MeshInput< MeshBase >::elems_of_dimension, libMesh::Utility::enum_to_string(), libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::INVALID_ELEM, libMesh::MeshInput< MT >::mesh(), libMesh::MeshBase::node_ptr(), libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM6, libMesh::QUAD4, libMesh::QUAD8, libMesh::Elem::set_node(), string_to_num(), libMesh::TET10, libMesh::TET4, libMesh::TRI3, and libMesh::TRI6.
Referenced by read().
|
protected |
This function reads all the IDs for the current node or element set of the given name, storing them in the passed map using the name as key.
Definition at line 838 of file abaqus_io.C.
References _in, and string_to_num().
Referenced by read().
|
protected |
This function parses a block of nodes in the Abaqus file once such a block has been found.
If the *NODE section specifies an NSET name, also pass that to this function.
Definition at line 484 of file abaqus_io.C.
References _in, _nodeset_ids, libMesh::MeshBase::add_point(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshBase::query_node_ptr(), libMesh::Real, and strip_ws().
Referenced by read().
|
protected |
This function reads a sideset from the input file.
This is defined by a "*Surface" section in the file, and then a list of element ID and side IDs for the set.
Definition at line 908 of file abaqus_io.C.
References _elemset_ids, _in, _nodeset_ids, libMesh::out, side_id, string_to_num(), and strip_ws().
Referenced by read().
|
inlineprotectedinherited |
Sets the number of partitions in the mesh.
Typically this gets done by the partitioner, but some parallel file formats begin "pre-partitioned".
Definition at line 101 of file mesh_input.h.
References libMesh::MeshInput< MT >::mesh().
Referenced by libMesh::Nemesis_IO::read(), and libMesh::XdrIO::read_header().
|
protectedinherited |
Reads input from in
, skipping all the lines that start with the character comment_start
.
Definition at line 187 of file mesh_input.h.
Referenced by libMesh::TetGenIO::read(), and libMesh::UCDIO::read_implementation().
|
protected |
Attempts to convert the input string to a numerical value using strtol.
If the conversion fails, 0 will be stored in the output, so you must check the return value, which will be true if the conversion succeeded, and false if it failed for any reason.
Definition at line 1295 of file abaqus_io.C.
Referenced by read_elements(), read_ids(), and read_sideset().
|
protected |
Removes all whitespace characters from "line".
Simpler than trying to remember the erase-remove-if idiom.
Definition at line 1303 of file abaqus_io.C.
Referenced by detect_generated_set(), generate_ids(), parse_label(), read_nodes(), and read_sideset().
|
protected |
This flag gets set to true after the first "*PART" section we see.
If it is still true when we see a second PART section, we will print an error message... we don't currently handle input files with multiple parts.
Definition at line 221 of file abaqus_io.h.
Referenced by read().
|
protected |
A set of the different geometric element types detected when reading the mesh.
Definition at line 213 of file abaqus_io.h.
Referenced by assign_subdomain_ids(), and read_elements().
|
protected |
Definition at line 201 of file abaqus_io.h.
Referenced by assign_sideset_ids(), assign_subdomain_ids(), read(), read_elements(), and read_sideset().
|
protected |
Stream object used to interact with the file.
Definition at line 207 of file abaqus_io.h.
Referenced by generate_ids(), process_and_discard_comments(), read(), read_elements(), read_ids(), read_nodes(), and read_sideset().
|
protected |
Abaqus writes nodesets and elemsets with labels.
As we read them in, we'll use these maps to provide a natural ordering for them.
Definition at line 200 of file abaqus_io.h.
Referenced by assign_boundary_node_ids(), read(), read_nodes(), and read_sideset().
|
protected |
Definition at line 202 of file abaqus_io.h.
Referenced by assign_sideset_ids(), and read().
bool libMesh::AbaqusIO::build_sidesets_from_nodesets |
Default false.
Set this flag to true if you want libmesh to automatically generate sidesets from Abaqus' nodesets. If the Abaqus file already contains some sidesets, we ignore this flag and don't generate sidesets, because the algorithm to do so currently does not take into account existing sidesets.
Definition at line 67 of file abaqus_io.h.
Referenced by read().
|
protectedinherited |
A vector of bools describing what dimension elements have been encountered when reading a mesh.
Definition at line 107 of file mesh_input.h.
Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::max_elem_dimension_seen(), max_elem_dimension_seen(), read(), libMesh::GMVIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), read_elements(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), and libMesh::XdrIO::read_serialized_connectivity().