Files
LaGriT/docs/_site/pages/mstkla/example.html
2025-12-17 11:00:57 +08:00

726 lines
16 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<html lang="en-gb" dir="ltr">
<head>
<title>LaGriT</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="LaGriT : LaGriT is a library providing mesh generation and optimization for a variety of polyhedra and dimensions.">
<link href="https://fonts.googleapis.com/css?family=Do+Hyeon|Fira+Sans" rel="stylesheet">
<link rel="preload" href="https://getuikit.com/fonts/ProximaNova-Reg-webfont.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="preload" href="https://getuikit.com/fonts/ProximaNova-Light-webfont.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="stylesheet" href="/assets/css/uikit_theme.css">
<link rel="icon" type="image/x-icon" href="https://www.lanl.gov/favicon.ico">
<link rel="stylesheet" type="text/css" href="/assets/css/footer.css">
<!-- load stylesheets -->
<script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" defer=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/he/1.2.0/he.min.js" defer=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.6.2/marked.min.js" defer=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js" defer=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.2/vue-router.min.js" defer=""></script>
<script src="https://getuikit.com/assets/uikit/dist/js/uikit.min.js?1180" defer=""></script>
<script src="https://getuikit.com/assets/uikit/dist/js/uikit-icons.min.js?1180" defer=""></script>
<script src="https://getuikit.com/assets/highlightjs/highlight.min.js" defer=""></script>
<script src="https://getuikit.com/app/main.min.js?1180" defer=""></script>
<script src="https://www.googletagmanager.com/gtag/js?id=UA-42150424-1" async=""></script>
<!-- tipuesearch files -->
<link rel="stylesheet" href="/assets/tipuesearch/css/normalize.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="/assets/tipuesearch/tipuesearch_content.js"></script>
<link rel="stylesheet" href="/assets/tipuesearch/css/tipuesearch.css">
<script src="/assets/tipuesearch/tipuesearch_set.js"></script>
<script src="/assets/tipuesearch/tipuesearch.min.js"></script>
<!-- Finally, load global style to overwrite template, tipuesearch, etc. -->
<!--<link rel="stylesheet" href="/assets/globalstyle.css">-->
</head>
<body>
<div>
<!-- Header -->
<div uk-sticky="media: 960" class="uk-navbar-container tm-navbar-container uk-sticky uk-sticky-fixed" style="position: fixed; top: 0px; width: 100%; color: #212328;">
<div class="uk-container uk-container-expand">
<nav class="uk-navbar">
<div class="uk-navbar-left">
<a href="/" class="uk-navbar-item uk-logo" style="font-family: 'Do Hyeon', sans-serif; color: white;">
<img uk-img src="/assets/img/logo.png" width="50" class="uk-margin-small-right" alt="LANL logo">
LaGriT
</a>
</div>
<div class="uk-navbar-right">
<ul class="uk-navbar-nav uk-visible@m">
<li><a href="/pages/commands">Commands</a></li>
<li><a href="/pages/tutorial/index">Tutorials</a></li>
<li><a href="/pages/release">Release Notes</a></li>
<li><a href="/pages/publications">Publications</a></li>
<li><a href="http://github.com/lanl/LaGriT"><span uk-icon="github"></span></a></li>
<!-- Begin search bar -->
<div class="nav-overlay uk-navbar-right">
<a class="uk-navbar-toggle" uk-search-icon uk-toggle="target: .nav-overlay; animation: uk-animation-fade" href="#"></a>
</div>
<div class="nav-overlay uk-navbar-left uk-flex-1" hidden>
<div class="uk-navbar-item uk-width-expand">
<form class="uk-search uk-search-navbar uk-width-1-1" action="https://lanl.github.io/LaGriT/search/">
<input class="uk-search-input" name="q" type="search" id="tipue_search_input" placeholder="Search..." autofocus>
</form>
</div>
<a class="uk-navbar-toggle" uk-close uk-toggle="target: .nav-overlay; animation: uk-animation-fade" href="#"></a>
</div>
<script>
$(document).ready(function() {
$('#tipue_search_input').tipuesearch({
'show': 10,
'newWindow' : true,
'showURL' : true,
'showTitleCount' : true,
'descriptiveWords' : 20,
'highlightTerms' : true,
'mode': 'static',
});
});
</script>
<!-- End search bar -->
</ul>
<a uk-navbar-toggle-icon="" href="#offcanvas" uk-toggle="" class="uk-navbar-toggle uk-hidden@m uk-icon uk-navbar-toggle-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="navbar-toggle-icon">
<rect y="9" width="20" height="2"></rect>
<rect y="3" width="20" height="2"></rect>
<rect y="15" width="20" height="2"></rect>
</svg>
</a>
</div>
</nav>
</div>
</div>
<div class="uk-sticky-placeholder" style="height: 80px; margin: 0px;"></div>
<!-- End Header -->
<!-- Main Body text -->
<div class="tm-main uk-section uk-section-default">
<div class="uk-container uk-container-small uk-position-relative">
<p> <img height="300" width="300" src="https://lanl.github.io/LaGriT/assets/images/arrow2.gif" />“30”
“30”](mstkla.md#EXAMPLE) <img height="300" width="300" src="https://lanl.github.io/LaGriT/assets/images/arrow3.gif" />“30”
“30”](utilities.md) <img height="300" width="300" src="https://lanl.github.io/LaGriT/assets/images/arrow4.gif" />“30”
“30”](linking.md)</p>
<p>/
*</p>
<p>==========================================================================</p>
<p>#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#</p>
<p>  Example program with MSTKLA</p>
<p>#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#</p>
<p>==========================================================================</p>
<p>*</p>
<p>#include &lt;stdio.h&gt;</p>
<p>#include &lt;stdlib.h&gt;</p>
<p>#include “mstkla.h”</p>
<p>#include “gmtkla.h”</p>
<p>int main(int argc, char
*argv[]) {</p>
<p>  char
*meshname;</p>
<p>  PMeshObj mesh;</p>
<p>  PMeshVert vert, rverts[8];</p>
<p>  PMeshRegn reg, oreg;</p>
<p>  ElType type;</p>
<p>  int nv, nf, nr, nrv, i, j,
*rfside, nrf, ngr, ngf;</p>
<p>  double xyz[3];</p>
<p>  PGeomEntity gent;</p>
<p>  PGeomFace
*rflist,
*gflist;</p>
<p>  PGeomRegn
*grlist;</p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Initialization
<em>**/</em></li>
</ul>
<p> </p>
<p>  MSTKLA_Init();</p>
<p>  GMTKLA_Init();</p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Create a mesh object and fill in the data after reading from a
file
<em>**/</em></li>
</ul>
<p>  mesh = MESH_Create();</p>
<p>  MESH_InitFromFile(mesh, argv[1], argv[2], 1, &amp;meshname);</p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Model info
<em>**/</em></li>
</ul>
<p> </p>
<p>  ngr = GM_NumRegions();</p>
<p>  fprintf(stderr,”Number of model regions: %d</p>
<p>n”,ngr);</p>
<p> </p>
<p>  ngf = GM_NumFaces();</p>
<p>  fprintf(stderr,”Number of model faces: %d</p>
<p>n”,ngf);</p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Get all the regions in the model
<em>**/</em></li>
</ul>
<p>  GM_Regions(&amp;ngr, &amp;grlist);</p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Loop through the regions and print out info about the faces***</li>
</ul>
<p><strong><em>     bounding this region</em></strong></p>
<p><em>**    
**</em>/*</p>
<p> </p>
<p>  for (i = 0; i &lt; ngr; i++) {</p>
<p>    fprintf(stderr,”Region %-d</p>
<p>n:</p>
<p>n”,(i+1));</p>
<p> </p>
<p>    ***/</p>
<ul>
<li>Faces of the region
<em>**/</em></li>
</ul>
<p> </p>
<p>    GR_Faces(grlist[i],&amp;nrf,&amp;rflist,&amp;rfside);</p>
<p> </p>
<p>    fprintf(stderr,”  %d Faces</p>
<p>n”,nrf);</p>
<p>    for (j = 0; j &lt; nrf; j++) {</p>
<p>      fprintf(stderr,”Face %-d  Dir %-d Type %-d</p>
<p>n”,</p>
<p>       GF_Number(rflist[j]),rfside[j],GF_Type(rflist[j]));</p>
<p>   </p>
<p> </p>
<p>  for (i = 0; i &lt; ngr; i++)</p>
<p>    GR_Delete(grlist[i]);</p>
<p>  free(grlist);</p>
<p>  <em>*/</em></p>
<ul>
<li>Just get the all the faces of the model
<em>**/</em></li>
</ul>
<p>***  /</p>
<ul>
<li>Delete the objects containing that info - the surfaces
themselves***</li>
</ul>
<p><strong><em>     dont get deleted</em></strong></p>
<p><em>**    
**</em>/*</p>
<p>  GM_Faces(&amp;ngf, &amp;gflist);</p>
<p>  for (i = 0; i &lt; ngf; i++)</p>
<p>    GF_Delete(gflist[i]);</p>
<p>  free(gflist);</p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Mesh Info
<em>**/</em></li>
</ul>
<p>  fprintf(stderr,”Number of nodes in
mesh:</p>
<p>t%d</p>
<p>n”,MESH_NumVertices(mesh));</p>
<p>  fprintf(stderr,”Number of elements in
mesh:</p>
<p>t%d</p>
<p>n”,MESH_NumRegions(mesh));</p>
<p>  ***/</p>
<ul>
<li>Loop through each mesh vertex and print some info about it</li>
</ul>
<p><em>**/</em></p>
<p>  nv = MESH_NumVertices(mesh);</p>
<p>  for (i = 0; i &lt; nv; i++) {</p>
<p>    vert = MESH_Vertex(mesh,i);</p>
<p>    if (MV_Type(mesh,vert) == VDELETED MV_Type(mesh,vert) ==
VIGNORE)</p>
<p>      continue;</p>
<p>    ***/</p>
<ul>
<li>Get the classification (model entity that mesh entity is on)
of***</li>
</ul>
<p><strong><em>       the mesh vertex</em></strong></p>
<p><em>**      
**</em>/*</p>
<p>    gent = MV_GMentity(mesh,vert);</p>
<p>    ***/</p>
<ul>
<li>Get the coordinates of the mesh vertex
<em>**/</em></li>
</ul>
<p>    MV_Coords(mesh, vert, xyz);</p>
<p>    if (gent)</p>
<p>      fprintf(stderr,”V%-d [ G%-d (order %1d) —  %lf %lf %lf</p>
<p>n”,</p>
<p>       MV_Number(mesh,vert),GEnt_Number(gent), MV_GMtype(mesh,vert),</p>
<p>       xyz[0],xyz[1],xyz[2]);</p>
<p>    else</p>
<p>      fprintf(stderr,”V%-d [ G</p>
<ul>
<li>(order %1d) —  %lf %lf %lf</li>
</ul>
<p>n”,</p>
<p>       MV_Number(mesh,vert),MV_GMtype(mesh,vert),</p>
<p>       xyz[0],xyz[1],xyz[2]);</p>
<p> </p>
<p>  fprintf(stderr,”</p>
<p>n</p>
<p>n”);</p>
<p>  nr = MESH_NumRegions(mesh);</p>
<p>  ***/</p>
<ul>
<li>Loop through each mesh regions and print some info about it</li>
</ul>
<p><em>**/</em></p>
<p>  for (i = 0; i &lt; nr; i++) {</p>
<p>    reg = MESH_Region(mesh,i);</p>
<p>    ***/</p>
<ul>
<li>Region type - TET, PYRAMID, PRISM, HEX?
<em>**/</em></li>
</ul>
<p>    type = MR_Type(mesh,reg);</p>
<p> </p>
<p>    ***/</p>
<ul>
<li>Vertices of region aka nodes of element
<em>**/</em></li>
</ul>
<p>    MR_Vertices(mesh, reg, &amp;nrv, (PMeshVert
*) rverts);</p>
<p> </p>
<p>    ***/</p>
<ul>
<li>Classification of mesh region i.e. what model region it is in</li>
</ul>
<p><em>**/</em></p>
<p>    gent = MR_GMentity(mesh,reg);</p>
<p>    if (GEnt_Type(gent) != GREGION)</p>
<p>      fprintf(stderr,”Mesh Region not classified on model
region???</p>
<p>n”);</p>
<p> </p>
<p>    fprintf(stderr,”R%-d [ G%-d — “, MR_Number(mesh,reg),
GEnt_Number(gent));</p>
<p>    for (j = 0; j &lt; nrv; j++)</p>
<p>      fprintf(stderr,”%d  “, MV_Number(mesh,rverts[j]));</p>
<p>    fprintf(stderr,”</p>
<p>n”);</p>
<p> </p>
<p> </p>
<p>  ***/</p>
<ul>
<li>Loop through the regions of the mesh and print the face
neighbor info
<em>**/</em></li>
</ul>
<p>  for (i = 0; i &lt; nr; i++) {</p>
<p>    reg = MESH_Region(mesh,i);</p>
<p>    fprintf(stderr,”Region %-d neighbors: “, MR_Number(mesh,reg));</p>
<p>    type = MR_Type(mesh,reg);</p>
<p>    nf = RType_NumFaces(type);</p>
<p>    for (j = 0; j &lt; nf; j++) {</p>
<p>      ***/</p>
<ul>
<li>Find the other region sharing face j of reg
<em>**/</em></li>
</ul>
<p>      oreg = MR_FaceNebr(mesh,reg,j);</p>
<p>      if (oreg) { ***/</p>
<ul>
<li>a region exists on the other side of face,
print info
<em>**/</em></li>
</ul>
<p>         fprintf(stderr,”R%-d “,MR_Number(mesh,oreg));</p>
<p>     </p>
<p>   </p>
<p>    fprintf(stderr,”</p>
<p>n”);</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> <img height="300" width="300" src="https://lanl.github.io/LaGriT/assets/images/arrow2.gif" />“30”
“30”](mstkla.md#EXAMPLE) <img height="300" width="300" src="https://lanl.github.io/LaGriT/assets/images/arrow3.gif" />“30”
“30”](utilities.md) <img height="300" width="300" src="https://lanl.github.io/LaGriT/assets/images/arrow4.gif" />“30”
“30”](linking.md)</p>
</div>
</div>
<!-- Begin footer -->
<footer class="footer-distributed">
<div class="footer-right">
<div><img src="/assets/img/lanl_logo_white.png" height="80"></div>
</div>
<div class="footer-left lg-background-color">
<p class="footer-links" style="font-family: 'Fira Sans', sans-serif; color: white;">
<a href="/">Home</a>
·
<a href="/pylagrit/original/index.html">PyLaGriT</a>
·
<a href="https://int.lanl.gov/org/ddste/aldcels/ees/index.shtml">EES-16</a>
·
<a href="/pages/licensing.html">License</a>
·
<a href="https://lagrit.lanl.gov/">Contact</a>
</p>
<p>&copy; 2019 Los Alamos National Laboratory</p>
<p>EES-16 | Computational Earth Science</p>
<p>LA-CC-15-069</p>
</div>
</footer>
<!-- Begin Navigation Bar -->
<div id="offcanvas" uk-offcanvas="mode: push; overlay: true" class="uk-offcanvas">
<div class="uk-offcanvas-bar">
<div class="uk-panel">
<ul class="uk-nav uk-nav-default tm-nav">
<form class="uk-search uk-search-default" action="https://lanl.github.io/LaGriT/search/">
<a href="" uk-search-icon></a>
<input class="uk-search-input" type="search" placeholder="" name="q" id="tipue_search_input_mobile">
</form>
<li class="uk-nav-header">General</li>
<li><a href="/">Home</a></li>
<li><a href="/pages/commands">Commands</a></li>
<li><a href="/pages/release">Release Notes</a></li>
<li><a href="/pages/publications">Publications</a></li>
<li><a href="http://github.com/lanl/LaGriT">GitHub</a></li>
</ul>
</div>
</div>
</div>
<!-- End Navigation Bar -->
</div>
</body>
</html>