Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

mesh.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001 The AUTHORS 
00003  *   Romeu Andre' Pieritz, Ph.D.        - romeu_pieritz@hotmail.com
00004  *   Rafael Mendes, Eng.                – mendes_rafael@yahoo.com
00005  *   Rodrigo Ferraz de Andrade, Eng.    – rferraz@iname.com 
00006  * All rights reserved.
00007  *
00008  * Permission to use, copy and distribute this software and its
00009  * documentation for educational and personal use, without fee is hereby granted, 
00010  * provided that the above copyright notice and the following
00011  * two paragraphs appear in all copies of this software.
00012  *
00013  * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR
00014  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
00015  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS
00016  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00017  *
00018  * THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES,
00019  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00020  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HERE UNDER IS
00021  * ON AN "AS IS" BASIS, AND THE AUTHORS HAVE NO OBLIGATION TO
00022  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00023  *
00024  * SINMEC Lab. - CFD Sinflow Project - http://www.sinmec.ufsc.br/cfd
00025  */
00026 
00027 // File Define
00028 #ifndef __CSFL_GEOM_GRID_MESH_H__
00029 #define __CSFL_GEOM_GRID_MESH_H__
00030 
00031 
00032 // Include
00033 #include <csfl/sys/math/array2d.h>
00034 #include <csfl/sys/geom/dpoint.h>
00035 #include <csfl/sys/core/string.h>
00036 #include <csfl/sys/core/sflobject.h>
00037 #include <csfl/sys/math/vector.h>
00038 
00039 
00040 // Namespace
00041 namespace csfl {
00042 
00043 //==============================================================================
00044 //              Class IMesh
00045 //              Description: Base class for mesh objects
00046 //==============================================================================
00047 
00048 class IMesh : 
00049         virtual public ISFLObject
00050 
00055 
00056 {
00057 
00058 public:
00059     
00064         IMesh( int _row, int _col );
00065 
00069 
00070         IMesh( const ISize &_size = ISize::zero );
00071 
00075         IMesh( IMesh *_mesh );
00076         
00077         ~IMesh();
00078           
00080     void SetID( const IString & _id ) { id = _id; }
00081 
00083     IString ID() { return id; }
00084 
00090     ISize Size() { return ISize( ni, nj ); }
00091 
00096         int Ni() { return ni; }
00097         
00102         int Nj() { return nj; }
00103 
00109         inline virtual IDPoint Node( const IPoint &_p ) const;
00110 
00116         inline virtual IDPoint Node( int _x, int _y ) const;
00117 
00122         inline virtual void SetNode( const IPoint &_p, const IDPoint &_value );
00123 
00128         inline virtual void SetNode( int _x, int _y, const IDPoint &_value );
00129     
00134     IArray2D<IDPoint> * Data() { return data; }
00135 
00137     void Read( istream &_is );
00138         
00143     void Write( ostream &_os );
00144 
00148         void SetMesh( IMesh *_mesh );
00149         
00154         void SetX( Vector *_v );
00155 
00160         void SetX( IMesh *_mesh );
00161         
00166         void SetY( Vector *_v );
00167 
00172         void SetY( IMesh *_mesh );
00173         
00178         void InvertI();
00179         
00184         void InvertJ();
00185         
00187         void TransposeIJ();
00188 
00190         void Translate( const double &_x ,const double &_y );
00191 
00192 
00193 
00194 private:
00195         int ni, nj;
00196     IString id;
00197         IArray2D<IDPoint> *data;
00198 
00199 
00200 };
00201 
00202 // =============================================================================
00203 // Inline functions
00204 // =============================================================================
00205 
00206 inline IDPoint IMesh::Node( const IPoint &_p ) const
00207 {
00208         return data->Value( _p );
00209 }
00210 
00211 inline IDPoint IMesh::Node( int _x, int _y ) const
00212 {
00213         return data->Value( _x, _y );
00214 }
00215 
00216 inline void IMesh::SetNode( const IPoint &_p, const IDPoint & _value )
00217 {
00218     data->SetValue( _p, _value );
00219 }
00220 
00221 inline void IMesh::SetNode( int _x, int _y, const IDPoint & _value )
00222 {
00223     data->SetValue( _x, _y, _value );
00224 }
00225 } // csfl namespace
00226 
00227 #endif // __CSFL_GEOM_GRID_MESH_H__
00228 

 

CFD Project | Documents | Downloads | Contact us | Use Terms

 

© SINMEC/EMC/UFSC, 2001.

All rights reserved.

Last Update: Jan. 18, 2002

 Webmaster