12 #ifndef smtk_mesh_moab_BufferedCellAllocator_h
13 #define smtk_mesh_moab_BufferedCellAllocator_h
15 #include "smtk/CoreExports.h"
18 #include "smtk/mesh/moab/Allocator.h"
19 #include "smtk/mesh/moab/Interface.h"
21 SMTK_THIRDPARTY_PRE_INCLUDE
22 #include "moab/EntityHandle.hpp"
23 #include "moab/Range.hpp"
24 SMTK_THIRDPARTY_POST_INCLUDE
53 bool reserveNumberOfCoordinates(std::size_t nCoordinates)
override;
54 bool setCoordinate(std::size_t coord,
double* xyz)
override;
59 return this->addCell<long long int>(ctype, pointIds, nCoordinates);
64 return this->addCell<long int>(ctype, pointIds, nCoordinates);
68 return this->addCell<int>(ctype, pointIds, nCoordinates);
71 bool flush()
override;
73 smtk::mesh::HandleRange cells()
override;
78 template<
typename IntegerType>
81 ::moab::EntityHandle m_firstCoordinate{ 0 };
82 std::size_t m_nCoordinates{ 0 };
83 std::vector<double*> m_coordinateMemory;
86 std::vector<std::int64_t> m_localConnectivity;
87 ::moab::Range m_cells;
90 template<
typename IntegerType>
91 bool BufferedCellAllocator::addCell(
93 IntegerType* pointIds,
94 std::int64_t nCoordinates)
101 if (ctype != m_activeCellType || (nCoordinates != 0 && nCoordinates != m_nCoords))
103 m_validState = this->flush();
104 m_activeCellType = ctype;
109 assert(m_activeCellType != smtk::mesh::CellType_MAX);
110 assert(m_nCoords > 0);
112 for (std::int64_t i = 0; i < m_nCoords; i++)
114 m_localConnectivity.push_back(pointIds[i]);