No...<br>The GEdgeLoop.h<br><br><div class="gmail_quote">On Thu, May 10, 2012 at 4:09 PM, Guowei He <span dir="ltr"><<a href="mailto:rteycisy@gmail.com" target="_blank">rteycisy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
=.=<br><br>Never mind, I've found the GEdge.h<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Thu, May 10, 2012 at 3:58 PM, Guowei He <span dir="ltr"><<a href="mailto:rteycisy@gmail.com" target="_blank">rteycisy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear gmsh users and ,<br><br>When the following C++ code is executed to generate a simple rectangle with a circular hole in it, based on the sample given by <pre>
Takuya OSHIMA, Ph.D. in <a href="http://www.geuz.org/pipermail/gmsh/2011/006803.html" target="_blank">http://www.geuz.org/pipermail/gmsh/2011/006803.html</a></pre>
, warning message "Staring subloop x in Line Loop 1 (are you sure about this?) is prompted during the command "gmsh test.geo", though the geo graph looks fine, the test.geo generated contains some thing like Line Loop(1) = {1, 2, 3, 4, -6, -5}; where 1 2 3 4 are external boundaries and 5 6 are edges of the circle. However a nicer approach in gmsh scripting is do something like <br>
<br>// exterior boundary<br>ll1 = newll; Line Loop(ll1) = { l01, l02, l03, l04 };<br><br>// interstitial domain<br>s1 = news; Plane Surface(s1) = { ll1, beadSurfLoops[] };<br><br>Is there some corresponding "Loops" object in gmsh library or we only use something like "typedef std::vector<GEdge *> Lineloop;<br>
typedef std::vector<Lineloop> Loops;"?<br><br>Many thanks!<br><br>/////////////////////////////////////////////////////////////////// test.geo ////////////////////////////////////////////////////////////////////////////////<br>
cl1 = 0.08;<br>Point(1) = {9.9, 8, 0, cl1};<br>Point(2) = {-9.9, 8, 0, cl1};<br>Point(3) = {-9.9, -8, 0, cl1};<br>Point(4) = {9.9, -8, 0, cl1};<br>Point(5) = {5, 5, 0, cl1};<br>Point(6) = {5, 7.5, 0, cl1};<br>Point(7) = {5, 2.5, 0, cl1};<br>
Line(1) = {1, 2};<br>Line(2) = {2, 3};<br>Line(3) = {3, 4};<br>Line(4) = {4, 1};<br>Circle(5) = {6, 5, 7};<br>Circle(6) = {7, 5, 6};<br>Line Loop(1) = {1, 2, 3, 4, -6, -5};<br>Plane Surface(1) = {1};<br>Line Loop(2) = {5, 6};<br>
Plane Surface(2) = {2};<br>Physical Line("inlet") = {1};<br>Physical Line("outlet") = {3};<br>Physical Line("wall") = {2, 4};<br>Physical Surface("interstitial") = {1};<br>Physical Surface("beadface") = {2};<br>
<br><br><br>////////////////////////////////////////////////////////// rec.cpp //////////////////////////////////////////////////////////////////////////////////<br> // A simple Gmsh API demonstration program.<br>#include "Gmsh.h"<br>
#include "GModel.h"<br>#include "MElement.h"<br>#include "MVertex.h"<br>#include <iostream><br><br>typedef std::vector<GEdge *> Lineloop;<br>typedef std::vector<Lineloop> Loops;<br>
<br>void *addBead(GModel *m, Loops &l, double const &cx, double const &cy, double const &radius, double const &lc_bead) {<br> Lineloop b;<br> GVertex *gvc1c = m->addVertex(cx, cy, 0, lc_bead);<br>
GVertex *gvc1s = m->addVertex(cx, cy - radius, 0, lc_bead);<br> GVertex *gvc1e = m->addVertex(cx, cy + radius, 0, lc_bead);<br> GEdge *gec11 = m->addCircleArcCenter(gvc1s, gvc1c, gvc1e);<br> GEdge *gec12 = m->addCircleArcCenter(gvc1e, gvc1c, gvc1s);<br>
<br> b.push_back(gec11);<br> b.push_back(gec12);<br> l.push_back(b);<br>}<br> <br>int main(int argc, char **argv)<br>{<br> // Initialization.<br> GmshInitialize(argc, argv);<br> // Options may be set this way.<br>
// Output information messages generated by the Gmsh library.<br> GmshSetOption("General", "Terminal", 1.);<br> // Be verbose (output debug messages).<br> GmshSetOption("General", "Verbosity", 99.);<br>
// Create GModel (the Gmsh library core) instance.<br> GModel *m = new GModel;<br> // Choices are "Gmsh" and "OCC" if the Gmsh library is compiled with<br> // OpenCASCADE. Usually you want to use the "Gmsh" factory.<br>
m->setFactory("Gmsh");<br><br> // Add vertices. Equivalent .geo directives are<br> // cl1 = 0.1;<br> // Point(1) = {-1, -1, 0, cl1};<br> // Point(2) = {1, -1, 0, cl1};<br> // Point(3) = {1, 1, 0, cl1};<br>
// Point(4) = {-1, 1, 0, cl1};<br> // Point(5) = {0, 0, 0, cl1};<br> const double lc_wall = 0.08, lc_bead = 0.08;<br><br> // generating walls<br> const double xmin = 10, xmax = -10, ymin = 10, ymax = -10, dx = 0.1, dy = 2;<br>
<br> // corner points of rect domain<br> GVertex *gv1 = m->addVertex(xmin - dx, ymin - dy, 0, lc_wall);<br> GVertex *gv2 = m->addVertex(xmax + dx, ymin - dy, 0, lc_wall);<br> GVertex *gv3 = m->addVertex(xmax + dx, ymax + dy, 0, lc_wall);<br>
GVertex *gv4 = m->addVertex(xmin - dx, ymax + dy, 0, lc_wall);<br><br> // lines around the rect domain<br> GEdge *ge1 = m->addLine(gv1, gv2);<br> GEdge *ge2 = m->addLine(gv2, gv3);<br> GEdge *ge3 = m->addLine(gv3, gv4);<br>
GEdge *ge4 = m->addLine(gv4, gv1);<br><br> // // draw circle<br><br> Loops ls;<br><br> // exterior boundary<br> Lineloop tmp;<br> <br> tmp.push_back(ge1);<br> tmp.push_back(ge2);<br> tmp.push_back(ge3);<br> tmp.push_back(ge4);<br>
ls.push_back(tmp);<br> <br> // call the bead func<br> int nBeads = 1;<br> double radius = ymax / nBeads / 4;<br> double cx = xmin / 2, cy = ymin / 2;<br> for (int i = 0; i < nBeads; i++) {<br> addBead(m, ls, cx, cy, radius, lc_bead);<br>
cx += 3 * radius;<br> }<br> <br> <br> // interstitial domain<br> GFace *gf1 = m->addPlanarFace(ls);<br><br> // create faces of beads<br> Loops::iterator it = ls.begin();<br> it++;<br> std::vector<GRegion *> fbeads;<br>
Loops lst;<br> int pn_beadface = m->setPhysicalName(nf_bead, dim_face);<br> for (;it != ls.end(); it++) {<br> lst.push_back(*it);<br> GFace *gft = m->addPlanarFace(lst);<br> gft->addPhysicalEntity(pn_beadface);<br>
lst.pop_back();<br> }<br><br> // The geometry constructed by the operations above may be saved this way.<br> m->writeGEO("test.geo");<br><br> // Create surface (2-D) mesh. Pass 3 to mesh() if creating a volume<br>
// (3-D) mesh.<br> m->mesh(2);<br><br> // // The created mesh may be saved this way.<br> m->writeMSH("test.msh");<br><br><br><br> // Finalization.<br> delete m;<br> GmshFinalize();<br>}<span><font color="#888888"><br>
<br clear="all">
<br>-- <br>Kind regards,<br>Guowei He<br><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Kind regards,<br>Guowei He<br><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Kind regards,<br>Guowei He<br><br>