Commit c88de206 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Inserting the Ellpack network to the mesh.

parent 1dbe4587
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ tnlString tnlEllpackMatrix< Real, Device, Index > :: getType()
          tnlString( ::getType< Real >() ) +
          tnlString( ", " ) +
          Device :: getDeviceType() +
          tnlString( ", " ) +
          tnlString( ::getType< Index >() ) +          
          tnlString( " >" );
}

+23 −0
Original line number Diff line number Diff line
@@ -55,18 +55,37 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
	typedef tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement > BaseType;

   public:
      
      typedef tnlMeshTraits< MeshConfig >                                   MeshTraits;
      typedef typename MeshTraits::template SuperentityTraits< MeshEntity, Dimensions > SuperentityTraits;
      typedef typename SuperentityTraits::SuperentityAccessorType               SuperentityAccessorType;
	   typedef typename tnlMeshTraits< MeshConfig >::IdArrayAccessorType    IdArrayAccessorType;
      

	   using BaseType::superentityIds;
	   IdArrayAccessorType superentityIds( Dimensions ) const { return m_superentityIndices; }

	   using BaseType::superentityIdsArray;
	   IdArrayAccessorType &superentityIdsArray( Dimensions ) { return m_superentityIndices; }
      
      using BaseType::getSuperentityIndices;
      const SuperentityAccessorType& getSuperentityIndices( Dimensions ) const
      {
         return this->superentityIndices;
      }
      
      SuperentityAccessorType& getSuperentityIndices( Dimensions )
      {
         return this->superentityIndices;
      }

      
      //bool operator == ( const tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, Dimensions, tnlStorageTraits< true > >& l ) { return true; } // TODO: fix

   private:
	   IdArrayAccessorType m_superentityIndices;
      
      SuperentityAccessorType superentityIndices;
};

template< typename MeshConfig,
@@ -93,6 +112,8 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
       */
	   void superentityIds()      {}
	   void superentityIdsArray() {}
      
      void getSuperentityIndices() {};
};

template< typename MeshConfig,
@@ -108,6 +129,8 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
       */
	   void superentityIds()      {}
	   void superentityIdsArray() {}
      
      void getSuperentityIndices() {};
};


+65 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlMeshSuperentityAccessor.h  -  description
                             -------------------
    begin                : Sep 11, 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 TNLMESHSUPERENTITYACCESSOR_H
#define	TNLMESHSUPERENTITYACCESSOR_H

template< typename NetworkPorts >
class tnlMeshSuperentityAccessor
{
   public:
      
      typedef typename NetworkPorts::IndexType   GlobalIndexType;
      typedef typename NetworkPorts::IndexType   LocalIndexType;
      
      // TODO: Add LocalIndexType to EllpackNetwork
           
      LocalIndexType getSupernetitiesCount() const
      {
         return this->ports.getPortsCount();
      };
      
      void setSuperentityIndex( const LocalIndexType localIndex,
                                const GlobalIndexType globalIndex )
      {
         ports.setOutput( localIndex, globalIndex );
      }
      
      GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const
      {
         return ports.getOutput( localIndex );
      }
      
      GlobalIndexType& operator[]( const LocalIndexType localIndex )
      {
         return this->ports[ localIndex ];
      }
      
      const GlobalIndexType& operator[]( const LocalIndexType localIndex ) const
      {
         return this->ports[ localIndex ];
      }
      
   protected:
      
      NetworkPorts ports;
      
};


#endif	/* TNLMESHSUPERENTITYACCESSOR_H */
+32 −5
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
                          tnlMeshSuperentityStorageLayer.h  -  description
                             -------------------
    begin                : Feb 13, 2014
    copyright            : (C) 2014 by Tomas Oberhuber
    copyright            : (C) 2014 by Tomas Oberhuber et al.
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

