<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    You can compute centroids of hex (or line, tri, quad, prism,
    pyramid, tet) with LaGriT.<br>
    <br>
    You have to output the mesh in a format LaGriT can read (eg. Abaqus)<br>
    <br>
    export abaqus "file_name" overwrite cubitids<br>
    <br>
    I convert the abaqus to AVS format with the awk script below (script
    below is hardwired for quads).<br>
    <br>
    Then the following LaGriT command compute the centroid and output it
    to a file in 3 column ascii.<br>
    <br>
    <tt>read / avs / file_name_in / mo<br>
      createpts / median<br>
      dump / avs2 / file_name_out / mo / 0 0 0 2<br>
      finish</tt><br>
    <br>
    Cheers,<br>
    Carl Gable<br>
    <br>
    <br>
    <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
      00003&nbsp; 1&nbsp; 1&nbsp; 1<br>
      xmed, real <br>
      ymed, real <br>
      zmed, real <br>
      &nbsp; 0.142157819824E+05&nbsp; 0.222367900391E+05&nbsp; 0.623520860076E+01<br>
      &nbsp; 0.143572114258E+05&nbsp; 0.222202792969E+05&nbsp; 0.708197271824E+01<br>
      &nbsp; 0.144949233398E+05&nbsp; 0.222228002930E+05&nbsp; 0.781360983849E+01<br>
      &nbsp; 0.146261022949E+05&nbsp; 0.222358046875E+05&nbsp; 0.813354587555E+01<br>
      &nbsp; 0.147520295410E+05&nbsp; 0.222421035156E+05&nbsp; 0.823126870394E+01<br>
      <br>
      <br>
      tessellate.lanl.gov:shell% cat abaqus2avs.awk<br>
      # this converts abacus quad file to avs <br>
      # awk -f abacus2avs.awk input.inp<br>
      #<br>
      BEGIN{ FS=","; ipt=0; iquad=0; IN_NODE=0; IN_QUAD=0; }<br>
      {<br>
      <br>
      # look for key words<br>
      # *NODE, NSET=ALLNODES<br>
      # *ELEMENT, TYPE=S4R, ELSET=EB1<br>
      <br>
      if ($1 == "*NODE") {IN_NODE = 1; } <br>
      if ($1 == "*ELEMENT") {IN_NODE=0; IN_QUAD = 1; } <br>
      <br>
      <br>
      if (IN_NODE==1 &amp;&amp; NF==4) {<br>
      &nbsp;&nbsp; ipt=ipt+1<br>
      &nbsp;&nbsp; xic[ipt]= $2<br>
      &nbsp;&nbsp; yic[ipt]= $3<br>
      &nbsp;&nbsp; zic[ipt]= $4<br>
      &nbsp;&nbsp; if ($1 == "**") {IN_NODE = 0}<br>
      &nbsp; }<br>
      <br>
      if (IN_QUAD==1 &amp;&amp; NF==5) {<br>
      &nbsp;&nbsp; iquad=iquad+1<br>
      &nbsp;&nbsp; q1[iquad]= $2<br>
      &nbsp;&nbsp; q2[iquad]= $3<br>
      &nbsp;&nbsp; q3[iquad]= $4<br>
      &nbsp;&nbsp; q4[iquad]= $5<br>
      &nbsp;&nbsp; if ($1 == "**") {IN_QUAD = 0}<br>
      &nbsp; }<br>
      <br>
      <br>
      <br>
      } END { <br>
      &nbsp; FS=" "<br>
      &nbsp; print ipt, iquad," 0 0";<br>
      <br>
      &nbsp; for (i=1; i&lt;=ipt; i=i+1) {<br>
      &nbsp;&nbsp; printf(" %10d %14.4f&nbsp; %14.4f&nbsp; %7.4f\n",i, xic[i], yic[i], elev
      ) } <br>
      <br>
      &nbsp; for (i = 1; i &lt;= (iquad); i = i + 1){&nbsp; <br>
      &nbsp;&nbsp; printf(" %10d&nbsp; 1&nbsp; quad %10d %10d %10d %10d\n",i, q1[i], q2[i],
      q3[i], q4[i] ) } <br>
      }<br>
      <br>
      tessellate.lanl.gov:shell% </tt><br>
    <br>
    <br>
    On 09/08/2012 08:33 PM, Matthew Knepley wrote:
    <blockquote
cite="mid:CAMYG4GmwqGjz-V7g6a31DEpxbJXWw_PmVwPhp0QQ_k-yUeHJiA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      On Sat, Sep 8, 2012 at 9:29 PM, Birendra jha <span dir="ltr">&lt;<a
          moz-do-not-send="true" href="mailto:bjha7333@yahoo.com"
          target="_blank">bjha7333@yahoo.com</a>&gt;</span> wrote:<br>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          Hi<br>
          <br>
          Does anyone know if it is possible to compute and output cell
          centroid coordinates from CUBIT?<br>
          <br>
          If not in CUBIT, is there some other tool (c++ code etc.) for
          this?<br>
          <br>
          I need it for unstructured hexahedral grid. From google I
          found:<br>
          <a moz-do-not-send="true"
            href="http://www.cs.berkeley.edu/%7Ejfc/mirtich/massProps.html"
            target="_blank">http://www.cs.berkeley.edu/~jfc/mirtich/massProps.html</a><br>
          which I tried to use but I don't understand why it does not
          work for general hexahedron.<br>
        </blockquote>
        <div><br>
        </div>
        <div>The way that makes sense in PyLith is to take the middle
          point in the reference element,</div>
        <div>(0.0,0.0,0.0) I believe, and transform it using the FE
          Jacobian inverse for that point. We</div>
        <div>have these routines since they are used for point location.</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp;Matt</div>
        <div>&nbsp;</div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          Thanks a lot<br>
          Birendra<br>
          _______________________________________________<br>
          CIG-SHORT mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:CIG-SHORT@geodynamics.org">CIG-SHORT@geodynamics.org</a><br>
          <a moz-do-not-send="true"
            href="http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short"
            target="_blank">http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short</a><br>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      What most experimenters take for granted before they begin their
      experiments is infinitely more interesting than any results to
      which their experiments lead.<br>
      -- Norbert Wiener<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
CIG-SHORT mailing list
<a class="moz-txt-link-abbreviated" href="mailto:CIG-SHORT@geodynamics.org">CIG-SHORT@geodynamics.org</a>
<a class="moz-txt-link-freetext" href="http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short">http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Dr. Carl W. Gable, Staff Scientist

Acting Group Leader, EES-16, Computational Earth Sciences
MS T003, Los Alamos National Laboratory, Los Alamos NM 87545
<a class="moz-txt-link-abbreviated" href="mailto:Email:gable@lanl.gov">Email:gable@lanl.gov</a>   Voice:505-665-3533   Fax:505-665-8737

Homepage:                         <a class="moz-txt-link-freetext" href="http://www.ees.lanl.gov/staff/gable">http://www.ees.lanl.gov/staff/gable</a>
LaGriT Mesh Generation Software:  <a class="moz-txt-link-freetext" href="http://lagrit.lanl.gov">http://lagrit.lanl.gov</a>
Mesh Generation, Geological Apps: <a class="moz-txt-link-freetext" href="http://meshing.lanl.gov">http://meshing.lanl.gov</a>

Focus:Geophysics, Hydrology, Mesh Generation, Computational Geometry

Schedule B
/\/\/\/\/\/\/\/\/\/\/Correspondence / TSPA\/\/\/\/\/\/\/\/\/\/\/\/\/
</pre>
  </body>
</html>