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 00028 // File Define 00029 #ifndef __CSFL_GEOM_GRID_GRID_H__ 00030 #define __CSFL_GEOM_GRID_GRID_H__ 00031 00032 00033 // Include 00034 #include <csfl/sys/core/sflobject.h> 00035 #include <csfl/sys/core/types.h> 00036 #include <csfl/sys/geom/dpolygon.h> 00037 #include <csfl/geom/grid/mesh.h> 00038 #include <csfl/sys/math/linearsys9d.h> 00039 #include <csfl/math/solver/solver.h> 00040 00041 00042 // Namespace 00043 namespace csfl { 00044 00045 00049 typedef 00050 enum _TDirection { 00051 diNULL, 00052 diNorth, 00053 diSouth, 00054 diEast, 00055 diWest, 00056 diSEast, 00057 diSWest, 00058 diNEast, 00059 diNWest 00060 } 00061 TDirection; 00062 00063 00067 00068 typedef 00069 enum _TDomainRegion { 00070 drNULL, 00071 drCenter, 00072 drNorthRow, 00073 drSouthRow, 00074 drEastColumn, 00075 drWestColumn, 00076 drNorthEastEdge, 00077 drNorthWestEdge, 00078 drSouthEastEdge, 00079 drSouthWestEdge, 00080 drSolidBlock, 00081 drNorthWestCorner, 00082 drNorthEastCorner, 00083 drSouthWestCorner, 00084 drSouthEastCorner 00085 } 00086 TDomainRegion; 00087 00088 00089 class IMetric; 00090 00091 00092 00093 class IGrid : 00094 virtual public ISFLObject 00095 00101 00102 { 00103 00104 public: 00105 00110 IGrid( int _row, int _col ); 00111 00118 IGrid( const ISize &_size = ISize::zero ); 00119 00123 IGrid( IMesh *_mesh ); 00124 00128 IGrid( IGrid *_grid ); 00129 ~IGrid(); 00130 00132 void SetID( const IString & _id ) { id = _id; } 00133 00135 IString ID() { return id; } 00136 00138 int Serial() { return serial; } 00139 00145 ISize Size() { return size; } 00146 00151 int Ni() { return ni; } 00152 00157 int Nj() { return nj; } 00158 00163 int VolNumber() const { return ni*nj; } 00164 00171 inline virtual IDPoint Node( const IPoint &_p ) const; 00172 00179 inline virtual IDPoint Node( int _x, int _y ) const; 00180 00184 inline virtual IDPoint SWNode() const; 00185 00189 inline virtual IDPoint SENode() const; 00190 00194 inline virtual IDPoint NWNode() const; 00195 00199 inline virtual IDPoint NENode() const; 00200 00201 00206 inline virtual void SetNode( const IPoint &_p, const IDPoint &_value ); 00207 00212 inline virtual void SetNode( int _x, int _y, const IDPoint &_value ); 00213 00218 IMesh * Mesh() { return mesh; } 00219 00223 IDPolygon * Geometry() const; 00224 00231 IDPoint VolumeCenter( const IPoint &_p ); 00232 00239 IDPoint VolumeCenter( int _x, int _y ); 00240 00250 IDPoint FaceCenter( const IPoint &_p, TDirection _dir ); 00251 00259 IDPoint FaceCenter( int _x, int _y, TDirection _dir ); 00260 00262 IMetric * Metric(); 00263 00265 void UpDateMetric(); 00266 00271 void Rotate( const double & angle, const IDPoint & origin = IDPoint::zero ); 00272 00276 void Translate( const double &_x ,const double &_y ); 00277 00282 void MirrorX(); 00283 00288 void MirrorY(); 00289 00293 void TransposeXY(); 00294 00299 void InvertI(); 00300 00305 void InvertJ(); 00306 00308 void TransposeIJ(); 00309 00311 void RefineI( const int & n ); 00312 00314 void RefineJ( const int & n ); 00315 00317 void RefineIJ( const int & n ); 00318 00320 virtual void Read( istream &_is ); 00321 00323 virtual void Write( ostream &_os ); 00324 00329 void WriteVolumeCenter( ostream &_osx, ostream &_osy ); 00330 00334 void WriteVolumeCenterX( ostream &_osx); 00335 00339 void WriteVolumeCenterY( ostream &_osy); 00340 00341 00342 protected: 00343 IString id; 00344 int ni, nj; 00345 int serial; 00346 00347 ISize size; 00348 IMesh *mesh; 00349 00350 IMetric *metric; 00351 00352 bool ischanged; 00353 00354 00355 public: 00356 00362 friend IGrid * MergeGrids( IGrid *_grid1, IGrid *_grid2, const TDirection &_dir1, 00363 const TDirection &_dir2, const bool &_move ); 00364 00365 friend IGrid * ConnectGrids( IGrid *_grid1, IGrid *_grid2, const TDirection &_dir1, 00366 const TDirection &_dir2, const bool &_move ); 00367 00368 }; 00369 00370 // Inline functions 00371 00372 inline IDPoint IGrid::Node( const IPoint &_p ) const 00373 { 00374 return mesh->Node( _p.x, _p.y ); 00375 } 00376 00377 inline IDPoint IGrid::Node( int _x, int _y ) const 00378 { 00379 return mesh->Node( _x, _y ); 00380 } 00381 00382 inline IDPoint IGrid::SWNode() const 00383 { 00384 return mesh->Node( 0, 0 ); 00385 } 00386 00387 inline IDPoint IGrid::SENode() const 00388 { 00389 return mesh->Node( ni, 0 ); 00390 } 00391 00392 inline IDPoint IGrid::NWNode() const 00393 { 00394 return mesh->Node( 0, nj ); 00395 } 00396 00397 inline IDPoint IGrid::NENode() const 00398 { 00399 return mesh->Node( ni, nj ); 00400 } 00401 00402 00403 inline void IGrid::SetNode( const IPoint &_p, const IDPoint & _value ) 00404 { 00405 mesh->SetNode( _p.x, _p.y , _value ); 00406 ischanged = true; 00407 } 00408 00409 inline void IGrid::SetNode( int _x, int _y, const IDPoint & _value ) 00410 { 00411 mesh->SetNode( _x, _y, _value ); 00412 ischanged = true; 00413 } 00414 00415 00416 } // csfl namespace 00417 00418 #endif// __CSFL_GEOM_GRID_GRID_H__ 00419
CFD Project
|
Documents |
Downloads |
Contact us |
Use Terms |
|
|||
© SINMEC/EMC/UFSC,
2001. |
All rights
reserved. |
Last Update: Jan. 18, 2002 |
|