23#ifndef _GEMA_FILE_IO_UTILS_H_
24#define _GEMA_FILE_IO_UTILS_H_
40namespace GmFileIOUtils
42 using TransformF = std::function<void(
const double*,
int,
double*)>;
49 const int _maxSize = 8*1024*1024;
52 assert(count > 0 && stride > 0);
53 int askedSize = count*stride;
54 _size = std::min(askedSize, _maxSize);
56 _data = (
char*)malloc(_size);
58 throw std::bad_alloc();
60 _capacity = _size / stride;
63 if(_data) free(_data);
64 throw std::bad_alloc();
68 void setData(
int i,
const void* ptr) {
69 assert(i < _capacity && ptr);
70 memcpy(_data + i*_stride, ptr, _stride);
73 void * getData(
int i) {
74 return (
void*)(_data + i*_stride);
77 void* memPtr()
const {
81 int getCapacity()
const {
return _capacity;}
The GmCellAccessor class is a proxy object to a value accesor implementing a more convenient interfac...
Definition gmCellAccessor.h:67
Base interface class for CellMesh type plugins.
Definition gmCellMesh.h:40
Base interface for FEM (finite element) meshes.
Definition gmElementMesh.h:42
Definition gmFileIOUtils.h:48
The GmGaussAccessor class is a proxy object to a value accessor implementing a more convenient interf...
Definition gmGaussAccessor.h:39
Base interface class for Mesh type plugins.
Definition gmMesh.h:48
Task manager used for handling parallel executions.
Definition gmTaskManager.h:84
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
Declaration of useful configuration definitions for the Core library.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of the GmFileFilter class.
GMC_API_EXPORT void fillNodeAcBuffer(GmTaskManager *tm, const GmMesh *mesh, GmValueAccessor *nac, int dimFilter, const TransformF &transformFunc, const QVector< int > &indexer, int nodeStart, int nodeCount, GmWBuffer &bbuf)
Utillity to fill a buffer with node accessor data. Gema tasks are used to speed up accessors with lua...
Definition gmFileIOUtils.cpp:51
GMC_API_EXPORT void fillCellAcBuffer(GmTaskManager *tm, const GmCellMesh *mesh, const GmCellAccessor *cac, const GmValueAccessor *coordAc, int dimFilter, const QVector< int > &indexer, int cellStart, int cellCount, GmWBuffer &bbuf)
Utillity to fill a buffer with cell accessor data. Gema tasks are used to speed up accessors with lua...
Definition gmFileIOUtils.cpp:113
GMC_API_EXPORT int fillGaussAcBuffer(GmTaskManager *tm, const GmElementMesh *mesh, const GmGaussAccessor *gac, int rule, int dimFilter, const QVector< GmFileFilter::Indexer > &preIndex, int cellStart, int cellCount, int valueStart, GmWBuffer &bbuf)
Utillity to fill a buffer with gauss accessor data. Gema tasks are used to speed up accessors with lu...
Definition gmFileIOUtils.cpp:200