libMesh
abaqus_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 <memory>
29 #include <set>
30 
31 namespace libMesh
32 {
33 
41 class AbaqusIO : public MeshInput<MeshBase>
42 {
43 public:
47  explicit
49 
53  virtual ~AbaqusIO ();
54 
58  virtual void read (const std::string & name) override;
59 
68 
69 private:
73  typedef std::map<std::string, std::vector<dof_id_type>> container_t;
74 
80  typedef std::map<std::string, std::vector<std::pair<dof_id_type, unsigned>>> sideset_container_t;
81 
87  void read_nodes(std::string nset_name);
88 
96  void read_elements(std::string upper, std::string elset_name);
97 
105  std::string parse_label(std::string line, std::string label_name) const;
106 
115  bool detect_generated_set(std::string upper) const;
116 
122  void read_ids(std::string set_name, container_t & container);
123 
130  void generate_ids(std::string set_name, container_t & container);
131 
153  void assign_subdomain_ids();
154 
160  void read_sideset(const std::string & sideset_name,
161  const std::string & sideset_type,
162  sideset_container_t & container);
163 
171 
176  void assign_sideset_ids();
177 
185 
193  unsigned char max_elem_dimension_seen();
194 
203 
207  std::unique_ptr<std::istream> _in;
208 
213  std::set<ElemType> _elem_types;
214 
222 };
223 
224 } // namespace
225 
226 #endif // LIBMESH_ABAQUS_IO_H
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
Definition: abaqus_io.C:255
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
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:1252
bool _already_seen_part
This flag gets set to true after the first "*PART" section we see.
Definition: abaqus_io.h:221
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:73
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format...
Definition: abaqus_io.h:41
sideset_container_t _sideset_ids
Definition: abaqus_io.h:202
virtual ~AbaqusIO()
Destructor.
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:848
bool build_sidesets_from_nodesets
Default false.
Definition: abaqus_io.h:67
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:1102
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:494
This is the MeshBase class.
Definition: mesh_base.h:74
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:571
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.
Definition: abaqus_io.C:918
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:80
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:786
bool detect_generated_set(std::string upper) const
Definition: abaqus_io.C:831
This class defines an abstract interface for Mesh input.
Definition: mesh_base.h:56
void generate_ids(std::string set_name, container_t &container)
This function handles "generated" nset and elset sections.
Definition: abaqus_io.C:881
void assign_subdomain_ids()
This function is called after all the elements have been read and assigns element subdomain IDs...
Definition: abaqus_io.C:993
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:1064
container_t _nodeset_ids
Abaqus writes nodesets and elemsets with labels.
Definition: abaqus_io.h:200
AbaqusIO(MeshBase &mesh)
Constructor.
Definition: abaqus_io.C:242
std::set< ElemType > _elem_types
A set of the different geometric element types detected when reading the mesh.
Definition: abaqus_io.h:213
unsigned char max_elem_dimension_seen()
Definition: abaqus_io.C:1295
std::unique_ptr< std::istream > _in
Stream object used to interact with the file.
Definition: abaqus_io.h:207
container_t _elemset_ids
Definition: abaqus_io.h:201