Пример #1
0
void getVolumeFromFaces ( RegionMesh const& mesh,
                          Real vols[ 3 ],
                          std::ostream& err = std::cerr )
{
    MeshUtility::GetCoordComponent getx ( 0 );
    MeshUtility::GetCoordComponent gety ( 1 );
    MeshUtility::GetCoordComponent getz ( 2 );
    vols[ 0 ] = 0.0;
    vols[ 1 ] = 0.0;
    vols[ 2 ] = 0.0;
    typedef typename RegionMesh::facetShape_Type GeoBShape;
    typedef typename RegionMesh::facet_Type facet_Type;
    typedef boost::shared_ptr<CurrentFEManifold> current_fe_type;

    current_fe_type bdfe;

    switch ( GeoBShape::S_shape )
    {
        case TRIANGLE:
            bdfe = current_fe_type ( new CurrentFEManifold ( feTriaP1, geoLinearTria,
                                                             quadRuleTria1pt ) );
            for ( ID i = 0; i < mesh.numBFaces(); i++ )
            {
                bdfe->update ( mesh.face ( i ), UPDATE_W_ROOT_DET_METRIC | UPDATE_NORMALS | UPDATE_QUAD_NODES );
                vols[ 0 ] += bdfe->normalIntegral ( getx );
                vols[ 1 ] += bdfe->normalIntegral ( gety );
                vols[ 2 ] += bdfe->normalIntegral ( getz );
            }
            break;
        case QUAD:
            bdfe = current_fe_type ( new CurrentFEManifold ( feQuadQ1, geoBilinearQuad,
                                                             quadRuleQuad1pt ) );
            for ( ID i = 0; i < mesh.numBFaces(); i++ )
            {
                bdfe->update ( mesh.face ( i ), UPDATE_W_ROOT_DET_METRIC | UPDATE_NORMALS | UPDATE_QUAD_NODES );
                vols[ 0 ] += bdfe->normalIntegral ( getx );
                vols[ 1 ] += bdfe->normalIntegral ( gety );
                vols[ 2 ] += bdfe->normalIntegral ( getz );
            }
            break;
        default:
            err << "Only tria and quad surface elements  may be checked for volume orientation at the moment" << std::endl;
            ASSERT0 ( false, "ABORT CONDITION OCCURRED" );
    }
}
Пример #2
0
Real testClosedDomain ( RegionMesh const& mesh,
                        std::ostream& err = std::cerr )
{
    typedef typename RegionMesh::facet_Type facet_Type;

    typedef boost::shared_ptr<CurrentFEManifold> current_fe_type;
    current_fe_type bdfe;

    MeshUtility::GetOnes ones;
    Real test ( 0.0 );

    switch ( RegionMesh::facetShape_Type::S_shape )
    {
        case TRIANGLE:
            bdfe = current_fe_type ( new CurrentFEManifold ( feTriaP1, geoLinearTria,
                                                             quadRuleTria1pt ) );
            for ( ID i = 0; i < mesh.numBFaces(); i++ )
            {
                bdfe->update ( mesh.face ( i ), UPDATE_W_ROOT_DET_METRIC | UPDATE_NORMALS | UPDATE_QUAD_NODES );
                test += bdfe->normalIntegral ( ones );
            }
            break;
        case QUAD:
            bdfe = current_fe_type ( new CurrentFEManifold ( feQuadQ1, geoBilinearQuad,
                                                             quadRuleQuad1pt ) );
            for ( ID i = 0; i < mesh.numBFaces(); i++ )
            {
                bdfe->update ( mesh.face ( i ), UPDATE_W_ROOT_DET_METRIC | UPDATE_NORMALS | UPDATE_QUAD_NODES );
                test += bdfe->normalIntegral ( ones );
            }

            break;

        default:
            err << "Only tria and quad surface elements  may be checked for volume orientation at the moment" << std::endl;
            ASSERT0 ( false, "ABORT CONDITION OCCURRED" );
    }

    return test;

}
Пример #3
0
static void
check_face (RegionMesh<LinearTetra>& mesh, ID i, ID j)
{
  ID faceId = mesh.localFaceId (i, j);

  if ( (ID) faceId != NotAnId)
  {
    RegionMesh<LinearTetra>::face_Type& face
    = mesh.face (faceId);

    if (0)
    fprintf (stdout, "  face: %5d %5d, ",
        faceId, face.id() );

    ID v0, v1, v2, gv0, gv1, gv2;
    v0 = LinearTetra::faceToPoint (j, 0);
    v1 = LinearTetra::faceToPoint (j, 1);
    v2 = LinearTetra::faceToPoint (j, 2);
    // fprintf(stdout, "[%5d %5d %5d], ", v0, v1, v2);

    gv0 = mesh.element (i).point (v0).id();
    gv1 = mesh.element (i).point (v1).id();
    gv2 = mesh.element (i).point (v2).id();
    fprintf (stdout, "[ %7d %7d %7d ], ", gv0, gv1, gv2);

    int mark = 0;
    if (face.flag() &
        EntityFlags::PHYSICAL_BOUNDARY)
    {
      mark = 1;
    }
    if (face.flag() &
        EntityFlags::SUBDOMAIN_INTERFACE)
    {
      mark += 2;
    }
    fprintf (stdout, "mark: %d, ", mark);

    ID vol0, vol1;
    ID pos0, pos1;
    vol0 = face.firstAdjacentElementIdentity();
    pos0 = face.firstAdjacentElementPosition();
    vol1 = face.secondAdjacentElementIdentity();
    pos1 = face.secondAdjacentElementPosition();

    if (vol0 == NotAnId)
    {
      vol0 = -1;
    }
    if (vol1 == NotAnId)
    {
      vol1 = -1;
    }
    if (pos0 == NotAnId)
    {
      pos0 = -1;
    }
    if (pos1 == NotAnId)
    {
      pos1 = -1;
    }

    fprintf (stdout, "first: %5d %d, second: %5d %d",
        vol0, pos0, vol1, pos1);

    fprintf (stdout, "\n");
  }
  else
  {
    fprintf (stdout, "Invalid face!!!\n");
  }
}