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.
gmshMesh.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_GMSHMESH_H_
30 #define NEMOSYS_GMSHMESH_H_
31 
32 #include "nemosys_export.h"
33 
34 #include <gmsh/GModel.h>
35 
36 #include "Mesh/meshBase.H"
37 
38 class NEMOSYS_EXPORT gmshMesh : public meshBase {
39  // --- constructors and destructors
40  public:
41  // default constructor
42  gmshMesh();
43 
44  // construct from dataset
45  gmshMesh(meshBase* mb);
46 
47  // initialize from a file name
48  explicit gmshMesh(const std::string &fname);
49 
50  ~gmshMesh() override;
51 
52  // --- diagnostics
53  public:
54  void report() const override;
55 
56  // --- access
57  public:
58  // get point with id
59  std::vector<double> getPoint(nemId_t id) const override;
60  // get 3 vecs with x,y and z coords
61  std::vector<std::vector<double>> getVertCrds() const override;
62  // get cell with id : returns point indices and respective coordinates
63  std::map<nemId_t, std::vector<double>>
64  getCell(nemId_t id) const override;
65  // get vector of coords of cell with id
66  std::vector<std::vector<double>> getCellVec(nemId_t id) const override;
67  // get edge lengths of dataSet
68  void inspectEdges(const std::string& ofname) const override;
69  // extract the surface mesh
70  vtkSmartPointer<vtkDataSet> extractSurface() override;
71  // get diameter of circumsphere of each cell
72  std::vector<double> getCellLengths() const override;
73  // get center of a cell
74  std::vector<double> getCellCenter(nemId_t cellID) const override;
75  // get cell type as an integer
76  // assumes all elements are the same type
77  int getCellType() const override;
78  // get connectivities. this is only safe to use if mesh has cells of the same type
79  // or you have information on the number of cells of each type and the order in
80  // which they appear (for look up in resulting vector)
81  std::vector<nemId_t> getConnectivities() const override;
82 
83  // --- read, write and conversion
84  public:
85  // intended to be used only for reading gmsh mesh files
86  void read(const std::string &fname);
87  // write the mesh to file named fname
88  using meshBase::write;
89  void write(const std::string &fname) const override;
90  void write(const std::string &fname, double mshFileVersion,
91  bool binary) const;
92 
93  // --- Gmsh data types
94  private:
95 // GModel _gmshGModel;
96 };
97 
98 #endif // NEMOSYS_GMSHMESH_H_
virtual void inspectEdges(const std::string &ofname) const =0
get edge lengths of dataSet
virtual std::vector< double > getCellLengths() const =0
get diameter of circumsphere of each cell
A brief description of meshBase.
Definition: meshBase.H:64
std::size_t nemId_t
Definition: meshBase.H:51
virtual std::vector< std::vector< double > > getCellVec(nemId_t id) const =0
get vector of coords of cell with id
virtual int getCellType() const =0
get cell type as an integer assumes all elements are the same type
virtual std::vector< nemId_t > getConnectivities() const =0
get connectivities.
virtual std::map< nemId_t, std::vector< double > > getCell(nemId_t id) const =0
get cell with id
virtual vtkSmartPointer< vtkDataSet > extractSurface()=0
extract the surface mesh
virtual void write() const
write the mesh to file named after the private var &#39;filename&#39;.
Definition: meshBase.H:598
virtual std::vector< std::vector< double > > getVertCrds() const =0
get 3 vecs with x,y and z coords
virtual std::vector< double > getCellCenter(nemId_t cellID) const =0
get center of a cell
virtual void report() const
generate a report of the mesh
Definition: meshBase.H:540
virtual void read(const std::string &fname)=0
abstract read method reserved for derived classes
virtual std::vector< double > getPoint(nemId_t id) const =0
get point with id