Ignore:
Timestamp:
07/24/12 10:36:19 (13 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 12703

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Gauss/GaussPenta.cpp

    r8416 r12706  
    33 */
    44
    5 /*Include files: {{{1*/
     5/*Include files: {{{*/
    66#include "./../objects.h"
    77/*}}}*/
    88
    99/*GaussPenta constructors and destructors:*/
    10 /*FUNCTION GaussPenta::GaussPenta() {{{1*/
     10/*FUNCTION GaussPenta::GaussPenta() {{{*/
    1111GaussPenta::GaussPenta(){
    1212
     
    2626}
    2727/*}}}*/
    28 /*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{1*/
     28/*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{*/
    2929GaussPenta::GaussPenta(int order_horiz,int order_vert){
    3030
     
    4747        /*Allocate GaussPenta fields*/
    4848        numgauss=numgauss_horiz*numgauss_vert;
    49         coords1=(double*)xmalloc(numgauss*sizeof(double));
    50         coords2=(double*)xmalloc(numgauss*sizeof(double));
    51         coords3=(double*)xmalloc(numgauss*sizeof(double));
    52         coords4=(double*)xmalloc(numgauss*sizeof(double));
    53         weights=(double*)xmalloc(numgauss*sizeof(double));
     49        coords1=xNew<double>(numgauss);
     50        coords2=xNew<double>(numgauss);
     51        coords3=xNew<double>(numgauss);
     52        coords4=xNew<double>(numgauss);
     53        weights=xNew<double>(numgauss);
    5454
    5555        /*Combine Horizontal and vertical points*/
     
    7272
    7373        /*Clean up*/
    74         xfree((void**)&coords1_horiz);
    75         xfree((void**)&coords2_horiz);
    76         xfree((void**)&coords3_horiz);
    77         xfree((void**)&coords_vert);
    78         xfree((void**)&weights_horiz);
    79         xfree((void**)&weights_vert);
    80 }
    81 /*}}}*/
    82 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int order){{{1*/
     74        xDelete<double>(coords1_horiz);
     75        xDelete<double>(coords2_horiz);
     76        xDelete<double>(coords3_horiz);
     77        xDelete<double>(coords_vert);
     78        xDelete<double>(weights_horiz);
     79        xDelete<double>(weights_vert);
     80}
     81/*}}}*/
     82/*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int order){{{*/
    8383GaussPenta::GaussPenta(int index1, int index2,int order){
    8484
     
    9393
    9494        /*Allocate GaussPenta fields*/
    95         coords1=(double*)xmalloc(numgauss*sizeof(double));
    96         coords2=(double*)xmalloc(numgauss*sizeof(double));
    97         coords3=(double*)xmalloc(numgauss*sizeof(double));
    98         coords4=(double*)xmalloc(numgauss*sizeof(double));
    99         weights=(double*)xmalloc(numgauss*sizeof(double));
     95        coords1=xNew<double>(numgauss);
     96        coords2=xNew<double>(numgauss);
     97        coords3=xNew<double>(numgauss);
     98        coords4=xNew<double>(numgauss);
     99        weights=xNew<double>(numgauss);
    100100
    101101        if(index1==0 && index2==3){
     
    121121        }
    122122        else{
    123                 _error_("Penta not supported yet");
     123                _error2_("Penta not supported yet");
    124124        }
    125125
     
    132132
    133133        /*clean up*/
    134         xfree((void**)&seg_coords);
    135         xfree((void**)&seg_weights);
    136 
    137 }
    138 /*}}}*/
    139 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int order){{{1*/
     134        xDelete<double>(seg_coords);
     135        xDelete<double>(seg_weights);
     136
     137}
     138/*}}}*/
     139/*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int order){{{*/
    140140GaussPenta::GaussPenta(int index1, int index2, int index3, int order){
    141141
     
    147147
    148148                /*compute z coordinate*/
    149                 coords4=(double*)xmalloc(numgauss*sizeof(double));
     149                coords4=xNew<double>(numgauss);
    150150                for(int i=0;i<numgauss;i++) coords4[i]=-1.0;
    151151        }
     
    157157
    158158                /*compute z coordinate*/
    159                 coords4=(double*)xmalloc(numgauss*sizeof(double));
     159                coords4=xNew<double>(numgauss);
    160160                for(int i=0;i<numgauss;i++) coords4[i]=1.0;
    161161        }
    162162        else{
    163                 _error_("Tria not supported yet");
    164         }
    165 
    166 }
    167 /*}}}*/
    168 /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){{{1*/
     163                _error2_("Tria not supported yet");
     164        }
     165
     166}
     167/*}}}*/
     168/*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){{{*/
    169169GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){
    170170
     
    182182        /*Allocate GaussPenta fields*/
    183183        numgauss=order_horiz*order_vert;
    184         coords1=(double*)xmalloc(numgauss*sizeof(double));
    185         coords2=(double*)xmalloc(numgauss*sizeof(double));
    186         coords3=(double*)xmalloc(numgauss*sizeof(double));
    187         coords4=(double*)xmalloc(numgauss*sizeof(double));
    188         weights=(double*)xmalloc(numgauss*sizeof(double));
     184        coords1=xNew<double>(numgauss);
     185        coords2=xNew<double>(numgauss);
     186        coords3=xNew<double>(numgauss);
     187        coords4=xNew<double>(numgauss);
     188        weights=xNew<double>(numgauss);
    189189
    190190        /*Quads: get the gauss points using the product of two line rules  */
     
    223223        }
    224224        else{
    225                 _error_("Tria not supported yet (user provided indices %i %i %i %i)",index1,index2,index3,index4);
     225                _error2_("Tria not supported yet (user provided indices " << index1 << " " << index2 << " " << index3 << " " << index4 << ")");
    226226        }
    227227
    228228        /*clean-up*/
    229         xfree((void**)&seg_horiz_coords);
    230         xfree((void**)&seg_horiz_weights);
    231         xfree((void**)&seg_vert_coords);
    232         xfree((void**)&seg_vert_weights);
    233 }
    234 /*}}}*/
    235 /*FUNCTION GaussPenta::~GaussPenta(){{{1*/
     229        xDelete<double>(seg_horiz_coords);
     230        xDelete<double>(seg_horiz_weights);
     231        xDelete<double>(seg_vert_coords);
     232        xDelete<double>(seg_vert_weights);
     233}
     234/*}}}*/
     235/*FUNCTION GaussPenta::~GaussPenta(){{{*/
    236236GaussPenta::~GaussPenta(){
    237         xfree((void**)&weights);
    238         xfree((void**)&coords1);
    239         xfree((void**)&coords2);
    240         xfree((void**)&coords3);
    241         xfree((void**)&coords4);
     237        xDelete<double>(weights);
     238        xDelete<double>(coords1);
     239        xDelete<double>(coords2);
     240        xDelete<double>(coords3);
     241        xDelete<double>(coords4);
    242242}
    243243/*}}}*/
    244244
    245245/*Methods*/
    246 /*FUNCTION GaussPenta::Echo{{{1*/
     246/*FUNCTION GaussPenta::Echo{{{*/
    247247void GaussPenta::Echo(void){
    248248
    249         printf("GaussPenta:\n");
    250         printf("   numgauss: %i\n",numgauss);
     249        _printLine_("GaussPenta:");
     250        _printLine_("   numgauss: " << numgauss);
    251251
    252252        if (weights){
    253          printf("   weights = [");
    254          for(int i=0;i<numgauss;i++) printf(" %g\n",weights[i]);
    255          printf("]\n");
    256         }
    257         else printf("weights = NULL\n");
     253         _printString_("   weights = [");
     254         for(int i=0;i<numgauss;i++) _printLine_(" " << weights[i]);
     255         _printLine_("]");
     256        }
     257        else _printLine_("weights = NULL");
    258258        if (coords1){
    259          printf("   coords1 = [");
    260          for(int i=0;i<numgauss;i++) printf(" %g\n",coords1[i]);
    261          printf("]\n");
    262         }
    263         else printf("coords1 = NULL\n");
     259         _printString_("   coords1 = [");
     260         for(int i=0;i<numgauss;i++) _printLine_(" " << coords1[i]);
     261         _printLine_("]");
     262        }
     263        else _printLine_("coords1 = NULL");
    264264        if (coords2){
    265          printf("   coords2 = [");
    266          for(int i=0;i<numgauss;i++) printf(" %g\n",coords2[i]);
    267          printf("]\n");
    268         }
    269         else printf("coords2 = NULL\n");
     265         _printString_("   coords2 = [");
     266         for(int i=0;i<numgauss;i++) _printLine_(" " << coords2[i]);
     267         _printLine_("]");
     268        }
     269        else _printLine_("coords2 = NULL");
    270270        if (coords3){
    271          printf("   coords3 = [");
    272          for(int i=0;i<numgauss;i++) printf(" %g\n",coords3[i]);
    273          printf("]\n");
    274         }
    275         else printf("coords3 = NULL\n");
     271         _printString_("   coords3 = [");
     272         for(int i=0;i<numgauss;i++) _printLine_(" " << coords3[i]);
     273         _printLine_("]");
     274        }
     275        else _printLine_("coords3 = NULL");
    276276        if (coords4){
    277                 printf("   coords4 = [");
    278                 for(int i=0;i<numgauss;i++) printf(" %g\n",coords4[i]);
    279                 printf("]\n");
    280         }
    281         else printf("coords4 = NULL\n");
    282 
    283         printf("   weight = %g\n",weight);
    284         printf("   coord1 = %g\n",coord1);
    285         printf("   coord2 = %g\n",coord2);
    286         printf("   coord3 = %g\n",coord3);
    287         printf("   coord4 = %g\n",coord4);
    288 
    289 }
    290 /*}}}*/
    291 /*FUNCTION GaussPenta::GaussCenter{{{1*/
     277                _printString_("   coords4 = [");
     278                for(int i=0;i<numgauss;i++) _printLine_(" " << coords4[i]);
     279                _printLine_("]");
     280        }
     281        else _printLine_("coords4 = NULL");
     282
     283        _printLine_("   weight = " << weight);
     284        _printLine_("   coord1 = " << coord1);
     285        _printLine_("   coord2 = " << coord2);
     286        _printLine_("   coord3 = " << coord3);
     287        _printLine_("   coord4 = " << coord4);
     288
     289}
     290/*}}}*/
     291/*FUNCTION GaussPenta::GaussCenter{{{*/
    292292void GaussPenta::GaussCenter(void){
    293293
     
    300300}
    301301/*}}}*/
    302 /*FUNCTION GaussPenta::GaussPoint{{{1*/
     302/*FUNCTION GaussPenta::GaussPoint{{{*/
    303303void GaussPenta::GaussPoint(int ig){
    304304
     
    315315}
    316316/*}}}*/
    317 /*FUNCTION GaussPenta::GaussVertex{{{1*/
     317/*FUNCTION GaussPenta::GaussVertex{{{*/
    318318void GaussPenta::GaussVertex(int iv){
    319319
     
    342342                        break;
    343343                default:
    344                         _error_("vertex index should be in [0 5]");
    345 
    346         }
    347 
    348 }
    349 /*}}}*/
    350 /*FUNCTION GaussPenta::GaussFaceTria{{{1*/
     344                        _error2_("vertex index should be in [0 5]");
     345
     346        }
     347
     348}
     349/*}}}*/
     350/*FUNCTION GaussPenta::GaussFaceTria{{{*/
    351351void GaussPenta::GaussFaceTria(int index1, int index2, int index3, int order){
    352352
     
    357357        if(index1==0 && index2==1 && index3==2){
    358358                GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
    359                 coords4=(double*)xmalloc(numgauss*sizeof(double));
     359                coords4=xNew<double>(numgauss);
    360360                for(int i=0;i<numgauss;i++) coords4[i]=-1.0;
    361361        }
    362362        else{
    363                 _error_("Tria not supported yet");
    364         }
    365 
    366 }
    367 /*}}}*/
    368 /*FUNCTION GaussPenta::begin{{{1*/
     363                _error2_("Tria not supported yet");
     364        }
     365
     366}
     367/*}}}*/
     368/*FUNCTION GaussPenta::begin{{{*/
    369369int GaussPenta::begin(void){
    370370
     
    381381}
    382382/*}}}*/
    383 /*FUNCTION GaussPenta::end{{{1*/
     383/*FUNCTION GaussPenta::end{{{*/
    384384int GaussPenta::end(void){
    385385
     
    396396}
    397397/*}}}*/
    398 /*FUNCTION GaussPenta::SynchronizeGaussTria{{{1*/
     398/*FUNCTION GaussPenta::SynchronizeGaussTria{{{*/
    399399void GaussPenta::SynchronizeGaussTria(GaussTria* gauss_tria){
    400400
Note: See TracChangeset for help on using the changeset viewer.