Real checkVolumes ( RegionMesh const& mesh, std::vector<bool>& elSign, Switch& sw ) { Real meas = 0.0; Real lmeas = 0.0; elSign.clear(); elSign.reserve ( mesh.numVolumes() ); typedef typename RegionMesh::elementShape_Type GeoShape; switch ( GeoShape::S_shape ) { case TETRA: { CurrentFE fe ( feTetraP1, geoLinearTetra, quadRuleTetra1pt ); for ( ID i = 0; i < mesh.numVolumes(); i++ ) { fe.updateJac ( mesh.volume ( i ) ); lmeas = fe.measure(); meas += lmeas; elSign.push_back ( lmeas > 0.0 ); } } break; case HEXA: { CurrentFE fe ( feHexaQ1, geoBilinearHexa, quadRuleHexa1pt ); for ( ID i = 0; i < mesh.numVolumes(); i++ ) { fe.updateJac ( mesh.volume ( i ) ); lmeas = fe.measure(); meas += lmeas; elSign.push_back ( lmeas > 0.0 ); } } break; default: sw.create ( "SKIP_ORIENTATION_TEST", true ); return 0; } if ( std::find ( elSign.begin(), elSign.end(), false ) != elSign.end() ) { sw.create ( "HAS_NEGATIVE_VOLUMES", true ); } return meas; }
void fixVolumes ( RegionMesh& mesh, const std::vector<bool>& elSign, Switch& sw ) { for ( ID i = 0; i < mesh.numVolumes(); i++ ) { if ( ! elSign[ i ] ) { mesh.volume (i).reversePoints(); } } sw.create ("HAS_VOLUMES", true); }