<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div style="16px">Hello,<br></div><div style="16px">with the code below, I create a tetrahedron using DMPlexCreateFromDAG, then I try to run DMPlexComputeCellGeometryFVM on this cell. The latter call fails with output:<br></div><div style="16px">...<br></div><div style="16px">[0]PETSC ERROR: --------------------- Error Message -----------------<br></div><div style="16px">[0]PETSC ERROR: Argument out of range<br></div><div style="16px">[0]PETSC ERROR: Cannot handle faces with 1 vertices</div><div style="16px">...<br></div><div style="16px">(full output is attached).<br></div><div style="16px" text-align="left"><br></div><div style="16px">What am I doing wrong?<br></div><div style="16px" text-align="left">regards<br></div><div style="16px" text-align="left">Chris<br></div><div style="16px" text-align="left"><br></div><div style="16px" text-align="left">Here is the code:<br></div><div style="16px">static char help[] = "No help \n";<br></div><div style="16px"><br></div><div style="16px">#include <petscdmplex.h><br></div><div style="16px"><br></div><div style="16px">#undef __FUNCT__<br></div><div style="16px">#define __FUNCT__ "main"<br></div><div style="16px">int main(int argc,char **args)<br></div><div style="16px">{<br></div><div style="16px"> PetscErrorCode ierr;<br></div><div style="16px"> PetscInitialize(&argc,&args,(char*)0,help);<br></div><div style="16px"><br></div><div style="16px"> DM dm;<br></div><div style="16px"> int cStart,cEnd;<br></div><div style="16px"> int fStart,fEnd;<br></div><div style="16px"><br></div><div style="16px"> int depth = 3;<br></div><div style="16px"> int dim = 3;<br></div><div style="16px"><br></div><div style="16px"> PetscInt numPoints[4] = {1,4,6,4};<br></div><div style="16px"> PetscInt coneSize[15] = {4,3,3,3,3,2,2,2,2,2,2,0,0,0,0};<br></div><div style="16px"> PetscInt cones[28] = {1,2,3,4, 5,9,8, 9,6,10, 10,8,7, 5,6,7, 11,12, 12,13, 13,11, 11,14, 12,14, 13,14};<br></div><div style="16px"> PetscInt coneOrientations[28] = {0 };<br></div><div style="16px"> PetscScalar vertexCoords[12] = {0,0,0, 1,0,0, 0,1,0, 0,0,1};<br></div><div style="16px"><br></div><div style="16px"> DMCreate(PETSC_COMM_WORLD, &dm);<br></div><div style="16px"> DMSetType(dm, DMPLEX);<br></div><div style="16px"> DMSetDimension(dm,dim);<br></div><div style="16px"> DMPlexCreateFromDAG(dm, depth, numPoints, coneSize, cones, coneOrientations, vertexCoords);<br></div><div style="16px"><br></div><div style="16px"> DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);<br></div><div style="16px"> DMPlexGetHeightStratum(dm, 1, &fStart, &fEnd);<br></div><div style="16px"><br></div><div style="16px"> for (int k =cStart;k<cEnd;k++){<br></div><div style="16px"> double vol;<br></div><div style="16px"> double centroid[3];<br></div><div style="16px"> double normal[3];<br></div><div style="16px"> ierr = DMPlexComputeCellGeometryFVM(dm, k, &vol, centroid,NULL);CHKERRQ(ierr);<br></div><div style="16px"> printf("FVM: V=%f c=(%f %f %f) n=(%f %f %f)\n",vol,centroid[0],centroid[1],centroid[2],<br></div><div style="16px"> normal[0],normal[1],normal[2]);<br></div><div style="16px"> }<br></div><div style="16px"> ierr = PetscFinalize();<br></div><div style="16px"> return 0;<br></div><div style="16px">}<br></div><div style="16px" text-align="left"><br></div><div style="16px" text-align="left"><br></div> </body>
</html>