From 770c2c9cfff9aa16c1e29edb3bda6586fa49b022 Mon Sep 17 00:00:00 2001 From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz> Date: Thu, 24 Jul 2014 20:14:42 +0200 Subject: [PATCH] Reimplementing the grid. --- .../tnlNeumannBoundaryConditions.h | 12 ++-- .../tnlNeumannBoundaryConditions_impl.h | 12 ++-- examples/heat-equation/tnlZeroRightHandSide.h | 12 ++-- .../heat-equation/tnlZeroRightHandSide_impl.h | 6 +- src/implementation/mesh/tnlGrid1D_impl.h | 14 ++-- src/implementation/mesh/tnlGrid2D_impl.h | 69 ++++++------------- src/implementation/mesh/tnlGrid3D_impl.h | 33 +++------ .../schemes/tnlFiniteDifferences_impl.h | 36 +++++----- src/mesh/CMakeLists.txt | 2 - src/mesh/tnlGrid.h | 27 +++++--- src/schemes/tnlFiniteDifferences.h | 13 ++-- tools/src/tnl-diff.cpp | 60 +++++----------- tools/src/tnl-discrete.cpp | 2 - tools/src/tnl-discrete.h | 8 +-- tools/src/tnl-view.cpp | 60 +++++----------- 15 files changed, 133 insertions(+), 233 deletions(-) diff --git a/examples/heat-equation/tnlNeumannBoundaryConditions.h b/examples/heat-equation/tnlNeumannBoundaryConditions.h index 43f1c6fbaa..1574258a5e 100644 --- a/examples/heat-equation/tnlNeumannBoundaryConditions.h +++ b/examples/heat-equation/tnlNeumannBoundaryConditions.h @@ -8,11 +8,11 @@ class tnlNeumannBoundaryConditions }; template<typename Real, typename Device, typename Index> -class tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry>> +class tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index > > { public: - typedef tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry> MeshType; + typedef tnlGrid<1,Real,Device,Index> MeshType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; typedef typename MeshType::RealType RealType; @@ -32,11 +32,11 @@ class tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index,tnlIdenticalGridG }; template<typename Real, typename Device, typename Index> -class tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry>> +class tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index > > { public: - typedef tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry> MeshType; + typedef tnlGrid<2,Real,Device,Index> MeshType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; typedef typename MeshType::RealType RealType; @@ -56,11 +56,11 @@ class tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index,tnlIdenticalGridG }; template<typename Real, typename Device, typename Index> -class tnlNeumannBoundaryConditions<tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry>> +class tnlNeumannBoundaryConditions<tnlGrid<3,Real,Device,Index>> { public: - typedef tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry> MeshType; + typedef tnlGrid<3,Real,Device,Index> MeshType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; typedef typename MeshType::RealType RealType; diff --git a/examples/heat-equation/tnlNeumannBoundaryConditions_impl.h b/examples/heat-equation/tnlNeumannBoundaryConditions_impl.h index b438860125..179e81de81 100644 --- a/examples/heat-equation/tnlNeumannBoundaryConditions_impl.h +++ b/examples/heat-equation/tnlNeumannBoundaryConditions_impl.h @@ -6,7 +6,7 @@ template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction, typename Vector> -void tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index>>:: applyBoundaryConditions(const MeshType& mesh, Vector& u, const RealType& time, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -15,7 +15,7 @@ applyBoundaryConditions(const MeshType& mesh, Vector& u, const RealType& time, template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction, typename Vector> -void tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlNeumannBoundaryConditions<tnlGrid<1,Real,Device,Index>>:: applyBoundaryTimeDerivation(const MeshType& mesh, Vector& u, const RealType& time, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -24,7 +24,7 @@ applyBoundaryTimeDerivation(const MeshType& mesh, Vector& u, const RealType& tim template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction, typename Vector> -void tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index>>:: applyBoundaryConditions(const MeshType& mesh, Vector& u, const RealType& time, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -33,7 +33,7 @@ applyBoundaryConditions(const MeshType& mesh, Vector& u, const RealType& time, template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction, typename Vector> -void tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlNeumannBoundaryConditions<tnlGrid<2,Real,Device,Index>>:: applyBoundaryTimeDerivation(const MeshType& mesh, Vector& u, const RealType& time, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -42,7 +42,7 @@ applyBoundaryTimeDerivation(const MeshType& mesh, Vector& u, const RealType& tim template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction, typename Vector> -void tnlNeumannBoundaryConditions<tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlNeumannBoundaryConditions<tnlGrid<3,Real,Device,Index>>:: applyBoundaryConditions(const MeshType& mesh, Vector& u, const RealType& time, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -51,7 +51,7 @@ applyBoundaryConditions(const MeshType& mesh, Vector& u, const RealType& time, template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction, typename Vector> -void tnlNeumannBoundaryConditions<tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlNeumannBoundaryConditions<tnlGrid<3,Real,Device,Index>>:: applyBoundaryTimeDerivation(const MeshType& mesh, Vector& u, const RealType& time, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { diff --git a/examples/heat-equation/tnlZeroRightHandSide.h b/examples/heat-equation/tnlZeroRightHandSide.h index 7ad6158480..7e79482237 100644 --- a/examples/heat-equation/tnlZeroRightHandSide.h +++ b/examples/heat-equation/tnlZeroRightHandSide.h @@ -9,11 +9,11 @@ class tnlZeroRightHandSide }; template<typename Real, typename Device, typename Index> -class tnlZeroRightHandSide<tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry>> { +class tnlZeroRightHandSide<tnlGrid<1,Real,Device,Index>> { public: - typedef tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry> MeshType; + typedef tnlGrid<1,Real,Device,Index> MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef typename MeshType::RealType RealType; typedef typename MeshType::DeviceType DeviceType; @@ -27,11 +27,11 @@ class tnlZeroRightHandSide<tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry> }; template<typename Real, typename Device, typename Index> -class tnlZeroRightHandSide<tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry>> { +class tnlZeroRightHandSide<tnlGrid<2,Real,Device,Index>> { public: - typedef tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry> MeshType; + typedef tnlGrid<2,Real,Device,Index> MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef typename MeshType::RealType RealType; typedef typename MeshType::DeviceType DeviceType; @@ -45,11 +45,11 @@ class tnlZeroRightHandSide<tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry> }; template<typename Real, typename Device, typename Index> -class tnlZeroRightHandSide<tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry>> { +class tnlZeroRightHandSide<tnlGrid<3,Real,Device,Index>> { public: - typedef tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry> MeshType; + typedef tnlGrid<3,Real,Device,Index> MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef typename MeshType::RealType RealType; typedef typename MeshType::DeviceType DeviceType; diff --git a/examples/heat-equation/tnlZeroRightHandSide_impl.h b/examples/heat-equation/tnlZeroRightHandSide_impl.h index 7f6eaa9033..c5e1aca3c1 100644 --- a/examples/heat-equation/tnlZeroRightHandSide_impl.h +++ b/examples/heat-equation/tnlZeroRightHandSide_impl.h @@ -6,7 +6,7 @@ template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction> -void tnlZeroRightHandSide<tnlGrid<1,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlZeroRightHandSide<tnlGrid<1,Real,Device,Index>>:: applyRHSValues(const MeshType& mesh, const RealType& time, DofVectorType& _fu, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -15,7 +15,7 @@ applyRHSValues(const MeshType& mesh, const RealType& time, DofVectorType& _fu, template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction> -void tnlZeroRightHandSide<tnlGrid<2,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlZeroRightHandSide<tnlGrid<2,Real,Device,Index>>:: applyRHSValues(const MeshType& mesh, const RealType& time, DofVectorType& _fu, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { @@ -24,7 +24,7 @@ applyRHSValues(const MeshType& mesh, const RealType& time, DofVectorType& _fu, template<typename Real, typename Device, typename Index> template<typename AnalyticSpaceFunction, typename TimeFunction> -void tnlZeroRightHandSide<tnlGrid<3,Real,Device,Index,tnlIdenticalGridGeometry>>:: +void tnlZeroRightHandSide<tnlGrid<3,Real,Device,Index>>:: applyRHSValues(const MeshType& mesh, const RealType& time, DofVectorType& _fu, TimeFunction& timeFunction, AnalyticSpaceFunction& analyticSpaceFunction) { diff --git a/src/implementation/mesh/tnlGrid1D_impl.h b/src/implementation/mesh/tnlGrid1D_impl.h index ef05079fa4..c0270de3f1 100644 --- a/src/implementation/mesh/tnlGrid1D_impl.h +++ b/src/implementation/mesh/tnlGrid1D_impl.h @@ -65,8 +65,8 @@ bool tnlGrid< 1, Real, Device, Index > :: setDimensions( const Index xSize ) dofs = xSize; VertexType parametricStep; - parametricStep. x() = geometry. getProportions(). x() / xSize; - geometry. setParametricStep( parametricStep ); + //parametricStep. x() = geometry. getProportions(). x() / xSize; + //geometry. setParametricStep( parametricStep ); return true; } @@ -109,7 +109,7 @@ template< typename Real, typename Index > void tnlGrid< 1, Real, Device, Index > :: setProportions( const VertexType& proportions ) { - this->geometry.setProportions( proportions ); + //this->geometry.setProportions( proportions ); this -> setDimensions( this -> dimensions ); } @@ -119,7 +119,7 @@ template< typename Real, const typename tnlGrid< 1, Real, Device, Index > :: VertexType& tnlGrid< 1, Real, Device, Index > :: getProportions() const { - return this -> geometry.getProportions(); + //return this -> geometry.getProportions(); } template< typename Real, @@ -129,8 +129,8 @@ void tnlGrid< 1, Real, Device, Index > :: setParametricStep( const VertexType& p { VertexType v; v.x() = this -> dimensions. x() * parametricStep. x(); - this->geometry.setProportions( v ); - geometry. setParametricStep( parametricStep ); + //this->geometry.setProportions( v ); + //geometry. setParametricStep( parametricStep ); } template< typename Real, @@ -139,7 +139,7 @@ template< typename Real, const typename tnlGrid< 1, Real, Device, Index > :: VertexType& tnlGrid< 1, Real, Device, Index > :: getParametricStep() const { - return geometry. getParametricStep(); + //return geometry. getParametricStep(); } template< typename Real, diff --git a/src/implementation/mesh/tnlGrid2D_impl.h b/src/implementation/mesh/tnlGrid2D_impl.h index 007d2058a2..9d7c6774ca 100644 --- a/src/implementation/mesh/tnlGrid2D_impl.h +++ b/src/implementation/mesh/tnlGrid2D_impl.h @@ -42,8 +42,7 @@ tnlString tnlGrid< 2, Real, Device, Index > :: getType() tnlString( Dimensions ) + ", " + tnlString( getParameterType< RealType >() ) + ", " + tnlString( Device :: getDeviceType() ) + ", " + - tnlString( getParameterType< IndexType >() ) + ", " + - Geometry< 2, Real, Device, Index > :: getType() + " >"; + tnlString( getParameterType< IndexType >() ) + " >"; } template< typename Real, @@ -68,7 +67,7 @@ bool tnlGrid< 2, Real, Device, Index > :: setDimensions( const Index xSize, cons this -> dimensions. y() = ySize; dofs = ySize * xSize; VertexType parametricStep; - parametricStep. x() = geometry. getProportions(). x() / xSize; + /*parametricStep. x() = geometry. getProportions(). x() / xSize; parametricStep. y() = geometry. getProportions(). y() / ySize; geometry. setParametricStep( parametricStep ); if( GeometryType :: ElementsMeasureStorage :: enabled && @@ -83,7 +82,7 @@ bool tnlGrid< 2, Real, Device, Index > :: setDimensions( const Index xSize, cons if( GeometryType :: VerticesStorage :: enabled && ( ! vertices. setSize( this -> getNumberOfVertices() ) || ! elementCenters. setSize( this -> getNumberOfVertices() ) ) ) - return false; + return false;*/ return true; } @@ -126,11 +125,11 @@ template< typename Real, typename Index > void tnlGrid< 2, Real, Device, Index > :: setProportions( const VertexType& proportions ) { - geometry. setProportions( proportions ); + /*geometry. setProportions( proportions ); VertexType parametricStep; parametricStep. x() = proportions. x() / ( this -> dimensions. x() ); parametricStep. y() = proportions. y() / ( this -> dimensions. y() ); - geometry. setParametricStep( parametricStep ); + geometry. setParametricStep( parametricStep );*/ } template< typename Real, @@ -139,7 +138,7 @@ template< typename Real, const typename tnlGrid< 2, Real, Device, Index > :: VertexType& tnlGrid< 2, Real, Device, Index > :: getProportions() const { - return geometry. getProportions(); + //return geometry. getProportions(); } template< typename Real, @@ -147,10 +146,10 @@ template< typename Real, typename Index > void tnlGrid< 2, Real, Device, Index > :: setParametricStep( const VertexType& spaceStep ) { - geometry. setProportions( + /*geometry. setProportions( VertexType( this -> dimensions. x() * geometry. getParametricStep(). x(), - this -> dimensions. y() * geometry. getParametricStep(). y() ) ); + this -> dimensions. y() * geometry. getParametricStep(). y() ) );*/ } template< typename Real, @@ -159,7 +158,7 @@ template< typename Real, const typename tnlGrid< 2, Real, Device, Index > :: VertexType& tnlGrid< 2, Real, Device, Index > :: getParametricStep() const { - return geometry. getParametricStep(); + //return geometry. getParametricStep(); } template< typename Real, @@ -230,7 +229,7 @@ template< typename Real, typename Index > void tnlGrid< 2, Real, Device, Index > :: refresh() { - if( GeometryType :: ElementsMeasureStorage :: enabled ) + /*if( GeometryType :: ElementsMeasureStorage :: enabled ) for( IndexType j = 0; j < dimensions. y(); j ++ ) for( IndexType i = 0; i < dimensions. x(); i ++ ) elementsMeasure[ getElementIndex( i, j ) ] = geometry. getElementMeasure( CoordinatesType( i, j ) ); @@ -271,7 +270,7 @@ void tnlGrid< 2, Real, Device, Index > :: refresh() //cout << "( " << elementCenters[ getElementIndex( i, j ) ] << " ), "; } //cout << endl; - } + }*/ } template< typename Real, @@ -328,24 +327,6 @@ Index tnlGrid< 2, Real, Device, Index > :: getNumberOfVertices() const return ( this -> dimensions. x() + 1 ) * ( this -> dimensions. y() + 1 ); } -template< typename Real, - typename Device, - typename Index > -typename tnlGrid< 2, Real, Device, Index > :: GeometryType& - tnlGrid< 2, Real, Device, Index > :: getGeometry() -{ - return this -> geometry; -} - -template< typename Real, - typename Device, - typename Index > -const typename tnlGrid< 2, Real, Device, Index > :: GeometryType& - tnlGrid< 2, Real, Device, Index > :: getGeometry() const -{ - return this -> geometry; -} - template< typename Real, typename Device, typename Index > @@ -353,7 +334,7 @@ template< typename Real, void tnlGrid< 2, Real, Device, Index > :: getElementCenter( const CoordinatesType& coordinates, Vertex& center ) const { - geometry. getElementCenter( origin, coordinates, center ); + //geometry. getElementCenter( origin, coordinates, center ); } template< typename Real, @@ -361,9 +342,9 @@ template< typename Real, typename Index > Real tnlGrid< 2, Real, Device, Index > :: getElementMeasure( const CoordinatesType& coordinates ) const { - if( GeometryType :: ElementsMeasureStorage :: enabled ) + /*if( GeometryType :: ElementsMeasureStorage :: enabled ) return elementsMeasure[ getElementIndex( coordinates. x(), coordinates. y() ) ]; - return geometry. getElementMeasure( coordinates ); + return geometry. getElementMeasure( coordinates );*/ } template< typename Real, @@ -372,9 +353,9 @@ template< typename Real, template< int dx, int dy > Real tnlGrid< 2, Real, Device, Index > :: getDualElementMeasure( const CoordinatesType& coordinates ) const { - if( GeometryType :: DualElementsMeasureStorage :: enabled ) + /*if( GeometryType :: DualElementsMeasureStorage :: enabled ) return dualElementsMeasure[ getEdgeIndex( coordinates. x(), coordinates. y(), dx, dy ) ]; - return geometry. getDualElementMeasure< dx, dy >( coordinates ); + return geometry. getDualElementMeasure< dx, dy >( coordinates );*/ } template< typename Real, @@ -384,14 +365,14 @@ template< int dx, int dy > void tnlGrid< 2, Real, Device, Index > :: getEdgeNormal( const CoordinatesType& coordinates, VertexType& normal ) const { - if( GeometryType :: EdgeNormalsStorage :: enabled ) + /*if( GeometryType :: EdgeNormalsStorage :: enabled ) { normal = edgeNormals[ getEdgeIndex( coordinates. x(), coordinates. y(), dx, dy ) ]; if( dx == -1 || dy == -1 ) normal *= ( RealType ) -1.0; } else - return geometry. getEdgeNormal< dx, dy >( coordinates, normal ); + return geometry. getEdgeNormal< dx, dy >( coordinates, normal );*/ } template< typename Real, @@ -401,7 +382,7 @@ template< typename Real, void tnlGrid< 2, Real, Device, Index > :: getVertex( const CoordinatesType& elementCoordinates, Vertex& vertex ) const { - tnlAssert( elementCoordinates. x() >= 0 && + /*tnlAssert( elementCoordinates. x() >= 0 && elementCoordinates. x() < this -> dimensions. x() && elementCoordinates. y() >= 0 && elementCoordinates. y() < this -> dimensions. y(), @@ -416,7 +397,7 @@ void tnlGrid< 2, Real, Device, Index > :: getVertex( const CoordinatesType& elem else return geometry. getVertex< dx, dy >( elementCoordinates, this -> origin, - vertex ); + vertex );*/ } template< typename Real, @@ -493,11 +474,6 @@ bool tnlGrid< 2, Real, Device, Index > :: save( tnlFile& file ) const << this -> getName() << endl; return false; } - if( ! geometry. save( file ) ) - { - cerr << "I was not able to save the mesh." << endl; - return false; - } return true; }; @@ -516,11 +492,6 @@ bool tnlGrid< 2, Real, Device, Index > :: load( tnlFile& file ) << this -> getName() << endl; return false; } - if( ! geometry. load( file ) ) - { - cerr << "I am not able to load the grid geometry." << endl; - return false; - } if( ! this -> setDimensions( dim ) ) { cerr << "I am not able to allocate the loaded grid." << endl; diff --git a/src/implementation/mesh/tnlGrid3D_impl.h b/src/implementation/mesh/tnlGrid3D_impl.h index a4816a539e..12914ec80e 100644 --- a/src/implementation/mesh/tnlGrid3D_impl.h +++ b/src/implementation/mesh/tnlGrid3D_impl.h @@ -38,8 +38,7 @@ tnlString tnlGrid< 3, Real, Device, Index > :: getType() tnlString( Dimensions ) + ", " + tnlString( getParameterType< RealType >() ) + ", " + tnlString( Device :: getDeviceType() ) + ", " + - tnlString( getParameterType< IndexType >() ) + ", " + - Geometry< 3, Real, Device, Index > :: getType() + " >"; + tnlString( getParameterType< IndexType >() ) + " >"; } template< typename Real, @@ -68,10 +67,10 @@ bool tnlGrid< 3, Real, Device, Index > :: setDimensions( const Index xSize, cons dofs = zSize * ySize * xSize; VertexType parametricStep; - parametricStep. x() = geometry. getProportions(). x() / xSize; + /*parametricStep. x() = geometry. getProportions(). x() / xSize; parametricStep. y() = geometry. getProportions(). y() / ySize; parametricStep. z() = geometry. getProportions(). z() / zSize; - geometry. setParametricStep( parametricStep ); + geometry. setParametricStep( parametricStep );*/ return true; } @@ -114,12 +113,12 @@ template< typename Real, typename Index > void tnlGrid< 3, Real, Device, Index > :: setProportions( const VertexType& proportions ) { - geometry. setProportions( proportions ); + //geometry. setProportions( proportions ); VertexType parametricStep; parametricStep. x() = proportions. x() / ( this -> dimensions. x() ); parametricStep. y() = proportions. y() / ( this -> dimensions. y() ); parametricStep. z() = proportions. z() / ( this -> dimensions. z() ); - geometry. setParametricStep( parametricStep ); + //geometry. setParametricStep( parametricStep ); } template< typename Real, @@ -128,7 +127,7 @@ template< typename Real, const typename tnlGrid< 3, Real, Device, Index > :: VertexType& tnlGrid< 3, Real, Device, Index > :: getProportions() const { - return geometry. getProportions(); + //return geometry. getProportions(); } template< typename Real, @@ -136,11 +135,11 @@ template< typename Real, typename Index > void tnlGrid< 3, Real, Device, Index > :: setParametricStep( const VertexType& spaceStep ) { - geometry. setProportions( + /* geometry. setProportions( VertexType( this -> dimensions. x() * geometry. getParametricStep(). x(), this -> dimensions. y() * geometry. getParametricStep(). y(), - this -> dimensions. z() * geometry. getParametricStep(). z() ) ); + this -> dimensions. z() * geometry. getParametricStep(). z() ) );*/ } template< typename Real, @@ -149,7 +148,7 @@ template< typename Real, const typename tnlGrid< 3, Real, Device, Index > :: VertexType& tnlGrid< 3, Real, Device, Index > :: getParametricStep() const { - return geometry. getParametricStep(); + //return geometry. getParametricStep(); } template< typename Real, @@ -195,7 +194,7 @@ template< typename Real, void tnlGrid< 3, Real, Device, Index > :: getElementCenter( const CoordinatesType& coordinates, Vertex& center ) const { - geometry. getElementCenter( origin, coordinates, center ); + // geometry. getElementCenter( origin, coordinates, center ); } template< typename Real, @@ -211,7 +210,7 @@ template< typename Real, typename Index > Real tnlGrid< 3, Real, Device, Index > :: getElementMeasure( const CoordinatesType& coordinates ) const { - return geometry. getElementMeasure( coordinates ); + //return geometry. getElementMeasure( coordinates ); } template< typename Real, @@ -277,11 +276,6 @@ bool tnlGrid< 3, Real, Device, Index > :: save( tnlFile& file ) const << this -> getName() << endl; return false; } - if( ! geometry. save( file ) ) - { - cerr << "I was not able to save the mesh." << endl; - return false; - } return true; }; @@ -300,11 +294,6 @@ bool tnlGrid< 3, Real, Device, Index > :: load( tnlFile& file ) << this -> getName() << endl; return false; } - if( ! geometry. load( file ) ) - { - cerr << "I am not able to load the grid geometry." << endl; - return false; - } if( ! this -> setDimensions( dim ) ) { cerr << "I am not able to allocate the loaded grid." << endl; diff --git a/src/implementation/schemes/tnlFiniteDifferences_impl.h b/src/implementation/schemes/tnlFiniteDifferences_impl.h index 1e335c2d2d..66a4e42908 100644 --- a/src/implementation/schemes/tnlFiniteDifferences_impl.h +++ b/src/implementation/schemes/tnlFiniteDifferences_impl.h @@ -28,9 +28,9 @@ template< typename Real, typename Device, typename Index > int XDifferenceDirection, int YDifferenceDirection, int ZDifferenceDirection > -Real tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index, tnlIdenticalGridGeometry > >::getDifference( const GridType& grid, - const GridFunction& inFunction, - GridFunction& outFunction ) +Real tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index > >::getDifference( const GridType& grid, + const GridFunction& inFunction, + GridFunction& outFunction ) { IndexType iBegin, iEnd; if( XDifferenceDirection == 0 || XDifferenceDirection == 1 ) @@ -64,9 +64,9 @@ template< typename Real, typename Device, typename Index > int XDifferenceDirection, int YDifferenceDirection, int ZDifferenceDirection > -Real tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index, tnlIdenticalGridGeometry > >::getDifference( const GridType& grid, - const CoordinatesType& c, - const GridFunction& function ) +Real tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index > >::getDifference( const GridType& grid, + const CoordinatesType& c, + const GridFunction& function ) { if( YDifferenceOrder > 0 || ZDifferenceOrder > 0 ) @@ -101,9 +101,9 @@ template< typename Real, typename Device, typename Index > int XDifferenceDirection, int YDifferenceDirection, int ZDifferenceDirection > -Real tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeometry > >::getDifference( const GridType& grid, - const GridFunction& inFunction, - GridFunction& outFunction ) +Real tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index > >::getDifference( const GridType& grid, + const GridFunction& inFunction, + GridFunction& outFunction ) { } @@ -116,9 +116,9 @@ template< typename Real, typename Device, typename Index > int XDifferenceDirection, int YDifferenceDirection, int ZDifferenceDirection > -Real tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeometry > >::getDifference( const GridType& grid, - const CoordinatesType& c, - const GridFunction& function ) +Real tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index > >::getDifference( const GridType& grid, + const CoordinatesType& c, + const GridFunction& function ) { if( YDifferenceOrder > 0 || ZDifferenceOrder > 0 ) return 0.0; @@ -149,9 +149,9 @@ template< typename Real, typename Device, typename Index > int XDifferenceDirection, int YDifferenceDirection, int ZDifferenceDirection > -Real tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index, tnlIdenticalGridGeometry > >::getDifference( const GridType& grid, - const GridFunction& inFunction, - GridFunction& outFunction ) +Real tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > >::getDifference( const GridType& grid, + const GridFunction& inFunction, + GridFunction& outFunction ) { } @@ -164,9 +164,9 @@ template< typename Real, typename Device, typename Index > int XDifferenceDirection, int YDifferenceDirection, int ZDifferenceDirection > -Real tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index, tnlIdenticalGridGeometry > >::getDifference( const GridType& grid, - const CoordinatesType& c, - const GridFunction& function ) +Real tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > >::getDifference( const GridType& grid, + const CoordinatesType& c, + const GridFunction& function ) { if( YDifferenceOrder > 0 || ZDifferenceOrder > 0 ) return 0.0; diff --git a/src/mesh/CMakeLists.txt b/src/mesh/CMakeLists.txt index 157f3c4586..f4a30c311c 100755 --- a/src/mesh/CMakeLists.txt +++ b/src/mesh/CMakeLists.txt @@ -4,8 +4,6 @@ ADD_SUBDIRECTORY( traits ) ADD_SUBDIRECTORY( topologies ) SET( headers tnlGrid.h - tnlIdenticalGridGeometry.h - tnlLinearGridGeometry.h tnlDummyMesh.h tnlGnuplotWriter.h tnlMesh.h diff --git a/src/mesh/tnlGrid.h b/src/mesh/tnlGrid.h index 6c39828564..59fb6913d5 100644 --- a/src/mesh/tnlGrid.h +++ b/src/mesh/tnlGrid.h @@ -66,29 +66,34 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject const VertexType& getProportions() const; - void setParametricStep( const VertexType& spaceStep ); + //void setParametricStep( const VertexType& spaceStep ); - const VertexType& getParametricStep() const; + const VertexType& getCellSize() const; - Index getElementIndex( const Index i ) const; + Index getCellIndex( const Index i ) const; - void getElementCoordinates( const Index i, - CoordinatesType& coordinates ) const; + void getCellCoordinates( const Index i, + CoordinatesType& coordinates ) const; + + Index getVertexIndex( const Index i ) const; + + void getVertexCoordinates( const Index i, + CoordinatesType& coordinates ) const; /**** * The type Vertex can have different Real type. */ template< typename Vertex > - void getElementCenter( const CoordinatesType& coordinates, - Vertex& v ) const; + void getCellCenter( const CoordinatesType& coordinates, + Vertex& v ) const; - Index getDofs() const; - - template< int dx, typename Vertex > + template< typename Vertex > void getVertex( const CoordinatesType& elementCoordinates, Vertex& vertex ) const; - Real getElementMeasure( const CoordinatesType& coordinates ) const; + Index getNumberOfCells() const; + + Index getNumberOfVertices() const; template< typename GridFunction > typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1, diff --git a/src/schemes/tnlFiniteDifferences.h b/src/schemes/tnlFiniteDifferences.h index 41e85a209a..55f3e57703 100644 --- a/src/schemes/tnlFiniteDifferences.h +++ b/src/schemes/tnlFiniteDifferences.h @@ -19,7 +19,6 @@ #define TNLFINITEDIFFERENCES_H_ #include <mesh/tnlGrid.h> -#include <mesh/tnlIdenticalGridGeometry.h> template< typename Grid > class tnlFiniteDifferences @@ -27,14 +26,14 @@ class tnlFiniteDifferences }; template< typename Real, typename Device, typename Index > -class tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index, tnlIdenticalGridGeometry > > +class tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index > > { public: typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef tnlGrid< 1, Real, Device, Index, tnlIdenticalGridGeometry > GridType; + typedef tnlGrid< 1, Real, Device, Index > GridType; typedef typename GridType::CoordinatesType CoordinatesType; #ifdef HAVE_NOT_CXX11 @@ -88,14 +87,14 @@ class tnlFiniteDifferences< tnlGrid< 1, Real, Device, Index, tnlIdenticalGridGeo }; template< typename Real, typename Device, typename Index > -class tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeometry > > +class tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index > > { public: typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeometry > GridType; + typedef tnlGrid< 2, Real, Device, Index > GridType; typedef typename GridType::CoordinatesType CoordinatesType; @@ -150,14 +149,14 @@ class tnlFiniteDifferences< tnlGrid< 2, Real, Device, Index, tnlIdenticalGridGeo }; template< typename Real, typename Device, typename Index > -class tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index, tnlIdenticalGridGeometry > > +class tnlFiniteDifferences< tnlGrid< 3, Real, Device, Index > > { public: typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef tnlGrid< 3, Real, Device, Index, tnlIdenticalGridGeometry > GridType; + typedef tnlGrid< 3, Real, Device, Index > GridType; typedef typename GridType::CoordinatesType CoordinatesType; #ifdef HAVE_NOT_CXX11 diff --git a/tools/src/tnl-diff.cpp b/tools/src/tnl-diff.cpp index 9ffd24ce3d..e9ee5cc68c 100644 --- a/tools/src/tnl-diff.cpp +++ b/tools/src/tnl-diff.cpp @@ -18,7 +18,6 @@ #include "tnl-diff.h" #include <mesh/tnlDummyMesh.h> #include <mesh/tnlGrid.h> -#include <mesh/tnlLinearGridGeometry.h> void setupConfig( tnlConfigDescription& config ) { @@ -78,53 +77,26 @@ int main( int argc, char* argv[] ) cerr << "Unable to parse the geometry type " << parsedMeshType[ 5 ] << "." << endl; return false; } - if( parsedGeometryType[ 0 ] == "tnlIdenticalGridGeometry" ) + int dimensions = atoi( parsedGeometryType[ 1 ].getString() ); + if( dimensions == 1 ) { - int dimensions = atoi( parsedGeometryType[ 1 ].getString() ); - if( dimensions == 1 ) - { - typedef tnlGrid< 1, double, tnlHost, int, tnlIdenticalGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 2 ) - { - typedef tnlGrid< 2, double, tnlHost, int, tnlIdenticalGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 3 ) - { - typedef tnlGrid< 3, double, tnlHost, int, tnlIdenticalGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + typedef tnlGrid< 1, double, tnlHost, int > MeshType; + if( ! processFiles< MeshType >( parameters ) ) + return EXIT_FAILURE; } - if( parsedGeometryType[ 0 ] == "tnlLinearGridGeometry" ) + if( dimensions == 2 ) { - int dimensions = atoi( parsedGeometryType[ 1 ].getString() ); - if( dimensions == 1 ) - { - typedef tnlGrid< 1, double, tnlHost, int, tnlLinearGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 2 ) - { - typedef tnlGrid< 2, double, tnlHost, int, tnlLinearGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 3 ) - { - typedef tnlGrid< 3, double, tnlHost, int, tnlLinearGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + typedef tnlGrid< 2, double, tnlHost, int > MeshType; + if( ! processFiles< MeshType >( parameters ) ) + return EXIT_FAILURE; } - + if( dimensions == 3 ) + { + typedef tnlGrid< 3, double, tnlHost, int > MeshType; + if( ! processFiles< MeshType >( parameters ) ) + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } return EXIT_FAILURE; } diff --git a/tools/src/tnl-discrete.cpp b/tools/src/tnl-discrete.cpp index a7867110fb..035e7287eb 100644 --- a/tools/src/tnl-discrete.cpp +++ b/tools/src/tnl-discrete.cpp @@ -23,8 +23,6 @@ #include <config/tnlParameterContainer.h> #include <mesh/tnlDummyMesh.h> #include <mesh/tnlGrid.h> -#include <mesh/tnlIdenticalGridGeometry.h> -#include <mesh/tnlLinearGridGeometry.h> #include "tnlConfig.h" const char configFile[] = TNL_CONFIG_DIRECTORY "tnl-discrete.cfg.desc"; diff --git a/tools/src/tnl-discrete.h b/tools/src/tnl-discrete.h index eb158e246d..c2f6b25001 100644 --- a/tools/src/tnl-discrete.h +++ b/tools/src/tnl-discrete.h @@ -21,7 +21,6 @@ #include <config/tnlParameterContainer.h> #include <core/vectors/tnlVector.h> #include <mesh/tnlGrid.h> -#include <mesh/tnlIdenticalGridGeometry.h> #include <generators/functions/tnlFunctionDiscretizer.h> #include <generators/functions/tnlSinWaveFunction.h> #include <generators/functions/tnlSinBumpsFunction.h> @@ -197,11 +196,8 @@ bool resolveMesh( const tnlList< tnlString >& parsedMeshType, cerr << "Unable to parse the geometry type " << parsedMeshType[ 5 ] << "." << endl; return false; } - if( parsedGeometryType[ 0 ] == "tnlIdenticalGridGeometry" ) - { - typedef tnlGrid< Dimensions, RealType, tnlHost, IndexType, tnlIdenticalGridGeometry > MeshType; - return resolveFunction< MeshType >( parameters ); - } + typedef tnlGrid< Dimensions, RealType, tnlHost, IndexType > MeshType; + return resolveFunction< MeshType >( parameters ); } cerr << "Unknown mesh type." << endl; return false; diff --git a/tools/src/tnl-view.cpp b/tools/src/tnl-view.cpp index d40100f19c..88b6807156 100644 --- a/tools/src/tnl-view.cpp +++ b/tools/src/tnl-view.cpp @@ -23,8 +23,6 @@ #include <config/tnlParameterContainer.h> #include <mesh/tnlDummyMesh.h> #include <mesh/tnlGrid.h> -#include <mesh/tnlIdenticalGridGeometry.h> -#include <mesh/tnlLinearGridGeometry.h> // TODO: Remove /*#include <mesh/tnlMesh.h> @@ -101,52 +99,26 @@ int main( int argc, char* argv[] ) cerr << "Unable to parse the geometry type " << parsedMeshType[ 5 ] << "." << endl; return false; } - if( parsedGeometryType[ 0 ] == "tnlIdenticalGridGeometry" ) + int dimensions = atoi( parsedGeometryType[ 1 ].getString() ); + if( dimensions == 1 ) { - int dimensions = atoi( parsedGeometryType[ 1 ].getString() ); - if( dimensions == 1 ) - { - typedef tnlGrid< 1, double, tnlHost, int, tnlIdenticalGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 2 ) - { - typedef tnlGrid< 2, double, tnlHost, int, tnlIdenticalGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 3 ) - { - typedef tnlGrid< 3, double, tnlHost, int, tnlIdenticalGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + typedef tnlGrid< 1, double, tnlHost, int > MeshType; + if( ! processFiles< MeshType >( parameters ) ) + return EXIT_FAILURE; } - if( parsedGeometryType[ 0 ] == "tnlLinearGridGeometry" ) + if( dimensions == 2 ) { - int dimensions = atoi( parsedGeometryType[ 1 ].getString() ); - if( dimensions == 1 ) - { - typedef tnlGrid< 1, double, tnlHost, int, tnlLinearGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 2 ) - { - typedef tnlGrid< 2, double, tnlHost, int, tnlLinearGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - if( dimensions == 3 ) - { - typedef tnlGrid< 3, double, tnlHost, int, tnlLinearGridGeometry > MeshType; - if( ! processFiles< MeshType >( parameters ) ) - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + typedef tnlGrid< 2, double, tnlHost, int > MeshType; + if( ! processFiles< MeshType >( parameters ) ) + return EXIT_FAILURE; } + if( dimensions == 3 ) + { + typedef tnlGrid< 3, double, tnlHost, int > MeshType; + if( ! processFiles< MeshType >( parameters ) ) + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } if( parsedMeshType[ 0 ] == "tnlMesh" ) { -- GitLab