Loading src/core/tnlString.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -446,6 +446,11 @@ int tnlString :: parse( tnlList< tnlString >& list, const char separator ) const return list. getSize(); } tnlString operator + ( const char* string1, const tnlString& string2 ) { return tnlString( string1 ) + string2; } ostream& operator << ( ostream& stream, const tnlString& str ) { stream << str. getString(); Loading src/core/tnlString.h +2 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,8 @@ class tnlString friend ostream& operator << ( ostream& stream, const tnlString& str ); }; tnlString operator + ( const char* string1, const tnlString& string2 ); ostream& operator << ( ostream& stream, const tnlString& str ); template< typename T > Loading src/functions/tnlMeshFunctionNormGetter.h +65 −13 Original line number Diff line number Diff line Loading @@ -24,24 +24,32 @@ class tnlMeshFunctionNormGetter { }; template< typename MeshFunction, int Dimensions, /*** * Specialization for grids * TODO: implement this even for other devices */ template< int Dimensions, typename MeshReal, typename Device, typename MeshIndex > class tnlMeshFunctionNormGetter< MeshFunction, tnlGrid< Dimensions, MeshReal, Device, MeshIndex > > typename MeshIndex, int EntityDimensions > class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex >, EntityDimensions >, tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex > > { public: typedef MeshFunction MeshFunctionType; typedef tnlGrid< Dimensions, MeshReal, Device, MeshIndex > GridType; typedef tnlMeshFunction< tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex >, EntityDimensions > MeshFunctionType; typedef tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex > GridType; typedef MeshReal MeshRealType; typedef Device DeviceType; typedef tnlHost DeviceType; typedef MeshIndex MeshIndexType; typedef typename MeshFunctionType::RealType RealType; typedef typename MeshFunctionType::MeshType MeshType; typedef typename MeshType::Face EntityType; static RealType getNorm( const MeshFunction& function, static RealType getNorm( const MeshFunctionType& function, const RealType& p ) { if( EntityDimensions == Dimensions ) { if( p == 1.0 ) return function.getMesh().getCellMeasure() * function.getData().lpNorm( 1.0 ); Loading @@ -49,6 +57,50 @@ class tnlMeshFunctionNormGetter< MeshFunction, tnlGrid< Dimensions, MeshReal, De return sqrt( function.getMesh().getCellMeasure() ) * function.getData().lpNorm( 2.0 ); return pow( function.getMesh().getCellMeasure(), 1.0 / p ) * function.getData().lpNorm( p ); } if( EntityDimensions > 0 ) { if( p == 1.0 ) { RealType result( 0.0 ); for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) { EntityType entity = function.getMesh().template getEntity< EntityType >( i ); result += fabs( function[ i ] ) * entity.getMeasure(); } return result; } if( p == 2.0 ) { RealType result( 0.0 ); for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) { EntityType entity = function.getMesh().template getEntity< EntityType >( i ); result += function[ i ] * function[ i ] * entity.getMeasure(); } return sqrt( result ); } RealType result( 0.0 ); for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) { EntityType entity = function.getMesh().template getEntity< EntityType >( i ); result += pow( fabs( function[ i ] ), p ) * entity.getMeasure(); } return pow( result, 1.0 / p ); } if( p == 1.0 ) return function.getData().lpNorm( 1.0 ); if( p == 2.0 ) return function.getData().lpNorm( 2.0 ); return function.getData().lpNorm( p ); } }; #endif /* TNLMESHFUNCTIONNORMGETTER_H */ Loading src/mesh/grids/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ SET( headers tnlBoundaryGridEntityChecker.h tnlGridEntityCenterGetter.h tnlGridEntityGetter.h tnlGridEntityGetter_impl.h tnlGridEntityMeasureGetter.h tnlNeighbourGridEntityGetter.h tnlNeighbourGridEntityGetter1D_impl.h tnlNeighbourGridEntityGetter2D_impl.h Loading src/mesh/grids/tnlGrid1D.h +8 −2 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject using MeshEntity = tnlGridEntity< ThisType, EntityDimensions, Config >; typedef MeshEntity< meshDimensions, tnlGridEntityCrossStencilStorage< 1 > > Cell; typedef MeshEntity< 0 > Face; typedef MeshEntity< 0 > Vertex; static constexpr int getDimensionsCount() { return meshDimensions; }; Loading Loading @@ -91,6 +92,13 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject __cuda_callable__ inline Index getEntityIndex( const EntityType& entity ) const; template< typename EntityType > __cuda_callable__ RealType getEntityMeasure( const EntityType& entity ) const; __cuda_callable__ RealType getCellMeasure() const; __cuda_callable__ inline VertexType getSpaceSteps() const; Loading @@ -101,8 +109,6 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject __cuda_callable__ inline RealType getSmallestSpaceStep() const; __cuda_callable__ RealType getCellMeasure() const; template< typename GridFunction > typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1, Loading Loading
src/core/tnlString.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -446,6 +446,11 @@ int tnlString :: parse( tnlList< tnlString >& list, const char separator ) const return list. getSize(); } tnlString operator + ( const char* string1, const tnlString& string2 ) { return tnlString( string1 ) + string2; } ostream& operator << ( ostream& stream, const tnlString& str ) { stream << str. getString(); Loading
src/core/tnlString.h +2 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,8 @@ class tnlString friend ostream& operator << ( ostream& stream, const tnlString& str ); }; tnlString operator + ( const char* string1, const tnlString& string2 ); ostream& operator << ( ostream& stream, const tnlString& str ); template< typename T > Loading
src/functions/tnlMeshFunctionNormGetter.h +65 −13 Original line number Diff line number Diff line Loading @@ -24,24 +24,32 @@ class tnlMeshFunctionNormGetter { }; template< typename MeshFunction, int Dimensions, /*** * Specialization for grids * TODO: implement this even for other devices */ template< int Dimensions, typename MeshReal, typename Device, typename MeshIndex > class tnlMeshFunctionNormGetter< MeshFunction, tnlGrid< Dimensions, MeshReal, Device, MeshIndex > > typename MeshIndex, int EntityDimensions > class tnlMeshFunctionNormGetter< tnlMeshFunction< tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex >, EntityDimensions >, tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex > > { public: typedef MeshFunction MeshFunctionType; typedef tnlGrid< Dimensions, MeshReal, Device, MeshIndex > GridType; typedef tnlMeshFunction< tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex >, EntityDimensions > MeshFunctionType; typedef tnlGrid< Dimensions, MeshReal, tnlHost, MeshIndex > GridType; typedef MeshReal MeshRealType; typedef Device DeviceType; typedef tnlHost DeviceType; typedef MeshIndex MeshIndexType; typedef typename MeshFunctionType::RealType RealType; typedef typename MeshFunctionType::MeshType MeshType; typedef typename MeshType::Face EntityType; static RealType getNorm( const MeshFunction& function, static RealType getNorm( const MeshFunctionType& function, const RealType& p ) { if( EntityDimensions == Dimensions ) { if( p == 1.0 ) return function.getMesh().getCellMeasure() * function.getData().lpNorm( 1.0 ); Loading @@ -49,6 +57,50 @@ class tnlMeshFunctionNormGetter< MeshFunction, tnlGrid< Dimensions, MeshReal, De return sqrt( function.getMesh().getCellMeasure() ) * function.getData().lpNorm( 2.0 ); return pow( function.getMesh().getCellMeasure(), 1.0 / p ) * function.getData().lpNorm( p ); } if( EntityDimensions > 0 ) { if( p == 1.0 ) { RealType result( 0.0 ); for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) { EntityType entity = function.getMesh().template getEntity< EntityType >( i ); result += fabs( function[ i ] ) * entity.getMeasure(); } return result; } if( p == 2.0 ) { RealType result( 0.0 ); for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) { EntityType entity = function.getMesh().template getEntity< EntityType >( i ); result += function[ i ] * function[ i ] * entity.getMeasure(); } return sqrt( result ); } RealType result( 0.0 ); for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) { EntityType entity = function.getMesh().template getEntity< EntityType >( i ); result += pow( fabs( function[ i ] ), p ) * entity.getMeasure(); } return pow( result, 1.0 / p ); } if( p == 1.0 ) return function.getData().lpNorm( 1.0 ); if( p == 2.0 ) return function.getData().lpNorm( 2.0 ); return function.getData().lpNorm( p ); } }; #endif /* TNLMESHFUNCTIONNORMGETTER_H */ Loading
src/mesh/grids/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ SET( headers tnlBoundaryGridEntityChecker.h tnlGridEntityCenterGetter.h tnlGridEntityGetter.h tnlGridEntityGetter_impl.h tnlGridEntityMeasureGetter.h tnlNeighbourGridEntityGetter.h tnlNeighbourGridEntityGetter1D_impl.h tnlNeighbourGridEntityGetter2D_impl.h Loading
src/mesh/grids/tnlGrid1D.h +8 −2 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject using MeshEntity = tnlGridEntity< ThisType, EntityDimensions, Config >; typedef MeshEntity< meshDimensions, tnlGridEntityCrossStencilStorage< 1 > > Cell; typedef MeshEntity< 0 > Face; typedef MeshEntity< 0 > Vertex; static constexpr int getDimensionsCount() { return meshDimensions; }; Loading Loading @@ -91,6 +92,13 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject __cuda_callable__ inline Index getEntityIndex( const EntityType& entity ) const; template< typename EntityType > __cuda_callable__ RealType getEntityMeasure( const EntityType& entity ) const; __cuda_callable__ RealType getCellMeasure() const; __cuda_callable__ inline VertexType getSpaceSteps() const; Loading @@ -101,8 +109,6 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject __cuda_callable__ inline RealType getSmallestSpaceStep() const; __cuda_callable__ RealType getCellMeasure() const; template< typename GridFunction > typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1, Loading