Loading src/mesh/tnlMesh.h +13 −1 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ #include <core/tnlObject.h> #include <mesh/tnlMeshEntity.h> #include <mesh/traits/tnlMeshTraits.h> #include <mesh/layers/tnlMeshStorageLayer.h> #include <mesh/config/tnlMeshConfigValidator.h> #include <mesh/tnlMeshInitializer.h> template< typename MeshConfig > class tnlMesh : public tnlObject, Loading @@ -29,6 +31,7 @@ class tnlMesh : public tnlObject, { public: typedef MeshConfig Config; typedef tnlMeshTraits< MeshConfig > MeshTraits; typedef typename tnlMeshTraits< MeshConfig >::PointType PointType; enum { dimensions = tnlMeshTraits< MeshConfig >::meshDimensions }; Loading Loading @@ -193,9 +196,18 @@ class tnlMesh : public tnlObject, return entitiesStorage.template superentityIdsArray< SuperDimensionsTag >( DimensionsTag() ); } typedef typename tnlMeshConfigTraits< MeshConfig>::PointArrayType PointArrayType; typedef typename tnlMeshTraits< MeshConfig>::CellSeedArrayType CellSeedArrayType; bool init( const PointArrayType& points, const CellSeedArrayType& cellSeeds ) { tnlMeshInitializer< MeshConfig> meshInitializer; return meshInitializer.createMesh( points, cellSeeds, *this ); } protected: void init(); tnlMeshStorageLayers< MeshConfig > entitiesStorage; Loading src/mesh/tnlMeshBuilder.h +46 −46 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class tnlMeshBuilder bool setCellsCount( const GlobalIndexType& cellsCount ) { tnlAssert( 0 <= cellsCount, cerr << "cellsCount = " << cellsCount ); this->cellCount.setSize( cellsCount ); this->cellSeeds.setSize( cellsCount ); return true; } Loading Loading @@ -83,7 +83,7 @@ class tnlMeshBuilder typedef typename MeshTraits::PointArrayType PointArrayType; typedef typename MeshTraits::CellSeedArrayType CellSeedArrayType; void validate() const bool validate() const { if( !allPointsSet() ) { Loading Loading @@ -113,7 +113,7 @@ class tnlMeshBuilder PointArrayType points; CellSeedArrayType cellSeeds; tnlArray< bool, GlobalIndexType > pointsSet; tnlArray< bool, tnlHost, GlobalIndexType > pointsSet; }; #endif /* TNLMESHBUILDER_H */ Loading src/mesh/tnlMeshEntity.h +2 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <mesh/layers/tnlMeshSubentityStorageLayer.h> #include <mesh/layers/tnlMeshSuperentityStorageLayer.h> #include <mesh/layers/tnlMeshSuperentityAccess.h> #include <mesh/tnlMeshEntitySeed.h> template< typename ConfigTag, typename EntityTag > Loading Loading @@ -97,6 +98,7 @@ class tnlMeshEntity */ typedef ConfigTag MeshConfigTag; typedef EntityTag Tag; typedef tnlMeshEntitySeed< ConfigTag, EntityTag > SeedType; enum { dimensions = Tag::dimensions }; enum { meshDimensions = tnlMeshTraits< ConfigTag >::meshDimensions }; Loading src/mesh/tnlMeshEntityKey.h +23 −16 Original line number Diff line number Diff line /*************************************************************************** tnlMeshEntityKey.h - description tnlMeshEntitySeedKey.h - description ------------------- begin : Feb 13, 2014 copyright : (C) 2014 by Tomas Oberhuber Loading @@ -15,23 +15,30 @@ * * ***************************************************************************/ #ifndef TNLMESHENTITYKEY_H_ #define TNLMESHENTITYKEY_H_ #ifndef TNLMESHENTITYSEEDKEY_H_ #define TNLMESHENTITYSEEDKEY_H_ #include <mesh/tnlMeshEntity.h> #include <mesh/traits/tnlMeshSubentitiesTraits.h> #include <mesh/tnlDimensionsTag.h> template< typename ConfigTag, typename EntityTag > class tnlMeshEntitySeed; template< typename ConfigTag, typename EntityTag, typename DimensionsTag > class tnlMeshSubentitiesTraits; /**** * Unique identification of a mesh entity by its vertices. * Uniqueness is preserved for entities of the same type only. */ template< typename ConfigTag, typename EntityTag > class tnlMeshEntityKey class tnlMeshEntitySeedKey { typedef tnlMeshEntity< ConfigTag, EntityTag > EntityType; tnlMeshEntitySeed< ConfigTag, EntityTag > EntitySeedType; typedef typename tnlMeshSubentitiesTraits< ConfigTag, Loading @@ -40,25 +47,25 @@ class tnlMeshEntityKey public: explicit tnlMeshEntityKey( const EntityType& entity ) explicit tnlMeshEntitySeedKey( const EntitySeedType& entitySeed ) { for( typename ContainerType::IndexType i = 0; i < ContainerType::size; i < entitySeed.getCornersCount(); i++ ) vertexIDs[ i ] = entity.template getSubentityIndex<0>( i ); vertexIDs.sort( ); this->sortedCorners[ i ] = entitySeed.getCornerIds()[ i ]; sortedCorners.sort( ); } bool operator<( const tnlMeshEntityKey& other ) const bool operator<( const tnlMeshEntitySeedKey& other ) const { for( typename ContainerType::IndexType i = 0; i < ContainerType::size; i++) { if( vertexIDs[ i ] < other.vertexIDs[ i ] ) if( sortedCorners[ i ] < other.sortedCorners[ i ] ) return true; else if( vertexIDs[ i ] > other.vertexIDs[ i ] ) if( sortedCorners[ i ] > other.sortedCorners[ i ] ) return false; } return false; Loading @@ -66,8 +73,8 @@ class tnlMeshEntityKey private: ContainerType vertexIDs; ContainerType sortedCorners; }; #endif /* TNLMESHENTITYKEY_H_ */ #endif /* TNLMESHENTITYKSEEDEY_H_ */ src/mesh/tnlMeshEntitySeed.h +30 −24 Original line number Diff line number Diff line Loading @@ -33,12 +33,14 @@ class tnlMeshEntitySeed public: typedef typename tnlMeshConfigTraits< MeshConfig >::GlobalIndexType GlobalIndexType; typedef typename tnlMeshConfigTraits< MeshConfig >::LocalIndexType LocalIndexType; //typedef typename tnlMeshConfigTraits< MeshConfig >::IdArrayAccessorType IdArrayAccessorType; typedef typename SubvertexTraits::IdArrayType IdArrayType; typedef typename tnlMeshConfigTraits< MeshConfig >::IdArrayAccessorType IdArrayAccessorType; typedef typename SubvertexTraits::ContainerType IdArrayType; static tnlString getType() { return tnlString( "tnlMeshEntitySeed<>" ); } static constexpr LocalIndexType getCornersCount() { return SubvertexTraits::Count; return SubvertexTraits::count; } void setCornerId( LocalIndexType cornerIndex, GlobalIndexType pointIndex ) Loading @@ -49,15 +51,19 @@ class tnlMeshEntitySeed this->cornerIds[ cornerIndex ] = pointIndex; } IdArrayType& getCornerIds() IdArrayAccessorType& getCornerIds() { return this->cornerIds; IdArrayAccessorType accessor; accessor.bind( this->corners.getData(), this->corners.getSize() ); return accessor; } const IdArrayType& getCornerIds() const const IdArrayAccessorType& getCornerIds() const { return this->cornerIds; IdArrayAccessorType accessor; accessor.bind( this->corners.getData(), this->corners.getSize() ); return accessor; } private: Loading Loading
src/mesh/tnlMesh.h +13 −1 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ #include <core/tnlObject.h> #include <mesh/tnlMeshEntity.h> #include <mesh/traits/tnlMeshTraits.h> #include <mesh/layers/tnlMeshStorageLayer.h> #include <mesh/config/tnlMeshConfigValidator.h> #include <mesh/tnlMeshInitializer.h> template< typename MeshConfig > class tnlMesh : public tnlObject, Loading @@ -29,6 +31,7 @@ class tnlMesh : public tnlObject, { public: typedef MeshConfig Config; typedef tnlMeshTraits< MeshConfig > MeshTraits; typedef typename tnlMeshTraits< MeshConfig >::PointType PointType; enum { dimensions = tnlMeshTraits< MeshConfig >::meshDimensions }; Loading Loading @@ -193,9 +196,18 @@ class tnlMesh : public tnlObject, return entitiesStorage.template superentityIdsArray< SuperDimensionsTag >( DimensionsTag() ); } typedef typename tnlMeshConfigTraits< MeshConfig>::PointArrayType PointArrayType; typedef typename tnlMeshTraits< MeshConfig>::CellSeedArrayType CellSeedArrayType; bool init( const PointArrayType& points, const CellSeedArrayType& cellSeeds ) { tnlMeshInitializer< MeshConfig> meshInitializer; return meshInitializer.createMesh( points, cellSeeds, *this ); } protected: void init(); tnlMeshStorageLayers< MeshConfig > entitiesStorage; Loading
src/mesh/tnlMeshBuilder.h +46 −46 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class tnlMeshBuilder bool setCellsCount( const GlobalIndexType& cellsCount ) { tnlAssert( 0 <= cellsCount, cerr << "cellsCount = " << cellsCount ); this->cellCount.setSize( cellsCount ); this->cellSeeds.setSize( cellsCount ); return true; } Loading Loading @@ -83,7 +83,7 @@ class tnlMeshBuilder typedef typename MeshTraits::PointArrayType PointArrayType; typedef typename MeshTraits::CellSeedArrayType CellSeedArrayType; void validate() const bool validate() const { if( !allPointsSet() ) { Loading Loading @@ -113,7 +113,7 @@ class tnlMeshBuilder PointArrayType points; CellSeedArrayType cellSeeds; tnlArray< bool, GlobalIndexType > pointsSet; tnlArray< bool, tnlHost, GlobalIndexType > pointsSet; }; #endif /* TNLMESHBUILDER_H */ Loading
src/mesh/tnlMeshEntity.h +2 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <mesh/layers/tnlMeshSubentityStorageLayer.h> #include <mesh/layers/tnlMeshSuperentityStorageLayer.h> #include <mesh/layers/tnlMeshSuperentityAccess.h> #include <mesh/tnlMeshEntitySeed.h> template< typename ConfigTag, typename EntityTag > Loading Loading @@ -97,6 +98,7 @@ class tnlMeshEntity */ typedef ConfigTag MeshConfigTag; typedef EntityTag Tag; typedef tnlMeshEntitySeed< ConfigTag, EntityTag > SeedType; enum { dimensions = Tag::dimensions }; enum { meshDimensions = tnlMeshTraits< ConfigTag >::meshDimensions }; Loading
src/mesh/tnlMeshEntityKey.h +23 −16 Original line number Diff line number Diff line /*************************************************************************** tnlMeshEntityKey.h - description tnlMeshEntitySeedKey.h - description ------------------- begin : Feb 13, 2014 copyright : (C) 2014 by Tomas Oberhuber Loading @@ -15,23 +15,30 @@ * * ***************************************************************************/ #ifndef TNLMESHENTITYKEY_H_ #define TNLMESHENTITYKEY_H_ #ifndef TNLMESHENTITYSEEDKEY_H_ #define TNLMESHENTITYSEEDKEY_H_ #include <mesh/tnlMeshEntity.h> #include <mesh/traits/tnlMeshSubentitiesTraits.h> #include <mesh/tnlDimensionsTag.h> template< typename ConfigTag, typename EntityTag > class tnlMeshEntitySeed; template< typename ConfigTag, typename EntityTag, typename DimensionsTag > class tnlMeshSubentitiesTraits; /**** * Unique identification of a mesh entity by its vertices. * Uniqueness is preserved for entities of the same type only. */ template< typename ConfigTag, typename EntityTag > class tnlMeshEntityKey class tnlMeshEntitySeedKey { typedef tnlMeshEntity< ConfigTag, EntityTag > EntityType; tnlMeshEntitySeed< ConfigTag, EntityTag > EntitySeedType; typedef typename tnlMeshSubentitiesTraits< ConfigTag, Loading @@ -40,25 +47,25 @@ class tnlMeshEntityKey public: explicit tnlMeshEntityKey( const EntityType& entity ) explicit tnlMeshEntitySeedKey( const EntitySeedType& entitySeed ) { for( typename ContainerType::IndexType i = 0; i < ContainerType::size; i < entitySeed.getCornersCount(); i++ ) vertexIDs[ i ] = entity.template getSubentityIndex<0>( i ); vertexIDs.sort( ); this->sortedCorners[ i ] = entitySeed.getCornerIds()[ i ]; sortedCorners.sort( ); } bool operator<( const tnlMeshEntityKey& other ) const bool operator<( const tnlMeshEntitySeedKey& other ) const { for( typename ContainerType::IndexType i = 0; i < ContainerType::size; i++) { if( vertexIDs[ i ] < other.vertexIDs[ i ] ) if( sortedCorners[ i ] < other.sortedCorners[ i ] ) return true; else if( vertexIDs[ i ] > other.vertexIDs[ i ] ) if( sortedCorners[ i ] > other.sortedCorners[ i ] ) return false; } return false; Loading @@ -66,8 +73,8 @@ class tnlMeshEntityKey private: ContainerType vertexIDs; ContainerType sortedCorners; }; #endif /* TNLMESHENTITYKEY_H_ */ #endif /* TNLMESHENTITYKSEEDEY_H_ */
src/mesh/tnlMeshEntitySeed.h +30 −24 Original line number Diff line number Diff line Loading @@ -33,12 +33,14 @@ class tnlMeshEntitySeed public: typedef typename tnlMeshConfigTraits< MeshConfig >::GlobalIndexType GlobalIndexType; typedef typename tnlMeshConfigTraits< MeshConfig >::LocalIndexType LocalIndexType; //typedef typename tnlMeshConfigTraits< MeshConfig >::IdArrayAccessorType IdArrayAccessorType; typedef typename SubvertexTraits::IdArrayType IdArrayType; typedef typename tnlMeshConfigTraits< MeshConfig >::IdArrayAccessorType IdArrayAccessorType; typedef typename SubvertexTraits::ContainerType IdArrayType; static tnlString getType() { return tnlString( "tnlMeshEntitySeed<>" ); } static constexpr LocalIndexType getCornersCount() { return SubvertexTraits::Count; return SubvertexTraits::count; } void setCornerId( LocalIndexType cornerIndex, GlobalIndexType pointIndex ) Loading @@ -49,15 +51,19 @@ class tnlMeshEntitySeed this->cornerIds[ cornerIndex ] = pointIndex; } IdArrayType& getCornerIds() IdArrayAccessorType& getCornerIds() { return this->cornerIds; IdArrayAccessorType accessor; accessor.bind( this->corners.getData(), this->corners.getSize() ); return accessor; } const IdArrayType& getCornerIds() const const IdArrayAccessorType& getCornerIds() const { return this->cornerIds; IdArrayAccessorType accessor; accessor.bind( this->corners.getData(), this->corners.getSize() ); return accessor; } private: Loading