@@ -48,8 +48,9 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag,
   typedef
      tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionsTag::Decrement >  BaseType;

   typedef
      tnlMeshSuperentityTraits< MeshConfig, EntityTopology, DimensionsTag::value >            SuperentityTraits;
   static const int Dimensions = DimensionsTag::value;
   typedef tnlMeshTraits< MeshConfig >                                                   MeshTraits;
   typedef typename MeshTraits::template SuperentityTraits< EntityTopology, Dimensions > SuperentityTraits;

   protected:

@@ -58,6 +59,8 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag,
   typedef typename SuperentityTraits::GlobalIndexType        GlobalIndexType;
   typedef typename SuperentityTraits::LocalIndexType         LocalIndexType;

   typedef typename SuperentityTraits::StorageNetworkType   StorageNetworkType;
   
   /****
     * Make visible setters and getters of the lower superentities
     */
@@ -169,6 +172,8 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag,

    AccessArrayType sharedSuperentitiesIndices;
    
    StorageNetworkType storageNetwork;
    
   // TODO: this is only for the mesh initializer - fix it
   public:
              
@@ -177,6 +182,12 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag,
      {
         return this->superentitiesIndices;
      }
      
      using BaseType::getStorageNetwork;
      StorageNetworkType& getStorageNetwork( DimensionsTag )
      {
         return this->storageNetwork;
      }
};

template< typename MeshConfig,
@@ -209,6 +220,8 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, tnlDimensionsT
   typedef typename ContainerType::ElementType                 GlobalIndexType;
   typedef int                                                 LocalIndexType;

   typedef typename SuperentityTraits::StorageNetworkType   StorageNetworkType;
   
   /****
    * These methods are due to 'using BaseType::...;' in the derived classes.
    */
@@ -242,12 +255,18 @@ class tnlMeshSuperentityStorageLayer< MeshConfig, EntityTopology, tnlDimensionsT
      return true;
   }
   
   template< typename SuperDimensionsTag >
   typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag )
   {
      tnlAssert( false, );
      //return this->superentitiesIndices;
   }

   StorageNetworkType& getStorageNetwork( DimensionsTag )
   {
      tnlAssert( false, );
     //return this->storageNetwork;
   }

};

template< typename MeshConfig,
@@ -274,6 +293,8 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
   typedef typename SuperentityTraits::GlobalIndexType               GlobalIndexType;
   typedef typename SuperentityTraits::LocalIndexType                LocalIndexType;

   typedef typename SuperentityTraits::StorageNetworkType   StorageNetworkType;
   
   /****
    * These methods are due to 'using BaseType::...;' in the derived classes.
    */
@@ -307,13 +328,19 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
      return true;
   }
   
   template< typename SuperDimensionsTag >
   typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag )
   {
      tnlAssert( false, );
      //return this->superentitiesIndices;
   }

   StorageNetworkType& getStorageNetwork( DimensionsTag )
   {
      tnlAssert( false, );
      //return this->storageNetwork;
   }

   
};

#endif /* TNLMESHSUPERENTITYSTORAGELAYER_H_ */
+5 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <mesh/config/tnlMeshConfigBase.h>
#include <mesh/topologies/tnlMeshEntityTopology.h>
#include <mesh/traits/tnlMeshEntityTraits.h>
#include <networks/tnlEllpackNetwork.h>

template< typename MeshConfig,
          typename EntityTopology,
@@ -50,6 +51,9 @@ class tnlMeshSuperentityTraits
    */
   typedef tnlArray< GlobalIndexType, tnlHost, LocalIndexType >             StorageArrayType;
   
   typedef tnlEllpackNetwork< GlobalIndexType, tnlHost >                        StorageNetworkType;
   typedef tnlMeshSuperentityAccessor< typename StorageNetworkType::PortsType > SuperentityAccessorType;
   
   /****
    * Type for passing the superentities indecis by the getSuperentitiesIndices()
    * method. We introduce it because of the compatibility with the subentities
Loading