25# ifndef __BITPIT_LEVELSET_OBJECT_TPP__
26# define __BITPIT_LEVELSET_OBJECT_TPP__
39template<
typename value_t>
49 return getCellCache<value_t>(cacheId);
60template<
typename value_t>
67 return (*m_cellCacheCollection)[cacheId].getCache<value_t>();
78template<
typename value_t>
91 cacheId = createCellCache<value_t>(expectedFillIn, cacheId);
97 std::size_t fieldIndex =
static_cast<std::size_t
>(field);
98 m_cellFieldCacheIds[fieldIndex] = cacheId;
111template<
typename value_t>
116 cacheId = m_cellCacheCollection->insert<LevelSetCartesianKernel::CellDenseCacheContainer<value_t>>(cacheId);
118 cacheId = m_cellCacheCollection->insert<LevelSetCartesianKernel::CellSparseCacheContainer<value_t>>(cacheId);
121 throw std::runtime_error(
"The fill in type is not supported!");
127 cacheId = m_cellCacheCollection->insert<LevelSetOctreeKernel::CellSparseCacheContainer<value_t>>(cacheId);
130 throw std::runtime_error(
"The fill in type is not supported!");
136 cacheId = m_cellCacheCollection->insert<LevelSetUnstructuredKernel::CellSparseCacheContainer<value_t>>(cacheId);
139 throw std::runtime_error(
"The fill in type is not supported!");
143 throw std::runtime_error(
"The kernel type is not supported!");
163template<
typename value_t,
typename evaluator_t,
typename fallback_t>
165 const evaluator_t evaluator,
const fallback_t fallback)
const
168 switch (fieldCacheMode) {
174 long cellId = cell.getId();
175 if (cache->contains(cellId)) {
176 flushValue(stream, format, evaluator(cellId));
188 long cellId = cell.getId();
190 flushValue(stream, format, evaluator(cellId));
202 long cellId = cell.getId();
203 flushValue(stream, format, evaluator(cellId));
212 long cellId = cell.getId();
235template<
typename value_t,
typename evaluator_t,
typename fallback_t>
242 if (cacheEntry.isValid()) {
248 value_t value = evalCellField<value_t>(field,
id, evaluator, fallback);
266template<
typename value_t,
typename evaluator_t,
typename fallback_t>
276 return evaluator(
id);
287 return evaluator(
id);
301template<
typename value_t>
335 cache->insertEntry(
id, value);
The Cell class defines the cells.
static const std::size_t NULL_CACHE_ID
The class LevelSetCache is the base class for defining caches.
Implements LevelSetKernel for cartesian meshes.
virtual VolumeKernel * getMesh() const
LevelSetFillIn getExpectedFillIn() const
CellCacheCollection::ValueCache< value_t > * getCellCache(std::size_t cacheId) const
LevelSetBulkEvaluationMode getCellBulkEvaluationMode() const
void fillFieldCellCache(LevelSetField field, const std::vector< long > &cellIds)
LevelSetKernel * m_kernel
std::size_t createCellCache(LevelSetFillIn expectedFillIn, std::size_t cacheId=CellCacheCollection::NULL_CACHE_ID)
std::size_t getFieldCellCacheId(LevelSetField field) const
CellCacheCollection::ValueCache< value_t > * getFieldCellCache(LevelSetField field) const
LevelSetCacheMode getFieldCellCacheMode(LevelSetField field) const
LevelSetCellLocation getCellLocation(long id) const
virtual bool isCellInNarrowBand(long id) const
value_t evalCellFieldCached(LevelSetField field, long id, const evaluator_t &evaluator, const fallback_t &fallback) const
virtual void flushVTKOutputData(std::fstream &stream, VTKFormat format, LevelSetField field) const
value_t evalCellField(LevelSetField field, long id, const evaluator_t &evaluator, const fallback_t &fallback) const
virtual std::size_t createFieldCellCache(LevelSetField field, std::size_t cacheId=CellCacheCollection::NULL_CACHE_ID)
Implements LevelSetKernel for octree meshes.
Implements LevelSetKernel for unstructured meshes.
The class LevelSetCache is the base class for defining caches that store values.
const CellConstRange getVTKCellWriteRange() const
void flushValue(std::fstream &, VTKFormat, const T &value) const
#define BITPIT_UNREACHABLE(str)
#define BITPIT_UNUSED(variable)
@ NARROW_BAND
Data are cached only inside the narrow band.
@ NONE
No caching will be performed.
@ FULL
Data are cached in the whole domain.
@ ON_DEMAND
Data are cached only where explicitly evaluated.
@ UNKNOWN
Unknown location.
@ EXACT
Exact data is evaluated.