LCOV - code coverage report
Current view: top level - algs/AssyGen - createpincell.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 93 538 17.3 %
Date: 2020-07-01 15:24:36 Functions: 3 4 75.0 %
Branches: 162 2380 6.8 %

           Branch data     Line data    Source code
       1                 :            : 
       2                 :            : #include "meshkit/AssyGen.hpp"
       3                 :            : 
       4                 :            : namespace MeshKit
       5                 :            : {
       6                 :            : 
       7                 :          2 :   void AssyGen::CreatePinCell(int i, double dX, double dY, double dZ)
       8                 :            :   //---------------------------------------------------------------------------
       9                 :            :   //Function: Create pincell i in location dX dY and dZ
      10                 :            :   //Input:    none
      11                 :            :   //Output:   none
      12                 :            :   //---------------------------------------------------------------------------
      13                 :            :   {
      14                 :          2 :     int nRadii=0, nCyl=0, nCells = 0;
      15                 :          2 :     double dCylMoveX = 0.0, dCylMoveY = 0.0, dHeightTotal = 0.0;
      16                 :          2 :     double dHeight =0.0,dZMove = 0.0, PX = 0.0,PY = 0.0,PZ = 0.0, dP=0.0;
      17 [ +  - ][ +  - ]:          4 :     CVector<double> dVCylZPos(2), dVCylXYPos(2), dVStartZ, dVEndZ;;
         [ +  - ][ +  - ]
      18         [ +  - ]:          4 :     CVector<std::string> szVCellMat;
      19                 :          2 :     iBase_EntityHandle cell = NULL, cyl= NULL, tmp_vol= NULL,tmp_vol1= NULL, tmp_new= NULL;
      20                 :            :     (void) tmp_vol;
      21         [ +  - ]:          4 :     std::vector<iBase_EntityHandle> cp_in;
      22                 :            :     // name tag handle
      23                 :          2 :     iBase_TagHandle this_tag= NULL;
      24                 :            : 
      25         [ +  - ]:          4 :     std::string sMatName = "";
      26         [ +  - ]:          4 :     std::string sMatName1 = "";
      27                 :          2 :     int nDuctIndex = -1;
      28                 :            : 
      29         [ +  - ]:          2 :     if(strcmp(m_szInfo.c_str(),"on") == 0){
      30         [ +  - ]:          2 :         std::ostringstream os;
      31         [ +  - ]:          2 :         pin_name = "_xp";
      32         [ +  - ]:          2 :         os << (m_nTotalPincells + m_nStartpinid - 1);
      33         [ +  - ]:          2 :         os << "_";
      34         [ +  - ]:          4 :         std::string pid = os.str(); //retrieve as a string
      35         [ +  - ]:          4 :         pin_name+=pid;
      36                 :            :       }
      37                 :            : 
      38                 :            :     // get tag handle for 'NAME' tag, already created as iGeom instance is created
      39                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
      40                 :          2 :     char* tag_name = (char*)"NAME";    
      41 [ +  - ][ +  - ]:          2 :     iGeom_getTagHandle(igeomImpl->instance(), tag_name, &this_tag, &err, 4);
      42                 :            : #endif
      43                 :            : 
      44                 :            :     // get cell material
      45 [ +  - ][ +  - ]:          2 :     m_Pincell(i).GetCellMatSize(nCells);
      46         [ +  - ]:          4 :     SimpleArray<iBase_EntityHandle> cells(nCells);
      47                 :            : 
      48                 :            :     // branch when cells are present
      49         [ -  + ]:          2 :     if(nCells > 0){
      50         [ #  # ]:          0 :         dVStartZ.SetSize(nCells);
      51         [ #  # ]:          0 :         dVEndZ.SetSize(nCells);
      52         [ #  # ]:          0 :         szVCellMat.SetSize(nCells);
      53 [ #  # ][ #  # ]:          0 :         m_Pincell(i).GetCellMat(dVStartZ, dVEndZ, szVCellMat);
      54                 :            : 
      55                 :            :         // get cylinder data
      56 [ #  # ][ #  # ]:          0 :         m_Pincell(i).GetNumCyl(nCyl);
      57                 :            : 
      58         [ #  # ]:          0 :         for(int n=1;n<=nCells; n++){
      59                 :            :             // get cylinder locations
      60         [ #  # ]:          0 :             if(nCyl > 0){
      61 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylZPos(n, dVCylZPos);
      62                 :          0 :                 nDuctIndex = -1;
      63                 :            : 
      64                 :            :                 // get the index for cp_inpins based on Z-heights
      65         [ #  # ]:          0 :                 for (int dd = 1; dd <= m_nDuct; dd++){
      66 [ #  # ][ #  # ]:          0 :                     if((m_dMZAssm(dd, 2)) >= (dVCylZPos(2)) && (m_dMZAssm(dd, 1)) >= (dVCylZPos(1)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      67                 :          0 :                       nDuctIndex = dd;
      68         [ #  # ]:          0 :                     if (nDuctIndex != -1)
      69                 :          0 :                       break;
      70                 :            :                   }
      71                 :            :               }
      72 [ #  # ][ #  # ]:          0 :             dHeight = fabs(dVEndZ(n) - dVStartZ(n));
      73 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cells = []\ncyls = []\ncp_in = []" << std::endl;
      74 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "sub1 = [] \nsub2 = []" << std::endl;
      75                 :            :             
      76 [ #  # ][ #  # ]:          0 :             if(m_szGeomType =="hexagonal"){
      77                 :            : 
      78 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(dP, dHeightTotal); // this dHeight is not used in creation
      79                 :          0 :                 double dSide = dP/(sqrt(3));
      80                 :            : 
      81         [ #  # ]:          0 :                 if(nCells >0){
      82                 :            :                     // create prism
      83                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
      84                 :            :                     iGeom_createPrism(igeomImpl->instance(), dHeight, 6,
      85                 :            :                                       dSide, dSide,
      86 [ #  # ][ #  # ]:          0 :                                       &cell, &err);
      87                 :            : #endif
      88 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cell = cubit.prism( " << dHeight << ", 6, " << dSide << ", " << dSide << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      89                 :            :                   }
      90                 :            :               }
      91                 :            :             // if rectangular geometry
      92 [ #  # ][ #  # ]:          0 :             if(m_szGeomType =="rectangular"){
      93                 :            : 
      94 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(PX, PY, PZ);
      95                 :            : 
      96         [ #  # ]:          0 :                 if(nCells >0){
      97                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
      98                 :            :                     // create brick
      99 [ #  # ][ #  # ]:          0 :                     iGeom_createBrick( igeomImpl->instance(),PX,PY,dHeight,&cell,&err );
     100                 :            : #endif
     101 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cell = cubit.brick( " << PX << ", " << PY << ", " << dHeight << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     102                 :            :                   }
     103                 :            :               }
     104                 :            : 
     105 [ #  # ][ #  # ]:          0 :             dZMove = (dVStartZ(n)+dVEndZ(n))/2.0;
     106         [ #  # ]:          0 :             if(nCells > 0){
     107                 :            :                 // position the brick in assembly
     108                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     109 [ #  # ][ #  # ]:          0 :                 iGeom_moveEnt(igeomImpl->instance(), cell, dX, dY, dZMove, &err);
     110                 :            : #endif
     111 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "vector = [" << dX << ", " << dY << ", " << dZMove << "]" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     112 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.move( cell, vector)" << std::endl;
     113                 :            : 
     114 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cells.append(cell)" << std::endl;
     115         [ #  # ]:          0 :                 cells[n-1]=cell;
     116                 :            : 
     117                 :            :                 //search for the full name of the abbreviated Cell Mat and set name
     118 [ #  # ][ #  # ]:          0 :                 for(int p=1;p<= m_szAssmMatAlias.GetSize();p++){
     119 [ #  # ][ #  # ]:          0 :                     if(strcmp (szVCellMat(n).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     120 [ #  # ][ #  # ]:          0 :                         sMatName = m_szAssmMat(p);
     121                 :            :                       }
     122                 :            :                   }
     123 [ #  # ][ #  # ]:          0 :                 std::cout << "created: " << sMatName << std::endl;
                 [ #  # ]
     124                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     125                 :            :                 iGeom_setData(igeomImpl->instance(), cell, this_tag,
     126 [ #  # ][ #  # ]:          0 :                               sMatName.c_str(), sMatName.size(), &err);
     127                 :            : #endif
     128 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile  << "lid = cells[0].id()" << std::endl;
     129 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     130                 :            : 
     131         [ #  # ]:          0 :                                    if(strcmp(m_szInfo.c_str(),"on") == 0){
     132                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     133                 :            :                     iGeom_setData(igeomImpl->instance(), cell, this_tag,
     134 [ #  # ][ #  # ]:          0 :                                   pin_name.c_str(), pin_name.size(), &err);
     135                 :            : #endif
     136 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << pin_name <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     137 [ #  # ][ #  # ]:          0 :                     std::cout << "Naming pin body :" <<  pin_name << std::endl;
                 [ #  # ]
     138                 :            :                   }
     139                 :            : 
     140                 :            : 
     141 [ #  # ][ #  # ]:          0 :                 Name_Faces(sMatName, cell, this_tag);
     142 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", cell) " << std::endl;
         [ #  # ][ #  # ]
     143                 :            :               }
     144                 :            :             // loop and create cylinders
     145         [ #  # ]:          0 :             if(nCyl > 0){
     146 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylSizes(n, nRadii);
     147         [ #  # ]:          0 :                 SimpleArray<iBase_EntityHandle> cyls(nRadii);
     148                 :            : 
     149                 :            :                 //declare variables
     150         [ #  # ]:          0 :                 CVector<double> dVCylRadii(2*nRadii);
     151         [ #  # ]:          0 :                 CVector<std::string> szVMat(nRadii);
     152         [ #  # ]:          0 :                 CVector<std::string> szVCylMat(nRadii);
     153                 :          0 :                 int nType = 0;
     154                 :            :                 //get values
     155 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylRadii(n, dVCylRadii);
     156 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylPos(n, dVCylXYPos);
     157 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylMat(n, szVCylMat);
     158 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylZPos(n, dVCylZPos);
     159 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCellType(n, nType);
     160                 :            : 
     161 [ #  # ][ #  # ]:          0 :                 dHeight = dVCylZPos(2)-dVCylZPos(1);
     162                 :            : 
     163         [ #  # ]:          0 :                 for (int m=1; m<=nRadii; m++){
     164                 :            : 
     165         [ #  # ]:          0 :                     if (nType == 0){
     166                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     167 [ #  # ][ #  # ]:          0 :                         iGeom_createCylinder(igeomImpl->instance(), dHeight, dVCylRadii(m), dVCylRadii(m),
     168 [ #  # ][ #  # ]:          0 :                                              &cyl, &err);
     169                 :            : #endif
     170 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     171 [ #  # ][ #  # ]:          0 :                         std::cout << m << ": Creating cylinder with radii " << dVCylRadii(m) << std::endl;
         [ #  # ][ #  # ]
                 [ #  # ]
     172                 :            :                       }
     173                 :            :                     else{
     174                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     175 [ #  # ][ #  # ]:          0 :                         iGeom_createCone(igeomImpl->instance(), dHeight, dVCylRadii(2*m-1), dVCylRadii(2*m-1), dVCylRadii(2*m),
                 [ #  # ]
     176 [ #  # ][ #  # ]:          0 :                                          &cyl, &err);
     177                 :            : #endif
     178 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     179                 :            :                       }
     180                 :            :                     // move their centers and also move to the assembly location  ! Modify if cyl is outside brick
     181         [ #  # ]:          0 :                     dCylMoveX = dVCylXYPos(1)+dX;
     182         [ #  # ]:          0 :                     dCylMoveY = dVCylXYPos(2)+dY;
     183 [ #  # ][ #  # ]:          0 :                     dZMove = (dVCylZPos(1)+dVCylZPos(2))/2.0;
     184                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     185 [ #  # ][ #  # ]:          0 :                     iGeom_moveEnt(igeomImpl->instance(), cyl, dCylMoveX,dCylMoveY,dZMove, &err);
     186                 :            : #endif
     187 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls.append(cyl)" << std::endl;
     188                 :            : 
     189 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "vector = [" << dCylMoveX << ", " << dCylMoveY << ", " << dZMove << "]" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     190 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.move(cyl, vector)" << std::endl;
     191         [ #  # ]:          0 :                     cyls[m-1] = cyl;
     192                 :            :                   }
     193                 :            : 
     194 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl;
     195                 :            : 
     196         [ #  # ]:          0 :                 if(nCells > 0){
     197                 :            :                     // copy cyl before subtract
     198                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     199 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), cyls[nRadii-1], &tmp_vol, &err);
                 [ #  # ]
     200                 :            : #endif
     201 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_vol = cubit.copy_body(cyls[" << nRadii-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     202                 :            : 
     203                 :            :                     // subtract outer most cyl from brick
     204                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     205 [ #  # ][ #  # ]:          0 :                     iGeom_subtractEnts(igeomImpl->instance(), cells[n-1], tmp_vol, &tmp_new, &err);
                 [ #  # ]
     206                 :            : #endif
     207 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1.append(cells[" << n-1 << "])\nsub2.append(tmp_vol)" << std::endl;
         [ #  # ][ #  # ]
     208 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_new = cubit.subtract(sub2, sub1)" << std::endl;
     209 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl;
     210                 :            : 
     211 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cells.append(tmp_new[0]) \ncell = tmp_new[0]" << std::endl;
     212                 :            : 
     213                 :            :                     // copy the new into the cyl array
     214         [ #  # ]:          0 :                     cells[n-1] = tmp_new; cell = tmp_new;
     215                 :            : 
     216                 :            :                   }
     217         [ #  # ]:          0 :                 cp_in.push_back(tmp_new);
     218 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cp_in.append(tmp_new[0])" << std::endl;
     219                 :            : 
     220                 :            :                 //set tag on inner most cylinder, search for the full name of the abbreviated Cell Mat
     221 [ #  # ][ #  # ]:          0 :                 for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     222 [ #  # ][ #  # ]:          0 :                     if(strcmp (szVCylMat(1).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     223 [ #  # ][ #  # ]:          0 :                         sMatName = m_szAssmMat(p);
     224                 :            :                       }
     225                 :            :                   }
     226         [ #  # ]:          0 :                 tmp_vol1=cyls[0]; //inner most cyl
     227         [ #  # ]:          0 :                 cp_in.push_back(tmp_vol1);
     228 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_vol1 = cyls[0]\ncp_in.append(tmp_vol1)" << std::endl;
     229                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     230                 :            :                 iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     231 [ #  # ][ #  # ]:          0 :                               sMatName.c_str(), 10, &err);
     232                 :            : #endif
     233 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile  << "lid = tmp_vol1.id()" << std::endl;
     234 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     235                 :            : 
     236         [ #  # ]:          0 :                  if(strcmp(m_szInfo.c_str(),"on") == 0){
     237                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     238                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     239 [ #  # ][ #  # ]:          0 :                                   pin_name.c_str(), pin_name.size(), &err);
     240                 :            : #endif
     241 [ #  # ][ #  # ]:          0 :                     std::cout << "Naming pin body :" <<  pin_name << std::endl;
                 [ #  # ]
     242                 :            :                   }
     243                 :            : 
     244 [ #  # ][ #  # ]:          0 :                 Name_Faces(sMatName, tmp_vol1, this_tag);
     245 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_vol1) " << std::endl;
         [ #  # ][ #  # ]
     246                 :            : 
     247                 :            :                 // other cyl annulus after substraction
     248         [ #  # ]:          0 :                 for (int b=nRadii; b>1; b--){
     249                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     250 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), cyls[b-2], &tmp_vol, &err);
                 [ #  # ]
     251                 :            : #endif
     252 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_vol = cubit.copy_body(cyls[" << b-2 << "])" << std::endl;
         [ #  # ][ #  # ]
     253                 :            : 
     254                 :            :                     //subtract tmp vol from the outer most
     255                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     256 [ #  # ][ #  # ]:          0 :                     iGeom_subtractEnts(igeomImpl->instance(), cyls[b-1], tmp_vol, &tmp_new, &err);
                 [ #  # ]
     257                 :            : #endif
     258 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1.append(cyls[" << b-1 << "])\nsub2.append(tmp_vol)" << std::endl;
         [ #  # ][ #  # ]
     259 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_new = cubit.subtract(sub2, sub1)" << std::endl;
     260 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl;
     261                 :            : 
     262                 :            :                     // now search for the full name of the abbreviated Cell Mat
     263                 :            :                     //    int tag_no;
     264 [ #  # ][ #  # ]:          0 :                     for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     265 [ #  # ][ #  # ]:          0 :                         if(strcmp (szVCylMat(b).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     266                 :            :                             //        tag_no = p;
     267 [ #  # ][ #  # ]:          0 :                             sMatName =  m_szAssmMat(p);
     268                 :            :                           }
     269                 :            :                       }
     270 [ #  # ][ #  # ]:          0 :                     std::cout << "created: " << sMatName << std::endl;
                 [ #  # ]
     271         [ #  # ]:          0 :                     cp_in.push_back(tmp_new);
     272 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cp_in.append(tmp_new[0])" << std::endl;
     273                 :            : 
     274                 :            :                     // set the name of the annulus
     275                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     276                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     277 [ #  # ][ #  # ]:          0 :                                   sMatName.c_str(),sMatName.size(), &err);
     278                 :            : #endif
     279 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile  << "lid = tmp_new[0].id()" << std::endl;
     280 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     281                 :            : 
     282         [ #  # ]:          0 :                     if(strcmp(m_szInfo.c_str(),"on") == 0){
     283                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     284                 :            :                         iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     285 [ #  # ][ #  # ]:          0 :                                       pin_name.c_str(), pin_name.size(), &err);
     286                 :            : #endif
     287 [ #  # ][ #  # ]:          0 :                         std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     288                 :            : 
     289 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << pin_name <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     290                 :            :                       }
     291 [ #  # ][ #  # ]:          0 :                     Name_Faces(sMatName, tmp_new, this_tag);
     292 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_new[0]) " << std::endl;
         [ #  # ][ #  # ]
     293 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls[" << b-1 << "] = tmp_new" << std::endl;
         [ #  # ][ #  # ]
     294                 :            : 
     295                 :            :                     // copy the new into the cyl array
     296         [ #  # ]:          0 :                     cyls[b-1] = tmp_new;
     297                 :          0 :                     tmp_vol=NULL;
     298                 :          0 :                   }
     299                 :            :               }
     300         [ #  # ]:          0 :             if(nDuctIndex > 0){
     301 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cp_inpins.append([])" << std::endl;
     302         [ #  # ]:          0 :                 for (int count = 0; count < (int) cp_in.size(); count++){
     303 [ #  # ][ #  # ]:          0 :                     cp_inpins[nDuctIndex-1].push_back(cp_in[count]);
                 [ #  # ]
     304 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cp_inpins[" << nDuctIndex-1 << "].append(cp_in[" << count << "])" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     305                 :            :                   }
     306                 :            :               }
     307                 :          0 :             cp_in.clear();
     308 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cp_in[:] =[]" << std::endl;
     309                 :            :           }
     310                 :            :       }
     311                 :            :     // this branch of the routine is responsible for creating cylinders with '0' cells
     312         [ +  - ]:          2 :     if(nCells == 0){
     313                 :            : 
     314                 :            :         // get cylinder data
     315 [ +  - ][ +  - ]:          2 :         m_Pincell(i).GetNumCyl(nCyl);
     316                 :          2 :         nCells = nCyl;
     317                 :            : 
     318         [ +  + ]:          4 :         for(int n=1;n<=nCells; n++){
     319                 :          2 :             nDuctIndex = -1;
     320 [ +  - ][ -  + ]:          2 :             if(m_szGeomType =="hexagonal"){
     321                 :            : 
     322 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(dP, dHeightTotal); // this dHeight is not used in creation
     323                 :            :               }
     324                 :            :             // if rectangular geometry
     325 [ +  - ][ +  - ]:          2 :             if(m_szGeomType =="rectangular"){
     326                 :            : 
     327 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetPitch(PX, PY, PZ);
     328                 :            :               }
     329                 :            : 
     330                 :            :             // loop and create cylinders
     331         [ +  - ]:          2 :             if(nCyl > 0){
     332 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetCylSizes(n, nRadii);
     333         [ +  - ]:          2 :                 SimpleArray<iBase_EntityHandle> cyls(nRadii);
     334                 :            : 
     335                 :            :                 //declare variables
     336         [ +  - ]:          4 :                 CVector<double> dVCylRadii(2*nRadii);
     337         [ +  - ]:          4 :                 CVector<std::string> szVMat(nRadii);
     338         [ +  - ]:          4 :                 CVector<std::string> szVCylMat(nRadii);
     339                 :          2 :                 int nType = 0;
     340                 :            :                 //get values
     341 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetCylRadii(n, dVCylRadii);
     342 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetCylPos(n, dVCylXYPos);
     343 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetCylMat(n, szVCylMat);
     344 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetCylZPos(n, dVCylZPos);
     345 [ +  - ][ +  - ]:          2 :                 m_Pincell(i).GetCellType(n, nType);
     346                 :            : 
     347 [ +  - ][ +  - ]:          2 :                 dHeight = dVCylZPos(2)-dVCylZPos(1);
     348                 :            : 
     349                 :            :                 // get the index for cp_inpins based on Z-heights
     350         [ +  - ]:          2 :                 for (int dd = 1; dd <= m_nDuct; dd++){
     351 [ +  - ][ +  - ]:          2 :                     if((m_dMZAssm(dd, 2)) >= (dVCylZPos(2)) && (m_dMZAssm(dd, 1)) >= (dVCylZPos(1)))
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     352                 :          2 :                       nDuctIndex = dd;
     353         [ +  - ]:          2 :                     if (nDuctIndex != -1)
     354                 :          2 :                       break;
     355                 :            :                   }
     356                 :            : 
     357 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile << "cyls = [] \ncp_in = []" << std::endl;
     358 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile << "sub1 = [] \nsub2 = []" << std::endl;
     359                 :            : 
     360         [ +  + ]:          4 :                 for (int m=1; m<=nRadii; m++){
     361         [ +  - ]:          2 :                     if (nType == 0){
     362                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     363 [ +  - ][ +  - ]:          2 :                         iGeom_createCylinder(igeomImpl->instance(), dHeight, dVCylRadii(m), dVCylRadii(m),
     364 [ +  - ][ +  - ]:          2 :                                              &cyl, &err);
     365                 :            : #endif
     366 [ +  - ][ +  - ]:          2 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ")" << std::endl;
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     367                 :            :                       }
     368                 :            :                     else{
     369                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     370 [ #  # ][ #  # ]:          0 :                         iGeom_createCone(igeomImpl->instance(), dHeight, dVCylRadii(2*m - 1), dVCylRadii(2*m - 1), dVCylRadii(2*m),
                 [ #  # ]
     371 [ #  # ][ #  # ]:          0 :                                          &cyl, &err);
     372                 :            : #endif
     373 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     374                 :            :                       }
     375                 :            : 
     376                 :            :                     // move their centers and also move to the assembly location  ! Modify if cyl is outside brick
     377         [ +  - ]:          2 :                     dCylMoveX = dVCylXYPos(1)+dX;
     378         [ +  - ]:          2 :                     dCylMoveY = dVCylXYPos(2)+dY;
     379 [ +  - ][ +  - ]:          2 :                     dZMove = (dVCylZPos(1)+dVCylZPos(2))/2.0;
     380                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     381 [ +  - ][ +  - ]:          2 :                     iGeom_moveEnt(igeomImpl->instance(), cyl, dCylMoveX, dCylMoveY, dZMove, &err);
     382                 :            : #endif
     383 [ +  - ][ +  - ]:          2 :                     m_PyCubGeomFile << "vector = [" << dCylMoveX << ", " << dCylMoveY << ", " << dZMove << "]" << std::endl;
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     384 [ +  - ][ +  - ]:          2 :                     m_PyCubGeomFile << "cubit.move( cyl, vector)" << std::endl;
     385 [ +  - ][ +  - ]:          2 :                     m_PyCubGeomFile << "cyls.append(cyl)" << std::endl;
     386         [ +  - ]:          2 :                     cyls[m-1] = cyl;
     387                 :            :                   }
     388                 :            : 
     389                 :            :                 //set tag on inner most cylinder, search for the full name of the abbreviated Cell Mat
     390 [ +  - ][ +  + ]:          8 :                 for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     391 [ +  - ][ +  - ]:          6 :                     if(strcmp (szVCylMat(1).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ +  + ]
     392 [ +  - ][ +  - ]:          2 :                         sMatName = m_szAssmMat(p);
     393                 :            :                       }
     394                 :            :                   }
     395 [ +  - ][ +  - ]:          2 :                 std::cout << "created: " << sMatName << std::endl;
                 [ +  - ]
     396         [ +  - ]:          2 :                 tmp_vol1=cyls[0]; //inner most cyl
     397                 :            : 
     398         [ +  - ]:          2 :                 cp_in.push_back(tmp_vol1);
     399 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile << "tmp_vol1 = cyls[0] \ncp_in.append(tmp_vol1)" << std::endl;
     400                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     401                 :            :                 iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     402 [ +  - ][ +  - ]:          2 :                               sMatName.c_str(), 10, &err);
     403                 :            : #endif
     404 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile  << "lid =cyls[0].id()" << std::endl;
     405 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ +  - ][ +  - ]
     406                 :            : 
     407                 :            : 
     408         [ +  - ]:          2 :                 if(strcmp(m_szInfo.c_str(),"on") == 0){
     409                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     410                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     411 [ +  - ][ +  - ]:          2 :                                   pin_name.c_str(), pin_name.size(), &err);
     412                 :            : #endif
     413 [ +  - ][ +  - ]:          2 :                     m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << pin_name <<  "\" )" << std::endl;
         [ +  - ][ +  - ]
     414                 :            : 
     415 [ +  - ][ +  - ]:          2 :                     std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ +  - ]
     416                 :            :                   }
     417                 :            : 
     418 [ +  - ][ +  - ]:          2 :                 Name_Faces(sMatName, tmp_vol1, this_tag);
     419 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_vol1) " << std::endl;
         [ +  - ][ +  - ]
     420                 :            : 
     421                 :            :                 // other cyl annulus after substraction
     422         [ -  + ]:          2 :                 for (int b=nRadii; b>1; b--){
     423                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     424 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), cyls[b-2], &tmp_vol, &err);
                 [ #  # ]
     425                 :            : #endif
     426 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "# SUBTRACTING ANNULUS ##\ntmp_vol = cubit.copy_body(cyls[" << b-2 << "])" << std::endl;
         [ #  # ][ #  # ]
     427                 :            : 
     428                 :            :                     //subtract tmp vol from the outer most
     429                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     430 [ #  # ][ #  # ]:          0 :                     iGeom_subtractEnts(igeomImpl->instance(), cyls[b-1], tmp_vol, &tmp_new, &err);
                 [ #  # ]
     431                 :            : #endif
     432 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1.append(cyls[" << b-1 << "])\nsub2.append(tmp_vol)" << std::endl;
         [ #  # ][ #  # ]
     433 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_new = cubit.subtract(sub2, sub1)" << std::endl;
     434 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl;
     435                 :            : 
     436                 :            :                     // now search for the full name of the abbreviated Cell Mat
     437 [ #  # ][ #  # ]:          0 :                     for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     438 [ #  # ][ #  # ]:          0 :                         if(strcmp (szVCylMat(b).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     439 [ #  # ][ #  # ]:          0 :                             sMatName =  m_szAssmMat(p);
     440                 :            :                           }
     441                 :            :                       }
     442 [ #  # ][ #  # ]:          0 :                     std::cout <<"created: " << sMatName << std::endl;
                 [ #  # ]
     443                 :            : 
     444         [ #  # ]:          0 :                     cp_in.push_back(tmp_new);
     445 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cp_in.append(tmp_new[0])" << std::endl;
     446                 :            : 
     447                 :            :                     // set the name of the annulus
     448                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     449                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     450 [ #  # ][ #  # ]:          0 :                                   sMatName.c_str(),sMatName.size(), &err);
     451                 :            : #endif
     452 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile  << "lid = tmp_new[0].id()" << std::endl;
     453 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     454         [ #  # ]:          0 :                     if(strcmp(m_szInfo.c_str(),"on") == 0){
     455                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     456                 :            :                         iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     457 [ #  # ][ #  # ]:          0 :                                       pin_name.c_str(), pin_name.size(), &err);
     458                 :            : #endif
     459 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << pin_name <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     460                 :            : 
     461 [ #  # ][ #  # ]:          0 :                         std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     462                 :            :                       }
     463                 :            : 
     464 [ #  # ][ #  # ]:          0 :                     Name_Faces(sMatName, tmp_new, this_tag);
     465 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_new[0]) " << std::endl;
         [ #  # ][ #  # ]
     466 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls[" << b-1 << "] = tmp_new" << std::endl;
         [ #  # ][ #  # ]
     467                 :            : 
     468                 :            :                     // copy the new into the cyl array
     469         [ #  # ]:          0 :                     cyls[b-1] = tmp_new;
     470                 :          2 :                   }
     471                 :            :               }
     472         [ +  - ]:          2 :             if(nDuctIndex > 0){
     473 [ +  - ][ +  - ]:          2 :                 m_PyCubGeomFile << "cp_inpins.append([])" << std::endl;
     474         [ +  + ]:          4 :                 for (int count = 0; count < (int) cp_in.size(); count++){
     475 [ +  - ][ +  - ]:          2 :                     cp_inpins[nDuctIndex-1].push_back(cp_in[count]);
                 [ +  - ]
     476 [ +  - ][ +  - ]:          2 :                     m_PyCubGeomFile << "cp_inpins["<< nDuctIndex -1 << "].append(cp_in[" << count << "])" << std::endl;
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     477                 :            : 
     478                 :            :                   }
     479                 :            :               }
     480                 :          2 :             cp_in.clear();
     481 [ +  - ][ +  - ]:          2 :             m_PyCubGeomFile << "cp_in[:] =[]" << std::endl;
     482                 :            : 
     483                 :            :           }
     484                 :          2 :       }
     485                 :            : 
     486                 :          2 :   }
     487                 :            : 
     488                 :            : 
     489                 :          0 :   void AssyGen::CreatePinCell_Intersect(int i, double dX, double dY, double dZ)
     490                 :            :   //---------------------------------------------------------------------------
     491                 :            :   //Function: Create pincell i in location dX dY and dZ
     492                 :            :   //Input:    none
     493                 :            :   //Output:   none
     494                 :            :   //---------------------------------------------------------------------------
     495                 :            :   {
     496                 :          0 :     int nRadii=0, nCyl=0, nCells = 0;
     497                 :          0 :     double dCylMoveX = 0.0, dCylMoveY = 0.0, dHeightTotal = 0.0;
     498                 :          0 :     double dHeight =0.0,dZMove = 0.0, PX = 0.0,PY = 0.0,PZ = 0.0, dP=0.0;
     499 [ #  # ][ #  # ]:          0 :     CVector<double> dVCylZPos(2), dVCylXYPos(2), dVEndZ, dVStartZ;
         [ #  # ][ #  # ]
     500         [ #  # ]:          0 :     CVector<std::string> szVCellMat;
     501                 :          0 :     iBase_EntityHandle cell = NULL, cyl= NULL, tmp_vol1= NULL, tmp_new= NULL, cell_copy = NULL, intersec = NULL;
     502         [ #  # ]:          0 :     std::vector<iBase_EntityHandle> cp_in;
     503                 :            : 
     504                 :            :     // name tag handle
     505                 :          0 :     iBase_TagHandle this_tag= NULL;
     506         [ #  # ]:          0 :     std::string sMatName = "";
     507         [ #  # ]:          0 :     std::string sMatName0 = "";
     508         [ #  # ]:          0 :     std::string sMatName1 = "";
     509                 :          0 :     int nDuctIndex = -1;
     510                 :            : 
     511         [ #  # ]:          0 :     if(strcmp(m_szInfo.c_str(),"on") == 0){
     512         [ #  # ]:          0 :         std::ostringstream os;
     513         [ #  # ]:          0 :         pin_name = "_xp";
     514         [ #  # ]:          0 :         os << (m_nTotalPincells + m_nStartpinid - 1);
     515         [ #  # ]:          0 :         os << "_";
     516         [ #  # ]:          0 :         std::string pid = os.str(); //retrieve as a string
     517         [ #  # ]:          0 :         pin_name+=pid;
     518                 :            :       }
     519                 :            : 
     520                 :            :     // get tag handle for 'NAME' tag, already created as iGeom instance is created
     521                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     522                 :          0 :     char* tag_name = (char*)"NAME";    
     523 [ #  # ][ #  # ]:          0 :     iGeom_getTagHandle(igeomImpl->instance(), tag_name, &this_tag, &err, 4);
     524                 :            : #endif
     525                 :            : 
     526                 :            :     // get cell material
     527 [ #  # ][ #  # ]:          0 :     m_Pincell(i).GetCellMatSize(nCells);
     528 [ #  # ][ #  # ]:          0 :     m_Pincell(i).GetNumCyl(nCyl);
     529         [ #  # ]:          0 :     SimpleArray<iBase_EntityHandle> cells(nCells);
     530                 :            : 
     531                 :            :     // branch when cells are present
     532         [ #  # ]:          0 :     if(nCells > 0){
     533         [ #  # ]:          0 :         dVStartZ.SetSize(nCells);
     534         [ #  # ]:          0 :         dVEndZ.SetSize(nCells);
     535         [ #  # ]:          0 :         szVCellMat.SetSize(nCells);
     536 [ #  # ][ #  # ]:          0 :         m_Pincell(i).GetCellMat(dVStartZ, dVEndZ, szVCellMat);
     537                 :            : 
     538                 :            :         // get cylinder data
     539 [ #  # ][ #  # ]:          0 :         m_Pincell(i).GetNumCyl(nCyl);
     540 [ #  # ][ #  # ]:          0 :         m_PyCubGeomFile << "cells = []\ncyls = []\ncp_in = []" << std::endl;
     541                 :            : 
     542         [ #  # ]:          0 :         for(int n=1;n<=nCells; n++){
     543                 :            : 
     544 [ #  # ][ #  # ]:          0 :             dHeight = fabs(dVEndZ(n) - dVStartZ(n));
     545                 :            :             // get the index for cp_inpins based on Z-heights
     546         [ #  # ]:          0 :             for (int dd = 1; dd <= m_nDuct; dd++){
     547 [ #  # ][ #  # ]:          0 :                 if((m_dMZAssm(dd, 2)) >= (dVCylZPos(2)) && (m_dMZAssm(dd, 1)) >= (dVCylZPos(1)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     548                 :          0 :                   nDuctIndex = dd;
     549         [ #  # ]:          0 :                 if (nDuctIndex != -1)
     550                 :          0 :                   break;
     551                 :            :               }
     552 [ #  # ][ #  # ]:          0 :             if(m_szGeomType =="hexagonal"){
     553                 :            : 
     554 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(dP, dHeightTotal); // this dHeight is not used in creation
     555                 :            : 
     556                 :          0 :                 double dSide = dP/(sqrt(3));
     557                 :            : 
     558         [ #  # ]:          0 :                 if(nCells >0){
     559                 :            :                     // create prism
     560                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     561                 :            :                     iGeom_createPrism(igeomImpl->instance(), dHeight, 6,
     562                 :            :                                       dSide, dSide,
     563 [ #  # ][ #  # ]:          0 :                                       &cell, &err);
     564                 :            : #endif
     565 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cell = cubit.prism(' " << dHeight << ", 6, " << dSide << ", " << dSide << ")" << std::endl;                  }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     566                 :            :               }
     567                 :            :             // if rectangular geometry
     568 [ #  # ][ #  # ]:          0 :             if(m_szGeomType =="rectangular"){
     569                 :            : 
     570 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(PX, PY, PZ);
     571                 :            : 
     572         [ #  # ]:          0 :                 if(nCells >0){
     573                 :            :                     // create brick
     574                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     575 [ #  # ][ #  # ]:          0 :                     iGeom_createBrick( igeomImpl->instance(),PX,PY,dHeight,&cell,&err );
     576                 :            : #endif
     577 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cell = cubit.brick(' " << PX << ", " << PY << ", " << dHeight << ")" << std::endl;                  }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     578                 :            :               }
     579                 :            : 
     580 [ #  # ][ #  # ]:          0 :             dZMove = (dVStartZ(n)+dVEndZ(n))/2.0;
     581                 :            : 
     582         [ #  # ]:          0 :             if(nCells > 0){
     583                 :            :                 // position the brick in assembly
     584                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     585 [ #  # ][ #  # ]:          0 :                 iGeom_moveEnt(igeomImpl->instance(), cell, dX, dY, dZMove, &err);
     586                 :            : #endif
     587 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "vector = [" << dX << ", " << dY << ", " << dZMove << "]" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     588 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.move( cell, vector)" << std::endl;
     589 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cells.append(cell)" << std::endl;
     590                 :            : 
     591         [ #  # ]:          0 :                 cells[n-1]=cell;
     592                 :            :               }
     593                 :            :             // loop and create cylinders
     594         [ #  # ]:          0 :             if(nCyl > 0){
     595 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylSizes(n, nRadii);
     596         [ #  # ]:          0 :                 SimpleArray<iBase_EntityHandle> cyls(nRadii);
     597         [ #  # ]:          0 :                 SimpleArray<iBase_EntityHandle> cell_copys(nRadii);
     598         [ #  # ]:          0 :                 SimpleArray<iBase_EntityHandle> intersec_main(nRadii);
     599                 :          0 :                 iBase_EntityHandle  tmp_intersec = NULL;
     600                 :            :                 (void) tmp_intersec;
     601                 :            :                 //declare variables
     602         [ #  # ]:          0 :                 CVector<double> dVCylRadii(2*nRadii);
     603         [ #  # ]:          0 :                 CVector<std::string> szVMat(nRadii);
     604         [ #  # ]:          0 :                 CVector<std::string> szVCylMat(nRadii);
     605                 :          0 :                 int nType = 0;
     606                 :            :                 //get values
     607 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylRadii(n, dVCylRadii);
     608 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylPos(n, dVCylXYPos);
     609 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylMat(n, szVCylMat);
     610 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylZPos(n, dVCylZPos);
     611 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCellType(n, nType);
     612                 :            : 
     613 [ #  # ][ #  # ]:          0 :                 dHeight = dVCylZPos(2)-dVCylZPos(1);
     614                 :            : 
     615 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cells_copy=[]\nintersec_main=[]" << std::endl;
     616 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cyls = [] \ncp_in = []" << std::endl;
     617 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "sub1 = [] \nsub2 = []" << std::endl;
     618         [ #  # ]:          0 :                 for (int m=1; m<=nRadii; m++){
     619         [ #  # ]:          0 :                     if (nType == 0){
     620                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     621 [ #  # ][ #  # ]:          0 :                         iGeom_createCylinder(igeomImpl->instance(), dHeight, dVCylRadii(m), dVCylRadii(m),
     622 [ #  # ][ #  # ]:          0 :                                              &cyl, &err);
     623                 :            : #endif
     624 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     625                 :            :                       }
     626                 :            :                     else{
     627                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     628 [ #  # ][ #  # ]:          0 :                         iGeom_createCone(igeomImpl->instance(), dHeight, dVCylRadii(2*m-1), dVCylRadii(2*m-1), dVCylRadii(2*m),
                 [ #  # ]
     629 [ #  # ][ #  # ]:          0 :                                          &cyl, &err);
     630                 :            : #endif
     631 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     632                 :            :                       }
     633                 :            : 
     634                 :            :                     // move their centers and also move to the assembly location  ! Modify if cyl is outside brick
     635         [ #  # ]:          0 :                     dCylMoveX = dVCylXYPos(1)+dX;
     636         [ #  # ]:          0 :                     dCylMoveY = dVCylXYPos(2)+dY;
     637 [ #  # ][ #  # ]:          0 :                     dZMove = (dVCylZPos(1)+dVCylZPos(2))/2.0;
     638                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     639 [ #  # ][ #  # ]:          0 :                     iGeom_moveEnt(igeomImpl->instance(), cyl, dCylMoveX,dCylMoveY,dZMove, &err);
     640                 :            : #endif
     641 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "vector = [" << dCylMoveX << ", " << dCylMoveY << ", " << dZMove << "]" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     642 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.move( cell, vector)" << std::endl;
     643 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls.append(cyl)" << std::endl;
     644         [ #  # ]:          0 :                     cyls[m-1] = cyl;
     645                 :            : 
     646                 :            : 
     647                 :            :                     //copy cell nRadii  times for intersection with cylinders
     648                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     649 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), cells[n-1], &cell_copy, &err);
                 [ #  # ]
     650                 :            : #endif
     651 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cell_copy = cubit.copy_body(cells[" << n-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     652 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cells_copy.append(cell_copy)" << std::endl;
     653         [ #  # ]:          0 :                     cell_copys[m-1] = cell_copy;
     654                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     655 [ #  # ][ #  # ]:          0 :                     iGeom_intersectEnts(igeomImpl->instance(), cell_copys[m-1], cyls[m-1],&intersec,&err);
         [ #  # ][ #  # ]
     656                 :            : #endif
     657 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmpunite = cubit.unite(cells_copy[" << m-1 << "]\ncyls [" << m-1 << "])" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     658 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "intersec = cubit.subtract(tmpunite, cells_copy[" << m-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     659 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "intersec_main.append(intersec)" << std::endl;
     660         [ #  # ]:          0 :                     intersec_main[m-1] = intersec;
     661                 :          0 :                     intersec = NULL;
     662                 :            :                   }
     663                 :            : 
     664                 :            :                 //set tag on inner most cylinder, search for the full name of the abbreviated Cell Mat
     665         [ #  # ]:          0 :                 tmp_vol1=intersec_main[0];
     666 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_vol1 = intersec_main[0]" << std::endl;
     667 [ #  # ][ #  # ]:          0 :                 for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     668 [ #  # ][ #  # ]:          0 :                     if(strcmp (szVCylMat(1).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     669 [ #  # ][ #  # ]:          0 :                         sMatName = m_szAssmMat(p);
     670                 :            :                       }
     671                 :            :                   }
     672 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_vol1 = cyls[0] \ncp_in.append(tmp_vol1)" << std::endl;
     673         [ #  # ]:          0 :                 cp_in.push_back(tmp_vol1);
     674                 :            : 
     675                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     676                 :            :                 iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     677 [ #  # ][ #  # ]:          0 :                               sMatName.c_str(), 10, &err);
     678                 :            : #endif
     679 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile  << "lid =tmp_vol1.id()" << std::endl;
     680 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     681                 :            : 
     682         [ #  # ]:          0 :                 if(strcmp(m_szInfo.c_str(),"on") == 0){
     683                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     684                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     685 [ #  # ][ #  # ]:          0 :                                   pin_name.c_str(), pin_name.size(), &err);
     686                 :            : #endif
     687 [ #  # ][ #  # ]:          0 :                     std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     688                 :            :                   }
     689 [ #  # ][ #  # ]:          0 :                 Name_Faces(sMatName, tmp_vol1, this_tag);
     690 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_vol1) " << std::endl;
         [ #  # ][ #  # ]
     691                 :            : 
     692                 :            :                 // copy the outermost cyl
     693                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     694 [ #  # ][ #  # ]:          0 :                 iGeom_copyEnt(igeomImpl->instance(), intersec_main[nRadii-1], &tmp_intersec, &err);
                 [ #  # ]
     695                 :            : #endif
     696 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_intersec = cubit.copy_body(intersec_main[" << nRadii-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     697                 :            : 
     698                 :            :                 // subtract the outermost cyl from the cell
     699                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     700 [ #  # ][ #  # ]:          0 :                 iGeom_subtractEnts(igeomImpl->instance(), cells[n-1], tmp_intersec, &tmp_new, &err);
                 [ #  # ]
     701                 :            : #endif
     702 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "sub1.append(tmp_intersec\nsub2.append(cells["<< n-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     703 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_new = cubit.subtract(sub2, sub1)" << std::endl;
     704 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl;                
     705                 :            :                 // now search for the full name of the abbreviated Cell Mat
     706                 :            :                 //  int tag_no;
     707 [ #  # ][ #  # ]:          0 :                 for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     708 [ #  # ][ #  # ]:          0 :                     if(strcmp (szVCellMat(n).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     709                 :            :                         //      tag_no = p;
     710 [ #  # ][ #  # ]:          0 :                         sMatName =  m_szAssmMat(p);
     711                 :            :                       }
     712                 :            :                   }
     713 [ #  # ][ #  # ]:          0 :                 std::cout << "created: " << sMatName << std::endl;
                 [ #  # ]
     714                 :            : 
     715         [ #  # ]:          0 :                 cp_in.push_back(tmp_new);
     716 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cp_in.append(tmp_new)" << std::endl;
     717                 :            : 
     718                 :            :                 // set the name of the annulus
     719                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     720                 :            :                 iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     721 [ #  # ][ #  # ]:          0 :                               sMatName.c_str(),sMatName.size(), &err);
     722                 :            : #endif
     723 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile  << "lid =tmp_new.id()" << std::endl;
     724 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     725                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     726                 :            :                 iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     727 [ #  # ][ #  # ]:          0 :                               pin_name.c_str(), pin_name.size(), &err);
     728                 :            : #endif
     729 [ #  # ][ #  # ]:          0 :                 std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     730 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << pin_name <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     731                 :            : 
     732 [ #  # ][ #  # ]:          0 :                 Name_Faces(sMatName, tmp_new, this_tag);
     733 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_new) " << std::endl;
         [ #  # ][ #  # ]
     734                 :            : 
     735         [ #  # ]:          0 :                 for (int b=nRadii; b>1; b--){
     736                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     737 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), intersec_main[b-2], &tmp_intersec, &err);
                 [ #  # ]
     738                 :            : #endif
     739 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_intersec = cubit.copy_body(intersec_main[" << b-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     740                 :            : 
     741                 :            :                     //subtract tmp vol from the outer most
     742                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     743 [ #  # ][ #  # ]:          0 :                     iGeom_subtractEnts(igeomImpl->instance(), intersec_main[b-1], tmp_intersec, &tmp_new, &err);
                 [ #  # ]
     744                 :            : #endif
     745 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1.append(tmp_intersec\nsub2.append(intersec_main["<< b-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     746 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_new = cubit.subtract(sub2, sub1)" << std::endl;
     747 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl; 
     748                 :            :                     // now search for the full name of the abbreviated Cell Mat
     749                 :            :                     //    int tag_no;
     750 [ #  # ][ #  # ]:          0 :                     for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     751 [ #  # ][ #  # ]:          0 :                         if(strcmp (szVCylMat(b).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     752                 :            :                             //        tag_no = p;
     753 [ #  # ][ #  # ]:          0 :                             sMatName =  m_szAssmMat(p);
     754                 :            :                           }
     755                 :            :                       }
     756 [ #  # ][ #  # ]:          0 :                     std::cout << "created: " << sMatName << std::endl;
                 [ #  # ]
     757                 :            : 
     758         [ #  # ]:          0 :                     cp_in.push_back(tmp_new);
     759 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cp_in.append(tmp_new)" << std::endl;
     760                 :            : 
     761                 :            :                     // set the name of the annulus
     762                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     763                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     764 [ #  # ][ #  # ]:          0 :                                   sMatName.c_str(),sMatName.size(), &err);
     765                 :            : #endif
     766 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile  << "lid =tmp_new.id()" << std::endl;
     767 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     768                 :            : 
     769         [ #  # ]:          0 :                     if(strcmp(m_szInfo.c_str(),"on") == 0){
     770                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     771                 :            :                         iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     772 [ #  # ][ #  # ]:          0 :                                       pin_name.c_str(), pin_name.size(), &err);
     773                 :            : #endif
     774 [ #  # ][ #  # ]:          0 :                         std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     775                 :            :                       }
     776 [ #  # ][ #  # ]:          0 :                     Name_Faces(sMatName, tmp_new, this_tag);
     777 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_new) " << std::endl;
         [ #  # ][ #  # ]
     778 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls[" << b-1 << "] = tmp_new" << std::endl;
         [ #  # ][ #  # ]
     779                 :            : 
     780                 :            :                     // copy the new into the cyl array
     781         [ #  # ]:          0 :                     cyls[b-1] = tmp_new;
     782                 :            : 
     783                 :          0 :                   }
     784                 :            :               }
     785         [ #  # ]:          0 :             if(nDuctIndex > 0){
     786         [ #  # ]:          0 :                 for (int count = 0; count < (int) cp_in.size(); count++){
     787 [ #  # ][ #  # ]:          0 :                   cp_inpins[nDuctIndex-1].push_back(cp_in[count]);
                 [ #  # ]
     788 [ #  # ][ #  # ]:          0 :                   m_PyCubGeomFile << "cp_inpins["<< nDuctIndex -1 << "].append(cp_in[" << count << "])" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     789                 :            :                 }
     790                 :            : 
     791                 :            :               }
     792                 :          0 :             cp_in.clear();
     793 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cp_in[:] =[]" << std::endl;
     794                 :            : 
     795                 :            :           }
     796                 :            :       }
     797                 :            :     // this branch of the routine is responsible for creating cylinders with '0' cells
     798         [ #  # ]:          0 :     if(nCells == 0){
     799                 :            : 
     800                 :            :         // get cylinder data
     801 [ #  # ][ #  # ]:          0 :         m_Pincell(i).GetNumCyl(nCyl);
     802                 :          0 :         nCells = nCyl;
     803         [ #  # ]:          0 :         cells.resize(nCells);
     804                 :            : 
     805         [ #  # ]:          0 :         for(int n=1;n<=nCells; n++){
     806                 :            : 
     807                 :            :             // get some cylinder parameters to create the cell material for intersection
     808 [ #  # ][ #  # ]:          0 :             m_Pincell(i).GetCylZPos(n, dVCylZPos);
     809 [ #  # ][ #  # ]:          0 :             dHeight = dVCylZPos(2)-dVCylZPos(1);
     810 [ #  # ][ #  # ]:          0 :             dZMove = (dVCylZPos(1)+dVCylZPos(2))/2.0;
     811                 :            : 
     812 [ #  # ][ #  # ]:          0 :             if(m_szGeomType =="hexagonal"){
     813                 :            : 
     814 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(dP, dHeightTotal); // this dHeight is not used in creation
     815                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     816                 :          0 :                 double dSide = dP/(sqrt(3));                
     817                 :            :                 iGeom_createPrism(igeomImpl->instance(), dHeight, 6,
     818                 :            :                                   dSide, dSide,
     819 [ #  # ][ #  # ]:          0 :                                   &cell, &err);
     820                 :            : #endif
     821                 :            :               }
     822 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cyls = [] \ncp_in = []\ncells = []" << std::endl;
     823 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "sub1 = [] \nsub2 = []" << std::endl;
     824                 :            :             // if rectangular geometry
     825 [ #  # ][ #  # ]:          0 :             if(m_szGeomType =="rectangular"){
     826                 :            : 
     827 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetPitch(PX, PY, PZ);
     828                 :            :                 // create brick
     829                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     830 [ #  # ][ #  # ]:          0 :                 iGeom_createBrick( igeomImpl->instance(),PX,PY,PZ, &cell,&err );
     831                 :            : #endif
     832 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cell = cubit.brick(' " << PX << ", " << PY << ", " << PZ << ")" << std::endl;                 
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     833                 :            :               }
     834                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     835 [ #  # ][ #  # ]:          0 :             iGeom_moveEnt(igeomImpl->instance(), cell, dX, dY, dZMove, &err);
     836                 :            : #endif
     837 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "vector = [" << dX << ", " << dY << ", " << dZMove << "]" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     838 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cubit.move( cell, vector)" << std::endl;
     839 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cells.append(cell)" << std::endl;
     840         [ #  # ]:          0 :             cells[n-1]=cell;
     841                 :            :             // loop and create cylinders
     842         [ #  # ]:          0 :             if(nCyl > 0){
     843 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylSizes(n, nRadii);
     844                 :            : 
     845                 :            :                 //declare variables
     846 [ #  # ][ #  # ]:          0 :                 SimpleArray<iBase_EntityHandle> cyls(nRadii), cell_copys(nRadii), intersec_main(nRadii), intersec_copy(nRadii);
         [ #  # ][ #  # ]
     847                 :          0 :                 iBase_EntityHandle  tmp_intersec = NULL;
     848                 :            :                 (void) tmp_intersec;
     849         [ #  # ]:          0 :                 CVector<double> dVCylRadii(2*nRadii);
     850 [ #  # ][ #  # ]:          0 :                 CVector<std::string> szVMat(nRadii), szVCylMat(nRadii);
     851                 :          0 :                 int nType = 0;
     852                 :            :                 //get values
     853 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylRadii(n, dVCylRadii);
     854 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylPos(n, dVCylXYPos);
     855 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCylMat(n, szVCylMat);
     856 [ #  # ][ #  # ]:          0 :                 m_Pincell(i).GetCellType(n, nType);
     857                 :            : 
     858                 :            : 
     859                 :            :                 // get the index for cp_inpins based on Z-heights
     860         [ #  # ]:          0 :                 for (int dd = 1; dd <= m_nDuct; dd++){
     861 [ #  # ][ #  # ]:          0 :                     if((m_dMZAssm(dd, 2)) >= (dVCylZPos(2)) && (m_dMZAssm(dd, 1)) >= (dVCylZPos(1)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     862                 :          0 :                       nDuctIndex = dd;
     863         [ #  # ]:          0 :                     if (nDuctIndex != -1)
     864                 :          0 :                       break;
     865                 :            :                   }
     866                 :            : 
     867         [ #  # ]:          0 :                 for (int m=1; m<=nRadii; m++){
     868         [ #  # ]:          0 :                     if (nType == 0){
     869                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     870 [ #  # ][ #  # ]:          0 :                         iGeom_createCylinder(igeomImpl->instance(), dHeight, dVCylRadii(m), dVCylRadii(m),
     871 [ #  # ][ #  # ]:          0 :                                              &cyl, &err);
     872                 :            : #endif
     873 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ", " << dVCylRadii(m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     874                 :            :                       }
     875                 :            :                     else{
     876                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     877 [ #  # ][ #  # ]:          0 :                         iGeom_createCone(igeomImpl->instance(), dHeight, dVCylRadii(2*m-1), dVCylRadii(2*m-1), dVCylRadii(2*m),
                 [ #  # ]
     878 [ #  # ][ #  # ]:          0 :                                          &cyl, &err);
     879                 :            : #endif
     880 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "#\n#\ncyl = cubit.cylinder(" << dHeight << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m-1) << ", " << dVCylRadii(2*m) << ")" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     881                 :            :                       }
     882                 :            : 
     883                 :            :                     // move their centers and also move to the assembly location  ! Modify if cyl is outside brick
     884         [ #  # ]:          0 :                     dCylMoveX = dVCylXYPos(1)+dX;
     885         [ #  # ]:          0 :                     dCylMoveY = dVCylXYPos(2)+dY;
     886                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     887 [ #  # ][ #  # ]:          0 :                     iGeom_moveEnt(igeomImpl->instance(), cyl, dCylMoveX,dCylMoveY,dZMove, &err);
     888                 :            : #endif
     889 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "vector = [" << dCylMoveX << ", " << dCylMoveY << ", " << dZMove << "]" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     890 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.move( cell, vector)" << std::endl;
     891 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls.append(cyl)" << std::endl;
     892                 :            : 
     893         [ #  # ]:          0 :                     cyls[m-1] = cyl;
     894                 :            : 
     895                 :            :                     //copy cell nRadii  times for intersection with cylinders
     896                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     897 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), cells[n-1], &cell_copy, &err);
                 [ #  # ]
     898                 :            : #endif
     899 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cell_copy = cubit.copy_body(cells[" << n-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     900 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cells_copy.append(cell_copy)" << std::endl;
     901                 :            : 
     902         [ #  # ]:          0 :                     cell_copys[m-1] = cell_copy;
     903                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     904 [ #  # ][ #  # ]:          0 :                     iGeom_intersectEnts(igeomImpl->instance(), cell_copy, cyls[m-1],&intersec,&err);
                 [ #  # ]
     905                 :            : #endif
     906 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmpunite = cubit.unite(cells_copy[" << m-1 << "], cyls [" << m-1 << "])" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     907 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "intersec = cubit.subtract(tmpunite, cells_copy[" << m-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     908 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "intersec_main.append(intersec)" << std::endl;
     909                 :            : 
     910         [ #  # ]:          0 :                     intersec_main[m-1] = intersec;
     911                 :          0 :                     intersec = NULL;
     912                 :            :                   }
     913                 :            : 
     914                 :            :                 //set tag on inner most cylinder, search for the full name of the abbreviated Cell Mat
     915         [ #  # ]:          0 :                 tmp_vol1=intersec_main[0];
     916 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_vol1 = intersec_main[0]" << std::endl;
     917                 :            : 
     918 [ #  # ][ #  # ]:          0 :                 for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     919 [ #  # ][ #  # ]:          0 :                     if(strcmp (szVCylMat(1).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     920 [ #  # ][ #  # ]:          0 :                         sMatName = m_szAssmMat(p);
     921                 :            :                       }
     922                 :            :                   }
     923                 :            : 
     924 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "tmp_vol1 = cyls[0] \ncp_in.append(tmp_vol1)" << std::endl;
     925         [ #  # ]:          0 :                 cp_in.push_back(tmp_vol1);
     926                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     927                 :            :                 iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     928 [ #  # ][ #  # ]:          0 :                               sMatName.c_str(), 10, &err);
     929                 :            : #endif
     930 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile  << "lid =tmp_vol1.id()" << std::endl;
     931 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     932                 :            : 
     933         [ #  # ]:          0 :                 if(strcmp(m_szInfo.c_str(),"on") == 0){
     934                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     935                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_vol1, this_tag,
     936 [ #  # ][ #  # ]:          0 :                                   pin_name.c_str(), pin_name.size(), &err);
     937                 :            : #endif
     938 [ #  # ][ #  # ]:          0 :                     std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     939                 :            :                   }
     940                 :            : 
     941 [ #  # ][ #  # ]:          0 :                 Name_Faces(sMatName, tmp_vol1, this_tag);
     942 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_vol1) " << std::endl;
         [ #  # ][ #  # ]
     943                 :            : 
     944                 :            :                 // delete the cell as this is the case when no. cell material is specified
     945                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     946 [ #  # ][ #  # ]:          0 :                 iGeom_deleteEnt(igeomImpl->instance(), cells[n-1], &err);
                 [ #  # ]
     947                 :            : #endif
     948 [ #  # ][ #  # ]:          0 :                 m_PyCubGeomFile << "cubit.cmd('delete vol << cells[" << n-1 << "].id()')" << std::endl;
         [ #  # ][ #  # ]
     949                 :            : 
     950                 :            : 
     951                 :            :                 // other cyl annulus after substraction
     952         [ #  # ]:          0 :                 for (int b=nRadii; b>1; b--){
     953                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     954 [ #  # ][ #  # ]:          0 :                     iGeom_copyEnt(igeomImpl->instance(), intersec_main[b-2], &tmp_intersec, &err);
                 [ #  # ]
     955                 :            : #endif
     956 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_intersec = cubit.copy_body(intersec_main[" << b-2 << "])" << std::endl;
         [ #  # ][ #  # ]
     957                 :            : 
     958                 :            :                     //subtract tmp vol from the outer most
     959                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     960 [ #  # ][ #  # ]:          0 :                     iGeom_subtractEnts(igeomImpl->instance(), intersec_main[b-1], tmp_intersec, &tmp_new, &err);
                 [ #  # ]
     961                 :            : #endif
     962 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1.append(tmp_intersec\nsub2.append(intersec_main["<< b-1 << "])" << std::endl;
         [ #  # ][ #  # ]
     963 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "tmp_new = cubit.subtract(sub2, sub1)" << std::endl;
     964 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "sub1[:] = []\nsub2[:] = []" << std::endl; 
     965                 :            : 
     966                 :            :                     // now search for the full name of the abbreviated Cell Mat
     967                 :            :                     //    int tag_no;
     968 [ #  # ][ #  # ]:          0 :                     for(int p=1;p<=m_szAssmMatAlias.GetSize();p++){
     969 [ #  # ][ #  # ]:          0 :                         if(strcmp (szVCylMat(b).c_str(), m_szAssmMatAlias(p).c_str()) == 0){
                 [ #  # ]
     970                 :            :                             //        tag_no = p;
     971 [ #  # ][ #  # ]:          0 :                             sMatName =  m_szAssmMat(p);
     972                 :            :                           }
     973                 :            :                       }
     974 [ #  # ][ #  # ]:          0 :                     std::cout << "created: " << sMatName << std::endl;
                 [ #  # ]
     975                 :            : 
     976 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cp_in.append(tmp_new)" << std::endl;
     977         [ #  # ]:          0 :                     cp_in.push_back(tmp_new);
     978                 :            : 
     979                 :            :                     // set the name of the annulus
     980                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     981                 :            :                     iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     982 [ #  # ][ #  # ]:          0 :                                   sMatName.c_str(),sMatName.size(), &err);
     983                 :            : #endif
     984                 :            : 
     985 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile  << "lid =tmp_new.id()" << std::endl;
     986 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << sMatName <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     987                 :            :                     
     988         [ #  # ]:          0 :                     if(strcmp(m_szInfo.c_str(),"on") == 0){
     989                 :            : #if defined (HAVE_ACIS) || defined (HAVE_OCC)
     990                 :            :                         iGeom_setData(igeomImpl->instance(), tmp_new, this_tag,
     991 [ #  # ][ #  # ]:          0 :                                       pin_name.c_str(), pin_name.size(), &err);
     992                 :            : #endif
     993 [ #  # ][ #  # ]:          0 :                         std::cout << "Naming pin body :" <<  pin_name<< std::endl;
                 [ #  # ]
     994 [ #  # ][ #  # ]:          0 :                         m_PyCubGeomFile << "cubit.set_entity_name(\"body\", lid, \""  << pin_name <<  "\" )" << std::endl;
         [ #  # ][ #  # ]
     995                 :            :                       }
     996                 :            : 
     997 [ #  # ][ #  # ]:          0 :                     Name_Faces(sMatName, tmp_new, this_tag);
     998 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "name_faces(\"" << sMatName << "\", tmp_new) " << std::endl;
         [ #  # ][ #  # ]
     999 [ #  # ][ #  # ]:          0 :                     m_PyCubGeomFile << "cyls[" << b-1 << "] = tmp_new" << std::endl;
         [ #  # ][ #  # ]
    1000                 :            : 
    1001                 :            :                     // copy the new into the cyl array
    1002         [ #  # ]:          0 :                     cyls[b-1] = tmp_new;
    1003                 :            : 
    1004                 :          0 :                   }
    1005                 :            :               }
    1006         [ #  # ]:          0 :             if(nDuctIndex > 0){
    1007         [ #  # ]:          0 :                 for (int count = 0; count < (int) cp_in.size(); count++){
    1008 [ #  # ][ #  # ]:          0 :                   cp_inpins[nDuctIndex-1].push_back(cp_in[count]);
                 [ #  # ]
    1009 [ #  # ][ #  # ]:          0 :                   m_PyCubGeomFile << "cp_inpins["<< nDuctIndex -1 << "].append(cp_in[" << count << "])" << std::endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1010                 :            :                 }
    1011                 :            : 
    1012                 :            :               }
    1013                 :          0 :             cp_in.clear();
    1014 [ #  # ][ #  # ]:          0 :             m_PyCubGeomFile << "cp_in[:] =[]" << std::endl;
    1015                 :            : 
    1016                 :            :           }
    1017                 :          0 :       }
    1018                 :            : 
    1019                 :          0 :   }
    1020                 :            : 
    1021 [ +  - ][ +  - ]:        156 : }

Generated by: LCOV version 1.11