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

Refactoring operator composition.

parent 1276374e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ class tnlMeshFunction :
                 const Vector& data,
                 const IndexType& offset = 0 );
      
      void setMesh( const MeshType& mesh ) const;      
      void setMesh( const MeshType& mesh );
      
      const MeshType& getMesh() const;
      
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ template< typename Mesh,
          typename Real >
void
tnlMeshFunction< Mesh, MeshEntityDimensions, Real >::
setMesh( const MeshType& mesh ) const
setMesh( const MeshType& mesh )
{
   this->mesh = &mesh;
}
+14 −10
Original line number Diff line number Diff line
@@ -143,12 +143,12 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
      
      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };     
      
      tnlOperatorFunction( const OperatorType& operator_,
      tnlOperatorFunction( OperatorType& operator_,
                           const MeshType& mesh )
      :  operator_( operator_ ), imageFunction( mesh )
      {};
      
      tnlOperatorFunction( const OperatorType& operator_,
      tnlOperatorFunction( OperatorType& operator_,
                           PreimageFunctionType& preimageFunction )
      :  operator_( operator_ ), imageFunction( preimageFunction.getMesh() ), preimageFunction( &preimageFunction )
      {};
@@ -159,15 +159,21 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
      
      const ImageFunctionType& getImageFunction() const { return this->imageFunction; };
      
      void setPreimageFunction( const PreimageFunction& preimageFunction )
      void setPreimageFunction( PreimageFunction& preimageFunction )
      { 
         this->preimageFunction = &preimageFunction;
         this->imageFunction.setMesh( preimageFunction.getMesh() );
      };
      
      const PreimageFunctionType& getPreimageFunction() const { return *this->preimageFunction; };

      bool refresh( const RealType& time = 0.0 )
      {
         OperatorFunction operatorFunction( this->operator_, *preimageFunction );         
         this->operator_.setPreimageFunction( *this->preimageFunction );
         if( ! this->operator_.refresh( time ) ||
             ! operatorFunction.refresh( time )  )
             return false;
         this->imageFunction = operatorFunction;
         return true;
      };
@@ -176,9 +182,7 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
      {
         if( ! this->preimageFunction->deepRefresh( time ) )
            return false;
         OperatorFunction operatorFunction( this->operator_, preimageFunction );
         this->imageFunction = operatorFunction;
         return true;
         return this->refresh( time );
      };
      
      template< typename MeshEntity >
@@ -191,14 +195,14 @@ class tnlOperatorFunction< Operator, PreimageFunction, void, false >
      }
      
      __cuda_callable__
      RealType operator[]( const IndexType& index )
      RealType operator[]( const IndexType& index ) const
      {
         return imageFunction[ index ];
      }
      
   protected:
      
      const Operator& operator_;
      Operator& operator_;
      
      PreimageFunctionType* preimageFunction;
      
+2 −2
Original line number Diff line number Diff line
@@ -264,8 +264,8 @@ class tnlNeighbourGridEntityGetter<
              cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                   << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                   << " EntityDimensions = " << EntityDimensions );
         tnlAssert( entity.getCoordinates().x() + step >= CoordinatesType( 0 ) &&
                    entity.getCoordinates().x() + step <= entity.getMesh().getDimensions(),
         tnlAssert( entity.getCoordinates().x() + step >= CoordinatesType( 0 ).x() &&
                    entity.getCoordinates().x() + step <= entity.getMesh().getDimensions().x(),
              cerr << "entity.getCoordinates() = " << entity.getCoordinates()
                   << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
                   << " EntityDimensions = " << EntityDimensions );
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
                              const MeshEntity& entity,
                              const RealType& time = 0.0 ) const
      {
         static_assert( MeshFunction::getMeshEntityDimensions() == Dimensions,
         static_assert( MeshFunction::getEntitiesDimensions() == Dimensions,
            "Finite differences can be evaluate only on mesh cells, i.e. the dimensions count of the mesh entities of mesh function must be the same as mesh dimensions count." );
         const int XDirection = -1 * ( XDifference != 0 );
         const int YDirection = -1 * ( YDifference != 0 );
Loading