MeshKit  1.0
meshscript.cpp
Go to the documentation of this file.
00001 
00002 #include "meshkit/AssyGen.hpp"
00003 
00004 namespace MeshKit
00005 {
00006   void AssyGen::CreateCubitJournal()
00007   //---------------------------------------------------------------------------
00008   //Function: Create Cubit Journal File for generating mesh
00009   //Input:    none
00010   //Output:   none
00011   //---------------------------------------------------------------------------
00012   {
00013 #ifdef HAVE_RGG16
00014     m_FileOutput << "#RGG16 enabled for AssyGen" << std::endl;
00015 #else
00016     m_FileOutput << "#<15.1 version enabled for AssyGen" << std::endl;
00017 #endif
00018     if(m_szMeshScheme == "hole")
00019       m_FileOutput << "surf in group hole_surfaces scheme hole" << std::endl;
00020 
00021     if (m_nBLAssemblyMat !=0){
00022         // Also look for material name in BL material list
00023         for (int ll=1; ll<= m_nBLAssemblyMat; ll++){
00024             //if(szVCylMat(m) == m_szBLAssmMat(ll)) {
00025 #ifdef HAVE_RGG16
00026             m_FileOutput << "group 'tmpgrp' equals surf with name '" <<  m_szBLAssmMat(ll)  << "_top*'" << std::endl;
00027 #else
00028             m_FileOutput << "group 'tmpgrp' equals surf with name '" <<  m_szBLAssmMat(ll)  << "_top'" << std::endl;
00029 #endif
00030 
00031             m_FileOutput << "surf in tmpgrp size {RADIAL_MESH_SIZE}" << std::endl;
00032             m_FileOutput << "group '" << m_szBLAssmMat(ll) << "_hole_surfaces' equals surf in tmpgrp"<< std::endl;
00033             m_FileOutput << "surface in group " << m_szBLAssmMat(ll) << "_hole_surfaces scheme hole rad_interval " << m_nBLMatIntervals(ll) << " bias " << m_dBLMatBias(ll) << std::endl;
00034             if(strcmp(m_szSmooth.c_str(),"on") == 0)
00035               m_FileOutput << "surf in group " << m_szBLAssmMat(ll) << "_hole_surfaces" << " smooth scheme condition number beta 2.0 cpu 10" << std::endl;
00036             //         m_FileOutput << "mesh surf in group " << m_szBLAssmMat(ll) << "_hole_surfaces" << std::endl;
00037             // }
00038             m_FileOutput << "group 'bl_surfaces' add surf in tmpgrp" << std::endl;
00039           }
00040       }
00041     // variables
00042     int nColor;
00043     std::string color[21] = {" ", "thistle", "grey", "deepskyblue", "red", "purple",  "green",
00044                              "yellow", "royalblue", "magenta", "cyan", "lightsalmon", "springgreen",
00045                              "gold", "orange", "brown", "pink", "khaki", "black", "aquamarine", "mediumslateblue"};
00046 
00047     // if creating only journal file load the geometry file to compute bounding box for automatic size specification
00048     if(m_nJouFlag == 1){
00049 #if defined (HAVE_ACIS) || defined (HAVE_OCC)
00050         iGeom_load(igeomImpl->instance(), m_szGeomFile.c_str(), NULL, &err, m_szGeomFile.length() , 0);
00051 #endif
00052       }
00053 
00054     // get the max and min coordinates of the geometry
00055 #if defined (HAVE_ACIS) || defined (HAVE_OCC)
00056     double x1, y1, z1, x2, y2, z2;
00057     iGeom_getBoundBox( igeomImpl->instance(), &x1, &y1, &z1, &x2, &y2, &z2, &err );
00058 #endif
00059 
00060     int nSideset=m_nNeumannSetId;
00061 
00062     m_SchemesFile << "group \"gall\" add vol all\n#{gtempid = Id(\"group\")}\n" << std::endl;
00063     m_SchemesFile << "#{Zmax = BBox_ZMax(\"group\", gtempid)}" << std::endl;
00064     m_SchemesFile << "#{Zmin = BBox_ZMin(\"group\", gtempid)}" << std::endl;
00065 
00066     std::string szGrp, szBlock, szSurfTop, szSurfBot, szSize, szSurfSide;
00067     double dHeight = 0.0, dMid = 0.0;
00068     int nTemp = 1;
00069 #if defined (HAVE_ACIS) || defined (HAVE_OCC)
00070     if(m_nDimensions > 0){
00071         dHeight= fabs(z2 - z1);
00072         dMid = z2 - dHeight/2.0;
00073       }
00074 #endif
00075 
00076     // writing to template.jou
00077     m_SchemesFile << "## This file is created by rgg program in MeshKit ##\n";
00078     m_SchemesFile << "##Schemes " << std::endl  ;
00079     m_SchemesFile << "#{CIRCLE =\"circle interval 1 fraction 0.8\"}" << std::endl;
00080     m_SchemesFile << "#{HOLE = \"hole rad_interval 2 bias 0.0\"}" << std::endl;
00081     m_SchemesFile << "#{PAVE = \"pave\"}" << std::endl;
00082     m_SchemesFile << "#{MAP = \"map\"}" << std::endl;
00083     m_SchemesFile << "#{SWEEP = \"sweep\"}" << std::endl;
00084     m_SchemesFile << "#{TET = \"tetmesh\"}" << std::endl;
00085     m_SchemesFile << "#{TOP_EDGE_INTERVAL = " << m_edgeInterval << " }" << std::endl;
00086     m_SchemesFile << "## Dimensions" << std::endl;
00087     if(m_szGeomType == "hexagonal"){
00088         if(m_nDimensions > 0){
00089             m_SchemesFile << "#{PITCH =" << m_dMAssmPitch(nTemp, m_nDimensions) << "}" << std::endl;
00090           }
00091       }
00092     else if(m_szGeomType == "rectangular"){
00093         if(m_nDimensions > 0){
00094             m_SchemesFile << "#{PITCHX =" << m_dMAssmPitchX(nTemp, m_nDimensions)<< "}" << std::endl;
00095             m_SchemesFile << "#{PITCHY =" << m_dMAssmPitchY(nTemp, m_nDimensions) << "}" << std::endl;
00096           }
00097       }
00098     if( m_nPlanar ==0){
00099         m_SchemesFile << "#{Z_HEIGHT = Zmax - Zmin}" << std::endl;
00100         m_SchemesFile << "#{Z_MID = (Zmax + Zmin)/2.0}" << std::endl;
00101       }
00102     m_SchemesFile << "##Set Mesh Sizes" << std::endl;
00103 
00104     if (m_szMeshType == "hex"){
00105         // volume only
00106         if(m_nPlanar == 0 ){
00107             if (m_dAxialSize.GetSize() == 0){
00108                 m_SchemesFile << "#{AXIAL_MESH_SIZE = 0.1*Z_HEIGHT}" << std::endl;
00109               }
00110             else {
00111                 m_SchemesFile << "#{AXIAL_MESH_SIZE = " << m_dAxialSize(1) << "}" << std::endl;
00112               }
00113 
00114             // create templates for specifying block z intervals
00115             if (m_nDuct > 1){
00116                 m_SchemesFile << "## Set interval along Z direction ## " << std::endl;
00117 
00118                 for( int p=1; p<= m_nDuct; p++){
00119                     if (m_dAxialSize.GetSize() != 0)
00120                       m_SchemesFile << "#{AXIAL_MESH_SIZE" << p << "=" << m_dAxialSize(p) << "}" << std::endl;
00121                     else
00122                       m_SchemesFile << "#{AXIAL_MESH_SIZE" << p << "= 0.1*Z_HEIGHT}" << std::endl;
00123                     m_SchemesFile << "#{BLOCK" << p << "_Z_INTERVAL = AXIAL_MESH_SIZE" << p << "}" << std::endl;
00124                     m_SchemesFile << "#{BLOCK" << p << "_ZBOT = " << m_dMZAssm(p, 1) << "}" << std::endl;
00125                     m_SchemesFile << "#{BLOCK" << p << "_ZTOP = " << m_dMZAssm(p, 2) << "}" << std::endl;
00126                   }
00127                 m_SchemesFile << "##" << std::endl;
00128               }
00129           }
00130         if (-1.0 == m_dRadialSize) {
00131             if (m_szGeomType == "hexagonal")
00132               m_SchemesFile << "#{RADIAL_MESH_SIZE = 0.1*PITCH}" << std::endl;
00133             else
00134               m_SchemesFile << "#{RADIAL_MESH_SIZE = 0.02*0.5*(PITCHX+PITCHY)}" << std::endl;
00135           }
00136         else
00137           m_SchemesFile << "#{RADIAL_MESH_SIZE = " << m_dRadialSize << "}" << std::endl;
00138       }
00139     else if (m_szMeshType == "tet"){
00140         if (-1.0 == m_dTetMeshSize) {
00141             if (m_szGeomType == "hexagonal")
00142               m_SchemesFile << "#{TET_MESH_SIZE = 0.1*PITCH}" << std::endl;
00143             else
00144               m_SchemesFile << "#{TET_MESH_SIZE = 0.02*0.5*(PITCHX+PITCHY)}" << std::endl;
00145           }
00146         else {
00147             m_SchemesFile << "#{TET_MESH_SIZE = " << m_dTetMeshSize  << "}" << std::endl;
00148           }
00149       }
00150 
00151     if(m_nHblock == -1){ // if more blocks are needed axially, create'em using hexes and the end
00152         // block creation dumps
00153         m_FileOutput << "#Creating blocks, Note: you might need to combine some blocks" << std::endl;
00154         // group creation dumps. each material has a group
00155         m_FileOutput << "#Creating groups" << std::endl;
00156         for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00157             szGrp = "g_"+ m_szAssmMat(p);
00158             m_szAssmMat(p);
00159             if(m_nPlanar ==1){
00160 #ifdef HAVE_RGG16
00161                 m_FileOutput << "group \"" << szGrp << "\" add surface with name \"" << m_szAssmMat(p) <<"*\"" << std::endl;
00162 #else
00163                 m_FileOutput << "group \"" << szGrp << "\" add surface with name \"" << m_szAssmMat(p) <<"\"" << std::endl;
00164 #endif
00165               }
00166             else{
00167 #ifdef HAVE_RGG16              
00168                 m_FileOutput << "group \"" << szGrp << "\" add body with name \"" << m_szAssmMat(p) <<"*\"" << std::endl;
00169 #else
00170                 m_FileOutput << "group \"" << szGrp << "\" add body with name \"" << m_szAssmMat(p) <<"\"" << std::endl;
00171 #endif
00172               }
00173           }
00174         for(int p = 1; p <=  (m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00175             szBlock = "b_"+ m_szAssmMat(p);
00176             szGrp = "g_"+ m_szAssmMat(p);
00177             m_FileOutput << "#{nb" << p << " =NumInGrp('" << szGrp << "')}" << std::endl;
00178             m_FileOutput << "#{Ifndef(nb" << p << ")}" << "\n" << "#{else}" << std::endl;
00179             if(m_nPlanar ==1){
00180                 m_FileOutput << "block " << m_nMaterialSetId + p -1 << " surface in " << szGrp  << std::endl;
00181                 m_FileOutput << "block " << m_nMaterialSetId + p -1 << " name \"" << szBlock <<"\""<< std::endl;
00182               }
00183             else{
00184                 m_FileOutput << "block " << m_nMaterialSetId + p -1 << " body in " << szGrp  << std::endl;
00185                 m_FileOutput << "block " << m_nMaterialSetId + p -1 << " name \"" << szBlock <<"\""<< std::endl;
00186               }
00187             m_FileOutput << "#{endif}" << std::endl;
00188           }
00189         m_FileOutput << "#" << std::endl;
00190       }
00191     if(m_szMeshType == "hex"){
00192         // imprint
00193         m_FileOutput << "#Imprint geometry" << std::endl;
00194         m_FileOutput << "imprint all" << std::endl;
00195         m_FileOutput << "#" << std::endl;
00196         // merge
00197 
00198         m_FileOutput << "Merge Tolerance " << m_dMergeTol << std::endl;
00199         m_FileOutput << "#" << std::endl;
00200 
00201         m_FileOutput << "#Merge geometry" << std::endl;
00202         m_FileOutput << "merge all" << std::endl;
00203         m_FileOutput << "#" << std::endl;
00204       }
00205 
00206     // for info keyword
00207     if(strcmp(m_szInfo.c_str(),"on") == 0){
00208         int temp = 9700;
00209         m_FileOutput << "# stuff for info keyword, remove if not desired " << std::endl;
00210         m_FileOutput << "# putting pins in seperate blocks " << std::endl;
00211         m_FileOutput << "#" << std::endl;
00212         for (int i=0; i<m_nTotalPincells; i++){
00213             m_FileOutput << "#You might have to use:\n#set duplicate block elements on\n#This is required for creating blocks with pin materials only" << std::endl;
00214 #ifdef HAVE_RGG16
00215             m_FileOutput << "group 'g"<< i+m_nStartpinid << "' add body with name '*_xp" << i+m_nStartpinid << "_*'" << std::endl;
00216 #else
00217             m_FileOutput << "group 'g"<< i+m_nStartpinid << "' add body with name '_xp" << i+m_nStartpinid << "_'" << std::endl;            
00218 #endif
00219             m_FileOutput << "#{nbody" << i+1 << " =NumInGrp('g" <<i+m_nStartpinid << "')}" << std::endl;
00220             m_FileOutput << "#{Ifndef(nbody" << i+1 << ")}" << "\n" << "#{else}" << std::endl;
00221             m_FileOutput << "block " << temp+i << " body in group g" << i+m_nStartpinid << std::endl;
00222             m_FileOutput << "block " << temp+i << " name '_xp" << i+m_nStartpinid << "'" << std::endl;
00223             m_FileOutput << "#{endif}" << std::endl;
00224           }
00225       }
00226 
00227     //surface only
00228     if(m_nPlanar ==1){
00229         m_FileOutput << "# Pointing surface normals to 0.0, 0.0, -1.0 or -ve Z or correct STARCCM+ cell-face orientation" << std::endl;
00230         m_FileOutput << "surface all normal opposite" << std::endl;
00231         m_FileOutput << "#" << std::endl;
00232       }
00233     // volume only
00234     else{
00235         if(m_szSideset == "yes"){
00236 
00237             // rename the skin surfaces, so that they don't appear as sidesets
00238             for (int p=1; p<=m_nDuct; p++){
00239                 for(int q=1;q<=m_nSides; q++){
00240 #ifdef HAVE_RGG16
00241                     m_FileOutput << "group 'edge" << (m_nSides*(p-1) + q ) <<"' equals curve with name 'side_edge"
00242                                  << (m_nSides*(p-1) + q ) << "*'" << std::endl;
00243 #else
00244                     m_FileOutput << "group 'edge" << (m_nSides*(p-1) + q ) <<"' equals curve with name 'side_edge"
00245                                  << (m_nSides*(p-1) + q ) << "@'" << std::endl;
00246 #endif
00247 
00248 
00249                     m_FileOutput << "group 'vt" <<  (m_nSides*(p-1) + q )  <<"' equals vertex with z_max == z_min in curve in edge"
00250                                  <<  (m_nSides*(p-1) + q ) << std::endl;
00251 
00252                   }
00253               }
00254 
00255             // creating groups for vertices on the top surface of the duct
00256             for (int p=1; p<=m_nDuct; p++){
00257                 for(int q=1;q<=m_nSides; q++){
00258 
00259                     if(q != m_nSides){
00260                         m_FileOutput << "group 'v" << (m_nSides*(p-1) + q ) <<"' intersect group vt" << (m_nSides*(p-1) + q )
00261                                      << " with group vt" <<  (m_nSides*(p-1) + q + 1 )  << std::endl;
00262                       }
00263                     else {
00264                         m_FileOutput << "group 'v" << (m_nSides*(p-1) + q ) <<"' intersect group vt" << (m_nSides*(p-1) + q )
00265                                      << " with group vt" <<  (m_nSides*(p-1) + 1 )  << std::endl;
00266                       }
00267                   }
00268               }
00269             // creating temp surfaces groups
00270             for (int p=1; p<=m_nDuct; p++){
00271                 for(int q=1;q<=m_nSides; q++){
00272                     m_FileOutput << "group 'st" << (m_nSides*(p-1) + q ) <<"' equals surface with z_max <> z_min in vert in v"
00273                                  << (m_nSides*(p-1) + q ) << "'" << std::endl;
00274                   }
00275               }
00276 
00277             // creating surface groups for obtaining surfaces
00278             for (int p=1; p<=m_nDuct; p++){
00279                 for(int q=1;q<=m_nSides; q++){
00280                     if(q != 1){
00281                         m_FileOutput << "group 's" << (m_nSides*(p-1) + q ) <<"' intersect group st"  << (m_nSides*(p-1) + q )
00282                                      << " with group st" <<  (m_nSides*(p-1) + q - 1 )  << std::endl;
00283                       }
00284                     else {
00285                         m_FileOutput << "group 's" << (m_nSides*(p-1) + q ) <<"' intersect group st" << (m_nSides*(p-1) + q )
00286                                      << " with group st" <<  (m_nSides*(p-1) + m_nSides )  << std::endl;
00287                       }
00288                   }
00289               }
00290 
00291             // renaming the skin side surfaces
00292             for (int p=1; p<=m_nDuct; p++){
00293                 for(int q=1;q<=m_nSides; q++){
00294                     m_FileOutput << "surface in group s" <<  (m_nSides*(p-1) + q ) << " rename 'side_surface"
00295                                  <<  (m_nSides*(p-1) + q ) << "'" << std::endl;
00296 
00297                   }
00298               }
00299           }
00300 
00301         if(m_szMeshType == "hex"){
00302 
00303             //now set the sizes
00304             m_FileOutput << "#Set Meshing Scheme and Sizes, use template.jou to specify sizes" << std::endl;
00305 
00306             for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00307                 szGrp = "g_"+ m_szAssmMat(p);
00308                 szSize =  m_szAssmMat(p) + "_size";
00309                 szSurfBot = m_szAssmMat(p) + "_bot";
00310                 szSize =  m_szAssmMat(p) + "_surf_size";
00311 #ifdef HAVE_RGG16
00312                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfBot  << "*\"" << std::endl;
00313 #else
00314                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfBot  << "\"" << std::endl;
00315 #endif
00316                 m_FileOutput << "surface in tmpgrp  size {"  << szSize <<"}" << std::endl;
00317               }
00318             m_FileOutput << "#" << std::endl;
00319           }
00320       }
00321     if(m_szMeshType == "hex"){
00322         // some more common stuff meshing top surfaces set the sizes and mesh
00323         m_FileOutput << "#Surfaces mesh, use template.jou to specify sizes" << std::endl;
00324         for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00325             szSurfTop = m_szAssmMat(p) + "_top";
00326             szGrp = "g_"+ m_szAssmMat(p);
00327             szSize =  m_szAssmMat(p) + "_surf_size";
00328             if(m_szMeshScheme == "hole" && m_nBLAssemblyMat == 0){
00329 #ifdef HAVE_RGG16
00330                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "*\"" << std::endl;
00331 #else
00332                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "\"" << std::endl;
00333 #endif
00334                 m_FileOutput << "group 'remove_hole' intersect group tmpgrp with group hole_surfaces" << std::endl;
00335                 m_FileOutput << "#{nIntersect=NumInGrp('remove_hole')}" << std::endl;
00336                 m_FileOutput << "#{If(nIntersect==0)}" << std::endl;
00337                 m_FileOutput << "surface in tmpgrp  size {"  << szSize <<"}" << std::endl;
00338                 m_FileOutput << "surface in tmpgrp scheme {" << "PAVE" << "}"  << std::endl;
00339                 m_FileOutput << "#{endif}"  << std::endl;
00340               }
00341             else{
00342 #ifdef HAVE_RGG16
00343                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "*\"" << std::endl;
00344 #else
00345                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "\"" << std::endl;
00346 #endif
00347                 m_FileOutput << "surface in tmpgrp  size {"  << szSize <<"}" << std::endl;
00348                 m_FileOutput << "surface in tmpgrp scheme {" << "PAVE" << "}"  << std::endl;
00349               }
00350 
00351             if (p==1 && m_edgeInterval != 99){
00352 #ifdef HAVE_RGG16
00353                 m_FileOutput << "group 'sz_edges" <<"' equals curve with name 'side_edge*'"<< std::endl;
00354 #else
00355                 m_FileOutput << "group 'sz_edges" <<"' equals curve with name 'side_edge'"<< std::endl;
00356 #endif
00357                 m_FileOutput << "curve in sz_edges interval {TOP_EDGE_INTERVAL}" << std::endl;
00358               }
00359 
00360             //    m_FileOutput << "mesh surface in " << szGrp << "\n#" << std::endl;
00361 
00362             // dumping these sizes schemes.jou also
00363             m_SchemesFile << "#{"  << szSize <<" = RADIAL_MESH_SIZE}" << std::endl;
00364           }
00365         m_FileOutput << "#" << std::endl;
00366 
00367         // mesh all command after meshing surface
00368         if (m_nDuct <= 1 ){
00369 #ifdef HAVE_RGG16
00370             m_FileOutput << "group 'tmpgrp' add surface with name '*_top*'" << std::endl;
00371 #else
00372             m_FileOutput << "group 'tmpgrp' add surface with name '_top'" << std::endl;
00373 #endif
00374             if (m_nBLAssemblyMat !=0){ // only if boundary layers are specified
00375                 m_FileOutput << "group 'tmpgrp1' subtract innerduct from tmpgrp" << std::endl;
00376                 m_FileOutput << "group 'tmpgrp2' subtract bl_surfaces from tmpgrp1" << std::endl;
00377                 m_FileOutput << "mesh tmpgrp2" << std::endl;
00378               }
00379             else
00380               {
00381                 m_FileOutput << "mesh tmpgrp" << std::endl;
00382               }
00383           }
00384         else {
00385             m_FileOutput << "#Meshing top surface" << std::endl;
00386             //m_FileOutput << "mesh surface with z_coord = " << z2 << std::endl;
00387             if(m_szMeshScheme == "hole" && m_nBLAssemblyMat == 0){
00388 #ifdef HAVE_RGG16
00389                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "*\"" << std::endl;
00390 #else
00391                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "\"" << std::endl;
00392 #endif
00393                 m_FileOutput << "group 'remove_hole' intersect group tmpgrp with group hole_surfaces" << std::endl;
00394                 m_FileOutput << "#{nIntersect=NumInGrp('remove_hole')}" << std::endl;
00395                 m_FileOutput << "#{If(nIntersect==0)}" << std::endl;
00396                 m_FileOutput << "surface in tmpgrp  size {"  << szSize <<"}" << std::endl;
00397                 m_FileOutput << "surface in tmpgrp scheme {" << "PAVE" << "}"  << std::endl;
00398                 m_FileOutput << "#{endif}"  << std::endl;
00399                 m_FileOutput << "mesh surface with z_coord = {Zmax}" << std::endl;
00400               }
00401             else if (m_nBLAssemblyMat != 0){ // mesh by spefifying boundary layers or mesh partially
00402 #ifdef HAVE_RGG16
00403                 m_FileOutput << "group 'tmpgrp' equals surface with name '*_top*'" << std::endl;
00404 #else
00405                 m_FileOutput << "group 'tmpgrp' equals surface with name '_top'" << std::endl;
00406 #endif
00407                 m_FileOutput << "group 'tmpgrp1' subtract innerduct from tmpgrp" << std::endl;
00408                 m_FileOutput << "group 'tmpgrp2' subtract bl_surfaces from tmpgrp1" << std::endl;
00409                 m_FileOutput << "group 'tmpgrp3' equals surface in tmpgrp2 with z_coord = {Zmax}" << std::endl;
00410 
00411                 m_FileOutput << "surface in tmpgrp3  size {"  << szSize <<"}" << std::endl;
00412                 m_FileOutput << "surface in tmpgrp3 scheme {" << "PAVE" << "}"  << std::endl;
00413                 m_FileOutput << "mesh tmpgrp3" << std::endl;
00414 
00415               }
00416             else {
00417 #ifdef HAVE_RGG16
00418                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "*\"" << std::endl;
00419 #else
00420                 m_FileOutput << "group 'tmpgrp' equals surface with name \""  << szSurfTop  << "\"" << std::endl;
00421 #endif
00422                 m_FileOutput << "surface in tmpgrp  size {"  << szSize <<"}" << std::endl;
00423                 m_FileOutput << "surface in tmpgrp scheme {" << "PAVE" << "}"  << std::endl;
00424                 m_FileOutput << "mesh surface with z_coord = {Zmax}" << std::endl;
00425               }
00426           }
00427         // This part is for mesh top surfaces only when boundary layer surfaces are specified
00428         if (m_nBLAssemblyMat !=0){
00429             // Also look for material name in BL material list
00430             for (int ll=1; ll<= m_nBLAssemblyMat; ll++){
00431                 bool duct = false;
00432                 for (int n = 0; n < (int) m_szDuctMats.size(); n++){
00433                     if (strcmp(m_szDuctMats[n].c_str(), m_szBLAssmMat(ll).c_str()) == 0)
00434                       duct = true;
00435                     else
00436                       duct = false;
00437                   }
00438                 if (duct){                 //We want to use this part with pair node only for ducts and not cylinderical pins so check if this material is duct or not
00439                     if (m_edgeInterval != 99)
00440                       m_FileOutput << "curve in surf in " << m_szBLAssmMat(ll) << "_hole_surfaces interval {TOP_EDGE_INTERVAL}"<< std::endl;
00441                     m_FileOutput << "mesh vertex in surf in " << m_szBLAssmMat(ll) << "_hole_surfaces with z_coord = {Zmax}" << std::endl;
00442                     m_FileOutput << "#{corner1 = Id('node')} " << std::endl;
00443                     m_FileOutput << "group 'gcurves' equals curve in surface in " << m_szBLAssmMat(ll) << "_hole_surfaces'" << std::endl;
00444                     m_FileOutput << "#{_cntr=0} " << "\n" <<
00445                                     "#{_tmp_dis=0} " << "\n" <<
00446                                     "#{_min_dis=0}  " << "\n" <<
00447                                     "#{_closest_node=11} " << "\n" <<
00448 
00449                                     "group 'v_node' equals node in volume in surface in " <<  m_szBLAssmMat(ll) << "_hole_surfaces" << "\n" <<
00450                                     "group v_node remove node {corner1} " << "\n" <<
00451                                     "#{xc1 = Nx(corner1)} " << "\n" <<
00452                                     "#{yc1 = Ny(corner1)} " << "\n" <<
00453                                     "#{_num_nodes = NumInGrp('v_node')} " << "\n" <<
00454                                     "#{_min_dis = 1.e10} " << "\n" <<
00455                                     "#{Loop(20)} " << "\n" <<
00456                                     "#{_node_id = GroupMemberId('v_node', 'node', _cntr)} " << "\n" <<
00457                                     "#{_xni = Nx(_node_id)} " << "\n" <<
00458                                     "#{_yni = Ny(_node_id)} " << "\n" <<
00459                                     "#{_tmp_dis = (xc1 - _xni)*(xc1 -_xni) + (yc1 -_yni)*(yc1 - _yni)} " << "\n" <<
00460                                     "#{if(_tmp_dis < _min_dis)} " << "\n" <<
00461                                     "#{ _closest_node = _node_id} " << "\n" <<
00462                                     "# {_min_dis=_tmp_dis} " << "\n" <<
00463                                     "#{endif} " << "\n" <<
00464                                     "#{_cntr++} " << "\n" <<
00465                                     "#{if (_cntr >_num_nodes)} " << "\n" <<
00466                                     "#{break} " << "\n" <<
00467                                     "#{endif} " << "\n" <<
00468                                     "#{EndLoop} " << "\n" << std::endl;
00469 
00470                     // This must be used only for ducts
00471                     //   if (m_szBLAssmMat(ll) == duct material or it's not pin material')
00472                     m_FileOutput << "surf in group " << m_szBLAssmMat(ll) << "_hole_surfaces scheme hole rad_intervals "
00473                                  << m_nBLMatIntervals(ll) << " bias " << m_dBLMatBias(ll) << " pair node {corner1} with node {_closest_node}" << std::endl;
00474                   }
00475                 else { // this is regular cylinder
00476                     m_FileOutput << "surf in group " << m_szBLAssmMat(ll) << "_hole_surfaces scheme hole rad_intervals "
00477                                  << m_nBLMatIntervals(ll) << " bias " << m_dBLMatBias(ll) << std::endl;
00478                   }
00479 
00480                 m_FileOutput << "mesh surf in group " << m_szBLAssmMat(ll) << "_hole_surfaces with z_coord = {Zmax}" << std::endl;
00481                 if(strcmp(m_szSmooth.c_str(),"on") == 0)
00482                   m_FileOutput << "smooth surf in group " << m_szBLAssmMat(ll) << "_hole_surfaces" << std::endl;
00483               }
00484             m_FileOutput << "mesh surf in innerduct with z_coord = {Zmax}" << std::endl;
00485           }
00486 
00487         if(m_nPlanar == 0){ // volumes only
00488             if (m_nDuct == 1){
00489                 m_FileOutput << "surf with z_coord > {Z_MID -.1*Z_HEIGHT}" <<
00490                                 " and z_coord < {Z_MID + .1*Z_HEIGHT} size {AXIAL_MESH_SIZE}" << std::endl ;
00491                 m_FileOutput << "mesh vol all" << std::endl;
00492               }
00493             else if (m_nDuct > 1){
00494                 m_FileOutput << "### Setting Z intervals on ducts and meshing along Z " << std::endl;
00495                 for( int p=m_nDuct; p>= 1; p--){
00496                     if(dMid == 0){ // z - centered
00497                         m_FileOutput << "surf with z_coord  > " << m_dMZAssm(p, 1) - dHeight/2.0
00498                                      << " and z_coord < " << m_dMZAssm(p, 2) - dHeight/2.0 << " interval " << "{BLOCK" << p << "_Z_INTERVAL}" << std::endl;
00499                         m_FileOutput << "mesh vol with z_coord  > " << m_dMZAssm(p, 1) - dHeight/2.0
00500                                      << " and z_coord < " << m_dMZAssm(p, 2) - dHeight/2.0 << std::endl;
00501                       }
00502                     else{
00503                         m_FileOutput << "surf with z_coord  > " << m_dMZAssm(p, 1)
00504                                      << " and z_coord < " << m_dMZAssm(p, 2) << " interval " << "{BLOCK" << p << "_Z_INTERVAL}" << std::endl;
00505                         m_FileOutput << "mesh vol with z_coord  > " << m_dMZAssm(p, 1)
00506                                      << " and z_coord < " << m_dMZAssm(p, 2) << std::endl;
00507 
00508                         m_FileOutput << "##" << std::endl;
00509                       }
00510                   }
00511               }
00512           }
00513       }
00514 
00515     else if(m_szMeshType == "tet"){
00516         m_FileOutput << "##"<< std::endl;
00517         m_FileOutput << "# groupings for creating vertex groups"<< std::endl;
00518         for (int p=1; p<=m_nDuct; p++){
00519             for(int q=1;q<=m_nSides; q++){
00520 #ifdef HAVE_RGG16
00521                 m_FileOutput << "group 'edge" << (m_nSides*(p-1) + q ) <<"' equals curve with name 'side_edge"
00522                              << (m_nSides*(p-1) + q ) << "*'" << std::endl;
00523 #else
00524                 m_FileOutput << "group 'edge" << (m_nSides*(p-1) + q ) <<"' equals curve with name 'side_edge"
00525                              << (m_nSides*(p-1) + q ) << "@'" << std::endl;                
00526 #endif
00527 
00528                 m_FileOutput << "group 'vt" <<  (m_nSides*(p-1) + q )  <<"' equals vertex with z_max == z_min in curve in edge"
00529                              <<  (m_nSides*(p-1) + q ) << std::endl;
00530 
00531               }
00532           }
00533 
00534         // creating groups for vertices on the top surface of the duct
00535         for (int p=1; p<=m_nDuct; p++){
00536             for(int q=1;q<=m_nSides; q++){
00537 
00538                 if(q != m_nSides){
00539                     m_FileOutput << "group 'v" << (m_nSides*(p-1) + q ) <<"' intersect group vt" << (m_nSides*(p-1) + q )
00540                                  << " with group vt" <<  (m_nSides*(p-1) + q + 1 )  << std::endl;
00541                   }
00542                 else {
00543                     m_FileOutput << "group 'v" << (m_nSides*(p-1) + q ) <<"' intersect group vt" << (m_nSides*(p-1) + q )
00544                                  << " with group vt" <<  (m_nSides*(p-1) + 1 )  << std::endl;
00545                   }
00546               }
00547           }
00548 
00549         // creating temp surfaces groups
00550         for (int p=1; p<=m_nDuct; p++){
00551             for(int q=1;q<=m_nSides; q++){
00552                 m_FileOutput << "group 'st" << (m_nSides*(p-1) + q ) <<"' equals surface with z_max <> z_min in vert in v"
00553                              << (m_nSides*(p-1) + q ) << "'" << std::endl;
00554               }
00555           }
00556 
00557         // creating side curve and surface groups
00558         for (int p=1; p<=m_nDuct; p++){
00559             for(int q=1;q<=m_nSides; q++){
00560 
00561                 m_FileOutput << "group 'c" <<  (m_nSides*(p-1) + q )  <<"' equals curve with z_max <> z_min in vert in v"
00562                              <<  (m_nSides*(p-1) + q ) << std::endl;
00563 
00564                 if(q != 1){
00565                     m_FileOutput << "group 's" << (m_nSides*(p-1) + q ) <<"' intersect group st"  << (m_nSides*(p-1) + q )
00566                                  << " with group st" <<  (m_nSides*(p-1) + q - 1 )  << std::endl;
00567                   }
00568                 else {
00569                     m_FileOutput << "group 's" << (m_nSides*(p-1) + q ) <<"' intersect group st" << (m_nSides*(p-1) + q )
00570                                  << " with group st" <<  (m_nSides*(p-1) + m_nSides )  << std::endl;
00571                   }
00572               }
00573           }
00574 
00575         // renaming the side surfaces for getting the split surfaces later
00576         for (int p=1; p<=m_nDuct; p++){
00577             for(int q=1;q<=m_nSides; q++){
00578                 m_FileOutput << "surface in group s" <<  (m_nSides*(p-1) + q ) << " rename 'side_surface"
00579                              <<  (m_nSides*(p-1) + q ) << "'" << std::endl;
00580               }
00581           }
00582 
00583         // splitting the surfaces
00584         for (int p=1; p<=m_nDuct; p++){
00585             for(int q=1;q<=m_nSides; q++){
00586 
00587                 m_FileOutput << "split surface in group s" <<  (m_nSides*(p-1) + q )  <<" direction curve in group c"
00588                              <<  (m_nSides*(p-1) + q ) << std::endl;
00589               }
00590           }
00591 
00592         // get all the split surfaces in individual groups
00593         for (int p=1; p<=m_nDuct; p++){
00594             for(int q=1;q<=m_nSides; q++){
00595 #ifdef HAVE_RGG16
00596                 m_FileOutput << "group 'sname" << (m_nSides*(p-1) + q ) <<  "' equals surface with name 'side_surface"
00597                              <<  (m_nSides*(p-1) + q ) << "*'"<< std::endl;
00598 #else
00599                 m_FileOutput << "group 'sname" << (m_nSides*(p-1) + q ) <<  "' equals surface with name 'side_surface"
00600                              <<  (m_nSides*(p-1) + q ) << "'"<< std::endl;
00601 #endif
00602                 m_FileOutput << "group 'svert" << (m_nSides*(p-1) + q ) <<  "' equals surface in vert in v"
00603                              <<  (m_nSides*(p-1) + q ) << std::endl;
00604                 m_FileOutput << "group 'ssplit" << (m_nSides*(p-1) + q ) <<  "' intersect group sname" <<  (m_nSides*(p-1) + q )
00605                              << " with group svert" << (m_nSides*(p-1) + q ) << std::endl;
00606               }
00607           }
00608 
00609         // get all the split surfaces in individual groups
00610         for (int p=1; p<=m_nDuct; p++){
00611             for(int q=1;q<=m_nSides; q++){
00612 
00613                 if(q != 1){
00614                     m_FileOutput << "group 'ssplit_" << (m_nSides*(p-1) + q ) <<"' intersect group sname"  << (m_nSides*(p-1) + q )
00615                                  << " with group svert" <<  (m_nSides*(p-1) + q - 1 )  << std::endl;
00616                   }
00617                 else {
00618                     m_FileOutput << "group 'ssplit_" <<  (m_nSides*(p-1) + q ) <<"' intersect group sname" << (m_nSides*(p-1) + q )
00619                                  << " with group svert" <<  (m_nSides*(p-1) + m_nSides )  << std::endl;
00620                   }
00621               }
00622           }
00623         // imprint
00624         m_FileOutput << "#Imprint geometry" << std::endl;
00625         m_FileOutput << "imprint all" << std::endl;
00626         m_FileOutput << "#" << std::endl;
00627         m_FileOutput << "Merge Tolerance " << m_dMergeTol << std::endl;
00628         m_FileOutput << "#" << std::endl;
00629 
00630         // merge
00631         m_FileOutput << "#Merge geometry" << std::endl;
00632         m_FileOutput << "merge all" << std::endl;
00633         m_FileOutput << "#" << std::endl;
00634 
00635         m_FileOutput << "#Set mesh scheme and size" << std::endl;
00636         m_FileOutput << "volume all scheme {TET} size {TET_MESH_SIZE}" << std::endl;
00637 
00638         // mesh one side of each duct, such that one is flipped mesh of the other
00639         for (int p=1; p<=m_nDuct; p++){
00640 
00641             m_FileOutput << "mesh surface in group ssplit" <<  (m_nSides*(p-1) + 1) << std::endl;
00642 
00643             m_FileOutput << "surface in group ssplit_" << (m_nSides*(p-1) + 1) << " scheme copy source surface in group ssplit"
00644                          <<  (m_nSides*(p-1) + 1)
00645                           << " source curve in group c" <<  (m_nSides*(p-1) + 1 ) << " target curve in group c" <<  (m_nSides*(p-1) + m_nSides )
00646                           << " source vertex in group v" <<  (m_nSides*(p-1) + 1) << " target vertex in group v"  <<  (m_nSides*(p-1) + m_nSides )
00647                           << " nosmoothing" << std::endl;
00648 
00649             m_FileOutput << "mesh surface in group  ssplit_" << (m_nSides*(p-1) + 1) << std::endl;
00650           }
00651 
00652         // setting the copy mesh commands on the above pair of split surfaces to have all surfaces symmetrical
00653         for (int p=1; p<=m_nDuct; p++){
00654             for(int q=1;q<=m_nSides; q++){
00655                 if(q != m_nSides){
00656 #ifdef HAVE_RGG16
00657                     m_FileOutput << "copy mesh surface in ssplit" <<  (m_nSides*(p-1) + 1)
00658                                  << " onto surface in ssplit" << (m_nSides*(p-1) + q + 1 )
00659                                  << " source curve in group c" << (m_nSides*(p-1) + 1)
00660                                  << " source vertex in group v" << (m_nSides*(p-1) + 1)                                   
00661                                  << " target curve in group c" <<  (m_nSides*(p-1) + q + 1) 
00662                                  << " target vertex in group v" <<  (m_nSides*(p-1) + q + 1) << " " <<  std::endl;
00663 
00664                     m_FileOutput << "copy mesh surface in ssplit_" << (m_nSides*(p-1) + 1 )
00665                                  << " onto surface in ssplit_" << (m_nSides*(p-1) + q +1 )
00666                                  << " source curve in group c" << (m_nSides*p)
00667                                  << " source vertex in group v" << (m_nSides*p)
00668                                  << " target curve in group c" <<  (m_nSides*(p-1) + q) 
00669                                  << " target vertex in group v" <<  (m_nSides*(p-1) + q) << " " << std::endl;
00670 #else
00671                     m_FileOutput << "copy mesh surface in ssplit" <<  (m_nSides*(p-1) + 1)
00672                                  << " onto surface in ssplit" << (m_nSides*(p-1) + q + 1 )
00673                                  << " source vertex in group v" << (m_nSides*(p-1) + 1)
00674                                  << " target vertex in group v" <<  (m_nSides*(p-1) + q + 1) << " nosmoothing" <<  std::endl;
00675 
00676                     m_FileOutput << "copy mesh surface in ssplit_" << (m_nSides*(p-1) + 1 )
00677                                  << " onto surface in ssplit_" << (m_nSides*(p-1) + q +1 )
00678                                  << " source vertex in group v" << (m_nSides*p)
00679                                  << " target vertex in group v" <<  (m_nSides*(p-1) + q) << " nosmoothing" << std::endl;          
00680 #endif
00681 
00682                   }
00683                 else{
00684                     // do nothing
00685                   }
00686               }
00687           }
00688 
00689         m_FileOutput << "# Mesh all volumes now" << std::endl;
00690         m_FileOutput << "mesh vol all" << std::endl;
00691       }
00692 
00693     // create and sidesets after meshing
00694     m_FileOutput << "#" << std::endl;
00695     //    }
00696     if(m_szSideset == "yes"){
00697         // top surface sidesets
00698         m_FileOutput << "#Creating top surface sidesets" << std::endl;
00699         m_FileOutput << "create group 'surfall'" << std::endl;
00700         for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00701             ++nSideset;
00702             szSurfTop = m_szAssmMat(p)+"_top";
00703             // Avoid creation if empty sideset
00704 #ifdef HAVE_RGG16
00705             m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "*' in vol in block " << m_nMaterialSetId + p -1 << std::endl;
00706 #else
00707             m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "' in vol in block " << m_nMaterialSetId + p -1 << std::endl;
00708 #endif
00709             m_FileOutput << "sideset " << nSideset << " surface in tmpgrp " << std::endl;
00710             m_FileOutput << "sideset " << nSideset << " name \"" << szSurfTop << "_ss\"" << std::endl;
00711           }
00712         m_FileOutput << "#" << std::endl;
00713         for(int p=1;p<=m_nBLAssemblyMat;p++){
00714             ++nSideset;
00715 
00716             // Avoid creation if empty sideset
00717 #ifdef HAVE_RGG16
00718             m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "*' in vol in block " << m_nMaterialSetId + p -1 << std::endl;
00719 #else
00720             m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "' in vol in block " << m_nMaterialSetId + p -1 << std::endl;
00721 #endif
00722             m_FileOutput << "sideset " << nSideset << " surface in tmpgrp " << std::endl;
00723             m_FileOutput << "sideset " << nSideset << " name \"" << szSurfTop << "_ss\"" << std::endl;
00724           }
00725         m_FileOutput << "#" << std::endl;
00726       }
00727 
00728 
00729     if(m_nPlanar ==0){
00730         if(m_szSideset == "yes"){
00731             // now create bot and side sideset
00732             m_FileOutput << "#Creating bot/side surface sidesets" << std::endl;
00733             for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00734                 szSurfTop = m_szAssmMat(p)+"_bot";
00735                 m_FileOutput << "#" << std::endl;
00736                 ++nSideset;
00737 #ifdef HAVE_RGG16
00738                 m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "*' in vol in block " << m_nMaterialSetId + p -1 << std::endl;
00739 #else
00740                 m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "' in vol in block " << m_nMaterialSetId + p -1 << std::endl;
00741 #endif
00742                 m_FileOutput << "sideset " << nSideset << " surface in tmpgrp " << std::endl;
00743                 m_FileOutput << "sideset " << nSideset << " name \"" << szSurfTop << "_ss\"" << std::endl;
00744               }
00745             for(int p=1;p<=m_nBLAssemblyMat;p++){
00746                 ++nSideset;
00747                 szSurfTop = m_szAssmMat(p)+"_bot";
00748 
00749                 // Avoid creation if empty sideset
00750 #ifdef HAVE_RGG16
00751                 m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << "*" << std::endl;
00752 #else
00753                 m_FileOutput << "group 'tmpgrp' equals surface with name '" << szSurfTop << std::endl;
00754 #endif
00755                 m_FileOutput << "sideset " << nSideset << " surface in tmpgrp " << std::endl;
00756                 m_FileOutput << "sideset " << nSideset << " name \"" << szSurfTop << "_ss\"" << std::endl;
00757               }
00758             m_FileOutput << "#" << std::endl;
00759 
00760             for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00761                 szSurfSide = m_szAssmMat(p)+"_side";
00762                 ++nSideset;
00763                 if(m_szGeomType == "hexagonal"){
00764                     for (int u=1; u<=6;u++){
00765 #ifdef HAVE_RGG16
00766                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "*'" << std::endl;
00767 #else
00768                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "'" << std::endl;
00769 #endif
00770                       }
00771                     m_FileOutput << "sideset " << nSideset << " surface in tmpgrp1 tmpgrp2 tmpgrp3 tmpgrp4 tmpgrp5 tmpgrp6" << std::endl;
00772                     m_FileOutput << "sideset " << nSideset << " name \"" << szSurfSide << "1_ss\"" << std::endl;
00773                     ++nSideset;
00774                   }
00775                 if(m_szGeomType == "hexagonal"){
00776                     for (int u=7; u<=12;u++){
00777 #ifdef HAVE_RGG16
00778                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "*'" << std::endl;
00779 #else
00780                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "'" << std::endl;
00781 #endif
00782                       }
00783                     m_FileOutput << "sideset " << nSideset << " surface in tmpgrp7 tmpgrp8 tmpgrp9 tmpgrp10 tmpgrp11 tmpgrp12" << std::endl;
00784                     m_FileOutput << "sideset " << nSideset << " name \"" << szSurfSide << "2_ss\"" << std::endl;
00785                   }
00786                 if(m_szGeomType == "rectangular"){
00787                     for (int u=1; u<=4;u++){
00788 #ifdef HAVE_RGG16
00789                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "*'" << std::endl;
00790 #else
00791                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "'" << std::endl;
00792 #endif
00793                       }
00794                     m_FileOutput << "sideset " << nSideset << " surface in tmpgrp1 tmpgrp2 tmpgrp3 tmpgrp4'" << std::endl;
00795                     m_FileOutput << "sideset " << nSideset << " name \"" << szSurfSide << "2_ss\"" << std::endl;
00796                     ++nSideset;
00797                   }
00798 
00799                 if(m_szGeomType == "rectangular"){
00800                     for (int u=5; u<=8;u++){
00801 #ifdef HAVE_RGG16
00802                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "*'" << std::endl;
00803 #else
00804                         m_FileOutput << "group 'tmpgrp" << u <<"' equals surf with name '" << szSurfSide << u << "'" << std::endl;
00805 #endif
00806                       }
00807                     m_FileOutput << "sideset " << nSideset << " surface in tmpgrp5 tmpgrp6 tmpgrp7 tmpgrp8'" << std::endl;
00808                     m_FileOutput << "sideset " << nSideset << " name \"" << szSurfSide << "2_ss\"" << std::endl;
00809                   }
00810               }
00811 
00812 
00813             m_FileOutput << "#" << std::endl;
00814 
00815             m_FileOutput << "#Creating sideset for outer most side surfaces" << std::endl;
00816             ++nSideset;
00817 #ifdef HAVE_RGG16
00818             m_FileOutput << "group 'tmpgrp' equals surf with name 'side_surface*'" << std::endl;
00819 #else
00820             m_FileOutput << "group 'tmpgrp' equals surf with name 'side_surface'" << std::endl;
00821 #endif
00822             m_FileOutput << "sideset " << nSideset << " surface in tmpgrp " << std::endl;
00823             m_FileOutput << "sideset " << nSideset << " name \"" << "outer_side_ss\"" << std::endl;
00824           }
00825       }
00826     if(m_nHblock != -1){ // if more blocks are needed axially, create'em using hexes and the end
00827         // block creation dumps
00828         m_FileOutput << "#Creating blocks, Note: you might need to combine some blocks" << std::endl;
00829         // group creation dumps. each material has a group
00830         m_FileOutput << "#Creating groups" << std::endl;
00831         if(m_szMeshType == "hex"){
00832             for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00833                 szGrp = "g_"+ m_szAssmMat(p);
00834                 m_szAssmMat(p);
00835                 if(m_nPlanar ==1){
00836 #ifdef HAVE_RGG16
00837                     m_FileOutput << "group \"" << szGrp << "\" add surface with name \"" << m_szAssmMat(p) <<"*\"" << std::endl;
00838 #else
00839                     m_FileOutput << "group \"" << szGrp << "\" add surface with name \"" << m_szAssmMat(p) <<"\"" << std::endl;
00840 #endif
00841                   }
00842                 else{
00843 #ifdef HAVE_RGG16
00844                     m_FileOutput << "group \"" << szGrp << "\" add body with name \"" << m_szAssmMat(p) <<"*\"" << std::endl;
00845 #else
00846                     m_FileOutput << "group \"" << szGrp << "\" add body with name \"" << m_szAssmMat(p) <<"\"" << std::endl;
00847 #endif
00848                   }
00849               }
00850             for(int p = 1; p <=  (m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00851                 szBlock = "b_"+ m_szAssmMat(p);
00852                 szGrp = "g_"+ m_szAssmMat(p);
00853                 m_FileOutput << "#{nb" << p << " =NumInGrp('" << szGrp << "')}" << std::endl;
00854                 m_FileOutput << "#{Ifndef(nb" << p << ")}" << "\n" << "#{else}" << std::endl;
00855                 if(m_nPlanar ==1){
00856                     m_FileOutput << "block " << m_nMaterialSetId + p -1 << " surface in " << szGrp  << std::endl;
00857                     m_FileOutput << "block " << m_nMaterialSetId + p -1 << " name \"" << szBlock <<"\""<< std::endl;
00858                   }
00859                 else{
00860                     m_FileOutput << "block " << m_nMaterialSetId + p -1 << " hex in body in " << szGrp  << std::endl;
00861                     m_FileOutput << "block " << m_nMaterialSetId + p -1 << " name \"" << szBlock <<"\""<< std::endl;
00862                   }
00863                 m_FileOutput << "#{endif}" << std::endl;
00864               }
00865             m_FileOutput << "#" << std::endl;
00866           }
00867         else{
00868             std::cout << "Error: Terminating journal file writing. \n Hex block (Hblock keyword) is not supported for a tet mesh." << std::endl;
00869             exit(1);
00870           }
00871       }
00872 
00873     // create super blocks
00874     if(m_nSuperBlocks > 0){
00875         for(int o = 1; o <= m_nSuperBlocks; o++){
00876             m_FileOutput << "block " << sb(o).m_nSuperBlockId << " vol in block ";
00877             for (int p = 1; p <= sb(o).m_nNumSBContents; p++){
00878                 m_FileOutput << m_nMaterialSetId + sb(o).m_nSBContents(p) << " ";
00879               }
00880             m_FileOutput << "\n" << "block " << sb(o).m_nSuperBlockId << " name '" << sb(o).m_szSuperBlockAlias << "'" << std::endl;
00881             m_FileOutput << "delete block " ;
00882             for (int q = 1; q <= sb(o).m_nNumSBContents; q++){
00883                 m_FileOutput << m_nMaterialSetId + sb(o).m_nSBContents(q) << " ";
00884               }
00885             m_FileOutput << "\n" << std::endl;
00886           }
00887       }
00888 
00889 
00890 
00891     if(m_nHblock > 0){
00892         // now dump the commands for making hex layers as blocks and subtracting from original
00893         double delta = (m_dZend - m_dZstart)/m_nHblock;
00894         for(int i=0; i<(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat); i++){
00895             m_FileOutput << "## BLOCK CREATION USING HEXES" << std::endl;
00896             for(int j=0; j<m_nHblock; j++){
00897                 m_FileOutput << "group 'tmpgrp" << j+1 << "' equals hex in block " <<  m_nMaterialSetId + i
00898                              << " with z_coord < " << m_dZstart + (j+1)*delta << " and z_coord > "
00899                              << m_dZstart + j*delta << std::endl;
00900               }
00901             for(int j=0; j<m_nHblock; j++){
00902                 m_FileOutput << "block " <<  m_nMaterialSetId+i << " group tmpgrp" << j+1 << " remove" << std::endl;
00903               }
00904             for(int j=0; j<m_nHblock; j++){
00905                 if((m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat) < 10)
00906                   m_FileOutput << "block " << j+1 <<  m_nMaterialSetId+i << " group tmpgrp" << j+1 << std::endl;
00907                 else
00908                   m_FileOutput << "block " << (j+1)*10 <<  m_nMaterialSetId+i << " group tmpgrp" << j+1 << std::endl;
00909               }
00910           }
00911       }
00912     if(m_nMaterialSetId != 1)
00913       m_FileOutput << "renumber hex all start_id " << MAXLINES*1000 << std::endl;
00914     // color now
00915     m_FileOutput << "#Set color for different parts" << std::endl;
00916     if(m_nPlanar == 0){ // volumes only
00917         for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00918             szGrp = "g_"+ m_szAssmMat(p);
00919             if(p>20)
00920               nColor = 1;
00921             else
00922               nColor = p;
00923             m_FileOutput << "color body in " << szGrp << " " << color[nColor] << std::endl;
00924           }
00925       }
00926     else{ //surfaces
00927         // color now
00928         for(int p=1;p<=(m_szAssmMatAlias.GetSize() - m_nBLAssemblyMat);p++){
00929             szGrp = "g_"+ m_szAssmMat(p);
00930             if(p>20)
00931               nColor = 1;
00932             else
00933               nColor = p;
00934             m_FileOutput << "color surface in " << szGrp << " " << color[nColor] << std::endl;
00935           }
00936       }
00937 
00938     m_FileOutput << "delete group all" << std::endl;
00939     // save as .cub file dump
00940     m_FileOutput << "#\n#Save file" << std::endl;
00941     if(save_exodus){
00942         std::string szSave = m_szFile + ".exo";
00943         std::transform(szSave.begin(), szSave.end(), szSave.begin(), ::tolower);
00944         m_FileOutput << "export mesh '"<< szSave <<"'" << " overwrite"<<std::endl;
00945       }
00946     else{
00947         std::string szSave = m_szFile + ".cub";
00948         std::transform(szSave.begin(), szSave.end(), szSave.begin(), ::tolower);
00949         m_FileOutput << "save as '"<< szSave <<"'" << " overwrite"<<std::endl;
00950       }
00951 
00952     std::cout << "Schemes file created: " << m_szSchFile << std::endl;
00953     std::cout << "Cubit journal file created: " << m_szJouFile << std::endl;
00954     if(strcmp(m_szInfo.c_str(),"on") == 0)
00955       std::cout << "Assembly info file created: " << m_szAssmInfo << std::endl;
00956 
00957     m_FileOutput << "Timer Stop" << std::endl;
00958 
00959   }
00960 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines