LCOV - code coverage report
Current view: top level - algs/PostBL - pushbmesh.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 37 89 41.6 %
Date: 2020-07-01 15:24:36 Functions: 3 3 100.0 %
Branches: 72 534 13.5 %

           Branch data     Line data    Source code
       1                 :            : #include "meshkit/PostBL.hpp"
       2                 :            : namespace MeshKit
       3                 :            : {
       4                 :          1 :   int PostBL::push_bulk_mesh(VerdictWrapper vw)
       5                 :            :   // ---------------------------------------------------------------------------
       6                 :            :   //! Function: After normal creation push the bulk mesh and make room for creation of new BL elements  \n
       7                 :            :   //! Input:    mesh quality verdict handle and included variables from PostBL.hpp file \n
       8                 :            :   //! Output:   save a mesh file in debug mode \n
       9                 :            :   // ---------------------------------------------------------------------------
      10                 :            :   {
      11                 :            :     // swap nodal coordinates of input nodes with innermost BL nodes to push the bulk mesh
      12                 :          1 :     int count = -1;
      13                 :            :     
      14                 :          1 :     int matindx = -1;
      15 [ +  - ][ +  - ]:          9 :     for (Range::iterator kter = nodes.begin(); kter != nodes.end(); ++kter){
         [ +  - ][ +  - ]
                 [ +  + ]
      16                 :          8 :         ++count;
      17 [ +  - ][ +  - ]:          8 :         if(all_bl[count] == 0 ){
      18                 :            :             
      19                 :          8 :             int nid = (count+1)*m_Intervals - 1;
      20 [ +  - ][ +  - ]:          8 :             MBERRCHK(mb->get_coords(&new_vert[nid], 1, coords_new_quad),mb);
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      21 [ +  - ][ +  - ]:          8 :             MBERRCHK(mb->get_coords(&(*kter), 1, coords_old_quad),mb);
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      22                 :            :             
      23                 :            :             //TODO: Set connectivity for pushed hexes
      24         [ -  + ]:          8 :             if (debug) {
      25 [ #  # ][ #  # ]:          0 :                 m_LogFile << std::setprecision (3) << std::scientific << " : NID: " << (nid)
         [ #  # ][ #  # ]
                 [ #  # ]
      26         [ #  # ]:          0 :                           << coords_old_quad[0]
      27 [ #  # ][ #  # ]:          0 :                           << ", " << coords_old_quad[1] << ", " << coords_old_quad[2] << " OLD:- coords: NEW" << coords_new_quad[0]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      28 [ #  # ][ #  # ]:          0 :                           << ", " << coords_new_quad[1] << ", " << coords_new_quad[2]  << std::endl;
         [ #  # ][ #  # ]
                 [ #  # ]
      29                 :            :               }
      30         [ +  - ]:          8 :             moab::Range deformed_hex;
      31 [ +  - ][ +  - ]:          8 :             MBERRCHK(mb->get_adjacencies(&(*kter), 1, m_GD, false, deformed_hex, Interface::UNION), mb);
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      32         [ +  - ]:         16 :             std::vector<moab::EntityHandle> dhex_conn;
      33 [ +  - ][ +  - ]:         24 :             for(Range::iterator fmter = deformed_hex.begin(); fmter != deformed_hex.end(); ++fmter){
         [ +  - ][ +  - ]
                 [ +  + ]
      34 [ +  - ][ +  - ]:         16 :                 mb->get_connectivity(&(*fmter), 1, dhex_conn);
      35         [ +  - ]:         16 :                 if(dhex_conn.size () > 0){
      36         [ +  + ]:        144 :                     for(int i=0; i < (int)dhex_conn.size(); i++){
      37 [ +  - ][ +  - ]:        128 :                         if((*kter) == dhex_conn[i]){
                 [ +  + ]
      38                 :            :                             // push the bulk mesh
      39 [ +  - ][ +  - ]:         16 :                             dhex_conn[i] = new_vert[nid];
      40                 :            :                           }
      41                 :            :                       }
      42 [ +  - ][ +  - ]:         16 :                     MBERRCHK(mb->set_connectivity(*fmter, &dhex_conn[0], dhex_conn.size()), mb);
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      43                 :            :                   }
      44                 :         16 :                 double jac = 0;
      45 [ +  - ][ +  - ]:         16 :                 vw.quality_measure(*fmter, MB_JACOBIAN, jac);
      46                 :         16 :                 ++m_JacCalls;
      47         [ -  + ]:         16 :                 if (jac < 0){
      48 [ #  # ][ #  # ]:          0 :                     m_LogFile << "ck BL thickness/intervals. Stopping." << std::endl;
      49                 :          0 :                     exit(0);
      50                 :            :                   }
      51                 :          8 :               }
      52                 :            :           }
      53 [ #  # ][ #  # ]:          0 :         else if(all_bl[count] > 0 && fixmat != -1){ 
         [ #  # ][ #  # ]
      54                 :            :             // node belongs to more than one material and fixmat specified
      55                 :          0 :             int nid = (count+1)*m_Intervals - 1;
      56 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->get_coords(&new_vert[nid], 1, coords_new_quad),mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      57 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->get_coords(&(*kter), 1, coords_old_quad),mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      58                 :            : 
      59         [ #  # ]:          0 :             if (debug) {
      60 [ #  # ][ #  # ]:          0 :                 m_LogFile << std::setprecision (3) << std::scientific << " : NID: " << (nid)
         [ #  # ][ #  # ]
                 [ #  # ]
      61         [ #  # ]:          0 :                           << coords_old_quad[0]
      62 [ #  # ][ #  # ]:          0 :                           << ", " << coords_old_quad[1] << ", " << coords_old_quad[2] << " OLD:- coords: NEW" << coords_new_quad[0]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      63 [ #  # ][ #  # ]:          0 :                           << ", " << coords_new_quad[1] << ", " << coords_new_quad[2]  << std::endl;
         [ #  # ][ #  # ]
                 [ #  # ]
      64                 :            :               }
      65                 :            :             
      66                 :            :             // now find the hex in fixmat_ents that was affected by this swap and UNswap the coords
      67         [ #  # ]:          0 :             moab::Range fhex;
      68 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->get_adjacencies(&(*kter), 1, m_GD, false, fhex, Interface::UNION), mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      69         [ #  # ]:          0 :             moab::Range fmhex= intersect(fhex,fixmat_ents);
      70         [ #  # ]:          0 :             moab::Range non_fixhex = subtract(fhex, fmhex);
      71                 :            :             
      72 [ #  # ][ #  # ]:          0 :             std::vector<int> tag_non_fixhex(non_fixhex.size(),0);
      73 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->tag_get_data(MatIDTag, non_fixhex, &tag_non_fixhex[0]), mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      74 [ #  # ][ #  # ]:          0 :             m_LogFile << quads.size() << std::endl;
                 [ #  # ]
      75                 :            :          
      76 [ #  # ][ #  # ]:          0 :             if( matindx < (int) quads.size() ){
      77                 :          0 :                 ++matindx;
      78                 :            :                 // handling more than 2 materials in MM case is not supported
      79 [ #  # ][ #  # ]:          0 :                 blmaterial_id[matindx] = tag_non_fixhex[0];
      80                 :            :               }
      81         [ #  # ]:          0 :             std::vector<moab::EntityHandle> fmconn;
      82 [ #  # ][ #  # ]:          0 :             for(Range::iterator fmter = non_fixhex.begin(); fmter != non_fixhex.end(); ++fmter){
         [ #  # ][ #  # ]
                 [ #  # ]
      83 [ #  # ][ #  # ]:          0 :                 mb->get_connectivity(&(*fmter), 1, fmconn);
      84         [ #  # ]:          0 :                 if(fmconn.size () > 0){
      85         [ #  # ]:          0 :                     for(int i=0; i < (int)fmconn.size(); i++){
      86 [ #  # ][ #  # ]:          0 :                         if((*kter) == fmconn[i]){
                 [ #  # ]
      87                 :            :                             // push the bulk mesh
      88 [ #  # ][ #  # ]:          0 :                             fmconn[i] = new_vert[nid];
      89                 :            :                           }
      90                 :            :                       }
      91 [ #  # ][ #  # ]:          0 :                     MBERRCHK(mb->set_connectivity(*fmter, &fmconn[0], fmconn.size()), mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      92                 :            :                   }
      93                 :          0 :                 double jac = 0;
      94 [ #  # ][ #  # ]:          0 :                 vw.quality_measure(*fmter, MB_JACOBIAN, jac);
      95                 :          0 :                 ++m_JacCalls;
      96         [ #  # ]:          0 :                 if (jac < 0){
      97 [ #  # ][ #  # ]:          0 :                     m_LogFile << "ck BL thickness/intervals. Stopping." << std::endl;
      98                 :          0 :                     exit(0);
      99                 :            :                   }
     100                 :            :               }   
     101 [ #  # ][ #  # ]:          0 :             m_LogFile << "Multiple material case: working along the edge" << std::endl;
     102                 :            :           }
     103 [ #  # ][ #  # ]:          0 :         else if(all_bl[count] > 0 && fixmat == -1){ // node belongs to more than one material and fixmat not specified
         [ #  # ][ #  # ]
     104                 :            :             // NODE ON BOUNDARY
     105                 :          0 :             int nid = (count+1)*m_Intervals - 1;
     106 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->get_coords(&new_vert[nid], 1, coords_new_quad),mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     107 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->get_coords(&(*kter), 1, coords_old_quad),mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     108 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->set_coords(&(*kter), 1, coords_new_quad),mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     109 [ #  # ][ #  # ]:          0 :             MBERRCHK(mb->set_coords(&new_vert[nid], 1, coords_old_quad),mb);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     110                 :            :             
     111 [ #  # ][ #  # ]:          0 :             m_LogFile << std::setprecision (3) << std::scientific << " : NID:" << (nid)
         [ #  # ][ #  # ]
                 [ #  # ]
     112         [ #  # ]:          0 :                       << coords_old_quad[0]
     113 [ #  # ][ #  # ]:          0 :                       << ", " << coords_old_quad[1] << ", " << coords_old_quad[2] << " OLD:- coords: NEW" << coords_new_quad[0]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     114 [ #  # ][ #  # ]:          0 :                       << ", " << coords_new_quad[1] << ", " << coords_new_quad[2]  << std::endl;
         [ #  # ][ #  # ]
                 [ #  # ]
     115                 :            :           }
     116                 :            :       } // for loop ends
     117                 :            :     
     118         [ -  + ]:          1 :     if(debug == true){
     119 [ #  # ][ #  # ]:          0 :         MBERRCHK(mb->write_mesh("bulkpushed.exo"),mb);
         [ #  # ][ #  # ]
                 [ #  # ]
     120                 :          0 :         m_LogFile <<  "\n\nWrote Mesh File: bulkpushed.exo" << std::endl;
     121                 :            :       }
     122                 :            :     // check for the volume of penultimate elements if -ve volume encountered. Report.
     123                 :          1 :     count = -1;
     124                 :            :     // Try to move another layer attached to it.
     125 [ +  - ][ +  - ]:          9 :     for (Range::iterator kter = nodes.begin(); kter != nodes.end(); ++kter){
         [ +  - ][ +  - ]
                 [ +  + ]
     126                 :          8 :         ++count;
     127         [ +  + ]:         24 :         for(int j=0; j< m_Intervals; j++){
     128                 :         16 :             int nid = count*m_Intervals+j;
     129                 :            :             double coords_new_quad[3];
     130 [ +  - ][ +  - ]:         16 :             MBERRCHK(mb->get_coords(&new_vert[nid], 1, coords_new_quad),mb);
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     131 [ +  - ][ +  - ]:         16 :             m_LogFile << std::setprecision (3) << std::scientific << " : NID:" << (nid)
         [ +  - ][ +  - ]
                 [ +  - ]
     132 [ +  - ][ +  - ]:         32 :                       << " of " << new_vert.size() << " new nodes:- coords: " << coords_new_quad[0]
         [ +  - ][ +  - ]
     133 [ +  - ][ +  - ]:         16 :                       << ", " << coords_new_quad[1] << ", " << coords_new_quad[2]  << std::endl;
         [ +  - ][ +  - ]
                 [ +  - ]
     134                 :            :           }
     135                 :            :       }
     136                 :            :     // shoot multiple normals for multiple materials case only.
     137                 :            :     // This can be used of regular case also how to invoke it. mention in algorithm
     138                 :            :     // mention local and global smoothing.
     139                 :            :     //    qcount = -1;
     140                 :            :     //    int flag[quads.size()];
     141                 :          1 :     return 0;
     142                 :            :   }
     143 [ +  - ][ +  - ]:        156 : }

Generated by: LCOV version 1.11