Loading src/TNL/Meshes/DistributedMeshes/DistributedMesh.h +5 −12 Original line number Diff line number Diff line Loading @@ -22,8 +22,7 @@ namespace DistributedMeshes { template< typename Mesh > class DistributedMesh : protected GlobalIndexStorage< Mesh, 0 >, protected GlobalIndexStorage< Mesh, Mesh::getMeshDimension() > : protected GlobalIndexStorageFamily< Mesh > { public: using MeshType = Mesh; Loading Loading @@ -55,8 +54,7 @@ public: template< typename Mesh_ > DistributedMesh& operator=( const Mesh_& other ) { getGlobalIndices< 0 >() = other.template getGlobalIndices< 0 >(); getGlobalIndices< Mesh::getMeshDimension() >() = other.template getGlobalIndices< Mesh::getMeshDimension() >(); GlobalIndexStorageFamily< Mesh >::operator=( other ); localMesh = other.getLocalMesh(); group = other.getCommunicationGroup(); ghostLevels = other.getGhostLevels(); Loading @@ -67,8 +65,7 @@ public: bool operator==( const DistributedMesh& other ) const { return ( getGlobalIndices< 0 >() == other.template getGlobalIndices< 0 >() && getGlobalIndices< Mesh::getMeshDimension() >() == other.template getGlobalIndices< Mesh::getMeshDimension() >() && return ( GlobalIndexStorageFamily< Mesh, DeviceType >::operator==( other ) && localMesh == other.getLocalMesh() && group == other.getCommunicationGroup() && ghostLevels == other.getGhostLevels() && Loading Loading @@ -137,18 +134,14 @@ public: const GlobalIndexArray& getGlobalIndices() const { static_assert( Dimension == 0 || Dimension == MeshType::getMeshDimension(), "Global index array for this dimension is not implemented yet." ); return GlobalIndexStorage< MeshType, Dimension >::getGlobalIndices(); return GlobalIndexStorage< MeshType, DeviceType, Dimension >::getGlobalIndices(); } template< int Dimension > GlobalIndexArray& getGlobalIndices() { static_assert( Dimension == 0 || Dimension == MeshType::getMeshDimension(), "Global index array for this dimension is not implemented yet." ); return GlobalIndexStorage< MeshType, Dimension >::getGlobalIndices(); return GlobalIndexStorage< MeshType, DeviceType, Dimension >::getGlobalIndices(); } VTKTypesArrayType& Loading src/TNL/Meshes/DistributedMeshes/GlobalIndexStorage.h +71 −2 Original line number Diff line number Diff line /*************************************************************************** DistributedMesh.h - description GlobalIndexStorage.h - description ------------------- begin : April 11, 2020 copyright : (C) 2020 by Tomas Oberhuber et al. Loading @@ -12,16 +12,36 @@ #pragma once #include <TNL/Meshes/DimensionTag.h> namespace TNL { namespace Meshes { namespace DistributedMeshes { template< typename Mesh, int Dimension > template< typename Mesh, typename Device, int Dimension > class GlobalIndexStorage { public: using GlobalIndexArray = typename Mesh::GlobalIndexArray; GlobalIndexStorage() = default; GlobalIndexStorage( const GlobalIndexStorage& ) = default; GlobalIndexStorage( GlobalIndexStorage&& ) = default; GlobalIndexStorage& operator=( const GlobalIndexStorage& ) = default; GlobalIndexStorage& operator=( GlobalIndexStorage&& ) = default; template< typename Mesh_ > GlobalIndexStorage& operator=( const Mesh_& mesh ) { globalIndices = mesh.template getGlobalIndices< Dimension >(); return *this; } bool operator==( const GlobalIndexStorage& other ) const { return globalIndices == other.getGlobalIndices(); } const GlobalIndexArray& getGlobalIndices() const { Loading @@ -38,6 +58,55 @@ protected: GlobalIndexArray globalIndices; }; template< typename Mesh, typename Device = typename Mesh::DeviceType, typename DimensionTag = Meshes::DimensionTag< 0 > > class GlobalIndexStorageFamily : public GlobalIndexStorage< Mesh, Device, DimensionTag::value >, public GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment > { public: GlobalIndexStorageFamily() = default; GlobalIndexStorageFamily( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) = default; GlobalIndexStorageFamily& operator=( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily& operator=( GlobalIndexStorageFamily&& ) = default; template< typename Mesh_ > GlobalIndexStorageFamily& operator=( const Mesh_& mesh ) { GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator=( mesh ); GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator=( mesh ); return *this; } bool operator==( const GlobalIndexStorageFamily& other ) const { return GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator==( other ) && GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator==( other ); } }; template< typename Mesh, typename Device > class GlobalIndexStorageFamily< Mesh, Device, Meshes::DimensionTag< Mesh::getMeshDimension() + 1 > > { public: GlobalIndexStorageFamily() = default; GlobalIndexStorageFamily( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) = default; GlobalIndexStorageFamily& operator=( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily& operator=( GlobalIndexStorageFamily&& ) = default; template< typename Mesh_ > GlobalIndexStorageFamily& operator=( const Mesh_& ) { return *this; } bool operator==( const GlobalIndexStorageFamily& ) const { return true; } }; } // namespace DistributedMeshes } // namespace Meshes } // namespace TNL Loading
src/TNL/Meshes/DistributedMeshes/DistributedMesh.h +5 −12 Original line number Diff line number Diff line Loading @@ -22,8 +22,7 @@ namespace DistributedMeshes { template< typename Mesh > class DistributedMesh : protected GlobalIndexStorage< Mesh, 0 >, protected GlobalIndexStorage< Mesh, Mesh::getMeshDimension() > : protected GlobalIndexStorageFamily< Mesh > { public: using MeshType = Mesh; Loading Loading @@ -55,8 +54,7 @@ public: template< typename Mesh_ > DistributedMesh& operator=( const Mesh_& other ) { getGlobalIndices< 0 >() = other.template getGlobalIndices< 0 >(); getGlobalIndices< Mesh::getMeshDimension() >() = other.template getGlobalIndices< Mesh::getMeshDimension() >(); GlobalIndexStorageFamily< Mesh >::operator=( other ); localMesh = other.getLocalMesh(); group = other.getCommunicationGroup(); ghostLevels = other.getGhostLevels(); Loading @@ -67,8 +65,7 @@ public: bool operator==( const DistributedMesh& other ) const { return ( getGlobalIndices< 0 >() == other.template getGlobalIndices< 0 >() && getGlobalIndices< Mesh::getMeshDimension() >() == other.template getGlobalIndices< Mesh::getMeshDimension() >() && return ( GlobalIndexStorageFamily< Mesh, DeviceType >::operator==( other ) && localMesh == other.getLocalMesh() && group == other.getCommunicationGroup() && ghostLevels == other.getGhostLevels() && Loading Loading @@ -137,18 +134,14 @@ public: const GlobalIndexArray& getGlobalIndices() const { static_assert( Dimension == 0 || Dimension == MeshType::getMeshDimension(), "Global index array for this dimension is not implemented yet." ); return GlobalIndexStorage< MeshType, Dimension >::getGlobalIndices(); return GlobalIndexStorage< MeshType, DeviceType, Dimension >::getGlobalIndices(); } template< int Dimension > GlobalIndexArray& getGlobalIndices() { static_assert( Dimension == 0 || Dimension == MeshType::getMeshDimension(), "Global index array for this dimension is not implemented yet." ); return GlobalIndexStorage< MeshType, Dimension >::getGlobalIndices(); return GlobalIndexStorage< MeshType, DeviceType, Dimension >::getGlobalIndices(); } VTKTypesArrayType& Loading
src/TNL/Meshes/DistributedMeshes/GlobalIndexStorage.h +71 −2 Original line number Diff line number Diff line /*************************************************************************** DistributedMesh.h - description GlobalIndexStorage.h - description ------------------- begin : April 11, 2020 copyright : (C) 2020 by Tomas Oberhuber et al. Loading @@ -12,16 +12,36 @@ #pragma once #include <TNL/Meshes/DimensionTag.h> namespace TNL { namespace Meshes { namespace DistributedMeshes { template< typename Mesh, int Dimension > template< typename Mesh, typename Device, int Dimension > class GlobalIndexStorage { public: using GlobalIndexArray = typename Mesh::GlobalIndexArray; GlobalIndexStorage() = default; GlobalIndexStorage( const GlobalIndexStorage& ) = default; GlobalIndexStorage( GlobalIndexStorage&& ) = default; GlobalIndexStorage& operator=( const GlobalIndexStorage& ) = default; GlobalIndexStorage& operator=( GlobalIndexStorage&& ) = default; template< typename Mesh_ > GlobalIndexStorage& operator=( const Mesh_& mesh ) { globalIndices = mesh.template getGlobalIndices< Dimension >(); return *this; } bool operator==( const GlobalIndexStorage& other ) const { return globalIndices == other.getGlobalIndices(); } const GlobalIndexArray& getGlobalIndices() const { Loading @@ -38,6 +58,55 @@ protected: GlobalIndexArray globalIndices; }; template< typename Mesh, typename Device = typename Mesh::DeviceType, typename DimensionTag = Meshes::DimensionTag< 0 > > class GlobalIndexStorageFamily : public GlobalIndexStorage< Mesh, Device, DimensionTag::value >, public GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment > { public: GlobalIndexStorageFamily() = default; GlobalIndexStorageFamily( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) = default; GlobalIndexStorageFamily& operator=( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily& operator=( GlobalIndexStorageFamily&& ) = default; template< typename Mesh_ > GlobalIndexStorageFamily& operator=( const Mesh_& mesh ) { GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator=( mesh ); GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator=( mesh ); return *this; } bool operator==( const GlobalIndexStorageFamily& other ) const { return GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator==( other ) && GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator==( other ); } }; template< typename Mesh, typename Device > class GlobalIndexStorageFamily< Mesh, Device, Meshes::DimensionTag< Mesh::getMeshDimension() + 1 > > { public: GlobalIndexStorageFamily() = default; GlobalIndexStorageFamily( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) = default; GlobalIndexStorageFamily& operator=( const GlobalIndexStorageFamily& ) = default; GlobalIndexStorageFamily& operator=( GlobalIndexStorageFamily&& ) = default; template< typename Mesh_ > GlobalIndexStorageFamily& operator=( const Mesh_& ) { return *this; } bool operator==( const GlobalIndexStorageFamily& ) const { return true; } }; } // namespace DistributedMeshes } // namespace Meshes } // namespace TNL