libMesh
abaqus_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 #ifndef LIBMESH_ABAQUS_IO_H
20 #define LIBMESH_ABAQUS_IO_H
21 
22 // Local includes
23 #include "libmesh/libmesh_common.h"
24 #include "libmesh/mesh_input.h"
25 
26 // C++ includes
27 #include <fstream>
28 #include <set>
29 
30 namespace libMesh
31 {
32 
40 class AbaqusIO : public MeshInput<MeshBase>
41 {
42 public:
46  explicit
48 
52  virtual ~AbaqusIO ();
53 
57  virtual void read (const std::string & name) libmesh_override;
58 
67 
68 private:
72  typedef std::map<std::string, std::vector<dof_id_type>> container_t;
73 
79  typedef std::map<std::string, std::vector<std::pair<dof_id_type, unsigned>>> sideset_container_t;
80 
86  void read_nodes(std::string nset_name);
87 
95  void read_elements(std::string upper, std::string elset_name);
96 
104  std::string parse_label(std::string line, std::string label_name) const;
105 
114  bool detect_generated_set(std::string upper) const;
115 
121  void read_ids(std::string set_name, container_t & container);
122 
129  void generate_ids(std::string set_name, container_t & container);
130 
152  void assign_subdomain_ids();
153 
159  void read_sideset(std::string sideset_name, sideset_container_t & container);
160 
168 
173  void assign_sideset_ids();
174 
182 
190  unsigned char max_elem_dimension_seen();
191 
197  container_t _nodeset_ids;
198  container_t _elemset_ids;
199  sideset_container_t _sideset_ids;
200 
204  std::ifstream _in;
205 
210  std::set<ElemType> _elem_types;
211 
216  // std::map<dof_id_type, dof_id_type> _libmesh_to_abaqus_elem_mapping;
217  std::map<dof_id_type, dof_id_type> _abaqus_to_libmesh_elem_mapping;
218 
227  std::map<dof_id_type, dof_id_type> _abaqus_to_libmesh_node_mapping;
228 
236 };
237 
238 } // namespace
239 
240 #endif // LIBMESH_ABAQUS_IO_H
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
void read_sideset(std::string sideset_name, sideset_container_t &container)
This function reads a sideset from the input file.
Definition: abaqus_io.C:813
void process_and_discard_comments()
Any of the various sections can start with some number of lines of comments, which start with "**"...
Definition: abaqus_io.C:1102
bool _already_seen_part
This flag gets set to true after the first "*PART" section we see.
Definition: abaqus_io.h:235
std::map< std::string, std::vector< dof_id_type > > container_t
The type of data structure used to store Node and Elemset IDs.
Definition: abaqus_io.h:72
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format...
Definition: abaqus_io.h:40
sideset_container_t _sideset_ids
Definition: abaqus_io.h:199
virtual ~AbaqusIO()
Destructor.
Definition: abaqus_io.C:198
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.
Definition: abaqus_io.C:731
bool build_sidesets_from_nodesets
Default false.
Definition: abaqus_io.h:66
void assign_sideset_ids()
Called at the end of the read() function, assigns any sideset IDs found when reading the file to the ...
Definition: abaqus_io.C:951
The libMesh namespace provides an interface to certain functionality in the library.
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...
Definition: abaqus_io.C:418
bool detect_generated_set(std::string upper) const
Definition: abaqus_io.C:714
This is the MeshBase class.
Definition: mesh_base.h:68
std::map< dof_id_type, dof_id_type > _abaqus_to_libmesh_elem_mapping
Map from libmesh element number -> abaqus element number, and the converse.
Definition: abaqus_io.h:217
void read_elements(std::string upper, std::string elset_name)
This function parses a block of elements in the Abaqus file.
Definition: abaqus_io.C:497
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.
Definition: abaqus_io.h:79
This class defines an abstract interface for Mesh input.
Definition: mesh_base.h:50
void generate_ids(std::string set_name, container_t &container)
This function handles "generated" nset and elset sections.
Definition: abaqus_io.C:776
void assign_subdomain_ids()
This function is called after all the elements have been read and assigns element subdomain IDs...
Definition: abaqus_io.C:846
void assign_boundary_node_ids()
This function assigns boundary IDs to node sets based on the alphabetical order in which the sets are...
Definition: abaqus_io.C:915
container_t _nodeset_ids
Abaqus writes nodesets and elemsets with labels.
Definition: abaqus_io.h:197
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 ...
Definition: abaqus_io.C:669
virtual void read(const std::string &name) libmesh_override
This method implements reading a mesh from a specified file.
Definition: abaqus_io.C:205
AbaqusIO(MeshBase &mesh)
Constructor.
Definition: abaqus_io.C:188
std::set< ElemType > _elem_types
A set of the different geometric element types detected when reading the mesh.
Definition: abaqus_io.h:210
std::map< dof_id_type, dof_id_type > _abaqus_to_libmesh_node_mapping
Map from abaqus node number -> sequential, 0-based libmesh node numbering.
Definition: abaqus_io.h:227
unsigned char max_elem_dimension_seen()
Definition: abaqus_io.C:1145
container_t _elemset_ids
Definition: abaqus_io.h:198
std::ifstream _in
Stream object used to interact with the file.
Definition: abaqus_io.h:204