Changeset 18488


Ignore:
Timestamp:
09/09/14 05:40:32 (11 years ago)
Author:
olason
Message:

CHG: do not include any vertex of the background mesh that may lie outside of the domain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/bamg/Mesh.cpp

    r18486 r18488  
    29302930                                Triangle *tcvj=TriangleFindFromCoord(vj.i,det3);
    29312931                                if (tcvj && !tcvj->link){
     2932                                        _printf_("While trying to add the following point:\n");
     2933                                        vj.Echo();
     2934                                        _printf_("BAMG determined that it was inside the following triangle, which probably lies outside of the geometric domain\n");
    29322935                                        tcvj->Echo();
    29332936                                        _error_("problem inserting point in InsertNewPoints (tcvj=" << tcvj << " and tcvj->link=" << tcvj->link << ")");
     
    31463149                        if (verbose>5) _printf_("         Inserting initial mesh points\n");
    31473150                        bool pointsoutside = false;
    3148                         for (i=0;i<Bh.nbv;i++){
     3151                        for(i=0;i<Bh.nbv;i++){
    31493152                                BamgVertex &bv=Bh[i];
    31503153                                /*Do not insert if the point is outside*/
    31513154                                long long det3[3];
    31523155                                Triangle* tcvj=TriangleFindFromCoord(bv.i,det3);
    3153                                 if(tcvj->det<0){
     3156                                if(tcvj->det<0 || !tcvj->link){
    31543157                                        pointsoutside = true;
    31553158                                        continue;
    31563159                                }
    3157                                 if (!bv.GeomEdgeHook){
     3160                                IssmDouble area_1=((bv.r.x -(*tcvj)(2)->r.x)*((*tcvj)(1)->r.y-(*tcvj)(2)->r.y)
     3161                                                - (bv.r.y -(*tcvj)(2)->r.y)*((*tcvj)(1)->r.x-(*tcvj)(2)->r.x));
     3162                                IssmDouble area_2=(((*tcvj)(0)->r.x -(*tcvj)(2)->r.x)*(bv.r.y -(*tcvj)(2)->r.y)
     3163                                                - ((*tcvj)(0)->r.y -(*tcvj)(2)->r.y)*(bv.r.x -(*tcvj)(2)->r.x));
     3164                                IssmDouble area_3 =((bv.r.x -(*tcvj)(1)->r.x)*((*tcvj)(0)->r.y-(*tcvj)(1)->r.y)
     3165                                                - (bv.r.y -(*tcvj)(1)->r.y)*((*tcvj)(0)->r.x-(*tcvj)(1)->r.x));
     3166                                if(area_1<0 || area_2<0 || area_3<0){
     3167                                        pointsoutside = true;
     3168                                        continue;
     3169                                }
     3170                                if(!bv.GeomEdgeHook){
    31583171                                        vertices[nbv].r              = bv.r;
    31593172                                        vertices[nbv].PreviousNumber = i+1;
     
    31643177                        Bh.CreateSingleVertexToTriangleConnectivity();     
    31653178                        InsertNewPoints(nbvold,NbTSwap,bamgopts->random);
    3166                 } 
     3179                }
    31673180                else Bh.CreateSingleVertexToTriangleConnectivity();     
    31683181
Note: See TracChangeset for help on using the changeset viewer.