source: issm/trunk/src/c/objects/Gauss/GaussTria.cpp@ 5641

Last change on this file since 5641 was 5641, checked in by Mathieu Morlighem, 15 years ago

Added GaussPenta

File size: 3.2 KB
RevLine 
[5625]1/*!\file GaussTria.c
2 * \brief: implementation of the GaussTria object
3 */
4
5/*Include files: {{{1*/
6#include "./../objects.h"
7/*}}}*/
8
9/*GaussTria constructors and destructors:*/
10/*FUNCTION GaussTria::GaussTria() {{{1*/
11GaussTria::GaussTria(){
12
13 numgauss=-1;
14
15 weights=NULL;
16 coords1=NULL;
17 coords2=NULL;
18 coords3=NULL;
19
20 weight=UNDEF;
21 coord1=UNDEF;
22 coord2=UNDEF;
23 coord3=UNDEF;
24}
25/*}}}*/
26/*FUNCTION GaussTria::GaussTria(int order) {{{1*/
27GaussTria::GaussTria(int order){
28
29 /*Get gauss points*/
30 GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
31
32 /*Initialize static fields as undefinite*/
33 weight=UNDEF;
34 coord1=UNDEF;
35 coord2=UNDEF;
36 coord3=UNDEF;
37
38}
39/*}}}*/
40/*FUNCTION GaussTria::~GaussTria(){{{1*/
41GaussTria::~GaussTria(){
42 xfree((void**)&weights);
43 xfree((void**)&coords1);
44 xfree((void**)&coords2);
45 xfree((void**)&coords3);
46}
47/*}}}*/
48
49/*Methods*/
50/*FUNCTION GaussTria::Echo{{{1*/
51void GaussTria::Echo(void){
52
53 printf("GaussTria:\n");
54 printf(" numgauss: %i\n",numgauss);
55
56 if (weights){
57 printf(" weights = [");
58 for(int i=0;i<numgauss;i++) printf(" %g\n",weights[i]);
59 printf("]\n");
60 }
61 else printf("weights = NULL\n");
62 if (coords1){
63 printf(" coords1 = [");
64 for(int i=0;i<numgauss;i++) printf(" %g\n",coords1[i]);
65 printf("]\n");
66 }
67 else printf("coords1 = NULL\n");
68 if (coords2){
69 printf(" coords2 = [");
70 for(int i=0;i<numgauss;i++) printf(" %g\n",coords2[i]);
71 printf("]\n");
72 }
73 else printf("coords2 = NULL\n");
74 if (coords3){
75 printf(" coords3 = [");
76 for(int i=0;i<numgauss;i++) printf(" %g\n",coords3[i]);
77 printf("]\n");
78 }
79 else printf("coords3 = NULL\n");
80
81 printf(" weight = %g\n",weight);
82 printf(" coord1 = %g\n",coord1);
83 printf(" coord2 = %g\n",coord2);
84 printf(" coord3 = %g\n",coord3);
85
86}
87/*}}}*/
[5637]88/*FUNCTION GaussTria::GaussCenter{{{1*/
89void GaussTria::GaussCenter(void){
90
91 /*update static arrays*/
92 coord1=ONETHIRD;
93 coord2=ONETHIRD;
94 coord3=ONETHIRD;
95
96}
97/*}}}*/
[5625]98/*FUNCTION GaussTria::GaussPoint{{{1*/
99void GaussTria::GaussPoint(int ig){
100
101 /*Check input in debugging mode*/
102 ISSMASSERT(ig>=0 && ig< numgauss);
103
104 /*update static arrays*/
105 weight=weights[ig];
106 coord1=coords1[ig];
107 coord2=coords2[ig];
108 coord3=coords3[ig];
109
110}
111/*}}}*/
[5630]112/*FUNCTION GaussTria::GaussVertex{{{1*/
113void GaussTria::GaussVertex(int iv){
114
115 /*in debugging mode: check that the default constructor has been called*/
116 ISSMASSERT(numgauss==-1);
117
118 /*update static arrays*/
119 switch(iv){
120 case 0:
121 coord1=1; coord2=0; coord3=0;
122 break;
123 case 1:
124 coord1=0; coord2=1; coord3=0;
125 break;
126 case 2:
127 coord1=0; coord2=0; coord3=1;
128 break;
129 default:
130 ISSMERROR("vertex index should be in [0 2]");
131
132 }
133
134}
135/*}}}*/
[5625]136/*FUNCTION GaussTria::begin{{{1*/
137int GaussTria::begin(void){
138
139 /*Check that this has been initialized*/
140 ISSMASSERT(numgauss>0);
141 ISSMASSERT(weights);
142 ISSMASSERT(coords1);
143 ISSMASSERT(coords2);
144 ISSMASSERT(coords3);
145
146 /*return first gauss index*/
147 return 0;
148}
149/*}}}*/
150/*FUNCTION GaussTria::end{{{1*/
151int GaussTria::end(void){
152
153 /*Check that this has been initialized*/
154 ISSMASSERT(numgauss>0);
155 ISSMASSERT(weights);
156 ISSMASSERT(coords1);
157 ISSMASSERT(coords2);
158 ISSMASSERT(coords3);
159
160 /*return last gauss index +1*/
161 return numgauss;
162}
163/*}}}*/
Note: See TracBrowser for help on using the repository browser.