Logo Search packages:      
Sourcecode: madlib version File versions  Download package

bool MAd::E_params ( const pEdge  edge,
double  u[2][2] 
)

Gets the parametric coordinates of the summits of the edge in the geometric entity on which it is classified. Returns false if parametric coordinates are not available.

Definition at line 2218 of file MeshDataBaseInterface.cc.

References MAd::E_vertex(), MAd::E_whatIn(), MAd::EN_whatIn(), MAd::V_params(), MAd::V_whatIn(), and MAd::V_whatInType().

  {
#ifdef _HAVE_GMSH_

    pGEntity edgeGE = E_whatIn(edge);
    int gDim = GEN_type(edgeGE);
  
    if ( gDim != 1 && gDim != 2 ) return false;

    for (int iV=0; iV<2; iV++) {
    
      pVertex pv = E_vertex(edge,iV);
      pGEntity vG = EN_whatIn(pv);
      int vGDim = GEN_type(vG);

      // --------------------------------------------------------------------
      // edge classified on a surface: we want the parameters on the surface
      // --------------------------------------------------------------------
      if ( gDim == 2 ) {

        switch ( vGDim ) {
        case 3: throw;
        case 2: {
          if ( !V_params(pv,&u[iV][0],&u[iV][1]) ) return false;
//           printf("node on face %d: %lf %lf\n",GEN_tag(edgeGE),u[iV][0],u[iV][1]);
          break;
        }
        case 1: {
          double tmp0,tmp1;
          if ( !V_params(pv,&tmp0,&tmp1) ) return false;

          double * otherU = NULL;
          if ( GE_isSeam( (pGEdge)vG, (pGFace)edgeGE ) )
            {
              pVertex otherV = E_vertex(edge,1-iV);
              double tmp20,tmp21;
              if ( V_whatInType(otherV)==2 && V_params(otherV,&tmp20,&tmp21) ) {
                otherU = new double[2];
                otherU[0] = tmp20;
                otherU[1] = tmp21;
              }
              else if ( V_whatInType(otherV)==1 && V_params(otherV,&tmp20,&tmp21) ) {
                if ( GE_isSeam( (pGEdge)V_whatIn(otherV), (pGFace)edgeGE ) ) {
                  MAdMsgSgl::instance().warning(__LINE__,__FILE__,
                                                "Found a surface with 2 seams");
                  return false;
                }
                otherU = new double[2];
                GE_reparamOnFace( (pGEdge)V_whatIn(otherV), (pGFace)edgeGE, 
                                  tmp20, &(otherU[0]) );
                otherU[1] = -1.;
              }
            }
          GE_reparamOnFace( (pGEdge)vG, (pGFace)edgeGE, tmp0, u[iV], otherU );
//           printf("node from edge %d on face %d: %lf %lf\n",GEN_tag(vG),GEN_tag(edgeGE),u[iV][0],u[iV][1]);
          break;
        }
        case 0: {
          double tmp0,tmp1;
          if ( !V_params(pv,&tmp0,&tmp1) ) return false;

          double * otherU = NULL;
          if ( GV_isOnSeam( (pGVertex)vG, (pGFace)edgeGE ) ) 
            {
              pVertex otherV = E_vertex(edge,1-iV);
              double tmp20,tmp21;
              if ( V_whatInType(otherV)==2 && V_params(otherV,&tmp20,&tmp21) ) {
                otherU = new double[2];
                otherU[0] = tmp20;
                otherU[1] = tmp21;
              }
              else if ( V_whatInType(otherV)==1 && V_params(otherV,&tmp20,&tmp21) ) {
                if ( GE_isSeam( (pGEdge)V_whatIn(otherV), (pGFace)edgeGE ) ) {
                  MAdMsgSgl::instance().warning(__LINE__,__FILE__,
                                                "Found a surface with 2 seams");
                  return false;
                }
                otherU = new double[2];
                GE_reparamOnFace( (pGEdge)V_whatIn(otherV), (pGFace)edgeGE, 
                                  tmp20, &(otherU[0]) );
                otherU[1] = -1.;
              }
            }
          GV_reparamOnFace( (pGVertex)vG, (pGFace)edgeGE, u[iV], otherU );
//           printf("vert %d on face %d: %lf %lf\n",GEN_tag(vG),GEN_tag(edgeGE),u[iV][0],u[iV][1]);
          break;
        }
        }
      }

      // --------------------------------------------------------------
      // edge classified on a line: we want the parameters on the line
      // --------------------------------------------------------------
      else if ( gDim == 1) {

        switch ( vGDim ) {
        case 3: throw;
        case 2: throw;
        case 1: {
          double tmp;
          if ( !V_params(pv,&u[iV][0],&tmp) ) return false;
          break;
        }
        case 0: {
          if ( !(pv->isParametric() ) ) return false;

          double otherU = -1.;
          pVertex otherV = E_vertex(edge,1-iV);
          double tmp20,tmp21;
          if ( V_whatInType(otherV)==1 && V_params(otherV,&tmp20,&tmp21) ) {
            otherU = tmp20;
          }
          else if ( V_whatInType(otherV)==0 ) {
            GV_reparamOnEdge( (pGVertex)V_whatIn(otherV), (pGEdge)edgeGE, &otherU );
          }

          GV_reparamOnEdge( (pGVertex)vG, (pGEdge)edgeGE, &u[iV][0], otherU );
          break;
        }
        }

      }

      else throw;
    }

    return true;
#else
    return false;
#endif
  }


Generated by  Doxygen 1.6.0   Back to index