![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsFEMMeshHexahedraGen.cpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (02/18/2010) 00009 UPDATE (04/16/2010) 00010 ******************************************************************************/ 00011 #include "TAPsFEMMeshHexahedraGen.hpp" 00012 // Using Inclusion Model (i.e. definitions are included in declarations) 00013 // (this name.cpp is included in name.hpp) 00014 // Each friend is defined directly inside its declaration. 00015 00016 BEGIN_NAMESPACE_TAPs__FEM 00017 //============================================================================= 00018 //template <typename T> std::vector< Hexahedron<T> > * MeshHexahedraGen<T>::m_pListOfElements = NULL; 00019 //template <typename T> std::vector< Vector3<T> > * MeshHexahedraGen<T>::m_pListOfDeformedMeshNodes = NULL; 00020 //template <typename T> std::vector< Vector3<T> > * MeshHexahedraGen<T>::m_pListOfUndeformedMeshNodes = NULL; 00021 //----------------------------------------------------------------------------- 00022 00024 //template <typename T> 00025 //void MeshHexahedraGen<T>::SetAccessors ( MeshHexahedra<T> & rHexFemMesh ) 00026 //{ 00027 // m_pListOfElements = &( rHexFemMesh.RetListOfElements() ); 00028 // m_pListOfDeformedMeshNodes = &( rHexFemMesh.RetListOfDeformedMeshNodes() ); 00029 // m_pListOfUndeformedMeshNodes = &( rHexFemMesh.RetListOfUndeformedMeshNodes() ); 00030 //} 00032 //template <typename T> 00033 //void MeshHexahedraGen<T>::ClearAccessors () 00034 //{ 00035 // m_pListOfElements = NULL; 00036 // m_pListOfDeformedMeshNodes = NULL; 00037 // m_pListOfUndeformedMeshNodes = NULL; 00038 //} 00039 00040 //----------------------------------------------------------------------------- 00041 template <typename T, typename DATA> 00042 void MeshHexahedraGen<T,DATA>::OneElementMesh ( MeshHexahedra<T> & rHexFemMesh, T mass, T YoungsModulus, T PoissonsRatio ) 00043 { 00044 // 3---------2 ^ y 00045 // /| /| | 00046 // / | / | | 00047 // 7---------6 | | 00048 // | 0- - - | -1 +------>x 00049 // | / | / / 00050 // |/ |/ / 00051 // 4---------5 v z 00052 00053 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00054 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00055 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00056 00057 // Clear the mesh 00058 E.clear(); 00059 Nd.clear(); 00060 Nu.clear(); 00061 00062 /* 00063 // 8 deformed nodes 00064 Nd.push_back( Vector3<T>(-1,-1,-1) ); 00065 Nd.push_back( Vector3<T>( 1,-1,-1) ); 00066 Nd.push_back( Vector3<T>( 1, 1,-1) ); 00067 Nd.push_back( Vector3<T>(-1, 1,-1) ); 00068 Nd.push_back( Vector3<T>(-1,-1, 1) ); 00069 Nd.push_back( Vector3<T>( 1,-1, 1) ); 00070 Nd.push_back( Vector3<T>( 1, 1, 1) ); 00071 Nd.push_back( Vector3<T>(-1, 1, 1) ); 00072 // 8 undeformed nodes 00073 Nu.push_back( Vector3<T>(-1,-1,-1) ); 00074 Nu.push_back( Vector3<T>( 1,-1,-1) ); 00075 Nu.push_back( Vector3<T>( 1, 1,-1) ); 00076 Nu.push_back( Vector3<T>(-1, 1,-1) ); 00077 Nu.push_back( Vector3<T>(-1,-1, 1) ); 00078 Nu.push_back( Vector3<T>( 1,-1, 1) ); 00079 Nu.push_back( Vector3<T>( 1, 1, 1) ); 00080 Nu.push_back( Vector3<T>(-1, 1, 1) ); 00081 //*/ 00082 00083 //* 00084 //----------------------------------------------------- 00085 // TEST 00086 // This data gives 00087 // | 0 0.5 0 | 00088 // J = | -0.5 0 | 00089 // | 0 0 0.375 | 00090 // 8 deformed nodes 00091 Nd.push_back( Vector3<T>(1,0,0) ); 00092 Nd.push_back( Vector3<T>(1,1,0) ); 00093 Nd.push_back( Vector3<T>(0,1,0) ); 00094 Nd.push_back( Vector3<T>(0,0,0) ); 00095 Nd.push_back( Vector3<T>(1,0,0.75) ); 00096 Nd.push_back( Vector3<T>(1,1,0.75) ); 00097 Nd.push_back( Vector3<T>(0,1,0.75) ); 00098 Nd.push_back( Vector3<T>(0,0,0.75) ); 00099 // 8 undeformed nodes 00100 Nu.push_back( Vector3<T>(1,0,0) ); 00101 Nu.push_back( Vector3<T>(1,1,0) ); 00102 Nu.push_back( Vector3<T>(0,1,0) ); 00103 Nu.push_back( Vector3<T>(0,0,0) ); 00104 Nu.push_back( Vector3<T>(1,0,0.75) ); 00105 Nu.push_back( Vector3<T>(1,1,0.75) ); 00106 Nu.push_back( Vector3<T>(0,1,0.75) ); 00107 Nu.push_back( Vector3<T>(0,0,0.75) ); 00108 //----------------------------------------------------- 00109 //*/ 00110 00111 E.push_back( Hexahedron<T>( 00112 &Nd, // the 8 deformed nodes 00113 &Nu, // the 8 undeformed nodes 00114 YoungsModulus, // Young's modulus 00115 PoissionsRatio, // Poisson's ratio 00116 0, 1, 2, 3, 4, 5, 6, 7 ) 00117 ); 00118 00119 rHexFemMesh.SetSizeOfStiffnessMatrix(); 00120 rHexFemMesh.AssembleStiffnessMatrix(); 00121 00122 // Allocate data for simulation 00123 rHexFemMesh.AllocateDataForSimulation( mass ); 00124 } 00125 00126 //----------------------------------------------------------------------------- 00127 template <typename T, typename DATA> 00128 void MeshHexahedraGen<T,DATA>::TwoElementMeshJoinByNode ( MeshHexahedra<T> & rHexFemMesh, T mass, T YoungsModulus, T PoissonsRatio ) 00129 { 00130 // JOIN AT PT 0 00131 // 3---------2 ^ y 00132 // 11-----/| -10 /| | 00133 // /| / | /| / | | 00134 // / | 7---------6 | | 00135 // 14------| -0- - - | -1 +------>x 00136 // | 8- -| /| -9 | / / 00137 // | / |/ | / |/ / 00138 // |/ 4---------5 v z 00139 // 12---------13 00140 00141 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00142 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00143 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00144 00145 // Clear the mesh 00146 E.clear(); 00147 Nd.clear(); 00148 Nu.clear(); 00149 00150 // 15 deformed nodes 00151 // 1st element // Pt# 00152 Nd.push_back( Vector3<T>( 0, 0, 0) ); // 0 00153 Nd.push_back( Vector3<T>( 1, 0, 0) ); // 1 00154 Nd.push_back( Vector3<T>( 1, 1, 0) ); // 2 00155 Nd.push_back( Vector3<T>( 0, 1, 0) ); // 3 00156 Nd.push_back( Vector3<T>( 0, 0, 1) ); // 4 00157 Nd.push_back( Vector3<T>( 1, 0, 1) ); // 5 00158 Nd.push_back( Vector3<T>( 1, 1, 1) ); // 6 00159 Nd.push_back( Vector3<T>( 0, 1, 1) ); // 7 00160 // 2nd element 00161 Nd.push_back( Vector3<T>(-1,-1,-1) ); // 8 00162 Nd.push_back( Vector3<T>( 0,-1,-1) ); // 9 00163 Nd.push_back( Vector3<T>( 0, 0,-1) ); // 10 00164 Nd.push_back( Vector3<T>(-1, 0,-1) ); // 11 00165 Nd.push_back( Vector3<T>(-1,-1, 0) ); // 12 00166 Nd.push_back( Vector3<T>( 0,-1, 0) ); // 13 00167 //Nd.push_back( Vector3<T>( 0, 0, 0) ); // == 0 00168 Nd.push_back( Vector3<T>(-1, 0, 0) ); // 14 00169 00170 // 15 undeformed nodes 00171 // 1st element // Pt# 00172 Nu.push_back( Vector3<T>( 0, 0, 0) ); // 0 00173 Nu.push_back( Vector3<T>( 1, 0, 0) ); // 1 00174 Nu.push_back( Vector3<T>( 1, 1, 0) ); // 2 00175 Nu.push_back( Vector3<T>( 0, 1, 0) ); // 3 00176 Nu.push_back( Vector3<T>( 0, 0, 1) ); // 4 00177 Nu.push_back( Vector3<T>( 1, 0, 1) ); // 5 00178 Nu.push_back( Vector3<T>( 1, 1, 1) ); // 6 00179 Nu.push_back( Vector3<T>( 0, 1, 1) ); // 7 00180 // 2nd element 00181 Nu.push_back( Vector3<T>(-1,-1,-1) ); // 8 00182 Nu.push_back( Vector3<T>( 0,-1,-1) ); // 9 00183 Nu.push_back( Vector3<T>( 0, 0,-1) ); // 10 00184 Nu.push_back( Vector3<T>(-1, 0,-1) ); // 11 00185 Nu.push_back( Vector3<T>(-1,-1, 0) ); // 12 00186 Nu.push_back( Vector3<T>( 0,-1, 0) ); // 13 00187 //Nu.push_back( Vector3<T>( 0, 0, 0) ); // == 0 00188 Nu.push_back( Vector3<T>(-1, 0, 0) ); // 14 00189 00190 // 1st element 00191 E.push_back( Hexahedron<T>( 00192 &Nd, // the 8 deformed nodes 00193 &Nu, // the 8 undeformed nodes 00194 YoungsModulus, // Young's modulus 00195 PoissionsRatio, // Poisson's ratio 00196 0, 1, 2, 3, 4, 5, 6, 7 ) 00197 ); 00198 // 2nd element 00199 E.push_back( Hexahedron<T>( 00200 &Nd, // the 8 deformed nodes 00201 &Nu, // the 8 undeformed nodes 00202 YoungsModulus, // Young's modulus 00203 PoissionsRatio, // Poisson's ratio 00204 8, 9, 10, 11, 12, 13, 0, 14 ) 00205 ); 00206 00207 rHexFemMesh.SetSizeOfStiffnessMatrix(); 00208 rHexFemMesh.AssembleStiffnessMatrix(); 00209 00210 // Allocate data for simulation 00211 rHexFemMesh.AllocateDataForSimulation( mass ); 00212 } 00213 00214 //----------------------------------------------------------------------------- 00215 template <typename T, typename DATA> 00216 void MeshHexahedraGen<T,DATA>::TwoElementMeshJoinByEdge ( MeshHexahedra<T> & rHexFemMesh, T mass, T YoungsModulus, T PoissonsRatio ) 00217 { 00218 // JOIN AT EDGE 0-4 00219 // 3---------2 ^ y 00220 // /| /| | 00221 // / | / | | 00222 // 7---------6 | | 00223 // 10------| -0- - - | -1 +------>x 00224 // /| | /| | / / 00225 // / | |/ | |/ / 00226 // 13---------4---------5 v z 00227 // | 8------|--9 00228 // | / | / 00229 // |/ |/ 00230 // 11---------12 00231 00232 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00233 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00234 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00235 00236 // Clear the mesh 00237 E.clear(); 00238 Nd.clear(); 00239 Nu.clear(); 00240 00241 // 15 deformed nodes 00242 // 1st element // Pt# 00243 Nd.push_back( Vector3<T>( 0, 0, 0) ); // 0 00244 Nd.push_back( Vector3<T>( 1, 0, 0) ); // 1 00245 Nd.push_back( Vector3<T>( 1, 1, 0) ); // 2 00246 Nd.push_back( Vector3<T>( 0, 1, 0) ); // 3 00247 Nd.push_back( Vector3<T>( 0, 0, 1) ); // 4 00248 Nd.push_back( Vector3<T>( 1, 0, 1) ); // 5 00249 Nd.push_back( Vector3<T>( 1, 1, 1) ); // 6 00250 Nd.push_back( Vector3<T>( 0, 1, 1) ); // 7 00251 // 2nd element 00252 Nd.push_back( Vector3<T>(-1,-1, 0) ); // 8 00253 Nd.push_back( Vector3<T>( 0,-1, 0) ); // 9 00254 //Nd.push_back( Vector3<T>( 0, 0, 0) ); // == 0 00255 Nd.push_back( Vector3<T>(-1, 0, 0) ); // 10 00256 Nd.push_back( Vector3<T>(-1,-1, 1) ); // 11 00257 Nd.push_back( Vector3<T>( 0,-1, 1) ); // 12 00258 //Nd.push_back( Vector3<T>( 0, 0, 1) ); // == 4 00259 Nd.push_back( Vector3<T>(-1, 0, 1) ); // 13 00260 00261 // 15 undeformed nodes 00262 // 1st element // Pt# 00263 Nu.push_back( Vector3<T>( 0, 0, 0) ); // 0 00264 Nu.push_back( Vector3<T>( 1, 0, 0) ); // 1 00265 Nu.push_back( Vector3<T>( 1, 1, 0) ); // 2 00266 Nu.push_back( Vector3<T>( 0, 1, 0) ); // 3 00267 Nu.push_back( Vector3<T>( 0, 0, 1) ); // 4 00268 Nu.push_back( Vector3<T>( 1, 0, 1) ); // 5 00269 Nu.push_back( Vector3<T>( 1, 1, 1) ); // 6 00270 Nu.push_back( Vector3<T>( 0, 1, 1) ); // 7 00271 // 2nd element 00272 Nu.push_back( Vector3<T>(-1,-1, 0) ); // 8 00273 Nu.push_back( Vector3<T>( 0,-1, 0) ); // 9 00274 //Nu.push_back( Vector3<T>( 0, 0, 0) ); // == 0 00275 Nu.push_back( Vector3<T>(-1, 0, 0) ); // 10 00276 Nu.push_back( Vector3<T>(-1,-1, 1) ); // 11 00277 Nu.push_back( Vector3<T>( 0,-1, 1) ); // 12 00278 //Nu.push_back( Vector3<T>( 0, 0, 1) ); // == 4 00279 Nu.push_back( Vector3<T>(-1, 0, 1) ); // 13 00280 00281 // 1st element 00282 E.push_back( Hexahedron<T>( 00283 &Nd, // the 8 deformed nodes 00284 &Nu, // the 8 undeformed nodes 00285 YoungsModulus, // Young's modulus 00286 PoissionsRatio, // Poisson's ratio 00287 0, 1, 2, 3, 4, 5, 6, 7 ) 00288 ); 00289 // 2nd element 00290 E.push_back( Hexahedron<T>( 00291 &Nd, // the 8 deformed nodes 00292 &Nu, // the 8 undeformed nodes 00293 YoungsModulus, // Young's modulus 00294 PoissionsRatio, // Poisson's ratio 00295 8, 9, 0, 10, 11, 12, 4, 13 ) 00296 ); 00297 00298 rHexFemMesh.SetSizeOfStiffnessMatrix(); 00299 rHexFemMesh.AssembleStiffnessMatrix(); 00300 00301 // Allocate data for simulation 00302 rHexFemMesh.AllocateDataForSimulation( mass ); 00303 } 00304 00305 //----------------------------------------------------------------------------- 00306 template <typename T, typename DATA> 00307 void MeshHexahedraGen<T,DATA>::TwoElementMeshJoinByFace ( MeshHexahedra<T> & rHexFemMesh, T mass, T YoungsModulus, T PoissonsRatio ) 00308 { 00309 // JOIN AT FACE 4-5-6-7 00310 // 3---------2 ^ y 00311 // /| /| | 00312 // / | / | | 00313 // 7---------6 | | 00314 // /| 0- - -/| -1 +------>x 00315 // / | / / | / / 00316 // 11---------10 |/ / 00317 // | 4------|--5 v z 00318 // | / | / 00319 // |/ |/ 00320 // 8---------9 00321 00322 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00323 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00324 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00325 00326 // Clear the mesh 00327 E.clear(); 00328 Nd.clear(); 00329 Nu.clear(); 00330 00331 // 15 deformed nodes 00332 // 1st element // Pt# 00333 Nd.push_back( Vector3<T>( 0, 0, 0) ); // 0 00334 Nd.push_back( Vector3<T>( 1, 0, 0) ); // 1 00335 Nd.push_back( Vector3<T>( 1, 1, 0) ); // 2 00336 Nd.push_back( Vector3<T>( 0, 1, 0) ); // 3 00337 Nd.push_back( Vector3<T>( 0, 0, 1) ); // 4 00338 Nd.push_back( Vector3<T>( 1, 0, 1) ); // 5 00339 Nd.push_back( Vector3<T>( 1, 1, 1) ); // 6 00340 Nd.push_back( Vector3<T>( 0, 1, 1) ); // 7 00341 // 2nd element 00342 Nd.push_back( Vector3<T>( 0, 0, 2) ); // 8 00343 Nd.push_back( Vector3<T>( 1, 0, 2) ); // 9 00344 Nd.push_back( Vector3<T>( 1, 1, 2) ); // 10 00345 Nd.push_back( Vector3<T>( 0, 1, 2) ); // 11 00346 00347 // 15 undeformed nodes 00348 // 1st element // Pt# 00349 Nu.push_back( Vector3<T>( 0, 0, 0) ); // 0 00350 Nu.push_back( Vector3<T>( 1, 0, 0) ); // 1 00351 Nu.push_back( Vector3<T>( 1, 1, 0) ); // 2 00352 Nu.push_back( Vector3<T>( 0, 1, 0) ); // 3 00353 Nu.push_back( Vector3<T>( 0, 0, 1) ); // 4 00354 Nu.push_back( Vector3<T>( 1, 0, 1) ); // 5 00355 Nu.push_back( Vector3<T>( 1, 1, 1) ); // 6 00356 Nu.push_back( Vector3<T>( 0, 1, 1) ); // 7 00357 // 2nd element 00358 Nu.push_back( Vector3<T>( 0, 0, 2) ); // 8 00359 Nu.push_back( Vector3<T>( 1, 0, 2) ); // 9 00360 Nu.push_back( Vector3<T>( 1, 1, 2) ); // 10 00361 Nu.push_back( Vector3<T>( 0, 1, 2) ); // 11 00362 00363 // 1st element 00364 E.push_back( Hexahedron<T>( 00365 &Nd, // the 8 deformed nodes 00366 &Nu, // the 8 undeformed nodes 00367 YoungsModulus, // Young's modulus 00368 PoissionsRatio, // Poisson's ratio 00369 0, 1, 2, 3, 4, 5, 6, 7 ) 00370 ); 00371 // 2nd element 00372 E.push_back( Hexahedron<T>( 00373 &Nd, // the 8 deformed nodes 00374 &Nu, // the 8 undeformed nodes 00375 YoungsModulus, // Young's modulus 00376 PoissionsRatio, // Poisson's ratio 00377 4, 5, 6, 7, 8, 9, 10, 11 ) 00378 ); 00379 00380 rHexFemMesh.SetSizeOfStiffnessMatrix(); 00381 rHexFemMesh.AssembleStiffnessMatrix(); 00382 00383 // Allocate data for simulation 00384 rHexFemMesh.AllocateDataForSimulation( mass ); 00385 } 00386 00387 00388 00389 //----------------------------------------------------------------------------- 00390 template <typename T, typename DATA> 00391 void MeshHexahedraGen<T,DATA>::Bar ( 00392 MeshHexahedra<T> & rHexFemMesh, 00393 unsigned int numOfElements, 00394 T width, 00395 T height, 00396 T depth, 00397 T mass, 00398 T YoungsModulus, 00399 T PoissonsRatio 00400 ) 00401 { 00402 // JOIN AT FACE 4-5-6-7 00403 // 3---------2 ^ y 00404 // /| /| | 00405 // / | / | | 00406 // 7---------6 | | 00407 // /| 0- - -/| -1 +------>x 00408 // / | / / | / / 00409 // 11---------10 |/ / 00410 // | 4------|--5 v z 00411 // | / | / 00412 // |/ |/ 00413 // 8---------9 00414 00415 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00416 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00417 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00418 00419 // Clear the mesh 00420 E.clear(); 00421 Nd.clear(); 00422 Nu.clear(); 00423 00424 T depthStep = depth / numOfElements; 00425 T w = width, h = height, d = T(0); 00426 00427 // 1st element (deformed nodes) // Pt# 00428 Nd.push_back( Vector3<T>(-w,-h, d) ); // 0 00429 Nd.push_back( Vector3<T>( w,-h, d) ); // 1 00430 Nd.push_back( Vector3<T>( w, h, d) ); // 2 00431 Nd.push_back( Vector3<T>(-w, h, d) ); // 3 00432 00433 Nu.push_back( Vector3<T>(-w,-h, d) ); // 0 00434 Nu.push_back( Vector3<T>( w,-h, d) ); // 1 00435 Nu.push_back( Vector3<T>( w, h, d) ); // 2 00436 Nu.push_back( Vector3<T>(-w, h, d) ); // 3 00437 00438 // Next elements 00439 for ( unsigned int i = 0, n=0; i < numOfElements; ++i, n+=4 ) { 00440 d += depthStep; 00441 00442 Nd.push_back( Vector3<T>(-w,-h, d) ); // 4 00443 Nd.push_back( Vector3<T>( w,-h, d) ); // 5 00444 Nd.push_back( Vector3<T>( w, h, d) ); // 6 00445 Nd.push_back( Vector3<T>(-w, h, d) ); // 7 00446 00447 Nu.push_back( Vector3<T>(-w,-h, d) ); // 4 00448 Nu.push_back( Vector3<T>( w,-h, d) ); // 5 00449 Nu.push_back( Vector3<T>( w, h, d) ); // 6 00450 Nu.push_back( Vector3<T>(-w, h, d) ); // 7 00451 00452 E.push_back( Hexahedron<T>( 00453 &Nd, // the 8 deformed nodes 00454 &Nu, // the 8 undeformed nodes 00455 YoungsModulus, // Young's modulus 00456 PoissonsRatio, // Poisson's ratio 00457 n, n+1, n+2, n+3, n+4, n+5, n+6, n+7 ) 00458 ); 00459 } 00460 00461 rHexFemMesh.SetSizeOfStiffnessMatrix(); 00462 rHexFemMesh.AssembleStiffnessMatrix(); 00463 00464 // Allocate data for simulation 00465 rHexFemMesh.AllocateDataForSimulation( mass ); 00466 } 00467 00468 00469 00470 //----------------------------------------------------------------------------- 00471 template <typename T, typename DATA> 00472 bool MeshHexahedraGen<T,DATA>::MeshFromGridGenerator ( 00473 MeshHexahedra<T> & rHexFemMesh, 00474 GridGenerator<T,DATA> & rGridGen, 00475 T mass, 00476 T YoungsModulus, 00477 T PoissonsRatio 00478 ) 00479 { 00480 00481 if ( !rGridGen.IsGridGenerated() ) { 00482 return false; 00483 } 00484 00485 // Grid layout (right-handed coordinates) 00486 // ^ y 00487 // | 00488 // | 00489 // 0-----> x x = column 00490 // / y = row 00491 // / z = depth 00492 // v z 00493 // 00494 // Where X := #columns-1, Y := #rows-1, and Z := #slices-1. 00495 // 00496 // O-------O-------O---------------O-------O 00497 // /| /| /| ... /| /| 00498 // / |(0,Y,0)| / | ... / |(X,Y,0)| 00499 // / | / | / | ... / | / | 00500 // / O---/---O---/---O-----------/---O---/---O 00501 // / | / | / | ... / | / /| 00502 // / | / | / | .../ | / / | 00503 // / |/ |/ | ../ |/ / | 00504 // / /-------/-------O-------/-------/---/---O 00505 // / /| / HIGHEST / POINT /| 00506 // O-------O-------O---------------O-------@ / / | 00507 // | | | ... | . | / / | 00508 // |(0,Y,Z)| | ... |(X,Y,Z)| / / | 00509 // | | | ... | . |/ / | 00510 // O-------O-------O---------------O-------O / | 00511 // | | | ... | . | / | 00512 // | | | ... | . | / | 00513 // | | | ... | . |/ | 00514 // O-------O-------O---------------O-------O | 00515 // | | . . | | 00516 // | O-------O-----.-O-------------|-O-------0 00517 // | /| | . | ... | | /| 00518 // | / |(0,0,0)| . | ... | |(X,0,0)| 00519 // | / | | . | ... | | / | 00520 // | / @-------O-----.-O-------------|-O---/---O 00521 // | LOWEST / POINT / ./ |/ / / 00522 // | / / / . | / / 00523 // | / / / /. /| / / 00524 // | / / / / . / | / / 00525 // |/ / / / . / |/ / 00526 // O-------O-------O---------------O-------O / 00527 // | / | / | / ... | / | / 00528 // |(0,0,Z)| / | / ... |(X,0,Z)| / 00529 // |/ |/ |/ ... |/ |/ 00530 // O-------O-------O---------------O-------O 00531 // 00532 // where D := Z; R := Y; C := X; 00533 // 00534 // The n-th Z-slice 00535 // 00536 // (nRC+(R-1)+C+0)--(nRC+(R-1)+C+1)--(nRC+(R-1)+C+2)-- ... --(nRC+(R+1)C+C-1) 00537 // | | | | 00538 // | | | | 00539 // | | | | 00540 // ... ... ... ... ... 00541 // | | | | 00542 // | | | | 00543 // | | | | 00544 // (nRC+2C+0)-------(nRC+2C+1)-------(nRC+2C+2)---- ... -----(nRC+2C+C-1) 00545 // | | | | 00546 // | | | | 00547 // | | | | 00548 // (nRC+C+0)--------(nRC+C+1)--------(nRC+C+2)---- ... ------(nRC+C+C-1) 00549 // | | | | 00550 // | | | | 00551 // | | | | 00552 // (nRC+0)----------(nRC+1)----------(nRC+2)----- ... -------(nRC+C-1) 00553 // 00554 // 00555 // 00556 // @---------@ ^ y 00557 // /| /| | 00558 // / | SLICE /A| | 00559 // @---------@ | | 00560 // /| @- - -/| -@ +------>x 00561 // / | SLICE /B| / / 00562 // @---------@ |/ / 00563 // | @------|--@ v z 00564 // | /SLICE C| / 00565 // |/ |/ 00566 // @---------@ 00567 00568 00569 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00570 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00571 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00572 00573 // Clear the mesh 00574 E.clear(); 00575 Nd.clear(); 00576 Nu.clear(); 00577 00578 // Z goes first follows by Y then X. 00579 // So the slice is in Z-plane with Y as rows and X as columns 00580 T **** const GridVertices = rGridGen.ReturnPtrToVertexPositionData(); 00581 unsigned int z,y,x; 00582 unsigned int C = rGridGen.GetGridSizeX(); 00583 unsigned int R = rGridGen.GetGridSizeY(); 00584 unsigned int D = rGridGen.GetGridSizeZ(); 00585 00586 // Add mesh vertices from the grid data 00587 for ( z = 0; z < D; ++z ) { 00588 for ( y = 0; y < R; ++y ) { 00589 for ( x = 0; x < C; ++x ) { 00590 Vector3<T> V( GridVertices[x][y][z][0], GridVertices[x][y][z][1], GridVertices[x][y][z][2] ); 00591 Nd.push_back( V ); 00592 Nu.push_back( V ); 00593 } 00594 } 00595 } 00596 00597 // Add hexahedron element from the mesh vertices 00598 unsigned int idx[4]; 00599 unsigned int RC = R*C; 00600 unsigned int SLICE = 0; 00601 unsigned int ROW; 00602 for ( z = 0; z < D-1; ++z ) { 00603 ROW = 0; 00604 for ( y = 0; y < R-1; ++y ) { 00605 for ( x = 0; x < C-1; ++x ) { 00606 // Pt 1 to 8 00607 // 00608 // idx1 3---------2 ^ y 00609 // /| /| | 00610 // / | / | | 00611 // idx3 7---------6 | | 00612 // idx0 | 0- - - | -1 +------>x 00613 // | / | / / 00614 // |/ |/ / 00615 // idx2 4---------5 v z 00616 idx[0] = SLICE + ROW + x; 00617 idx[1] = idx[0] + C; 00618 idx[2] = idx[0] + RC; 00619 idx[3] = idx[2] + C; 00620 00621 E.push_back( Hexahedron<T>( 00622 &Nd, // the 8 deformed nodes 00623 &Nu, // the 8 undeformed nodes 00624 YoungsModulus, // Young's modulus 00625 PoissonsRatio, // Poisson's ratio 00626 idx[0], idx[0]+1, idx[1]+1, idx[1], idx[2], idx[2]+1, idx[3]+1, idx[3] ) 00627 ); 00628 } 00629 ROW += C; 00630 } 00631 SLICE += RC; 00632 } 00633 00634 //std::cout << "set size of stiffness matrix" << std::endl; 00635 rHexFemMesh.SetSizeOfStiffnessMatrix(); 00636 //std::cout << "assemble stiffness matrix" << std::endl; 00637 rHexFemMesh.AssembleStiffnessMatrix(); 00638 00639 // Allocate data for simulation 00640 //std::cout << "Allocate data for simulation" << std::endl; 00641 rHexFemMesh.AllocateDataForSimulation( mass ); 00642 00643 // DEBUG 00644 std::cout << "Generated Hexahedral FEM mesh has " << rHexFemMesh.GetNumOfNodes() 00645 << " nodes and " << rHexFemMesh.GetNumOfElements() << " elements.\n"; 00646 00647 return true; 00648 } 00649 00650 00651 00652 //----------------------------------------------------------------------------- 00653 template <typename T, typename DATA> 00654 bool MeshHexahedraGen<T,DATA>::MeshFromGridGenerator ( 00655 MeshHexahedra<T> & rHexFemMesh, 00656 std::vector< HexBarycentricCoordsForVertexRef<T,DATA> > & rBaryCoords, 00657 //std::vector< unsigned int > & rElementID, //!< identify the element that the barycentric coordinates are embedded in 00658 GridGenerator<T,DATA> & rGridGen, 00659 T mass, 00660 T YoungsModulus, 00661 T PoissonsRatio, 00662 bool bGenElementsInsideVolume, 00663 int *** pElementsGridLocations 00664 ) 00665 { 00666 00667 if ( !rGridGen.IsGridGenerated() ) { 00668 return false; 00669 } 00670 00671 // Grid layout (right-handed coordinates) 00672 // ^ y 00673 // | 00674 // | 00675 // 0-----> x x = column 00676 // / y = row 00677 // / z = depth 00678 // v z 00679 // 00680 // Where X := #columns-1, Y := #rows-1, and Z := #slices-1. 00681 // 00682 // O-------O-------O---------------O-------O 00683 // /| /| /| ... /| /| 00684 // / |(0,Y,0)| / | ... / |(X,Y,0)| 00685 // / | / | / | ... / | / | 00686 // / O---/---O---/---O-----------/---O---/---O 00687 // / | / | / | ... / | / /| 00688 // / | / | / | .../ | / / | 00689 // / |/ |/ | ../ |/ / | 00690 // / /-------/-------O-------/-------/---/---O 00691 // / /| / HIGHEST / POINT /| 00692 // O-------O-------O---------------O-------@ / / | 00693 // | | | ... | . | / / | 00694 // |(0,Y,Z)| | ... |(X,Y,Z)| / / | 00695 // | | | ... | . |/ / | 00696 // O-------O-------O---------------O-------O / | 00697 // | | | ... | . | / | 00698 // | | | ... | . | / | 00699 // | | | ... | . |/ | 00700 // O-------O-------O---------------O-------O | 00701 // | | . . | | 00702 // | O-------O-----.-O-------------|-O-------0 00703 // | /| | . | ... | | /| 00704 // | / |(0,0,0)| . | ... | |(X,0,0)| 00705 // | / | | . | ... | | / | 00706 // | / @-------O-----.-O-------------|-O---/---O 00707 // | LOWEST / POINT / ./ |/ / / 00708 // | / / / . | / / 00709 // | / / / /. /| / / 00710 // | / / / / . / | / / 00711 // |/ / / / . / |/ / 00712 // O-------O-------O---------------O-------O / 00713 // | / | / | / ... | / | / 00714 // |(0,0,Z)| / | / ... |(X,0,Z)| / 00715 // |/ |/ |/ ... |/ |/ 00716 // O-------O-------O---------------O-------O 00717 // 00718 // where D := Z; R := Y; C := X; 00719 // 00720 // The n-th Z-slice 00721 // 00722 // (nRC+(R-1)+C+0)--(nRC+(R-1)+C+1)--(nRC+(R-1)+C+2)-- ... --(nRC+(R+1)C+C-1) 00723 // | | | | 00724 // | | | | 00725 // | | | | 00726 // ... ... ... ... ... 00727 // | | | | 00728 // | | | | 00729 // | | | | 00730 // (nRC+2C+0)-------(nRC+2C+1)-------(nRC+2C+2)---- ... -----(nRC+2C+C-1) 00731 // | | | | 00732 // | | | | 00733 // | | | | 00734 // (nRC+C+0)--------(nRC+C+1)--------(nRC+C+2)---- ... ------(nRC+C+C-1) 00735 // | | | | 00736 // | | | | 00737 // | | | | 00738 // (nRC+0)----------(nRC+1)----------(nRC+2)----- ... -------(nRC+C-1) 00739 // 00740 // 00741 // 00742 // @---------@ ^ y 00743 // /| /| | 00744 // / | SLICE /A| | 00745 // @---------@ | | 00746 // /| @- - -/| -@ +------>x 00747 // / | SLICE /B| / / 00748 // @---------@ |/ / 00749 // | @------|--@ v z 00750 // | /SLICE C| / 00751 // |/ |/ 00752 // @---------@ 00753 00754 std::vector< Hexahedron<T> > & E = rHexFemMesh.RetListOfElements(); 00755 std::vector< Vector3<T> > & Nd = rHexFemMesh.RetListOfDeformedMeshNodes(); 00756 std::vector< Vector3<T> > & Nu = rHexFemMesh.RetListOfUndeformedMeshNodes(); 00757 00758 // Clear the mesh 00759 E.clear(); 00760 Nd.clear(); 00761 Nu.clear(); 00762 00763 // Z goes first follows by Y then X. 00764 // So the slice is in Z-plane with Y as rows and X as columns 00765 T **** const GridVertices = rGridGen.ReturnPtrToVertexPositionData(); 00766 unsigned int z,y,x; 00767 unsigned int C = rGridGen.GetGridSizeX(); 00768 unsigned int R = rGridGen.GetGridSizeY(); 00769 unsigned int D = rGridGen.GetGridSizeZ(); 00770 unsigned int RC = R*C; 00771 unsigned int C_1 = C-1; 00772 unsigned int R_1 = R-1; 00773 unsigned int D_1 = D-1; 00774 unsigned int RC_1 = R_1*C_1; 00775 00776 unsigned int count = 0; 00777 00778 // convert std::vector< GenBarycentricCoordsForVertexRef<T,DATA> > 00779 // to std::vector< std::vector< GenBarycentricCoordsForVertexRef<T,DATA> > > 00780 std::vector< std::vector<unsigned int> > TransferCoords( D_1*RC_1 ); 00781 std::vector< HexBarycentricCoordsForVertexRef<T,DATA> >::iterator Coords = rGridGen.GetHexBarycentricCoords().begin(); 00782 while ( Coords != rGridGen.GetHexBarycentricCoords().end() ) { 00783 Coords->GetGridLocations( x, y, z ); 00784 unsigned int location = z*RC_1 + y*C_1 + x; 00785 TransferCoords[ location ].push_back( count++ ); 00786 ++Coords; 00787 } 00788 00789 //==================================================================== 00790 // Add ONLY mesh vertices THAT EMBEDED IN FEM MESH from the grid data 00791 //-------------------------------------------------------------------- 00792 00793 // Copy to rBaryCoords (barycentric of polygonal embedded in FEM mesh) 00794 rBaryCoords = rGridGen.GetHexBarycentricCoords(); 00795 00796 // Allocate temp data to store the valid FEM mesh vertices and elements 00797 struct TDAT { 00798 TDAT() : validvertex(false), validelement(false) {} 00799 bool validvertex; 00800 unsigned int vertexid; 00801 bool validelement; 00802 }; 00803 TDAT *** LOC = new TDAT**[D]; 00804 unsigned int DRC = D*R*C; 00805 for ( z = 0; z < D; ++z ) { 00806 LOC[z] = new TDAT*[R]; 00807 for ( y = 0; y < R; ++y ) { 00808 LOC[z][y] = new TDAT[C]; 00809 // Initialize vertexid to DRC --> same as mark it as the vertex is not created yet 00810 for ( unsigned int x = 0; x < C; ++x ) { 00811 LOC[z][y][x].vertexid = DRC; 00812 } 00813 } 00814 } 00815 00816 // (SURFACE) MESH DATA 00817 // Mark the valid vertices (location) in temp data based on the barycentric coordinates stored in rGridGen 00818 Coords = rGridGen.GetHexBarycentricCoords().begin(); 00819 while ( Coords != rGridGen.GetHexBarycentricCoords().end() ) { 00820 Coords->GetGridLocations( x, y, z ); 00821 // One valid element 00822 LOC[z][y][x].validelement = true; 00823 // Eight valid vertices (0 as valid; ULONG_MAX as notvalid) 00824 LOC[z ][y ][x ].validvertex = true; 00825 LOC[z ][y ][x+1].validvertex = true; 00826 LOC[z ][y+1][x+1].validvertex = true; 00827 LOC[z ][y+1][x ].validvertex = true; 00828 LOC[z+1][y ][x ].validvertex = true; 00829 LOC[z+1][y ][x+1].validvertex = true; 00830 LOC[z+1][y+1][x+1].validvertex = true; 00831 LOC[z+1][y+1][x ].validvertex = true; 00832 ++Coords; 00833 } 00834 00835 // (VOLUME) GRID DATA 00836 if ( bGenElementsInsideVolume ) { 00837 // Mark the valid vertices (location) in temp data based on the grid vertex data stored in rGridGen 00838 GridGenerator<T,DATA>::VertexFlag *** const vertexFlag = rGridGen.ReturnPtrToVertexFlagData(); 00839 // Mark the valid vertices (location) in temp data 00840 for ( x = 0; x < C; ++x ) { 00841 for ( y = 0; y < R; ++y ) { 00842 for ( z = 0; z < D; ++z ) { 00843 if ( vertexFlag[x][y][z] == GridGenerator<T,DATA>::RIGHT_OUTSIDE_BOUNDARY 00844 || vertexFlag[x][y][z] == GridGenerator<T,DATA>::ON_BOUNDARY 00845 || vertexFlag[x][y][z] == GridGenerator<T,DATA>::RIGHT_INSIDE_BOUNDARY 00846 || vertexFlag[x][y][z] == GridGenerator<T,DATA>::INSIDE_MODEL ) 00847 { 00848 LOC[z][y][x].validvertex = true; 00849 } 00850 } 00851 } 00852 } 00853 // Mark the valid elements (location) in temp data 00854 for ( x = 0; x < C_1; ++x ) { 00855 for ( y = 0; y < R_1; ++y ) { 00856 for ( z = 0; z < D_1; ++z ) { 00857 if ( LOC[z ][y ][x ].validvertex 00858 && LOC[z ][y ][x+1].validvertex 00859 && LOC[z ][y+1][x+1].validvertex 00860 && LOC[z ][y+1][x ].validvertex 00861 && LOC[z+1][y ][x ].validvertex 00862 && LOC[z+1][y ][x+1].validvertex 00863 && LOC[z+1][y+1][x+1].validvertex 00864 && LOC[z+1][y+1][x ].validvertex ) 00865 { 00866 LOC[z][y][x].validelement = true; 00867 } 00868 } 00869 } 00870 } 00871 } 00872 00873 // Add the valid vertices to the FEM mesh data for vertices 00874 count = 0; 00875 for ( z = 0; z < D_1; ++z ) { 00876 for ( y = 0; y < R_1; ++y ) { 00877 for ( x = 0; x < C_1; ++x ) { 00878 if ( LOC[z][y][x].validelement ) { 00879 // v0 00880 if ( LOC[z][y][x].validvertex && LOC[z][y][x].vertexid == DRC ) { 00881 Vector3<T> V( GridVertices[x][y][z][0], GridVertices[x][y][z][1], GridVertices[x][y][z][2] ); 00882 Nd.push_back( V ); 00883 Nu.push_back( V ); 00884 LOC[z][y][x].vertexid = count++; 00885 } 00886 // v1 00887 if ( LOC[z][y][x+1].validvertex && LOC[z][y][x+1].vertexid == DRC ) { 00888 Vector3<T> V( GridVertices[x+1][y][z][0], GridVertices[x+1][y][z][1], GridVertices[x+1][y][z][2] ); 00889 Nd.push_back( V ); 00890 Nu.push_back( V ); 00891 LOC[z][y][x+1].vertexid = count++; 00892 } 00893 // v2 00894 if ( LOC[z][y+1][x+1].validvertex && LOC[z][y+1][x+1].vertexid == DRC ) { 00895 Vector3<T> V( GridVertices[x+1][y+1][z][0], GridVertices[x+1][y+1][z][1], GridVertices[x+1][y+1][z][2] ); 00896 Nd.push_back( V ); 00897 Nu.push_back( V ); 00898 LOC[z][y+1][x+1].vertexid = count++; 00899 } 00900 // v3 00901 if ( LOC[z][y+1][x].validvertex && LOC[z][y+1][x].vertexid == DRC ) { 00902 Vector3<T> V( GridVertices[x][y+1][z][0], GridVertices[x][y+1][z][1], GridVertices[x][y+1][z][2] ); 00903 Nd.push_back( V ); 00904 Nu.push_back( V ); 00905 LOC[z][y+1][x].vertexid = count++; 00906 } 00907 // v4 00908 if ( LOC[z+1][y][x].validvertex && LOC[z+1][y][x].vertexid == DRC ) { 00909 Vector3<T> V( GridVertices[x][y][z+1][0], GridVertices[x][y][z+1][1], GridVertices[x][y][z+1][2] ); 00910 Nd.push_back( V ); 00911 Nu.push_back( V ); 00912 LOC[z+1][y][x].vertexid = count++; 00913 } 00914 // v5 00915 if ( LOC[z+1][y][x+1].validvertex && LOC[z+1][y][x+1].vertexid == DRC ) { 00916 Vector3<T> V( GridVertices[x+1][y][z+1][0], GridVertices[x+1][y][z+1][1], GridVertices[x+1][y][z+1][2] ); 00917 Nd.push_back( V ); 00918 Nu.push_back( V ); 00919 LOC[z+1][y][x+1].vertexid = count++; 00920 } 00921 // v6 00922 if ( LOC[z+1][y+1][x+1].validvertex && LOC[z+1][y+1][x+1].vertexid == DRC ) { 00923 Vector3<T> V( GridVertices[x+1][y+1][z+1][0], GridVertices[x+1][y+1][z+1][1], GridVertices[x+1][y+1][z+1][2] ); 00924 Nd.push_back( V ); 00925 Nu.push_back( V ); 00926 LOC[z+1][y+1][x+1].vertexid = count++; 00927 } 00928 // v7 00929 if ( LOC[z+1][y+1][x].validvertex && LOC[z+1][y+1][x].vertexid == DRC ) { 00930 Vector3<T> V( GridVertices[x][y+1][z+1][0], GridVertices[x][y+1][z+1][1], GridVertices[x][y+1][z+1][2] ); 00931 Nd.push_back( V ); 00932 Nu.push_back( V ); 00933 LOC[z+1][y+1][x].vertexid = count++; 00934 } 00935 } 00936 } 00937 } 00938 } 00939 00940 // Add hexahedron element from the mesh vertices 00941 count = 0; 00942 //rElementID.resize( rBaryCoords.size() ); 00943 00944 for ( z = 0; z < D_1; ++z ) { 00945 for ( y = 0; y < R_1; ++y ) { 00946 for ( x = 0; x < C_1; ++x ) { 00947 if ( LOC[z][y][x].validelement ) { 00948 // Pt 0 to 7 00949 // 00950 // 3---------2 ^ y 00951 // /| /| | 00952 // / | / | | 00953 // 7---------6 | | 00954 // | 0- - - | -1 +------>x 00955 // | / | / / 00956 // |/ |/ / 00957 // 4---------5 v z 00958 E.push_back( Hexahedron<T>( 00959 &Nd, // the 8 deformed nodes 00960 &Nu, // the 8 undeformed nodes 00961 YoungsModulus, // Young's modulus 00962 PoissonsRatio, // Poisson's ratio 00963 LOC[z ][y ][x ].vertexid, 00964 LOC[z ][y ][x+1].vertexid, 00965 LOC[z ][y+1][x+1].vertexid, 00966 LOC[z ][y+1][x ].vertexid, 00967 LOC[z+1][y ][x ].vertexid, 00968 LOC[z+1][y ][x+1].vertexid, 00969 LOC[z+1][y+1][x+1].vertexid, 00970 LOC[z+1][y+1][x ].vertexid ) 00971 ); 00972 // Record the element id for identifying barycentric coordinate locations 00973 unsigned int loc = z*RC_1 + y*C_1 + x; 00974 for ( unsigned int i = 0; i < TransferCoords[loc].size(); ++i ) { 00975 //rElementID[ TransferCoords[loc][i] ] = count; 00976 rBaryCoords[ TransferCoords[loc][i] ].SetElementID( count ); 00977 } 00978 00979 // Store the element ID in the grid location xyz -- width,height,depth 00980 if ( pElementsGridLocations ) { 00981 pElementsGridLocations[x][y][z] = count; 00982 } 00983 00984 ++count; 00985 00986 } 00987 } 00988 } 00989 } 00990 00991 // Set pointers to hexahedra 00992 // MUST BE DONE AFTER ALL HEXAHEDRAL ELEMENTS ARE GENERATED! 00993 // OTHERWISE THE POINTERS WILL NOT BE VALID DUE TO 00994 // THE AUTOMATICAL RESIZING OF STD::VECTOR! 00995 for ( unsigned int i = 0; i < rBaryCoords.size(); ++i ) { 00996 rBaryCoords[i].SetPtrToHexahedron( &E[ rBaryCoords[i].GetElementID() ] ); 00997 } 00998 00999 // Set the barycentric pointer for each vertex 01000 // MUST BE DONE AFTER ALL BARY COORDS ARE GENERATED! 01001 // OTHERWISE THE POINTERS WILL NOT BE VALID DUE TO 01002 // THE AUTOMATICAL RESIZING OF STD::VECTOR! 01003 count = 0; 01004 TAPs::OpenGL::HalfEdgeModel<T> * pHEModel = dynamic_cast< TAPs::OpenGL::HalfEdgeModel<T> * >( rGridGen.GetModelUseToGenGrid() ); 01005 HEVertex<T> * pVertex = pHEModel->GetVertexList()->Head(); 01006 while ( pVertex != NULL ) { 01007 pVertex->SetBarycentricPtr( &rBaryCoords[count] ); 01008 //std::cout << count << "\tTet\t" << pVertex << "\t" << pVertex->GetBarycentricPtr() << "\t" << *(pVertex->GetBarycentricPtr()) << "\n"; 01009 pVertex = pVertex->Next(); 01010 ++count; 01011 } 01012 01013 // Delete temp data 01014 for ( z = 0; z < D; ++z ) { 01015 for ( y = 0; y < R; ++y ) { 01016 delete [] LOC[z][y]; 01017 } 01018 delete [] LOC[z]; 01019 } 01020 delete [] LOC; 01021 01022 //-------------------------------------------------------------------- 01023 //==================================================================== 01024 01025 rHexFemMesh.SetSizeOfStiffnessMatrix(); 01026 rHexFemMesh.AssembleStiffnessMatrix(); 01027 01028 // Allocate data for simulation 01029 rHexFemMesh.AllocateDataForSimulation( mass ); 01030 01031 // DEBUG 01032 std::cout << "Generated Hexahedral FEM mesh has " << rHexFemMesh.GetNumOfNodes() 01033 << " nodes and " << rHexFemMesh.GetNumOfElements() << " elements.\n"; 01034 std::cout << std::flush; 01035 01036 return true; 01037 } 01038 01039 01040 //----------------------------------------------------------------------------- 01041 //============================================================================= 01042 END_NAMESPACE_TAPs__FEM 01043 //34567890123456789012345678901234567890123456789012345678901234567890123456789 01044 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----