CEPS  24.01
Cardiac ElectroPhysiology Simulator
GmshMeshReader.hpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS 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
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
31 #pragma once
32 
34 
37 class GmshMeshReader : public MeshReader
38 {
39 
40  public:
41 
43  GmshMeshReader (const CepsString &fileName, const CepsUInt &dim, CepsBool quads = false);
44 
46  ~GmshMeshReader () override;
47 
49  void
50  initialize () override;
51 
53  void
54  readNodes(
55  CepsUInt indexStart,
56  CepsUInt indexEnd,
57  CepsUInt nodeOffset,
58  CepsVector<CepsReal>& coords,
60  CepsVector<CepsUInt>& attrPtr
61  ) override;
62 
64  void
65  readCells(
66  CepsUInt indexStart,
67  CepsUInt indexEnd,
68  CepsUInt nodeOffset,
69  CepsUInt cellOffset,
71  CepsVector<CepsUInt>& nodeIndicesPtr,
72  CepsVector<CepsAttribute>& cellAttr,
73  CepsVector<CepsUInt>& cellAttrPtr,
74  CepsVector<CepsChar>& isBoundaryCell
75  ) override;
76 
77 
78  private:
79 
81  void
83  CepsUInt cellId,
84  CepsUInt fileCellId,
85  CepsUInt nodeOffset,
87  CepsVector<CepsUInt>& nodeIndicesPtr,
88  CepsVector<CepsAttribute>& cellAttr,
89  CepsVector<CepsUInt>& cellAttrPtr,
90  CepsVector<CepsChar>& isBoundaryCell,
91  CepsBool boundaryFlag
92  ) override;
93 
95  void
97 
98 
99  private:
100 
102 
104  CepsVector<CepsString> m_keywordsT = {"15", "1", "2", "4"};
106  CepsVector<CepsString> m_keywordsQ = {"15", "1", "3", "5"};
107 };
std::basic_string< CepsChar > CepsString
C++ format string.
Definition: CepsTypes.hpp:128
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
bool CepsBool
Booleans.
Definition: CepsTypes.hpp:124
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
Reader for gmsh (.msh) files. For now, only version 2 of the msh format is implemented.
void readCells(CepsUInt indexStart, CepsUInt indexEnd, CepsUInt nodeOffset, CepsUInt cellOffset, CepsVector< CepsNodeGlobalIndex > &nodeIndices, CepsVector< CepsUInt > &nodeIndicesPtr, CepsVector< CepsAttribute > &cellAttr, CepsVector< CepsUInt > &cellAttrPtr, CepsVector< CepsChar > &isBoundaryCell) override
Reads several cells in mesh file.
GmshMeshReader(const CepsString &fileName, const CepsUInt &dim, CepsBool quads=false)
Constructor with full fileName.
CepsString m_bdryCellType
CepsVector< CepsString > m_keywordsT
Read type of cells (tetras, tris, etc)
void checkFormatVersion()
Stops if the format version of the msh file is not 2.X.
void initialize() override
Get the number of nodes cells and boundary cells before reading.
void getNextCell(CepsUInt cellId, CepsUInt fileCellId, CepsUInt nodeOffset, CepsVector< CepsNodeGlobalIndex > &nodeIndices, CepsVector< CepsUInt > &nodeIndicesPtr, CepsVector< CepsAttribute > &cellAttr, CepsVector< CepsUInt > &cellAttrPtr, CepsVector< CepsChar > &isBoundaryCell, CepsBool boundaryFlag) override
Reads a single cell in mesh file.
CepsVector< CepsString > m_keywordsQ
Keywords used to separate cells in medit format, for quads.
void readNodes(CepsUInt indexStart, CepsUInt indexEnd, CepsUInt nodeOffset, CepsVector< CepsReal > &coords, CepsVector< CepsAttribute > &attr, CepsVector< CepsUInt > &attrPtr) override
Reads several nodes in mesh file.
~GmshMeshReader() override
Destructor.
CepsString m_cellType
Abstract base class that encapsulates primary functionalities of each mesh reader.
Definition: MeshReader.hpp:42