CEPS  24.01
Cardiac ElectroPhysiology Simulator
MeditMeshReader.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 
45 {
46 
47  public:
49  MeditMeshReader (const CepsString &fileName, const CepsUInt &dim, CepsBool quads = false);
50 
52  ~MeditMeshReader() override;
53 
55  void
56  initialize() override;
57 
59  void
60  readNodes(
61  CepsUInt indexStart,
62  CepsUInt indexEnd,
63  CepsUInt nodeOffset,
64  CepsVector<CepsReal>& coords,
66  CepsVector<CepsUInt>& attrPtr
67  ) override;
68 
70  void
71  readCells(
72  CepsUInt indexStart,
73  CepsUInt indexEnd,
74  CepsUInt nodeOffset,
75  CepsUInt cellOffset,
77  CepsVector<CepsUInt>& nodeIndicesPtr,
78  CepsVector<CepsAttribute>& cellAttr,
79  CepsVector<CepsUInt>& cellAttrPtr,
80  CepsVector<CepsChar>& isBoundaryCell
81  ) override;
82 
83 
84  private:
85 
87  void
89  CepsUInt cellId,
90  CepsUInt fileCellId,
91  CepsUInt nodeOffset,
93  CepsVector<CepsUInt>& nodeIndicesPtr,
94  CepsVector<CepsAttribute>& cellAttr,
95  CepsVector<CepsUInt>& cellAttrPtr,
96  CepsVector<CepsChar>& isBoundaryCell,
97  CepsBool boundaryFlag
98  ) override;
99 
100 
101  private:
102 
105 
107  CepsVector<CepsString> m_keywordsT = {"Points", "Edges", "Triangles", "Tetrahedra"};
109  CepsVector<CepsString> m_keywordsQ = {"Points", "Edges", "Quadrilaterals", "Hexahedra"};
110 };
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
int32_t CepsInt
Need 32 bit integer.
Definition: CepsTypes.hpp:106
Reader for medit (.mesh) files.
CepsVector< CepsString > m_keywordsT
Keywords used to separate cells in medit format, for simplices.
void initialize() override
Get the number of nodes cells and boundary cells before reading.
~MeditMeshReader() override
Destructor.
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.
MeditMeshReader(const CepsString &fileName, const CepsUInt &dim, CepsBool quads=false)
Constructor with full fileName and expected dimension.
void readNodes(CepsUInt indexStart, CepsUInt indexEnd, CepsUInt nodeOffset, CepsVector< CepsReal > &coords, CepsVector< CepsAttribute > &attr, CepsVector< CepsUInt > &attrPtr) override
Reads several nodes in mesh file.
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.
CepsInt m_boundaryIndexOffset
Internal offset.
CepsVector< CepsString > m_keywordsQ
Keywords used to separate cells in medit format, for quads.
CepsInt m_indexOffset
Internal offset.
Abstract base class that encapsulates primary functionalities of each mesh reader.
Definition: MeshReader.hpp:42