-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dRuleGetPatches to enable integration over separate patches withi…
…n an element Includes simple test program
- Loading branch information
Showing
10 changed files
with
391 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
static const char help[] = "Tests modal bases for dJacobi."; | ||
|
||
#include <dohpjacobi.h> | ||
#include <dohpsys.h> | ||
#include <dohp.h> | ||
|
||
static dErr TestPatches(dJacobi jac,PetscViewer viewer) | ||
{ | ||
dEntTopology topo[] = {dTOPO_HEX,dTOPO_HEX,dTOPO_HEX,dTOPO_HEX}; | ||
dPolynomialOrder rdegree[4],bdegree[4]; | ||
dRule *rules; | ||
dEFS *efs; | ||
dQuadrature quad; | ||
dQuadratureMethod method = dQUADRATURE_METHOD_FAST; | ||
dInt bp = 5; | ||
dErr err; | ||
|
||
dFunctionBegin; | ||
err = PetscOptionsBegin(PETSC_COMM_WORLD,NULL,"TestPatches Options",NULL);dCHK(err); | ||
err = PetscOptionsInt("-basis_degree","Degree of tensor-product basis polynomial",NULL,bp,&bp,NULL);dCHK(err); | ||
err = PetscOptionsEnum("-quadrature_method","Method to use for sample quadrature",NULL,dQuadratureMethods,(PetscEnum)method,(PetscEnum*)&method,NULL);dCHK(err); | ||
err = PetscOptionsEnd();dCHK(err); | ||
for (dInt i=0; i<4; i++) { | ||
rdegree[i] = dPolynomialOrderCreate(0,i+1,i+1,i+1); | ||
bdegree[i] = dPolynomialOrderCreate(0,bp,bp,bp); | ||
} | ||
err = dJacobiGetQuadrature(jac,method,&quad);dCHK(err); | ||
err = dQuadratureGetRules(quad,4,topo,rdegree,&rules);dCHK(err); | ||
err = dJacobiGetEFS(jac,4,topo,bdegree,rules,&efs);dCHK(err); | ||
|
||
for (dInt i=0; i<4; i++) { | ||
dInt npatches,patchsize,dim,tsize[3]; | ||
const dInt *ind; | ||
const dReal *weight,*tcoord[3],*tweight[3]; | ||
dRule rule; | ||
err = dEFSGetRule(efs[i],&rule);dCHK(err); | ||
err = dRuleGetTensorNodeWeight(rule,&dim,tsize,tcoord,tweight);dCHK(err); | ||
err = dRuleGetPatches(rule,&npatches,&patchsize,&ind,&weight);dCHK(err); | ||
if (npatches*patchsize != tsize[0]*tsize[1]*tsize[2]) dERROR(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Inconsistent patch sizes"); | ||
err = PetscViewerASCIIPrintf(viewer,"Element %D: npatches %D patchsize %D\n",i,npatches,patchsize);dCHK(err); | ||
err = dIntTableView(npatches,patchsize,ind,"indices",viewer);dCHK(err); | ||
err = dRealTableView(npatches,patchsize,weight,"weights",viewer);dCHK(err); | ||
} | ||
err = dFree(rules);dCHK(err); | ||
err = dFree(efs);dCHK(err); | ||
dFunctionReturn(0); | ||
} | ||
|
||
int main(int argc,char *argv[]) | ||
{ | ||
dJacobi jac; | ||
MPI_Comm comm; | ||
PetscViewer viewer; | ||
dErr err; | ||
|
||
err = dInitialize(&argc,&argv,0,help);dCHK(err); | ||
comm = PETSC_COMM_WORLD; | ||
viewer = PETSC_VIEWER_STDOUT_WORLD; | ||
|
||
err = dJacobiCreate(comm,&jac);dCHK(err); | ||
err = dJacobiSetFromOptions(jac);dCHK(err); | ||
err = TestPatches(jac,viewer);dCHK(err); | ||
err = dJacobiDestroy(jac);dCHK(err); | ||
err = dFinalize();dCHK(err); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Element 0: npatches 1 patchsize 1 | ||
indices[ 0][ 0: 1] 0 | ||
weights[ 0][ 0: 1] 8.00000 | ||
Element 1: npatches 1 patchsize 8 | ||
indices[ 0][ 0: 8] 0 1 2 3 4 5 6 7 | ||
weights[ 0][ 0: 8] 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 | ||
Element 2: npatches 1 patchsize 8 | ||
indices[ 0][ 0: 8] 0 1 2 3 4 5 6 7 | ||
weights[ 0][ 0: 8] 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 | ||
Element 3: npatches 1 patchsize 27 | ||
indices[ 0][ 0:27] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ||
weights[ 0][ 0:27] 0.17147 0.17147 0.17147 0.43896 0.43896 0.43896 0.17147 0.17147 0.17147 0.27435 0.27435 0.27435 0.70233 0.70233 0.70233 0.27435 0.27435 0.27435 0.17147 0.17147 0.17147 0.43896 0.43896 0.43896 0.17147 0.17147 0.17147 |
Oops, something went wrong.