Loading src/UnstructuredMesh/MeshDataContainer/MeshDataContainer.h +21 −12 Original line number Original line Diff line number Diff line Loading @@ -102,7 +102,6 @@ private: * @param parent * @param parent * @param meshDataContainer * @param meshDataContainer */ */ template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { parent.template getDataByPos<pos>().resize( parent.template getDataByPos<pos>().resize( Loading @@ -111,7 +110,6 @@ private: Allocator<pos - 1>::allocateMemory(parent, meshDataContainer); Allocator<pos - 1>::allocateMemory(parent, meshDataContainer); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue) { const DataType& initialValue) { Loading Loading @@ -143,14 +141,12 @@ private: } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { parent.template getDataByPos<0>().resize( parent.template getDataByPos<0>().resize( meshDataContainer.template getDataByPos<0>().size()); meshDataContainer.template getDataByPos<0>().size()); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue) { const DataType& initialValue) { Loading Loading @@ -178,22 +174,43 @@ public: return data._DataContainer<DataType, dimensionIndex<dim>()>::_data; return data._DataContainer<DataType, dimensionIndex<dim>()>::_data; } } template<unsigned int dim> const DataContainer<DataType, dimensionIndex<dim>(), dim>& getDataByDim() const { return data._DataContainer<DataType, dimensionIndex<dim>()>::_data; } template<unsigned int pos> template<unsigned int pos> DataContainer<DataType, pos, dimensionAt<pos>()>& getDataByPos(){ DataContainer<DataType, pos, dimensionAt<pos>()>& getDataByPos(){ return data._DataContainer<DataType,pos>::_data; return data._DataContainer<DataType,pos>::_data; } } template<unsigned int pos> const DataContainer<DataType, pos, dimensionAt<pos>()>& getDataByPos() const { return data._DataContainer<DataType,pos>::_data; } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> DataType& at(const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { DataType& at(const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { return getDataByDim<ElementDim>().at(element.getIndex()); return getDataByDim<ElementDim>().at(element.getIndex()); } } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> const DataType& at(const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) const { return getDataByDim<ElementDim>().at(element.getIndex()); } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> DataType& operator[](const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { DataType& operator[](const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { return getDataByDim<ElementDim>()[element.getIndex()]; return getDataByDim<ElementDim>()[element.getIndex()]; } } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> const DataType& operator[](const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) const { return getDataByDim<ElementDim>()[element.getIndex()]; } MeshDataContainer(){} MeshDataContainer(){} template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> Loading Loading @@ -235,12 +252,10 @@ public: } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer){ void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer){ Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer); Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer); } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue){ void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue){ Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer,initialValue); Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer,initialValue); } } Loading Loading @@ -336,7 +351,6 @@ public: Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, mesh, values...); Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, mesh, values...); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { parent.template getDataByPos<pos>().resize( parent.template getDataByPos<pos>().resize( Loading @@ -344,7 +358,6 @@ public: Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, meshDataContainer); Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, meshDataContainer); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const _DataType& initialValue, const _DataType& initialValue, Loading Loading @@ -379,7 +392,6 @@ public: } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { parent.template getDataByPos<0>().resize( parent.template getDataByPos<0>().resize( Loading @@ -387,7 +399,6 @@ public: } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const _DataType& initialValue, const _DataType& initialValue, Loading Loading @@ -471,14 +482,12 @@ public: } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer){ void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer){ Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer); Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer); } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const DataTypes&... initialValues){ const DataTypes&... initialValues){ Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer, initialValues...); Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer, initialValues...); Loading Loading
src/UnstructuredMesh/MeshDataContainer/MeshDataContainer.h +21 −12 Original line number Original line Diff line number Diff line Loading @@ -102,7 +102,6 @@ private: * @param parent * @param parent * @param meshDataContainer * @param meshDataContainer */ */ template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { parent.template getDataByPos<pos>().resize( parent.template getDataByPos<pos>().resize( Loading @@ -111,7 +110,6 @@ private: Allocator<pos - 1>::allocateMemory(parent, meshDataContainer); Allocator<pos - 1>::allocateMemory(parent, meshDataContainer); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue) { const DataType& initialValue) { Loading Loading @@ -143,14 +141,12 @@ private: } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { const MeshDataContainer<DataType, Dimensions...>& meshDataContainer) { parent.template getDataByPos<0>().resize( parent.template getDataByPos<0>().resize( meshDataContainer.template getDataByPos<0>().size()); meshDataContainer.template getDataByPos<0>().size()); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<DataType, Dimensions...>& parent , const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue) { const DataType& initialValue) { Loading Loading @@ -178,22 +174,43 @@ public: return data._DataContainer<DataType, dimensionIndex<dim>()>::_data; return data._DataContainer<DataType, dimensionIndex<dim>()>::_data; } } template<unsigned int dim> const DataContainer<DataType, dimensionIndex<dim>(), dim>& getDataByDim() const { return data._DataContainer<DataType, dimensionIndex<dim>()>::_data; } template<unsigned int pos> template<unsigned int pos> DataContainer<DataType, pos, dimensionAt<pos>()>& getDataByPos(){ DataContainer<DataType, pos, dimensionAt<pos>()>& getDataByPos(){ return data._DataContainer<DataType,pos>::_data; return data._DataContainer<DataType,pos>::_data; } } template<unsigned int pos> const DataContainer<DataType, pos, dimensionAt<pos>()>& getDataByPos() const { return data._DataContainer<DataType,pos>::_data; } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> DataType& at(const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { DataType& at(const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { return getDataByDim<ElementDim>().at(element.getIndex()); return getDataByDim<ElementDim>().at(element.getIndex()); } } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> const DataType& at(const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) const { return getDataByDim<ElementDim>().at(element.getIndex()); } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> DataType& operator[](const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { DataType& operator[](const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) { return getDataByDim<ElementDim>()[element.getIndex()]; return getDataByDim<ElementDim>()[element.getIndex()]; } } template <unsigned int ElementDim, unsigned int Dimension, typename IndexType, typename Real, unsigned int Reserve> const DataType& operator[](const MeshElement<Dimension, ElementDim, IndexType, Real, Reserve>& element) const { return getDataByDim<ElementDim>()[element.getIndex()]; } MeshDataContainer(){} MeshDataContainer(){} template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> Loading Loading @@ -235,12 +252,10 @@ public: } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer){ void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer){ Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer); Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer); } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue){ void allocateData(const MeshDataContainer<DataType, Dimensions...>& meshDataContainer, const DataType& initialValue){ Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer,initialValue); Allocator<sizeof... (Dimensions) - 1>::allocateMemory(*this, meshDataContainer,initialValue); } } Loading Loading @@ -336,7 +351,6 @@ public: Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, mesh, values...); Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, mesh, values...); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { parent.template getDataByPos<pos>().resize( parent.template getDataByPos<pos>().resize( Loading @@ -344,7 +358,6 @@ public: Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, meshDataContainer); Allocator<pos + 1, _DataTypes...>::allocateMemory(parent, meshDataContainer); } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const _DataType& initialValue, const _DataType& initialValue, Loading Loading @@ -379,7 +392,6 @@ public: } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent , const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer) { parent.template getDataByPos<0>().resize( parent.template getDataByPos<0>().resize( Loading @@ -387,7 +399,6 @@ public: } } template<unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, static void allocateMemory(MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& parent, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const _DataType& initialValue, const _DataType& initialValue, Loading Loading @@ -471,14 +482,12 @@ public: } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer){ void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer){ Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer); Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer); } } template <unsigned int Dimension, typename IndexType, typename Real, unsigned int ...Reserve> void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, void allocateData(const MeshDataContainer<std::tuple<DataTypes...>, Dimensions...>& meshDataContainer, const DataTypes&... initialValues){ const DataTypes&... initialValues){ Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer, initialValues...); Allocator<0, DataTypes...>::allocateMemory(*this, meshDataContainer, initialValues...); Loading