Changeset 12706 for issm/trunk/src/c/objects/Gauss/GaussPenta.cpp
- Timestamp:
- 07/24/12 10:36:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Gauss/GaussPenta.cpp
r8416 r12706 3 3 */ 4 4 5 /*Include files: {{{ 1*/5 /*Include files: {{{*/ 6 6 #include "./../objects.h" 7 7 /*}}}*/ 8 8 9 9 /*GaussPenta constructors and destructors:*/ 10 /*FUNCTION GaussPenta::GaussPenta() {{{ 1*/10 /*FUNCTION GaussPenta::GaussPenta() {{{*/ 11 11 GaussPenta::GaussPenta(){ 12 12 … … 26 26 } 27 27 /*}}}*/ 28 /*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{ 1*/28 /*FUNCTION GaussPenta::GaussPenta(int order_horiz,int order_vert) {{{*/ 29 29 GaussPenta::GaussPenta(int order_horiz,int order_vert){ 30 30 … … 47 47 /*Allocate GaussPenta fields*/ 48 48 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); 54 54 55 55 /*Combine Horizontal and vertical points*/ … … 72 72 73 73 /*Clean up*/ 74 x free((void**)&coords1_horiz);75 x free((void**)&coords2_horiz);76 x free((void**)&coords3_horiz);77 x free((void**)&coords_vert);78 x free((void**)&weights_horiz);79 x free((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){{{*/ 83 83 GaussPenta::GaussPenta(int index1, int index2,int order){ 84 84 … … 93 93 94 94 /*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); 100 100 101 101 if(index1==0 && index2==3){ … … 121 121 } 122 122 else{ 123 _error _("Penta not supported yet");123 _error2_("Penta not supported yet"); 124 124 } 125 125 … … 132 132 133 133 /*clean up*/ 134 x free((void**)&seg_coords);135 x free((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){{{*/ 140 140 GaussPenta::GaussPenta(int index1, int index2, int index3, int order){ 141 141 … … 147 147 148 148 /*compute z coordinate*/ 149 coords4= (double*)xmalloc(numgauss*sizeof(double));149 coords4=xNew<double>(numgauss); 150 150 for(int i=0;i<numgauss;i++) coords4[i]=-1.0; 151 151 } … … 157 157 158 158 /*compute z coordinate*/ 159 coords4= (double*)xmalloc(numgauss*sizeof(double));159 coords4=xNew<double>(numgauss); 160 160 for(int i=0;i<numgauss;i++) coords4[i]=1.0; 161 161 } 162 162 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){{{*/ 169 169 GaussPenta::GaussPenta(int index1, int index2, int index3, int index4,int order_horiz,int order_vert){ 170 170 … … 182 182 /*Allocate GaussPenta fields*/ 183 183 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); 189 189 190 190 /*Quads: get the gauss points using the product of two line rules */ … … 223 223 } 224 224 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 << ")"); 226 226 } 227 227 228 228 /*clean-up*/ 229 x free((void**)&seg_horiz_coords);230 x free((void**)&seg_horiz_weights);231 x free((void**)&seg_vert_coords);232 x free((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(){{{*/ 236 236 GaussPenta::~GaussPenta(){ 237 x free((void**)&weights);238 x free((void**)&coords1);239 x free((void**)&coords2);240 x free((void**)&coords3);241 x free((void**)&coords4);237 xDelete<double>(weights); 238 xDelete<double>(coords1); 239 xDelete<double>(coords2); 240 xDelete<double>(coords3); 241 xDelete<double>(coords4); 242 242 } 243 243 /*}}}*/ 244 244 245 245 /*Methods*/ 246 /*FUNCTION GaussPenta::Echo{{{ 1*/246 /*FUNCTION GaussPenta::Echo{{{*/ 247 247 void GaussPenta::Echo(void){ 248 248 249 printf("GaussPenta:\n");250 printf(" numgauss: %i\n",numgauss);249 _printLine_("GaussPenta:"); 250 _printLine_(" numgauss: " << numgauss); 251 251 252 252 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"); 258 258 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"); 264 264 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"); 270 270 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"); 276 276 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{{{*/ 292 292 void GaussPenta::GaussCenter(void){ 293 293 … … 300 300 } 301 301 /*}}}*/ 302 /*FUNCTION GaussPenta::GaussPoint{{{ 1*/302 /*FUNCTION GaussPenta::GaussPoint{{{*/ 303 303 void GaussPenta::GaussPoint(int ig){ 304 304 … … 315 315 } 316 316 /*}}}*/ 317 /*FUNCTION GaussPenta::GaussVertex{{{ 1*/317 /*FUNCTION GaussPenta::GaussVertex{{{*/ 318 318 void GaussPenta::GaussVertex(int iv){ 319 319 … … 342 342 break; 343 343 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{{{*/ 351 351 void GaussPenta::GaussFaceTria(int index1, int index2, int index3, int order){ 352 352 … … 357 357 if(index1==0 && index2==1 && index3==2){ 358 358 GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order); 359 coords4= (double*)xmalloc(numgauss*sizeof(double));359 coords4=xNew<double>(numgauss); 360 360 for(int i=0;i<numgauss;i++) coords4[i]=-1.0; 361 361 } 362 362 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{{{*/ 369 369 int GaussPenta::begin(void){ 370 370 … … 381 381 } 382 382 /*}}}*/ 383 /*FUNCTION GaussPenta::end{{{ 1*/383 /*FUNCTION GaussPenta::end{{{*/ 384 384 int GaussPenta::end(void){ 385 385 … … 396 396 } 397 397 /*}}}*/ 398 /*FUNCTION GaussPenta::SynchronizeGaussTria{{{ 1*/398 /*FUNCTION GaussPenta::SynchronizeGaussTria{{{*/ 399 399 void GaussPenta::SynchronizeGaussTria(GaussTria* gauss_tria){ 400 400
Note:
See TracChangeset
for help on using the changeset viewer.