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_FIELD_VALUE_VECTOR_FACE_H__ 00030 #define __CSFL_FIELD_VALUE_VECTOR_FACE_H__ 00031 00032 00033 // Include 00034 #include <csfl/field/core/field.h> 00035 #include <csfl/sys/math/matrix.h> 00036 00037 00038 // Namespace 00039 namespace csfl { 00040 00041 //============================================================================== 00042 // Class IFaceVector 00043 // Description: Represents a vector in the cell faces 00044 //============================================================================== 00045 00046 class IFaceVector 00047 00051 00052 { 00053 00054 public: 00055 00056 static const IFaceVector zero; 00057 00058 IFaceVector(); 00059 ~IFaceVector(); 00060 00062 inline IFaceVector * operator = ( const IFaceVector & ); 00063 00064 IVector *N, *S, *E, *W; 00065 }; 00066 00067 // ============================================================================= 00068 // Inline functions 00069 // ============================================================================= 00070 00071 inline IFaceVector * IFaceVector::operator = ( const IFaceVector &_fv ) 00072 { 00073 00074 S->x = _fv.S->x; 00075 S->y = _fv.S->y; 00076 00077 W->x = _fv.W->x; 00078 W->y = _fv.W->y; 00079 00080 return this; 00081 } 00082 00083 //============================================================================== 00084 // Class IFieldVectorFace 00085 // Description: Represents a discretized physical face vector field 00086 //============================================================================== 00087 00088 class IFieldVectorFace : 00089 public IField 00090 00095 00096 { 00097 00098 public: 00099 00104 IFieldVectorFace( const IString &_name, int _ni, int _nj ); 00105 00110 IFieldVectorFace( const IString &_name, const ISize &_s ); 00111 00115 IFieldVectorFace( IFieldVectorFace *_f ); 00116 00117 ~IFieldVectorFace(); 00118 00124 inline IVector Vector( const IPoint &_p, TDirection _dir ); 00125 00131 inline IVector Vector( int _i, int _j, TDirection _dir ); 00132 00137 void SetVector( int _i, int _j, TDirection _dir, const IVector &_v ); 00138 00139 protected: 00140 IArray2D<IFaceVector> *data; 00141 00142 }; 00143 00144 // ============================================================================= 00145 // Inline functions 00146 // ============================================================================= 00147 00148 inline IVector IFieldVectorFace::Vector( int _i, int _j, TDirection _dir ) 00149 { 00160 return Vector( IPoint( _i, _j ), _dir ); 00161 } 00162 00163 inline IVector IFieldVectorFace::Vector( const IPoint & _p, TDirection _dir ) 00164 { 00165 00166 00167 if ( _p.x>=0.0 && _p.x<fsize.width && _p.y>=0.0 && _p.y<fsize.height) { 00168 00169 switch (_dir) { 00170 case (diNorth) : 00171 return IVector( data->Value(_p).N->x, data->Value(_p).N->y ); 00172 case (diSouth) : 00173 return IVector( data->Value(_p).S->x, data->Value(_p).S->y ); 00174 case (diEast) : 00175 return IVector( data->Value(_p).E->x, data->Value(_p).E->y ); 00176 case (diWest) : 00177 return IVector( data->Value(_p).W->x, data->Value(_p).W->y ); 00178 case (diNULL) : 00179 return IVector( 0.0, 0.0 ); 00180 00181 } 00182 } 00183 00184 return IVector( 0.0, 0.0 ); 00185 00186 } 00187 00188 inline void IFieldVectorFace::SetVector( int _i, int _j, TDirection _dir, const IVector & _v ) 00189 { 00199 00200 if ( _i>=0.0 && _i<fsize.width && _j>=0.0 && _j<fsize.height) { 00201 00202 switch (_dir) { 00203 case (diNorth) : 00204 (*data)(_i,_j).N->x = _v.x; 00205 (*data)(_i,_j).N->y = _v.y; 00206 break; 00207 case (diSouth) : 00208 (*data)(_i,_j).S->x = _v.x; 00209 (*data)(_i,_j).S->y = _v.y; 00210 break; 00211 case (diEast) : 00212 (*data)(_i,_j).E->x = _v.x; 00213 (*data)(_i,_j).E->y = _v.y; 00214 break; 00215 case (diWest) : 00216 (*data)(_i,_j).W->x = _v.x; 00217 (*data)(_i,_j).W->y = _v.y; 00218 break; 00219 } 00220 00221 } 00222 }} // csfl namespace 00223 00224 #endif// __CSFL_FIELD_VALUE_VECTOR_FACE_H__
CFD Project
|
Documents |
Downloads |
Contact us |
Use Terms |
|
|||
© SINMEC/EMC/UFSC,
2001. |
All rights
reserved. |
Last Update: Jan. 18, 2002 |
|