Newer
Older
Tomáš Oberhuber
committed
/***************************************************************************
Tomáš Oberhuber
committed
-------------------
begin : Jan 16, 2013
copyright : (C) 2013 by Tomas Oberhuber
Tomáš Oberhuber
committed
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TNLGRID_H_
#define TNLGRID_H_
#include <core/tnlObject.h>
#include <core/tnlHost.h>
#include <core/tnlTuple.h>
Tomáš Oberhuber
committed
template< int Dimensions,
typename Real = double,
typename Device = tnlHost,
typename Index = int >
class tnlGrid : public tnlObject
Tomáš Oberhuber
committed
{
template< typename Real,
typename Device,
typename Index >
class tnlGrid< 1, Real, Device, Index> : public tnlObject
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
enum { Dimensions = 1};
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
const tnlTuple< 1, Index >& getDimensions() const;
Tomáš Oberhuber
committed
void setLowerCorner( const tnlTuple< 1, Real >& lowerCorner );
Tomáš Oberhuber
committed
const tnlTuple< 1, Real >& getLowerCorner() const;
Tomáš Oberhuber
committed
void setUpperCorner( const tnlTuple< 1, Real >& upperCorner );
Tomáš Oberhuber
committed
const tnlTuple< 1, Real >& getUpperCorner() const;
Tomáš Oberhuber
committed
void setSpaceStep( const tnlTuple< 1, Real >& spaceStep );
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
//! Method for saving the object to a file as a binary data
bool save( tnlFile& file ) const;
//! Method for restoring the object from a file
bool load( tnlFile& file );
bool save( const tnlString& fileName ) const;
bool load( const tnlString& fileName );
tnlTuple< 1, RealType > lowerCorner, upperCorner;
template< typename Real,
typename Device,
typename Index >
class tnlGrid< 2, Real, Device, Index> : public tnlObject
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
enum { Dimensions = 2};
void setDimensions( const Index ySize, const Index xSize );
const tnlTuple< 2, Index >& getDimensions() const;
void setLowerCorner( const tnlTuple< 2, Real >& lowerCorner );
Tomáš Oberhuber
committed
const tnlTuple< 2, Real >& getLowerCorner() const;
Tomáš Oberhuber
committed
void setUpperCorner( const tnlTuple< 2, Real >& upperCorner );
Tomáš Oberhuber
committed
const tnlTuple< 2, Real >& getUpperCorner() const;
Tomáš Oberhuber
committed
void setSpaceStep( const tnlTuple< 2, Real >& spaceStep );
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
Index getNodeIndex( const Index j, const Index i ) const;
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
//! Method for saving the object to a file as a binary data
bool save( tnlFile& file ) const;
//! Method for restoring the object from a file
bool load( tnlFile& file );
bool save( const tnlString& fileName ) const;
bool load( const tnlString& fileName );
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
tnlTuple< 2, RealType > lowerCorner, upperCorner;
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
};
template< typename Real,
typename Device,
typename Index >
class tnlGrid< 3, Real, Device, Index> : public tnlObject
Tomáš Oberhuber
committed
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
enum { Dimensions = 3};
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
void setDimensions( const Index zSize, const Index ySize, const Index xSize );
Tomáš Oberhuber
committed
const tnlTuple< 3, Index >& getDimensions() const;
Tomáš Oberhuber
committed
void setLowerCorner( const tnlTuple< 3, Real >& lowerCorner );
Tomáš Oberhuber
committed
const tnlTuple< 3, Real >& getLowerCorner() const;
Tomáš Oberhuber
committed
void setUpperCorner( const tnlTuple< 3, Real >& upperCorner );
Tomáš Oberhuber
committed
const tnlTuple< 3, Real >& getUpperCorner() const;
Tomáš Oberhuber
committed
void setSpaceStep( const tnlTuple< 3, Real >& spaceStep );
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
Index getNodeIndex( const Index k, const Index j, const Index i ) const;
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
//! Method for saving the object to a file as a binary data
bool save( tnlFile& file ) const;
//! Method for restoring the object from a file
bool load( tnlFile& file );
bool save( const tnlString& fileName ) const;
bool load( const tnlString& fileName );
tnlTuple< 3, RealType > lowerCorner, upperCorner;
Tomáš Oberhuber
committed
Tomáš Oberhuber
committed
#include <implementation/mesh/tnlGrid1D_impl.h>
#include <implementation/mesh/tnlGrid2D_impl.h>
#include <implementation/mesh/tnlGrid3D_impl.h>