<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hello,<div><br></div><div>I defined the partition of Vector, which is not stored contiguously. Here is a part of my code. The total number of nodes is NODE*DOF. Before executing this following code, I defined LEN and an array NODENP[] to store the number of nodes and the list of nodes in each processor. I accessed the element using aM[node*DOF+j] and aM[i*DOF+j], but none of them gave me the correct answer. Your help is well appreciated.</div><div><br></div><div>**************************************************************</div><div>VecCreate(PETSC_COMM_WORLD, &M);</div><div>VecSetSizes(M, LEN*DOF, NODE*DOF); </div><div><br></div><div>VecGetArray(M, &aM); </div><div><br></div><div><div>for(int i=0; i<LEN; i++)</div><div>{</div></div><div> node=NODENP[i];</div><div> for(int j=0; j<DOF; j++)</div><div> {</div><div> aM[node*DOF+j] or <span style="font-size: 12pt;">aM[i*DOF+j] ?</span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;"> //accessing the elements of M</span></div><div> </div><div> }</div><div>}</div><div>VecRestoreArray(M, &aM); </div><div>*********************************************************</div> </div></body>
</html>