|
Intrepid
|
00001 // @HEADER 00002 // ************************************************************************ 00003 // 00004 // Intrepid Package 00005 // Copyright (2007) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) or 00025 // Denis Ridzal (dridzal@sandia.gov) or 00026 // Robert Kirby (robert.c.kirby@ttu.edu) 00027 // 00028 // ************************************************************************ 00029 // @HEADER 00030 00036 namespace Intrepid 00037 { 00038 void ProductTopology::lineProduct2d( const int dim0 , 00039 const int entity0 , 00040 const int dim1 , 00041 const int entity1 , 00042 int &resultdim , 00043 int &resultentity ) 00044 { 00045 // two vertices 00046 if (dim0 == 0 && dim1 == 0) { 00047 resultdim = 0; 00048 if (entity0 == 0 && entity1 == 0) { 00049 resultentity = 0; 00050 } 00051 else if (entity0 == 0 && entity1 == 1) { 00052 resultentity = 3; 00053 } 00054 else if (entity0 == 1 && entity1 == 0) { 00055 resultentity = 1; 00056 } 00057 else if (entity0 == 1 && entity1 == 1) { 00058 resultentity = 2; 00059 } 00060 else { 00061 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00062 "Intrepid::ProductTopology::lineProduct2D: illegal inputs" ); 00063 } 00064 } 00065 else if (dim0 == 0 && dim1 == 1) { 00066 resultdim = 1; 00067 if (entity0 == 0 && entity1 == 0) { 00068 resultentity = 3; 00069 } 00070 else if (entity0 == 1 && entity1 == 0) { 00071 resultentity = 1; 00072 } 00073 else { 00074 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00075 "Intrepid::ProductTopology::lineProduct2D: illegal inputs" ); 00076 } 00077 } 00078 else if (dim0 == 1 && dim1 == 0) { 00079 resultdim = 1; 00080 if (entity0 == 0 && entity1 == 0) { 00081 resultentity = 0; 00082 } 00083 else if (entity0 == 0 && entity1 == 1) { 00084 resultentity = 2; 00085 } 00086 else { 00087 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00088 "Intrepid::ProductTopology::lineProduct2D: illegal inputs" ); 00089 } 00090 } 00091 else if (dim0 == 1 && dim1 == 1) { 00092 resultdim = 2; 00093 if (entity0 == 0 && entity1 == 0) { 00094 resultentity = 0; 00095 } 00096 else { 00097 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00098 "Intrepid::ProductTopology::lineProduct2D: illegal inputs" ); 00099 } 00100 } 00101 else { 00102 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00103 "Intrepid::ProductTopology::lineProduct2D: illegal inputs" ); 00104 } 00105 00106 } 00107 00108 void ProductTopology::lineProduct3d( const int dim0 , 00109 const int entity0 , 00110 const int dim1 , 00111 const int entity1 , 00112 const int dim2 , 00113 const int entity2 , 00114 int &resultdim , 00115 int &resultentity ) 00116 { 00117 // on vertex 00118 if (dim0 == 0 && dim1 == 0 && dim2 == 0) { 00119 resultdim = 0; 00120 if (entity0 == 0 && entity1 == 0 && entity2 == 0 ) { 00121 resultentity = 0; 00122 } 00123 else if (entity0 == 0 && entity1 == 0 && entity2 == 1 ) { 00124 resultentity = 4; 00125 } 00126 else if (entity0 == 0 && entity1 == 1 && entity2 == 0 ) { 00127 resultentity = 3; 00128 } 00129 else if (entity0 == 0 && entity1 == 1 && entity2 == 1 ) { 00130 resultentity = 7; 00131 } 00132 else if (entity0 == 1 && entity1 == 0 && entity2 == 0) { 00133 resultentity = 1; 00134 } 00135 else if (entity0 == 1 && entity1 == 0 && entity2 == 1) { 00136 resultentity = 5; 00137 } 00138 else if (entity0 == 1 && entity1 == 1 && entity2 == 0) { 00139 resultentity = 2; 00140 } 00141 else if (entity0 == 1 && entity1 == 1 && entity2 == 1) { 00142 resultentity = 6; 00143 } 00144 else { 00145 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00146 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00147 } 00148 } 00149 // LINES 00150 // z coord is on line, other two on vertex, this makes an ascending vertical edge 00151 else if (dim0 == 0 && dim1 == 0 && dim2 == 1) { 00152 resultdim = 1; 00153 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00154 resultentity = 8; 00155 } 00156 else if (entity0 == 0 && entity1 == 1 && entity2 == 0) { 00157 resultentity = 11; 00158 } 00159 else if (entity0 == 1 && entity1 == 0 && entity2 == 0) { 00160 resultentity = 9; 00161 } 00162 else if (entity0 == 1 && entity1 == 1 && entity2 == 0) { 00163 resultentity = 10; 00164 } 00165 else { 00166 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00167 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00168 } 00169 } 00170 // only y coord is on line, other two on vertex, this makes line along y axis 00171 else if (dim0 == 0 && dim1 == 1 && dim2 == 0) { 00172 resultdim = 1; 00173 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00174 resultentity = 3; 00175 } 00176 else if (entity0 == 0 && entity1 == 0 && entity2 == 1) { 00177 resultentity = 7; 00178 } 00179 else if (entity0 == 1 && entity1 == 0 && entity2 == 0) { 00180 resultentity = 1; 00181 } 00182 else if (entity0 == 1 && entity1 == 0 && entity2 == 1) { 00183 resultentity = 5; 00184 } 00185 else { 00186 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00187 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00188 } 00189 } 00190 // x dof is on line, others on vertex. 00191 else if (dim0 == 1 && dim1 == 0 && dim2 == 0) { 00192 resultdim = 1; 00193 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00194 resultentity = 0; 00195 } 00196 else if (entity0 == 0 && entity1 == 0 && entity2 == 1) { 00197 resultentity = 4; 00198 } 00199 else if (entity0 == 0 && entity1 == 1 && entity2 == 0) { 00200 resultentity = 2; 00201 } 00202 else if (entity0 == 0 && entity1 == 1 && entity2 == 1) { 00203 resultentity = 6; 00204 } 00205 else { 00206 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00207 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00208 } 00209 } 00210 // FACES, these require two of the line dimensions to be 1 00211 else if (dim0 == 0 && dim1 == 1 && dim2 == 1) { 00212 resultdim = 2; 00213 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00214 resultentity = 3; 00215 } 00216 else if (entity0 == 1 && entity1 == 0 && entity2 == 0) { 00217 resultentity = 1; 00218 } 00219 else { 00220 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00221 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00222 } 00223 } 00224 else if (dim0 == 1 && dim1 == 0 && dim2 == 1) { 00225 resultdim = 2; 00226 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00227 resultentity = 0; 00228 } 00229 else if (entity0 == 0 && entity1 == 1 && entity2 == 0) { 00230 resultentity = 2; 00231 } 00232 else { 00233 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00234 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00235 } 00236 } 00237 else if (dim0 == 1 && dim1 == 1 && dim2 == 0) { 00238 resultdim = 2; 00239 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00240 resultentity = 4; 00241 } 00242 else if (entity0 == 0 && entity1 == 0 && entity2 == 1) { 00243 resultentity = 5; 00244 } 00245 else { 00246 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00247 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00248 } 00249 } 00250 // CELL ITSELF 00251 else if (dim0 == 1 && dim1 == 1 && dim2 == 1) { 00252 resultdim = 3; 00253 if (entity0 == 0 && entity1 == 0 && entity2 == 0) { 00254 resultentity = 0; 00255 } 00256 else { 00257 TEST_FOR_EXCEPTION( true , std::invalid_argument , 00258 "Intrepid::ProductTopology::lineProduct3D: illegal inputs" ); 00259 } 00260 } 00261 } 00262 }
1.7.4