diff --git a/src/mesh/initializer/tnlMeshEntityInitializer.h b/src/mesh/initializer/tnlMeshEntityInitializer.h index c8166d7fce93c4c0cac2f9c9fdf7aa8b8e845dbb..6d2fdd29e9ddb2bbb8a9c3cef8f149f20628859e 100644 --- a/src/mesh/initializer/tnlMeshEntityInitializer.h +++ b/src/mesh/initializer/tnlMeshEntityInitializer.h @@ -153,7 +153,7 @@ class tnlMeshEntityInitializerLayer< MeshConfig, typedef tnlMeshTraits< MeshConfig > MeshTraits; typedef typename MeshTraits:: template SubentityTraits< EntityTopology, Dimensions > SubentityTraits; typedef typename SubentityTraits::SubentityContainerType SubentityContainerType; - typedef typename SubentityTraits::SharedContainerType SharedContainerType; + typedef typename SubentityTraits::AccessArrayType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef tnlMeshInitializer< MeshConfig > InitializerType; @@ -210,7 +210,7 @@ class tnlMeshEntityInitializerLayer< MeshConfig, typedef tnlMeshSubentityTraits< MeshConfig, EntityTopology, DimensionsTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::SubentityContainerType SubentityContainerType; - typedef typename SubentitiesTraits::SharedContainerType SharedContainerType; + typedef typename SubentitiesTraits::AccessArrayType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef tnlMeshInitializer< MeshConfig > InitializerType; @@ -436,7 +436,7 @@ class tnlMeshEntityInitializerLayer< MeshConfig, EntityTopology, DimensionsTag::value > SubentitiesTraits; - typedef typename SubentitiesTraits::SharedContainerType SharedContainerType; + typedef typename SubentitiesTraits::AccessArrayType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef tnlMeshInitializer< MeshConfig > InitializerType; diff --git a/src/mesh/initializer/tnlMeshEntitySeed.h b/src/mesh/initializer/tnlMeshEntitySeed.h index 9eda53f8ec160abe422b453c2b029ade0be806da..d3e25036ece15c7d8cbb7e2101751cb77ce81d6c 100644 --- a/src/mesh/initializer/tnlMeshEntitySeed.h +++ b/src/mesh/initializer/tnlMeshEntitySeed.h @@ -31,7 +31,7 @@ class tnlMeshEntitySeed typedef typename tnlMeshTraits< MeshConfig >::GlobalIndexType GlobalIndexType; typedef typename tnlMeshTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename tnlMeshTraits< MeshConfig >::IdArrayAccessorType IdArrayAccessorType; - typedef typename SubvertexTraits::ContainerType IdArrayType; + typedef typename SubvertexTraits::IdArrayType IdArrayType; static tnlString getType() { return tnlString( "tnlMeshEntitySeed<>" ); } diff --git a/src/mesh/initializer/tnlMeshEntitySeedKey.h b/src/mesh/initializer/tnlMeshEntitySeedKey.h index f5445607eb4a36120a36126d06c1712cdb9ca86a..5220d8a3bd8632d56b45bb21bf0ed826a0880910 100644 --- a/src/mesh/initializer/tnlMeshEntitySeedKey.h +++ b/src/mesh/initializer/tnlMeshEntitySeedKey.h @@ -43,13 +43,13 @@ class tnlMeshEntitySeedKey typedef typename tnlMeshSubentityTraits< MeshConfig, EntityTopology, - 0 >::ContainerType ContainerType; + 0 >::StorageArrayType StorageArrayType; public: explicit tnlMeshEntitySeedKey( const EntitySeedType& entitySeed ) { - for( typename ContainerType::IndexType i = 0; + for( typename StorageArrayType::IndexType i = 0; i < entitySeed.getCornersCount(); i++ ) this->sortedCorners[ i ] = entitySeed.getCornerIds()[ i ]; @@ -58,8 +58,8 @@ class tnlMeshEntitySeedKey bool operator<( const tnlMeshEntitySeedKey& other ) const { - for( typename ContainerType::IndexType i = 0; - i < ContainerType::size; + for( typename StorageArrayType::IndexType i = 0; + i < StorageArrayType::size; i++) { if( sortedCorners[ i ] < other.sortedCorners[ i ] ) @@ -73,7 +73,7 @@ class tnlMeshEntitySeedKey private: - ContainerType sortedCorners; + StorageArrayType sortedCorners; }; diff --git a/src/mesh/initializer/tnlMeshInitializer.h b/src/mesh/initializer/tnlMeshInitializer.h index 435d40ad40079d08d8edf92cbaeb1c0450a56a69..1a34ab9339466eef13a3c3919571398af46f0996 100644 --- a/src/mesh/initializer/tnlMeshInitializer.h +++ b/src/mesh/initializer/tnlMeshInitializer.h @@ -93,21 +93,21 @@ class tnlMeshInitializer static typename tnlMeshTraits< MeshConfig >::template SubentityTraits< typename EntityType::EntityTopology, SubDimensionsTag::value >::IdArrayType& subentityIdsArray( EntityType& entity ) { - return entity.template subentityIdsArray< SubDimensionsTag >(); + return entity.template subentityIdsArray< SubDimensionsTag::value >(); } template< typename SuperDimensionsTag, typename MeshEntity> static typename tnlMeshTraits< MeshConfig >::IdArrayAccessorType& superentityIdsArray( MeshEntity& entity ) { - return entity.template superentityIdsArray< SuperDimensionsTag >(); + return entity.template superentityIdsArray< SuperDimensionsTag::value >(); } template<typename SubDimensionsTag, typename MeshEntity > static typename tnlMeshTraits< MeshConfig >::template SubentityTraits< typename MeshEntity::EntityTopology, SubDimensionsTag::value >::OrientationArrayType& subentityOrientationsArray( MeshEntity &entity ) { - return entity.template subentityOrientationsArray< SubDimensionsTag >(); + return entity.template subentityOrientationsArray< SubDimensionsTag::value >(); } template< typename DimensionsTag > diff --git a/src/mesh/tnlMeshEntity.h b/src/mesh/tnlMeshEntity.h index bc53200700914d9a7c3495fb72e59bdeddaacc2a..77abe1fcc3906a4f4b727e4bd5adea944b13977a 100644 --- a/src/mesh/tnlMeshEntity.h +++ b/src/mesh/tnlMeshEntity.h @@ -2,7 +2,7 @@ tnlMeshEntity.h - description ------------------- begin : Feb 11, 2014 - copyright : (C) 2014 by Tomas Oberhuber + copyright : (C) 2014 by Tomas Oberhuber et al. email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ @@ -29,6 +29,9 @@ #include <mesh/layers/tnlMeshSuperentityAccess.h> #include <mesh/initializer/tnlMeshEntitySeed.h> +template< typename MeshConfig > +class tnlMeshInitializer; + template< typename MeshConfig, typename EntityTopology_ > class tnlMeshEntity @@ -46,309 +49,108 @@ class tnlMeshEntity typedef typename MeshTraits::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; typedef tnlMeshEntitySeed< MeshConfig, EntityTopology > SeedType; - static const int Dimensions = EntityTopology::dimensions; - static const int MeshDimensions = MeshTraits::meshDimensions; - - - tnlMeshEntity( const SeedType& entitySeed ) - { - typedef typename SeedType::LocalIndexType LocalIndexType; - for( LocalIndexType i = 0; i < entitySeed.getCornerIds().getSize(); i++ ) - this->template setSubentityIndex< 0 >( i, entitySeed.getCornerIds()[ i ] ); - } - - tnlMeshEntity() {} - - static tnlString getType() - { - return tnlString( "tnlMesh< " ) + - //MeshConfig::getType() + ", " + - //EntityTopology::getType() + ", " + - " >"; - } - - tnlString getTypeVirtual() const - { - return this->getType(); - } - - /*~tnlMeshEntity() - { - cerr << " Destroying entity with " << EntityTopology::dimensions << " dimensions..." << endl; - }*/ - - bool save( tnlFile& file ) const - { - if( ! tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::save( file ) /*|| - ! tnlMeshSuperentityStorageLayers< MeshConfig, EntityTopology >::save( file )*/ ) - return false; - return true; - } - - bool load( tnlFile& file ) - { - if( ! tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::load( file ) /*|| - ! tnlMeshSuperentityStorageLayers< MeshConfig, EntityTopology >::load( file ) */ ) - return false; - return true; - } - - void print( ostream& str ) const - { - str << "\t Mesh entity dimensions: " << EntityTopology::dimensions << endl; - tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::print( str ); - tnlMeshSuperentityAccess< MeshConfig, EntityTopology >::print( str ); - } - - bool operator==( const tnlMeshEntity& entity ) const - { - return ( tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::operator==( entity ) && - tnlMeshSuperentityAccess< MeshConfig, EntityTopology >::operator==( entity ) && - tnlMeshEntityId< typename MeshConfig::IdType, - typename MeshConfig::GlobalIndexType >::operator==( entity ) ); - } - - /**** - * Subentities - */ - template< int SubDimensions > using SubentityTraits = - typename MeshTraits::template SubentityTraits< EntityTopology, SubDimensions >; + template< int Subdimensions > using SubentityTraits = + typename MeshTraits::template SubentityTraits< EntityTopology, Subdimensions >; - /*struct SubentityTraits - { - static_assert( Dimensions < meshDimensions, "Asking for subentities with more or the same number of dimensions then the mesh itself." ); - typedef tnlDimensionsTag< Dimensions > DimensionsTag; - typedef tnlMeshSubentityTraits< MeshConfig, - EntityTopology, - DimensionsTag::value > SubentityTraits; - typedef typename SubentityTraits::ContainerType ContainerType; - typedef typename SubentityTraits::SharedContainerType SharedContainerType; - typedef typename ContainerType::ElementType GlobalIndexType; - typedef int LocalIndexType; - - // TODO: make this as: - // typedef typename Type::IndexType LocalIndexType - //enum { available = tnlMeshSubentityStorage< MeshConfig, - // EntityTopology, - // Dimensions >::enabled }; - static const bool available = MeshConfig::template subentityStorage( EntityTopology(), Dimensions ); - enum { subentitiesCount = SubentityTraits::count }; - };*/ - - template< int SubDimensions > - bool subentitiesAvailable() const - { - return SubentityTraits< SubDimensions >::available; - }; - - template< int SubDimensions > - typename SubentityTraits< SubDimensions >::LocalIndexType getNumberOfSubentities() const - { - return SubentityTraits< SubDimensions >::count; - }; - - template< int SubDimensions > - void setSubentityIndex( const LocalIndexType localIndex, - const GlobalIndexType globalIndex ) - { - static_assert( SubentityTraits< SubDimensions >::storageEnabled, "You try to set subentity which is not configured for storage." ); - tnlAssert( 0 <= localIndex && - localIndex < SubentityTraits< SubDimensions >::count, - cerr << "localIndex = " << localIndex - << " subentitiesCount = " - << SubentityTraits< SubDimensions >::count ); - typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - SubentityBaseType::setSubentityIndex( tnlDimensionsTag< SubDimensions >(), - localIndex, - globalIndex ); - } - - template< int SubDimensions > - typename SubentityTraits< SubDimensions >::GlobalIndexType - getSubentityIndex( const typename SubentityTraits< SubDimensions >::LocalIndexType localIndex) const - { - static_assert( SubentityTraits< SubDimensions >::storageEnabled, "You try to get subentity which is not configured for storage." ); - tnlAssert( 0 <= localIndex && - localIndex < SubentityTraits< SubDimensions >::count, - cerr << "localIndex = " << localIndex - << " subentitiesCount = " - << SubentityTraits< SubDimensions >::count ); - typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - return SubentityBaseType::getSubentityIndex( tnlDimensionsTag< SubDimensions >(), - localIndex ); - } - - template< int SubDimensions > - typename SubentityTraits< SubDimensions >::SharedContainerType& - getSubentitiesIndices() - { - static_assert( SubentityTraits< SubDimensions >::storageEnabled, "You try to get subentities which are not configured for storage." ); - typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - return SubentityBaseType::getSubentitiesIndices( tnlDimensionsTag< SubDimensions >() ); - } - - template< int SubDimensions > - const typename SubentityTraits< SubDimensions >::SharedContainerType& - getSubentitiesIndices() const - { - static_assert( SubentityTraits< SubDimensions >::storageEnabled, "You try to set subentities which are not configured for storage." ); - typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - return SubentityBaseType::getSubentitiesIndices( tnlDimensionsTag< SubDimensions >() ); - } - - /**** - * Superentities - */ template< int SuperDimensions > using SuperentityTraits = typename MeshTraits::template SuperentityTraits< EntityTopology, SuperDimensions >; - /*struct SuperentityTraits - { - static_assert( Dimensions <= meshDimensions, "Asking for subentities with more dimensions then the mesh itself." ); - typedef tnlDimensionsTag< Dimensions > DimensionsTag; - typedef tnlMeshSuperentityTraits< MeshConfig, - EntityTopology, - Dimensions > SuperentityTraits; - typedef typename SuperentityTraits::ContainerType ContainerType; - typedef typename SuperentityTraits::SharedContainerType SharedContainerType; - typedef typename ContainerType::ElementType GlobalIndexType; - typedef int LocalIndexType; - // TODO: make this as: - // typedef typename Type::IndexType LocalIndexType - static const bool available = MeshConfig::template superentityStorage( EntityTopology(), Dimensions ); - };*/ - - /*template< int Dimensions > - bool setNumberOfSuperentities( const typename SuperentityTraits< Dimensions >::LocalIndexType size ) - { - static_assert( SuperentityTraits< Dimensions >::available, "You try to set number of superentities which are not configured for storage." ); - tnlAssert( size >= 0, - cerr << "size = " << size << endl; ); - typedef tnlMeshSuperentityStorageLayers< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::setNumberOfSuperentities( tnlDimensionsTag< Dimensions >(), - size ); - }*/ + tnlMeshEntity( const SeedType& entitySeed ); - template< int SuperDimensions > - typename SuperentityTraits< SuperDimensions >::LocalIndexType getNumberOfSuperentities() const - { - static_assert( SuperentityTraits< SuperDimensions >::available, "You try to get number of superentities which are not configured for storage." ); - typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::getNumberOfSuperentities( tnlDimensionsTag< SuperDimensions >() ); - } + tnlMeshEntity(); + + ~tnlMeshEntity(); + + static tnlString getType(); + + tnlString getTypeVirtual() const; + + bool save( tnlFile& file ) const; + + bool load( tnlFile& file ); + + void print( ostream& str ) const; + + bool operator==( const tnlMeshEntity& entity ) const; + + constexpr int getEntityDimensions() const; + + /**** + * Subentities + */ + template< int Subdimensions > + constexpr bool subentitiesAvailable() const; + + template< int Subdimensions > + constexpr LocalIndexType getNumberOfSubentities() const; + template< int Subdimensions > + GlobalIndexType getSubentityIndex( const LocalIndexType localIndex) const; + + template< int Subdimensions > + typename SubentityTraits< Subdimensions >::AccessArrayType& getSubentitiesIndices(); + + template< int Subdimensions > + const typename SubentityTraits< Subdimensions >::AccessArrayType& getSubentitiesIndices() const; + + /**** + * Superentities + */ template< int SuperDimensions > - void setSuperentityIndex( const LocalIndexType localIndex, - const GlobalIndexType globalIndex ) - { - static_assert( SuperentityTraits< SuperDimensions >::available, "You try to set superentity which is not configured for storage." ); - tnlAssert( localIndex < this->getNumberOfSuperentities< SuperDimensions >(), - cerr << " localIndex = " << localIndex - << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< Dimensions >() << endl; ); - typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - SuperentityBaseType::setSuperentityIndex( tnlDimensionsTag< Dimensions >(), - localIndex, - globalIndex ); - } + LocalIndexType getNumberOfSuperentities() const; template< int SuperDimensions > - typename SuperentityTraits< SuperDimensions >::GlobalIndexType - getSuperentityIndex( const typename SuperentityTraits< SuperDimensions >::LocalIndexType localIndex ) const - { - static_assert( SuperentityTraits< SuperDimensions >::available, "You try to get superentity which is not configured for storage." ); - tnlAssert( localIndex < this->getNumberOfSuperentities< SuperDimensions >(), - cerr << " localIndex = " << localIndex - << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< SuperDimensions >() << endl; ); - typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::getSuperentityIndex( tnlDimensionsTag< SuperDimensions >(), - localIndex ); - } + GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const; template< int SuperDimensions > - typename SuperentityTraits< SuperDimensions >::SharedContainerType& getSuperentitiesIndices() - { - static_assert( SuperentityTraits< SuperDimensions >::available, "You try to get superentities which are not configured for storage." ); - typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - //return SuperentityBaseType::getSuperentitiesIndices( tnlDimensionsTag< Dimensions >() ); - } + typename SuperentityTraits< SuperDimensions >::AccessArrayType& getSuperentitiesIndices(); template< int SuperDimensions > - const typename SuperentityTraits< SuperDimensions >::SharedContainerType& getSuperentitiesIndices() const - { - static_assert( SuperentityTraits< SuperDimensions >::available, "You try to get superentities which are not configured for storage." ); - typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::getSubentitiesIndices( tnlDimensionsTag< SuperDimensions >() ); - } + const typename SuperentityTraits< SuperDimensions >::AccessArrayType& getSuperentitiesIndices() const; /**** * Vertices */ - static const int verticesCount = SubentityTraits< 0 >::count; - typedef typename SubentityTraits< 0 >::ContainerType ContainerType; - typedef typename SubentityTraits< 0 >::SharedContainerType SharedContainerType; - //typedef typename SubentityTraits< 0 >::GlobalIndexType GlobalIndexType; - //typedef typename SubentityTraits< 0 >::LocalIndexType LocalIndexType; - - LocalIndexType getNumberOfVertices() const - { - return verticesCount; - } - - void setVertexIndex( const LocalIndexType localIndex, - const GlobalIndexType globalIndex ) - { - this->setSubentityIndex< 0 >( localIndex, globalIndex ); - } - - GlobalIndexType getVertexIndex( const LocalIndexType localIndex ) const - { - return this->getSubentityIndex< 0 >( localIndex ); - } - - SharedContainerType& getVerticesIndices() - { - return this->getSubentitiesIndices< 0 >(); - } - - const SharedContainerType& getVerticesIndices() const - { - return this->getSubentitiesIndices< 0 >(); - } - - template< int dim > - IdPermutationArrayAccessorType subentityOrientation( LocalIndexType index ) const - { - static const LocalIndexType subentitiesCount = tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, 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< MeshConfig, EntityTopology > SuperentityAccessBase; - typedef typename tnlMeshTraits< MeshConfig>::IdArrayAccessorType IdArrayAccessorType; - typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityStorageLayers; - - template< typename DimensionsTag > - typename tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::IdArrayType& subentityIdsArray() - { - return SubentityStorageLayers::subentityIdsArray( DimensionsTag() ); - } - - template<typename DimensionsTag > - IdArrayAccessorType& superentityIdsArray() - { - return SuperentityAccessBase::superentityIdsArray( DimensionsTag()); - } - - template< typename DimensionsTag > - typename tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::OrientationArrayType& subentityOrientationsArray() - { - return SubentityStorageLayers::subentityOrientationsArray( DimensionsTag() ); - } + constexpr LocalIndexType getNumberOfVertices() const; + + GlobalIndexType getVertexIndex( const LocalIndexType localIndex ) const; + + typename SubentityTraits< 0 >::AccessArrayType& getVerticesIndices(); + + const typename SubentityTraits< 0 >::AccessArrayType& getVerticesIndices() const; + + template< int Dimensions > + IdPermutationArrayAccessorType subentityOrientation( LocalIndexType index ) const; + + protected: + + /**** + * Methods for the mesh initialization + */ + typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityAccessBase; + typedef typename MeshTraits::IdArrayAccessorType IdArrayAccessorType; + typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityStorageLayers; + + template< int Subdimensions > + void setSubentityIndex( const LocalIndexType localIndex, + const GlobalIndexType globalIndex ); + + template< int Subdimensions > + typename SubentityTraits< Subdimensions >::IdArrayType& subentityIdsArray(); + + template< int Superdimensions > + IdArrayAccessorType& superentityIdsArray(); + + template< int Subdimensions > + typename SubentityTraits< Subdimensions >::OrientationArrayType& subentityOrientationsArray(); + + friend tnlMeshInitializer< MeshConfig >; }; +/**** + * Vertex entity specialization + */ template< typename MeshConfig > class tnlMeshEntity< MeshConfig, tnlMeshVertexTopology > : public tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology >, @@ -363,189 +165,62 @@ class tnlMeshEntity< MeshConfig, tnlMeshVertexTopology > typedef typename MeshTraits::LocalIndexType LocalIndexType; typedef typename MeshTraits::PointType PointType; typedef typename MeshTraits::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; - typedef tnlMeshEntitySeed< MeshConfig, EntityTopology > SeedType; - - static const int Dimensions = EntityTopology::dimensions; - static const int MeshDimensions = MeshTraits::meshDimensions; + typedef tnlMeshEntitySeed< MeshConfig, EntityTopology > SeedType; - /**** - * The entity typedefs - */ - /*typedef MeshConfig MeshMeshConfig; - typedef tnlMeshVertexTopology Tag; - typedef tnlMeshEntitySeed< MeshConfig, tnlMeshVertexTopology > SeedType; - typedef typename tnlMeshTraits< MeshConfig >::PointType PointType; - enum { dimensions = Tag::dimensions }; - enum { meshDimensions = tnlMeshTraits< MeshConfig >::meshDimensions };*/ + template< int SuperDimensions > using SuperentityTraits = + typename MeshTraits::template SuperentityTraits< EntityTopology, SuperDimensions >; - /*tnlMeshEntity( const SeedType & entytiSeed ) - { - typedef typename SeedType::LocalIndexType LocalIndexType; - for( LocalIndexType i = 0; i < entytiSeed.getCornerIds().getSize(); i++ ) - this->template setSubentityIndex< 0 >( i, entitySeed.getCornerIds()[ i ] ); - }*/ + static tnlString getType(); + tnlString getTypeVirtual() const; + ~tnlMeshEntity(); + + bool save( tnlFile& file ) const; + + bool load( tnlFile& file ); + + void print( ostream& str ) const; + + bool operator==( const tnlMeshEntity& entity ) const; - static tnlString getType() - { - return tnlString( "tnlMesh< " ) + - //MeshConfig::getType() + ", " + - //EntityTopology::getType() + ", " + - " >"; - } - - tnlString getTypeVirtual() const - { - return this->getType(); - } - - - /*~tnlMeshEntity() - { - cerr << " Destroying entity with " << tnlMeshVertexTopology::dimensions << " dimensions..." << endl; - }*/ - - bool save( tnlFile& file ) const - { - if( //! tnlMeshSuperentityStorageLayers< MeshConfig, tnlMeshVertexTopology >::save( file ) || - ! point.save( file ) ) - return false; - return true; - } - - bool load( tnlFile& file ) - { - if( //! tnlMeshSuperentityStorageLayers< MeshConfig, tnlMeshVertexTopology >::load( file ) || - ! point.load( file ) ) - return false; - return true; - } - - void print( ostream& str ) const - { - str << "\t Mesh entity dimensions: " << tnlMeshVertexTopology::dimensions << endl; - str << "\t Coordinates = ( " << point << " )"; - tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology >::print( str ); - } - - bool operator==( const tnlMeshEntity& entity ) const - { - return ( //tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology >::operator==( entity ) && - tnlMeshEntityId< typename MeshConfig::IdType, - typename MeshConfig::GlobalIndexType >::operator==( entity ) && - point == entity.point ); - - } - - /**** - * Superentities - */ - template< int SuperDimensions > using SuperentityTraits = - typename MeshTraits::template SuperentityTraits< EntityTopology, SuperDimensions >; - /*template< int Dimensions > - struct SuperentityTraits - { - typedef tnlDimensionsTag< Dimensions > DimensionsTag; - typedef tnlMeshSuperentityTraits< MeshConfig, - tnlMeshVertexTopology, - Dimensions > SuperentityTraits; - typedef typename SuperentityTraits::StorageArrayType StorageArrayType; - typedef typename SuperentityTraits::AccessArrayType AccessArrayType; - typedef typename SuperentityTraits::GlobalIndexType GlobalIndexType; - typedef int LocalIndexType; - - static const bool available = MeshConfig::template superentityStorage< tnlMeshVertexTopology >( Dimensions ); - };*/ - - /*template< int Dimensions > - bool setNumberOfSuperentities( const typename SuperentityTraits< Dimensions >::LocalIndexType size ) - { - tnlAssert( size >= 0, - cerr << "size = " << size << endl; ); - typedef tnlMeshSuperentityStorageLayers< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; - return SuperentityBaseType::setNumberOfSuperentities( tnlDimensionsTag< Dimensions >(), - size ); - }*/ - - template< int Dimensions > - typename SuperentityTraits< Dimensions >::LocalIndexType getNumberOfSuperentities() const - { - typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; - //return SuperentityBaseType::getNumberOfSuperentities( tnlDimensionsTag< Dimensions >() ); - } - - template< int Dimensions > - typename SuperentityTraits< Dimensions >::SharedContainerType& getSuperentitiesIndices() - { - typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; - //return SuperentityBaseType::getSuperentitiesIndices( tnlDimensionsTag< Dimensions >() ); - } - - template< int Dimensions > - const typename SuperentityTraits< Dimensions >::SharedContainerType& getSuperentitiesIndeces() const - { - typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; - //return SuperentityBaseType::getSubentitiesIndices( tnlDimensionsTag< Dimensions >() ); - } - - /*template< int Dimensions > - void setSuperentityIndex( const typename SuperentityTraits< Dimensions >::LocalIndexType localIndex, - const typename SuperentityTraits< Dimensions >::GlobalIndexType globalIndex ) - { - tnlAssert( localIndex < this->getNumberOfSuperentities< Dimensions >(), - cerr << " localIndex = " << localIndex - << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< Dimensions >() << endl; ); - typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; - SuperentityBaseType::setSuperentityIndex( tnlDimensionsTag< Dimensions >(), - localIndex, - globalIndex ); - }*/ - - template< int Dimensions > - typename SuperentityTraits< Dimensions >::GlobalIndexType - getSuperentityIndex( const typename SuperentityTraits< Dimensions >::LocalIndexType localIndex ) const - { - tnlAssert( localIndex < this->getNumberOfSuperentities< Dimensions >(), - cerr << " localIndex = " << localIndex - << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< Dimensions >() << endl; ); - typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; - /*return SuperentityBaseType::getSuperentityIndex( tnlDimensionsTag< Dimensions >(), - localIndex );*/ - } - - /**** - * Points - */ - PointType getPoint() const { return this->point; } - - void setPoint( const PointType& point ) { this->point = point; } + constexpr int getEntityDimensions() const; - protected: - PointType point; - - - // TODO: This is only for the mesh initializer, fix this - public: - typedef typename tnlMeshTraits< MeshConfig>::IdArrayAccessorType IdArrayAccessorType; - typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityAccessBase; + template< int Superdimensions > LocalIndexType getNumberOfSuperentities() const; + + template< int Superdimensions > + typename SuperentityTraits< Superdimensions >::AccessArrayType& getSuperentitiesIndices(); + + template< int Superdimensions > + const typename SuperentityTraits< Superdimensions >::AccessArrayType& getSuperentitiesIndeces() const; + + template< int Dimensions > + GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const; + + /**** + * Points + */ + PointType getPoint() const; + + void setPoint( const PointType& point ); + + protected: + + typedef typename MeshTraits::IdArrayAccessorType IdArrayAccessorType; + typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityAccessBase; - template<typename DimensionsTag > - IdArrayAccessorType& superentityIdsArray() - { - return SuperentityAccessBase::superentityIdsArray( DimensionsTag()); - } + template< int Superdimensions > + IdArrayAccessorType& superentityIdsArray(); + PointType point; + + friend tnlMeshInitializer< MeshConfig >; }; template< typename MeshConfig, typename EntityTopology > -ostream& operator <<( ostream& str, const tnlMeshEntity< MeshConfig, EntityTopology >& entity ) -{ - entity.print( str ); - return str; -} +ostream& operator <<( ostream& str, const tnlMeshEntity< MeshConfig, EntityTopology >& entity ); /**** * This tells the compiler that theMeshEntity is a type with a dynamic memory allocation. @@ -558,4 +233,6 @@ struct tnlDynamicTypeTag< tnlMeshEntity< MeshConfig, EntityTopology > > enum { value = true }; }; +#include <mesh/tnlMeshEntity_impl.h> + #endif /* TNLMESHENTITY_H_ */ diff --git a/src/mesh/tnlMeshEntity_impl.h b/src/mesh/tnlMeshEntity_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..8b58e02acaab3f8c75f2d1e1bfd256b8020d7db9 --- /dev/null +++ b/src/mesh/tnlMeshEntity_impl.h @@ -0,0 +1,499 @@ +/*************************************************************************** + tnlMeshEntity_impl.h - description + ------------------- + begin : Sep 8, 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 TNLMESHENTITY_IMPL_H +#define TNLMESHENTITY_IMPL_H + +#include "tnlMeshEntity.h" + + +template< typename MeshConfig, + typename EntityTopology > +tnlMeshEntity< MeshConfig, EntityTopology >:: +tnlMeshEntity( const SeedType& entitySeed ) +{ + typedef typename SeedType::LocalIndexType LocalIndexType; + for( LocalIndexType i = 0; i < entitySeed.getCornerIds().getSize(); i++ ) + this->template setSubentityIndex< 0 >( i, entitySeed.getCornerIds()[ i ] ); +} + + +template< typename MeshConfig, + typename EntityTopology > +tnlMeshEntity< MeshConfig, EntityTopology >:: +tnlMeshEntity() +{ +} + +template< typename MeshConfig, + typename EntityTopology > +tnlMeshEntity< MeshConfig, EntityTopology >:: +~tnlMeshEntity() +{ + //cerr << " Destroying entity with " << EntityTopology::dimensions << " dimensions..." << endl; +} + +template< typename MeshConfig, + typename EntityTopology > +tnlString +tnlMeshEntity< MeshConfig, EntityTopology >:: +getType() +{ + return tnlString( "tnlMesh< ... >" ); +} + +template< typename MeshConfig, + typename EntityTopology > +tnlString +tnlMeshEntity< MeshConfig, EntityTopology >:: +getTypeVirtual() const +{ + return this->getType(); +} + +template< typename MeshConfig, + typename EntityTopology > +bool +tnlMeshEntity< MeshConfig, EntityTopology >:: +save( tnlFile& file ) const +{ + if( ! tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::save( file ) /*|| + ! tnlMeshSuperentityStorageLayers< MeshConfig, EntityTopology >::save( file )*/ ) + return false; + return true; +} + +template< typename MeshConfig, + typename EntityTopology > +bool +tnlMeshEntity< MeshConfig, EntityTopology >:: +load( tnlFile& file ) +{ + if( ! tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::load( file ) /*|| + ! tnlMeshSuperentityStorageLayers< MeshConfig, EntityTopology >::load( file ) */ ) + return false; + return true; +} + +template< typename MeshConfig, + typename EntityTopology > +void +tnlMeshEntity< MeshConfig, EntityTopology >:: +print( ostream& str ) const +{ + str << "\t Mesh entity dimensions: " << EntityTopology::dimensions << endl; + tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::print( str ); + tnlMeshSuperentityAccess< MeshConfig, EntityTopology >::print( str ); +} + +template< typename MeshConfig, + typename EntityTopology > +bool +tnlMeshEntity< MeshConfig, EntityTopology >:: +operator==( const tnlMeshEntity& entity ) const +{ + return ( tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology >::operator==( entity ) && + tnlMeshSuperentityAccess< MeshConfig, EntityTopology >::operator==( entity ) && + tnlMeshEntityId< typename MeshConfig::IdType, + typename MeshConfig::GlobalIndexType >::operator==( entity ) ); +} + +template< typename MeshConfig, + typename EntityTopology > +constexpr int +tnlMeshEntity< MeshConfig, EntityTopology >:: +getEntityDimensions() const +{ + return EntityTopology::dimensions; +} + +/**** + * Subentities + */ +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +constexpr bool +tnlMeshEntity< MeshConfig, EntityTopology >:: +subentitiesAvailable() const +{ + return SubentityTraits< Subdimensions >::storageEnabled; +}; + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +constexpr typename tnlMeshEntity< MeshConfig, EntityTopology >::LocalIndexType +tnlMeshEntity< MeshConfig, EntityTopology >:: +getNumberOfSubentities() const +{ + return SubentityTraits< Subdimensions >::count; +}; + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::GlobalIndexType +tnlMeshEntity< MeshConfig, EntityTopology >:: +getSubentityIndex( const LocalIndexType localIndex) const +{ + static_assert( SubentityTraits< Subdimensions >::storageEnabled, "You try to get subentity which is not configured for storage." ); + tnlAssert( 0 <= localIndex && + localIndex < SubentityTraits< Subdimensions >::count, + cerr << "localIndex = " << localIndex + << " subentitiesCount = " + << SubentityTraits< Subdimensions >::count ); + typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; + return SubentityBaseType::getSubentityIndex( tnlDimensionsTag< Subdimensions >(), + localIndex ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< Subdimensions >::AccessArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: + getSubentitiesIndices() +{ + static_assert( SubentityTraits< Subdimensions >::storageEnabled, "You try to get subentities which are not configured for storage." ); + typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; + return SubentityBaseType::getSubentitiesIndices( tnlDimensionsTag< Subdimensions >() ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +const typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< Subdimensions >::AccessArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +getSubentitiesIndices() const +{ + static_assert( SubentityTraits< Subdimensions >::storageEnabled, "You try to set subentities which are not configured for storage." ); + typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; + return SubentityBaseType::getSubentitiesIndices( tnlDimensionsTag< Subdimensions >() ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int SuperDimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::LocalIndexType +tnlMeshEntity< MeshConfig, EntityTopology >:: +getNumberOfSuperentities() const +{ + static_assert( SuperentityTraits< SuperDimensions >::available, "You try to get number of superentities which are not configured for storage." ); + typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; + return SuperentityBaseType::getNumberOfSuperentities( tnlDimensionsTag< SuperDimensions >() ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int SuperDimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::GlobalIndexType +tnlMeshEntity< MeshConfig, EntityTopology >:: +getSuperentityIndex( const LocalIndexType localIndex ) const +{ + static_assert( SuperentityTraits< SuperDimensions >::storageEnabled, "You try to get superentity which is not configured for storage." ); + tnlAssert( localIndex < this->getNumberOfSuperentities< SuperDimensions >(), + cerr << " localIndex = " << localIndex + << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< SuperDimensions >() << endl; ); + typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; + return SuperentityBaseType::getSuperentityIndex( tnlDimensionsTag< SuperDimensions >(), + localIndex ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int SuperDimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimensions >::AccessArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +getSuperentitiesIndices() +{ + static_assert( SuperentityTraits< SuperDimensions >::storageEnabled, "You try to get superentities which are not configured for storage." ); + typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; + //return SuperentityBaseType::getSuperentitiesIndices( tnlDimensionsTag< Dimensions >() ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int SuperDimensions > +const typename tnlMeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimensions >::AccessArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +getSuperentitiesIndices() const +{ + static_assert( SuperentityTraits< SuperDimensions >::storageEnabled, "You try to get superentities which are not configured for storage." ); + typedef tnlMeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; + return SuperentityBaseType::getSubentitiesIndices( tnlDimensionsTag< SuperDimensions >() ); +} + +template< typename MeshConfig, + typename EntityTopology > +constexpr typename tnlMeshEntity< MeshConfig, EntityTopology >::LocalIndexType +tnlMeshEntity< MeshConfig, EntityTopology >:: +getNumberOfVertices() const +{ + return SubentityTraits< 0 >::count; +} + +template< typename MeshConfig, + typename EntityTopology > +typename tnlMeshEntity< MeshConfig, EntityTopology >::GlobalIndexType +tnlMeshEntity< MeshConfig, EntityTopology >:: +getVertexIndex( const LocalIndexType localIndex ) const +{ + return this->getSubentityIndex< 0 >( localIndex ); +} + +template< typename MeshConfig, + typename EntityTopology > +typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< 0 >::AccessArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +getVerticesIndices() +{ + return this->getSubentitiesIndices< 0 >(); +} + +template< typename MeshConfig, + typename EntityTopology > +const typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< 0 >::AccessArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +getVerticesIndices() const +{ + return this->getSubentitiesIndices< 0 >(); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int Dimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::IdPermutationArrayAccessorType +tnlMeshEntity< MeshConfig, EntityTopology >:: +subentityOrientation( LocalIndexType index ) const +{ + static const LocalIndexType subentitiesCount = SubentityTraits< Dimensions >::count; + tnlAssert( 0 <= index && index < subentitiesCount, ); + + return SubentityStorageLayers::subentityOrientation( tnlDimensionsTag< Dimensions >(), index ); +} + +/**** + * Mesh initialization method + */ + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +void +tnlMeshEntity< MeshConfig, EntityTopology >:: +setSubentityIndex( const LocalIndexType localIndex, + const GlobalIndexType globalIndex ) +{ + static_assert( SubentityTraits< Subdimensions >::storageEnabled, "You try to set subentity which is not configured for storage." ); + tnlAssert( 0 <= localIndex && + localIndex < SubentityTraits< Subdimensions >::count, + cerr << "localIndex = " << localIndex + << " subentitiesCount = " + << SubentityTraits< Subdimensions >::count ); + typedef tnlMeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; + SubentityBaseType::setSubentityIndex( tnlDimensionsTag< Subdimensions >(), + localIndex, + globalIndex ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< Subdimensions >::IdArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +subentityIdsArray() +{ + return SubentityStorageLayers::subentityIdsArray( tnlDimensionsTag< Subdimensions >() ); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int Superdimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::IdArrayAccessorType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +superentityIdsArray() +{ + return SuperentityAccessBase::superentityIdsArray( tnlDimensionsTag< Superdimensions >()); +} + +template< typename MeshConfig, + typename EntityTopology > + template< int Subdimensions > +typename tnlMeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< Subdimensions >::OrientationArrayType& +tnlMeshEntity< MeshConfig, EntityTopology >:: +subentityOrientationsArray() +{ + return SubentityStorageLayers::subentityOrientationsArray( tnlDimensionsTag< Subdimensions >() ); +} + +/**** + * Vertex entity specialization + */ +template< typename MeshConfig > +tnlString +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getType() +{ + return tnlString( "tnlMesh< ... >" ); +} + +template< typename MeshConfig > +tnlString +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getTypeVirtual() const +{ + return this->getType(); +} + +template< typename MeshConfig > +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +~tnlMeshEntity() +{ + //cerr << " Destroying entity with " << tnlMeshVertexTopology::dimensions << " dimensions..." << endl; +} + +template< typename MeshConfig > +bool +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +save( tnlFile& file ) const +{ + if( //! tnlMeshSuperentityStorageLayers< MeshConfig, tnlMeshVertexTopology >::save( file ) || + ! point.save( file ) ) + return false; + return true; +} + +template< typename MeshConfig > +bool +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +load( tnlFile& file ) +{ + if( //! tnlMeshSuperentityStorageLayers< MeshConfig, tnlMeshVertexTopology >::load( file ) || + ! point.load( file ) ) + return false; + return true; +} + +template< typename MeshConfig > +void +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +print( ostream& str ) const +{ + str << "\t Mesh entity dimensions: " << tnlMeshVertexTopology::dimensions << endl; + str << "\t Coordinates = ( " << point << " )"; + tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology >::print( str ); +} + +template< typename MeshConfig > +bool +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +operator==( const tnlMeshEntity& entity ) const +{ + return ( //tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology >::operator==( entity ) && + tnlMeshEntityId< typename MeshConfig::IdType, + typename MeshConfig::GlobalIndexType >::operator==( entity ) && + point == entity.point ); +} + +template< typename MeshConfig > +constexpr int +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getEntityDimensions() const +{ + return EntityTopology::dimensions; +} + +template< typename MeshConfig > + template< int Superdimensions > +typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::LocalIndexType +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getNumberOfSuperentities() const +{ + typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; + return SuperentityBaseType::getNumberOfSuperentities( tnlDimensionsTag< Superdimensions >() ); +} + +template< typename MeshConfig > + template< int Superdimensions > +typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::template SuperentityTraits< Superdimensions >::AccessArrayType& +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getSuperentitiesIndices() +{ + typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; + return SuperentityBaseType::getSuperentitiesIndices( tnlDimensionsTag< Superdimensions >() ); +} + +template< typename MeshConfig > + template< int Superdimensions > +const typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::template SuperentityTraits< Superdimensions >::AccessArrayType& +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getSuperentitiesIndeces() const +{ + typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; + return SuperentityBaseType::getSubentitiesIndices( tnlDimensionsTag< Superdimensions >() ); +} + +template< typename MeshConfig > + template< int Dimensions > +typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::GlobalIndexType +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getSuperentityIndex( const LocalIndexType localIndex ) const +{ + tnlAssert( localIndex < this->getNumberOfSuperentities< Dimensions >(), + cerr << " localIndex = " << localIndex + << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< Dimensions >() << endl; ); + typedef tnlMeshSuperentityAccess< MeshConfig, tnlMeshVertexTopology > SuperentityBaseType; + return SuperentityBaseType::getSuperentityIndex( tnlDimensionsTag< Dimensions >(), + localIndex ); +} + +template< typename MeshConfig > +typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::PointType +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +getPoint() const +{ + return this->point; +} + +template< typename MeshConfig > +void +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +setPoint( const PointType& point ) +{ + this->point = point; +} + +template< typename MeshConfig > + template< int Superdimensions > +typename tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >::MeshTraits::IdArrayAccessorType& +tnlMeshEntity< MeshConfig, tnlMeshVertexTopology >:: +superentityIdsArray() +{ + return SuperentityAccessBase::superentityIdsArray( tnlDimensionsTag< Superdimensions >()); +} + +template< typename MeshConfig, + typename EntityTopology > +ostream& operator <<( ostream& str, const tnlMeshEntity< MeshConfig, EntityTopology >& entity ) +{ + entity.print( str ); + return str; +} + +#endif /* TNLMESHENTITY_IMPL_H */ + diff --git a/src/mesh/traits/tnlMeshSubentityTraits.h b/src/mesh/traits/tnlMeshSubentityTraits.h index 8a017ae567c87b3c62ede632ea9800bef856652e..d23c19c69dde59a23afad7ebef5c5e5070dd185c 100644 --- a/src/mesh/traits/tnlMeshSubentityTraits.h +++ b/src/mesh/traits/tnlMeshSubentityTraits.h @@ -47,10 +47,10 @@ class tnlMeshSubentityTraits static const int count = Subtopology::count; - typedef tnlStaticArray< count, GlobalIndexType > ContainerType; + typedef tnlStaticArray< count, GlobalIndexType > StorageArrayType; typedef tnlSharedArray< GlobalIndexType, tnlHost, - LocalIndexType > SharedContainerType; + LocalIndexType > AccessArrayType; typedef tnlStaticArray< count, GlobalIndexType > IdArrayType; typedef tnlStaticArray< count, SubentityType > SubentityContainerType; typedef tnlStaticArray< count, Seed > SeedArrayType; diff --git a/tests/unit-tests/mesh/CMakeLists.txt b/tests/unit-tests/mesh/CMakeLists.txt index 8a806acdfe3ac0bb351a4cc3b80235d733a5b206..d5f357e079b73fd2a5223c1e444fa44a0689b722 100755 --- a/tests/unit-tests/mesh/CMakeLists.txt +++ b/tests/unit-tests/mesh/CMakeLists.txt @@ -6,9 +6,9 @@ ADD_EXECUTABLE( tnlGridTest${mpiExt}${debugExt} ${headers} tnlGridTest.cpp ) TARGET_LINK_LIBRARIES( tnlGridTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES} tnl${mpiExt}${debugExt}-0.1 ) -ADD_EXECUTABLE( tnlMeshEntityTest${mpiExt}${debugExt} ${headers} tnlMeshEntityTest.cpp ) -TARGET_LINK_LIBRARIES( tnlMeshEntityTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES} - tnl${mpiExt}${debugExt}-0.1 ) +#ADD_EXECUTABLE( tnlMeshEntityTest${mpiExt}${debugExt} ${headers} tnlMeshEntityTest.cpp ) +#TARGET_LINK_LIBRARIES( tnlMeshEntityTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES} +# tnl${mpiExt}${debugExt}-0.1 ) ADD_EXECUTABLE( tnlMeshTest${mpiExt}${debugExt} ${headers} tnlMeshTest.cpp ) TARGET_LINK_LIBRARIES( tnlMeshTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}