#ifndef INCLUDE_NASTGRID2D_H #define INCLUDE_NASTGRID2D_H //----------------------------------------------------------------------------- // NastGrid2d.h //----------------------------------------------------------------------------- // // Copyright (C) 1998 Technische Universitaet Muenchen, Germany // written by Bernhard Brueck // // This file is part of Nast++ // //----------------------------------------------------------------------------- // CNastGrid2d ist ein einfaches Gitter. Es hat alle Funktionalitaeten von // zweidimensionale Arrays, aber bietet zusaetzlich noch die Moeglichkeit // geometrische Informationen zu erfragen. // // z.B. pntMax() // operator( sizeI()-1, sizeJ()-1) // / // +---------+---------+---------+---------+---------+ --- // | | | | | | ^ // | | | | | | | // | | | | | | | // | | | | | | | // | | | | | | | // +---------+---------+---------+---------+---------+ | // | | | | | | | // | | | | | | | // | | | | | | | // | | | | | | | // | | | | | | | // +---------+---------+---------+---------+---------+ sizeY() // | | | | | | | // | | | | | | | // | | | | | | | // | | | | | | | // | | | | | | | // +---------+---------+---------+---------+---------+ | --- // | | | | | | | ^ // | | | | | | | | // | | | | | | | dy() // | | | | | | | | // | | | | | | v v // +---------+---------+---------+---------+---------+ --- --- // / // operator()(0, 0) // pntMin() // |<- dx()->| // // |<------------------- sizeX() ------------------->| // // // ^ y // | // | // +---> // x // #include "NastConfig.h" #include "NastObject.h" #include "NastBox2d.h" #include "NastArray2d.h" #include "NastPoint2d.h" class CNastGrid2d : public CNastArray2d { public: //------------------------------------------------------------------------- // Konstruktor + Destruktor //------------------------------------------------------------------------- CNastGrid2d( const CNastPoint2d &pntMin, const CNastPoint2d &pntMax, int nSizeI, int nSizeJ ); CNastGrid2d( const CNastBox2d &box, int nSizeI, int nSizeJ ); virtual ~CNastGrid2d(); CNastGrid2d( const CNastGrid2d &other); const CNastGrid2d& operator=( const CNastGrid2d &other ); //------------------------------------------------------------------------- // Memberfunktionen //------------------------------------------------------------------------- // dx() Gitterweite in X-Richtung // dy() Gitterweite in Y-Richtung // absMax() maximaler Absolutwert // box() box um das Gitter herum // pos(i,j) Position eines Gitterelements // interpolate bilinear interpolierter Wert double dx() const; double dy() const; double absMax() const; const CNastBox2d& box() const; CNastPoint2d pos( int i, int j) const; double interpolate( const CNastPoint2d &pnt ) const; //------------------------------------------------------------------------- // Debug //------------------------------------------------------------------------- // debugInfo gibt Information ueber den Zustand des Objekts aus // assertValid testet das Objekt auf Integritaet // virtual void debugDump( CNastDumpContext &dumpContext ) const; virtual void assertValid() const; private: //------------------------------------------------------------------------- // Membervariablen //------------------------------------------------------------------------- double m_dx; // Zellgroesse in x-Richtung double m_dy; // Zellgroesse in y-Richtung double m_rdx; // 1 / m_dx double m_rdy; // 1 / m_dy CNastBox2d m_box; // das Gebiet der Daten }; //------------------------------------------------------------------------- // inline //------------------------------------------------------------------------- inline double CNastGrid2d::dx() const { NAST_ASSERT_VALID( this ); return m_dx; } inline double CNastGrid2d::dy() const { NAST_ASSERT_VALID( this ); return m_dy; } inline const CNastBox2d& CNastGrid2d::box() const { NAST_ASSERT_VALID( this ); return m_box; } inline CNastPoint2d CNastGrid2d::pos( int i, int j) const { NAST_ASSERT_VALID( this ); return CNastPoint2d( m_box.minX() + i * m_dx, m_box.minY() + j * m_dy ); } #endif // INCLUDE_NASTGRID2D_H