Changeset 18523
- Timestamp:
- 09/16/14 09:14:24 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp
r18521 r18523 1 /*!\file PentaRef.c 1 /*!\file PentaRef.cpp 2 2 * \brief: implementation of the PentaRef object 3 3 */ … … 26 26 #define NUMNODESP2b 19 27 27 #define NUMNODESP2xP4 30 28 #define NUMNODESMAX 30 28 29 29 30 /*Object constructors and destructor*/ … … 886 887 /*}}}*/ 887 888 void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){/*{{{*/ 888 889 /*Output*/ 890 IssmDouble value =0.; 889 /* WARNING: For a significant gain in performance, it is better to use 890 * static memory allocation instead of dynamic.*/ 891 892 /*Allocate basis functions*/ 893 IssmDouble basis[NUMNODESMAX]; 891 894 892 895 /*Fetch number of nodes for this finite element*/ 893 896 int numnodes = this->NumberofNodes(finiteelement); 894 895 /*Get nodal functions*/ 896 IssmDouble* basis=xNew<IssmDouble>(numnodes);897 GetNodalFunctions( basis,gauss,finiteelement);897 _assert_(numnodes<=NUMNODESMAX); 898 899 /*Get basis functions at this point*/ 900 GetNodalFunctions(&basis[0],gauss,finiteelement); 898 901 899 902 /*Calculate parameter for this Gauss point*/ 903 IssmDouble value =0.; 900 904 for(int i=0;i<numnodes;i++) value += basis[i]*plist[i]; 901 905 902 906 /*Assign output pointer*/ 903 xDelete<IssmDouble>(basis);904 907 *pvalue = value; 905 906 908 } 907 909 /*}}}*/ … … 915 917 * 916 918 * p is a vector of size 3x1 already allocated. 919 * 920 * WARNING: For a significant gain in performance, it is better to use 921 * static memory allocation instead of dynamic. 917 922 */ 918 923 919 /*Output*/ 924 /*Allocate derivatives of basis functions*/ 925 IssmDouble dbasis[3*NUMNODESMAX]; 926 927 /*Fetch number of nodes for this finite element*/ 928 int numnodes = this->NumberofNodes(finiteelement); 929 _assert_(numnodes<=NUMNODESMAX); 930 931 /*Get basis functions derivatives at this point*/ 932 GetNodalFunctionsDerivatives(&dbasis[0],xyz_list,gauss,finiteelement); 933 934 /*Calculate parameter for this Gauss point*/ 920 935 IssmDouble dpx=0.; 921 936 IssmDouble dpy=0.; 922 937 IssmDouble dpz=0.; 923 924 /*Fetch number of nodes for this finite element*/925 int numnodes = this->NumberofNodes(finiteelement);926 927 /*Get nodal functions derivatives*/928 IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);929 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,finiteelement);930 931 /*Calculate parameter for this Gauss point*/932 938 for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i]; 933 939 for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i]; … … 935 941 936 942 /*Assign values*/ 937 xDelete<IssmDouble>(dbasis);938 943 p[0]=dpx; 939 944 p[1]=dpy; 940 945 p[2]=dpz; 941 942 946 } 943 947 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp
r18078 r18523 18 18 #define NUMNODESP0 1 19 19 #define NUMNODESP1 2 20 #define NUMNODESMAX 2 20 21 21 22 /*Object constructors and destructor*/ … … 115 116 * 116 117 * p is a vector already allocated. 118 * 119 * WARNING: For a significant gain in performance, it is better to use 120 * static memory allocation instead of dynamic. 117 121 */ 118 122 119 /* Output*/120 IssmDouble dpx = 0.;123 /*Allocate derivatives of basis functions*/ 124 IssmDouble dbasis[1*NUMNODESMAX]; 121 125 122 126 /*Fetch number of nodes for this finite element*/ 123 127 int numnodes = this->NumberofNodes(finiteelement); 124 125 /*Get nodal functions derivatives*/ 126 IssmDouble* dbasis=xNew<IssmDouble>(1*numnodes);127 GetNodalFunctionsDerivatives( dbasis,xyz_list,gauss,finiteelement);128 _assert_(numnodes<=NUMNODESMAX); 129 130 /*Get basis functions derivatives at this point*/ 131 GetNodalFunctionsDerivatives(&dbasis[0],xyz_list,gauss,finiteelement); 128 132 129 133 /*Calculate parameter for this Gauss point*/ 130 for(int i=0;i<numnodes;i++) dpx += dbasis[i]*plist[i]; 134 IssmDouble dpx=0.; 135 for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i]; 131 136 132 137 /*Assign values*/ 133 xDelete<IssmDouble>(dbasis); 134 *p=dpx; 135 138 p[0]=dpx; 136 139 } 137 140 /*}}}*/ 138 141 void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){/*{{{*/ 139 140 /*Output*/ 141 IssmDouble value =0.; 142 /* WARNING: For a significant gain in performance, it is better to use 143 * static memory allocation instead of dynamic.*/ 144 145 /*Allocate basis functions*/ 146 IssmDouble basis[NUMNODESMAX]; 142 147 143 148 /*Fetch number of nodes for this finite element*/ 144 149 int numnodes = this->NumberofNodes(finiteelement); 145 146 /*Get nodal functions*/ 147 IssmDouble* basis=xNew<IssmDouble>(numnodes);148 GetNodalFunctions( basis,gauss,finiteelement);150 _assert_(numnodes<=NUMNODESMAX); 151 152 /*Get basis functions at this point*/ 153 GetNodalFunctions(&basis[0],gauss,finiteelement); 149 154 150 155 /*Calculate parameter for this Gauss point*/ 156 IssmDouble value =0.; 151 157 for(int i=0;i<numnodes;i++) value += basis[i]*plist[i]; 152 158 153 159 /*Assign output pointer*/ 154 xDelete<IssmDouble>(basis);155 160 *p = value; 156 161 } -
issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp
r18521 r18523 20 20 #define NUMNODESP1b 5 21 21 #define NUMNODESP2 10 22 #define NUMNODESMAX 10 22 23 23 24 /*Object constructors and destructor*/ … … 217 218 * 218 219 * p is a vector of size 3x1 already allocated. 220 * 221 * WARNING: For a significant gain in performance, it is better to use 222 * static memory allocation instead of dynamic. 219 223 */ 220 224 221 /*Output*/ 225 /*Allocate derivatives of basis functions*/ 226 IssmDouble dbasis[3*NUMNODESMAX]; 227 228 /*Fetch number of nodes for this finite element*/ 229 int numnodes = this->NumberofNodes(finiteelement); 230 _assert_(numnodes<=NUMNODESMAX); 231 232 /*Get basis functions derivatives at this point*/ 233 GetNodalFunctionsDerivatives(&dbasis[0],xyz_list,gauss,finiteelement); 234 235 /*Calculate parameter for this Gauss point*/ 222 236 IssmDouble dpx=0.; 223 237 IssmDouble dpy=0.; 224 238 IssmDouble dpz=0.; 225 226 /*Fetch number of nodes for this finite element*/227 int numnodes = this->NumberofNodes(finiteelement);228 229 /*Get nodal functions derivatives*/230 IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);231 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,finiteelement);232 233 /*Calculate parameter for this Gauss point*/234 239 for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i]; 235 240 for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i]; … … 237 242 238 243 /*Assign values*/ 239 xDelete<IssmDouble>(dbasis);240 244 p[0]=dpx; 241 245 p[1]=dpy; … … 244 248 /*}}}*/ 245 249 void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){/*{{{*/ 246 247 /*Output*/ 248 IssmDouble value =0.; 250 /* WARNING: For a significant gain in performance, it is better to use 251 * static memory allocation instead of dynamic.*/ 252 253 /*Allocate basis functions*/ 254 IssmDouble basis[NUMNODESMAX]; 249 255 250 256 /*Fetch number of nodes for this finite element*/ 251 257 int numnodes = this->NumberofNodes(finiteelement); 252 253 /*Get nodal functions*/ 254 IssmDouble* basis=xNew<IssmDouble>(numnodes);255 GetNodalFunctions( basis,gauss,finiteelement);258 _assert_(numnodes<=NUMNODESMAX); 259 260 /*Get basis functions at this point*/ 261 GetNodalFunctions(&basis[0],gauss,finiteelement); 256 262 257 263 /*Calculate parameter for this Gauss point*/ 264 IssmDouble value =0.; 258 265 for(int i=0;i<numnodes;i++) value += basis[i]*plist[i]; 259 266 260 267 /*Assign output pointer*/ 261 xDelete<IssmDouble>(basis);262 268 *p = value; 263 269 } -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r18521 r18523 21 21 #define NUMNODESP2 6 22 22 #define NUMNODESP2b 7 23 #define NUMNODESMAX 7 23 24 24 25 /*Object constructors and destructor*/ … … 354 355 /*}}}*/ 355 356 void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/ 356 357 357 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian 358 358 * point specified by gauss_basis: … … 361 361 * 362 362 * p is a vector already allocated. 363 * 364 * WARNING: For a significant gain in performance, it is better to use 365 * static memory allocation instead of dynamic. 363 366 */ 364 367 365 /*Output*/ 368 /*Allocate derivatives of basis functions*/ 369 IssmDouble dbasis[2*NUMNODESMAX]; 370 371 /*Fetch number of nodes for this finite element*/ 372 int numnodes = this->NumberofNodes(finiteelement); 373 _assert_(numnodes<=NUMNODESMAX); 374 375 /*Get basis functions derivatives at this point*/ 376 GetNodalFunctionsDerivatives(&dbasis[0],xyz_list,gauss,finiteelement); 377 378 /*Calculate parameter for this Gauss point*/ 366 379 IssmDouble dpx=0.; 367 380 IssmDouble dpy=0.; 381 for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i]; 382 for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i]; 383 384 /*Assign values*/ 385 p[0]=dpx; 386 p[1]=dpy; 387 388 } 389 /*}}}*/ 390 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){/*{{{*/ 391 /* WARNING: For a significant gain in performance, it is better to use 392 * static memory allocation instead of dynamic.*/ 393 394 /*Allocate basis functions*/ 395 IssmDouble basis[NUMNODESMAX]; 368 396 369 397 /*Fetch number of nodes for this finite element*/ 370 398 int numnodes = this->NumberofNodes(finiteelement); 371 372 /*Get nodal functions derivatives*/ 373 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);374 GetNodalFunctions Derivatives(dbasis,xyz_list,gauss,finiteelement);399 _assert_(numnodes<=NUMNODESMAX); 400 401 /*Get basis functions at this point*/ 402 GetNodalFunctions(&basis[0],gauss,finiteelement); 375 403 376 404 /*Calculate parameter for this Gauss point*/ 377 for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i];378 for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i];379 380 /*Assign values*/381 xDelete<IssmDouble>(dbasis);382 p[0]=dpx;383 p[1]=dpy;384 385 }386 /*}}}*/387 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){/*{{{*/388 389 /*Output*/390 405 IssmDouble value =0.; 391 392 /*Fetch number of nodes for this finite element*/393 int numnodes = this->NumberofNodes(finiteelement);394 395 /*Get nodal functions*/396 IssmDouble* basis=xNew<IssmDouble>(numnodes);397 GetNodalFunctions(basis, gauss,finiteelement);398 399 /*Calculate parameter for this Gauss point*/400 406 for(int i=0;i<numnodes;i++) value += basis[i]*plist[i]; 401 407 402 408 /*Assign output pointer*/ 403 xDelete<IssmDouble>(basis);404 409 *p = value; 405 410 }
Note:
See TracChangeset
for help on using the changeset viewer.