/*!\file GaussPenta.c * \brief: implementation of the GaussPenta object */ /*Include files: {{{*/ #include "./../objects.h" /*}}}*/ /*GaussPenta constructors and destructors:*/ /*FUNCTION GaussPenta::GaussPenta() {{{*/ GaussPenta::GaussPenta(){ numgauss=-1; weights=NULL; coords1=NULL; coords2=NULL; coords3=NULL; coords4=NULL; weight=UNDEF; coord1=UNDEF; coord2=UNDEF; coord3=UNDEF; coord4=UNDEF; } /*}}}*/ /*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{*/ GaussPenta::GaussPenta(int order_horiz,int order_vert){ /*Intermediaries*/ int ighoriz,igvert; int numgauss_horiz; int numgauss_vert; double *coords1_horiz = NULL; double *coords2_horiz = NULL; double *coords3_horiz = NULL; double *weights_horiz = NULL; double *coords_vert = NULL; double *weights_vert = NULL; /*Get gauss points*/ GaussLegendreTria(&numgauss_horiz,&coords1_horiz,&coords2_horiz,&coords3_horiz,&weights_horiz,order_horiz); GaussLegendreLinear(&coords_vert,&weights_vert,order_vert); numgauss_vert=order_vert; /*Allocate GaussPenta fields*/ numgauss=numgauss_horiz*numgauss_vert; coords1=xNew(numgauss); coords2=xNew(numgauss); coords3=xNew(numgauss); coords4=xNew(numgauss); weights=xNew(numgauss); /*Combine Horizontal and vertical points*/ for (ighoriz=0; ighoriz(coords1_horiz); xDelete(coords2_horiz); xDelete(coords3_horiz); xDelete(coords_vert); xDelete(weights_horiz); xDelete(weights_vert); } /*}}}*/ /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int order){{{*/ GaussPenta::GaussPenta(int index1, int index2,int order){ /*Intermediaties*/ double *seg_coords = NULL; double *seg_weights = NULL; int i; /*Get Segment gauss points*/ numgauss=order; GaussLegendreLinear(&seg_coords,&seg_weights,numgauss); /*Allocate GaussPenta fields*/ coords1=xNew(numgauss); coords2=xNew(numgauss); coords3=xNew(numgauss); coords4=xNew(numgauss); weights=xNew(numgauss); if(index1==0 && index2==3){ for(i=0;i(seg_coords); xDelete(seg_weights); } /*}}}*/ /*FUNCTION GaussPenta::GaussPenta(int index1, int index2, int index3, int order){{{*/ GaussPenta::GaussPenta(int index1, int index2, int index3, int order){ /*Basal Tria*/ if(index1==0 && index2==1 && index3==2){ /*Get GaussTria*/ GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order); /*compute z coordinate*/ coords4=xNew(numgauss); for(int i=0;i(numgauss); for(int i=0;i(numgauss); coords2=xNew(numgauss); coords3=xNew(numgauss); coords4=xNew(numgauss); weights=xNew(numgauss); /*Quads: get the gauss points using the product of two line rules */ if(index1==0 && index2==1 && index3==4 && index4==3){ for(i=0;i(seg_horiz_coords); xDelete(seg_horiz_weights); xDelete(seg_vert_coords); xDelete(seg_vert_weights); } /*}}}*/ /*FUNCTION GaussPenta::~GaussPenta(){{{*/ GaussPenta::~GaussPenta(){ xDelete(weights); xDelete(coords1); xDelete(coords2); xDelete(coords3); xDelete(coords4); } /*}}}*/ /*Methods*/ /*FUNCTION GaussPenta::Echo{{{*/ void GaussPenta::Echo(void){ _printLine_("GaussPenta:"); _printLine_(" numgauss: " << numgauss); if (weights){ _printString_(" weights = ["); for(int i=0;i(numgauss); for(int i=0;i0); _assert_(weights); _assert_(coords1); _assert_(coords2); _assert_(coords3); _assert_(coords4); /*return first gauss index*/ return 0; } /*}}}*/ /*FUNCTION GaussPenta::end{{{*/ int GaussPenta::end(void){ /*Check that this has been initialized*/ _assert_(numgauss>0); _assert_(weights); _assert_(coords1); _assert_(coords2); _assert_(coords3); _assert_(coords4); /*return last gauss index +1*/ return numgauss; } /*}}}*/ /*FUNCTION GaussPenta::SynchronizeGaussTria{{{*/ void GaussPenta::SynchronizeGaussTria(GaussTria* gauss_tria){ gauss_tria->coord1=this->coord1; gauss_tria->coord2=this->coord2; gauss_tria->coord3=this->coord3; gauss_tria->weight=UNDEF; } /*}}}*/