NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
inpGeoMesh.H
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #ifndef NEMOSYS_INPGEOMESH_H_
30 #define NEMOSYS_INPGEOMESH_H_
31 
32 #include "Mesh/geoMeshBase.H"
33 
34 #include <map>
35 #include <set>
36 #include <utility>
37 
38 namespace NEM {
39 namespace MSH {
40 
41 /**
42  * @brief Class representing meshes in CalculiX input deck (similar to ABAQUS)
43  * @details Currently supports the keywords ELEMENT ("C3D4", "C3D8", and "C3D6"
44  * types, ELSET parameter), ELSET, NSET, and SURFACE (TYPE=ELEMENT only). By
45  * default, physical groups with dimension equal to mesh dimension are turned
46  * into ELSETs, and NSETs and physical groups with dimension one less than mesh
47  * dimension are turned into SURFACEs and NSETs.
48  */
49 class NEMOSYS_EXPORT inpGeoMesh : public geoMeshBase {
50  private:
51  struct NEMOSYS_NO_EXPORT InpSets {
52  /**
53  * @brief NSET keyword; indexing matches GeoMesh::mesh
54  */
55  std::map<std::string, std::set<vtkIdType>> nodeSets;
56  /**
57  * @brief ELSET keyword; indexing matches GeoMesh::mesh
58  */
59  std::map<std::string, std::set<vtkIdType>> elSets;
60  /**
61  * @brief SURFACE keyword; indexing matches GeoMesh::sideSet
62  */
63  std::map<std::string, std::set<vtkIdType>> surfaces;
64  };
65 
66  public:
67  static inpGeoMesh *New();
68  static inpGeoMesh *Read(const std::string &fileName);
69  vtkTypeMacro(inpGeoMesh, geoMeshBase)
70 
71  void write(const std::string &fileName) override;
72  void report(std::ostream &out) const override;
73 
74  decltype(InpSets::nodeSets) &getNSets() { return inpSets_.nodeSets; }
75  decltype(InpSets::elSets) &getElSets() { return inpSets_.elSets; }
76  decltype(InpSets::surfaces) &getSurfaces() { return inpSets_.surfaces; }
77 
78  protected:
79  inpGeoMesh();
80  explicit inpGeoMesh(const std::string &fileName);
81 
82  void reconstructGeo() override;
83 
84  private:
85  /**
86  * @brief Ctor meant for ease of delegating to geoMeshBase ctor
87  * @param mesh from parsing a .inp mesh file
88  */
89  explicit inpGeoMesh(std::pair<GeoMesh, InpSets> mesh);
90  void resetNative() override;
91  static std::pair<GeoMesh, InpSets> inp2GM(const std::string &fileName);
92 
93  /**
94  * @brief Holds data specific to inp format
95  */
97 };
98 
99 } // namespace MSH
100 } // namespace NEM
101 
102 #endif // NEMOSYS_INPGEOMESH_H_
std::map< std::string, std::vector< vtkIdType > > elSets
Map from ELSET name to element ids (ids given by .inp file)
Definition: inpGeoMesh.C:148
std::map< std::string, std::set< vtkIdType > > surfaces
SURFACE keyword; indexing matches GeoMesh::sideSet.
Definition: inpGeoMesh.H:63
std::map< std::string, std::set< vtkIdType > > nodeSets
NSET keyword; indexing matches GeoMesh::mesh.
Definition: inpGeoMesh.H:55
Class representing meshes in CalculiX input deck (similar to ABAQUS)
Definition: inpGeoMesh.H:49
geoMeshBase * Read(const std::string &fileName)
Read a mesh from file.
std::map< std::string, std::vector< vtkIdType > > nodeSets
Map from NSET name to node ids (ids given by .inp file)
Definition: inpGeoMesh.C:152
geoMeshBase * New(MeshType meshType)
Create a new mesh object.
decltype(InpSets::elSets) & getElSets()
Definition: inpGeoMesh.H:75
std::map< std::string, std::set< vtkIdType > > elSets
ELSET keyword; indexing matches GeoMesh::mesh.
Definition: inpGeoMesh.H:59
std::shared_ptr< meshBase > mesh
std::map< std::string, std::vector< std::pair< vtkIdType, int > > > surfaces
Map from SURFACE name to (element id, side) (id and side both use .inp IDs)
Definition: inpGeoMesh.C:157
abstract class to specify geometry and mesh data
Definition: geoMeshBase.H:102
InpSets inpSets_
Holds data specific to inp format.
Definition: inpGeoMesh.H:96
decltype(InpSets::nodeSets) & getNSets()
Definition: inpGeoMesh.H:74
decltype(InpSets::surfaces) & getSurfaces()
Definition: inpGeoMesh.H:76