Loading src/mesh/config/tnlMeshConfigBase.h +3 −2 Original line number Diff line number Diff line Loading @@ -72,12 +72,13 @@ struct tnlMeshConfigBase } /**** * Storage of subentity orientations of mesh entities * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return false; return ( SubentityDimensions > 0 ); } /**** Loading src/mesh/layers/tnlMeshSubentityStorageLayer.h +22 −5 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ class tnlMeshSubentityStorageLayer< ConfigTag, typedef typename ContainerType::ElementType GlobalIndexType; typedef int LocalIndexType; typedef typename SubentityTraits::IdArrayType IdArrayType; typedef typename SubentityTraits::OrientationArrayType OrientationArrayType; typedef typename tnlMeshConfigTraits< ConfigTag >::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; tnlMeshSubentityStorageLayer() { Loading Loading @@ -164,11 +166,20 @@ class tnlMeshSubentityStorageLayer< ConfigTag, using BaseType::subentityIdsArray; IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; } using BaseType::subentityOrientation; IdPermutationArrayAccessorType subentityOrientation( DimensionsTag, LocalIndexType index) const { tnlAssert( 0 <= index && index < SubentityTraits::count, ); return this->subentityOrientations[ index ].getSubvertexPermutation(); } private: IdArrayType subentitiesIndices; SharedContainerType sharedSubentitiesIndices; OrientationArrayType subentityOrientations; }; Loading Loading @@ -282,7 +293,13 @@ class tnlMeshSubentityStorageLayer< ConfigTag, IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; } private: protected: /*** * Necessary because of 'using TBase::...;' in the derived classes */ void subentityOrientation() {} void subentityOrientationsArray() {} IdArrayType verticesIndices; Loading src/mesh/tnlMeshEntity.h +19 −5 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class tnlMeshEntity typedef tnlMeshEntitySeed< ConfigTag, EntityTag > SeedType; enum { dimensions = Tag::dimensions }; enum { meshDimensions = tnlMeshTraits< ConfigTag >::meshDimensions }; typedef typename tnlMeshConfigTraits< ConfigTag>::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; tnlMeshEntity( const SeedType& entitySeed ) { Loading Loading @@ -310,6 +310,14 @@ class tnlMeshEntity return this->getSubentitiesIndices< 0 >(); } template< int dim > IdPermutationArrayAccessorType subentityOrientation( LocalIndexType index ) const { static const LocalIndexType subentitiesCount = tnlMeshConfigTraits< ConfigTag >::template SubentityTraits< EntityTag, tnlDimensionsTag<dim>>::count; tnlAssert( 0 <= index && index < subentitiesCount, ); return SubentityStorageLayers::subentityOrientation( tnlDimensionsTag< dim >(), index ); } // TODO: This is only for the mesh initializer, fix this typedef tnlMeshSuperentityAccess< ConfigTag, EntityTag > SuperentityAccessBase; Loading @@ -328,6 +336,12 @@ class tnlMeshEntity return SuperentityAccessBase::superentityIdsArray( DimensionsTag()); } template< typename DimensionsTag > typename tnlMeshConfigTraits< ConfigTag >::template SubentityTraits< EntityTag, DimensionsTag >::OrientationArray& subentityOrientationsArray() { return SubentityStorageLayers::subentityOrientationsArray( DimensionsTag() ); } }; template< typename ConfigTag > Loading src/mesh/tnlMeshEntityOrientation.h +6 −6 Original line number Diff line number Diff line Loading @@ -25,23 +25,23 @@ class tnlMeshEntityOrientation template< typename, typename> friend class tnlMeshEntityReferenceOrientation; public: typedef typename tnlMeshConfigTraits< MeshConfig >::IdPermutationArrayAccessor IdPermutationArrayAccessor; typedef typename tnlMeshConfigTraits< MeshConfig >::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; IdPermutationArrayAccessor getSubvertexPermutation() const IdPermutationArrayAccessorType getSubvertexPermutation() const { return this->subvertexPermutation.subarray( 0, this->subvertexPermutation.getSize() ); } private: typedef typename ConfigTraits<TConfig>::TLocalIndex TLocalIndex; typedef typename ConfigTraits<TConfig>::template SubentityTraits<TEntityTopology, Dim<0>>::TIdPermutationArray TIdPermutationArray; typedef typename tnlMeshConfigTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename tnlMeshConfigTraits< MeshConfig >::template SubentityTraits< EntityTopology, tnlDimensionsTag< 0 > >::IdPermutationArrayType IdPermutationArrayType; void setPermutationValue(TLocalIndex index, TLocalIndex value) void setPermutationValue( LocalIndexType index, LocalIndexType value ) { this->subvertexPermutation[ index ] = value; } IdPermutationArray this->subvertexPermutation; IdPermutationArrayType subvertexPermutation; }; Loading src/mesh/tnlMeshEntityReferenceOrientation.h 0 → 100644 +63 −0 Original line number Diff line number Diff line /*************************************************************************** tnlMeshEntityReferenceOrientation.h - description ------------------- begin : Aug 25, 2015 copyright : (C) 2015 by Tomas Oberhuber et al. email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLMESHENTITYREFERENCEORIENTATION_H #define TNLMESHENTITYREFERENCEORIENTATION_H template< typename MeshConfig, typename EntityTopology > class tnlMeshEntityReferenceOrientation { typedef typename tnlMeshConfigTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename tnlMeshConfigTraits< MeshConfig >::GlobalIndexType GlobalIndexType; public: typedef tnlMeshEntitySeed< MeshConfig, EntityTopology > SeedType; typedef tnlMeshEntityOrientation< MeshConfig, EntityTopology > EntityOrientation; tnlMeshEntityReferenceOrientation() = default; explicit tnlMeshEntityReferenceOrientation( const SeedType& referenceSeed ) { auto referenceCornerIds = referenceSeed.getCornerIds(); for( LocalIndexType i = 0; i < referenceCornerIds.getSize(); i++ ) { tnlAssert( this->cornerIdsMap.find( referenceCornerIds[i]) == this->cornerIdsMap.end(), ); this->cornerIdsMap.insert( std::make_pair( referenceCornerIds[i], i ) ); } } static tnlString getType(){}; EntityOrientation createOrientation( const SeedType& seed ) const { EntityOrientation result; auto cornerIds = seed.getCornerIds(); for( LocalIndexType i = 0; i < cornerIds.getSize(); i++ ) { tnlAssert( this->cornerIdsMap.find( cornerIds[ i ] ) != this->cornerIdsMap.end(), ); result.setPermutationValue( i, this->cornerIdsMap.find( cornerIds[ i ])->second ); } return result; } private: std::map< GlobalIndexType, LocalIndexType > cornerIdsMap; }; #endif /* TNLMESHENTITYREFERENCEORIENTATION_H */ Loading
src/mesh/config/tnlMeshConfigBase.h +3 −2 Original line number Diff line number Diff line Loading @@ -72,12 +72,13 @@ struct tnlMeshConfigBase } /**** * Storage of subentity orientations of mesh entities * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return false; return ( SubentityDimensions > 0 ); } /**** Loading
src/mesh/layers/tnlMeshSubentityStorageLayer.h +22 −5 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ class tnlMeshSubentityStorageLayer< ConfigTag, typedef typename ContainerType::ElementType GlobalIndexType; typedef int LocalIndexType; typedef typename SubentityTraits::IdArrayType IdArrayType; typedef typename SubentityTraits::OrientationArrayType OrientationArrayType; typedef typename tnlMeshConfigTraits< ConfigTag >::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; tnlMeshSubentityStorageLayer() { Loading Loading @@ -164,11 +166,20 @@ class tnlMeshSubentityStorageLayer< ConfigTag, using BaseType::subentityIdsArray; IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; } using BaseType::subentityOrientation; IdPermutationArrayAccessorType subentityOrientation( DimensionsTag, LocalIndexType index) const { tnlAssert( 0 <= index && index < SubentityTraits::count, ); return this->subentityOrientations[ index ].getSubvertexPermutation(); } private: IdArrayType subentitiesIndices; SharedContainerType sharedSubentitiesIndices; OrientationArrayType subentityOrientations; }; Loading Loading @@ -282,7 +293,13 @@ class tnlMeshSubentityStorageLayer< ConfigTag, IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; } private: protected: /*** * Necessary because of 'using TBase::...;' in the derived classes */ void subentityOrientation() {} void subentityOrientationsArray() {} IdArrayType verticesIndices; Loading
src/mesh/tnlMeshEntity.h +19 −5 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ class tnlMeshEntity typedef tnlMeshEntitySeed< ConfigTag, EntityTag > SeedType; enum { dimensions = Tag::dimensions }; enum { meshDimensions = tnlMeshTraits< ConfigTag >::meshDimensions }; typedef typename tnlMeshConfigTraits< ConfigTag>::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; tnlMeshEntity( const SeedType& entitySeed ) { Loading Loading @@ -310,6 +310,14 @@ class tnlMeshEntity return this->getSubentitiesIndices< 0 >(); } template< int dim > IdPermutationArrayAccessorType subentityOrientation( LocalIndexType index ) const { static const LocalIndexType subentitiesCount = tnlMeshConfigTraits< ConfigTag >::template SubentityTraits< EntityTag, tnlDimensionsTag<dim>>::count; tnlAssert( 0 <= index && index < subentitiesCount, ); return SubentityStorageLayers::subentityOrientation( tnlDimensionsTag< dim >(), index ); } // TODO: This is only for the mesh initializer, fix this typedef tnlMeshSuperentityAccess< ConfigTag, EntityTag > SuperentityAccessBase; Loading @@ -328,6 +336,12 @@ class tnlMeshEntity return SuperentityAccessBase::superentityIdsArray( DimensionsTag()); } template< typename DimensionsTag > typename tnlMeshConfigTraits< ConfigTag >::template SubentityTraits< EntityTag, DimensionsTag >::OrientationArray& subentityOrientationsArray() { return SubentityStorageLayers::subentityOrientationsArray( DimensionsTag() ); } }; template< typename ConfigTag > Loading
src/mesh/tnlMeshEntityOrientation.h +6 −6 Original line number Diff line number Diff line Loading @@ -25,23 +25,23 @@ class tnlMeshEntityOrientation template< typename, typename> friend class tnlMeshEntityReferenceOrientation; public: typedef typename tnlMeshConfigTraits< MeshConfig >::IdPermutationArrayAccessor IdPermutationArrayAccessor; typedef typename tnlMeshConfigTraits< MeshConfig >::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; IdPermutationArrayAccessor getSubvertexPermutation() const IdPermutationArrayAccessorType getSubvertexPermutation() const { return this->subvertexPermutation.subarray( 0, this->subvertexPermutation.getSize() ); } private: typedef typename ConfigTraits<TConfig>::TLocalIndex TLocalIndex; typedef typename ConfigTraits<TConfig>::template SubentityTraits<TEntityTopology, Dim<0>>::TIdPermutationArray TIdPermutationArray; typedef typename tnlMeshConfigTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename tnlMeshConfigTraits< MeshConfig >::template SubentityTraits< EntityTopology, tnlDimensionsTag< 0 > >::IdPermutationArrayType IdPermutationArrayType; void setPermutationValue(TLocalIndex index, TLocalIndex value) void setPermutationValue( LocalIndexType index, LocalIndexType value ) { this->subvertexPermutation[ index ] = value; } IdPermutationArray this->subvertexPermutation; IdPermutationArrayType subvertexPermutation; }; Loading
src/mesh/tnlMeshEntityReferenceOrientation.h 0 → 100644 +63 −0 Original line number Diff line number Diff line /*************************************************************************** tnlMeshEntityReferenceOrientation.h - description ------------------- begin : Aug 25, 2015 copyright : (C) 2015 by Tomas Oberhuber et al. email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLMESHENTITYREFERENCEORIENTATION_H #define TNLMESHENTITYREFERENCEORIENTATION_H template< typename MeshConfig, typename EntityTopology > class tnlMeshEntityReferenceOrientation { typedef typename tnlMeshConfigTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename tnlMeshConfigTraits< MeshConfig >::GlobalIndexType GlobalIndexType; public: typedef tnlMeshEntitySeed< MeshConfig, EntityTopology > SeedType; typedef tnlMeshEntityOrientation< MeshConfig, EntityTopology > EntityOrientation; tnlMeshEntityReferenceOrientation() = default; explicit tnlMeshEntityReferenceOrientation( const SeedType& referenceSeed ) { auto referenceCornerIds = referenceSeed.getCornerIds(); for( LocalIndexType i = 0; i < referenceCornerIds.getSize(); i++ ) { tnlAssert( this->cornerIdsMap.find( referenceCornerIds[i]) == this->cornerIdsMap.end(), ); this->cornerIdsMap.insert( std::make_pair( referenceCornerIds[i], i ) ); } } static tnlString getType(){}; EntityOrientation createOrientation( const SeedType& seed ) const { EntityOrientation result; auto cornerIds = seed.getCornerIds(); for( LocalIndexType i = 0; i < cornerIds.getSize(); i++ ) { tnlAssert( this->cornerIdsMap.find( cornerIds[ i ] ) != this->cornerIdsMap.end(), ); result.setPermutationValue( i, this->cornerIdsMap.find( cornerIds[ i ])->second ); } return result; } private: std::map< GlobalIndexType, LocalIndexType > cornerIdsMap; }; #endif /* TNLMESHENTITYREFERENCEORIENTATION_H */