Loading src/implementation/core/tnlSharedVector_impl.h +6 −1 Original line number Diff line number Diff line Loading @@ -25,10 +25,15 @@ template< typename Real, typename Index > tnlString tnlSharedVector< Real, Device, Index > :: getType() const { return tnlString( "tnlSharedVector< " ) + return tnlString( "tnlVector< " ) + getParameterType< Real >() + ", " + Device :: getDeviceType() + ", " + getParameterType< Index >() + " >"; /**** * It seems that there is no reason to differ here between vector and shared vector. * This method is used mainly (or only) for loading and saving of objects. * Making difference between shared vector and vector only complicates thinks. */ }; template< typename Real, Loading src/implementation/core/tnlVector_impl.h +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ template< typename Real, typename Index > tnlString tnlVector< Real, Device, Index > :: getType() const { return tnlString( "tnlVector< " ) + ", " + return tnlString( "tnlVector< " ) + getParameterType< Real >() + ", " + Device :: getDeviceType() + ", " + getParameterType< Index >() + " >"; Loading src/implementation/mesh/tnlGrid1D_impl.h +1 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ bool tnlGrid< 1, Real, Device, Index> :: load( tnlFile& file ) << this -> getName() << endl; return false; } this -> dofs = this -> getDimensions(). x(); return true; }; Loading src/implementation/mesh/tnlGrid2D_impl.h +47 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,11 @@ #ifndef TNLGRID2D_IMPL_H_ #define TNLGRID2D_IMPL_H_ #include <fstream> #include <core/tnlAssert.h> using namespace std; template< typename Real, typename Device, typename Index > Loading Loading @@ -197,6 +200,8 @@ bool tnlGrid< 2, Real, Device, Index> :: load( tnlFile& file ) << this -> getName() << endl; return false; } this -> dofs = this -> getDimensions(). x() * this -> getDimensions(). y(); return true; }; Loading @@ -216,4 +221,44 @@ bool tnlGrid< 2, Real, Device, Index> :: load( const tnlString& fileName ) return tnlObject :: load( fileName ); }; template< typename Real, typename Device, typename Index > template< typename MeshFunction > bool tnlGrid< 2, Real, Device, Index> :: write( const MeshFunction& function, const tnlString& fileName, const tnlString& format ) const { if( this -> getDofs() != function. getSize() ) { cerr << "The size ( " << function. getSize() << " ) of the mesh function " << function. getName() << " does not agree with the DOFs ( " << this -> getDofs() << " ) of the mesh " << this -> getName() << "." << endl; return false; } fstream file; file. open( fileName. getString(), ios :: out ); if( ! file ) { cerr << "I am not able to open the file " << fileName << "." << endl; return false; } const RealType hx = getSpaceStep(). x(); const RealType hy = getSpaceStep(). y(); if( format == "gnuplot" ) for( IndexType j = 0; j < getDimensions(). y(); j++ ) { for( IndexType i = 0; i < getDimensions(). x(); i++ ) { const RealType x = this -> getLowerCorner(). x() + i * hx; const RealType y = this -> getLowerCorner(). y() + i * hy; file << x << " " << " " << y << " " << function[ this -> getNodeIndex( j, i ) ] << endl; } file << endl; } file. close(); return true; } #endif /* TNLGRID2D_IMPL_H_ */ src/implementation/mesh/tnlGrid3D_impl.h +3 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,9 @@ bool tnlGrid< 3, Real, Device, Index> :: load( tnlFile& file ) << this -> getName() << endl; return false; } this -> dofs = this -> getDimensions(). x() * this -> getDimensions(). y() * this -> getDimensions(). z(); return true; }; Loading Loading
src/implementation/core/tnlSharedVector_impl.h +6 −1 Original line number Diff line number Diff line Loading @@ -25,10 +25,15 @@ template< typename Real, typename Index > tnlString tnlSharedVector< Real, Device, Index > :: getType() const { return tnlString( "tnlSharedVector< " ) + return tnlString( "tnlVector< " ) + getParameterType< Real >() + ", " + Device :: getDeviceType() + ", " + getParameterType< Index >() + " >"; /**** * It seems that there is no reason to differ here between vector and shared vector. * This method is used mainly (or only) for loading and saving of objects. * Making difference between shared vector and vector only complicates thinks. */ }; template< typename Real, Loading
src/implementation/core/tnlVector_impl.h +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ template< typename Real, typename Index > tnlString tnlVector< Real, Device, Index > :: getType() const { return tnlString( "tnlVector< " ) + ", " + return tnlString( "tnlVector< " ) + getParameterType< Real >() + ", " + Device :: getDeviceType() + ", " + getParameterType< Index >() + " >"; Loading
src/implementation/mesh/tnlGrid1D_impl.h +1 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ bool tnlGrid< 1, Real, Device, Index> :: load( tnlFile& file ) << this -> getName() << endl; return false; } this -> dofs = this -> getDimensions(). x(); return true; }; Loading
src/implementation/mesh/tnlGrid2D_impl.h +47 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,11 @@ #ifndef TNLGRID2D_IMPL_H_ #define TNLGRID2D_IMPL_H_ #include <fstream> #include <core/tnlAssert.h> using namespace std; template< typename Real, typename Device, typename Index > Loading Loading @@ -197,6 +200,8 @@ bool tnlGrid< 2, Real, Device, Index> :: load( tnlFile& file ) << this -> getName() << endl; return false; } this -> dofs = this -> getDimensions(). x() * this -> getDimensions(). y(); return true; }; Loading @@ -216,4 +221,44 @@ bool tnlGrid< 2, Real, Device, Index> :: load( const tnlString& fileName ) return tnlObject :: load( fileName ); }; template< typename Real, typename Device, typename Index > template< typename MeshFunction > bool tnlGrid< 2, Real, Device, Index> :: write( const MeshFunction& function, const tnlString& fileName, const tnlString& format ) const { if( this -> getDofs() != function. getSize() ) { cerr << "The size ( " << function. getSize() << " ) of the mesh function " << function. getName() << " does not agree with the DOFs ( " << this -> getDofs() << " ) of the mesh " << this -> getName() << "." << endl; return false; } fstream file; file. open( fileName. getString(), ios :: out ); if( ! file ) { cerr << "I am not able to open the file " << fileName << "." << endl; return false; } const RealType hx = getSpaceStep(). x(); const RealType hy = getSpaceStep(). y(); if( format == "gnuplot" ) for( IndexType j = 0; j < getDimensions(). y(); j++ ) { for( IndexType i = 0; i < getDimensions(). x(); i++ ) { const RealType x = this -> getLowerCorner(). x() + i * hx; const RealType y = this -> getLowerCorner(). y() + i * hy; file << x << " " << " " << y << " " << function[ this -> getNodeIndex( j, i ) ] << endl; } file << endl; } file. close(); return true; } #endif /* TNLGRID2D_IMPL_H_ */
src/implementation/mesh/tnlGrid3D_impl.h +3 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,9 @@ bool tnlGrid< 3, Real, Device, Index> :: load( tnlFile& file ) << this -> getName() << endl; return false; } this -> dofs = this -> getDimensions(). x() * this -> getDimensions(). y() * this -> getDimensions(). z(); return true; }; Loading