libMesh
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
libMesh::AbaqusIO Class Reference

The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format. More...

#include <abaqus_io.h>

Inheritance diagram for libMesh::AbaqusIO:
[legend]

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...
 

Public Attributes

bool build_sidesets_from_nodesets
 Default false. More...
 

Protected Member Functions

MeshBasemesh ()
 
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

std::vector< bool > elems_of_dimension
 A vector of bools describing what dimension elements have been encountered when reading a mesh. More...
 

Private 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...
 

Private 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 (std::string sideset_name, 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 ()
 

Private Attributes

container_t _nodeset_ids
 Abaqus writes nodesets and elemsets with labels. More...
 
container_t _elemset_ids
 
sideset_container_t _sideset_ids
 
std::ifstream _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...
 
std::map< dof_id_type, dof_id_type_abaqus_to_libmesh_elem_mapping
 Map from libmesh element number -> abaqus element number, and the converse. More...
 
std::map< dof_id_type, dof_id_type_abaqus_to_libmesh_node_mapping
 Map from abaqus node number -> sequential, 0-based libmesh node numbering. More...
 
bool _already_seen_part
 This flag gets set to true after the first "*PART" section we see. More...
 

Detailed Description

The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format.

Author
John W. Peterson
Date
2011

Definition at line 40 of file abaqus_io.h.

Member Typedef Documentation

◆ container_t

typedef std::map<std::string, std::vector<dof_id_type> > libMesh::AbaqusIO::container_t
private

The type of data structure used to store Node and Elemset IDs.

Definition at line 72 of file abaqus_io.h.

◆ sideset_container_t

typedef std::map<std::string, std::vector<std::pair<dof_id_type, unsigned> > > libMesh::AbaqusIO::sideset_container_t
private

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 79 of file abaqus_io.h.

Constructor & Destructor Documentation

◆ AbaqusIO()

libMesh::AbaqusIO::AbaqusIO ( MeshBase mesh)
explicit

Constructor.

Takes a writable reference to a mesh object.

◆ ~AbaqusIO()

virtual libMesh::AbaqusIO::~AbaqusIO ( )
virtual

Destructor.

Member Function Documentation

◆ assign_boundary_node_ids()

void libMesh::AbaqusIO::assign_boundary_node_ids ( )
private

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.

◆ assign_sideset_ids()

void libMesh::AbaqusIO::assign_sideset_ids ( )
private

Called at the end of the read() function, assigns any sideset IDs found when reading the file to the BoundaryInfo object.

◆ assign_subdomain_ids()

void libMesh::AbaqusIO::assign_subdomain_ids ( )
private

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 0, Geometric Type N: ID 0+N*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.

◆ detect_generated_set()

bool libMesh::AbaqusIO::detect_generated_set ( std::string  upper) const
private
Returns
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

◆ generate_ids()

void libMesh::AbaqusIO::generate_ids ( std::string  set_name,
container_t container 
)
private

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

◆ max_elem_dimension_seen()

unsigned char libMesh::AbaqusIO::max_elem_dimension_seen ( )
private
Returns
The maximum geometric element dimension encountered while reading the Mesh.

Only valid after the elements have been read in and the elems_of_dimension array has been populated.

◆ mesh()

MeshBase & libMesh::MeshInput< MeshBase >::mesh ( )
protectedinherited
Returns
The object as a writable reference.

Definition at line 169 of file mesh_input.h.

Referenced by libMesh::XdrIO::write_parallel().

170 {
171  if (_obj == nullptr)
172  libmesh_error_msg("ERROR: _obj should not be nullptr!");
173  return *_obj;
174 }
MeshBase * _obj
A pointer to a non-const object object.
Definition: mesh_input.h:114

◆ parse_label()

std::string libMesh::AbaqusIO::parse_label ( std::string  line,
std::string  label_name 
) const
private

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

◆ process_and_discard_comments()

void libMesh::AbaqusIO::process_and_discard_comments ( )
private

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.

◆ read()

virtual void libMesh::AbaqusIO::read ( const std::string &  name)
overridevirtual

This method implements reading a mesh from a specified file.

Implements libMesh::MeshInput< MeshBase >.

◆ read_elements()

void libMesh::AbaqusIO::read_elements ( std::string  upper,
std::string  elset_name 
)
private

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.

◆ read_ids()

void libMesh::AbaqusIO::read_ids ( std::string  set_name,
container_t container 
)
private

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.

◆ read_nodes()

void libMesh::AbaqusIO::read_nodes ( std::string  nset_name)
private

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.

◆ read_sideset()

void libMesh::AbaqusIO::read_sideset ( std::string  sideset_name,
sideset_container_t container 
)
private

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.

◆ set_n_partitions()

void libMesh::MeshInput< MeshBase >::set_n_partitions ( unsigned int  n_parts)
protectedinherited

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 91 of file mesh_input.h.

References libMesh::MeshInput< MT >::mesh().

91 { this->mesh().set_n_partitions() = n_parts; }
unsigned int & set_n_partitions()
Definition: mesh_base.h:1371

◆ skip_comment_lines()

void libMesh::MeshInput< MeshBase >::skip_comment_lines ( std::istream &  in,
const char  comment_start 
)
protectedinherited

Reads input from in, skipping all the lines that start with the character comment_start.

Definition at line 179 of file mesh_input.h.

181 {
182  char c, line[256];
183 
184  while (in.get(c), c==comment_start)
185  in.getline (line, 255);
186 
187  // put back first character of
188  // first non-comment line
189  in.putback (c);
190 }

Member Data Documentation

◆ _abaqus_to_libmesh_elem_mapping

std::map<dof_id_type, dof_id_type> libMesh::AbaqusIO::_abaqus_to_libmesh_elem_mapping
private

Map from libmesh element number -> abaqus element number, and the converse.

Definition at line 217 of file abaqus_io.h.

◆ _abaqus_to_libmesh_node_mapping

std::map<dof_id_type, dof_id_type> libMesh::AbaqusIO::_abaqus_to_libmesh_node_mapping
private

Map from abaqus node number -> sequential, 0-based libmesh node numbering.

Note
In every Abaqus file I've ever seen the node numbers were 1-based, sequential, and all in order, so that this map is probably overkill. Nevertheless, it is the most general solution in case we come across a weird Abaqus file some day.

Definition at line 227 of file abaqus_io.h.

◆ _already_seen_part

bool libMesh::AbaqusIO::_already_seen_part
private

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 235 of file abaqus_io.h.

◆ _elem_types

std::set<ElemType> libMesh::AbaqusIO::_elem_types
private

A set of the different geometric element types detected when reading the mesh.

Definition at line 210 of file abaqus_io.h.

◆ _elemset_ids

container_t libMesh::AbaqusIO::_elemset_ids
private

Definition at line 198 of file abaqus_io.h.

◆ _in

std::ifstream libMesh::AbaqusIO::_in
private

Stream object used to interact with the file.

Definition at line 204 of file abaqus_io.h.

◆ _nodeset_ids

container_t libMesh::AbaqusIO::_nodeset_ids
private

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 197 of file abaqus_io.h.

◆ _sideset_ids

sideset_container_t libMesh::AbaqusIO::_sideset_ids
private

Definition at line 199 of file abaqus_io.h.

◆ build_sidesets_from_nodesets

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 66 of file abaqus_io.h.

◆ elems_of_dimension

std::vector<bool> libMesh::MeshInput< MeshBase >::elems_of_dimension
protectedinherited

A vector of bools describing what dimension elements have been encountered when reading a mesh.

Definition at line 97 of file mesh_input.h.


The documentation for this class was generated from the following file: