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_SYS_MATH_LINEARSYSTEM9D_H__ 00030 #define __CSFL_SYS_MATH_LINEARSYSTEM9D_H__ 00031 00032 00033 // Include 00034 #include <csfl/sys/math/vector.h> 00035 #include <csfl/sys/math/matrix.h> 00036 #include <csfl/sys/math/linearsys.h> 00037 00038 00039 // Namespace 00040 namespace csfl { 00041 00042 00043 00044 class ILinearSystem9D : public ILinearSystem 00045 00050 00051 { 00052 00053 public: 00054 00059 ILinearSystem9D( int _row, int _col ); 00060 00062 ILinearSystem9D( const ISize &_size ); 00063 ILinearSystem9D( ILinearSystem9D *_lsys ); 00064 ~ILinearSystem9D(); 00065 00069 inline double MatrixA( int _i, int _j ); 00070 00077 inline void MatrixA( int _i, int _j, double _val ); 00078 00079 }; 00080 00081 00082 // Inline functions 00083 00084 inline double ILinearSystem9D::MatrixA( int _i, int _j ) 00085 { 00086 //Mudando o formato de A 00087 int lni = lsize.width; 00088 int lnj = lsize.height; 00089 int ni = gsize.width; 00090 int nj = gsize.height; 00091 00092 int x = _i; 00093 int y = _j; 00094 00095 if ( _i>=0 && _i<lni && _j>=0 && _j<lnj ) { 00096 00097 if (x==y) 00098 return (*matA)( 0, y ); 00099 00100 else if (x==(y+1)) 00101 return (*matA)( 1, y ); 00102 00103 else if (x==(y-1)) 00104 return (*matA)( 5, y ); 00105 00106 else if (x==(y+(ni-1))) 00107 return (*matA)( 2, y ); 00108 00109 else if (x==(y+ni)) 00110 return (*matA)( 3, y ); 00111 00112 else if (x==(y+(ni+1))) 00113 return (*matA)( 4, y ); 00114 00115 else if (x==((y-ni)+1)) 00116 return (*matA)( 6, y ); 00117 00118 else if (x==(y-ni)) 00119 return (*matA)( 7, y ); 00120 00121 else if (x==((y-ni)-1)) 00122 return (*matA)( 8, y ); 00123 00124 else 00125 return 0.0; 00126 } 00127 else 00128 return 0.0; 00129 } 00130 00131 inline void ILinearSystem9D::MatrixA( int _i, int _j, double _val ) 00132 { 00133 //Mudando o formato de A 00134 int lni = lsize.width; 00135 int lnj = lsize.height; 00136 int ni = gsize.width; 00137 int nj = gsize.height; 00138 00139 int x = _i; 00140 int y = _j; 00141 00142 if ( _i>=0 && _i<lni && _j>=0 && _j<lnj ) 00143 { 00144 00145 if (x==y) 00146 (*matA)( 0, y )= _val; 00147 else 00148 if (x==(y+1)) 00149 (*matA)( 1, y )= _val; 00150 else 00151 if (x==(y-1)) 00152 (*matA)( 5, y )= _val; 00153 else 00154 if (x==((y+ni)-1)) 00155 (*matA)( 2, y )= _val; 00156 else 00157 if (x==(y+ni)) 00158 (*matA)( 3, y )= _val; 00159 else 00160 if (x==(y+ni)+1) 00161 (*matA)( 4, y )= _val; 00162 else 00163 if (x==((y-ni)+1)) 00164 (*matA)( 6, y )= _val; 00165 else 00166 if (x==(y-ni)) 00167 (*matA)( 7, y )= _val; 00168 else 00169 if (x==((y-ni)-1)) 00170 (*matA)( 8, y )= _val; 00171 } 00172 } 00173 00174 } // csfl namespace 00175 00176 #endif // __CSFL_SYS_MATH_LINEARSYSTEM9D_H__ 00177
CFD Project
|
Documents |
Downloads |
Contact us |
Use Terms |
|
|||
© SINMEC/EMC/UFSC,
2001. |
All rights
reserved. |
Last Update: Jan. 18, 2002 |
|