[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*/
|
---|
| 11 | GaussTria::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*/
|
---|
| 27 | GaussTria::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*/
|
---|
| 41 | GaussTria::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*/
|
---|
| 57 | GaussTria::~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*/
|
---|
| 67 | void 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 | /*}}}*/
|
---|
[5637] | 104 | /*FUNCTION GaussTria::GaussCenter{{{1*/
|
---|
| 105 | void GaussTria::GaussCenter(void){
|
---|
| 106 |
|
---|
| 107 | /*update static arrays*/
|
---|
| 108 | coord1=ONETHIRD;
|
---|
| 109 | coord2=ONETHIRD;
|
---|
| 110 | coord3=ONETHIRD;
|
---|
| 111 |
|
---|
| 112 | }
|
---|
| 113 | /*}}}*/
|
---|
[5625] | 114 | /*FUNCTION GaussTria::GaussPoint{{{1*/
|
---|
| 115 | void GaussTria::GaussPoint(int ig){
|
---|
| 116 |
|
---|
| 117 | /*Check input in debugging mode*/
|
---|
| 118 | ISSMASSERT(ig>=0 && ig< numgauss);
|
---|
| 119 |
|
---|
| 120 | /*update static arrays*/
|
---|
| 121 | weight=weights[ig];
|
---|
| 122 | coord1=coords1[ig];
|
---|
| 123 | coord2=coords2[ig];
|
---|
| 124 | coord3=coords3[ig];
|
---|
| 125 |
|
---|
| 126 | }
|
---|
| 127 | /*}}}*/
|
---|
[5630] | 128 | /*FUNCTION GaussTria::GaussVertex{{{1*/
|
---|
| 129 | void GaussTria::GaussVertex(int iv){
|
---|
| 130 |
|
---|
| 131 | /*in debugging mode: check that the default constructor has been called*/
|
---|
| 132 | ISSMASSERT(numgauss==-1);
|
---|
| 133 |
|
---|
| 134 | /*update static arrays*/
|
---|
| 135 | switch(iv){
|
---|
| 136 | case 0:
|
---|
| 137 | coord1=1; coord2=0; coord3=0;
|
---|
| 138 | break;
|
---|
| 139 | case 1:
|
---|
| 140 | coord1=0; coord2=1; coord3=0;
|
---|
| 141 | break;
|
---|
| 142 | case 2:
|
---|
| 143 | coord1=0; coord2=0; coord3=1;
|
---|
| 144 | break;
|
---|
| 145 | default:
|
---|
| 146 | ISSMERROR("vertex index should be in [0 2]");
|
---|
| 147 |
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | }
|
---|
| 151 | /*}}}*/
|
---|
[5625] | 152 | /*FUNCTION GaussTria::begin{{{1*/
|
---|
| 153 | int GaussTria::begin(void){
|
---|
| 154 |
|
---|
| 155 | /*Check that this has been initialized*/
|
---|
| 156 | ISSMASSERT(numgauss>0);
|
---|
| 157 | ISSMASSERT(weights);
|
---|
| 158 | ISSMASSERT(coords1);
|
---|
| 159 | ISSMASSERT(coords2);
|
---|
| 160 | ISSMASSERT(coords3);
|
---|
| 161 |
|
---|
| 162 | /*return first gauss index*/
|
---|
| 163 | return 0;
|
---|
| 164 | }
|
---|
| 165 | /*}}}*/
|
---|
| 166 | /*FUNCTION GaussTria::end{{{1*/
|
---|
| 167 | int GaussTria::end(void){
|
---|
| 168 |
|
---|
| 169 | /*Check that this has been initialized*/
|
---|
| 170 | ISSMASSERT(numgauss>0);
|
---|
| 171 | ISSMASSERT(weights);
|
---|
| 172 | ISSMASSERT(coords1);
|
---|
| 173 | ISSMASSERT(coords2);
|
---|
| 174 | ISSMASSERT(coords3);
|
---|
| 175 |
|
---|
| 176 | /*return last gauss index +1*/
|
---|
| 177 | return numgauss;
|
---|
| 178 | }
|
---|
| 179 | /*}}}*/
|
---|