libMesh
Loading...
Searching...
No Matches
abaqus_io.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
31namespace libMesh
32{
33
41class AbaqusIO : public MeshInput<MeshBase>
42{
43public:
47 explicit
49
53 virtual ~AbaqusIO ();
54
58 virtual void read (const std::string & name) override;
59
68
69protected:
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
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
229 bool string_to_num(const std::string &input, dof_id_type &output) const;
230
235 void strip_ws(std::string &line) const;
236
241 virtual void extended_parsing(const std::string & /*header*/) {}
242};
243
244} // namespace
245
246#endif // LIBMESH_ABAQUS_IO_H
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format.
Definition abaqus_io.h:42
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:908
virtual ~AbaqusIO()
Destructor.
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::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
container_t _elemset_ids
Definition abaqus_io.h:201
void assign_subdomain_ids()
This function is called after all the elements have been read and assigns element subdomain IDs.
Definition abaqus_io.C:979
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:1238
std::set< ElemType > _elem_types
A set of the different geometric element types detected when reading the mesh.
Definition abaqus_io.h:213
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:1050
virtual void extended_parsing(const std::string &)
Override this callback to implement support for more sections in derived classes.
Definition abaqus_io.h:241
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
Definition abaqus_io.C:227
std::unique_ptr< std::istream > _in
Stream object used to interact with the file.
Definition abaqus_io.h:207
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:1088
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:776
bool build_sidesets_from_nodesets
Default false.
Definition abaqus_io.h:67
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:484
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.
Definition abaqus_io.C:1295
bool detect_generated_set(std::string upper) const
Definition abaqus_io.C:821
unsigned char max_elem_dimension_seen()
Definition abaqus_io.C:1281
void strip_ws(std::string &line) const
Removes all whitespace characters from "line".
Definition abaqus_io.C:1303
container_t _nodeset_ids
Abaqus writes nodesets and elemsets with labels.
Definition abaqus_io.h:200
bool _already_seen_part
This flag gets set to true after the first "*PART" section we see.
Definition abaqus_io.h:221
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,...
Definition abaqus_io.C:838
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:561
sideset_container_t _sideset_ids
Definition abaqus_io.h:202
void generate_ids(std::string set_name, container_t &container)
This function handles "generated" nset and elset sections.
Definition abaqus_io.C:871
This is the MeshBase class.
Definition mesh_base.h:81
This class defines an abstract interface for Mesh input.
Definition mesh_input.h:49
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t dof_id_type
Definition id_types.h:67