Loading src/functions/tnlOperatorFunction.h +2 −9 Original line number Diff line number Diff line Loading @@ -250,15 +250,8 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false bool deepRefresh( const RealType& time = 0.0 ) { //if( ! this->preimageFunction.deepRefresh( time ) ) // return false; OperatorFunction operatorFunction( this->operator_, this->preimageFunction ); if( !this->operator_.deepRefresh() || !operatorFunction.refresh( time ) ) return false; this->imageFunction = operatorFunction; tnlBoundaryConditionsSetter< ImageFunctionType, BoundaryConditionsType >::apply( this->boundaryConditions, time, this->imageFunction ); return true; return this->preimageFunction.deepRefresh( time ) && this->refresh( time ); }; template< typename MeshEntity > Loading src/operators/geometric/tnlCoFVMGradientNorm.h +24 −3 Original line number Diff line number Diff line Loading @@ -22,18 +22,39 @@ #include <operators/geometric/tnlExactGradientNorm.h> template< typename Mesh, int MeshEntityDimensions = Mesh::getMeshDimensions(), typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class tnlCoFVMGradientNorm { }; template< int MeshDimensions, typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshDimensions, Real, Index > : public tnlOperatorComposition< tnlMeshEntitiesInterpolants< > tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshInteriorDomain, MeshDimensions, MeshDimensions, Real, Index > { public: }; template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index > class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, 0, Real, Index > : public tnlDomain< 1, MeshInteriorDomain > { public: Loading Loading @@ -93,7 +114,7 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index > class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real, Index > : public tnlDomain< 2, MeshInteriorDomain > { public: Loading Loading @@ -211,7 +232,7 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index > class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real, Index > : public tnlDomain< 3, MeshInteriorDomain > { public: Loading src/operators/tnlOperatorComposition.h +2 −12 Original line number Diff line number Diff line Loading @@ -68,22 +68,12 @@ class tnlOperatorComposition bool refresh( const RealType& time = 0.0 ) { if( ! this->innerOperatorFunction.refresh( time ) ) return false; typename InnerOperatorFunction::ImageFunctionType imageFunction( this->innerOperatorFunction.getMesh() ); imageFunction = this->innerOperatorFunction; imageFunction.write( "innerFunction" ); return true; return this->innerOperatorFunction.refresh( time ); } bool deepRefresh( const RealType& time = 0.0 ) { if( ! this->innerOperatorFunction.deepRefresh( time ) ) return false; typename InnerOperatorFunction::ImageFunctionType imageFunction( this->innerOperatorFunction.getMesh() ); imageFunction = this->innerOperatorFunction; imageFunction.write( "innerFunction" ); return true; return this->innerOperatorFunction.deepRefresh( time ); } template< typename MeshFunction, typename MeshEntity > Loading tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h +4 −4 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class tnlCoFVMGradientNormTest { this->setupMesh( meshSize ); typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions()> DiscreteTestFunction; /*typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions()> DiscreteTestFunction; DiscreteTestFunction discreteTestFunction( this->mesh ); discreteTestFunction = this->function; Loading @@ -83,15 +83,15 @@ class tnlCoFVMGradientNormTest gradientNormOnFacesFunction = gradientNormOnFacesOperator; typedef tnlMeshEntitiesInterpolants< MeshType, MeshType::getMeshDimensions() - 1 , MeshType::getMeshDimensions() > Interpolant; Interpolant interpolant; Interpolant interpolant;*/ // TODOL udelat implementaci iterpolace pro operatory a specializaci pro mesh functions /*this->performTest( testOperator, this->performTest( testOperator, this->exactOperator, errors, write, verbose );*/ verbose ); } void runUnitTest() Loading tests/unit-tests/operators/tnlOperatorCompositionTest.h +7 −7 Original line number Diff line number Diff line Loading @@ -85,28 +85,28 @@ class tnlOperatorCompositionTest OperatorFunction2 operatorFunction2( operator_, boundaryConditions, operatorFunction1 ); operatorFunction2.deepRefresh(); f1 = testFunction; //f1 = testFunction; OperatorComposition operatorComposition( operator_, operator_, boundaryConditions, f1 ); //operatorComposition.refresh(); tnlOperatorFunction< OperatorComposition, MeshFunctionType, BoundaryConditions > operatorFunction3( operatorComposition, boundaryConditions, f1 ); operatorFunction3.deepRefresh(); f1 = testFunction; f1.write( "f0", "gnuplot" ); /*f1 = testFunction; f1.write( "testFunction", "gnuplot" ); f1 = operatorFunction1; f1.write( "f1", "gnuplot" ); f1.write( "operator1", "gnuplot" ); f1 = operatorFunction2; f1.write( "f2", "gnuplot" ); f1.write( "operator2", "gnuplot" ); f1 = operatorFunction3; f1.write( "f3", "gnuplot" ); f1.write( "operatorComposition", "gnuplot" ); */ //CPPUNIT_ASSERT( operatorFunction2 == operatorFunction3 ); for( IndexType i = 0; i < mesh.template getEntitiesCount< typename MeshType::Cell >(); i++ ) { auto entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); cerr << entity.getIndex() << " " << operatorFunction2( entity ) << " " << operatorFunction3( entity ) << endl; //cerr << entity.getIndex() << " " << operatorFunction2( entity ) << " " << operatorFunction3( entity ) << endl; CPPUNIT_ASSERT( operatorFunction2( entity ) == operatorFunction3( entity ) ); /*if( entity.isBoundaryEntity() ) CPPUNIT_ASSERT( boundaryConditions( f1, entity ) == operatorFunction( entity ) ); Loading Loading
src/functions/tnlOperatorFunction.h +2 −9 Original line number Diff line number Diff line Loading @@ -250,15 +250,8 @@ class tnlOperatorFunction< Operator, PreimageFunction, BoundaryConditions, false bool deepRefresh( const RealType& time = 0.0 ) { //if( ! this->preimageFunction.deepRefresh( time ) ) // return false; OperatorFunction operatorFunction( this->operator_, this->preimageFunction ); if( !this->operator_.deepRefresh() || !operatorFunction.refresh( time ) ) return false; this->imageFunction = operatorFunction; tnlBoundaryConditionsSetter< ImageFunctionType, BoundaryConditionsType >::apply( this->boundaryConditions, time, this->imageFunction ); return true; return this->preimageFunction.deepRefresh( time ) && this->refresh( time ); }; template< typename MeshEntity > Loading
src/operators/geometric/tnlCoFVMGradientNorm.h +24 −3 Original line number Diff line number Diff line Loading @@ -22,18 +22,39 @@ #include <operators/geometric/tnlExactGradientNorm.h> template< typename Mesh, int MeshEntityDimensions = Mesh::getMeshDimensions(), typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class tnlCoFVMGradientNorm { }; template< int MeshDimensions, typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshDimensions, Real, Index > : public tnlOperatorComposition< tnlMeshEntitiesInterpolants< > tnlGrid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshInteriorDomain, MeshDimensions, MeshDimensions, Real, Index > { public: }; template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index > class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, 0, Real, Index > : public tnlDomain< 1, MeshInteriorDomain > { public: Loading Loading @@ -93,7 +114,7 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index > class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, 1, Real, Index > : public tnlDomain< 2, MeshInteriorDomain > { public: Loading Loading @@ -211,7 +232,7 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index > class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, 2, Real, Index > : public tnlDomain< 3, MeshInteriorDomain > { public: Loading
src/operators/tnlOperatorComposition.h +2 −12 Original line number Diff line number Diff line Loading @@ -68,22 +68,12 @@ class tnlOperatorComposition bool refresh( const RealType& time = 0.0 ) { if( ! this->innerOperatorFunction.refresh( time ) ) return false; typename InnerOperatorFunction::ImageFunctionType imageFunction( this->innerOperatorFunction.getMesh() ); imageFunction = this->innerOperatorFunction; imageFunction.write( "innerFunction" ); return true; return this->innerOperatorFunction.refresh( time ); } bool deepRefresh( const RealType& time = 0.0 ) { if( ! this->innerOperatorFunction.deepRefresh( time ) ) return false; typename InnerOperatorFunction::ImageFunctionType imageFunction( this->innerOperatorFunction.getMesh() ); imageFunction = this->innerOperatorFunction; imageFunction.write( "innerFunction" ); return true; return this->innerOperatorFunction.deepRefresh( time ); } template< typename MeshFunction, typename MeshEntity > Loading
tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h +4 −4 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class tnlCoFVMGradientNormTest { this->setupMesh( meshSize ); typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions()> DiscreteTestFunction; /*typedef tnlMeshFunction< MeshType, MeshType::getMeshDimensions()> DiscreteTestFunction; DiscreteTestFunction discreteTestFunction( this->mesh ); discreteTestFunction = this->function; Loading @@ -83,15 +83,15 @@ class tnlCoFVMGradientNormTest gradientNormOnFacesFunction = gradientNormOnFacesOperator; typedef tnlMeshEntitiesInterpolants< MeshType, MeshType::getMeshDimensions() - 1 , MeshType::getMeshDimensions() > Interpolant; Interpolant interpolant; Interpolant interpolant;*/ // TODOL udelat implementaci iterpolace pro operatory a specializaci pro mesh functions /*this->performTest( testOperator, this->performTest( testOperator, this->exactOperator, errors, write, verbose );*/ verbose ); } void runUnitTest() Loading
tests/unit-tests/operators/tnlOperatorCompositionTest.h +7 −7 Original line number Diff line number Diff line Loading @@ -85,28 +85,28 @@ class tnlOperatorCompositionTest OperatorFunction2 operatorFunction2( operator_, boundaryConditions, operatorFunction1 ); operatorFunction2.deepRefresh(); f1 = testFunction; //f1 = testFunction; OperatorComposition operatorComposition( operator_, operator_, boundaryConditions, f1 ); //operatorComposition.refresh(); tnlOperatorFunction< OperatorComposition, MeshFunctionType, BoundaryConditions > operatorFunction3( operatorComposition, boundaryConditions, f1 ); operatorFunction3.deepRefresh(); f1 = testFunction; f1.write( "f0", "gnuplot" ); /*f1 = testFunction; f1.write( "testFunction", "gnuplot" ); f1 = operatorFunction1; f1.write( "f1", "gnuplot" ); f1.write( "operator1", "gnuplot" ); f1 = operatorFunction2; f1.write( "f2", "gnuplot" ); f1.write( "operator2", "gnuplot" ); f1 = operatorFunction3; f1.write( "f3", "gnuplot" ); f1.write( "operatorComposition", "gnuplot" ); */ //CPPUNIT_ASSERT( operatorFunction2 == operatorFunction3 ); for( IndexType i = 0; i < mesh.template getEntitiesCount< typename MeshType::Cell >(); i++ ) { auto entity = mesh.template getEntity< typename MeshType::Cell >( i ); entity.refresh(); cerr << entity.getIndex() << " " << operatorFunction2( entity ) << " " << operatorFunction3( entity ) << endl; //cerr << entity.getIndex() << " " << operatorFunction2( entity ) << " " << operatorFunction3( entity ) << endl; CPPUNIT_ASSERT( operatorFunction2( entity ) == operatorFunction3( entity ) ); /*if( entity.isBoundaryEntity() ) CPPUNIT_ASSERT( boundaryConditions( f1, entity ) == operatorFunction( entity ) ); Loading