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

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

Added GaussTria for slope only for now

File size: 2.9 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(int order,int node1,int node2) {{{1*/
41GaussTria::GaussTria(int order,int node1,int node2){
42
43 ISSMERROR("not implemented yet");
44
45 /*Get gauss points*/
46 GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
47
48 /*Initialize static fields as undefinite*/
49 weight=UNDEF;
50 coord1=UNDEF;
51 coord2=UNDEF;
52 coord3=UNDEF;
53
54}
55/*}}}*/
56/*FUNCTION GaussTria::~GaussTria(){{{1*/
57GaussTria::~GaussTria(){
58 xfree((void**)&weights);
59 xfree((void**)&coords1);
60 xfree((void**)&coords2);
61 xfree((void**)&coords3);
62}
63/*}}}*/
64
65/*Methods*/
66/*FUNCTION GaussTria::Echo{{{1*/
67void GaussTria::Echo(void){
68
69 printf("GaussTria:\n");
70 printf(" numgauss: %i\n",numgauss);
71
72 if (weights){
73 printf(" weights = [");
74 for(int i=0;i<numgauss;i++) printf(" %g\n",weights[i]);
75 printf("]\n");
76 }
77 else printf("weights = NULL\n");
78 if (coords1){
79 printf(" coords1 = [");
80 for(int i=0;i<numgauss;i++) printf(" %g\n",coords1[i]);
81 printf("]\n");
82 }
83 else printf("coords1 = NULL\n");
84 if (coords2){
85 printf(" coords2 = [");
86 for(int i=0;i<numgauss;i++) printf(" %g\n",coords2[i]);
87 printf("]\n");
88 }
89 else printf("coords2 = NULL\n");
90 if (coords3){
91 printf(" coords3 = [");
92 for(int i=0;i<numgauss;i++) printf(" %g\n",coords3[i]);
93 printf("]\n");
94 }
95 else printf("coords3 = NULL\n");
96
97 printf(" weight = %g\n",weight);
98 printf(" coord1 = %g\n",coord1);
99 printf(" coord2 = %g\n",coord2);
100 printf(" coord3 = %g\n",coord3);
101
102}
103/*}}}*/
104/*FUNCTION GaussTria::GaussPoint{{{1*/
105void GaussTria::GaussPoint(int ig){
106
107 /*Check input in debugging mode*/
108 ISSMASSERT(ig>=0 && ig< numgauss);
109
110 /*update static arrays*/
111 weight=weights[ig];
112 coord1=coords1[ig];
113 coord2=coords2[ig];
114 coord3=coords3[ig];
115
116}
117/*}}}*/
118/*FUNCTION GaussTria::begin{{{1*/
119int GaussTria::begin(void){
120
121 /*Check that this has been initialized*/
122 ISSMASSERT(numgauss>0);
123 ISSMASSERT(weights);
124 ISSMASSERT(coords1);
125 ISSMASSERT(coords2);
126 ISSMASSERT(coords3);
127
128 /*return first gauss index*/
129 return 0;
130}
131/*}}}*/
132/*FUNCTION GaussTria::end{{{1*/
133int GaussTria::end(void){
134
135 /*Check that this has been initialized*/
136 ISSMASSERT(numgauss>0);
137 ISSMASSERT(weights);
138 ISSMASSERT(coords1);
139 ISSMASSERT(coords2);
140 ISSMASSERT(coords3);
141
142 /*return last gauss index +1*/
143 return numgauss;
144}
145/*}}}*/
Note: See TracBrowser for help on using the repository browser.